repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
classgraph/classgraph
src/main/java/nonapi/io/github/classgraph/utils/FastPathResolver.java
FastPathResolver.unescapePercentEncoding
private static void unescapePercentEncoding(final String path, final int startIdx, final int endIdx, final StringBuilder buf) { if (endIdx - startIdx == 3 && path.charAt(startIdx + 1) == '2' && path.charAt(startIdx + 2) == '0') { // Fast path for "%20" buf.append(' '); } else { final byte[] bytes = new byte[(endIdx - startIdx) / 3]; for (int i = startIdx, j = 0; i < endIdx; i += 3, j++) { final char c1 = path.charAt(i + 1); final char c2 = path.charAt(i + 2); final int digit1 = hexCharToInt(c1); final int digit2 = hexCharToInt(c2); bytes[j] = (byte) ((digit1 << 4) | digit2); } // Decode UTF-8 bytes String str = new String(bytes, StandardCharsets.UTF_8); // Turn forward slash / backslash back into %-encoding str = str.replace("/", "%2F").replace("\\", "%5C"); buf.append(str); } }
java
private static void unescapePercentEncoding(final String path, final int startIdx, final int endIdx, final StringBuilder buf) { if (endIdx - startIdx == 3 && path.charAt(startIdx + 1) == '2' && path.charAt(startIdx + 2) == '0') { // Fast path for "%20" buf.append(' '); } else { final byte[] bytes = new byte[(endIdx - startIdx) / 3]; for (int i = startIdx, j = 0; i < endIdx; i += 3, j++) { final char c1 = path.charAt(i + 1); final char c2 = path.charAt(i + 2); final int digit1 = hexCharToInt(c1); final int digit2 = hexCharToInt(c2); bytes[j] = (byte) ((digit1 << 4) | digit2); } // Decode UTF-8 bytes String str = new String(bytes, StandardCharsets.UTF_8); // Turn forward slash / backslash back into %-encoding str = str.replace("/", "%2F").replace("\\", "%5C"); buf.append(str); } }
[ "private", "static", "void", "unescapePercentEncoding", "(", "final", "String", "path", ",", "final", "int", "startIdx", ",", "final", "int", "endIdx", ",", "final", "StringBuilder", "buf", ")", "{", "if", "(", "endIdx", "-", "startIdx", "==", "3", "&&", "...
Unescape runs of percent encoding, e.g. "%20%43%20" -> " + " @param path the path @param startIdx the start index @param endIdx the end index @param buf the buf
[ "Unescape", "runs", "of", "percent", "encoding", "e", ".", "g", ".", "%20%43%20", "-", ">", "+" ]
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/utils/FastPathResolver.java#L113-L133
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/query/impl/Indexes.java
Indexes.matchIndex
public InternalIndex matchIndex(String pattern, QueryContext.IndexMatchHint matchHint) { if (matchHint == QueryContext.IndexMatchHint.EXACT_NAME) { return indexesByName.get(pattern); } else { return attributeIndexRegistry.match(pattern, matchHint); } }
java
public InternalIndex matchIndex(String pattern, QueryContext.IndexMatchHint matchHint) { if (matchHint == QueryContext.IndexMatchHint.EXACT_NAME) { return indexesByName.get(pattern); } else { return attributeIndexRegistry.match(pattern, matchHint); } }
[ "public", "InternalIndex", "matchIndex", "(", "String", "pattern", ",", "QueryContext", ".", "IndexMatchHint", "matchHint", ")", "{", "if", "(", "matchHint", "==", "QueryContext", ".", "IndexMatchHint", ".", "EXACT_NAME", ")", "{", "return", "indexesByName", ".", ...
Matches an index for the given pattern and match hint. @param pattern the pattern to match an index for. May be either an attribute name or an exact index name. @param matchHint the match hint. @return the matched index or {@code null} if nothing matched. @see QueryContext.IndexMatchHint @see Indexes#matchIndex
[ "Matches", "an", "index", "for", "the", "given", "pattern", "and", "match", "hint", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/query/impl/Indexes.java#L303-L309
classgraph/classgraph
src/main/java/nonapi/io/github/classgraph/json/JSONSerializer.java
JSONSerializer.serializeFromField
public static String serializeFromField(final Object containingObject, final String fieldName, final int indentWidth, final boolean onlySerializePublicFields, final ClassFieldCache classFieldCache) { final FieldTypeInfo fieldResolvedTypeInfo = classFieldCache .get(containingObject.getClass()).fieldNameToFieldTypeInfo.get(fieldName); if (fieldResolvedTypeInfo == null) { throw new IllegalArgumentException("Class " + containingObject.getClass().getName() + " does not have a field named \"" + fieldName + "\""); } final Field field = fieldResolvedTypeInfo.field; if (!JSONUtils.fieldIsSerializable(field, /* onlySerializePublicFields = */ false)) { throw new IllegalArgumentException("Field " + containingObject.getClass().getName() + "." + fieldName + " needs to be accessible, non-transient, and non-final"); } Object fieldValue; try { fieldValue = JSONUtils.getFieldValue(containingObject, field); } catch (final IllegalAccessException e) { throw new IllegalArgumentException("Could get value of field " + fieldName, e); } return serializeObject(fieldValue, indentWidth, onlySerializePublicFields, classFieldCache); }
java
public static String serializeFromField(final Object containingObject, final String fieldName, final int indentWidth, final boolean onlySerializePublicFields, final ClassFieldCache classFieldCache) { final FieldTypeInfo fieldResolvedTypeInfo = classFieldCache .get(containingObject.getClass()).fieldNameToFieldTypeInfo.get(fieldName); if (fieldResolvedTypeInfo == null) { throw new IllegalArgumentException("Class " + containingObject.getClass().getName() + " does not have a field named \"" + fieldName + "\""); } final Field field = fieldResolvedTypeInfo.field; if (!JSONUtils.fieldIsSerializable(field, /* onlySerializePublicFields = */ false)) { throw new IllegalArgumentException("Field " + containingObject.getClass().getName() + "." + fieldName + " needs to be accessible, non-transient, and non-final"); } Object fieldValue; try { fieldValue = JSONUtils.getFieldValue(containingObject, field); } catch (final IllegalAccessException e) { throw new IllegalArgumentException("Could get value of field " + fieldName, e); } return serializeObject(fieldValue, indentWidth, onlySerializePublicFields, classFieldCache); }
[ "public", "static", "String", "serializeFromField", "(", "final", "Object", "containingObject", ",", "final", "String", "fieldName", ",", "final", "int", "indentWidth", ",", "final", "boolean", "onlySerializePublicFields", ",", "final", "ClassFieldCache", "classFieldCac...
Recursively serialize the named field of an object, skipping transient and final fields. @param containingObject The object containing the field value to serialize. @param fieldName The name of the field to serialize. @param indentWidth If indentWidth == 0, no prettyprinting indentation is performed, otherwise this specifies the number of spaces to indent each level of JSON. @param onlySerializePublicFields If true, only serialize public fields. @param classFieldCache The class field cache. Reusing this cache will increase the speed if many JSON documents of the same type need to be produced. @return The object graph in JSON form. @throws IllegalArgumentException If anything goes wrong during serialization.
[ "Recursively", "serialize", "the", "named", "field", "of", "an", "object", "skipping", "transient", "and", "final", "fields", "." ]
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/json/JSONSerializer.java#L547-L567
alkacon/opencms-core
src-setup/org/opencms/setup/ui/CmsSetupErrorDialog.java
CmsSetupErrorDialog.showErrorDialog
public static void showErrorDialog(String message, String details) { Window window = prepareWindow(DialogWidth.wide); window.setCaption("Error"); window.setContent(new CmsSetupErrorDialog(message, details, null, window)); A_CmsUI.get().addWindow(window); }
java
public static void showErrorDialog(String message, String details) { Window window = prepareWindow(DialogWidth.wide); window.setCaption("Error"); window.setContent(new CmsSetupErrorDialog(message, details, null, window)); A_CmsUI.get().addWindow(window); }
[ "public", "static", "void", "showErrorDialog", "(", "String", "message", ",", "String", "details", ")", "{", "Window", "window", "=", "prepareWindow", "(", "DialogWidth", ".", "wide", ")", ";", "window", ".", "setCaption", "(", "\"Error\"", ")", ";", "window...
Shows error dialog, manually supplying details instead of getting them from an exception stack trace. @param message the error message @param details the details
[ "Shows", "error", "dialog", "manually", "supplying", "details", "instead", "of", "getting", "them", "from", "an", "exception", "stack", "trace", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/ui/CmsSetupErrorDialog.java#L154-L161
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/jetty/servlet/ServletHttpContext.java
ServletHttpContext.addServlet
public synchronized ServletHolder addServlet(String pathSpec, String className) throws ClassNotFoundException, InstantiationException, IllegalAccessException { return addServlet(className,pathSpec,className); }
java
public synchronized ServletHolder addServlet(String pathSpec, String className) throws ClassNotFoundException, InstantiationException, IllegalAccessException { return addServlet(className,pathSpec,className); }
[ "public", "synchronized", "ServletHolder", "addServlet", "(", "String", "pathSpec", ",", "String", "className", ")", "throws", "ClassNotFoundException", ",", "InstantiationException", ",", "IllegalAccessException", "{", "return", "addServlet", "(", "className", ",", "pa...
Add a servlet to the context. Conveniance method. If no ServletHandler is found in the context, a new one is added. @param pathSpec The pathspec within the context @param className The classname of the servlet. @return The ServletHolder. @exception ClassNotFoundException @exception InstantiationException @exception IllegalAccessException
[ "Add", "a", "servlet", "to", "the", "context", ".", "Conveniance", "method", ".", "If", "no", "ServletHandler", "is", "found", "in", "the", "context", "a", "new", "one", "is", "added", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/jetty/servlet/ServletHttpContext.java#L90-L97
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.deleteUser
public void deleteUser(CmsUUID userId, CmsUUID replacementId) throws CmsException { m_securityManager.deleteUser(m_context, userId, replacementId); }
java
public void deleteUser(CmsUUID userId, CmsUUID replacementId) throws CmsException { m_securityManager.deleteUser(m_context, userId, replacementId); }
[ "public", "void", "deleteUser", "(", "CmsUUID", "userId", ",", "CmsUUID", "replacementId", ")", "throws", "CmsException", "{", "m_securityManager", ".", "deleteUser", "(", "m_context", ",", "userId", ",", "replacementId", ")", ";", "}" ]
Deletes a user, where all permissions and resources attributes of the user were transfered to a replacement user.<p> @param userId the id of the user to be deleted @param replacementId the id of the user to be transfered, can be <code>null</code> @throws CmsException if operation was not successful
[ "Deletes", "a", "user", "where", "all", "permissions", "and", "resources", "attributes", "of", "the", "user", "were", "transfered", "to", "a", "replacement", "user", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L1111-L1114
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/convert/MultipleFieldConverter.java
MultipleFieldConverter.setState
public int setState(boolean state, boolean bDisplayOption, int iMoveMode) { // Must be overidden m_bSetData = true; // Make sure getNextConverter is called correctly (if it is called). int iErrorCode = super.setState(state, bDisplayOption, iMoveMode); m_bSetData = false; return iErrorCode; }
java
public int setState(boolean state, boolean bDisplayOption, int iMoveMode) { // Must be overidden m_bSetData = true; // Make sure getNextConverter is called correctly (if it is called). int iErrorCode = super.setState(state, bDisplayOption, iMoveMode); m_bSetData = false; return iErrorCode; }
[ "public", "int", "setState", "(", "boolean", "state", ",", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "// Must be overidden", "m_bSetData", "=", "true", ";", "// Make sure getNextConverter is called correctly (if it is called).", "int", "iErrorCode", ...
For binary fields, set the current state. @param state The state to set this field. @param bDisplayOption Display changed fields if true. @param iMoveMode The move mode. @return The error code (or NORMAL_RETURN).
[ "For", "binary", "fields", "set", "the", "current", "state", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/MultipleFieldConverter.java#L143-L149
apache/incubator-druid
core/src/main/java/org/apache/druid/concurrent/Threads.java
Threads.sleepFor
public static void sleepFor(long sleepTime, TimeUnit unit) throws InterruptedException { if (Thread.interrupted()) { throw new InterruptedException(); } if (sleepTime <= 0) { return; } long sleepTimeLimitNanos = System.nanoTime() + unit.toNanos(sleepTime); while (true) { long sleepTimeoutNanos = sleepTimeLimitNanos - System.nanoTime(); if (sleepTimeoutNanos <= 0) { return; } LockSupport.parkNanos(sleepTimeoutNanos); if (Thread.interrupted()) { throw new InterruptedException(); } } }
java
public static void sleepFor(long sleepTime, TimeUnit unit) throws InterruptedException { if (Thread.interrupted()) { throw new InterruptedException(); } if (sleepTime <= 0) { return; } long sleepTimeLimitNanos = System.nanoTime() + unit.toNanos(sleepTime); while (true) { long sleepTimeoutNanos = sleepTimeLimitNanos - System.nanoTime(); if (sleepTimeoutNanos <= 0) { return; } LockSupport.parkNanos(sleepTimeoutNanos); if (Thread.interrupted()) { throw new InterruptedException(); } } }
[ "public", "static", "void", "sleepFor", "(", "long", "sleepTime", ",", "TimeUnit", "unit", ")", "throws", "InterruptedException", "{", "if", "(", "Thread", ".", "interrupted", "(", ")", ")", "{", "throw", "new", "InterruptedException", "(", ")", ";", "}", ...
Equivalent of {@link Thread#sleep(long)} with arguments and semantics of timed wait methods in classes from {@link java.util.concurrent} (like {@link java.util.concurrent.Semaphore#tryAcquire(long, TimeUnit)}, {@link java.util.concurrent.locks.Lock#tryLock(long, TimeUnit)}, etc.): if the sleepTime argument is negative or zero, the method returns immediately. {@link Thread#sleep}, on the contrary, throws an IllegalArgumentException if the argument is negative and attempts to unschedule the thread if the argument is zero. @throws InterruptedException if the current thread is interrupted when this method is called or during sleeping.
[ "Equivalent", "of", "{", "@link", "Thread#sleep", "(", "long", ")", "}", "with", "arguments", "and", "semantics", "of", "timed", "wait", "methods", "in", "classes", "from", "{", "@link", "java", ".", "util", ".", "concurrent", "}", "(", "like", "{", "@li...
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/concurrent/Threads.java#L37-L56
jbundle/jbundle
thin/base/util/util/src/main/java/org/jbundle/thin/base/util/Application.java
Application.setLanguage
public void setLanguage(String language) { Locale currentLocale = null; if (language == null) language = this.getProperty(Params.LANGUAGE); if (language != null) { currentLocale = new Locale(language, Constants.BLANK); m_resources = null; } if (currentLocale == null) currentLocale = Locale.getDefault(); ResourceBundle resourcesOld = m_resources; String strResourcesName = this.getProperty(Params.RESOURCE); m_resources = this.getResources(strResourcesName, true); if (m_resources == null) m_resources = resourcesOld; this.setProperty(Params.LANGUAGE, language); }
java
public void setLanguage(String language) { Locale currentLocale = null; if (language == null) language = this.getProperty(Params.LANGUAGE); if (language != null) { currentLocale = new Locale(language, Constants.BLANK); m_resources = null; } if (currentLocale == null) currentLocale = Locale.getDefault(); ResourceBundle resourcesOld = m_resources; String strResourcesName = this.getProperty(Params.RESOURCE); m_resources = this.getResources(strResourcesName, true); if (m_resources == null) m_resources = resourcesOld; this.setProperty(Params.LANGUAGE, language); }
[ "public", "void", "setLanguage", "(", "String", "language", ")", "{", "Locale", "currentLocale", "=", "null", ";", "if", "(", "language", "==", "null", ")", "language", "=", "this", ".", "getProperty", "(", "Params", ".", "LANGUAGE", ")", ";", "if", "(",...
Set the current language. Change the current resource bundle to the new language. <p>In your overriding code you might convert the actual language names to the two letter code: <code> if (language != null) if (language.length() > 2) if (language.indexOf('_') == -1) language = this.findLocaleFromLanguage(language); </code> <p>In your code, you should update all the current display fields when the language is changed. @param language java.lang.String The language code.
[ "Set", "the", "current", "language", ".", "Change", "the", "current", "resource", "bundle", "to", "the", "new", "language", ".", "<p", ">", "In", "your", "overriding", "code", "you", "might", "convert", "the", "actual", "language", "names", "to", "the", "t...
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/util/util/src/main/java/org/jbundle/thin/base/util/Application.java#L816-L834
landawn/AbacusUtil
src/com/landawn/abacus/util/Primitives.java
Primitives.box
@SafeVarargs public static Long[] box(final long... a) { if (a == null) { return null; } return box(a, 0, a.length); }
java
@SafeVarargs public static Long[] box(final long... a) { if (a == null) { return null; } return box(a, 0, a.length); }
[ "@", "SafeVarargs", "public", "static", "Long", "[", "]", "box", "(", "final", "long", "...", "a", ")", "{", "if", "(", "a", "==", "null", ")", "{", "return", "null", ";", "}", "return", "box", "(", "a", ",", "0", ",", "a", ".", "length", ")", ...
<p> Converts an array of primitive longs to objects. </p> <p> This method returns {@code null} for a {@code null} input array. </p> @param a a {@code long} array @return a {@code Long} array, {@code null} if null array input
[ "<p", ">", "Converts", "an", "array", "of", "primitive", "longs", "to", "objects", ".", "<", "/", "p", ">" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Primitives.java#L313-L320
landawn/AbacusUtil
src/com/landawn/abacus/util/Multiset.java
Multiset.computeIfAbsent
public <E extends Exception> int computeIfAbsent(T e, Try.Function<? super T, Integer, E> mappingFunction) throws E { N.checkArgNotNull(mappingFunction); final int oldValue = get(e); if (oldValue > 0) { return oldValue; } final int newValue = mappingFunction.apply(e); if (newValue > 0) { set(e, newValue); } return newValue; }
java
public <E extends Exception> int computeIfAbsent(T e, Try.Function<? super T, Integer, E> mappingFunction) throws E { N.checkArgNotNull(mappingFunction); final int oldValue = get(e); if (oldValue > 0) { return oldValue; } final int newValue = mappingFunction.apply(e); if (newValue > 0) { set(e, newValue); } return newValue; }
[ "public", "<", "E", "extends", "Exception", ">", "int", "computeIfAbsent", "(", "T", "e", ",", "Try", ".", "Function", "<", "?", "super", "T", ",", "Integer", ",", "E", ">", "mappingFunction", ")", "throws", "E", "{", "N", ".", "checkArgNotNull", "(", ...
The implementation is equivalent to performing the following steps for this Multiset: <pre> final int oldValue = get(e); if (oldValue > 0) { return oldValue; } final int newValue = mappingFunction.apply(e); if (newValue > 0) { set(e, newValue); } return newValue; </pre> @param e @param mappingFunction @return
[ "The", "implementation", "is", "equivalent", "to", "performing", "the", "following", "steps", "for", "this", "Multiset", ":" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Multiset.java#L1239-L1255
akarnokd/ixjava
src/main/java/ix/Ix.java
Ix.zipWith
public final <U, R> Ix<R> zipWith(Iterable<U> other, IxFunction2<? super T, ? super U, ? extends R> zipper) { return zip(this, other, zipper); }
java
public final <U, R> Ix<R> zipWith(Iterable<U> other, IxFunction2<? super T, ? super U, ? extends R> zipper) { return zip(this, other, zipper); }
[ "public", "final", "<", "U", ",", "R", ">", "Ix", "<", "R", ">", "zipWith", "(", "Iterable", "<", "U", ">", "other", ",", "IxFunction2", "<", "?", "super", "T", ",", "?", "super", "U", ",", "?", "extends", "R", ">", "zipper", ")", "{", "return"...
Combines the next element from this and the other source Iterable via a zipper function. <p> If one of the source Iterables is sorter the sequence terminates eagerly. <p> The result's iterator() doesn't support remove(). @param <U> the other source's element type @param <R> the result value type @param other the the other source Iterable @param zipper the function that takes one from each source, not null @return the new Ix instance @throws NullPointerException if other or zipper is null @since 1.0
[ "Combines", "the", "next", "element", "from", "this", "and", "the", "other", "source", "Iterable", "via", "a", "zipper", "function", ".", "<p", ">", "If", "one", "of", "the", "source", "Iterables", "is", "sorter", "the", "sequence", "terminates", "eagerly", ...
train
https://github.com/akarnokd/ixjava/blob/add721bba550c36541faa450e40a975bb65e78d7/src/main/java/ix/Ix.java#L2238-L2240
Baidu-AIP/java-sdk
src/main/java/com/baidu/aip/contentcensor/AipContentCensor.java
AipContentCensor.imageCensorUserDefined
public JSONObject imageCensorUserDefined(String image, EImgType type, HashMap<String, String> options) { if (type == EImgType.FILE) { try { byte[] imgData = Util.readFileByBytes(image); return imageCensorUserDefined(imgData, options); } catch (IOException e) { return AipError.IMAGE_READ_ERROR.toJsonResult(); } } // url AipRequest request = new AipRequest(); request.addBody("imgUrl", image); return imageCensorUserDefinedHelper(request, options); }
java
public JSONObject imageCensorUserDefined(String image, EImgType type, HashMap<String, String> options) { if (type == EImgType.FILE) { try { byte[] imgData = Util.readFileByBytes(image); return imageCensorUserDefined(imgData, options); } catch (IOException e) { return AipError.IMAGE_READ_ERROR.toJsonResult(); } } // url AipRequest request = new AipRequest(); request.addBody("imgUrl", image); return imageCensorUserDefinedHelper(request, options); }
[ "public", "JSONObject", "imageCensorUserDefined", "(", "String", "image", ",", "EImgType", "type", ",", "HashMap", "<", "String", ",", "String", ">", "options", ")", "{", "if", "(", "type", "==", "EImgType", ".", "FILE", ")", "{", "try", "{", "byte", "["...
图像审核接口 本接口除了支持自定义配置外,还对返回结果进行了总体的包装,按照用户在控制台中配置的规则直接返回是否合规,如果不合规则指出具体不合规的内容。 @param image 本地图片路径或图片url @param type image参数类型:FILE或URL @param options 可选参数 @return JSONObject
[ "图像审核接口", "本接口除了支持自定义配置外,还对返回结果进行了总体的包装,按照用户在控制台中配置的规则直接返回是否合规,如果不合规则指出具体不合规的内容。" ]
train
https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/contentcensor/AipContentCensor.java#L299-L315
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/preprocessors/DefaultContextPreprocessor.java
DefaultContextPreprocessor.isNumber
private boolean isNumber(String in1) { //noinspection LoopStatementThatDoesntLoop for (StringTokenizer stringTokenizer = new StringTokenizer(in1, numberCharacters); stringTokenizer.hasMoreTokens(); ) { return false; } return true; }
java
private boolean isNumber(String in1) { //noinspection LoopStatementThatDoesntLoop for (StringTokenizer stringTokenizer = new StringTokenizer(in1, numberCharacters); stringTokenizer.hasMoreTokens(); ) { return false; } return true; }
[ "private", "boolean", "isNumber", "(", "String", "in1", ")", "{", "//noinspection LoopStatementThatDoesntLoop\r", "for", "(", "StringTokenizer", "stringTokenizer", "=", "new", "StringTokenizer", "(", "in1", ",", "numberCharacters", ")", ";", "stringTokenizer", ".", "h...
Checks whether input string contains a number or not. @param in1 input string @return false if it contains a number
[ "Checks", "whether", "input", "string", "contains", "a", "number", "or", "not", "." ]
train
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/preprocessors/DefaultContextPreprocessor.java#L736-L742
liuyukuai/commons
commons-core/src/main/java/com/itxiaoer/commons/core/date/LocalDateUtil.java
LocalDateUtil.parse
public static LocalDate parse(String localDate, String pattern) { return LocalDate.from(DateTimeFormatter.ofPattern(pattern).parse(localDate)); }
java
public static LocalDate parse(String localDate, String pattern) { return LocalDate.from(DateTimeFormatter.ofPattern(pattern).parse(localDate)); }
[ "public", "static", "LocalDate", "parse", "(", "String", "localDate", ",", "String", "pattern", ")", "{", "return", "LocalDate", ".", "from", "(", "DateTimeFormatter", ".", "ofPattern", "(", "pattern", ")", ".", "parse", "(", "localDate", ")", ")", ";", "}...
格式化时间 @param localDate 时间 @param pattern 时间格式 @return 时间字符串
[ "格式化时间" ]
train
https://github.com/liuyukuai/commons/blob/ba67eddb542446b12f419f1866dbaa82e47fbf35/commons-core/src/main/java/com/itxiaoer/commons/core/date/LocalDateUtil.java#L119-L121
alipay/sofa-rpc
extension-impl/fault-tolerance/src/main/java/com/alipay/sofa/rpc/client/aft/impl/ServiceHorizontalMeasureStrategy.java
ServiceHorizontalMeasureStrategy.getInvocationLeastWindowCount
private long getInvocationLeastWindowCount(InvocationStat invocationStat, Integer weight, long leastWindowCount) { InvocationStatDimension statDimension = invocationStat.getDimension(); Integer originWeight = statDimension.getOriginWeight(); if (originWeight == 0) { LOGGER.errorWithApp(statDimension.getAppName(), "originWeight is 0,but is invoked. service[" + statDimension.getService() + "];ip[" + statDimension.getIp() + "]."); return -1; } else if (weight == null) { //如果地址还未被调控过或者已经恢复。 return leastWindowCount; } else if (weight == -1) { //如果地址被剔除 return -1; } double rate = CalculateUtils.divide(weight, originWeight); long invocationLeastWindowCount = CalculateUtils.multiply(leastWindowCount, rate); return invocationLeastWindowCount < LEGAL_LEAST_WINDOW_COUNT ? LEGAL_LEAST_WINDOW_COUNT : invocationLeastWindowCount; }
java
private long getInvocationLeastWindowCount(InvocationStat invocationStat, Integer weight, long leastWindowCount) { InvocationStatDimension statDimension = invocationStat.getDimension(); Integer originWeight = statDimension.getOriginWeight(); if (originWeight == 0) { LOGGER.errorWithApp(statDimension.getAppName(), "originWeight is 0,but is invoked. service[" + statDimension.getService() + "];ip[" + statDimension.getIp() + "]."); return -1; } else if (weight == null) { //如果地址还未被调控过或者已经恢复。 return leastWindowCount; } else if (weight == -1) { //如果地址被剔除 return -1; } double rate = CalculateUtils.divide(weight, originWeight); long invocationLeastWindowCount = CalculateUtils.multiply(leastWindowCount, rate); return invocationLeastWindowCount < LEGAL_LEAST_WINDOW_COUNT ? LEGAL_LEAST_WINDOW_COUNT : invocationLeastWindowCount; }
[ "private", "long", "getInvocationLeastWindowCount", "(", "InvocationStat", "invocationStat", ",", "Integer", "weight", ",", "long", "leastWindowCount", ")", "{", "InvocationStatDimension", "statDimension", "=", "invocationStat", ".", "getDimension", "(", ")", ";", "Inte...
根据Invocation的实际权重计算该Invocation的实际最小窗口调用次数 如果目标地址原始权重为0,或者地址已经被剔除则返回-1。 @param invocationStat InvocationStat @param weight weight @param leastWindowCount original least Window count @return leastWindowCount
[ "根据Invocation的实际权重计算该Invocation的实际最小窗口调用次数", "如果目标地址原始权重为0,或者地址已经被剔除则返回", "-", "1。" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/fault-tolerance/src/main/java/com/alipay/sofa/rpc/client/aft/impl/ServiceHorizontalMeasureStrategy.java#L294-L312
alipay/sofa-rpc
extension-impl/remoting-http/src/main/java/com/alipay/sofa/rpc/transport/http/AbstractHttp2ClientTransport.java
AbstractHttp2ClientTransport.doInvokeSync
protected SofaResponse doInvokeSync(SofaRequest request, int timeout) throws InterruptedException, ExecutionException, TimeoutException { HttpResponseFuture future = new HttpResponseFuture(request, timeout); AbstractHttpClientHandler callback = new SyncInvokeClientHandler(transportConfig.getConsumerConfig(), transportConfig.getProviderInfo(), future, request, RpcInternalContext.getContext(), ClassLoaderUtils.getCurrentClassLoader()); future.setSentTime(); doSend(request, callback, timeout); future.setSentTime(); return future.getSofaResponse(timeout, TimeUnit.MILLISECONDS); }
java
protected SofaResponse doInvokeSync(SofaRequest request, int timeout) throws InterruptedException, ExecutionException, TimeoutException { HttpResponseFuture future = new HttpResponseFuture(request, timeout); AbstractHttpClientHandler callback = new SyncInvokeClientHandler(transportConfig.getConsumerConfig(), transportConfig.getProviderInfo(), future, request, RpcInternalContext.getContext(), ClassLoaderUtils.getCurrentClassLoader()); future.setSentTime(); doSend(request, callback, timeout); future.setSentTime(); return future.getSofaResponse(timeout, TimeUnit.MILLISECONDS); }
[ "protected", "SofaResponse", "doInvokeSync", "(", "SofaRequest", "request", ",", "int", "timeout", ")", "throws", "InterruptedException", ",", "ExecutionException", ",", "TimeoutException", "{", "HttpResponseFuture", "future", "=", "new", "HttpResponseFuture", "(", "req...
同步调用 @param request 请求对象 @param timeout 超时时间(毫秒) @return 返回对象 @throws InterruptedException 中断异常 @throws ExecutionException 执行异常 @throws TimeoutException 超时异常
[ "同步调用" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/remoting-http/src/main/java/com/alipay/sofa/rpc/transport/http/AbstractHttp2ClientTransport.java#L274-L284
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/Parameters.java
Parameters.setLong
@NonNull public Parameters setLong(@NonNull String name, long value) { return setValue(name, value); }
java
@NonNull public Parameters setLong(@NonNull String name, long value) { return setValue(name, value); }
[ "@", "NonNull", "public", "Parameters", "setLong", "(", "@", "NonNull", "String", "name", ",", "long", "value", ")", "{", "return", "setValue", "(", "name", ",", "value", ")", ";", "}" ]
Set an long value to the query parameter referenced by the given name. A query parameter is defined by using the Expression's parameter(String name) function. @param name The parameter name. @param value The long value. @return The self object.
[ "Set", "an", "long", "value", "to", "the", "query", "parameter", "referenced", "by", "the", "given", "name", ".", "A", "query", "parameter", "is", "defined", "by", "using", "the", "Expression", "s", "parameter", "(", "String", "name", ")", "function", "." ...
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/Parameters.java#L118-L121
DV8FromTheWorld/JDA
src/main/java/net/dv8tion/jda/core/utils/WidgetUtil.java
WidgetUtil.getPremadeWidgetHtml
public static String getPremadeWidgetHtml(Guild guild, WidgetTheme theme, int width, int height) { Checks.notNull(guild, "Guild"); return getPremadeWidgetHtml(guild.getId(), theme, width, height); }
java
public static String getPremadeWidgetHtml(Guild guild, WidgetTheme theme, int width, int height) { Checks.notNull(guild, "Guild"); return getPremadeWidgetHtml(guild.getId(), theme, width, height); }
[ "public", "static", "String", "getPremadeWidgetHtml", "(", "Guild", "guild", ",", "WidgetTheme", "theme", ",", "int", "width", ",", "int", "height", ")", "{", "Checks", ".", "notNull", "(", "guild", ",", "\"Guild\"", ")", ";", "return", "getPremadeWidgetHtml",...
Gets the pre-made HTML Widget for the specified guild using the specified settings. The widget will only display correctly if the guild in question has the Widget enabled. @param guild the guild @param theme the theme, light or dark @param width the width of the widget @param height the height of the widget @return a String containing the pre-made widget with the supplied settings
[ "Gets", "the", "pre", "-", "made", "HTML", "Widget", "for", "the", "specified", "guild", "using", "the", "specified", "settings", ".", "The", "widget", "will", "only", "display", "correctly", "if", "the", "guild", "in", "question", "has", "the", "Widget", ...
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/utils/WidgetUtil.java#L106-L110
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_rule_ruleId_PUT
public void billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_rule_ruleId_PUT(String billingAccount, String serviceName, Long dialplanId, Long extensionId, Long ruleId, OvhOvhPabxDialplanExtensionRule body) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/rule/{ruleId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId, extensionId, ruleId); exec(qPath, "PUT", sb.toString(), body); }
java
public void billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_rule_ruleId_PUT(String billingAccount, String serviceName, Long dialplanId, Long extensionId, Long ruleId, OvhOvhPabxDialplanExtensionRule body) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/rule/{ruleId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, dialplanId, extensionId, ruleId); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "billingAccount_ovhPabx_serviceName_dialplan_dialplanId_extension_extensionId_rule_ruleId_PUT", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "dialplanId", ",", "Long", "extensionId", ",", "Long", "ruleId", ",", "OvhOvhPabxDialpla...
Alter this object properties REST: PUT /telephony/{billingAccount}/ovhPabx/{serviceName}/dialplan/{dialplanId}/extension/{extensionId}/rule/{ruleId} @param body [required] New object properties @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param dialplanId [required] @param extensionId [required] @param ruleId [required]
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L7261-L7265
structr/structr
structr-core/src/main/java/org/structr/core/entity/SchemaNode.java
SchemaNode.throwExceptionIfTypeAlreadyExists
private void throwExceptionIfTypeAlreadyExists() throws FrameworkException { if (Services.getInstance().isInitialized() && ! Services.getInstance().isOverridingSchemaTypesAllowed()) { final String typeName = getProperty(name); // add type names to list of forbidden entity names if (EntityNameBlacklist.contains(typeName)) { throw new FrameworkException(422, "Type '" + typeName + "' already exists. To prevent unwanted/unexpected behavior this is forbidden."); } /* // add type names to list of forbidden entity names if (StructrApp.getConfiguration().getNodeEntities().containsKey(typeName)) { throw new FrameworkException(422, "Type '" + typeName + "' already exists. To prevent unwanted/unexpected behavior this is forbidden."); } // add interfaces to list of forbidden entity names if (StructrApp.getConfiguration().getInterfaces().containsKey(typeName)) { throw new FrameworkException(422, "Type '" + typeName + "' already exists. To prevent unwanted/unexpected behavior this is forbidden."); } */ } }
java
private void throwExceptionIfTypeAlreadyExists() throws FrameworkException { if (Services.getInstance().isInitialized() && ! Services.getInstance().isOverridingSchemaTypesAllowed()) { final String typeName = getProperty(name); // add type names to list of forbidden entity names if (EntityNameBlacklist.contains(typeName)) { throw new FrameworkException(422, "Type '" + typeName + "' already exists. To prevent unwanted/unexpected behavior this is forbidden."); } /* // add type names to list of forbidden entity names if (StructrApp.getConfiguration().getNodeEntities().containsKey(typeName)) { throw new FrameworkException(422, "Type '" + typeName + "' already exists. To prevent unwanted/unexpected behavior this is forbidden."); } // add interfaces to list of forbidden entity names if (StructrApp.getConfiguration().getInterfaces().containsKey(typeName)) { throw new FrameworkException(422, "Type '" + typeName + "' already exists. To prevent unwanted/unexpected behavior this is forbidden."); } */ } }
[ "private", "void", "throwExceptionIfTypeAlreadyExists", "(", ")", "throws", "FrameworkException", "{", "if", "(", "Services", ".", "getInstance", "(", ")", ".", "isInitialized", "(", ")", "&&", "!", "Services", ".", "getInstance", "(", ")", ".", "isOverridingSch...
If the system is fully initialized (and no schema replacement is currently active), we disallow overriding (known) existing types so we can prevent unwanted behavior. If a user were to create a type 'Html', he could cripple Structrs Page rendering completely. This is a fix for all types in the Structr context - this does not help if the user creates a type named 'String' or 'Object'. That could still lead to unexpected behavior. @throws FrameworkException if a pre-existing type is encountered
[ "If", "the", "system", "is", "fully", "initialized", "(", "and", "no", "schema", "replacement", "is", "currently", "active", ")", "we", "disallow", "overriding", "(", "known", ")", "existing", "types", "so", "we", "can", "prevent", "unwanted", "behavior", "....
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/core/entity/SchemaNode.java#L730-L753
wildfly/wildfly-core
cli/src/main/java/org/jboss/as/cli/Util.java
Util.replaceFilePathsWithBytes
public static void replaceFilePathsWithBytes(ModelNode request, ModelNode opDescOutcome) throws CommandFormatException { ModelNode requestProps = opDescOutcome.get("result", "request-properties"); for (Property prop : requestProps.asPropertyList()) { ModelNode typeDesc = prop.getValue().get("type"); if (typeDesc.getType() == ModelType.TYPE && typeDesc.asType() == ModelType.BYTES && request.hasDefined(prop.getName())) { String filePath = request.get(prop.getName()).asString(); File localFile = new File(filePath); if (!localFile.exists()) continue; try { request.get(prop.getName()).set(Util.readBytes(localFile)); } catch (OperationFormatException e) { throw new CommandFormatException(e); } } } }
java
public static void replaceFilePathsWithBytes(ModelNode request, ModelNode opDescOutcome) throws CommandFormatException { ModelNode requestProps = opDescOutcome.get("result", "request-properties"); for (Property prop : requestProps.asPropertyList()) { ModelNode typeDesc = prop.getValue().get("type"); if (typeDesc.getType() == ModelType.TYPE && typeDesc.asType() == ModelType.BYTES && request.hasDefined(prop.getName())) { String filePath = request.get(prop.getName()).asString(); File localFile = new File(filePath); if (!localFile.exists()) continue; try { request.get(prop.getName()).set(Util.readBytes(localFile)); } catch (OperationFormatException e) { throw new CommandFormatException(e); } } } }
[ "public", "static", "void", "replaceFilePathsWithBytes", "(", "ModelNode", "request", ",", "ModelNode", "opDescOutcome", ")", "throws", "CommandFormatException", "{", "ModelNode", "requestProps", "=", "opDescOutcome", ".", "get", "(", "\"result\"", ",", "\"request-prope...
For any request params that are of type BYTES, replace the file path with the bytes from the file
[ "For", "any", "request", "params", "that", "are", "of", "type", "BYTES", "replace", "the", "file", "path", "with", "the", "bytes", "from", "the", "file" ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/Util.java#L1693-L1710
Backendless/Android-SDK
src/com/backendless/Media.java
Media.configureForPublish
public void configureForPublish( Context context, SurfaceView mSurfaceView, DisplayOrientation orientation ) { session = getSession( context, mSurfaceView, orientation.getValue() ); rtspClient = getRtspClient( context, session ); }
java
public void configureForPublish( Context context, SurfaceView mSurfaceView, DisplayOrientation orientation ) { session = getSession( context, mSurfaceView, orientation.getValue() ); rtspClient = getRtspClient( context, session ); }
[ "public", "void", "configureForPublish", "(", "Context", "context", ",", "SurfaceView", "mSurfaceView", ",", "DisplayOrientation", "orientation", ")", "{", "session", "=", "getSession", "(", "context", ",", "mSurfaceView", ",", "orientation", ".", "getValue", "(", ...
<p> default video quality to 176x144 20fps 500Kbps<br/> default audio quality to 16 000 sampleRate 272000 bitRate </p>
[ "<p", ">", "default", "video", "quality", "to", "176x144", "20fps", "500Kbps<br", "/", ">", "default", "audio", "quality", "to", "16", "000", "sampleRate", "272000", "bitRate", "<", "/", "p", ">" ]
train
https://github.com/Backendless/Android-SDK/blob/3af1e9a378f19d890db28a833f7fc8595b924cc3/src/com/backendless/Media.java#L198-L202
cloudfoundry/uaa
server/src/main/java/org/cloudfoundry/identity/uaa/provider/saml/NonSnarlMetadataManager.java
NonSnarlMetadataManager.addDescriptor
private void addDescriptor(List<String> result, EntityDescriptor descriptor) throws MetadataProviderException { String entityID = descriptor.getEntityID(); log.debug("Found metadata EntityDescriptor with ID", entityID); result.add(entityID); }
java
private void addDescriptor(List<String> result, EntityDescriptor descriptor) throws MetadataProviderException { String entityID = descriptor.getEntityID(); log.debug("Found metadata EntityDescriptor with ID", entityID); result.add(entityID); }
[ "private", "void", "addDescriptor", "(", "List", "<", "String", ">", "result", ",", "EntityDescriptor", "descriptor", ")", "throws", "MetadataProviderException", "{", "String", "entityID", "=", "descriptor", ".", "getEntityID", "(", ")", ";", "log", ".", "debug"...
Parses entityID from the descriptor and adds it to the result set. Signatures on all found entities are verified using the given policy and trust engine. @param result result set @param descriptor descriptor to parse @throws MetadataProviderException in case signature validation fails
[ "Parses", "entityID", "from", "the", "descriptor", "and", "adds", "it", "to", "the", "result", "set", ".", "Signatures", "on", "all", "found", "entities", "are", "verified", "using", "the", "given", "policy", "and", "trust", "engine", "." ]
train
https://github.com/cloudfoundry/uaa/blob/e8df3d7060580c92d33461106399f9e4f36e3cd2/server/src/main/java/org/cloudfoundry/identity/uaa/provider/saml/NonSnarlMetadataManager.java#L384-L390
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/clustering/LinkClustering.java
LinkClustering.getEdgeSimilarity
protected double getEdgeSimilarity(SparseMatrix sm, Edge e1, Edge e2) { // Determing the keystone (shared) node by the edges and the other two // impost (unshared) nodes. int keystone = -1; int impost1 = -1; int impost2 = -1; if (e1.from == e2.from) { keystone = e1.from; impost1 = e1.to; impost2 = e2.to; } else if (e1.from == e2.to) { keystone = e1.from; impost1 = e1.to; impost2 = e2.from; } else if (e2.to == e1.from) { keystone = e1.from; impost1 = e1.to; impost2 = e2.from; } else if (e1.to == e2.to) { keystone = e1.to; impost1 = e1.from; impost2 = e2.from; } else return 0d; // Determine the overlap between the neighbors of the impost nodes int[] impost1edges = getImpostNeighbors(sm, impost1); int[] impost2edges = getImpostNeighbors(sm, impost2); double similarity = Similarity.jaccardIndex(impost1edges, impost2edges); return similarity; }
java
protected double getEdgeSimilarity(SparseMatrix sm, Edge e1, Edge e2) { // Determing the keystone (shared) node by the edges and the other two // impost (unshared) nodes. int keystone = -1; int impost1 = -1; int impost2 = -1; if (e1.from == e2.from) { keystone = e1.from; impost1 = e1.to; impost2 = e2.to; } else if (e1.from == e2.to) { keystone = e1.from; impost1 = e1.to; impost2 = e2.from; } else if (e2.to == e1.from) { keystone = e1.from; impost1 = e1.to; impost2 = e2.from; } else if (e1.to == e2.to) { keystone = e1.to; impost1 = e1.from; impost2 = e2.from; } else return 0d; // Determine the overlap between the neighbors of the impost nodes int[] impost1edges = getImpostNeighbors(sm, impost1); int[] impost2edges = getImpostNeighbors(sm, impost2); double similarity = Similarity.jaccardIndex(impost1edges, impost2edges); return similarity; }
[ "protected", "double", "getEdgeSimilarity", "(", "SparseMatrix", "sm", ",", "Edge", "e1", ",", "Edge", "e2", ")", "{", "// Determing the keystone (shared) node by the edges and the other two", "// impost (unshared) nodes.", "int", "keystone", "=", "-", "1", ";", "int", ...
Computes the similarity of the two edges as the Jaccard index of the neighbors of two impost nodes. The impost nodes are the two nodes the edges do not have in common. Subclasses may override this method to define a new method for computing edge similarity. <p><i>Implementation Note</i>: Subclasses that wish to override this behavior should be aware that this method is likely to be called by multiple threads and therefor should make provisions to be thread safe. In addition, this method may be called more than once per edge pair if the similarity matrix is being computed on-the-fly. @param sm a matrix containing the connections between edges. A non-zero value in location (i,j) indicates a node <i>i</i> is connected to node <i>j</i> by an edge. @param e1 an edge to be compared with {@code e2} @param e2 an edge to be compared with {@code e1} @return the similarity of the edges.a
[ "Computes", "the", "similarity", "of", "the", "two", "edges", "as", "the", "Jaccard", "index", "of", "the", "neighbors", "of", "two", "impost", "nodes", ".", "The", "impost", "nodes", "are", "the", "two", "nodes", "the", "edges", "do", "not", "have", "in...
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/clustering/LinkClustering.java#L451-L485
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/RolesInner.java
RolesInner.createOrUpdate
public RoleInner createOrUpdate(String deviceName, String name, String resourceGroupName, RoleInner role) { return createOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, role).toBlocking().last().body(); }
java
public RoleInner createOrUpdate(String deviceName, String name, String resourceGroupName, RoleInner role) { return createOrUpdateWithServiceResponseAsync(deviceName, name, resourceGroupName, role).toBlocking().last().body(); }
[ "public", "RoleInner", "createOrUpdate", "(", "String", "deviceName", ",", "String", "name", ",", "String", "resourceGroupName", ",", "RoleInner", "role", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "deviceName", ",", "name", ",", "resourceGroup...
Create or update a role. @param deviceName The device name. @param name The role name. @param resourceGroupName The resource group name. @param role The role properties. @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 RoleInner object if successful.
[ "Create", "or", "update", "a", "role", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/RolesInner.java#L322-L324
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geometry/GrahamScanConvexHull2D.java
GrahamScanConvexHull2D.getHull
public Polygon getHull() { if(!ok) { computeConvexHull(); } return new Polygon(points, minmaxX.getMin(), minmaxX.getMax(), minmaxY.getMin(), minmaxY.getMax()); }
java
public Polygon getHull() { if(!ok) { computeConvexHull(); } return new Polygon(points, minmaxX.getMin(), minmaxX.getMax(), minmaxY.getMin(), minmaxY.getMax()); }
[ "public", "Polygon", "getHull", "(", ")", "{", "if", "(", "!", "ok", ")", "{", "computeConvexHull", "(", ")", ";", "}", "return", "new", "Polygon", "(", "points", ",", "minmaxX", ".", "getMin", "(", ")", ",", "minmaxX", ".", "getMax", "(", ")", ","...
Compute the convex hull, and return the resulting polygon. @return Polygon of the hull
[ "Compute", "the", "convex", "hull", "and", "return", "the", "resulting", "polygon", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geometry/GrahamScanConvexHull2D.java#L267-L272
Erudika/para
para-server/src/main/java/com/erudika/para/security/SimpleAxFetchListFactory.java
SimpleAxFetchListFactory.createAttributeList
public List<OpenIDAttribute> createAttributeList(String identifier) { List<OpenIDAttribute> list = new LinkedList<>(); if (identifier != null && identifier.matches("https://www.google.com/.*")) { OpenIDAttribute email = new OpenIDAttribute("email", "http://axschema.org/contact/email"); OpenIDAttribute first = new OpenIDAttribute("firstname", "http://axschema.org/namePerson/first"); OpenIDAttribute last = new OpenIDAttribute("lastname", "http://axschema.org/namePerson/last"); email.setCount(1); email.setRequired(true); first.setRequired(true); last.setRequired(true); list.add(email); list.add(first); list.add(last); } return list; }
java
public List<OpenIDAttribute> createAttributeList(String identifier) { List<OpenIDAttribute> list = new LinkedList<>(); if (identifier != null && identifier.matches("https://www.google.com/.*")) { OpenIDAttribute email = new OpenIDAttribute("email", "http://axschema.org/contact/email"); OpenIDAttribute first = new OpenIDAttribute("firstname", "http://axschema.org/namePerson/first"); OpenIDAttribute last = new OpenIDAttribute("lastname", "http://axschema.org/namePerson/last"); email.setCount(1); email.setRequired(true); first.setRequired(true); last.setRequired(true); list.add(email); list.add(first); list.add(last); } return list; }
[ "public", "List", "<", "OpenIDAttribute", ">", "createAttributeList", "(", "String", "identifier", ")", "{", "List", "<", "OpenIDAttribute", ">", "list", "=", "new", "LinkedList", "<>", "(", ")", ";", "if", "(", "identifier", "!=", "null", "&&", "identifier"...
A list of OpenID attributes to send in a request. @param identifier a user identifier @return a list of attributes
[ "A", "list", "of", "OpenID", "attributes", "to", "send", "in", "a", "request", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/security/SimpleAxFetchListFactory.java#L37-L52
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/jni/Serial.java
Serial.write
public synchronized static void write(int fd, byte[] data, int offset, int length) throws IOException { // we make a copy of the data argument because we don't want to modify the original source data byte[] buffer = new byte[length]; System.arraycopy(data, offset, buffer, 0, length); // write the buffer contents to the serial port via JNI native method write(fd, buffer, length); }
java
public synchronized static void write(int fd, byte[] data, int offset, int length) throws IOException { // we make a copy of the data argument because we don't want to modify the original source data byte[] buffer = new byte[length]; System.arraycopy(data, offset, buffer, 0, length); // write the buffer contents to the serial port via JNI native method write(fd, buffer, length); }
[ "public", "synchronized", "static", "void", "write", "(", "int", "fd", ",", "byte", "[", "]", "data", ",", "int", "offset", ",", "int", "length", ")", "throws", "IOException", "{", "// we make a copy of the data argument because we don't want to modify the original sour...
<p>Sends an array of bytes to the serial port/device identified by the given file descriptor.</p> @param fd The file descriptor of the serial port/device. @param data A ByteBuffer of data to be transmitted. @param offset The starting index (inclusive) in the array to send from. @param length The number of bytes from the byte array to transmit to the serial port.
[ "<p", ">", "Sends", "an", "array", "of", "bytes", "to", "the", "serial", "port", "/", "device", "identified", "by", "the", "given", "file", "descriptor", ".", "<", "/", "p", ">" ]
train
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/jni/Serial.java#L676-L684
akquinet/needle
src/main/java/de/akquinet/jbosscc/needle/reflection/ReflectionUtil.java
ReflectionUtil.invokeMethod
public static Object invokeMethod(final Object object, final String methodName, final Object... arguments) throws Exception { return invokeMethod(object, object.getClass(), methodName, arguments); }
java
public static Object invokeMethod(final Object object, final String methodName, final Object... arguments) throws Exception { return invokeMethod(object, object.getClass(), methodName, arguments); }
[ "public", "static", "Object", "invokeMethod", "(", "final", "Object", "object", ",", "final", "String", "methodName", ",", "final", "Object", "...", "arguments", ")", "throws", "Exception", "{", "return", "invokeMethod", "(", "object", ",", "object", ".", "get...
Invoke a given method with given arguments on a given object via reflection. @param object -- target object of invocation @param methodName -- name of method to be invoked @param arguments -- arguments for method invocation @return -- method object to which invocation is actually dispatched @throws Exception
[ "Invoke", "a", "given", "method", "with", "given", "arguments", "on", "a", "given", "object", "via", "reflection", "." ]
train
https://github.com/akquinet/needle/blob/8b411c521246b8212882485edc01644f9aac7e24/src/main/java/de/akquinet/jbosscc/needle/reflection/ReflectionUtil.java#L401-L404
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/table/TableSliceGroup.java
TableSliceGroup.aggregate
public Table aggregate(String colName1, AggregateFunction<?,?>... functions) { ArrayListMultimap<String, AggregateFunction<?,?>> columnFunctionMap = ArrayListMultimap.create(); columnFunctionMap.putAll(colName1, Lists.newArrayList(functions)); return aggregate(columnFunctionMap); }
java
public Table aggregate(String colName1, AggregateFunction<?,?>... functions) { ArrayListMultimap<String, AggregateFunction<?,?>> columnFunctionMap = ArrayListMultimap.create(); columnFunctionMap.putAll(colName1, Lists.newArrayList(functions)); return aggregate(columnFunctionMap); }
[ "public", "Table", "aggregate", "(", "String", "colName1", ",", "AggregateFunction", "<", "?", ",", "?", ">", "...", "functions", ")", "{", "ArrayListMultimap", "<", "String", ",", "AggregateFunction", "<", "?", ",", "?", ">", ">", "columnFunctionMap", "=", ...
Applies the given aggregation to the given column. The apply and combine steps of a split-apply-combine.
[ "Applies", "the", "given", "aggregation", "to", "the", "given", "column", ".", "The", "apply", "and", "combine", "steps", "of", "a", "split", "-", "apply", "-", "combine", "." ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/table/TableSliceGroup.java#L138-L142
OpenLiberty/open-liberty
dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/notification/ClientNotificationArea.java
ClientNotificationArea.toNotificationTargetInformation
private NotificationTargetInformation toNotificationTargetInformation(RESTRequest request, String objectName) { //Handle incoming routing context (if applicable) String[] routingContext = RESTHelper.getRoutingContext(request, false); if (routingContext != null) { return new NotificationTargetInformation(objectName, routingContext[0], routingContext[2], routingContext[1]); } return new NotificationTargetInformation(objectName); }
java
private NotificationTargetInformation toNotificationTargetInformation(RESTRequest request, String objectName) { //Handle incoming routing context (if applicable) String[] routingContext = RESTHelper.getRoutingContext(request, false); if (routingContext != null) { return new NotificationTargetInformation(objectName, routingContext[0], routingContext[2], routingContext[1]); } return new NotificationTargetInformation(objectName); }
[ "private", "NotificationTargetInformation", "toNotificationTargetInformation", "(", "RESTRequest", "request", ",", "String", "objectName", ")", "{", "//Handle incoming routing context (if applicable)", "String", "[", "]", "routingContext", "=", "RESTHelper", ".", "getRoutingCon...
Builds an instance of NotificationTargetInformation from the headers of an RESTRequest and a JMX ObjectName (as a string).
[ "Builds", "an", "instance", "of", "NotificationTargetInformation", "from", "the", "headers", "of", "an", "RESTRequest", "and", "a", "JMX", "ObjectName", "(", "as", "a", "string", ")", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.server.rest/src/com/ibm/ws/jmx/connector/server/rest/notification/ClientNotificationArea.java#L211-L220
aws/aws-sdk-java
aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/PutIntegrationResult.java
PutIntegrationResult.withRequestParameters
public PutIntegrationResult withRequestParameters(java.util.Map<String, String> requestParameters) { setRequestParameters(requestParameters); return this; }
java
public PutIntegrationResult withRequestParameters(java.util.Map<String, String> requestParameters) { setRequestParameters(requestParameters); return this; }
[ "public", "PutIntegrationResult", "withRequestParameters", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "requestParameters", ")", "{", "setRequestParameters", "(", "requestParameters", ")", ";", "return", "this", ";", "}" ]
<p> A key-value map specifying request parameters that are passed from the method request to the back end. The key is an integration request parameter name and the associated value is a method request parameter value or static value that must be enclosed within single quotes and pre-encoded as required by the back end. The method request parameter value must match the pattern of <code>method.request.{location}.{name}</code>, where <code>location</code> is <code>querystring</code>, <code>path</code>, or <code>header</code> and <code>name</code> must be a valid and unique method request parameter name. </p> @param requestParameters A key-value map specifying request parameters that are passed from the method request to the back end. The key is an integration request parameter name and the associated value is a method request parameter value or static value that must be enclosed within single quotes and pre-encoded as required by the back end. The method request parameter value must match the pattern of <code>method.request.{location}.{name}</code> , where <code>location</code> is <code>querystring</code>, <code>path</code>, or <code>header</code> and <code>name</code> must be a valid and unique method request parameter name. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "key", "-", "value", "map", "specifying", "request", "parameters", "that", "are", "passed", "from", "the", "method", "request", "to", "the", "back", "end", ".", "The", "key", "is", "an", "integration", "request", "parameter", "name", "and",...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/PutIntegrationResult.java#L1034-L1037
Alluxio/alluxio
minicluster/src/main/java/alluxio/multi/process/MultiProcessCluster.java
MultiProcessCluster.writeConfToFile
private void writeConfToFile(File dir, Map<PropertyKey, String> properties) throws IOException { // Generates the full set of properties to write Map<PropertyKey, String> map = new HashMap<>(mProperties); for (Map.Entry<PropertyKey, String> entry : properties.entrySet()) { map.put(entry.getKey(), entry.getValue()); } StringBuilder sb = new StringBuilder(); for (Entry<PropertyKey, String> entry : map.entrySet()) { sb.append(String.format("%s=%s%n", entry.getKey(), entry.getValue())); } dir.mkdirs(); try (FileOutputStream fos = new FileOutputStream(new File(dir, "alluxio-site.properties"))) { fos.write(sb.toString().getBytes(Charsets.UTF_8)); } }
java
private void writeConfToFile(File dir, Map<PropertyKey, String> properties) throws IOException { // Generates the full set of properties to write Map<PropertyKey, String> map = new HashMap<>(mProperties); for (Map.Entry<PropertyKey, String> entry : properties.entrySet()) { map.put(entry.getKey(), entry.getValue()); } StringBuilder sb = new StringBuilder(); for (Entry<PropertyKey, String> entry : map.entrySet()) { sb.append(String.format("%s=%s%n", entry.getKey(), entry.getValue())); } dir.mkdirs(); try (FileOutputStream fos = new FileOutputStream(new File(dir, "alluxio-site.properties"))) { fos.write(sb.toString().getBytes(Charsets.UTF_8)); } }
[ "private", "void", "writeConfToFile", "(", "File", "dir", ",", "Map", "<", "PropertyKey", ",", "String", ">", "properties", ")", "throws", "IOException", "{", "// Generates the full set of properties to write", "Map", "<", "PropertyKey", ",", "String", ">", "map", ...
Creates the conf directory and file. Writes the properties to the generated file. @param dir the conf directory to create @param properties the specific properties of the current node
[ "Creates", "the", "conf", "directory", "and", "file", ".", "Writes", "the", "properties", "to", "the", "generated", "file", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/minicluster/src/main/java/alluxio/multi/process/MultiProcessCluster.java#L686-L703
osglworks/java-tool
src/main/java/org/osgl/Lang.java
F2.lift
public F2<P1, P2, Option<R>> lift() { final F2<P1, P2, R> me = this; return new F2<P1, P2, Option<R>>() { @Override public Option<R> apply(P1 p1, P2 p2) { try { return some(me.apply(p1, p2)); } catch (RuntimeException e) { return none(); } } }; }
java
public F2<P1, P2, Option<R>> lift() { final F2<P1, P2, R> me = this; return new F2<P1, P2, Option<R>>() { @Override public Option<R> apply(P1 p1, P2 p2) { try { return some(me.apply(p1, p2)); } catch (RuntimeException e) { return none(); } } }; }
[ "public", "F2", "<", "P1", ",", "P2", ",", "Option", "<", "R", ">", ">", "lift", "(", ")", "{", "final", "F2", "<", "P1", ",", "P2", ",", "R", ">", "me", "=", "this", ";", "return", "new", "F2", "<", "P1", ",", "P2", ",", "Option", "<", "...
Turns this partial function into a plain function returning an Option result. @return a function that takes an argument x to Some(this.apply(x)) if this can be applied, and to None otherwise.
[ "Turns", "this", "partial", "function", "into", "a", "plain", "function", "returning", "an", "Option", "result", "." ]
train
https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/Lang.java#L1057-L1069
thorntail/thorntail
core/bootstrap/src/main/java/org/wildfly/swarm/bootstrap/modules/GradleResolver.java
GradleResolver.toGradleArtifactFileName
String toGradleArtifactFileName(ArtifactCoordinates artifactCoordinates, String packaging) { StringBuilder sbFileFilter = new StringBuilder(); sbFileFilter .append(artifactCoordinates.getArtifactId()) .append("-") .append(artifactCoordinates.getVersion()); if (artifactCoordinates.getClassifier() != null && artifactCoordinates.getClassifier().length() > 0) { sbFileFilter .append("-") .append(artifactCoordinates.getClassifier()); } sbFileFilter .append(".") .append(packaging); return sbFileFilter.toString(); }
java
String toGradleArtifactFileName(ArtifactCoordinates artifactCoordinates, String packaging) { StringBuilder sbFileFilter = new StringBuilder(); sbFileFilter .append(artifactCoordinates.getArtifactId()) .append("-") .append(artifactCoordinates.getVersion()); if (artifactCoordinates.getClassifier() != null && artifactCoordinates.getClassifier().length() > 0) { sbFileFilter .append("-") .append(artifactCoordinates.getClassifier()); } sbFileFilter .append(".") .append(packaging); return sbFileFilter.toString(); }
[ "String", "toGradleArtifactFileName", "(", "ArtifactCoordinates", "artifactCoordinates", ",", "String", "packaging", ")", "{", "StringBuilder", "sbFileFilter", "=", "new", "StringBuilder", "(", ")", ";", "sbFileFilter", ".", "append", "(", "artifactCoordinates", ".", ...
Build file name for artifact. @param artifactCoordinates @param packaging @return
[ "Build", "file", "name", "for", "artifact", "." ]
train
https://github.com/thorntail/thorntail/blob/4a391b68ffae98c6e66d30a3bfb99dadc9509f14/core/bootstrap/src/main/java/org/wildfly/swarm/bootstrap/modules/GradleResolver.java#L179-L194
landawn/AbacusUtil
src/com/landawn/abacus/util/MongoDB.java
MongoDB.fromJSON
public static <T> T fromJSON(final Class<T> targetClass, final String json) { if (targetClass.equals(Bson.class) || targetClass.equals(Document.class)) { final Document doc = new Document(); jsonParser.readString(doc, json); return (T) doc; } else if (targetClass.equals(BasicBSONObject.class)) { final BasicBSONObject result = new BasicBSONObject(); jsonParser.readString(result, json); return (T) result; } else if (targetClass.equals(BasicDBObject.class)) { final BasicDBObject result = new BasicDBObject(); jsonParser.readString(result, json); return (T) result; } else { throw new IllegalArgumentException("Unsupported type: " + ClassUtil.getCanonicalClassName(targetClass)); } }
java
public static <T> T fromJSON(final Class<T> targetClass, final String json) { if (targetClass.equals(Bson.class) || targetClass.equals(Document.class)) { final Document doc = new Document(); jsonParser.readString(doc, json); return (T) doc; } else if (targetClass.equals(BasicBSONObject.class)) { final BasicBSONObject result = new BasicBSONObject(); jsonParser.readString(result, json); return (T) result; } else if (targetClass.equals(BasicDBObject.class)) { final BasicDBObject result = new BasicDBObject(); jsonParser.readString(result, json); return (T) result; } else { throw new IllegalArgumentException("Unsupported type: " + ClassUtil.getCanonicalClassName(targetClass)); } }
[ "public", "static", "<", "T", ">", "T", "fromJSON", "(", "final", "Class", "<", "T", ">", "targetClass", ",", "final", "String", "json", ")", "{", "if", "(", "targetClass", ".", "equals", "(", "Bson", ".", "class", ")", "||", "targetClass", ".", "equ...
Returns an instance of the specified target class with the property values from the specified JSON String. @param targetClass <code>Bson.class</code>, <code>Document.class</code>, <code>BasicBSONObject.class</code>, <code>BasicDBObject.class</code> @param json @return
[ "Returns", "an", "instance", "of", "the", "specified", "target", "class", "with", "the", "property", "values", "from", "the", "specified", "JSON", "String", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/MongoDB.java#L412-L428
groupon/monsoon
collectors/jmx/src/main/java/com/groupon/lex/metrics/jmx/MBeanGroup.java
MBeanGroup.nameFromObjectName
private static GroupName nameFromObjectName(ObjectName obj_name, NamedResolverMap resolvedMap) { String name = obj_name.getKeyProperty("name"); String type = obj_name.getKeyProperty("type"); String domain = obj_name.getDomain(); Map<String, MetricValue> tags = obj_name.getKeyPropertyList().entrySet().stream() .filter((entry) -> !entry.getKey().equals("name")) .filter((entry) -> !entry.getKey().equals("type")) .map(Tag::valueOf) .collect(Collectors.toMap((Tag t) -> t.getName(), (Tag t) -> t.getValue())); final List<String> path = new ArrayList<>(); if (name != null) { path.addAll(Arrays.asList(name.split("\\."))); } else if (type != null) { path.addAll(Arrays.asList(domain.split("\\."))); path.add(type); } else { path.addAll(Arrays.asList(domain.split("\\."))); } return resolvedMap.getGroupName(path, tags); }
java
private static GroupName nameFromObjectName(ObjectName obj_name, NamedResolverMap resolvedMap) { String name = obj_name.getKeyProperty("name"); String type = obj_name.getKeyProperty("type"); String domain = obj_name.getDomain(); Map<String, MetricValue> tags = obj_name.getKeyPropertyList().entrySet().stream() .filter((entry) -> !entry.getKey().equals("name")) .filter((entry) -> !entry.getKey().equals("type")) .map(Tag::valueOf) .collect(Collectors.toMap((Tag t) -> t.getName(), (Tag t) -> t.getValue())); final List<String> path = new ArrayList<>(); if (name != null) { path.addAll(Arrays.asList(name.split("\\."))); } else if (type != null) { path.addAll(Arrays.asList(domain.split("\\."))); path.add(type); } else { path.addAll(Arrays.asList(domain.split("\\."))); } return resolvedMap.getGroupName(path, tags); }
[ "private", "static", "GroupName", "nameFromObjectName", "(", "ObjectName", "obj_name", ",", "NamedResolverMap", "resolvedMap", ")", "{", "String", "name", "=", "obj_name", ".", "getKeyProperty", "(", "\"name\"", ")", ";", "String", "type", "=", "obj_name", ".", ...
Extract a metric group name from a JMX ObjectName. @param obj_name a JMX object name from which to derive a metric name. @param resolvedMap a resolver map to use when generating the group name. @return A metric name for the given ObjectName, with tags.
[ "Extract", "a", "metric", "group", "name", "from", "a", "JMX", "ObjectName", "." ]
train
https://github.com/groupon/monsoon/blob/eb68d72ba4c01fe018dc981097dbee033908f5c7/collectors/jmx/src/main/java/com/groupon/lex/metrics/jmx/MBeanGroup.java#L131-L152
phax/ph-commons
ph-dao/src/main/java/com/helger/dao/wal/AbstractMapBasedWALDAO.java
AbstractMapBasedWALDAO.internalCreateItem
@MustBeLocked (ELockType.WRITE) @Nonnull protected final IMPLTYPE internalCreateItem (@Nonnull final IMPLTYPE aNewItem) { return internalCreateItem (aNewItem, true); }
java
@MustBeLocked (ELockType.WRITE) @Nonnull protected final IMPLTYPE internalCreateItem (@Nonnull final IMPLTYPE aNewItem) { return internalCreateItem (aNewItem, true); }
[ "@", "MustBeLocked", "(", "ELockType", ".", "WRITE", ")", "@", "Nonnull", "protected", "final", "IMPLTYPE", "internalCreateItem", "(", "@", "Nonnull", "final", "IMPLTYPE", "aNewItem", ")", "{", "return", "internalCreateItem", "(", "aNewItem", ",", "true", ")", ...
Add an item including invoking the callback. Must only be invoked inside a write-lock. @param aNewItem The item to be added. May not be <code>null</code>. @return The passed parameter as-is. Never <code>null</code>. @throws IllegalArgumentException If an item with the same ID is already contained
[ "Add", "an", "item", "including", "invoking", "the", "callback", ".", "Must", "only", "be", "invoked", "inside", "a", "write", "-", "lock", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-dao/src/main/java/com/helger/dao/wal/AbstractMapBasedWALDAO.java#L294-L299
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/LocationsInner.java
LocationsInner.checkNameAvailability
public EntityNameAvailabilityCheckOutputInner checkNameAvailability(String locationName, CheckNameAvailabilityInput parameters) { return checkNameAvailabilityWithServiceResponseAsync(locationName, parameters).toBlocking().single().body(); }
java
public EntityNameAvailabilityCheckOutputInner checkNameAvailability(String locationName, CheckNameAvailabilityInput parameters) { return checkNameAvailabilityWithServiceResponseAsync(locationName, parameters).toBlocking().single().body(); }
[ "public", "EntityNameAvailabilityCheckOutputInner", "checkNameAvailability", "(", "String", "locationName", ",", "CheckNameAvailabilityInput", "parameters", ")", "{", "return", "checkNameAvailabilityWithServiceResponseAsync", "(", "locationName", ",", "parameters", ")", ".", "t...
Check Name Availability. Checks whether the Media Service resource name is available. @param locationName the String value @param parameters The request parameters @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the EntityNameAvailabilityCheckOutputInner object if successful.
[ "Check", "Name", "Availability", ".", "Checks", "whether", "the", "Media", "Service", "resource", "name", "is", "available", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/LocationsInner.java#L74-L76
finmath/finmath-lib
src/main/java/net/finmath/montecarlo/assetderivativevaluation/products/BermudanDigitalOption.java
BermudanDigitalOption.getValue
@Override public RandomVariable getValue(double evaluationTime, AssetModelMonteCarloSimulationModel model) throws CalculationException { if(exerciseMethod == ExerciseMethod.UPPER_BOUND_METHOD) { // Find optimal lambda GoldenSectionSearch optimizer = new GoldenSectionSearch(-1.0, 1.0); while(!optimizer.isDone()) { double lambda = optimizer.getNextPoint(); double value = this.getValues(evaluationTime, model, lambda).getAverage(); optimizer.setValue(value); } return getValues(evaluationTime, model, optimizer.getBestPoint()); } else { return getValues(evaluationTime, model, 0.0); } }
java
@Override public RandomVariable getValue(double evaluationTime, AssetModelMonteCarloSimulationModel model) throws CalculationException { if(exerciseMethod == ExerciseMethod.UPPER_BOUND_METHOD) { // Find optimal lambda GoldenSectionSearch optimizer = new GoldenSectionSearch(-1.0, 1.0); while(!optimizer.isDone()) { double lambda = optimizer.getNextPoint(); double value = this.getValues(evaluationTime, model, lambda).getAverage(); optimizer.setValue(value); } return getValues(evaluationTime, model, optimizer.getBestPoint()); } else { return getValues(evaluationTime, model, 0.0); } }
[ "@", "Override", "public", "RandomVariable", "getValue", "(", "double", "evaluationTime", ",", "AssetModelMonteCarloSimulationModel", "model", ")", "throws", "CalculationException", "{", "if", "(", "exerciseMethod", "==", "ExerciseMethod", ".", "UPPER_BOUND_METHOD", ")", ...
This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime. Cash-flows prior evaluationTime are not considered. @param evaluationTime The time on which this products value should be observed. @param model The model used to price the product. @return The random variable representing the value of the product discounted to evaluation time. @throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</code> method.
[ "This", "method", "returns", "the", "value", "random", "variable", "of", "the", "product", "within", "the", "specified", "model", "evaluated", "at", "a", "given", "evalutationTime", ".", "Cash", "-", "flows", "prior", "evaluationTime", "are", "not", "considered"...
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/assetderivativevaluation/products/BermudanDigitalOption.java#L96-L111
groupon/odo
proxyui/src/main/java/com/groupon/odo/controllers/ControllerUtils.java
ControllerUtils.convertPathIdentifier
public static Integer convertPathIdentifier(String identifier, Integer profileId) throws Exception { Integer pathId = -1; try { pathId = Integer.parseInt(identifier); } catch (NumberFormatException ne) { // this is OK.. just means it's not a # if (profileId == null) throw new Exception("A profileId must be specified"); pathId = PathOverrideService.getInstance().getPathId(identifier, profileId); } return pathId; }
java
public static Integer convertPathIdentifier(String identifier, Integer profileId) throws Exception { Integer pathId = -1; try { pathId = Integer.parseInt(identifier); } catch (NumberFormatException ne) { // this is OK.. just means it's not a # if (profileId == null) throw new Exception("A profileId must be specified"); pathId = PathOverrideService.getInstance().getPathId(identifier, profileId); } return pathId; }
[ "public", "static", "Integer", "convertPathIdentifier", "(", "String", "identifier", ",", "Integer", "profileId", ")", "throws", "Exception", "{", "Integer", "pathId", "=", "-", "1", ";", "try", "{", "pathId", "=", "Integer", ".", "parseInt", "(", "identifier"...
Obtain the path ID for a profile @param identifier Can be the path ID, or friendly name @param profileId @return @throws Exception
[ "Obtain", "the", "path", "ID", "for", "a", "profile" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxyui/src/main/java/com/groupon/odo/controllers/ControllerUtils.java#L36-L49
Pi4J/pi4j
pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerDeviceController.java
MicrochipPotentiometerDeviceController.setBit
private int setBit(final int mem, final int mask, final boolean value) { final int result; if (value) { result = mem | mask; // set bit by using OR } else { result = mem & ~mask; // clear bit by using AND with the inverted mask } return result; }
java
private int setBit(final int mem, final int mask, final boolean value) { final int result; if (value) { result = mem | mask; // set bit by using OR } else { result = mem & ~mask; // clear bit by using AND with the inverted mask } return result; }
[ "private", "int", "setBit", "(", "final", "int", "mem", ",", "final", "int", "mask", ",", "final", "boolean", "value", ")", "{", "final", "int", "result", ";", "if", "(", "value", ")", "{", "result", "=", "mem", "|", "mask", ";", "// set bit by using O...
Sets or clears a bit in the given memory (integer). @param mem The memory to modify @param mask The mask which defines to bit to be set/cleared @param value Whether to set the bit (true) or clear the bit (false) @return The modified memory
[ "Sets", "or", "clears", "a", "bit", "in", "the", "given", "memory", "(", "integer", ")", "." ]
train
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-device/src/main/java/com/pi4j/component/potentiometer/microchip/impl/MicrochipPotentiometerDeviceController.java#L377-L387
jcuda/jcudnn
JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java
JCudnn.cudnnGetRNNWorkspaceSize
public static int cudnnGetRNNWorkspaceSize( cudnnHandle handle, cudnnRNNDescriptor rnnDesc, int seqLength, cudnnTensorDescriptor[] xDesc, long[] sizeInBytes) { return checkResult(cudnnGetRNNWorkspaceSizeNative(handle, rnnDesc, seqLength, xDesc, sizeInBytes)); }
java
public static int cudnnGetRNNWorkspaceSize( cudnnHandle handle, cudnnRNNDescriptor rnnDesc, int seqLength, cudnnTensorDescriptor[] xDesc, long[] sizeInBytes) { return checkResult(cudnnGetRNNWorkspaceSizeNative(handle, rnnDesc, seqLength, xDesc, sizeInBytes)); }
[ "public", "static", "int", "cudnnGetRNNWorkspaceSize", "(", "cudnnHandle", "handle", ",", "cudnnRNNDescriptor", "rnnDesc", ",", "int", "seqLength", ",", "cudnnTensorDescriptor", "[", "]", "xDesc", ",", "long", "[", "]", "sizeInBytes", ")", "{", "return", "checkRes...
dataType in weight descriptors and input descriptors is used to describe storage
[ "dataType", "in", "weight", "descriptors", "and", "input", "descriptors", "is", "used", "to", "describe", "storage" ]
train
https://github.com/jcuda/jcudnn/blob/ce71f2fc02817cecace51a80e6db5f0c7f10cffc/JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java#L3336-L3344
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java
Node.getSubscriptionOptions
public SubscribeForm getSubscriptionOptions(String jid, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { PubSub packet = sendPubsubPacket(createPubsubPacket(Type.get, new OptionsExtension(jid, getId(), subscriptionId))); FormNode ext = packet.getExtension(PubSubElementType.OPTIONS); return new SubscribeForm(ext.getForm()); }
java
public SubscribeForm getSubscriptionOptions(String jid, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { PubSub packet = sendPubsubPacket(createPubsubPacket(Type.get, new OptionsExtension(jid, getId(), subscriptionId))); FormNode ext = packet.getExtension(PubSubElementType.OPTIONS); return new SubscribeForm(ext.getForm()); }
[ "public", "SubscribeForm", "getSubscriptionOptions", "(", "String", "jid", ",", "String", "subscriptionId", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "PubSub", "packet", "=", "sendPubsu...
Get the options for configuring the specified subscription. @param jid JID the subscription is registered under @param subscriptionId The subscription id @return The subscription option form @throws XMPPErrorException @throws NoResponseException @throws NotConnectedException @throws InterruptedException
[ "Get", "the", "options", "for", "configuring", "the", "specified", "subscription", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java#L484-L488
paypal/SeLion
server/src/main/java/com/paypal/selion/utils/ServletHelper.java
ServletHelper.respondAsJsonWithHttpStatus
public static void respondAsJsonWithHttpStatus(HttpServletResponse resp, Object response, int statusCode) throws IOException { String json = new GsonBuilder().serializeNulls().create().toJson(response); String jsonUtf8 = new String(json.getBytes(), "UTF-8"); resp.setContentType("application/json"); resp.setCharacterEncoding("UTF-8"); resp.setStatus(statusCode); resp.getOutputStream().print(jsonUtf8); resp.flushBuffer(); }
java
public static void respondAsJsonWithHttpStatus(HttpServletResponse resp, Object response, int statusCode) throws IOException { String json = new GsonBuilder().serializeNulls().create().toJson(response); String jsonUtf8 = new String(json.getBytes(), "UTF-8"); resp.setContentType("application/json"); resp.setCharacterEncoding("UTF-8"); resp.setStatus(statusCode); resp.getOutputStream().print(jsonUtf8); resp.flushBuffer(); }
[ "public", "static", "void", "respondAsJsonWithHttpStatus", "(", "HttpServletResponse", "resp", ",", "Object", "response", ",", "int", "statusCode", ")", "throws", "IOException", "{", "String", "json", "=", "new", "GsonBuilder", "(", ")", ".", "serializeNulls", "("...
Sends a HTTP response as a application/json document and with a HTTP status code. @param resp A {@link HttpServletResponse} object that the servlet is responding on. @param response The response object which will be serialized to a JSON document @param statusCode The HTTP status code to send with the response @throws IOException
[ "Sends", "a", "HTTP", "response", "as", "a", "application", "/", "json", "document", "and", "with", "a", "HTTP", "status", "code", "." ]
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/server/src/main/java/com/paypal/selion/utils/ServletHelper.java#L74-L83
StefanLiebenberg/kute
kute-core/src/main/java/slieb/kute/Kute.java
Kute.inputStreamResource
public static InputStreamResource inputStreamResource(final String path, final SupplierWithThrowable<InputStream, IOException> supplier) { return new InputStreamResource(path, supplier); }
java
public static InputStreamResource inputStreamResource(final String path, final SupplierWithThrowable<InputStream, IOException> supplier) { return new InputStreamResource(path, supplier); }
[ "public", "static", "InputStreamResource", "inputStreamResource", "(", "final", "String", "path", ",", "final", "SupplierWithThrowable", "<", "InputStream", ",", "IOException", ">", "supplier", ")", "{", "return", "new", "InputStreamResource", "(", "path", ",", "sup...
Create resources from input stream. @param path The path name for this resource. @param supplier The input stream to supply content. @return a readable resource that reads from provided input stream.
[ "Create", "resources", "from", "input", "stream", "." ]
train
https://github.com/StefanLiebenberg/kute/blob/1db0e8d2c76459d22c7d4b0ba99c18f74748f6fd/kute-core/src/main/java/slieb/kute/Kute.java#L188-L191
line/armeria
kafka/src/main/java/com/linecorp/armeria/server/logging/structured/kafka/KafkaStructuredLoggingService.java
KafkaStructuredLoggingService.newDecorator
public static <I extends Request, O extends Response, L> Function<Service<I, O>, StructuredLoggingService<I, O, L>> newDecorator( Producer<byte[], L> producer, String topic, StructuredLogBuilder<L> logBuilder) { return newDecorator(producer, topic, logBuilder, null); }
java
public static <I extends Request, O extends Response, L> Function<Service<I, O>, StructuredLoggingService<I, O, L>> newDecorator( Producer<byte[], L> producer, String topic, StructuredLogBuilder<L> logBuilder) { return newDecorator(producer, topic, logBuilder, null); }
[ "public", "static", "<", "I", "extends", "Request", ",", "O", "extends", "Response", ",", "L", ">", "Function", "<", "Service", "<", "I", ",", "O", ">", ",", "StructuredLoggingService", "<", "I", ",", "O", ",", "L", ">", ">", "newDecorator", "(", "Pr...
Creates a decorator which provides {@link StructuredLoggingService} with defaulting key to null. @param producer a kafka {@link Producer} producer which is used to send logs to Kafka @param topic a name of topic which is used to send logs @param logBuilder an instance of {@link StructuredLogBuilder} which is used to construct a log entry @param <I> the {@link Request} type @param <O> the {@link Response} type @param <L> the type of the structured log representation @return a service decorator which adds structured logging support integrated to Kafka
[ "Creates", "a", "decorator", "which", "provides", "{", "@link", "StructuredLoggingService", "}", "with", "defaulting", "key", "to", "null", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/kafka/src/main/java/com/linecorp/armeria/server/logging/structured/kafka/KafkaStructuredLoggingService.java#L111-L116
UrielCh/ovh-java-sdk
ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java
ApiOvhSms.ptts_GET
public OvhPttDetails ptts_GET(Long ptt) throws IOException { String qPath = "/sms/ptts"; StringBuilder sb = path(qPath); query(sb, "ptt", ptt); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPttDetails.class); }
java
public OvhPttDetails ptts_GET(Long ptt) throws IOException { String qPath = "/sms/ptts"; StringBuilder sb = path(qPath); query(sb, "ptt", ptt); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPttDetails.class); }
[ "public", "OvhPttDetails", "ptts_GET", "(", "Long", "ptt", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/sms/ptts\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "query", "(", "sb", ",", "\"ptt\"", ",", "ptt", ")", "...
Get informations about the given ptt code REST: GET /sms/ptts @param ptt [required] The premium transaction tracking code
[ "Get", "informations", "about", "the", "given", "ptt", "code" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L1721-L1727
io7m/jaffirm
com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Invariants.java
Invariants.checkInvariant
public static <T> T checkInvariant( final T value, final boolean condition, final Function<T, String> describer) { return innerCheckInvariant(value, condition, describer); }
java
public static <T> T checkInvariant( final T value, final boolean condition, final Function<T, String> describer) { return innerCheckInvariant(value, condition, describer); }
[ "public", "static", "<", "T", ">", "T", "checkInvariant", "(", "final", "T", "value", ",", "final", "boolean", "condition", ",", "final", "Function", "<", "T", ",", "String", ">", "describer", ")", "{", "return", "innerCheckInvariant", "(", "value", ",", ...
<p>Evaluate the given {@code predicate} using {@code value} as input.</p> <p>The function throws {@link InvariantViolationException} if the predicate is false.</p> @param value The value @param condition The predicate @param describer A describer for the predicate @param <T> The type of values @return value @throws InvariantViolationException If the predicate is false
[ "<p", ">", "Evaluate", "the", "given", "{", "@code", "predicate", "}", "using", "{", "@code", "value", "}", "as", "input", ".", "<", "/", "p", ">" ]
train
https://github.com/io7m/jaffirm/blob/c97d246242d381e48832838737418cfe4cb57b4d/com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Invariants.java#L237-L243
apache/spark
common/sketch/src/main/java/org/apache/spark/util/sketch/Murmur3_x86_32.java
Murmur3_x86_32.fmix
private static int fmix(int h1, int length) { h1 ^= length; h1 ^= h1 >>> 16; h1 *= 0x85ebca6b; h1 ^= h1 >>> 13; h1 *= 0xc2b2ae35; h1 ^= h1 >>> 16; return h1; }
java
private static int fmix(int h1, int length) { h1 ^= length; h1 ^= h1 >>> 16; h1 *= 0x85ebca6b; h1 ^= h1 >>> 13; h1 *= 0xc2b2ae35; h1 ^= h1 >>> 16; return h1; }
[ "private", "static", "int", "fmix", "(", "int", "h1", ",", "int", "length", ")", "{", "h1", "^=", "length", ";", "h1", "^=", "h1", ">>>", "16", ";", "h1", "*=", "0x85ebca6b", ";", "h1", "^=", "h1", ">>>", "13", ";", "h1", "*=", "0xc2b2ae35", ";",...
Finalization mix - force all bits of a hash block to avalanche
[ "Finalization", "mix", "-", "force", "all", "bits", "of", "a", "hash", "block", "to", "avalanche" ]
train
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/sketch/src/main/java/org/apache/spark/util/sketch/Murmur3_x86_32.java#L133-L141
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/transform/AbstractGeneratedSQLTransform.java
AbstractGeneratedSQLTransform.generateReadValueFromCursor
@Override public void generateReadValueFromCursor(Builder methodBuilder, SQLiteDaoDefinition daoDefinition, TypeName paramTypeName, String cursorName, String indexName) { String methodName = daoDefinition.generateJava2ContentParser(paramTypeName); methodBuilder.addCode("$L($L.getBlob($L))", methodName, cursorName, indexName); }
java
@Override public void generateReadValueFromCursor(Builder methodBuilder, SQLiteDaoDefinition daoDefinition, TypeName paramTypeName, String cursorName, String indexName) { String methodName = daoDefinition.generateJava2ContentParser(paramTypeName); methodBuilder.addCode("$L($L.getBlob($L))", methodName, cursorName, indexName); }
[ "@", "Override", "public", "void", "generateReadValueFromCursor", "(", "Builder", "methodBuilder", ",", "SQLiteDaoDefinition", "daoDefinition", ",", "TypeName", "paramTypeName", ",", "String", "cursorName", ",", "String", "indexName", ")", "{", "String", "methodName", ...
/* (non-Javadoc) @see com.abubusoft.kripton.processor.sqlite.transform.AbstractSQLTransform#generateReadValueFromCursor(com.squareup.javapoet.MethodSpec.Builder, com.abubusoft.kripton.processor.sqlite.model.SQLiteDaoDefinition, com.squareup.javapoet.TypeName, java.lang.String, java.lang.String)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/transform/AbstractGeneratedSQLTransform.java#L69-L74
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.postponeSubscription
public Subscription postponeSubscription(final Subscription subscription, final DateTime renewaldate) { return doPUT(Subscription.SUBSCRIPTION_RESOURCE + "/" + subscription.getUuid() + "/postpone?next_renewal_date=" + renewaldate, subscription, Subscription.class); }
java
public Subscription postponeSubscription(final Subscription subscription, final DateTime renewaldate) { return doPUT(Subscription.SUBSCRIPTION_RESOURCE + "/" + subscription.getUuid() + "/postpone?next_renewal_date=" + renewaldate, subscription, Subscription.class); }
[ "public", "Subscription", "postponeSubscription", "(", "final", "Subscription", "subscription", ",", "final", "DateTime", "renewaldate", ")", "{", "return", "doPUT", "(", "Subscription", ".", "SUBSCRIPTION_RESOURCE", "+", "\"/\"", "+", "subscription", ".", "getUuid", ...
Postpone a subscription <p> postpone a subscription, setting a new renewal date. @param subscription Subscription object @return Subscription
[ "Postpone", "a", "subscription", "<p", ">", "postpone", "a", "subscription", "setting", "a", "new", "renewal", "date", "." ]
train
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L551-L554
srikalyc/Sql4D
IndexerAgent/src/main/java/com/yahoo/sql4d/indexeragent/actors/MainActor.java
MainActor.bootFromDsqls
private void bootFromDsqls(String path) { File[] files = new File(path).listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.endsWith(".sql"); } }); for (File file:files) {//In this context only add/update is cared for. sqlSniffer.onCreate(Paths.get(file.toURI())); } }
java
private void bootFromDsqls(String path) { File[] files = new File(path).listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.endsWith(".sql"); } }); for (File file:files) {//In this context only add/update is cared for. sqlSniffer.onCreate(Paths.get(file.toURI())); } }
[ "private", "void", "bootFromDsqls", "(", "String", "path", ")", "{", "File", "[", "]", "files", "=", "new", "File", "(", "path", ")", ".", "listFiles", "(", "new", "FilenameFilter", "(", ")", "{", "@", "Override", "public", "boolean", "accept", "(", "F...
Read off a bunch of sql files expecting insert statements within them.
[ "Read", "off", "a", "bunch", "of", "sql", "files", "expecting", "insert", "statements", "within", "them", "." ]
train
https://github.com/srikalyc/Sql4D/blob/2c052fe60ead5a16277c798a3440de7d4f6f24f6/IndexerAgent/src/main/java/com/yahoo/sql4d/indexeragent/actors/MainActor.java#L142-L153
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/MediaApi.java
MediaApi.pullInteractionFromWorkbin
public ApiSuccessResponse pullInteractionFromWorkbin(String mediatype, String id, PullInteractionFromWorkbinData pullInteractionFromWorkbinData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = pullInteractionFromWorkbinWithHttpInfo(mediatype, id, pullInteractionFromWorkbinData); return resp.getData(); }
java
public ApiSuccessResponse pullInteractionFromWorkbin(String mediatype, String id, PullInteractionFromWorkbinData pullInteractionFromWorkbinData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = pullInteractionFromWorkbinWithHttpInfo(mediatype, id, pullInteractionFromWorkbinData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "pullInteractionFromWorkbin", "(", "String", "mediatype", ",", "String", "id", ",", "PullInteractionFromWorkbinData", "pullInteractionFromWorkbinData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", ...
Pull an Interaction from a Workbin @param mediatype The media channel. (required) @param id The ID of the interaction. (required) @param pullInteractionFromWorkbinData (optional) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Pull", "an", "Interaction", "from", "a", "Workbin" ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/MediaApi.java#L3255-L3258
Netflix/spectator
spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/BucketCounter.java
BucketCounter.get
public static BucketCounter get(Id id, BucketFunction f) { return get(Spectator.globalRegistry(), id, f); }
java
public static BucketCounter get(Id id, BucketFunction f) { return get(Spectator.globalRegistry(), id, f); }
[ "public", "static", "BucketCounter", "get", "(", "Id", "id", ",", "BucketFunction", "f", ")", "{", "return", "get", "(", "Spectator", ".", "globalRegistry", "(", ")", ",", "id", ",", "f", ")", ";", "}" ]
Creates a distribution summary object that manages a set of counters based on the bucket function supplied. Calling record will increment the appropriate counter. @param id Identifier for the metric being registered. @param f Function to map values to buckets. @return Distribution summary that manages sub-counters based on the bucket function.
[ "Creates", "a", "distribution", "summary", "object", "that", "manages", "a", "set", "of", "counters", "based", "on", "the", "bucket", "function", "supplied", ".", "Calling", "record", "will", "increment", "the", "appropriate", "counter", "." ]
train
https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-ext-sandbox/src/main/java/com/netflix/spectator/sandbox/BucketCounter.java#L44-L46
lessthanoptimal/BoofCV
main/boofcv-types/src/main/java/boofcv/struct/PackedSetsPoint2D_I32.java
PackedSetsPoint2D_I32.writeOverSet
public void writeOverSet(int which, List<Point2D_I32> points) { BlockIndexLength set = sets.get(which); if( set.length != points.size() ) throw new IllegalArgumentException("points and set don't have the same length"); for (int i = 0; i < set.length; i++) { int index = set.start + i*2; int blockIndex = set.block + index/blockLength; index %= blockLength; Point2D_I32 p = points.get(i); int block[] = blocks.get( blockIndex ); block[index] = p.x; block[index+1] = p.y; } }
java
public void writeOverSet(int which, List<Point2D_I32> points) { BlockIndexLength set = sets.get(which); if( set.length != points.size() ) throw new IllegalArgumentException("points and set don't have the same length"); for (int i = 0; i < set.length; i++) { int index = set.start + i*2; int blockIndex = set.block + index/blockLength; index %= blockLength; Point2D_I32 p = points.get(i); int block[] = blocks.get( blockIndex ); block[index] = p.x; block[index+1] = p.y; } }
[ "public", "void", "writeOverSet", "(", "int", "which", ",", "List", "<", "Point2D_I32", ">", "points", ")", "{", "BlockIndexLength", "set", "=", "sets", ".", "get", "(", "which", ")", ";", "if", "(", "set", ".", "length", "!=", "points", ".", "size", ...
Overwrites the points in the set with the list of points. @param points Points which are to be written into the set. Must be the same size as the set.
[ "Overwrites", "the", "points", "in", "the", "set", "with", "the", "list", "of", "points", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/struct/PackedSetsPoint2D_I32.java#L199-L214
jbundle/jbundle
thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/TableProxy.java
TableProxy.setRemoteProperty
public void setRemoteProperty(String strProperty, String strValue) throws RemoteException { BaseTransport transport = this.createProxyTransport(SET_REMOTE_PROPERTY); transport.addParam(KEY, strProperty); transport.addParam(VALUE, strValue); Object strReturn = transport.sendMessageAndGetReply(); /*Object objReturn = */transport.convertReturnObject(strReturn); //x this.checkException(objReturn); }
java
public void setRemoteProperty(String strProperty, String strValue) throws RemoteException { BaseTransport transport = this.createProxyTransport(SET_REMOTE_PROPERTY); transport.addParam(KEY, strProperty); transport.addParam(VALUE, strValue); Object strReturn = transport.sendMessageAndGetReply(); /*Object objReturn = */transport.convertReturnObject(strReturn); //x this.checkException(objReturn); }
[ "public", "void", "setRemoteProperty", "(", "String", "strProperty", ",", "String", "strValue", ")", "throws", "RemoteException", "{", "BaseTransport", "transport", "=", "this", ".", "createProxyTransport", "(", "SET_REMOTE_PROPERTY", ")", ";", "transport", ".", "ad...
Set a table property. @param strProperty The key to set. @param strValue The value to set it to.
[ "Set", "a", "table", "property", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/TableProxy.java#L240-L248
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/gen/StorableGenerator.java
StorableGenerator.loadThisProperty
private void loadThisProperty(CodeBuilder b, StorableProperty property, TypeDesc type) { b.loadThis(); if (property.isDerived()) { b.invoke(property.getReadMethod()); } else { b.loadField(property.getName(), type); } }
java
private void loadThisProperty(CodeBuilder b, StorableProperty property, TypeDesc type) { b.loadThis(); if (property.isDerived()) { b.invoke(property.getReadMethod()); } else { b.loadField(property.getName(), type); } }
[ "private", "void", "loadThisProperty", "(", "CodeBuilder", "b", ",", "StorableProperty", "property", ",", "TypeDesc", "type", ")", "{", "b", ".", "loadThis", "(", ")", ";", "if", "(", "property", ".", "isDerived", "(", ")", ")", "{", "b", ".", "invoke", ...
Loads the property value of the current storable onto the stack. If the property is derived the read method is used, otherwise it just loads the value from the appropriate field. entry stack: [ exit stack: [value @param b - {@link CodeBuilder} to which to add the load code @param property - property to load @param type - type of the property
[ "Loads", "the", "property", "value", "of", "the", "current", "storable", "onto", "the", "stack", ".", "If", "the", "property", "is", "derived", "the", "read", "method", "is", "used", "otherwise", "it", "just", "loads", "the", "value", "from", "the", "appro...
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/gen/StorableGenerator.java#L2077-L2084
couchbase/couchbase-jvm-core
src/main/java/com/couchbase/client/core/RequestHandler.java
RequestHandler.checkFeaturesForRequest
protected void checkFeaturesForRequest(final CouchbaseRequest request, final BucketConfig config) { if (request instanceof BinaryRequest && !config.serviceEnabled(ServiceType.BINARY)) { throw new ServiceNotAvailableException("The KeyValue service is not enabled or no node in the cluster " + "supports it."); } else if (request instanceof ViewRequest && !config.serviceEnabled(ServiceType.VIEW)) { throw new ServiceNotAvailableException("The View service is not enabled or no node in the cluster " + "supports it."); } else if (request instanceof QueryRequest && !config.serviceEnabled(ServiceType.QUERY)) { throw new ServiceNotAvailableException("The Query service is not enabled or no node in the " + "cluster supports it."); } else if (request instanceof SearchRequest && !config.serviceEnabled(ServiceType.SEARCH)) { throw new ServiceNotAvailableException("The Search service is not enabled or no node in the " + "cluster supports it."); } else if (request instanceof AnalyticsRequest && !config.serviceEnabled(ServiceType.ANALYTICS)) { throw new ServiceNotAvailableException("The Analytics service is not enabled or no node in the " + "cluster supports it."); } }
java
protected void checkFeaturesForRequest(final CouchbaseRequest request, final BucketConfig config) { if (request instanceof BinaryRequest && !config.serviceEnabled(ServiceType.BINARY)) { throw new ServiceNotAvailableException("The KeyValue service is not enabled or no node in the cluster " + "supports it."); } else if (request instanceof ViewRequest && !config.serviceEnabled(ServiceType.VIEW)) { throw new ServiceNotAvailableException("The View service is not enabled or no node in the cluster " + "supports it."); } else if (request instanceof QueryRequest && !config.serviceEnabled(ServiceType.QUERY)) { throw new ServiceNotAvailableException("The Query service is not enabled or no node in the " + "cluster supports it."); } else if (request instanceof SearchRequest && !config.serviceEnabled(ServiceType.SEARCH)) { throw new ServiceNotAvailableException("The Search service is not enabled or no node in the " + "cluster supports it."); } else if (request instanceof AnalyticsRequest && !config.serviceEnabled(ServiceType.ANALYTICS)) { throw new ServiceNotAvailableException("The Analytics service is not enabled or no node in the " + "cluster supports it."); } }
[ "protected", "void", "checkFeaturesForRequest", "(", "final", "CouchbaseRequest", "request", ",", "final", "BucketConfig", "config", ")", "{", "if", "(", "request", "instanceof", "BinaryRequest", "&&", "!", "config", ".", "serviceEnabled", "(", "ServiceType", ".", ...
Checks, for a sub-set of {@link CouchbaseRequest}, if the current environment has the necessary feature activated. If not, throws an {@link ServiceNotAvailableException}. @param request the request to check. @throws ServiceNotAvailableException if the request type needs a particular feature which isn't activated.
[ "Checks", "for", "a", "sub", "-", "set", "of", "{", "@link", "CouchbaseRequest", "}", "if", "the", "current", "environment", "has", "the", "necessary", "feature", "activated", ".", "If", "not", "throws", "an", "{", "@link", "ServiceNotAvailableException", "}",...
train
https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/RequestHandler.java#L269-L286
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java
ValueEnforcer.isEqual
public static void isEqual (final double dValue, final double dExpectedValue, final String sName) { if (isEnabled ()) isEqual (dValue, dExpectedValue, () -> sName); }
java
public static void isEqual (final double dValue, final double dExpectedValue, final String sName) { if (isEnabled ()) isEqual (dValue, dExpectedValue, () -> sName); }
[ "public", "static", "void", "isEqual", "(", "final", "double", "dValue", ",", "final", "double", "dExpectedValue", ",", "final", "String", "sName", ")", "{", "if", "(", "isEnabled", "(", ")", ")", "isEqual", "(", "dValue", ",", "dExpectedValue", ",", "(", ...
Check that the passed value is the same as the provided expected value using <code>==</code> to check comparison. @param dValue The First value. @param dExpectedValue The expected value. @param sName The name of the value (e.g. the parameter name) @throws IllegalArgumentException if the passed value is not <code>null</code>.
[ "Check", "that", "the", "passed", "value", "is", "the", "same", "as", "the", "provided", "expected", "value", "using", "<code", ">", "==", "<", "/", "code", ">", "to", "check", "comparison", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/ValueEnforcer.java#L1626-L1630
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/br/br_configurebandwidth6x.java
br_configurebandwidth6x.configurebandwidth6x
public static br_configurebandwidth6x configurebandwidth6x(nitro_service client, br_configurebandwidth6x resource) throws Exception { return ((br_configurebandwidth6x[]) resource.perform_operation(client, "configurebandwidth6x"))[0]; }
java
public static br_configurebandwidth6x configurebandwidth6x(nitro_service client, br_configurebandwidth6x resource) throws Exception { return ((br_configurebandwidth6x[]) resource.perform_operation(client, "configurebandwidth6x"))[0]; }
[ "public", "static", "br_configurebandwidth6x", "configurebandwidth6x", "(", "nitro_service", "client", ",", "br_configurebandwidth6x", "resource", ")", "throws", "Exception", "{", "return", "(", "(", "br_configurebandwidth6x", "[", "]", ")", "resource", ".", "perform_op...
<pre> Use this operation to configure Repeater bandwidth of devices of version 6.x or later. </pre>
[ "<pre", ">", "Use", "this", "operation", "to", "configure", "Repeater", "bandwidth", "of", "devices", "of", "version", "6", ".", "x", "or", "later", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/br/br_configurebandwidth6x.java#L126-L129
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java
Query.orderBy
@Nonnull public Query orderBy(@Nonnull FieldPath fieldPath) { return orderBy(fieldPath, Direction.ASCENDING); }
java
@Nonnull public Query orderBy(@Nonnull FieldPath fieldPath) { return orderBy(fieldPath, Direction.ASCENDING); }
[ "@", "Nonnull", "public", "Query", "orderBy", "(", "@", "Nonnull", "FieldPath", "fieldPath", ")", "{", "return", "orderBy", "(", "fieldPath", ",", "Direction", ".", "ASCENDING", ")", ";", "}" ]
Creates and returns a new Query that's additionally sorted by the specified field. @param fieldPath The field to sort by. @return The created Query.
[ "Creates", "and", "returns", "a", "new", "Query", "that", "s", "additionally", "sorted", "by", "the", "specified", "field", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java#L632-L635
jbundle/jbundle
base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcTable.java
JdbcTable.doRemove
public void doRemove() throws DBException { Object bookmark = this.getRecord().getHandle(DBConstants.BOOKMARK_HANDLE); String strRecordset = this.getRecord().getSQLDelete(SQLParams.USE_INSERT_UPDATE_LITERALS); this.executeUpdate(strRecordset, DBConstants.SQL_DELETE_TYPE); if (m_iRow != -1) m_iRow--; // Just in case I'm in an active query this will keep requeries correct if (this.lockOnDBTrxType(null, DBConstants.AFTER_DELETE_TYPE, false)) // Should I do the unlock in my code? this.unlockIfLocked(this.getRecord(), bookmark); }
java
public void doRemove() throws DBException { Object bookmark = this.getRecord().getHandle(DBConstants.BOOKMARK_HANDLE); String strRecordset = this.getRecord().getSQLDelete(SQLParams.USE_INSERT_UPDATE_LITERALS); this.executeUpdate(strRecordset, DBConstants.SQL_DELETE_TYPE); if (m_iRow != -1) m_iRow--; // Just in case I'm in an active query this will keep requeries correct if (this.lockOnDBTrxType(null, DBConstants.AFTER_DELETE_TYPE, false)) // Should I do the unlock in my code? this.unlockIfLocked(this.getRecord(), bookmark); }
[ "public", "void", "doRemove", "(", ")", "throws", "DBException", "{", "Object", "bookmark", "=", "this", ".", "getRecord", "(", ")", ".", "getHandle", "(", "DBConstants", ".", "BOOKMARK_HANDLE", ")", ";", "String", "strRecordset", "=", "this", ".", "getRecor...
Delete this record (Always called from the record class). Do a SQL delete. @exception DBException INVALID_RECORD - Attempt to delete a record that is not current.
[ "Delete", "this", "record", "(", "Always", "called", "from", "the", "record", "class", ")", ".", "Do", "a", "SQL", "delete", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/db/jdbc/src/main/java/org/jbundle/base/db/jdbc/JdbcTable.java#L559-L568
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/services/network/NetworkUtil.java
NetworkUtil.toInetSocketAddress
public static InetSocketAddress toInetSocketAddress(URI uri) { final InetAddress adr = toInetAddress(uri); final int port = uri.getPort(); if (port <= 0) { throw new IllegalArgumentException(uri.toString()); } return new InetSocketAddress(adr, port); }
java
public static InetSocketAddress toInetSocketAddress(URI uri) { final InetAddress adr = toInetAddress(uri); final int port = uri.getPort(); if (port <= 0) { throw new IllegalArgumentException(uri.toString()); } return new InetSocketAddress(adr, port); }
[ "public", "static", "InetSocketAddress", "toInetSocketAddress", "(", "URI", "uri", ")", "{", "final", "InetAddress", "adr", "=", "toInetAddress", "(", "uri", ")", ";", "final", "int", "port", "=", "uri", ".", "getPort", "(", ")", ";", "if", "(", "port", ...
Extract an Inet address from an URI. @param uri the address. @return the address.
[ "Extract", "an", "Inet", "address", "from", "an", "URI", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/services/network/NetworkUtil.java#L229-L236
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/jboss/logging/Logger.java
Logger.infof
public void infof(Throwable t, String format, Object... params) { doLogf(Level.INFO, FQCN, format, params, t); }
java
public void infof(Throwable t, String format, Object... params) { doLogf(Level.INFO, FQCN, format, params, t); }
[ "public", "void", "infof", "(", "Throwable", "t", ",", "String", "format", ",", "Object", "...", "params", ")", "{", "doLogf", "(", "Level", ".", "INFO", ",", "FQCN", ",", "format", ",", "params", ",", "t", ")", ";", "}" ]
Issue a formatted log message with a level of INFO. @param t the throwable @param format the format string, as per {@link String#format(String, Object...)} @param params the parameters
[ "Issue", "a", "formatted", "log", "message", "with", "a", "level", "of", "INFO", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L1174-L1176
Nexmo/nexmo-java
src/main/java/com/nexmo/client/numbers/NumbersClient.java
NumbersClient.buyNumber
public void buyNumber(String country, String msisdn) throws IOException, NexmoClientException { this.buyNumber.execute(new BuyNumberRequest(country, msisdn)); }
java
public void buyNumber(String country, String msisdn) throws IOException, NexmoClientException { this.buyNumber.execute(new BuyNumberRequest(country, msisdn)); }
[ "public", "void", "buyNumber", "(", "String", "country", ",", "String", "msisdn", ")", "throws", "IOException", ",", "NexmoClientException", "{", "this", ".", "buyNumber", ".", "execute", "(", "new", "BuyNumberRequest", "(", "country", ",", "msisdn", ")", ")",...
Start renting a Nexmo Virtual Number. @param country A String containing a 2-character ISO country code. @param msisdn The phone number to be bought. @throws IOException if an error occurs contacting the Nexmo API @throws NexmoClientException if an error is returned by the server.
[ "Start", "renting", "a", "Nexmo", "Virtual", "Number", "." ]
train
https://github.com/Nexmo/nexmo-java/blob/7427eff6d6baa5a5bd9197fa096bcf2564191cf5/src/main/java/com/nexmo/client/numbers/NumbersClient.java#L100-L102
UrielCh/ovh-java-sdk
ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java
ApiOvhIpLoadbalancing.serviceName_tcp_farm_farmId_server_GET
public ArrayList<Long> serviceName_tcp_farm_farmId_server_GET(String serviceName, Long farmId, String address, OvhBackendCustomerServerStatusEnum status) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/tcp/farm/{farmId}/server"; StringBuilder sb = path(qPath, serviceName, farmId); query(sb, "address", address); query(sb, "status", status); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
java
public ArrayList<Long> serviceName_tcp_farm_farmId_server_GET(String serviceName, Long farmId, String address, OvhBackendCustomerServerStatusEnum status) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/tcp/farm/{farmId}/server"; StringBuilder sb = path(qPath, serviceName, farmId); query(sb, "address", address); query(sb, "status", status); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
[ "public", "ArrayList", "<", "Long", ">", "serviceName_tcp_farm_farmId_server_GET", "(", "String", "serviceName", ",", "Long", "farmId", ",", "String", "address", ",", "OvhBackendCustomerServerStatusEnum", "status", ")", "throws", "IOException", "{", "String", "qPath", ...
TCP Farm's Servers REST: GET /ipLoadbalancing/{serviceName}/tcp/farm/{farmId}/server @param address [required] Filter the value of address property (=) @param status [required] Filter the value of status property (=) @param serviceName [required] The internal name of your IP load balancing @param farmId [required] Id of your farm
[ "TCP", "Farm", "s", "Servers" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L1656-L1663
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/LocalNetworkGatewaysInner.java
LocalNetworkGatewaysInner.updateTags
public LocalNetworkGatewayInner updateTags(String resourceGroupName, String localNetworkGatewayName, Map<String, String> tags) { return updateTagsWithServiceResponseAsync(resourceGroupName, localNetworkGatewayName, tags).toBlocking().last().body(); }
java
public LocalNetworkGatewayInner updateTags(String resourceGroupName, String localNetworkGatewayName, Map<String, String> tags) { return updateTagsWithServiceResponseAsync(resourceGroupName, localNetworkGatewayName, tags).toBlocking().last().body(); }
[ "public", "LocalNetworkGatewayInner", "updateTags", "(", "String", "resourceGroupName", ",", "String", "localNetworkGatewayName", ",", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "updateTagsWithServiceResponseAsync", "(", "resourceGroupName", "...
Updates a local network gateway tags. @param resourceGroupName The name of the resource group. @param localNetworkGatewayName The name of the local network gateway. @param tags Resource tags. @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 LocalNetworkGatewayInner object if successful.
[ "Updates", "a", "local", "network", "gateway", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/LocalNetworkGatewaysInner.java#L590-L592
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.listPresets
public ListPresetsResponse listPresets() { ListPresetsRequest request = new ListPresetsRequest(); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, LIVE_PRESET); return invokeHttpClient(internalRequest, ListPresetsResponse.class); }
java
public ListPresetsResponse listPresets() { ListPresetsRequest request = new ListPresetsRequest(); InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, LIVE_PRESET); return invokeHttpClient(internalRequest, ListPresetsResponse.class); }
[ "public", "ListPresetsResponse", "listPresets", "(", ")", "{", "ListPresetsRequest", "request", "=", "new", "ListPresetsRequest", "(", ")", ";", "InternalRequest", "internalRequest", "=", "createRequest", "(", "HttpMethodName", ".", "GET", ",", "request", ",", "LIVE...
List all your live presets. @return The list of all your live presets
[ "List", "all", "your", "live", "presets", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L393-L397
duracloud/duracloud
durastore/src/main/java/org/duracloud/durastore/rest/SpaceRest.java
SpaceRest.getSpaces
@Path("/spaces") @GET @Produces(XML) public Response getSpaces(@QueryParam("storeID") String storeID) { String msg = "getting spaces(" + storeID + ")"; try { String xml = spaceResource.getSpaces(storeID); return responseOkXml(msg, xml); } catch (ResourceException e) { return responseBad(msg, e, INTERNAL_SERVER_ERROR); } catch (Exception e) { return responseBad(msg, e, INTERNAL_SERVER_ERROR); } }
java
@Path("/spaces") @GET @Produces(XML) public Response getSpaces(@QueryParam("storeID") String storeID) { String msg = "getting spaces(" + storeID + ")"; try { String xml = spaceResource.getSpaces(storeID); return responseOkXml(msg, xml); } catch (ResourceException e) { return responseBad(msg, e, INTERNAL_SERVER_ERROR); } catch (Exception e) { return responseBad(msg, e, INTERNAL_SERVER_ERROR); } }
[ "@", "Path", "(", "\"/spaces\"", ")", "@", "GET", "@", "Produces", "(", "XML", ")", "public", "Response", "getSpaces", "(", "@", "QueryParam", "(", "\"storeID\"", ")", "String", "storeID", ")", "{", "String", "msg", "=", "\"getting spaces(\"", "+", "storeI...
see SpaceResource.getSpaces() @return 200 response with XML listing of spaces
[ "see", "SpaceResource", ".", "getSpaces", "()" ]
train
https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/durastore/src/main/java/org/duracloud/durastore/rest/SpaceRest.java#L67-L83
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.iiop/src/com/ibm/ws/transport/iiop/yoko/helper/SocketFactoryHelper.java
SocketFactoryHelper.attemptSocketBind
private void attemptSocketBind(ServerSocket serverSocket, SocketAddress address, boolean reuseflag, int backlog) throws IOException { serverSocket.setReuseAddress(reuseflag); serverSocket.bind(address, backlog); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "ServerSocket bind worked, reuse=" + serverSocket.getReuseAddress()); } }
java
private void attemptSocketBind(ServerSocket serverSocket, SocketAddress address, boolean reuseflag, int backlog) throws IOException { serverSocket.setReuseAddress(reuseflag); serverSocket.bind(address, backlog); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "ServerSocket bind worked, reuse=" + serverSocket.getReuseAddress()); } }
[ "private", "void", "attemptSocketBind", "(", "ServerSocket", "serverSocket", ",", "SocketAddress", "address", ",", "boolean", "reuseflag", ",", "int", "backlog", ")", "throws", "IOException", "{", "serverSocket", ".", "setReuseAddress", "(", "reuseflag", ")", ";", ...
Attempt a socket bind to the input address with the given re-use option flag. @param address @param reuseflag @throws IOException
[ "Attempt", "a", "socket", "bind", "to", "the", "input", "address", "with", "the", "given", "re", "-", "use", "option", "flag", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.iiop/src/com/ibm/ws/transport/iiop/yoko/helper/SocketFactoryHelper.java#L137-L143
ef-labs/vertx-when
vertx-when/src/main/java/com/englishtown/vertx/promises/impl/DefaultWhenFileSystem.java
DefaultWhenFileSystem.chmod
@Override public Promise<Void> chmod(String path, String perms) { return adapter.toPromise(handler -> vertx.fileSystem().chmod(path, perms, handler)); }
java
@Override public Promise<Void> chmod(String path, String perms) { return adapter.toPromise(handler -> vertx.fileSystem().chmod(path, perms, handler)); }
[ "@", "Override", "public", "Promise", "<", "Void", ">", "chmod", "(", "String", "path", ",", "String", "perms", ")", "{", "return", "adapter", ".", "toPromise", "(", "handler", "->", "vertx", ".", "fileSystem", "(", ")", ".", "chmod", "(", "path", ",",...
Change the permissions on the file represented by {@code path} to {@code perms}, asynchronously. <p> The permission String takes the form rwxr-x--- as specified <a href="http://download.oracle.com/javase/7/docs/api/java/nio/file/attribute/PosixFilePermissions.html">here</a>. @param path the path to the file @param perms the permissions string @return a promise for completion
[ "Change", "the", "permissions", "on", "the", "file", "represented", "by", "{", "@code", "path", "}", "to", "{", "@code", "perms", "}", "asynchronously", ".", "<p", ">", "The", "permission", "String", "takes", "the", "form", "rwxr", "-", "x", "---", "as",...
train
https://github.com/ef-labs/vertx-when/blob/dc4fde973f58130f2eb2159206ee78b867048f4d/vertx-when/src/main/java/com/englishtown/vertx/promises/impl/DefaultWhenFileSystem.java#L105-L108
windup/windup
config/api/src/main/java/org/jboss/windup/config/tags/TagService.java
TagService.getOrCreateTag
public Tag getOrCreateTag(String tagName, boolean isRef) { if (null == tagName) throw new IllegalArgumentException("Looking for a null tag name."); tagName = Tag.normalizeName(tagName); synchronized (this.definedTags) { if (definedTags.containsKey(tagName)) return definedTags.get(tagName); else { final Tag tag = new Tag(tagName); definedTags.put(tagName, tag); return tag; } } }
java
public Tag getOrCreateTag(String tagName, boolean isRef) { if (null == tagName) throw new IllegalArgumentException("Looking for a null tag name."); tagName = Tag.normalizeName(tagName); synchronized (this.definedTags) { if (definedTags.containsKey(tagName)) return definedTags.get(tagName); else { final Tag tag = new Tag(tagName); definedTags.put(tagName, tag); return tag; } } }
[ "public", "Tag", "getOrCreateTag", "(", "String", "tagName", ",", "boolean", "isRef", ")", "{", "if", "(", "null", "==", "tagName", ")", "throw", "new", "IllegalArgumentException", "(", "\"Looking for a null tag name.\"", ")", ";", "tagName", "=", "Tag", ".", ...
Gets the {@link Tag} with the given name or creates a new {@link Tag} if one does not already exist. @param isRef True if the given tag name is a reference, in which case it should already exist.
[ "Gets", "the", "{", "@link", "Tag", "}", "with", "the", "given", "name", "or", "creates", "a", "new", "{", "@link", "Tag", "}", "if", "one", "does", "not", "already", "exist", "." ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/config/api/src/main/java/org/jboss/windup/config/tags/TagService.java#L95-L112
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ConcurrentHashMap.java
TreeBin.tieBreakOrder
static int tieBreakOrder(Object a, Object b) { int d; if (a == null || b == null || (d = a.getClass().getName(). compareTo(b.getClass().getName())) == 0) d = (System.identityHashCode(a) <= System.identityHashCode(b) ? -1 : 1); return d; }
java
static int tieBreakOrder(Object a, Object b) { int d; if (a == null || b == null || (d = a.getClass().getName(). compareTo(b.getClass().getName())) == 0) d = (System.identityHashCode(a) <= System.identityHashCode(b) ? -1 : 1); return d; }
[ "static", "int", "tieBreakOrder", "(", "Object", "a", ",", "Object", "b", ")", "{", "int", "d", ";", "if", "(", "a", "==", "null", "||", "b", "==", "null", "||", "(", "d", "=", "a", ".", "getClass", "(", ")", ".", "getName", "(", ")", ".", "c...
Tie-breaking utility for ordering insertions when equal hashCodes and non-comparable. We don't require a total order, just a consistent insertion rule to maintain equivalence across rebalancings. Tie-breaking further than necessary simplifies testing a bit.
[ "Tie", "-", "breaking", "utility", "for", "ordering", "insertions", "when", "equal", "hashCodes", "and", "non", "-", "comparable", ".", "We", "don", "t", "require", "a", "total", "order", "just", "a", "consistent", "insertion", "rule", "to", "maintain", "equ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ConcurrentHashMap.java#L2800-L2808
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/DynamicURLClassLoader.java
DynamicURLClassLoader.newInstance
@Pure public static DynamicURLClassLoader newInstance(final ClassLoader parent, final URL... urls) { // Save the caller's context final AccessControlContext acc = AccessController.getContext(); // Need a privileged block to create the class loader return AccessController.doPrivileged(new PrivilegedAction<DynamicURLClassLoader>() { @Override public DynamicURLClassLoader run() { // Now set the context on the loader using the one we saved, // not the one inside the privileged block... return new FactoryDynamicURLClassLoader(parent, acc, urls); } }); }
java
@Pure public static DynamicURLClassLoader newInstance(final ClassLoader parent, final URL... urls) { // Save the caller's context final AccessControlContext acc = AccessController.getContext(); // Need a privileged block to create the class loader return AccessController.doPrivileged(new PrivilegedAction<DynamicURLClassLoader>() { @Override public DynamicURLClassLoader run() { // Now set the context on the loader using the one we saved, // not the one inside the privileged block... return new FactoryDynamicURLClassLoader(parent, acc, urls); } }); }
[ "@", "Pure", "public", "static", "DynamicURLClassLoader", "newInstance", "(", "final", "ClassLoader", "parent", ",", "final", "URL", "...", "urls", ")", "{", "// Save the caller's context", "final", "AccessControlContext", "acc", "=", "AccessController", ".", "getCont...
Creates a new instance of DynamicURLClassLoader for the specified URLs and parent class loader. If a security manager is installed, the <code>loadClass</code> method of the URLClassLoader returned by this method will invoke the <code>SecurityManager.checkPackageAccess</code> method before loading the class. @param parent the parent class loader for delegation @param urls the URLs to search for classes and resources @return the resulting class loader
[ "Creates", "a", "new", "instance", "of", "DynamicURLClassLoader", "for", "the", "specified", "URLs", "and", "parent", "class", "loader", ".", "If", "a", "security", "manager", "is", "installed", "the", "<code", ">", "loadClass<", "/", "code", ">", "method", ...
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/DynamicURLClassLoader.java#L519-L532
peholmst/vaadin4spring
extensions/security/src/main/java/org/vaadin/spring/security/shared/DefaultVaadinSharedSecurity.java
DefaultVaadinSharedSecurity.unsuccessfulAuthentication
protected void unsuccessfulAuthentication(HttpServletRequest request, HttpServletResponse response) { LOGGER.debug("Authentication failed"); SecurityContextHolder.clearContext(); getRememberMeServices().loginFail(request, response); }
java
protected void unsuccessfulAuthentication(HttpServletRequest request, HttpServletResponse response) { LOGGER.debug("Authentication failed"); SecurityContextHolder.clearContext(); getRememberMeServices().loginFail(request, response); }
[ "protected", "void", "unsuccessfulAuthentication", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "{", "LOGGER", ".", "debug", "(", "\"Authentication failed\"", ")", ";", "SecurityContextHolder", ".", "clearContext", "(", ")", ";", ...
Called by {@link #login(Authentication, boolean)} upon unsuccessful authentication. This implementation will clear the security context holder and inform the {@code RememberMeServices} of the failed login. @param request the current request. @param response the current response.
[ "Called", "by", "{", "@link", "#login", "(", "Authentication", "boolean", ")", "}", "upon", "unsuccessful", "authentication", ".", "This", "implementation", "will", "clear", "the", "security", "context", "holder", "and", "inform", "the", "{", "@code", "RememberM...
train
https://github.com/peholmst/vaadin4spring/blob/ea896012f15d6abea6e6391def9a0001113a1f7a/extensions/security/src/main/java/org/vaadin/spring/security/shared/DefaultVaadinSharedSecurity.java#L115-L119
rharter/auto-value-gson
auto-value-gson/src/main/java/com/ryanharter/auto/value/gson/AutoValueGsonAdapterFactoryProcessor.java
AutoValueGsonAdapterFactoryProcessor.classNameOf
private static String classNameOf(TypeElement type, String delimiter) { String name = type.getSimpleName().toString(); while (type.getEnclosingElement() instanceof TypeElement) { type = (TypeElement) type.getEnclosingElement(); name = type.getSimpleName() + delimiter + name; } return name; }
java
private static String classNameOf(TypeElement type, String delimiter) { String name = type.getSimpleName().toString(); while (type.getEnclosingElement() instanceof TypeElement) { type = (TypeElement) type.getEnclosingElement(); name = type.getSimpleName() + delimiter + name; } return name; }
[ "private", "static", "String", "classNameOf", "(", "TypeElement", "type", ",", "String", "delimiter", ")", "{", "String", "name", "=", "type", ".", "getSimpleName", "(", ")", ".", "toString", "(", ")", ";", "while", "(", "type", ".", "getEnclosingElement", ...
Returns the name of the given type, including any enclosing types but not the package, separated by a delimiter.
[ "Returns", "the", "name", "of", "the", "given", "type", "including", "any", "enclosing", "types", "but", "not", "the", "package", "separated", "by", "a", "delimiter", "." ]
train
https://github.com/rharter/auto-value-gson/blob/68be3b6a208d25ac0580164f6372a38c279cf4fc/auto-value-gson/src/main/java/com/ryanharter/auto/value/gson/AutoValueGsonAdapterFactoryProcessor.java#L328-L335
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java
AbstractMemberWriter.addModifiers
protected void addModifiers(Element member, Content htmltree) { Set<Modifier> set = new TreeSet<>(member.getModifiers()); // remove the ones we really don't need set.remove(NATIVE); set.remove(SYNCHRONIZED); set.remove(STRICTFP); // According to JLS, we should not be showing public modifier for // interface methods. if ((utils.isField(member) || utils.isMethod(member)) && ((writer instanceof ClassWriterImpl && utils.isInterface(((ClassWriterImpl) writer).getTypeElement()) || writer instanceof AnnotationTypeWriterImpl) )) { // Remove the implicit abstract and public modifiers if (utils.isMethod(member) && (utils.isInterface(member.getEnclosingElement()) || utils.isAnnotationType(member.getEnclosingElement()))) { set.remove(ABSTRACT); set.remove(PUBLIC); } if (!utils.isMethod(member)) { set.remove(PUBLIC); } } if (!set.isEmpty()) { String mods = set.stream().map(Modifier::toString).collect(Collectors.joining(" ")); htmltree.addContent(mods); htmltree.addContent(Contents.SPACE); } }
java
protected void addModifiers(Element member, Content htmltree) { Set<Modifier> set = new TreeSet<>(member.getModifiers()); // remove the ones we really don't need set.remove(NATIVE); set.remove(SYNCHRONIZED); set.remove(STRICTFP); // According to JLS, we should not be showing public modifier for // interface methods. if ((utils.isField(member) || utils.isMethod(member)) && ((writer instanceof ClassWriterImpl && utils.isInterface(((ClassWriterImpl) writer).getTypeElement()) || writer instanceof AnnotationTypeWriterImpl) )) { // Remove the implicit abstract and public modifiers if (utils.isMethod(member) && (utils.isInterface(member.getEnclosingElement()) || utils.isAnnotationType(member.getEnclosingElement()))) { set.remove(ABSTRACT); set.remove(PUBLIC); } if (!utils.isMethod(member)) { set.remove(PUBLIC); } } if (!set.isEmpty()) { String mods = set.stream().map(Modifier::toString).collect(Collectors.joining(" ")); htmltree.addContent(mods); htmltree.addContent(Contents.SPACE); } }
[ "protected", "void", "addModifiers", "(", "Element", "member", ",", "Content", "htmltree", ")", "{", "Set", "<", "Modifier", ">", "set", "=", "new", "TreeSet", "<>", "(", "member", ".", "getModifiers", "(", ")", ")", ";", "// remove the ones we really don't ne...
Add the modifier for the member. The modifiers are ordered as specified by <em>The Java Language Specification</em>. @param member the member for which teh modifier will be added. @param htmltree the content tree to which the modifier information will be added.
[ "Add", "the", "modifier", "for", "the", "member", ".", "The", "modifiers", "are", "ordered", "as", "specified", "by", "<em", ">", "The", "Java", "Language", "Specification<", "/", "em", ">", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java#L234-L264
citrusframework/citrus
modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/functions/Functions.java
Functions.randomString
public static String randomString(Long numberOfLetters, boolean useNumbers, TestContext context) { return randomString(numberOfLetters, RandomStringFunction.MIXED, useNumbers, context); }
java
public static String randomString(Long numberOfLetters, boolean useNumbers, TestContext context) { return randomString(numberOfLetters, RandomStringFunction.MIXED, useNumbers, context); }
[ "public", "static", "String", "randomString", "(", "Long", "numberOfLetters", ",", "boolean", "useNumbers", ",", "TestContext", "context", ")", "{", "return", "randomString", "(", "numberOfLetters", ",", "RandomStringFunction", ".", "MIXED", ",", "useNumbers", ",", ...
Runs random string function with arguments. @param numberOfLetters @param useNumbers @return
[ "Runs", "random", "string", "function", "with", "arguments", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/functions/Functions.java#L197-L199
javamelody/javamelody
javamelody-swing/src/main/java/net/bull/javamelody/swing/Utilities.java
Utilities.createParagraphTitle
public static JLabel createParagraphTitle(String title, String iconName) { final JLabel label = new JLabel(title); label.setIcon(ImageIconCache.getScaledImageIcon(iconName, 24, 24)); label.setFont(label.getFont().deriveFont(Font.BOLD, label.getFont().getSize() + 4)); // séparateur avec composants au-dessus et en-dessous label.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); return label; }
java
public static JLabel createParagraphTitle(String title, String iconName) { final JLabel label = new JLabel(title); label.setIcon(ImageIconCache.getScaledImageIcon(iconName, 24, 24)); label.setFont(label.getFont().deriveFont(Font.BOLD, label.getFont().getSize() + 4)); // séparateur avec composants au-dessus et en-dessous label.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); return label; }
[ "public", "static", "JLabel", "createParagraphTitle", "(", "String", "title", ",", "String", "iconName", ")", "{", "final", "JLabel", "label", "=", "new", "JLabel", "(", "title", ")", ";", "label", ".", "setIcon", "(", "ImageIconCache", ".", "getScaledImageIco...
Création d'un JLabel de paragraphe. @param title String @param iconName String @return JLabel
[ "Création", "d", "un", "JLabel", "de", "paragraphe", "." ]
train
https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-swing/src/main/java/net/bull/javamelody/swing/Utilities.java#L74-L81
Stratio/stratio-connector-commons
connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsMetadataEngine.java
CommonsMetadataEngine.alterCatalog
@Override public final void alterCatalog(ClusterName targetCluster, CatalogName catalogName, Map<Selector, Selector> options) throws UnsupportedException, ExecutionException { try { connectionHandler.startJob(targetCluster.getName()); if (logger.isDebugEnabled()) { logger.debug( "Altering catalog[" + catalogName.getName() + "] in cluster [" + targetCluster.getName() + "]"); } alterCatalog(catalogName, options, connectionHandler.getConnection(targetCluster.getName())); if (logger.isDebugEnabled()) { logger.debug("Catalog [" + catalogName.getName() + "] has been altered successfully in cluster [" + targetCluster.getName() + "]"); } } finally { connectionHandler.endJob(targetCluster.getName()); } }
java
@Override public final void alterCatalog(ClusterName targetCluster, CatalogName catalogName, Map<Selector, Selector> options) throws UnsupportedException, ExecutionException { try { connectionHandler.startJob(targetCluster.getName()); if (logger.isDebugEnabled()) { logger.debug( "Altering catalog[" + catalogName.getName() + "] in cluster [" + targetCluster.getName() + "]"); } alterCatalog(catalogName, options, connectionHandler.getConnection(targetCluster.getName())); if (logger.isDebugEnabled()) { logger.debug("Catalog [" + catalogName.getName() + "] has been altered successfully in cluster [" + targetCluster.getName() + "]"); } } finally { connectionHandler.endJob(targetCluster.getName()); } }
[ "@", "Override", "public", "final", "void", "alterCatalog", "(", "ClusterName", "targetCluster", ",", "CatalogName", "catalogName", ",", "Map", "<", "Selector", ",", "Selector", ">", "options", ")", "throws", "UnsupportedException", ",", "ExecutionException", "{", ...
Alter options in an existing table. @param targetCluster the target cluster where the catalog will be altered. @param catalogName the catalog name @param options the options @throws UnsupportedException if the operation is not supported @throws ExecutionException if any error happen during the execution
[ "Alter", "options", "in", "an", "existing", "table", "." ]
train
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/engine/CommonsMetadataEngine.java#L301-L321
jronrun/benayn
benayn-ustyle/src/main/java/com/benayn/ustyle/string/AbstrStrMatcher.java
AbstrStrMatcher.joinWith
public String joinWith(String separator, Object... join) { return Joiner.on(separator).join(delegate.get(), EMPTY, join); }
java
public String joinWith(String separator, Object... join) { return Joiner.on(separator).join(delegate.get(), EMPTY, join); }
[ "public", "String", "joinWith", "(", "String", "separator", ",", "Object", "...", "join", ")", "{", "return", "Joiner", ".", "on", "(", "separator", ")", ".", "join", "(", "delegate", ".", "get", "(", ")", ",", "EMPTY", ",", "join", ")", ";", "}" ]
Returns a new string that append the specified string to the delegate string with specified separator @param join @return
[ "Returns", "a", "new", "string", "that", "append", "the", "specified", "string", "to", "the", "delegate", "string", "with", "specified", "separator" ]
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/AbstrStrMatcher.java#L88-L90
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/factory/interpolate/FactoryInterpolation.java
FactoryInterpolation.createPixelS
public static <T extends ImageGray<T>> InterpolatePixelS<T> createPixelS(double min, double max, InterpolationType type, BorderType borderType , ImageDataType dataType ) { Class t = ImageDataType.typeToSingleClass(dataType); return createPixelS(min,max,type,borderType,t); }
java
public static <T extends ImageGray<T>> InterpolatePixelS<T> createPixelS(double min, double max, InterpolationType type, BorderType borderType , ImageDataType dataType ) { Class t = ImageDataType.typeToSingleClass(dataType); return createPixelS(min,max,type,borderType,t); }
[ "public", "static", "<", "T", "extends", "ImageGray", "<", "T", ">", ">", "InterpolatePixelS", "<", "T", ">", "createPixelS", "(", "double", "min", ",", "double", "max", ",", "InterpolationType", "type", ",", "BorderType", "borderType", ",", "ImageDataType", ...
Returns {@link InterpolatePixelS} of the specified type. @param min Minimum possible pixel value. Inclusive. @param max Maximum possible pixel value. Inclusive. @param type Type of interpolation. @param dataType Type of gray-scale image @return Interpolation for single band image
[ "Returns", "{", "@link", "InterpolatePixelS", "}", "of", "the", "specified", "type", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/factory/interpolate/FactoryInterpolation.java#L46-L53
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VpnSitesInner.java
VpnSitesInner.beginCreateOrUpdate
public VpnSiteInner beginCreateOrUpdate(String resourceGroupName, String vpnSiteName, VpnSiteInner vpnSiteParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, vpnSiteName, vpnSiteParameters).toBlocking().single().body(); }
java
public VpnSiteInner beginCreateOrUpdate(String resourceGroupName, String vpnSiteName, VpnSiteInner vpnSiteParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, vpnSiteName, vpnSiteParameters).toBlocking().single().body(); }
[ "public", "VpnSiteInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "vpnSiteName", ",", "VpnSiteInner", "vpnSiteParameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "vpnSiteName", ",", ...
Creates a VpnSite resource if it doesn't exist else updates the existing VpnSite. @param resourceGroupName The resource group name of the VpnSite. @param vpnSiteName The name of the VpnSite being created or updated. @param vpnSiteParameters Parameters supplied to create or update VpnSite. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the VpnSiteInner object if successful.
[ "Creates", "a", "VpnSite", "resource", "if", "it", "doesn", "t", "exist", "else", "updates", "the", "existing", "VpnSite", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/VpnSitesInner.java#L286-L288
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java
AbstractManagedType.isBindable
private <E> boolean isBindable(Bindable<?> attribute, Class<E> elementType) { return attribute != null && attribute.getBindableJavaType().equals(elementType); }
java
private <E> boolean isBindable(Bindable<?> attribute, Class<E> elementType) { return attribute != null && attribute.getBindableJavaType().equals(elementType); }
[ "private", "<", "E", ">", "boolean", "isBindable", "(", "Bindable", "<", "?", ">", "attribute", ",", "Class", "<", "E", ">", "elementType", ")", "{", "return", "attribute", "!=", "null", "&&", "attribute", ".", "getBindableJavaType", "(", ")", ".", "equa...
Checks if is bindable. @param <E> the element type @param attribute the attribute @param elementType the element type @return true, if is bindable
[ "Checks", "if", "is", "bindable", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java#L1079-L1082
pressgang-ccms/PressGangCCMSQuery
src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java
BaseFilterQueryBuilder.addSizeLessThanCondition
protected void addSizeLessThanCondition(final String propertyName, final Integer size) { final Expression<Integer> propertySizeExpression = getCriteriaBuilder().size(getRootPath().get(propertyName).as(Set.class)); fieldConditions.add(getCriteriaBuilder().lt(propertySizeExpression, size)); }
java
protected void addSizeLessThanCondition(final String propertyName, final Integer size) { final Expression<Integer> propertySizeExpression = getCriteriaBuilder().size(getRootPath().get(propertyName).as(Set.class)); fieldConditions.add(getCriteriaBuilder().lt(propertySizeExpression, size)); }
[ "protected", "void", "addSizeLessThanCondition", "(", "final", "String", "propertyName", ",", "final", "Integer", "size", ")", "{", "final", "Expression", "<", "Integer", ">", "propertySizeExpression", "=", "getCriteriaBuilder", "(", ")", ".", "size", "(", "getRoo...
Add a Field Search Condition that will check if the size of a collection in an entity is less than the specified size. @param propertyName The name of the collection as defined in the Entity mapping class. @param size The size that the collection should be less than.
[ "Add", "a", "Field", "Search", "Condition", "that", "will", "check", "if", "the", "size", "of", "a", "collection", "in", "an", "entity", "is", "less", "than", "the", "specified", "size", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSQuery/blob/2bb23430adab956737d0301cd2ea933f986dd85b/src/main/java/org/jboss/pressgang/ccms/filter/base/BaseFilterQueryBuilder.java#L281-L284
authlete/authlete-java-common
src/main/java/com/authlete/common/util/Utils.java
Utils.stringifyPrompts
public static String stringifyPrompts(Prompt[] prompts) { if (prompts == null) { return null; } String[] array = new String[prompts.length]; for (int i = 0; i < prompts.length; ++i) { array[i] = (prompts[i] == null) ? null : prompts[i].name().toLowerCase(); } return join(array, " "); }
java
public static String stringifyPrompts(Prompt[] prompts) { if (prompts == null) { return null; } String[] array = new String[prompts.length]; for (int i = 0; i < prompts.length; ++i) { array[i] = (prompts[i] == null) ? null : prompts[i].name().toLowerCase(); } return join(array, " "); }
[ "public", "static", "String", "stringifyPrompts", "(", "Prompt", "[", "]", "prompts", ")", "{", "if", "(", "prompts", "==", "null", ")", "{", "return", "null", ";", "}", "String", "[", "]", "array", "=", "new", "String", "[", "prompts", ".", "length", ...
Stringify an array of {@link Prompt}. @param prompts An array of {@link Prompt}. If {@code null} is given, {@code null} is returned. @return A string containing lower-case prompt names using white spaces as the delimiter. @since 2.5
[ "Stringify", "an", "array", "of", "{", "@link", "Prompt", "}", "." ]
train
https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/util/Utils.java#L226-L241
aws/aws-sdk-java
aws-java-sdk-iot1clickprojects/src/main/java/com/amazonaws/services/iot1clickprojects/model/CreatePlacementRequest.java
CreatePlacementRequest.withAttributes
public CreatePlacementRequest withAttributes(java.util.Map<String, String> attributes) { setAttributes(attributes); return this; }
java
public CreatePlacementRequest withAttributes(java.util.Map<String, String> attributes) { setAttributes(attributes); return this; }
[ "public", "CreatePlacementRequest", "withAttributes", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "attributes", ")", "{", "setAttributes", "(", "attributes", ")", ";", "return", "this", ";", "}" ]
<p> Optional user-defined key/value pairs providing contextual data (such as location or function) for the placement. </p> @param attributes Optional user-defined key/value pairs providing contextual data (such as location or function) for the placement. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Optional", "user", "-", "defined", "key", "/", "value", "pairs", "providing", "contextual", "data", "(", "such", "as", "location", "or", "function", ")", "for", "the", "placement", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot1clickprojects/src/main/java/com/amazonaws/services/iot1clickprojects/model/CreatePlacementRequest.java#L165-L168
mike706574/java-map-support
src/main/java/fun/mike/map/alpha/Get.java
Get.requiredString
public static <T> String requiredString(Map<String, T> map, String key) { return requiredStringOfType(map, key, "string"); }
java
public static <T> String requiredString(Map<String, T> map, String key) { return requiredStringOfType(map, key, "string"); }
[ "public", "static", "<", "T", ">", "String", "requiredString", "(", "Map", "<", "String", ",", "T", ">", "map", ",", "String", "key", ")", "{", "return", "requiredStringOfType", "(", "map", ",", "key", ",", "\"string\"", ")", ";", "}" ]
Validates that the value from {@code map} for the given {@code key} is present and a string. Returns the value when valid; otherwise, throws an {@code IllegalArgumentException}. @param map a map @param key a key @param <T> the type of value @return the string value @throws java.util.NoSuchElementException if the required value is not present @throws java.lang.IllegalArgumentException if the value is in valid
[ "Validates", "that", "the", "value", "from", "{" ]
train
https://github.com/mike706574/java-map-support/blob/7cb09f34c24adfaca73ad25a3c3e05abec72eafe/src/main/java/fun/mike/map/alpha/Get.java#L87-L89
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java
SARLOperationHelper._hasSideEffects
protected Boolean _hasSideEffects(XIfExpression expression, ISideEffectContext context) { if (hasSideEffects(expression.getIf(), context)) { return true; } final Map<String, List<XExpression>> buffer1 = context.createVariableAssignmentBufferForBranch(); if (hasSideEffects(expression.getThen(), context.branch(buffer1))) { return true; } final Map<String, List<XExpression>> buffer2 = context.createVariableAssignmentBufferForBranch(); if (hasSideEffects(expression.getElse(), context.branch(buffer2))) { return true; } context.mergeBranchVariableAssignments(Arrays.asList(buffer1, buffer2)); return false; }
java
protected Boolean _hasSideEffects(XIfExpression expression, ISideEffectContext context) { if (hasSideEffects(expression.getIf(), context)) { return true; } final Map<String, List<XExpression>> buffer1 = context.createVariableAssignmentBufferForBranch(); if (hasSideEffects(expression.getThen(), context.branch(buffer1))) { return true; } final Map<String, List<XExpression>> buffer2 = context.createVariableAssignmentBufferForBranch(); if (hasSideEffects(expression.getElse(), context.branch(buffer2))) { return true; } context.mergeBranchVariableAssignments(Arrays.asList(buffer1, buffer2)); return false; }
[ "protected", "Boolean", "_hasSideEffects", "(", "XIfExpression", "expression", ",", "ISideEffectContext", "context", ")", "{", "if", "(", "hasSideEffects", "(", "expression", ".", "getIf", "(", ")", ",", "context", ")", ")", "{", "return", "true", ";", "}", ...
Test if the given expression has side effects. @param expression the expression. @param context the list of context expressions. @return {@code true} if the expression has side effects.
[ "Test", "if", "the", "given", "expression", "has", "side", "effects", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java#L317-L331
OpenLiberty/open-liberty
dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/services/impl/JPAPersistenceManagerImpl.java
JPAPersistenceManagerImpl.updateStepExecutionOnRecovery
public StepThreadExecutionEntity updateStepExecutionOnRecovery(PersistenceServiceUnit psu, final long stepExecutionId, final BatchStatus newStepBatchStatus, final String newStepExitStatus, final Date endTime) throws IllegalArgumentException { EntityManager em = psu.createEntityManager(); try { return new TranRequest<StepThreadExecutionEntity>(em) { @Override public StepThreadExecutionEntity call() { StepThreadExecutionEntity stepExec = entityMgr.find(StepThreadExecutionEntity.class, stepExecutionId); if (stepExec == null) { throw new IllegalArgumentException("StepThreadExecEntity with id =" + stepExecutionId + " should be persisted at this point, but didn't find it."); } try { verifyThreadStatusTransitionIsValid(stepExec, newStepBatchStatus); } catch (BatchIllegalJobStatusTransitionException e) { throw new PersistenceException(e); } stepExec.setBatchStatus(newStepBatchStatus); stepExec.setExitStatus(newStepExitStatus); stepExec.setEndTime(endTime); return stepExec; } }.runInNewOrExistingGlobalTran(); } finally { em.close(); } }
java
public StepThreadExecutionEntity updateStepExecutionOnRecovery(PersistenceServiceUnit psu, final long stepExecutionId, final BatchStatus newStepBatchStatus, final String newStepExitStatus, final Date endTime) throws IllegalArgumentException { EntityManager em = psu.createEntityManager(); try { return new TranRequest<StepThreadExecutionEntity>(em) { @Override public StepThreadExecutionEntity call() { StepThreadExecutionEntity stepExec = entityMgr.find(StepThreadExecutionEntity.class, stepExecutionId); if (stepExec == null) { throw new IllegalArgumentException("StepThreadExecEntity with id =" + stepExecutionId + " should be persisted at this point, but didn't find it."); } try { verifyThreadStatusTransitionIsValid(stepExec, newStepBatchStatus); } catch (BatchIllegalJobStatusTransitionException e) { throw new PersistenceException(e); } stepExec.setBatchStatus(newStepBatchStatus); stepExec.setExitStatus(newStepExitStatus); stepExec.setEndTime(endTime); return stepExec; } }.runInNewOrExistingGlobalTran(); } finally { em.close(); } }
[ "public", "StepThreadExecutionEntity", "updateStepExecutionOnRecovery", "(", "PersistenceServiceUnit", "psu", ",", "final", "long", "stepExecutionId", ",", "final", "BatchStatus", "newStepBatchStatus", ",", "final", "String", "newStepExitStatus", ",", "final", "Date", "endT...
This method is called during recovery. Set the batchStatus, exitStatus, and endTime for the given stepExecution.
[ "This", "method", "is", "called", "during", "recovery", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/services/impl/JPAPersistenceManagerImpl.java#L2134-L2166
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/list/primitive/IntInterval.java
IntInterval.fromToBy
public static IntInterval fromToBy(int from, int to, int stepBy) { if (stepBy == 0) { throw new IllegalArgumentException("Cannot use a step by of 0"); } if (from > to && stepBy > 0 || from < to && stepBy < 0) { throw new IllegalArgumentException("Step by is incorrect for the range"); } return new IntInterval(from, to, stepBy); }
java
public static IntInterval fromToBy(int from, int to, int stepBy) { if (stepBy == 0) { throw new IllegalArgumentException("Cannot use a step by of 0"); } if (from > to && stepBy > 0 || from < to && stepBy < 0) { throw new IllegalArgumentException("Step by is incorrect for the range"); } return new IntInterval(from, to, stepBy); }
[ "public", "static", "IntInterval", "fromToBy", "(", "int", "from", ",", "int", "to", ",", "int", "stepBy", ")", "{", "if", "(", "stepBy", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Cannot use a step by of 0\"", ")", ";", "}", ...
Returns an IntInterval for the range of integers inclusively between from and to with the specified stepBy value.
[ "Returns", "an", "IntInterval", "for", "the", "range", "of", "integers", "inclusively", "between", "from", "and", "to", "with", "the", "specified", "stepBy", "value", "." ]
train
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/list/primitive/IntInterval.java#L238-L249
liferay/com-liferay-commerce
commerce-api/src/main/java/com/liferay/commerce/model/CommerceShippingMethodWrapper.java
CommerceShippingMethodWrapper.getName
@Override public String getName(String languageId, boolean useDefault) { return _commerceShippingMethod.getName(languageId, useDefault); }
java
@Override public String getName(String languageId, boolean useDefault) { return _commerceShippingMethod.getName(languageId, useDefault); }
[ "@", "Override", "public", "String", "getName", "(", "String", "languageId", ",", "boolean", "useDefault", ")", "{", "return", "_commerceShippingMethod", ".", "getName", "(", "languageId", ",", "useDefault", ")", ";", "}" ]
Returns the localized name of this commerce shipping method in the language, optionally using the default language if no localization exists for the requested language. @param languageId the ID of the language @param useDefault whether to use the default language if no localization exists for the requested language @return the localized name of this commerce shipping method
[ "Returns", "the", "localized", "name", "of", "this", "commerce", "shipping", "method", "in", "the", "language", "optionally", "using", "the", "default", "language", "if", "no", "localization", "exists", "for", "the", "requested", "language", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-api/src/main/java/com/liferay/commerce/model/CommerceShippingMethodWrapper.java#L399-L402
maestrano/maestrano-java
src/main/java/com/maestrano/Maestrano.java
Maestrano.loadProperties
public static Properties loadProperties(String filePath) throws MnoConfigurationException { Properties properties = new Properties(); InputStream input = getInputStreamFromClassPathOrFile(filePath); try { properties.load(input); } catch (IOException e) { throw new MnoConfigurationException("Could not load properties file: " + filePath, e); } finally { IOUtils.closeQuietly(input); } return properties; }
java
public static Properties loadProperties(String filePath) throws MnoConfigurationException { Properties properties = new Properties(); InputStream input = getInputStreamFromClassPathOrFile(filePath); try { properties.load(input); } catch (IOException e) { throw new MnoConfigurationException("Could not load properties file: " + filePath, e); } finally { IOUtils.closeQuietly(input); } return properties; }
[ "public", "static", "Properties", "loadProperties", "(", "String", "filePath", ")", "throws", "MnoConfigurationException", "{", "Properties", "properties", "=", "new", "Properties", "(", ")", ";", "InputStream", "input", "=", "getInputStreamFromClassPathOrFile", "(", ...
load Properties from a filePath, in the classPath or absolute @param filePath @return @throws MnoConfigurationException
[ "load", "Properties", "from", "a", "filePath", "in", "the", "classPath", "or", "absolute" ]
train
https://github.com/maestrano/maestrano-java/blob/e71c6d3172d7645529d678d1cb3ea9e0a59de314/src/main/java/com/maestrano/Maestrano.java#L189-L200
mpetazzoni/ttorrent
ttorrent-client/src/main/java/com/turn/ttorrent/client/CommunicationManager.java
CommunicationManager.addTorrent
public TorrentManager addTorrent(TorrentMetadataProvider metadataProvider, PieceStorage pieceStorage) throws IOException { return addTorrent(metadataProvider, pieceStorage, Collections.<TorrentListener>emptyList()); }
java
public TorrentManager addTorrent(TorrentMetadataProvider metadataProvider, PieceStorage pieceStorage) throws IOException { return addTorrent(metadataProvider, pieceStorage, Collections.<TorrentListener>emptyList()); }
[ "public", "TorrentManager", "addTorrent", "(", "TorrentMetadataProvider", "metadataProvider", ",", "PieceStorage", "pieceStorage", ")", "throws", "IOException", "{", "return", "addTorrent", "(", "metadataProvider", ",", "pieceStorage", ",", "Collections", ".", "<", "Tor...
Adds torrent to storage with any storage and metadata source @param metadataProvider specified metadata source @param pieceStorage specified storage of pieces @return {@link TorrentManager} instance for monitoring torrent state @throws IOException if IO error occurs in reading metadata file
[ "Adds", "torrent", "to", "storage", "with", "any", "storage", "and", "metadata", "source" ]
train
https://github.com/mpetazzoni/ttorrent/blob/ecd0e6caf853b63393c4ab63cfd8f20114f73f70/ttorrent-client/src/main/java/com/turn/ttorrent/client/CommunicationManager.java#L191-L193
TimeAndSpaceIO/SmoothieMap
src/main/java/net/openhft/smoothie/SmoothieMap.java
SmoothieMap.getOrDefault
@Override public final V getOrDefault(Object key, V defaultValue) { long hash, allocIndex; Segment<K, V> segment; return (allocIndex = (segment = segment(segmentIndex(hash = keyHashCode(key)))) .find(this, hash, key)) > 0 ? segment.readValue(allocIndex) : defaultValue; }
java
@Override public final V getOrDefault(Object key, V defaultValue) { long hash, allocIndex; Segment<K, V> segment; return (allocIndex = (segment = segment(segmentIndex(hash = keyHashCode(key)))) .find(this, hash, key)) > 0 ? segment.readValue(allocIndex) : defaultValue; }
[ "@", "Override", "public", "final", "V", "getOrDefault", "(", "Object", "key", ",", "V", "defaultValue", ")", "{", "long", "hash", ",", "allocIndex", ";", "Segment", "<", "K", ",", "V", ">", "segment", ";", "return", "(", "allocIndex", "=", "(", "segme...
Returns the value to which the specified key is mapped, or {@code defaultValue} if this map contains no mapping for the key. @param key the key whose associated value is to be returned @param defaultValue the default mapping of the key @return the value to which the specified key is mapped, or {@code defaultValue} if this map contains no mapping for the key
[ "Returns", "the", "value", "to", "which", "the", "specified", "key", "is", "mapped", "or", "{", "@code", "defaultValue", "}", "if", "this", "map", "contains", "no", "mapping", "for", "the", "key", "." ]
train
https://github.com/TimeAndSpaceIO/SmoothieMap/blob/c798f6cae1d377f6913e8821a1fcf5bf45ee0412/src/main/java/net/openhft/smoothie/SmoothieMap.java#L734-L741
visallo/vertexium
cypher/src/main/java/org/vertexium/cypher/executor/ReturnClauseExecutor.java
ReturnClauseExecutor.expandResultMapSubItems
private Object expandResultMapSubItems(VertexiumCypherQueryContext ctx, Object value, ExpressionScope scope) { if (value instanceof Map) { Map<?, ?> map = (Map<?, ?>) value; Map<Object, Object> result = new LinkedHashMap<>(); for (Map.Entry<?, ?> entry : map.entrySet()) { if (entry.getValue() instanceof CypherAstBase) { CypherAstBase entryValue = (CypherAstBase) entry.getValue(); Object newEntryValue = expressionExecutor.executeExpression(ctx, entryValue, scope); newEntryValue = expandResultMapSubItems(ctx, newEntryValue, scope); result.put(entry.getKey(), newEntryValue); } else { result.put(entry.getKey(), entry.getValue()); } } return result; } return value; }
java
private Object expandResultMapSubItems(VertexiumCypherQueryContext ctx, Object value, ExpressionScope scope) { if (value instanceof Map) { Map<?, ?> map = (Map<?, ?>) value; Map<Object, Object> result = new LinkedHashMap<>(); for (Map.Entry<?, ?> entry : map.entrySet()) { if (entry.getValue() instanceof CypherAstBase) { CypherAstBase entryValue = (CypherAstBase) entry.getValue(); Object newEntryValue = expressionExecutor.executeExpression(ctx, entryValue, scope); newEntryValue = expandResultMapSubItems(ctx, newEntryValue, scope); result.put(entry.getKey(), newEntryValue); } else { result.put(entry.getKey(), entry.getValue()); } } return result; } return value; }
[ "private", "Object", "expandResultMapSubItems", "(", "VertexiumCypherQueryContext", "ctx", ",", "Object", "value", ",", "ExpressionScope", "scope", ")", "{", "if", "(", "value", "instanceof", "Map", ")", "{", "Map", "<", "?", ",", "?", ">", "map", "=", "(", ...
/* This method will expand return items such as RETURN coalesce(a.prop, b.prop) AS foo, b.prop AS bar, {y: count(b)} AS baz In the above example {y: count(b)} in the map this method will expand
[ "/", "*", "This", "method", "will", "expand", "return", "items", "such", "as" ]
train
https://github.com/visallo/vertexium/blob/bb132b5425ac168957667164e1409b78adbea769/cypher/src/main/java/org/vertexium/cypher/executor/ReturnClauseExecutor.java#L170-L187
bushidowallet/bushido-java-service
bushido-service-lib/src/main/java/com/bccapi/bitlib/StandardTransactionBuilder.java
StandardTransactionBuilder.estimateTransacrionSize
private static int estimateTransacrionSize(UnsignedTransaction unsigned) { // Create fake empty inputs TransactionInput[] inputs = new TransactionInput[unsigned._funding.length]; for (int i = 0; i < inputs.length; i++) { inputs[i] = new TransactionInput(unsigned._funding[i].outPoint, ScriptInput.EMPTY); } // Create fake transaction Transaction t = new Transaction(1, inputs, unsigned._outputs, 0); int txSize = t.toBytes().length; // Add maximum size for each input txSize += 140 * t.inputs.length; return txSize; }
java
private static int estimateTransacrionSize(UnsignedTransaction unsigned) { // Create fake empty inputs TransactionInput[] inputs = new TransactionInput[unsigned._funding.length]; for (int i = 0; i < inputs.length; i++) { inputs[i] = new TransactionInput(unsigned._funding[i].outPoint, ScriptInput.EMPTY); } // Create fake transaction Transaction t = new Transaction(1, inputs, unsigned._outputs, 0); int txSize = t.toBytes().length; // Add maximum size for each input txSize += 140 * t.inputs.length; return txSize; }
[ "private", "static", "int", "estimateTransacrionSize", "(", "UnsignedTransaction", "unsigned", ")", "{", "// Create fake empty inputs", "TransactionInput", "[", "]", "inputs", "=", "new", "TransactionInput", "[", "unsigned", ".", "_funding", ".", "length", "]", ";", ...
Estimate transaction size by clearing all input scripts and adding 140 bytes for each input. (The type of scripts we generate are 138-140 bytes long). This allows us to give a good estimate of the final transaction size, and determine whether out fee size is large enough. @param unsigned The unsigned transaction to estimate the size of @return The estimated transaction size
[ "Estimate", "transaction", "size", "by", "clearing", "all", "input", "scripts", "and", "adding", "140", "bytes", "for", "each", "input", ".", "(", "The", "type", "of", "scripts", "we", "generate", "are", "138", "-", "140", "bytes", "long", ")", ".", "Thi...
train
https://github.com/bushidowallet/bushido-java-service/blob/e1a0157527e57459b509718044d2df44084876a2/bushido-service-lib/src/main/java/com/bccapi/bitlib/StandardTransactionBuilder.java#L354-L369
groundupworks/wings
wings-facebook/src/main/java/com/groundupworks/wings/facebook/FacebookSettings.java
FacebookSettings.newInstance
static FacebookSettings newInstance(Bundle bundle) { FacebookSettings settings = null; int destinationId = bundle.getInt(BUNDLE_KEY_DESTINATION_ID); String accountName = bundle.getString(BUNDLE_KEY_ACCOUNT_NAME); String albumName = bundle.getString(BUNDLE_KEY_ALBUM_NAME); String albumGraphPath = bundle.getString(BUNDLE_KEY_ALBUM_GRAPH_PATH); String pageAccessToken = bundle.getString(BUNDLE_KEY_PAGE_ACCESS_TOKEN); String photoPrivacy = bundle.getString(BUNDLE_KEY_PHOTO_PRIVACY); if (!TextUtils.isEmpty(accountName) && !TextUtils.isEmpty(albumName) && !TextUtils.isEmpty(albumGraphPath)) { if (destinationId == FacebookEndpoint.DestinationId.PROFILE) { settings = new FacebookSettings(destinationId, accountName, albumName, albumGraphPath, pageAccessToken, photoPrivacy); } else if ((destinationId == FacebookEndpoint.DestinationId.PAGE || destinationId == FacebookEndpoint.DestinationId.PAGE_ALBUM) && !TextUtils.isEmpty(pageAccessToken)) { settings = new FacebookSettings(destinationId, accountName, albumName, albumGraphPath, pageAccessToken, photoPrivacy); } } return settings; }
java
static FacebookSettings newInstance(Bundle bundle) { FacebookSettings settings = null; int destinationId = bundle.getInt(BUNDLE_KEY_DESTINATION_ID); String accountName = bundle.getString(BUNDLE_KEY_ACCOUNT_NAME); String albumName = bundle.getString(BUNDLE_KEY_ALBUM_NAME); String albumGraphPath = bundle.getString(BUNDLE_KEY_ALBUM_GRAPH_PATH); String pageAccessToken = bundle.getString(BUNDLE_KEY_PAGE_ACCESS_TOKEN); String photoPrivacy = bundle.getString(BUNDLE_KEY_PHOTO_PRIVACY); if (!TextUtils.isEmpty(accountName) && !TextUtils.isEmpty(albumName) && !TextUtils.isEmpty(albumGraphPath)) { if (destinationId == FacebookEndpoint.DestinationId.PROFILE) { settings = new FacebookSettings(destinationId, accountName, albumName, albumGraphPath, pageAccessToken, photoPrivacy); } else if ((destinationId == FacebookEndpoint.DestinationId.PAGE || destinationId == FacebookEndpoint.DestinationId.PAGE_ALBUM) && !TextUtils.isEmpty(pageAccessToken)) { settings = new FacebookSettings(destinationId, accountName, albumName, albumGraphPath, pageAccessToken, photoPrivacy); } } return settings; }
[ "static", "FacebookSettings", "newInstance", "(", "Bundle", "bundle", ")", "{", "FacebookSettings", "settings", "=", "null", ";", "int", "destinationId", "=", "bundle", ".", "getInt", "(", "BUNDLE_KEY_DESTINATION_ID", ")", ";", "String", "accountName", "=", "bundl...
Creates a new {@link FacebookSettings} instance from a {@link Bundle} created by the {@link #toBundle()} method. @param bundle the {@link Bundle}. @return a new {@link FacebookSettings} instance; or null if the {@link Bundle} is invalid.
[ "Creates", "a", "new", "{", "@link", "FacebookSettings", "}", "instance", "from", "a", "{", "@link", "Bundle", "}", "created", "by", "the", "{", "@link", "#toBundle", "()", "}", "method", "." ]
train
https://github.com/groundupworks/wings/blob/03d2827c30ef55f2db4e23f7500e016c7771fa39/wings-facebook/src/main/java/com/groundupworks/wings/facebook/FacebookSettings.java#L117-L137