repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/tunnel/tunneltrafficpolicy_binding.java
tunneltrafficpolicy_binding.get
public static tunneltrafficpolicy_binding get(nitro_service service, String name) throws Exception{ tunneltrafficpolicy_binding obj = new tunneltrafficpolicy_binding(); obj.set_name(name); tunneltrafficpolicy_binding response = (tunneltrafficpolicy_binding) obj.get_resource(service); return response; }
java
public static tunneltrafficpolicy_binding get(nitro_service service, String name) throws Exception{ tunneltrafficpolicy_binding obj = new tunneltrafficpolicy_binding(); obj.set_name(name); tunneltrafficpolicy_binding response = (tunneltrafficpolicy_binding) obj.get_resource(service); return response; }
[ "public", "static", "tunneltrafficpolicy_binding", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "tunneltrafficpolicy_binding", "obj", "=", "new", "tunneltrafficpolicy_binding", "(", ")", ";", "obj", ".", "set_name", ...
Use this API to fetch tunneltrafficpolicy_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "tunneltrafficpolicy_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/tunnel/tunneltrafficpolicy_binding.java#L103-L108
actframework/actframework
src/main/java/act/ws/WebSocketConnectionManager.java
WebSocketConnectionManager.sendJsonToTagged
public void sendJsonToTagged(Object data, String ... labels) { for (String label : labels) { sendJsonToTagged(data, label); } }
java
public void sendJsonToTagged(Object data, String ... labels) { for (String label : labels) { sendJsonToTagged(data, label); } }
[ "public", "void", "sendJsonToTagged", "(", "Object", "data", ",", "String", "...", "labels", ")", "{", "for", "(", "String", "label", ":", "labels", ")", "{", "sendJsonToTagged", "(", "data", ",", "label", ")", ";", "}", "}" ]
Send JSON representation of given data object to all connections tagged with all give tag labels @param data the data object @param labels the tag labels
[ "Send", "JSON", "representation", "of", "given", "data", "object", "to", "all", "connections", "tagged", "with", "all", "give", "tag", "labels" ]
train
https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/ws/WebSocketConnectionManager.java#L179-L183
JakeWharton/ActionBarSherlock
actionbarsherlock/src/com/actionbarsherlock/widget/SuggestionsAdapter.java
SuggestionsAdapter.setViewDrawable
private void setViewDrawable(ImageView v, Drawable drawable, int nullVisibility) { // Set the icon even if the drawable is null, since we need to clear any // previous icon. v.setImageDrawable(drawable); if (drawable == null) { v.setVisibility(nullVisibility); } else { v.setVisibility(View.VISIBLE); // This is a hack to get any animated drawables (like a 'working' spinner) // to animate. You have to setVisible true on an AnimationDrawable to get // it to start animating, but it must first have been false or else the // call to setVisible will be ineffective. We need to clear up the story // about animated drawables in the future, see http://b/1878430. drawable.setVisible(false, false); drawable.setVisible(true, false); } }
java
private void setViewDrawable(ImageView v, Drawable drawable, int nullVisibility) { // Set the icon even if the drawable is null, since we need to clear any // previous icon. v.setImageDrawable(drawable); if (drawable == null) { v.setVisibility(nullVisibility); } else { v.setVisibility(View.VISIBLE); // This is a hack to get any animated drawables (like a 'working' spinner) // to animate. You have to setVisible true on an AnimationDrawable to get // it to start animating, but it must first have been false or else the // call to setVisible will be ineffective. We need to clear up the story // about animated drawables in the future, see http://b/1878430. drawable.setVisible(false, false); drawable.setVisible(true, false); } }
[ "private", "void", "setViewDrawable", "(", "ImageView", "v", ",", "Drawable", "drawable", ",", "int", "nullVisibility", ")", "{", "// Set the icon even if the drawable is null, since we need to clear any", "// previous icon.", "v", ".", "setImageDrawable", "(", "drawable", ...
Sets the drawable in an image view, makes sure the view is only visible if there is a drawable.
[ "Sets", "the", "drawable", "in", "an", "image", "view", "makes", "sure", "the", "view", "is", "only", "visible", "if", "there", "is", "a", "drawable", "." ]
train
https://github.com/JakeWharton/ActionBarSherlock/blob/2c71339e756bcc0b1424c4525680549ba3a2dc97/actionbarsherlock/src/com/actionbarsherlock/widget/SuggestionsAdapter.java#L460-L478
finnyb/javampd
src/main/java/org/bff/javampd/monitor/MPDErrorMonitor.java
MPDErrorMonitor.fireMPDErrorEvent
protected void fireMPDErrorEvent(String message) { ErrorEvent ee = new ErrorEvent(this, message); for (ErrorListener el : errorListeners) { el.errorEventReceived(ee); } }
java
protected void fireMPDErrorEvent(String message) { ErrorEvent ee = new ErrorEvent(this, message); for (ErrorListener el : errorListeners) { el.errorEventReceived(ee); } }
[ "protected", "void", "fireMPDErrorEvent", "(", "String", "message", ")", "{", "ErrorEvent", "ee", "=", "new", "ErrorEvent", "(", "this", ",", "message", ")", ";", "for", "(", "ErrorListener", "el", ":", "errorListeners", ")", "{", "el", ".", "errorEventRecei...
Sends the appropriate {@link ErrorListener} to all registered {@link ErrorListener}s. @param message the event message
[ "Sends", "the", "appropriate", "{", "@link", "ErrorListener", "}", "to", "all", "registered", "{", "@link", "ErrorListener", "}", "s", "." ]
train
https://github.com/finnyb/javampd/blob/186736e85fc238b4208cc9ee23373f9249376b4c/src/main/java/org/bff/javampd/monitor/MPDErrorMonitor.java#L36-L42
SeleniumJT/seleniumjt-core
src/main/java/com/jt/selenium/SeleniumJT.java
SeleniumJT.dragAndDropWithPause
@LogExecTime public void dragAndDropWithPause(String locator, String targetLocator, int pause) { jtEvent.dragAndDropWithPause(locator, targetLocator, pause); }
java
@LogExecTime public void dragAndDropWithPause(String locator, String targetLocator, int pause) { jtEvent.dragAndDropWithPause(locator, targetLocator, pause); }
[ "@", "LogExecTime", "public", "void", "dragAndDropWithPause", "(", "String", "locator", ",", "String", "targetLocator", ",", "int", "pause", ")", "{", "jtEvent", ".", "dragAndDropWithPause", "(", "locator", ",", "targetLocator", ",", "pause", ")", ";", "}" ]
/* Drags the element locator to the element targetLocator with a set pause after the event
[ "/", "*", "Drags", "the", "element", "locator", "to", "the", "element", "targetLocator", "with", "a", "set", "pause", "after", "the", "event" ]
train
https://github.com/SeleniumJT/seleniumjt-core/blob/8e972f69adc4846a3f1d7b8ca9c3f8d953a2d0f3/src/main/java/com/jt/selenium/SeleniumJT.java#L718-L722
dadoonet/spring-elasticsearch
src/main/java/fr/pilato/spring/elasticsearch/type/TypeFinder.java
TypeFinder.findTypes
public static List<String> findTypes(String index) throws IOException, URISyntaxException { return findTypes(Defaults.ConfigDir, index); }
java
public static List<String> findTypes(String index) throws IOException, URISyntaxException { return findTypes(Defaults.ConfigDir, index); }
[ "public", "static", "List", "<", "String", ">", "findTypes", "(", "String", "index", ")", "throws", "IOException", ",", "URISyntaxException", "{", "return", "findTypes", "(", "Defaults", ".", "ConfigDir", ",", "index", ")", ";", "}" ]
Find all types within an index in default classpath dir @param index index name @return The list of types @throws IOException if the connection with elasticsearch is failing @throws URISyntaxException this should not happen
[ "Find", "all", "types", "within", "an", "index", "in", "default", "classpath", "dir" ]
train
https://github.com/dadoonet/spring-elasticsearch/blob/b338223818a5bdf5d9c06c88cb98589c843fd293/src/main/java/fr/pilato/spring/elasticsearch/type/TypeFinder.java#L42-L44
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/expressions/Expressions.java
Expressions.geoEquals
public static GeoEquals geoEquals(Expression<Geometry> left, Expression<Geometry> right) { return new GeoEquals(left, right); }
java
public static GeoEquals geoEquals(Expression<Geometry> left, Expression<Geometry> right) { return new GeoEquals(left, right); }
[ "public", "static", "GeoEquals", "geoEquals", "(", "Expression", "<", "Geometry", ">", "left", ",", "Expression", "<", "Geometry", ">", "right", ")", "{", "return", "new", "GeoEquals", "(", "left", ",", "right", ")", ";", "}" ]
Creates a GeoEquals expression from the left and right expressions. @param left The left expression. @param right The right expression. @return A GeoEquals expression.
[ "Creates", "a", "GeoEquals", "expression", "from", "the", "left", "and", "right", "expressions", "." ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/expressions/Expressions.java#L795-L797
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java
PageFlowUtils.getLongLivedPageFlow
public static PageFlowController getLongLivedPageFlow( String modulePath, HttpServletRequest request ) { ServletContext servletContext = InternalUtils.getServletContext( request ); return getLongLivedPageFlow( modulePath, request, servletContext ); }
java
public static PageFlowController getLongLivedPageFlow( String modulePath, HttpServletRequest request ) { ServletContext servletContext = InternalUtils.getServletContext( request ); return getLongLivedPageFlow( modulePath, request, servletContext ); }
[ "public", "static", "PageFlowController", "getLongLivedPageFlow", "(", "String", "modulePath", ",", "HttpServletRequest", "request", ")", "{", "ServletContext", "servletContext", "=", "InternalUtils", ".", "getServletContext", "(", "request", ")", ";", "return", "getLon...
Get the long-lived page flow instance associated with the given module (directory) path. @deprecated Use {@link #getLongLivedPageFlow(String, HttpServletRequest, ServletContext)} instead. @param modulePath the webapp-relative path to the directory containing the long-lived page flow. @param request the current HttpServletRequest. @return the long-lived page flow instance associated with the given module, or <code>null</code> if none is found.
[ "Get", "the", "long", "-", "lived", "page", "flow", "instance", "associated", "with", "the", "given", "module", "(", "directory", ")", "path", ".", "@deprecated", "Use", "{", "@link", "#getLongLivedPageFlow", "(", "String", "HttpServletRequest", "ServletContext", ...
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L469-L473
jfaster/mango
src/main/java/org/jfaster/mango/util/reflect/Types.java
Types.newParameterizedTypeWithOwner
static ParameterizedType newParameterizedTypeWithOwner( @Nullable Type ownerType, Class<?> rawType, Type... arguments) { if (ownerType == null) { return newParameterizedType(rawType, arguments); } // ParameterizedTypeImpl constructor already checks, but we want to throw NPE before IAE if (arguments == null) { throw new NullPointerException(); } if (rawType.getEnclosingClass() == null) { throw new IllegalArgumentException(String.format("Owner type for unenclosed %s", rawType)); } return new ParameterizedTypeImpl(ownerType, rawType, arguments); }
java
static ParameterizedType newParameterizedTypeWithOwner( @Nullable Type ownerType, Class<?> rawType, Type... arguments) { if (ownerType == null) { return newParameterizedType(rawType, arguments); } // ParameterizedTypeImpl constructor already checks, but we want to throw NPE before IAE if (arguments == null) { throw new NullPointerException(); } if (rawType.getEnclosingClass() == null) { throw new IllegalArgumentException(String.format("Owner type for unenclosed %s", rawType)); } return new ParameterizedTypeImpl(ownerType, rawType, arguments); }
[ "static", "ParameterizedType", "newParameterizedTypeWithOwner", "(", "@", "Nullable", "Type", "ownerType", ",", "Class", "<", "?", ">", "rawType", ",", "Type", "...", "arguments", ")", "{", "if", "(", "ownerType", "==", "null", ")", "{", "return", "newParamete...
Returns a type where {@code rawType} is parameterized by {@code arguments} and is owned by {@code ownerType}.
[ "Returns", "a", "type", "where", "{" ]
train
https://github.com/jfaster/mango/blob/4f078846f1daa2cb92424edcde5964267e390e8f/src/main/java/org/jfaster/mango/util/reflect/Types.java#L66-L79
casmi/casmi
src/main/java/casmi/graphics/element/Quad.java
Quad.setCornerColor
public void setCornerColor(int index, Color color) { if (!isGradation()) { for (int i = 0; i < 4; i++) { cornerColor[i] = new RGBColor(0.0, 0.0, 0.0); cornerColor[i] = this.fillColor; } setGradation(true); } cornerColor[index] = color; }
java
public void setCornerColor(int index, Color color) { if (!isGradation()) { for (int i = 0; i < 4; i++) { cornerColor[i] = new RGBColor(0.0, 0.0, 0.0); cornerColor[i] = this.fillColor; } setGradation(true); } cornerColor[index] = color; }
[ "public", "void", "setCornerColor", "(", "int", "index", ",", "Color", "color", ")", "{", "if", "(", "!", "isGradation", "(", ")", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "4", ";", "i", "++", ")", "{", "cornerColor", "[", "i"...
Sets the color of a corner for gradation. @param index The index of a corner. @param color The color of a corner.
[ "Sets", "the", "color", "of", "a", "corner", "for", "gradation", "." ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Quad.java#L346-L355
code4everything/util
src/main/java/com/zhazhapan/util/DateUtils.java
DateUtils.convertDateToTime
public static Time convertDateToTime(Date date, Time elseValue) { return Checker.isNull(date) ? elseValue : new Time(date.getTime()); }
java
public static Time convertDateToTime(Date date, Time elseValue) { return Checker.isNull(date) ? elseValue : new Time(date.getTime()); }
[ "public", "static", "Time", "convertDateToTime", "(", "Date", "date", ",", "Time", "elseValue", ")", "{", "return", "Checker", ".", "isNull", "(", "date", ")", "?", "elseValue", ":", "new", "Time", "(", "date", ".", "getTime", "(", ")", ")", ";", "}" ]
将日期转换成时间 @param date {@link Date} @param elseValue 日期为空返回默认时间 @return {@link Time} @since 1.1.1
[ "将日期转换成时间" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/DateUtils.java#L104-L106
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java
AppServiceCertificateOrdersInner.updateCertificateAsync
public Observable<AppServiceCertificateResourceInner> updateCertificateAsync(String resourceGroupName, String certificateOrderName, String name, AppServiceCertificatePatchResource keyVaultCertificate) { return updateCertificateWithServiceResponseAsync(resourceGroupName, certificateOrderName, name, keyVaultCertificate).map(new Func1<ServiceResponse<AppServiceCertificateResourceInner>, AppServiceCertificateResourceInner>() { @Override public AppServiceCertificateResourceInner call(ServiceResponse<AppServiceCertificateResourceInner> response) { return response.body(); } }); }
java
public Observable<AppServiceCertificateResourceInner> updateCertificateAsync(String resourceGroupName, String certificateOrderName, String name, AppServiceCertificatePatchResource keyVaultCertificate) { return updateCertificateWithServiceResponseAsync(resourceGroupName, certificateOrderName, name, keyVaultCertificate).map(new Func1<ServiceResponse<AppServiceCertificateResourceInner>, AppServiceCertificateResourceInner>() { @Override public AppServiceCertificateResourceInner call(ServiceResponse<AppServiceCertificateResourceInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "AppServiceCertificateResourceInner", ">", "updateCertificateAsync", "(", "String", "resourceGroupName", ",", "String", "certificateOrderName", ",", "String", "name", ",", "AppServiceCertificatePatchResource", "keyVaultCertificate", ")", "{", "ret...
Creates or updates a certificate and associates with key vault secret. Creates or updates a certificate and associates with key vault secret. @param resourceGroupName Name of the resource group to which the resource belongs. @param certificateOrderName Name of the certificate order. @param name Name of the certificate. @param keyVaultCertificate Key vault certificate resource Id. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the AppServiceCertificateResourceInner object
[ "Creates", "or", "updates", "a", "certificate", "and", "associates", "with", "key", "vault", "secret", ".", "Creates", "or", "updates", "a", "certificate", "and", "associates", "with", "key", "vault", "secret", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java#L1511-L1518
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java
URLUtil.complateUrl
public static String complateUrl(String baseUrl, String relativePath) { baseUrl = normalize(baseUrl, false); if (StrUtil.isBlank(baseUrl)) { return null; } try { final URL absoluteUrl = new URL(baseUrl); final URL parseUrl = new URL(absoluteUrl, relativePath); return parseUrl.toString(); } catch (MalformedURLException e) { throw new UtilException(e); } }
java
public static String complateUrl(String baseUrl, String relativePath) { baseUrl = normalize(baseUrl, false); if (StrUtil.isBlank(baseUrl)) { return null; } try { final URL absoluteUrl = new URL(baseUrl); final URL parseUrl = new URL(absoluteUrl, relativePath); return parseUrl.toString(); } catch (MalformedURLException e) { throw new UtilException(e); } }
[ "public", "static", "String", "complateUrl", "(", "String", "baseUrl", ",", "String", "relativePath", ")", "{", "baseUrl", "=", "normalize", "(", "baseUrl", ",", "false", ")", ";", "if", "(", "StrUtil", ".", "isBlank", "(", "baseUrl", ")", ")", "{", "ret...
补全相对路径 @param baseUrl 基准URL @param relativePath 相对URL @return 相对路径 @exception UtilException MalformedURLException
[ "补全相对路径" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java#L193-L206
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDialog.java
WDialog.setTitle
public void setTitle(final String title, final Serializable... args) { getOrCreateComponentModel().title = I18nUtilities.asMessage(title, args); }
java
public void setTitle(final String title, final Serializable... args) { getOrCreateComponentModel().title = I18nUtilities.asMessage(title, args); }
[ "public", "void", "setTitle", "(", "final", "String", "title", ",", "final", "Serializable", "...", "args", ")", "{", "getOrCreateComponentModel", "(", ")", ".", "title", "=", "I18nUtilities", ".", "asMessage", "(", "title", ",", "args", ")", ";", "}" ]
Sets the dialog title. @param title the title to set, using {@link MessageFormat} syntax. @param args optional arguments for the message format string.
[ "Sets", "the", "dialog", "title", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDialog.java#L264-L266
elki-project/elki
elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/FormatUtil.java
FormatUtil.getConsoleWidth
public static int getConsoleWidth() { if(width > 0) { return width; } final int default_termwidth = 78; try { final String env = System.getenv("COLUMNS"); if(env != null) { int columns = ParseUtil.parseIntBase10(env); return width = (columns > 50 ? columns - 1 : default_termwidth); } } catch(SecurityException | NumberFormatException e) { // OK. Probably not exported. } try { Process p = Runtime.getRuntime().exec(new String[] { "sh", "-c", "tput cols 2> /dev/tty" }); byte[] buf = new byte[16]; p.getOutputStream().close(); // We do not intend to write. int l = p.getInputStream().read(buf); if(l >= 2 && l < buf.length) { int columns = ParseUtil.parseIntBase10(new String(buf, 0, buf[l - 1] == '\n' ? l - 1 : l)); return width = (columns > 50 ? columns - 1 : default_termwidth); } p.destroy(); } catch(IOException | SecurityException | NumberFormatException e) { // Ok. Probably not a unix system. } // We could use the jLine library, but that would introduce another // dependency. :-( return width = default_termwidth; }
java
public static int getConsoleWidth() { if(width > 0) { return width; } final int default_termwidth = 78; try { final String env = System.getenv("COLUMNS"); if(env != null) { int columns = ParseUtil.parseIntBase10(env); return width = (columns > 50 ? columns - 1 : default_termwidth); } } catch(SecurityException | NumberFormatException e) { // OK. Probably not exported. } try { Process p = Runtime.getRuntime().exec(new String[] { "sh", "-c", "tput cols 2> /dev/tty" }); byte[] buf = new byte[16]; p.getOutputStream().close(); // We do not intend to write. int l = p.getInputStream().read(buf); if(l >= 2 && l < buf.length) { int columns = ParseUtil.parseIntBase10(new String(buf, 0, buf[l - 1] == '\n' ? l - 1 : l)); return width = (columns > 50 ? columns - 1 : default_termwidth); } p.destroy(); } catch(IOException | SecurityException | NumberFormatException e) { // Ok. Probably not a unix system. } // We could use the jLine library, but that would introduce another // dependency. :-( return width = default_termwidth; }
[ "public", "static", "int", "getConsoleWidth", "(", ")", "{", "if", "(", "width", ">", "0", ")", "{", "return", "width", ";", "}", "final", "int", "default_termwidth", "=", "78", ";", "try", "{", "final", "String", "env", "=", "System", ".", "getenv", ...
Get the width of the terminal window (on Unix xterms), with a default of 78 characters. @return Terminal width
[ "Get", "the", "width", "of", "the", "terminal", "window", "(", "on", "Unix", "xterms", ")", "with", "a", "default", "of", "78", "characters", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/io/FormatUtil.java#L895-L927
JOML-CI/JOML
src/org/joml/Matrix4f.java
Matrix4f.obliqueZ
public Matrix4f obliqueZ(float a, float b, Matrix4f dest) { dest.m00 = m00; dest.m01 = m01; dest.m02 = m02; dest.m03 = m03; dest.m10 = m10; dest.m11 = m11; dest.m12 = m12; dest.m13 = m13; dest.m20 = m00 * a + m10 * b + m20; dest.m21 = m01 * a + m11 * b + m21; dest.m22 = m02 * a + m12 * b + m22; dest.m23 = m23; dest.m30 = m30; dest.m31 = m31; dest.m32 = m32; dest.m33 = m33; dest._properties(this.properties & PROPERTY_AFFINE); return dest; }
java
public Matrix4f obliqueZ(float a, float b, Matrix4f dest) { dest.m00 = m00; dest.m01 = m01; dest.m02 = m02; dest.m03 = m03; dest.m10 = m10; dest.m11 = m11; dest.m12 = m12; dest.m13 = m13; dest.m20 = m00 * a + m10 * b + m20; dest.m21 = m01 * a + m11 * b + m21; dest.m22 = m02 * a + m12 * b + m22; dest.m23 = m23; dest.m30 = m30; dest.m31 = m31; dest.m32 = m32; dest.m33 = m33; dest._properties(this.properties & PROPERTY_AFFINE); return dest; }
[ "public", "Matrix4f", "obliqueZ", "(", "float", "a", ",", "float", "b", ",", "Matrix4f", "dest", ")", "{", "dest", ".", "m00", "=", "m00", ";", "dest", ".", "m01", "=", "m01", ";", "dest", ".", "m02", "=", "m02", ";", "dest", ".", "m03", "=", "...
Apply an oblique projection transformation to this matrix with the given values for <code>a</code> and <code>b</code> and store the result in <code>dest</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>O</code> the oblique transformation matrix, then the new matrix will be <code>M * O</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the oblique transformation will be applied first! <p> The oblique transformation is defined as: <pre> x' = x + a*z y' = y + a*z z' = z </pre> or in matrix form: <pre> 1 0 a 0 0 1 b 0 0 0 1 0 0 0 0 1 </pre> @param a the value for the z factor that applies to x @param b the value for the z factor that applies to y @param dest will hold the result @return dest
[ "Apply", "an", "oblique", "projection", "transformation", "to", "this", "matrix", "with", "the", "given", "values", "for", "<code", ">", "a<", "/", "code", ">", "and", "<code", ">", "b<", "/", "code", ">", "and", "store", "the", "result", "in", "<code", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L14669-L14688
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageBandMath.java
ImageBandMath.stdDev
public static void stdDev(Planar<GrayS32> input, GrayS32 output, @Nullable GrayS32 avg) { stdDev(input,output,avg,0,input.getNumBands() - 1); }
java
public static void stdDev(Planar<GrayS32> input, GrayS32 output, @Nullable GrayS32 avg) { stdDev(input,output,avg,0,input.getNumBands() - 1); }
[ "public", "static", "void", "stdDev", "(", "Planar", "<", "GrayS32", ">", "input", ",", "GrayS32", "output", ",", "@", "Nullable", "GrayS32", "avg", ")", "{", "stdDev", "(", "input", ",", "output", ",", "avg", ",", "0", ",", "input", ".", "getNumBands"...
Computes the standard deviation for each pixel across all bands in the {@link Planar} image. @param input Planar image - not modified @param output Gray scale image containing average pixel values - modified @param avg Input Gray scale image containing average image. Can be null
[ "Computes", "the", "standard", "deviation", "for", "each", "pixel", "across", "all", "bands", "in", "the", "{" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageBandMath.java#L693-L695
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/Reflector.java
Reflector.callMethod
public static Object callMethod(Object obj, String methodName, Object[] args) throws PageException { return callMethod(obj, KeyImpl.getInstance(methodName), args); }
java
public static Object callMethod(Object obj, String methodName, Object[] args) throws PageException { return callMethod(obj, KeyImpl.getInstance(methodName), args); }
[ "public", "static", "Object", "callMethod", "(", "Object", "obj", ",", "String", "methodName", ",", "Object", "[", "]", "args", ")", "throws", "PageException", "{", "return", "callMethod", "(", "obj", ",", "KeyImpl", ".", "getInstance", "(", "methodName", ")...
calls a Method of a Objct @param obj Object to call Method on it @param methodName Name of the Method to get @param args Arguments of the Method to get @return return return value of the called Method @throws PageException
[ "calls", "a", "Method", "of", "a", "Objct" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L840-L842
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/converters/Converters.java
Converters.fromDBObject
public void fromDBObject(final DBObject dbObj, final MappedField mf, final Object targetEntity) { final Object object = mf.getDbObjectValue(dbObj); if (object != null) { final TypeConverter enc = getEncoder(mf); final Object decodedValue = enc.decode(mf.getType(), object, mf); try { mf.setFieldValue(targetEntity, decodedValue); } catch (IllegalArgumentException e) { throw new MappingException(format("Error setting value from converter (%s) for %s to %s", enc.getClass().getSimpleName(), mf.getFullName(), decodedValue), e); } } }
java
public void fromDBObject(final DBObject dbObj, final MappedField mf, final Object targetEntity) { final Object object = mf.getDbObjectValue(dbObj); if (object != null) { final TypeConverter enc = getEncoder(mf); final Object decodedValue = enc.decode(mf.getType(), object, mf); try { mf.setFieldValue(targetEntity, decodedValue); } catch (IllegalArgumentException e) { throw new MappingException(format("Error setting value from converter (%s) for %s to %s", enc.getClass().getSimpleName(), mf.getFullName(), decodedValue), e); } } }
[ "public", "void", "fromDBObject", "(", "final", "DBObject", "dbObj", ",", "final", "MappedField", "mf", ",", "final", "Object", "targetEntity", ")", "{", "final", "Object", "object", "=", "mf", ".", "getDbObjectValue", "(", "dbObj", ")", ";", "if", "(", "o...
Creates an entity and populates its state based on the dbObject given. This method is primarily an internal method. Reliance on this method may break your application in future releases. @param dbObj the object state to use @param mf the MappedField containing the metadata to use when decoding in to a field @param targetEntity then entity to hold the state from the database
[ "Creates", "an", "entity", "and", "populates", "its", "state", "based", "on", "the", "dbObject", "given", ".", "This", "method", "is", "primarily", "an", "internal", "method", ".", "Reliance", "on", "this", "method", "may", "break", "your", "application", "i...
train
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/converters/Converters.java#L131-L143
Azure/azure-sdk-for-java
policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/implementation/PolicySetDefinitionsInner.java
PolicySetDefinitionsInner.getAtManagementGroupAsync
public Observable<PolicySetDefinitionInner> getAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId) { return getAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId).map(new Func1<ServiceResponse<PolicySetDefinitionInner>, PolicySetDefinitionInner>() { @Override public PolicySetDefinitionInner call(ServiceResponse<PolicySetDefinitionInner> response) { return response.body(); } }); }
java
public Observable<PolicySetDefinitionInner> getAtManagementGroupAsync(String policySetDefinitionName, String managementGroupId) { return getAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId).map(new Func1<ServiceResponse<PolicySetDefinitionInner>, PolicySetDefinitionInner>() { @Override public PolicySetDefinitionInner call(ServiceResponse<PolicySetDefinitionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "PolicySetDefinitionInner", ">", "getAtManagementGroupAsync", "(", "String", "policySetDefinitionName", ",", "String", "managementGroupId", ")", "{", "return", "getAtManagementGroupWithServiceResponseAsync", "(", "policySetDefinitionName", ",", "man...
Retrieves a policy set definition. This operation retrieves the policy set definition in the given management group with the given name. @param policySetDefinitionName The name of the policy set definition to get. @param managementGroupId The ID of the management group. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PolicySetDefinitionInner object
[ "Retrieves", "a", "policy", "set", "definition", ".", "This", "operation", "retrieves", "the", "policy", "set", "definition", "in", "the", "given", "management", "group", "with", "the", "given", "name", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/implementation/PolicySetDefinitionsInner.java#L898-L905
xmlunit/xmlunit
xmlunit-core/src/main/java/org/xmlunit/diff/DifferenceEvaluators.java
DifferenceEvaluators.ignorePrologDifferences
public static DifferenceEvaluator ignorePrologDifferences() { return new DifferenceEvaluator() { @Override public ComparisonResult evaluate(Comparison comparison, ComparisonResult orig) { return belongsToProlog(comparison, true) || isSequenceOfRootElement(comparison) ? ComparisonResult.EQUAL : orig; } }; }
java
public static DifferenceEvaluator ignorePrologDifferences() { return new DifferenceEvaluator() { @Override public ComparisonResult evaluate(Comparison comparison, ComparisonResult orig) { return belongsToProlog(comparison, true) || isSequenceOfRootElement(comparison) ? ComparisonResult.EQUAL : orig; } }; }
[ "public", "static", "DifferenceEvaluator", "ignorePrologDifferences", "(", ")", "{", "return", "new", "DifferenceEvaluator", "(", ")", "{", "@", "Override", "public", "ComparisonResult", "evaluate", "(", "Comparison", "comparison", ",", "ComparisonResult", "orig", ")"...
Ignore any differences that are part of the <a href="https://www.w3.org/TR/2008/REC-xml-20081126/#sec-prolog-dtd">XML prolog</a>. <p>Here "ignore" means return {@code ComparisonResult.EQUAL}.</p> @since XMLUnit 2.1.0
[ "Ignore", "any", "differences", "that", "are", "part", "of", "the", "<a", "href", "=", "https", ":", "//", "www", ".", "w3", ".", "org", "/", "TR", "/", "2008", "/", "REC", "-", "xml", "-", "20081126", "/", "#sec", "-", "prolog", "-", "dtd", ">",...
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-core/src/main/java/org/xmlunit/diff/DifferenceEvaluators.java#L168-L177
twilio/twilio-java
src/main/java/com/twilio/rest/proxy/v1/service/SessionUpdater.java
SessionUpdater.setParticipants
public SessionUpdater setParticipants(final Map<String, Object> participants) { return setParticipants(Promoter.listOfOne(participants)); }
java
public SessionUpdater setParticipants(final Map<String, Object> participants) { return setParticipants(Promoter.listOfOne(participants)); }
[ "public", "SessionUpdater", "setParticipants", "(", "final", "Map", "<", "String", ",", "Object", ">", "participants", ")", "{", "return", "setParticipants", "(", "Promoter", ".", "listOfOne", "(", "participants", ")", ")", ";", "}" ]
The Participant objects to include in the session.. @param participants The Participant objects to include in the session @return this
[ "The", "Participant", "objects", "to", "include", "in", "the", "session", ".." ]
train
https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/proxy/v1/service/SessionUpdater.java#L117-L119
alkacon/opencms-core
src/org/opencms/security/CmsOrgUnitManager.java
CmsOrgUnitManager.addResourceToOrgUnit
public void addResourceToOrgUnit(CmsObject cms, String ouFqn, String resourceName) throws CmsException { CmsOrganizationalUnit orgUnit = readOrganizationalUnit(cms, ouFqn); CmsResource resource = cms.readResource(resourceName); m_securityManager.addResourceToOrgUnit(cms.getRequestContext(), orgUnit, resource); }
java
public void addResourceToOrgUnit(CmsObject cms, String ouFqn, String resourceName) throws CmsException { CmsOrganizationalUnit orgUnit = readOrganizationalUnit(cms, ouFqn); CmsResource resource = cms.readResource(resourceName); m_securityManager.addResourceToOrgUnit(cms.getRequestContext(), orgUnit, resource); }
[ "public", "void", "addResourceToOrgUnit", "(", "CmsObject", "cms", ",", "String", "ouFqn", ",", "String", "resourceName", ")", "throws", "CmsException", "{", "CmsOrganizationalUnit", "orgUnit", "=", "readOrganizationalUnit", "(", "cms", ",", "ouFqn", ")", ";", "Cm...
Adds a resource to the given organizational unit.<p> @param cms the opencms context @param ouFqn the full qualified name of the organizational unit to add the resource to @param resourceName the name of the resource that is to be added to the organizational unit @throws CmsException if something goes wrong
[ "Adds", "a", "resource", "to", "the", "given", "organizational", "unit", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/security/CmsOrgUnitManager.java#L78-L83
aol/cyclops
cyclops/src/main/java/cyclops/companion/Functions.java
Functions.mapInts
public static Function<? super ReactiveSeq<Integer>, ? extends ReactiveSeq<Integer>> mapInts(IntUnaryOperator b){ return a->a.ints(i->i,s->s.map(b)); }
java
public static Function<? super ReactiveSeq<Integer>, ? extends ReactiveSeq<Integer>> mapInts(IntUnaryOperator b){ return a->a.ints(i->i,s->s.map(b)); }
[ "public", "static", "Function", "<", "?", "super", "ReactiveSeq", "<", "Integer", ">", ",", "?", "extends", "ReactiveSeq", "<", "Integer", ">", ">", "mapInts", "(", "IntUnaryOperator", "b", ")", "{", "return", "a", "->", "a", ".", "ints", "(", "i", "->...
/* Fluent transform operation using primitive types e.g. <pre> {@code import static cyclops.ReactiveSeq.mapInts; ReactiveSeq.ofInts(1,2,3) .to(mapInts(i->i*2)); //[2,4,6] } </pre>
[ "/", "*", "Fluent", "transform", "operation", "using", "primitive", "types", "e", ".", "g", ".", "<pre", ">", "{", "@code", "import", "static", "cyclops", ".", "ReactiveSeq", ".", "mapInts", ";" ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Functions.java#L259-L262
cuba-platform/yarg
core/modules/api/src/com/haulmont/yarg/reporting/RunParams.java
RunParams.templateCode
public RunParams templateCode(String templateCode) { if (templateCode == null) { throw new NullPointerException("\"templateCode\" parameter can not be null"); } this.reportTemplate = report.getReportTemplates().get(templateCode); if (reportTemplate == null) { throw new NullPointerException(String.format("Report template not found for code [%s]", templateCode)); } return this; }
java
public RunParams templateCode(String templateCode) { if (templateCode == null) { throw new NullPointerException("\"templateCode\" parameter can not be null"); } this.reportTemplate = report.getReportTemplates().get(templateCode); if (reportTemplate == null) { throw new NullPointerException(String.format("Report template not found for code [%s]", templateCode)); } return this; }
[ "public", "RunParams", "templateCode", "(", "String", "templateCode", ")", "{", "if", "(", "templateCode", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"\\\"templateCode\\\" parameter can not be null\"", ")", ";", "}", "this", ".", "reportT...
Setup necessary template by string code. Throws validation exception if code is null or template not found @param templateCode - string code of template
[ "Setup", "necessary", "template", "by", "string", "code", ".", "Throws", "validation", "exception", "if", "code", "is", "null", "or", "template", "not", "found" ]
train
https://github.com/cuba-platform/yarg/blob/d157286cbe29448f3e1f445e8c5dd88808351da0/core/modules/api/src/com/haulmont/yarg/reporting/RunParams.java#L43-L52
junit-team/junit4
src/main/java/org/junit/Assert.java
Assert.assertThrows
public static <T extends Throwable> T assertThrows(Class<T> expectedThrowable, ThrowingRunnable runnable) { return assertThrows(null, expectedThrowable, runnable); }
java
public static <T extends Throwable> T assertThrows(Class<T> expectedThrowable, ThrowingRunnable runnable) { return assertThrows(null, expectedThrowable, runnable); }
[ "public", "static", "<", "T", "extends", "Throwable", ">", "T", "assertThrows", "(", "Class", "<", "T", ">", "expectedThrowable", ",", "ThrowingRunnable", "runnable", ")", "{", "return", "assertThrows", "(", "null", ",", "expectedThrowable", ",", "runnable", "...
Asserts that {@code runnable} throws an exception of type {@code expectedThrowable} when executed. If it does, the exception object is returned. If it does not throw an exception, an {@link AssertionError} is thrown. If it throws the wrong type of exception, an {@code AssertionError} is thrown describing the mismatch; the exception that was actually thrown can be obtained by calling {@link AssertionError#getCause}. @param expectedThrowable the expected type of the exception @param runnable a function that is expected to throw an exception when executed @return the exception thrown by {@code runnable} @since 4.13
[ "Asserts", "that", "{", "@code", "runnable", "}", "throws", "an", "exception", "of", "type", "{", "@code", "expectedThrowable", "}", "when", "executed", ".", "If", "it", "does", "the", "exception", "object", "is", "returned", ".", "If", "it", "does", "not"...
train
https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/org/junit/Assert.java#L981-L984
jetty-project/jetty-npn
npn-boot/src/main/java/sun/security/ssl/Handshaker.java
Handshaker.process_record
void process_record(InputRecord r, boolean expectingFinished) throws IOException { checkThrown(); /* * Store the incoming handshake data, then see if we can * now process any completed handshake messages */ input.incomingRecord(r); /* * We don't need to create a separate delegatable task * for finished messages. */ if ((conn != null) || expectingFinished) { processLoop(); } else { delegateTask(new PrivilegedExceptionAction<Void>() { public Void run() throws Exception { processLoop(); return null; } }); } }
java
void process_record(InputRecord r, boolean expectingFinished) throws IOException { checkThrown(); /* * Store the incoming handshake data, then see if we can * now process any completed handshake messages */ input.incomingRecord(r); /* * We don't need to create a separate delegatable task * for finished messages. */ if ((conn != null) || expectingFinished) { processLoop(); } else { delegateTask(new PrivilegedExceptionAction<Void>() { public Void run() throws Exception { processLoop(); return null; } }); } }
[ "void", "process_record", "(", "InputRecord", "r", ",", "boolean", "expectingFinished", ")", "throws", "IOException", "{", "checkThrown", "(", ")", ";", "/*\n * Store the incoming handshake data, then see if we can\n * now process any completed handshake messages\n ...
/* This routine is fed SSL handshake records when they become available, and processes messages found therein.
[ "/", "*", "This", "routine", "is", "fed", "SSL", "handshake", "records", "when", "they", "become", "available", "and", "processes", "messages", "found", "therein", "." ]
train
https://github.com/jetty-project/jetty-npn/blob/a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d/npn-boot/src/main/java/sun/security/ssl/Handshaker.java#L837-L862
jboss-integration/fuse-bxms-integ
switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/operation/KnowledgeOperations.java
KnowledgeOperations.containsGlobals
public static boolean containsGlobals(Message message, KnowledgeOperation operation, KnowledgeRuntimeEngine runtime) { Map<String, Object> expressionMap = getMap(message, operation.getGlobalExpressionMappings(), null); return expressionMap != null && expressionMap.size() > 0; }
java
public static boolean containsGlobals(Message message, KnowledgeOperation operation, KnowledgeRuntimeEngine runtime) { Map<String, Object> expressionMap = getMap(message, operation.getGlobalExpressionMappings(), null); return expressionMap != null && expressionMap.size() > 0; }
[ "public", "static", "boolean", "containsGlobals", "(", "Message", "message", ",", "KnowledgeOperation", "operation", ",", "KnowledgeRuntimeEngine", "runtime", ")", "{", "Map", "<", "String", ",", "Object", ">", "expressionMap", "=", "getMap", "(", "message", ",", ...
Contains the globals. @param message the message @param operation the operation @param runtime the runtime engine @return containsGlobal
[ "Contains", "the", "globals", "." ]
train
https://github.com/jboss-integration/fuse-bxms-integ/blob/ca5c012bf867ea15d1250f0991af3cd7e708aaaf/switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/operation/KnowledgeOperations.java#L160-L164
threerings/gwt-utils
src/main/java/com/threerings/gwt/ui/Widgets.java
Widgets.newActionLabel
public static Label newActionLabel (String text, ClickHandler onClick) { return newActionLabel(text, null, onClick); }
java
public static Label newActionLabel (String text, ClickHandler onClick) { return newActionLabel(text, null, onClick); }
[ "public", "static", "Label", "newActionLabel", "(", "String", "text", ",", "ClickHandler", "onClick", ")", "{", "return", "newActionLabel", "(", "text", ",", "null", ",", "onClick", ")", ";", "}" ]
Creates a label that triggers an action using the supplied text and handler.
[ "Creates", "a", "label", "that", "triggers", "an", "action", "using", "the", "supplied", "text", "and", "handler", "." ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/Widgets.java#L194-L197
olavloite/spanner-jdbc
src/main/java/nl/topicus/jdbc/CloudSpannerDriver.java
CloudSpannerDriver.getSpanner
synchronized Spanner getSpanner(String projectId, Credentials credentials, String host) { SpannerKey key = SpannerKey.of(host, projectId, credentials); Spanner spanner = spanners.get(key); if (spanner == null) { spanner = createSpanner(key); spanners.put(key, spanner); } return spanner; }
java
synchronized Spanner getSpanner(String projectId, Credentials credentials, String host) { SpannerKey key = SpannerKey.of(host, projectId, credentials); Spanner spanner = spanners.get(key); if (spanner == null) { spanner = createSpanner(key); spanners.put(key, spanner); } return spanner; }
[ "synchronized", "Spanner", "getSpanner", "(", "String", "projectId", ",", "Credentials", "credentials", ",", "String", "host", ")", "{", "SpannerKey", "key", "=", "SpannerKey", ".", "of", "(", "host", ",", "projectId", ",", "credentials", ")", ";", "Spanner", ...
Get a {@link Spanner} instance from the pool or create a new one if needed. @param projectId The projectId to connect to @param credentials The credentials to use for the connection @param host The host to connect to. Normally this is https://spanner.googleapis.com, but you could also use a (local) emulator. If null, no host will be set and the default host of Google Cloud Spanner will be used. @return The {@link Spanner} instance to use
[ "Get", "a", "{", "@link", "Spanner", "}", "instance", "from", "the", "pool", "or", "create", "a", "new", "one", "if", "needed", "." ]
train
https://github.com/olavloite/spanner-jdbc/blob/b65a5185300580b143866e57501a1ea606b59aa5/src/main/java/nl/topicus/jdbc/CloudSpannerDriver.java#L220-L228
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/adapter/urbridge/utils/URBridgeEntity.java
URBridgeEntity.getSecurityName
public String getSecurityName(boolean setAttr) throws Exception { String securityName = null; if (entity.getIdentifier().isSet(securityNameProp)) { securityName = (String) entity.getIdentifier().get(securityNameProp); } // Neither identifier is set. if (securityName == null && !entity.getIdentifier().isSet(uniqueIdProp)) { throw new WIMApplicationException(WIMMessageKey.REQUIRED_IDENTIFIERS_MISSING, Tr.formatMessage(tc, WIMMessageKey.REQUIRED_IDENTIFIERS_MISSING)); } else if (securityName == null) { String uniqueId = (String) entity.getIdentifier().get(uniqueIdProp); // Get the securityName. securityName = getSecurityNameForEntity(uniqueId); } // Set the attribute in the WIM entity if requested. If it needs a RDN style name, make it. if (setAttr) { // Construct RDN style from securityName only if its not already a DN // securityName = (UniqueNameHelper.isDN(securityName) == null || // !StringUtil.endsWithIgnoreCase(securityName, "," + baseEntryName)) ? securityName : securityName; entity.getIdentifier().set(securityNameProp, securityName); } return securityName; }
java
public String getSecurityName(boolean setAttr) throws Exception { String securityName = null; if (entity.getIdentifier().isSet(securityNameProp)) { securityName = (String) entity.getIdentifier().get(securityNameProp); } // Neither identifier is set. if (securityName == null && !entity.getIdentifier().isSet(uniqueIdProp)) { throw new WIMApplicationException(WIMMessageKey.REQUIRED_IDENTIFIERS_MISSING, Tr.formatMessage(tc, WIMMessageKey.REQUIRED_IDENTIFIERS_MISSING)); } else if (securityName == null) { String uniqueId = (String) entity.getIdentifier().get(uniqueIdProp); // Get the securityName. securityName = getSecurityNameForEntity(uniqueId); } // Set the attribute in the WIM entity if requested. If it needs a RDN style name, make it. if (setAttr) { // Construct RDN style from securityName only if its not already a DN // securityName = (UniqueNameHelper.isDN(securityName) == null || // !StringUtil.endsWithIgnoreCase(securityName, "," + baseEntryName)) ? securityName : securityName; entity.getIdentifier().set(securityNameProp, securityName); } return securityName; }
[ "public", "String", "getSecurityName", "(", "boolean", "setAttr", ")", "throws", "Exception", "{", "String", "securityName", "=", "null", ";", "if", "(", "entity", ".", "getIdentifier", "(", ")", ".", "isSet", "(", "securityNameProp", ")", ")", "{", "securit...
Returns the securityName of a user or a group. @param setAttr a boolean indicating whether to actually set the attribute in the entity or just perform a lookup. @return the user or group's securityName. @throws Exception identifier values are missing or the underlying registry threw an error.
[ "Returns", "the", "securityName", "of", "a", "user", "or", "a", "group", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/adapter/urbridge/utils/URBridgeEntity.java#L161-L186
Multifarious/MacroManager
src/main/java/com/fasterxml/mama/listeners/HandoffResultsListener.java
HandoffResultsListener.finishHandoff
public void finishHandoff(final String workUnit) throws InterruptedException { String unitId = cluster.workUnitMap.get(workUnit); LOG.info("Handoff of {} to me acknowledged. Deleting claim ZNode for {} and waiting for {} to shutdown work.", workUnit, workUnit, ((unitId == null) ? "(None)" : unitId)); final String path = cluster.workUnitClaimPath(workUnit); Stat stat = ZKUtils.exists(cluster.zk, path, new Watcher() { @Override public void process(WatchedEvent event) { // Don't really care about the type of event here - call unconditionally to clean up state completeHandoff(workUnit, path); } }); // Unlikely that peer will have already deleted znode, but handle it regardless if (stat == null) { LOG.warn("Peer already deleted znode of {}", workUnit); completeHandoff(workUnit, path); } }
java
public void finishHandoff(final String workUnit) throws InterruptedException { String unitId = cluster.workUnitMap.get(workUnit); LOG.info("Handoff of {} to me acknowledged. Deleting claim ZNode for {} and waiting for {} to shutdown work.", workUnit, workUnit, ((unitId == null) ? "(None)" : unitId)); final String path = cluster.workUnitClaimPath(workUnit); Stat stat = ZKUtils.exists(cluster.zk, path, new Watcher() { @Override public void process(WatchedEvent event) { // Don't really care about the type of event here - call unconditionally to clean up state completeHandoff(workUnit, path); } }); // Unlikely that peer will have already deleted znode, but handle it regardless if (stat == null) { LOG.warn("Peer already deleted znode of {}", workUnit); completeHandoff(workUnit, path); } }
[ "public", "void", "finishHandoff", "(", "final", "String", "workUnit", ")", "throws", "InterruptedException", "{", "String", "unitId", "=", "cluster", ".", "workUnitMap", ".", "get", "(", "workUnit", ")", ";", "LOG", ".", "info", "(", "\"Handoff of {} to me ackn...
Completes the process of handing off a work unit from one node to the current one. Attempts to establish a final claim to the node handed off to me in ZooKeeper, and repeats execution of the task every two seconds until it is complete.
[ "Completes", "the", "process", "of", "handing", "off", "a", "work", "unit", "from", "one", "node", "to", "the", "current", "one", ".", "Attempts", "to", "establish", "a", "final", "claim", "to", "the", "node", "handed", "off", "to", "me", "in", "ZooKeepe...
train
https://github.com/Multifarious/MacroManager/blob/559785839981f460aaeba3c3fddff7fb667d9581/src/main/java/com/fasterxml/mama/listeners/HandoffResultsListener.java#L102-L123
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java
ElementBase.notifyParent
public void notifyParent(String eventName, Object eventData, boolean recurse) { ElementBase ele = parent; while (ele != null) { recurse &= ele.parentListeners.notify(this, eventName, eventData); ele = recurse ? ele.parent : null; } }
java
public void notifyParent(String eventName, Object eventData, boolean recurse) { ElementBase ele = parent; while (ele != null) { recurse &= ele.parentListeners.notify(this, eventName, eventData); ele = recurse ? ele.parent : null; } }
[ "public", "void", "notifyParent", "(", "String", "eventName", ",", "Object", "eventData", ",", "boolean", "recurse", ")", "{", "ElementBase", "ele", "=", "parent", ";", "while", "(", "ele", "!=", "null", ")", "{", "recurse", "&=", "ele", ".", "parentListen...
Allows a child element to notify its parent of an event of interest. @param eventName Name of the event. @param eventData Data associated with the event. @param recurse If true, recurse up the parent chain.
[ "Allows", "a", "child", "element", "to", "notify", "its", "parent", "of", "an", "event", "of", "interest", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementBase.java#L985-L992
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/chess/ChessboardCornerClusterToGrid.java
ChessboardCornerClusterToGrid.isRightHanded
static boolean isRightHanded( Node seed , int idxRow , int idxCol ) { Node r = seed.edges[idxRow]; Node c = seed.edges[idxCol]; double dirRow = Math.atan2(r.y-seed.y,r.x-seed.x); double dirCol = Math.atan2(c.y-seed.y,c.x-seed.x); return UtilAngle.distanceCW(dirRow,dirCol) < Math.PI; }
java
static boolean isRightHanded( Node seed , int idxRow , int idxCol ) { Node r = seed.edges[idxRow]; Node c = seed.edges[idxCol]; double dirRow = Math.atan2(r.y-seed.y,r.x-seed.x); double dirCol = Math.atan2(c.y-seed.y,c.x-seed.x); return UtilAngle.distanceCW(dirRow,dirCol) < Math.PI; }
[ "static", "boolean", "isRightHanded", "(", "Node", "seed", ",", "int", "idxRow", ",", "int", "idxCol", ")", "{", "Node", "r", "=", "seed", ".", "edges", "[", "idxRow", "]", ";", "Node", "c", "=", "seed", ".", "edges", "[", "idxCol", "]", ";", "doub...
Checks to see if the rows and columns for a coordinate system which is right handed @param idxRow Index for moving up a row @param idxCol index for moving up a column
[ "Checks", "to", "see", "if", "the", "rows", "and", "columns", "for", "a", "coordinate", "system", "which", "is", "right", "handed" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/chess/ChessboardCornerClusterToGrid.java#L244-L252
jurmous/etcd4j
src/main/java/mousio/etcd4j/security/SecurityContextBuilder.java
SecurityContextBuilder.forKeystoreAndTruststore
public static SslContext forKeystoreAndTruststore(String keystorePath, String keystorePassword, String truststorePath, String truststorePassword, String keyManagerAlgorithm) throws SecurityContextException { try { return forKeystoreAndTruststore(new FileInputStream(keystorePath), keystorePassword, new FileInputStream(truststorePath), truststorePassword, keyManagerAlgorithm); } catch (Exception e) { throw new SecurityContextException(e); } }
java
public static SslContext forKeystoreAndTruststore(String keystorePath, String keystorePassword, String truststorePath, String truststorePassword, String keyManagerAlgorithm) throws SecurityContextException { try { return forKeystoreAndTruststore(new FileInputStream(keystorePath), keystorePassword, new FileInputStream(truststorePath), truststorePassword, keyManagerAlgorithm); } catch (Exception e) { throw new SecurityContextException(e); } }
[ "public", "static", "SslContext", "forKeystoreAndTruststore", "(", "String", "keystorePath", ",", "String", "keystorePassword", ",", "String", "truststorePath", ",", "String", "truststorePassword", ",", "String", "keyManagerAlgorithm", ")", "throws", "SecurityContextExcepti...
Builds SslContext using protected keystore and truststores. Adequate for mutual TLS connections. @param keystorePath Path for keystore file @param keystorePassword Password for protected keystore file @param truststorePath Path for truststore file @param truststorePassword Password for protected truststore file @param keyManagerAlgorithm Algorithm for keyManager used to process keystorefile @return SslContext ready to use @throws SecurityContextException
[ "Builds", "SslContext", "using", "protected", "keystore", "and", "truststores", ".", "Adequate", "for", "mutual", "TLS", "connections", "." ]
train
https://github.com/jurmous/etcd4j/blob/ffb1d574cf85bbab025dd566ce250f1860bbcbc7/src/main/java/mousio/etcd4j/security/SecurityContextBuilder.java#L101-L109
meltmedia/cadmium
cli/src/main/java/com/meltmedia/cadmium/cli/BranchCreator.java
BranchCreator.createNewBranches
public void createNewBranches(String basename, boolean empty, Logger log) throws Exception { createNewBranch(null, basename, empty, log); createNewBranch("cd", basename, empty, log); createNewBranch("cfg", basename, empty, log); }
java
public void createNewBranches(String basename, boolean empty, Logger log) throws Exception { createNewBranch(null, basename, empty, log); createNewBranch("cd", basename, empty, log); createNewBranch("cfg", basename, empty, log); }
[ "public", "void", "createNewBranches", "(", "String", "basename", ",", "boolean", "empty", ",", "Logger", "log", ")", "throws", "Exception", "{", "createNewBranch", "(", "null", ",", "basename", ",", "empty", ",", "log", ")", ";", "createNewBranch", "(", "\"...
Creates required cadmium branches using the given basename. This will also create the source branch. The branches created will be as follows: <ul> <li><i>basename</i></li> <li>cd-<i>basename</i></li> <li>cfg-<i>basename</i></li> </ul> @param basename The basename used for all branches that will be created. @param empty If true the branches will all be created with no content. If false the branches will be created off of the associated <i>master</i> branch. @param log @throws Exception
[ "Creates", "required", "cadmium", "branches", "using", "the", "given", "basename", ".", "This", "will", "also", "create", "the", "source", "branch", ".", "The", "branches", "created", "will", "be", "as", "follows", ":", "<ul", ">", "<li", ">", "<i", ">", ...
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/cli/src/main/java/com/meltmedia/cadmium/cli/BranchCreator.java#L78-L82
stanfy/goro
goro/src/main/java/com/stanfy/enroscar/goro/GoroService.java
GoroService.taskIntent
public static <T extends Callable<?> & Parcelable> Intent taskIntent(final Context context, final T task) { return taskIntent(context, Goro.DEFAULT_QUEUE, task); }
java
public static <T extends Callable<?> & Parcelable> Intent taskIntent(final Context context, final T task) { return taskIntent(context, Goro.DEFAULT_QUEUE, task); }
[ "public", "static", "<", "T", "extends", "Callable", "<", "?", ">", "&", "Parcelable", ">", "Intent", "taskIntent", "(", "final", "Context", "context", ",", "final", "T", "task", ")", "{", "return", "taskIntent", "(", "context", ",", "Goro", ".", "DEFAUL...
Create an intent that contains a task that should be scheduled on a default queue. @param context context instance @param task task instance @param <T> task type @see #taskIntent(android.content.Context, String, java.util.concurrent.Callable)
[ "Create", "an", "intent", "that", "contains", "a", "task", "that", "should", "be", "scheduled", "on", "a", "default", "queue", "." ]
train
https://github.com/stanfy/goro/blob/6618e63a926833d61f492ec611ee77668d756820/goro/src/main/java/com/stanfy/enroscar/goro/GoroService.java#L197-L200
GCRC/nunaliit
nunaliit2-multimedia/src/main/java/ca/carleton/gcrc/olkit/multimedia/apachePDFBox/imageio/TIFFUtil.java
TIFFUtil.updateMetadata
static void updateMetadata(IIOMetadata metadata, BufferedImage image, int dpi) throws IIOInvalidTreeException { String metaDataFormat = metadata.getNativeMetadataFormatName(); if (metaDataFormat == null) { logger.debug("TIFF image writer doesn't support any data format"); return; } debugLogMetadata(metadata, metaDataFormat); IIOMetadataNode root = new IIOMetadataNode(metaDataFormat); IIOMetadataNode ifd; if (root.getElementsByTagName("TIFFIFD").getLength() == 0) { ifd = new IIOMetadataNode("TIFFIFD"); root.appendChild(ifd); } else { ifd = (IIOMetadataNode)root.getElementsByTagName("TIFFIFD").item(0); } // standard metadata does not work, so we set the DPI manually ifd.appendChild(createRationalField(282, "XResolution", dpi, 1)); ifd.appendChild(createRationalField(283, "YResolution", dpi, 1)); ifd.appendChild(createShortField(296, "ResolutionUnit", 2)); // Inch ifd.appendChild(createLongField(278, "RowsPerStrip", image.getHeight())); ifd.appendChild(createAsciiField(305, "Software", "PDFBOX")); if (image.getType() == BufferedImage.TYPE_BYTE_BINARY && image.getColorModel().getPixelSize() == 1) { // set PhotometricInterpretation WhiteIsZero // because of bug in Windows XP preview ifd.appendChild(createShortField(262, "PhotometricInterpretation", 0)); } metadata.mergeTree(metaDataFormat, root); debugLogMetadata(metadata, metaDataFormat); }
java
static void updateMetadata(IIOMetadata metadata, BufferedImage image, int dpi) throws IIOInvalidTreeException { String metaDataFormat = metadata.getNativeMetadataFormatName(); if (metaDataFormat == null) { logger.debug("TIFF image writer doesn't support any data format"); return; } debugLogMetadata(metadata, metaDataFormat); IIOMetadataNode root = new IIOMetadataNode(metaDataFormat); IIOMetadataNode ifd; if (root.getElementsByTagName("TIFFIFD").getLength() == 0) { ifd = new IIOMetadataNode("TIFFIFD"); root.appendChild(ifd); } else { ifd = (IIOMetadataNode)root.getElementsByTagName("TIFFIFD").item(0); } // standard metadata does not work, so we set the DPI manually ifd.appendChild(createRationalField(282, "XResolution", dpi, 1)); ifd.appendChild(createRationalField(283, "YResolution", dpi, 1)); ifd.appendChild(createShortField(296, "ResolutionUnit", 2)); // Inch ifd.appendChild(createLongField(278, "RowsPerStrip", image.getHeight())); ifd.appendChild(createAsciiField(305, "Software", "PDFBOX")); if (image.getType() == BufferedImage.TYPE_BYTE_BINARY && image.getColorModel().getPixelSize() == 1) { // set PhotometricInterpretation WhiteIsZero // because of bug in Windows XP preview ifd.appendChild(createShortField(262, "PhotometricInterpretation", 0)); } metadata.mergeTree(metaDataFormat, root); debugLogMetadata(metadata, metaDataFormat); }
[ "static", "void", "updateMetadata", "(", "IIOMetadata", "metadata", ",", "BufferedImage", "image", ",", "int", "dpi", ")", "throws", "IIOInvalidTreeException", "{", "String", "metaDataFormat", "=", "metadata", ".", "getNativeMetadataFormatName", "(", ")", ";", "if",...
Updates the given ImageIO metadata with Sun's custom TIFF tags, as described in the <a href="https://svn.apache.org/repos/asf/xmlgraphics/commons/tags/commons-1_3_1/src/java/org/apache/xmlgraphics/image/writer/imageio/ImageIOTIFFImageWriter.java">org.apache.xmlgraphics.image.writer.imageio.ImageIOTIFFImageWriter sources</a>, the <a href="http://download.java.net/media/jai-imageio/javadoc/1.0_01/com/sun/media/imageio/plugins/tiff/package-summary.html">com.sun.media.imageio.plugins.tiff package javadoc</a> and the <a href="http://partners.adobe.com/public/developer/tiff/index.html">TIFF specification</a>. @param image buffered image which will be written @param metadata ImageIO metadata @param dpi image dots per inch @throws IIOInvalidTreeException if something goes wrong
[ "Updates", "the", "given", "ImageIO", "metadata", "with", "Sun", "s", "custom", "TIFF", "tags", "as", "described", "in", "the", "<a", "href", "=", "https", ":", "//", "svn", ".", "apache", ".", "org", "/", "repos", "/", "asf", "/", "xmlgraphics", "/", ...
train
https://github.com/GCRC/nunaliit/blob/0b4abfc64eef2eb8b94f852ce697de2e851d8e67/nunaliit2-multimedia/src/main/java/ca/carleton/gcrc/olkit/multimedia/apachePDFBox/imageio/TIFFUtil.java#L77-L120
sagiegurari/fax4j
src/main/java/org/fax4j/spi/http/ApacheHTTPClient.java
ApacheHTTPClient.submitHTTPRequest
public HTTPResponse submitHTTPRequest(HTTPRequest httpRequest,HTTPClientConfiguration httpClientConfiguration,HTTPMethod httpMethod) { //create HTTP client HttpClient httpClient=this.createHttpClient(); //create URL String url=this.createURL(httpRequest,httpClientConfiguration); //create request HttpMethodBase httpMethodClient=this.createMethod(url,httpMethod); //setup header properties this.setupHTTPRequestHeaderProperties(httpRequest,httpMethodClient); //set content this.setRequestContent(httpRequest,httpMethodClient); //get logger LoggerManager loggerManager=LoggerManager.getInstance(); Logger logger=loggerManager.getLogger(); try { logger.logDebug(new Object[]{"Submitting HTTP request: ",httpMethodClient.getURI()},null); } catch(URIException exception) { logger.logDebug(new Object[]{"Submitting HTTP request"},null); } String responseContent=null; int statusCode=-1; try { //submit HTTP request statusCode=httpClient.executeMethod(httpMethodClient); if(statusCode>=400) { throw new FaxException("Error while invoking HTTP request, return status code: "+statusCode); } //get response content responseContent=httpMethodClient.getResponseBodyAsString(); } catch(FaxException exception) { throw exception; } catch(Exception exception) { throw new FaxException("Error while executing HTTP request.",exception); } finally { //release connection httpMethodClient.releaseConnection(); } //create HTTP response HTTPResponse httpResponse=this.createHTTPResponse(statusCode,responseContent); return httpResponse; }
java
public HTTPResponse submitHTTPRequest(HTTPRequest httpRequest,HTTPClientConfiguration httpClientConfiguration,HTTPMethod httpMethod) { //create HTTP client HttpClient httpClient=this.createHttpClient(); //create URL String url=this.createURL(httpRequest,httpClientConfiguration); //create request HttpMethodBase httpMethodClient=this.createMethod(url,httpMethod); //setup header properties this.setupHTTPRequestHeaderProperties(httpRequest,httpMethodClient); //set content this.setRequestContent(httpRequest,httpMethodClient); //get logger LoggerManager loggerManager=LoggerManager.getInstance(); Logger logger=loggerManager.getLogger(); try { logger.logDebug(new Object[]{"Submitting HTTP request: ",httpMethodClient.getURI()},null); } catch(URIException exception) { logger.logDebug(new Object[]{"Submitting HTTP request"},null); } String responseContent=null; int statusCode=-1; try { //submit HTTP request statusCode=httpClient.executeMethod(httpMethodClient); if(statusCode>=400) { throw new FaxException("Error while invoking HTTP request, return status code: "+statusCode); } //get response content responseContent=httpMethodClient.getResponseBodyAsString(); } catch(FaxException exception) { throw exception; } catch(Exception exception) { throw new FaxException("Error while executing HTTP request.",exception); } finally { //release connection httpMethodClient.releaseConnection(); } //create HTTP response HTTPResponse httpResponse=this.createHTTPResponse(statusCode,responseContent); return httpResponse; }
[ "public", "HTTPResponse", "submitHTTPRequest", "(", "HTTPRequest", "httpRequest", ",", "HTTPClientConfiguration", "httpClientConfiguration", ",", "HTTPMethod", "httpMethod", ")", "{", "//create HTTP client", "HttpClient", "httpClient", "=", "this", ".", "createHttpClient", ...
Submits the HTTP request and returns the HTTP response. @param httpRequest The HTTP request to send @param httpClientConfiguration HTTP client configuration @param httpMethod The HTTP method to use @return The HTTP response
[ "Submits", "the", "HTTP", "request", "and", "returns", "the", "HTTP", "response", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/http/ApacheHTTPClient.java#L441-L504
btrplace/scheduler
choco/src/main/java/org/btrplace/scheduler/choco/extensions/pack/VectorPackingPropagator.java
VectorPackingPropagator.filterLoadSup
protected boolean filterLoadSup(int dim, int bin, int newLoadSup) throws ContradictionException { int delta = newLoadSup - loads[dim][bin].getUB(); if (delta >= 0) { return false; } loads[dim][bin].updateUpperBound(newLoadSup, this); if (sumISizes[dim] > sumLoadSup[dim].add(delta)) { fails(); } return true; }
java
protected boolean filterLoadSup(int dim, int bin, int newLoadSup) throws ContradictionException { int delta = newLoadSup - loads[dim][bin].getUB(); if (delta >= 0) { return false; } loads[dim][bin].updateUpperBound(newLoadSup, this); if (sumISizes[dim] > sumLoadSup[dim].add(delta)) { fails(); } return true; }
[ "protected", "boolean", "filterLoadSup", "(", "int", "dim", ",", "int", "bin", ",", "int", "newLoadSup", ")", "throws", "ContradictionException", "{", "int", "delta", "=", "newLoadSup", "-", "loads", "[", "dim", "]", "[", "bin", "]", ".", "getUB", "(", "...
update sup(binLoad) and sumLoadSup accordingly @param dim the dimension @param bin the bin @param newLoadSup the new lower bound value @return if the upper bound has actually been updated @throws ContradictionException if the domain of the bin load variable becomes empty
[ "update", "sup", "(", "binLoad", ")", "and", "sumLoadSup", "accordingly" ]
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/extensions/pack/VectorPackingPropagator.java#L286-L296
lightblueseas/net-extensions
src/main/java/de/alpharogroup/net/socket/SocketExtensions.java
SocketExtensions.writeObject
public static void writeObject(final Socket socket, final int port, final Object objectToSend) throws IOException { writeObject(socket.getInetAddress(), port, objectToSend); }
java
public static void writeObject(final Socket socket, final int port, final Object objectToSend) throws IOException { writeObject(socket.getInetAddress(), port, objectToSend); }
[ "public", "static", "void", "writeObject", "(", "final", "Socket", "socket", ",", "final", "int", "port", ",", "final", "Object", "objectToSend", ")", "throws", "IOException", "{", "writeObject", "(", "socket", ".", "getInetAddress", "(", ")", ",", "port", "...
Writes the given Object to the given Socket who listen to the given port. @param socket The Socket to the receiver. @param port The port who listen the receiver. @param objectToSend The Object to send. @throws IOException Signals that an I/O exception has occurred.
[ "Writes", "the", "given", "Object", "to", "the", "given", "Socket", "who", "listen", "to", "the", "given", "port", "." ]
train
https://github.com/lightblueseas/net-extensions/blob/771757a93fa9ad13ce0fe061c158e5cba43344cb/src/main/java/de/alpharogroup/net/socket/SocketExtensions.java#L401-L405
vipshop/vjtools
vjkit/src/main/java/com/vip/vjtools/vjkit/logging/PerformanceUtil.java
PerformanceUtil.slowLog
public static void slowLog(Logger logger, String key, long duration, long threshold, String context) { if (duration > threshold) { logger.warn("[Performance Warning] task {} use {}ms, slow than {}ms, contxt={}", key, duration, threshold, context); } }
java
public static void slowLog(Logger logger, String key, long duration, long threshold, String context) { if (duration > threshold) { logger.warn("[Performance Warning] task {} use {}ms, slow than {}ms, contxt={}", key, duration, threshold, context); } }
[ "public", "static", "void", "slowLog", "(", "Logger", "logger", ",", "String", "key", ",", "long", "duration", ",", "long", "threshold", ",", "String", "context", ")", "{", "if", "(", "duration", ">", "threshold", ")", "{", "logger", ".", "warn", "(", ...
当处理时间超过预定的阈值时发出警告信息 @param logger @param key @param threshold 阈值(单位:ms) @param context 需要记录的context信息,如请求的json等
[ "当处理时间超过预定的阈值时发出警告信息" ]
train
https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjkit/src/main/java/com/vip/vjtools/vjkit/logging/PerformanceUtil.java#L130-L135
comapi/comapi-sdk-android
COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java
InternalService.getParticipants
public Observable<ComapiResult<List<Participant>>> getParticipants(@NonNull final String conversationId) { final String token = getToken(); if (sessionController.isCreatingSession()) { return getTaskQueue().queueGetParticipants(conversationId); } else if (TextUtils.isEmpty(token)) { return Observable.error(getSessionStateErrorDescription()); } else { return doGetParticipants(token, conversationId); } }
java
public Observable<ComapiResult<List<Participant>>> getParticipants(@NonNull final String conversationId) { final String token = getToken(); if (sessionController.isCreatingSession()) { return getTaskQueue().queueGetParticipants(conversationId); } else if (TextUtils.isEmpty(token)) { return Observable.error(getSessionStateErrorDescription()); } else { return doGetParticipants(token, conversationId); } }
[ "public", "Observable", "<", "ComapiResult", "<", "List", "<", "Participant", ">", ">", ">", "getParticipants", "(", "@", "NonNull", "final", "String", "conversationId", ")", "{", "final", "String", "token", "=", "getToken", "(", ")", ";", "if", "(", "sess...
Returns observable to add a participant to. @param conversationId ID of a conversation to add a participant to. @return Observable to get a list of conversation participants.
[ "Returns", "observable", "to", "add", "a", "participant", "to", "." ]
train
https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L636-L647
elki-project/elki
elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/subspace/OUTRES.java
OUTRES.initialRange
private DoubleDBIDList initialRange(DBIDRef obj, DBIDs cands, PrimitiveDistanceFunction<? super NumberVector> df, double eps, KernelDensityEstimator kernel, ModifiableDoubleDBIDList n) { n.clear(); NumberVector o = kernel.relation.get(obj); final double twoeps = eps * 2; int matches = 0; for(DBIDIter cand = cands.iter(); cand.valid(); cand.advance()) { final double dist = df.distance(o, kernel.relation.get(cand)); if(dist <= twoeps) { n.add(dist, cand); if(dist <= eps) { ++matches; } } } n.sort(); return n.slice(0, matches); }
java
private DoubleDBIDList initialRange(DBIDRef obj, DBIDs cands, PrimitiveDistanceFunction<? super NumberVector> df, double eps, KernelDensityEstimator kernel, ModifiableDoubleDBIDList n) { n.clear(); NumberVector o = kernel.relation.get(obj); final double twoeps = eps * 2; int matches = 0; for(DBIDIter cand = cands.iter(); cand.valid(); cand.advance()) { final double dist = df.distance(o, kernel.relation.get(cand)); if(dist <= twoeps) { n.add(dist, cand); if(dist <= eps) { ++matches; } } } n.sort(); return n.slice(0, matches); }
[ "private", "DoubleDBIDList", "initialRange", "(", "DBIDRef", "obj", ",", "DBIDs", "cands", ",", "PrimitiveDistanceFunction", "<", "?", "super", "NumberVector", ">", "df", ",", "double", "eps", ",", "KernelDensityEstimator", "kernel", ",", "ModifiableDoubleDBIDList", ...
Initial range query. @param obj Object @param cands Candidates @param df Distance function @param eps Epsilon radius @param kernel Kernel @param n Output buffer @return Neighbors
[ "Initial", "range", "query", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/subspace/OUTRES.java#L199-L215
threerings/narya
core/src/main/java/com/threerings/presents/peer/server/PeerManager.java
PeerManager.locateClient
public ClientInfo locateClient (final Name key) { return lookupNodeDatum(new Function<NodeObject,ClientInfo>() { public ClientInfo apply (NodeObject nodeobj) { return nodeobj.clients.get(key); } }); }
java
public ClientInfo locateClient (final Name key) { return lookupNodeDatum(new Function<NodeObject,ClientInfo>() { public ClientInfo apply (NodeObject nodeobj) { return nodeobj.clients.get(key); } }); }
[ "public", "ClientInfo", "locateClient", "(", "final", "Name", "key", ")", "{", "return", "lookupNodeDatum", "(", "new", "Function", "<", "NodeObject", ",", "ClientInfo", ">", "(", ")", "{", "public", "ClientInfo", "apply", "(", "NodeObject", "nodeobj", ")", ...
Locates the client with the specified name. Returns null if the client is not logged onto any peer.
[ "Locates", "the", "client", "with", "the", "specified", "name", ".", "Returns", "null", "if", "the", "client", "is", "not", "logged", "onto", "any", "peer", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/peer/server/PeerManager.java#L416-L423
intuit/QuickBooks-V3-Java-SDK
ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java
DataService.prepareCDCQuery
private <T extends IEntity> IntuitMessage prepareCDCQuery(List<? extends IEntity> entities, String changedSince) throws FMSException { IntuitMessage intuitMessage = new IntuitMessage(); RequestElements requestElements = intuitMessage.getRequestElements(); //set the request params Map<String, String> requestParameters = requestElements.getRequestParameters(); requestParameters.put(RequestElements.REQ_PARAM_METHOD_TYPE, MethodType.GET.toString()); if (entities != null) { StringBuffer entityParam = new StringBuffer(); for (IEntity entity : entities) { entityParam.append(entity.getClass().getSimpleName()).append(","); } entityParam.delete(entityParam.length() - 1, entityParam.length()); requestParameters.put(RequestElements.REQ_PARAM_ENTITIES, entityParam.toString()); } String cdcChangedSinceParam = null; String cdcAction = null; cdcChangedSinceParam = RequestElements.REQ_PARAM_CHANGED_SINCE; cdcAction = OperationType.CDCQUERY.toString(); if (StringUtils.hasText(changedSince)) { requestParameters.put(cdcChangedSinceParam, changedSince); } requestElements.setAction(cdcAction); requestElements.setContext(context); return intuitMessage; }
java
private <T extends IEntity> IntuitMessage prepareCDCQuery(List<? extends IEntity> entities, String changedSince) throws FMSException { IntuitMessage intuitMessage = new IntuitMessage(); RequestElements requestElements = intuitMessage.getRequestElements(); //set the request params Map<String, String> requestParameters = requestElements.getRequestParameters(); requestParameters.put(RequestElements.REQ_PARAM_METHOD_TYPE, MethodType.GET.toString()); if (entities != null) { StringBuffer entityParam = new StringBuffer(); for (IEntity entity : entities) { entityParam.append(entity.getClass().getSimpleName()).append(","); } entityParam.delete(entityParam.length() - 1, entityParam.length()); requestParameters.put(RequestElements.REQ_PARAM_ENTITIES, entityParam.toString()); } String cdcChangedSinceParam = null; String cdcAction = null; cdcChangedSinceParam = RequestElements.REQ_PARAM_CHANGED_SINCE; cdcAction = OperationType.CDCQUERY.toString(); if (StringUtils.hasText(changedSince)) { requestParameters.put(cdcChangedSinceParam, changedSince); } requestElements.setAction(cdcAction); requestElements.setContext(context); return intuitMessage; }
[ "private", "<", "T", "extends", "IEntity", ">", "IntuitMessage", "prepareCDCQuery", "(", "List", "<", "?", "extends", "IEntity", ">", "entities", ",", "String", "changedSince", ")", "throws", "FMSException", "{", "IntuitMessage", "intuitMessage", "=", "new", "In...
Common method to prepare the request params for CDC query operation for both sync and async calls @param entities the list of entities @param changedSince the date where the entities should be listed from the last changed date @return IntuitMessage the intuit message @throws FMSException
[ "Common", "method", "to", "prepare", "the", "request", "params", "for", "CDC", "query", "operation", "for", "both", "sync", "and", "async", "calls" ]
train
https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/services/DataService.java#L1475-L1504
gallandarakhneorg/afc
advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/dfx/Segment3dfx.java
Segment3dfx.x2Property
@Pure public DoubleProperty x2Property() { if (this.p2.x == null) { this.p2.x = new SimpleDoubleProperty(this, MathFXAttributeNames.X2); } return this.p2.x; }
java
@Pure public DoubleProperty x2Property() { if (this.p2.x == null) { this.p2.x = new SimpleDoubleProperty(this, MathFXAttributeNames.X2); } return this.p2.x; }
[ "@", "Pure", "public", "DoubleProperty", "x2Property", "(", ")", "{", "if", "(", "this", ".", "p2", ".", "x", "==", "null", ")", "{", "this", ".", "p2", ".", "x", "=", "new", "SimpleDoubleProperty", "(", "this", ",", "MathFXAttributeNames", ".", "X2", ...
Replies the property that is the x coordinate of the second segment point. @return the x2 property.
[ "Replies", "the", "property", "that", "is", "the", "x", "coordinate", "of", "the", "second", "segment", "point", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/dfx/Segment3dfx.java#L259-L265
Stratio/deep-spark
deep-commons/src/main/java/com/stratio/deep/commons/entity/Cells.java
Cells.getValue
public <T> T getValue(int idx, Class<T> cellClass) { Cell cell = getCellByIdx(idx); return cell == null ? null : cell.getValue(cellClass); }
java
public <T> T getValue(int idx, Class<T> cellClass) { Cell cell = getCellByIdx(idx); return cell == null ? null : cell.getValue(cellClass); }
[ "public", "<", "T", ">", "T", "getValue", "(", "int", "idx", ",", "Class", "<", "T", ">", "cellClass", ")", "{", "Cell", "cell", "=", "getCellByIdx", "(", "idx", ")", ";", "return", "cell", "==", "null", "?", "null", ":", "cell", ".", "getValue", ...
Returns the casted value of the {@link Cell} at position {@code idx} in the list of Cell object. @param idx the index position of the Cell we want to retrieve @param cellClass the class of the cell's value @param <T> the type of the cell's value @return the casted value of the {@link Cell} at position {@code idx} in the list of Cell object
[ "Returns", "the", "casted", "value", "of", "the", "{", "@link", "Cell", "}", "at", "position", "{", "@code", "idx", "}", "in", "the", "list", "of", "Cell", "object", "." ]
train
https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-commons/src/main/java/com/stratio/deep/commons/entity/Cells.java#L605-L608
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/CmsSitemapTreeItem.java
CmsSitemapTreeItem.highlightTemporarily
public void highlightTemporarily(int duration, final Background background) { int blinkInterval = 300; final int blinkCount = duration / blinkInterval; Scheduler.get().scheduleFixedPeriod(new RepeatingCommand() { private int m_counter; /** * @see com.google.gwt.core.client.Scheduler.RepeatingCommand#execute() */ public boolean execute() { boolean finish = m_counter > blinkCount; highlight(((m_counter % 2) == 0) && !finish); m_counter += 1; if (finish) { setBackgroundColor(background); } return !finish; } }, blinkInterval); }
java
public void highlightTemporarily(int duration, final Background background) { int blinkInterval = 300; final int blinkCount = duration / blinkInterval; Scheduler.get().scheduleFixedPeriod(new RepeatingCommand() { private int m_counter; /** * @see com.google.gwt.core.client.Scheduler.RepeatingCommand#execute() */ public boolean execute() { boolean finish = m_counter > blinkCount; highlight(((m_counter % 2) == 0) && !finish); m_counter += 1; if (finish) { setBackgroundColor(background); } return !finish; } }, blinkInterval); }
[ "public", "void", "highlightTemporarily", "(", "int", "duration", ",", "final", "Background", "background", ")", "{", "int", "blinkInterval", "=", "300", ";", "final", "int", "blinkCount", "=", "duration", "/", "blinkInterval", ";", "Scheduler", ".", "get", "(...
Temporarily highlights an item.<p> @param duration the duration for which @param background the background to color to set when finished
[ "Temporarily", "highlights", "an", "item", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/CmsSitemapTreeItem.java#L528-L551
andygibson/datafactory
src/main/java/org/fluttercode/datafactory/impl/DataFactory.java
DataFactory.getRandomText
public String getRandomText(final int minLength, final int maxLength) { validateMinMaxParams(minLength, maxLength); StringBuilder sb = new StringBuilder(maxLength); int length = minLength; if (maxLength != minLength) { length = length + random.nextInt(maxLength - minLength); } while (length > 0) { if (sb.length() != 0) { sb.append(" "); length--; } final double desiredWordLengthNormalDistributed = 1.0 + Math.abs(random.nextGaussian()) * 6; int usedWordLength = (int) (Math.min(length, desiredWordLengthNormalDistributed)); String word = getRandomWord(usedWordLength); sb.append(word); length = length - word.length(); } return sb.toString(); }
java
public String getRandomText(final int minLength, final int maxLength) { validateMinMaxParams(minLength, maxLength); StringBuilder sb = new StringBuilder(maxLength); int length = minLength; if (maxLength != minLength) { length = length + random.nextInt(maxLength - minLength); } while (length > 0) { if (sb.length() != 0) { sb.append(" "); length--; } final double desiredWordLengthNormalDistributed = 1.0 + Math.abs(random.nextGaussian()) * 6; int usedWordLength = (int) (Math.min(length, desiredWordLengthNormalDistributed)); String word = getRandomWord(usedWordLength); sb.append(word); length = length - word.length(); } return sb.toString(); }
[ "public", "String", "getRandomText", "(", "final", "int", "minLength", ",", "final", "int", "maxLength", ")", "{", "validateMinMaxParams", "(", "minLength", ",", "maxLength", ")", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "maxLength", ")", ...
Returns random text made up of english words @param minLength minimum length of returned string @param maxLength maximum length of returned string @return string of length between min and max length
[ "Returns", "random", "text", "made", "up", "of", "english", "words" ]
train
https://github.com/andygibson/datafactory/blob/f748beb93844dea2ad6174715be3b70df0448a9c/src/main/java/org/fluttercode/datafactory/impl/DataFactory.java#L401-L422
looly/hutool
hutool-db/src/main/java/cn/hutool/db/StatementUtil.java
StatementUtil.prepareStatementForBatch
public static PreparedStatement prepareStatementForBatch(Connection conn, String sql, Object[]... paramsBatch) throws SQLException { return prepareStatementForBatch(conn, sql, new ArrayIter<Object[]>(paramsBatch)); }
java
public static PreparedStatement prepareStatementForBatch(Connection conn, String sql, Object[]... paramsBatch) throws SQLException { return prepareStatementForBatch(conn, sql, new ArrayIter<Object[]>(paramsBatch)); }
[ "public", "static", "PreparedStatement", "prepareStatementForBatch", "(", "Connection", "conn", ",", "String", "sql", ",", "Object", "[", "]", "...", "paramsBatch", ")", "throws", "SQLException", "{", "return", "prepareStatementForBatch", "(", "conn", ",", "sql", ...
创建批量操作的{@link PreparedStatement} @param conn 数据库连接 @param sql SQL语句,使用"?"做为占位符 @param paramsBatch "?"对应参数批次列表 @return {@link PreparedStatement} @throws SQLException SQL异常 @since 4.1.13
[ "创建批量操作的", "{", "@link", "PreparedStatement", "}" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/StatementUtil.java#L163-L165
BranchMetrics/android-branch-deep-linking
Branch-SDK/src/io/branch/referral/ExtendedAnswerProvider.java
ExtendedAnswerProvider.addJsonArrayToKitEvent
private void addJsonArrayToKitEvent(KitEvent kitEvent, JSONArray jsonArray, String keyPathPrepend) throws JSONException { for (int i = 0; i < jsonArray.length(); i++) { addBranchAttributes(kitEvent, keyPathPrepend, CTRL_PARAM_NOTATION + Integer.toString(i), jsonArray.getString(i)); } }
java
private void addJsonArrayToKitEvent(KitEvent kitEvent, JSONArray jsonArray, String keyPathPrepend) throws JSONException { for (int i = 0; i < jsonArray.length(); i++) { addBranchAttributes(kitEvent, keyPathPrepend, CTRL_PARAM_NOTATION + Integer.toString(i), jsonArray.getString(i)); } }
[ "private", "void", "addJsonArrayToKitEvent", "(", "KitEvent", "kitEvent", ",", "JSONArray", "jsonArray", ",", "String", "keyPathPrepend", ")", "throws", "JSONException", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "jsonArray", ".", "length", "(", "...
<p> Converts the given JsonArray to key-value pairs and update the {@link KitEvent} </p> @param kitEvent {@link KitEvent} to update with key-value pairs from the JsonArray @param jsonArray {@link JSONArray} to add to the {@link KitEvent} @param keyPathPrepend {@link String} with value to prepend to the keys adding to the {@link KitEvent} @throws JSONException {@link JSONException} on any Json converting errors
[ "<p", ">", "Converts", "the", "given", "JsonArray", "to", "key", "-", "value", "pairs", "and", "update", "the", "{", "@link", "KitEvent", "}", "<", "/", "p", ">" ]
train
https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/ExtendedAnswerProvider.java#L91-L95
jvirtanen/config-extras
src/main/java/org/jvirtanen/config/Configs.java
Configs.getInetAddress
public static InetAddress getInetAddress(Config config, String path) { try { return InetAddress.getByName(config.getString(path)); } catch (UnknownHostException e) { throw badValue(e, config, path); } }
java
public static InetAddress getInetAddress(Config config, String path) { try { return InetAddress.getByName(config.getString(path)); } catch (UnknownHostException e) { throw badValue(e, config, path); } }
[ "public", "static", "InetAddress", "getInetAddress", "(", "Config", "config", ",", "String", "path", ")", "{", "try", "{", "return", "InetAddress", ".", "getByName", "(", "config", ".", "getString", "(", "path", ")", ")", ";", "}", "catch", "(", "UnknownHo...
Get an IP address. The configuration value can either be a hostname or a literal IP address. @param config a configuration object @param path the path expression @return an IP address @throws ConfigException.Missing if the value is absent or null @throws ConfigException.WrongType if the value is not convertible to a string @throws ConfigException.BadValue if the value cannot be translated into an IP address
[ "Get", "an", "IP", "address", ".", "The", "configuration", "value", "can", "either", "be", "a", "hostname", "or", "a", "literal", "IP", "address", "." ]
train
https://github.com/jvirtanen/config-extras/blob/eba3cff680c302fe07625dc8046f0bd4a56b9fc3/src/main/java/org/jvirtanen/config/Configs.java#L32-L38
erlang/otp
lib/jinterface/java_src/com/ericsson/otp/erlang/OtpLocalNode.java
OtpLocalNode.createRef
public synchronized OtpErlangRef createRef() { final OtpErlangRef r = new OtpErlangRef(node, refId, creation); // increment ref ids (3 ints: 18 + 32 + 32 bits) refId[0]++; if (refId[0] > 0x3ffff) { refId[0] = 0; refId[1]++; if (refId[1] == 0) { refId[2]++; } } return r; }
java
public synchronized OtpErlangRef createRef() { final OtpErlangRef r = new OtpErlangRef(node, refId, creation); // increment ref ids (3 ints: 18 + 32 + 32 bits) refId[0]++; if (refId[0] > 0x3ffff) { refId[0] = 0; refId[1]++; if (refId[1] == 0) { refId[2]++; } } return r; }
[ "public", "synchronized", "OtpErlangRef", "createRef", "(", ")", "{", "final", "OtpErlangRef", "r", "=", "new", "OtpErlangRef", "(", "node", ",", "refId", ",", "creation", ")", ";", "// increment ref ids (3 ints: 18 + 32 + 32 bits)", "refId", "[", "0", "]", "++", ...
Create an Erlang {@link OtpErlangRef reference}. Erlang references are based upon some node specific information; this method creates a reference using the information in this node. Each call to this method produces a unique reference. @return an Erlang reference.
[ "Create", "an", "Erlang", "{", "@link", "OtpErlangRef", "reference", "}", ".", "Erlang", "references", "are", "based", "upon", "some", "node", "specific", "information", ";", "this", "method", "creates", "a", "reference", "using", "the", "information", "in", "...
train
https://github.com/erlang/otp/blob/ac6084fd83240355f72e94adbf303e57832d1fab/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpLocalNode.java#L160-L175
redkale/redkale
src/org/redkale/net/http/HttpRequest.java
HttpRequest.getCookie
public String getCookie(String name, String dfvalue) { for (HttpCookie c : getCookies()) { if (name.equals(c.getName())) return c.getValue(); } return dfvalue; }
java
public String getCookie(String name, String dfvalue) { for (HttpCookie c : getCookies()) { if (name.equals(c.getName())) return c.getValue(); } return dfvalue; }
[ "public", "String", "getCookie", "(", "String", "name", ",", "String", "dfvalue", ")", "{", "for", "(", "HttpCookie", "c", ":", "getCookies", "(", ")", ")", "{", "if", "(", "name", ".", "equals", "(", "c", ".", "getName", "(", ")", ")", ")", "retur...
获取Cookie值, 没有返回默认值 @param name cookie名 @param dfvalue 默认cookie值 @return cookie值
[ "获取Cookie值,", "没有返回默认值" ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/net/http/HttpRequest.java#L530-L535
Jasig/spring-portlet-contrib
spring-webmvc-portlet-contrib/src/main/java/org/jasig/springframework/web/portlet/filter/GenericPortletFilterBean.java
GenericPortletFilterBean.doCommonFilter
protected void doCommonFilter(PortletRequest request, PortletResponse response, FilterChain chain) throws IOException, PortletException { PortletFilterUtils.doFilter(request, response, chain); }
java
protected void doCommonFilter(PortletRequest request, PortletResponse response, FilterChain chain) throws IOException, PortletException { PortletFilterUtils.doFilter(request, response, chain); }
[ "protected", "void", "doCommonFilter", "(", "PortletRequest", "request", ",", "PortletResponse", "response", ",", "FilterChain", "chain", ")", "throws", "IOException", ",", "PortletException", "{", "PortletFilterUtils", ".", "doFilter", "(", "request", ",", "response"...
Can be implemented by subclasses to provide filter handling common to all request types. Default implementation just uses {@link org.jasig.springframework.web.portlet.filter.PortletFilterUtils#doFilter(PortletRequest, PortletResponse, FilterChain)} @param request a {@link javax.portlet.PortletRequest} object. @param response a {@link javax.portlet.PortletResponse} object. @param chain a {@link javax.portlet.filter.FilterChain} object. @throws java.io.IOException if any. @throws javax.portlet.PortletException if any.
[ "Can", "be", "implemented", "by", "subclasses", "to", "provide", "filter", "handling", "common", "to", "all", "request", "types", ".", "Default", "implementation", "just", "uses", "{", "@link", "org", ".", "jasig", ".", "springframework", ".", "web", ".", "p...
train
https://github.com/Jasig/spring-portlet-contrib/blob/719240fa268ddc69900ce9775d9cad3b9c543c6b/spring-webmvc-portlet-contrib/src/main/java/org/jasig/springframework/web/portlet/filter/GenericPortletFilterBean.java#L357-L359
alkacon/opencms-core
src-modules/org/opencms/workplace/list/CmsListMetadata.java
CmsListMetadata.addColumn
public void addColumn(CmsListColumnDefinition listColumn, int position) { setListIdForColumn(listColumn); if (m_columns.elementList().isEmpty()) { listColumn.setPrintable(true); } else { listColumn.setPrintable(listColumn.isSorteable()); } if ((listColumn.getName() == null) && listColumn.isPrintable()) { listColumn.setPrintable(false); } m_columns.addIdentifiableObject(listColumn.getId(), listColumn, position); }
java
public void addColumn(CmsListColumnDefinition listColumn, int position) { setListIdForColumn(listColumn); if (m_columns.elementList().isEmpty()) { listColumn.setPrintable(true); } else { listColumn.setPrintable(listColumn.isSorteable()); } if ((listColumn.getName() == null) && listColumn.isPrintable()) { listColumn.setPrintable(false); } m_columns.addIdentifiableObject(listColumn.getId(), listColumn, position); }
[ "public", "void", "addColumn", "(", "CmsListColumnDefinition", "listColumn", ",", "int", "position", ")", "{", "setListIdForColumn", "(", "listColumn", ")", ";", "if", "(", "m_columns", ".", "elementList", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "listC...
Adds a new column definition at the given position.<p> By default a column is printable if it is the first column in the list, or if it is sorteable.<p> If you want to override this behaviour, use the {@link CmsListColumnDefinition#setPrintable(boolean)} method after calling this one. @param listColumn the column definition @param position the position @see CmsIdentifiableObjectContainer
[ "Adds", "a", "new", "column", "definition", "at", "the", "given", "position", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/list/CmsListMetadata.java#L152-L164
fuinorg/utils4j
src/main/java/org/fuin/utils4j/Utils4J.java
Utils4J.createHash
public static String createHash(final InputStream inputStream, final String algorithm) { checkNotNull("inputStream", inputStream); checkNotNull("algorithm", algorithm); try { final MessageDigest messageDigest = MessageDigest.getInstance(algorithm); try (final BufferedInputStream in = new BufferedInputStream(inputStream)) { final byte[] buf = new byte[1024]; int count = 0; while ((count = in.read(buf)) > -1) { messageDigest.update(buf, 0, count); } } return encodeHex(messageDigest.digest()); } catch (final NoSuchAlgorithmException | IOException ex) { throw new RuntimeException(ex); } }
java
public static String createHash(final InputStream inputStream, final String algorithm) { checkNotNull("inputStream", inputStream); checkNotNull("algorithm", algorithm); try { final MessageDigest messageDigest = MessageDigest.getInstance(algorithm); try (final BufferedInputStream in = new BufferedInputStream(inputStream)) { final byte[] buf = new byte[1024]; int count = 0; while ((count = in.read(buf)) > -1) { messageDigest.update(buf, 0, count); } } return encodeHex(messageDigest.digest()); } catch (final NoSuchAlgorithmException | IOException ex) { throw new RuntimeException(ex); } }
[ "public", "static", "String", "createHash", "(", "final", "InputStream", "inputStream", ",", "final", "String", "algorithm", ")", "{", "checkNotNull", "(", "\"inputStream\"", ",", "inputStream", ")", ";", "checkNotNull", "(", "\"algorithm\"", ",", "algorithm", ")"...
Creates a HEX encoded hash from a stream. @param inputStream Stream to create a hash for - Cannot be <code>null</code>. @param algorithm Hash algorithm like "MD5" or "SHA" - Cannot be <code>null</code>. @return HEX encoded hash.
[ "Creates", "a", "HEX", "encoded", "hash", "from", "a", "stream", "." ]
train
https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/Utils4J.java#L346-L362
threerings/nenya
core/src/main/java/com/threerings/miso/client/MisoScenePanel.java
MisoScenePanel.getHitObjects
protected void getHitObjects (DirtyItemList list, int x, int y) { for (SceneObject scobj : _vizobjs) { Rectangle pbounds = scobj.bounds; if (!pbounds.contains(x, y)) { continue; } // see if we should skip it if (skipHitObject(scobj)) { continue; } // now check that the pixel in the tile image is non-transparent at that point if (!scobj.tile.hitTest(x - pbounds.x, y - pbounds.y)) { continue; } // we've passed the test, add the object to the list list.appendDirtyObject(scobj); } }
java
protected void getHitObjects (DirtyItemList list, int x, int y) { for (SceneObject scobj : _vizobjs) { Rectangle pbounds = scobj.bounds; if (!pbounds.contains(x, y)) { continue; } // see if we should skip it if (skipHitObject(scobj)) { continue; } // now check that the pixel in the tile image is non-transparent at that point if (!scobj.tile.hitTest(x - pbounds.x, y - pbounds.y)) { continue; } // we've passed the test, add the object to the list list.appendDirtyObject(scobj); } }
[ "protected", "void", "getHitObjects", "(", "DirtyItemList", "list", ",", "int", "x", ",", "int", "y", ")", "{", "for", "(", "SceneObject", "scobj", ":", "_vizobjs", ")", "{", "Rectangle", "pbounds", "=", "scobj", ".", "bounds", ";", "if", "(", "!", "pb...
Adds to the supplied dirty item list, all of the object tiles that are hit by the specified point (meaning the point is contained within their bounds and intersects a non-transparent pixel in the actual object image.
[ "Adds", "to", "the", "supplied", "dirty", "item", "list", "all", "of", "the", "object", "tiles", "that", "are", "hit", "by", "the", "specified", "point", "(", "meaning", "the", "point", "is", "contained", "within", "their", "bounds", "and", "intersects", "...
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/MisoScenePanel.java#L1155-L1176
bazaarvoice/emodb
event/src/main/java/com/bazaarvoice/emodb/event/dedup/DedupQueue.java
DedupQueue.peekOrPoll
private boolean peekOrPoll(@Nullable Duration claimTtl, EventSink rawSink) { // If dedup activity is disabled then we're in the process of falling back to regular non-dedup'd channels. // Don't do anything that might move events around--we're likely racing a call to moveToRawChannel(). if (!_dedupEnabled.get()) { return false; } // When polling, protect from bad pollers that never ack. if (claimTtl != null && _eventStore.getClaimCount(_readChannel) >= Limits.MAX_CLAIMS_OUTSTANDING) { return false; } TrackingEventSink sink = new TrackingEventSink(rawSink); // There are three places in which to look for events: // 1. Read channel // 2. Persistent sorted queue // 3. Write channel // This code is designed to, in the *common* case, poll only one of those sources. As things transition // between the following 3 phases it will occasionally poll multiple sources, but hopefully a server will // spend most of its time in one particular phase, resulting in efficient polling overall. // Phase 1: Try to keep the read channel empty. Start by draining the read channel of un-acked events. // Phase 2: When readers are slower than writers, events build up in the sorted queue. Source from the sorted queue. // Phase 3: When readers are faster than writers, the sorted queue isn't useful. Source directly from the write channel. // The read channel only contains unclaimed events when (a) claims have expired because something has gone // wrong (crash, restart, timeout, etc.) or (b) polling the sorted queue or write channel pulled more items // than the sink would accept and we had to write the overflow to the read channel. Neither is the common // case, so rely on the DefaultEventStore "empty channel" cache to rate limit actual reads to one-per-second. boolean moreRead = peekOrPollReadChannel(claimTtl, sink); if (sink.isDone()) { return moreRead || !getQueue().isEmpty() || !isWriteChannelEmpty(); } // Do NOT dedup events in-memory between the read channel and the other sources. Once an event makes it to // the read channel we can't dedup it with anything else. That lets us support the following sequence: // 1. process A adds EventX // 2. process B polls EventX and begins working on it // 3. process A makes a change and adds EventX to be re-evaluated // 4. process B acks EventX // The event added in step 3 must be kept separate from the event added in step 1 so it doesn't get acked // in step 4. Essentially, once a poller starts working on an event (indicated by its presence in the read // channel) we can't dedup/consolidate that event with any other events. Set<ByteBuffer> unique = Sets.newHashSet(); // Search for events in the write channel, copying them to the sorted queue or, under certain circumstances, // copying them directly to the read channel before returning. boolean moreWrite = peekOrPollWriteChannel(claimTtl, sink, unique); if (moreWrite) { // There are more unconsumed write channel events. Move them asynchronously to the sorted queue. _asyncFiller.start(); } // Search for events in the sorted queue, copying them to the read channel before returning. boolean moreSorted = peekOrPollSortedQueue(claimTtl, sink, unique); return moreWrite || moreSorted; }
java
private boolean peekOrPoll(@Nullable Duration claimTtl, EventSink rawSink) { // If dedup activity is disabled then we're in the process of falling back to regular non-dedup'd channels. // Don't do anything that might move events around--we're likely racing a call to moveToRawChannel(). if (!_dedupEnabled.get()) { return false; } // When polling, protect from bad pollers that never ack. if (claimTtl != null && _eventStore.getClaimCount(_readChannel) >= Limits.MAX_CLAIMS_OUTSTANDING) { return false; } TrackingEventSink sink = new TrackingEventSink(rawSink); // There are three places in which to look for events: // 1. Read channel // 2. Persistent sorted queue // 3. Write channel // This code is designed to, in the *common* case, poll only one of those sources. As things transition // between the following 3 phases it will occasionally poll multiple sources, but hopefully a server will // spend most of its time in one particular phase, resulting in efficient polling overall. // Phase 1: Try to keep the read channel empty. Start by draining the read channel of un-acked events. // Phase 2: When readers are slower than writers, events build up in the sorted queue. Source from the sorted queue. // Phase 3: When readers are faster than writers, the sorted queue isn't useful. Source directly from the write channel. // The read channel only contains unclaimed events when (a) claims have expired because something has gone // wrong (crash, restart, timeout, etc.) or (b) polling the sorted queue or write channel pulled more items // than the sink would accept and we had to write the overflow to the read channel. Neither is the common // case, so rely on the DefaultEventStore "empty channel" cache to rate limit actual reads to one-per-second. boolean moreRead = peekOrPollReadChannel(claimTtl, sink); if (sink.isDone()) { return moreRead || !getQueue().isEmpty() || !isWriteChannelEmpty(); } // Do NOT dedup events in-memory between the read channel and the other sources. Once an event makes it to // the read channel we can't dedup it with anything else. That lets us support the following sequence: // 1. process A adds EventX // 2. process B polls EventX and begins working on it // 3. process A makes a change and adds EventX to be re-evaluated // 4. process B acks EventX // The event added in step 3 must be kept separate from the event added in step 1 so it doesn't get acked // in step 4. Essentially, once a poller starts working on an event (indicated by its presence in the read // channel) we can't dedup/consolidate that event with any other events. Set<ByteBuffer> unique = Sets.newHashSet(); // Search for events in the write channel, copying them to the sorted queue or, under certain circumstances, // copying them directly to the read channel before returning. boolean moreWrite = peekOrPollWriteChannel(claimTtl, sink, unique); if (moreWrite) { // There are more unconsumed write channel events. Move them asynchronously to the sorted queue. _asyncFiller.start(); } // Search for events in the sorted queue, copying them to the read channel before returning. boolean moreSorted = peekOrPollSortedQueue(claimTtl, sink, unique); return moreWrite || moreSorted; }
[ "private", "boolean", "peekOrPoll", "(", "@", "Nullable", "Duration", "claimTtl", ",", "EventSink", "rawSink", ")", "{", "// If dedup activity is disabled then we're in the process of falling back to regular non-dedup'd channels.", "// Don't do anything that might move events around--we'...
Implements peek() or poll() based on whether claimTtl is null or non-null.
[ "Implements", "peek", "()", "or", "poll", "()", "based", "on", "whether", "claimTtl", "is", "null", "or", "non", "-", "null", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/event/src/main/java/com/bazaarvoice/emodb/event/dedup/DedupQueue.java#L153-L210
fedups/com.obdobion.argument
src/main/java/com/obdobion/argument/input/NamespaceParser.java
NamespaceParser.unparseTokens
static public void unparseTokens(final String prefix, final List<ICmdLineArg<?>> args, final StringBuilder out) { final Iterator<ICmdLineArg<?>> aIter = args.iterator(); while (aIter.hasNext()) { final ICmdLineArg<?> arg = aIter.next(); if (arg.isParsed()) arg.exportNamespace(prefix, out); } }
java
static public void unparseTokens(final String prefix, final List<ICmdLineArg<?>> args, final StringBuilder out) { final Iterator<ICmdLineArg<?>> aIter = args.iterator(); while (aIter.hasNext()) { final ICmdLineArg<?> arg = aIter.next(); if (arg.isParsed()) arg.exportNamespace(prefix, out); } }
[ "static", "public", "void", "unparseTokens", "(", "final", "String", "prefix", ",", "final", "List", "<", "ICmdLineArg", "<", "?", ">", ">", "args", ",", "final", "StringBuilder", "out", ")", "{", "final", "Iterator", "<", "ICmdLineArg", "<", "?", ">", "...
<p> unparseTokens. </p> @param prefix a {@link java.lang.String} object. @param args a {@link java.util.List} object. @param out a {@link java.lang.StringBuilder} object.
[ "<p", ">", "unparseTokens", ".", "<", "/", "p", ">" ]
train
https://github.com/fedups/com.obdobion.argument/blob/9679aebbeedaef4e592227842fa0e91410708a67/src/main/java/com/obdobion/argument/input/NamespaceParser.java#L151-L160
dfoerderreuther/console-builder
console-builder/src/main/java/de/eleon/console/builder/AskBuilder.java
AskBuilder.answer
public <T extends Enum<T>> T answer(final Class<T> enumClass) { return answer(enumClass, "unknown value"); }
java
public <T extends Enum<T>> T answer(final Class<T> enumClass) { return answer(enumClass, "unknown value"); }
[ "public", "<", "T", "extends", "Enum", "<", "T", ">", ">", "T", "answer", "(", "final", "Class", "<", "T", ">", "enumClass", ")", "{", "return", "answer", "(", "enumClass", ",", "\"unknown value\"", ")", ";", "}" ]
Return user input as T extends Enum<T>. Complete with enum values. @param enumClass Class of enum to return @param <T> the return type @return user input as enum value
[ "Return", "user", "input", "as", "T", "extends", "Enum<T", ">", ".", "Complete", "with", "enum", "values", "." ]
train
https://github.com/dfoerderreuther/console-builder/blob/814bee4a1a812a3a39a9b239e5eccb525b944e65/console-builder/src/main/java/de/eleon/console/builder/AskBuilder.java#L147-L149
Ordinastie/MalisisCore
src/main/java/net/malisis/core/util/callback/CallbackRegistry.java
CallbackRegistry.registerCallback
public void registerCallback(C callback, CallbackOption<P> option) { callbacks.add(Pair.of(callback, option)); callbacks = Ordering.natural() .reverse() .onResultOf(Priority::ordinal) .onResultOf(CallbackOption<P>::getPriority) .onResultOf(Pair<C, CallbackOption<P>>::getRight) .sortedCopy(callbacks); }
java
public void registerCallback(C callback, CallbackOption<P> option) { callbacks.add(Pair.of(callback, option)); callbacks = Ordering.natural() .reverse() .onResultOf(Priority::ordinal) .onResultOf(CallbackOption<P>::getPriority) .onResultOf(Pair<C, CallbackOption<P>>::getRight) .sortedCopy(callbacks); }
[ "public", "void", "registerCallback", "(", "C", "callback", ",", "CallbackOption", "<", "P", ">", "option", ")", "{", "callbacks", ".", "add", "(", "Pair", ".", "of", "(", "callback", ",", "option", ")", ")", ";", "callbacks", "=", "Ordering", ".", "na...
Registers a {@link ICallback} to be call when the {@link ICallbackPredicate} returns true. @param callback the callback @param option the option
[ "Registers", "a", "{", "@link", "ICallback", "}", "to", "be", "call", "when", "the", "{", "@link", "ICallbackPredicate", "}", "returns", "true", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/callback/CallbackRegistry.java#L76-L85
projectodd/stilts
stomp-server-core/src/main/java/org/projectodd/stilts/stomp/server/protocol/websockets/ServerHandshakeHandler.java
ServerHandshakeHandler.reconfigureUpstream
protected void reconfigureUpstream(ChannelPipeline pipeline, Handshake handshake) { pipeline.replace( "http-decoder", "websockets-decoder", handshake.newDecoder() ); ChannelHandler[] additionalHandlers = handshake.newAdditionalHandlers(); String currentTail = "websockets-decoder"; for (ChannelHandler each : additionalHandlers) { String handlerName = "additional-" + each.getClass().getSimpleName(); pipeline.addAfter( currentTail, handlerName, each ); currentTail = handlerName; } }
java
protected void reconfigureUpstream(ChannelPipeline pipeline, Handshake handshake) { pipeline.replace( "http-decoder", "websockets-decoder", handshake.newDecoder() ); ChannelHandler[] additionalHandlers = handshake.newAdditionalHandlers(); String currentTail = "websockets-decoder"; for (ChannelHandler each : additionalHandlers) { String handlerName = "additional-" + each.getClass().getSimpleName(); pipeline.addAfter( currentTail, handlerName, each ); currentTail = handlerName; } }
[ "protected", "void", "reconfigureUpstream", "(", "ChannelPipeline", "pipeline", ",", "Handshake", "handshake", ")", "{", "pipeline", ".", "replace", "(", "\"http-decoder\"", ",", "\"websockets-decoder\"", ",", "handshake", ".", "newDecoder", "(", ")", ")", ";", "C...
Remove HTTP handlers, replace with web-socket handlers. @param pipeline The pipeline to reconfigure.
[ "Remove", "HTTP", "handlers", "replace", "with", "web", "-", "socket", "handlers", "." ]
train
https://github.com/projectodd/stilts/blob/6ba81d4162325b98f591c206520476cf575d0567/stomp-server-core/src/main/java/org/projectodd/stilts/stomp/server/protocol/websockets/ServerHandshakeHandler.java#L198-L207
james-hu/jabb-core
src/main/java/net/sf/jabb/util/db/ColumnMetaData.java
ColumnMetaData.createList
static public List<ColumnMetaData> createList(ResultSetMetaData m) throws SQLException{ List<ColumnMetaData> result = new ArrayList<ColumnMetaData>(m.getColumnCount()); for (int i = 1; i <= m.getColumnCount(); i ++){ ColumnMetaData cm = new ColumnMetaData(m, i); result.add(cm); } return result; }
java
static public List<ColumnMetaData> createList(ResultSetMetaData m) throws SQLException{ List<ColumnMetaData> result = new ArrayList<ColumnMetaData>(m.getColumnCount()); for (int i = 1; i <= m.getColumnCount(); i ++){ ColumnMetaData cm = new ColumnMetaData(m, i); result.add(cm); } return result; }
[ "static", "public", "List", "<", "ColumnMetaData", ">", "createList", "(", "ResultSetMetaData", "m", ")", "throws", "SQLException", "{", "List", "<", "ColumnMetaData", ">", "result", "=", "new", "ArrayList", "<", "ColumnMetaData", ">", "(", "m", ".", "getColum...
Get all the column meta data and put them into a list in their default order @param m the result set meta data @return a list of column meta data @throws SQLException
[ "Get", "all", "the", "column", "meta", "data", "and", "put", "them", "into", "a", "list", "in", "their", "default", "order" ]
train
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/db/ColumnMetaData.java#L100-L107
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientPropertyData.java
TransientPropertyData.createPropertyData
public static TransientPropertyData createPropertyData(NodeData parent, InternalQName name, int type, boolean multiValued) { QPath path = QPath.makeChildPath(parent.getQPath(), name); TransientPropertyData propData = new TransientPropertyData(path, IdGenerator.generate(), -1, type, parent.getIdentifier(), multiValued); return propData; }
java
public static TransientPropertyData createPropertyData(NodeData parent, InternalQName name, int type, boolean multiValued) { QPath path = QPath.makeChildPath(parent.getQPath(), name); TransientPropertyData propData = new TransientPropertyData(path, IdGenerator.generate(), -1, type, parent.getIdentifier(), multiValued); return propData; }
[ "public", "static", "TransientPropertyData", "createPropertyData", "(", "NodeData", "parent", ",", "InternalQName", "name", ",", "int", "type", ",", "boolean", "multiValued", ")", "{", "QPath", "path", "=", "QPath", ".", "makeChildPath", "(", "parent", ".", "get...
Factory method. @param parent NodeData @param name InternalQName @param type int @param multiValued boolean @return TransientPropertyData
[ "Factory", "method", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/TransientPropertyData.java#L152-L160
groovy/groovy-core
src/main/org/codehaus/groovy/ast/CompileUnit.java
CompileUnit.addClassNodeToCompile
public void addClassNodeToCompile(ClassNode node, SourceUnit location) { classesToCompile.put(node.getName(), node); classNameToSource.put(node.getName(), location); }
java
public void addClassNodeToCompile(ClassNode node, SourceUnit location) { classesToCompile.put(node.getName(), node); classNameToSource.put(node.getName(), location); }
[ "public", "void", "addClassNodeToCompile", "(", "ClassNode", "node", ",", "SourceUnit", "location", ")", "{", "classesToCompile", ".", "put", "(", "node", ".", "getName", "(", ")", ",", "node", ")", ";", "classNameToSource", ".", "put", "(", "node", ".", "...
this method actually does not compile a class. It's only a marker that this type has to be compiled by the CompilationUnit at the end of a parse step no node should be be left.
[ "this", "method", "actually", "does", "not", "compile", "a", "class", ".", "It", "s", "only", "a", "marker", "that", "this", "type", "has", "to", "be", "compiled", "by", "the", "CompilationUnit", "at", "the", "end", "of", "a", "parse", "step", "no", "n...
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/ast/CompileUnit.java#L166-L169
ziccardi/jnrpe
jnrpe-plugins/src/main/java/it/jnrpe/plugin/utils/HttpUtils.java
HttpUtils.setRequestProperties
public static void setRequestProperties(final Properties props, HttpURLConnection conn, Integer timeout) { if (props != null) { if (props.get("User-Agent") == null) { conn.setRequestProperty("User-Agent", "Java"); } for (Entry entry : props.entrySet()) { conn.setRequestProperty(String.valueOf(entry.getKey()), String.valueOf(entry.getValue())); } } if (timeout != null) { conn.setConnectTimeout(timeout * 1000); } }
java
public static void setRequestProperties(final Properties props, HttpURLConnection conn, Integer timeout) { if (props != null) { if (props.get("User-Agent") == null) { conn.setRequestProperty("User-Agent", "Java"); } for (Entry entry : props.entrySet()) { conn.setRequestProperty(String.valueOf(entry.getKey()), String.valueOf(entry.getValue())); } } if (timeout != null) { conn.setConnectTimeout(timeout * 1000); } }
[ "public", "static", "void", "setRequestProperties", "(", "final", "Properties", "props", ",", "HttpURLConnection", "conn", ",", "Integer", "timeout", ")", "{", "if", "(", "props", "!=", "null", ")", "{", "if", "(", "props", ".", "get", "(", "\"User-Agent\"",...
Sets request headers for an http connection @param props properties to be sent @param conn the connection @param timeout the connection timeout
[ "Sets", "request", "headers", "for", "an", "http", "connection" ]
train
https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-plugins/src/main/java/it/jnrpe/plugin/utils/HttpUtils.java#L137-L152
kiegroup/drools
kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/parser/feel11/FEELParser.java
FEELParser.isVariableNamePartValid
public static boolean isVariableNamePartValid( String namePart, Scope scope ) { if ( DIGITS_PATTERN.matcher(namePart).matches() ) { return true; } if ( REUSABLE_KEYWORDS.contains(namePart) ) { return scope.followUp(namePart, true); } return isVariableNameValid(namePart); }
java
public static boolean isVariableNamePartValid( String namePart, Scope scope ) { if ( DIGITS_PATTERN.matcher(namePart).matches() ) { return true; } if ( REUSABLE_KEYWORDS.contains(namePart) ) { return scope.followUp(namePart, true); } return isVariableNameValid(namePart); }
[ "public", "static", "boolean", "isVariableNamePartValid", "(", "String", "namePart", ",", "Scope", "scope", ")", "{", "if", "(", "DIGITS_PATTERN", ".", "matcher", "(", "namePart", ")", ".", "matches", "(", ")", ")", "{", "return", "true", ";", "}", "if", ...
Either namePart is a string of digits, or it must be a valid name itself
[ "Either", "namePart", "is", "a", "string", "of", "digits", "or", "it", "must", "be", "a", "valid", "name", "itself" ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/parser/feel11/FEELParser.java#L82-L90
gallandarakhneorg/afc
advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/attr/DBaseFileAttributePool.java
DBaseFileAttributePool.getRawValue
@SuppressWarnings("resource") @Pure public Object getRawValue(int recordNumber, String name, OutputParameter<AttributeType> type) throws AttributeException { try { final DBaseFileReader dbReader = getReader(); synchronized (dbReader) { dbReader.seek(recordNumber); final DBaseFileRecord record = dbReader.readNextDBFRecord(); if (record != null) { final int column = dbReader.getDBFFieldIndex(name); if (column >= 0) { final Object value = record.getFieldValue(column); final DBaseFieldType dbfType = dbReader.getDBFFieldType(column); type.set(dbfType.toAttributeType()); return value; } } throw new NoAttributeFoundException(name); } } catch (IOException e) { throw new AttributeException(e); } }
java
@SuppressWarnings("resource") @Pure public Object getRawValue(int recordNumber, String name, OutputParameter<AttributeType> type) throws AttributeException { try { final DBaseFileReader dbReader = getReader(); synchronized (dbReader) { dbReader.seek(recordNumber); final DBaseFileRecord record = dbReader.readNextDBFRecord(); if (record != null) { final int column = dbReader.getDBFFieldIndex(name); if (column >= 0) { final Object value = record.getFieldValue(column); final DBaseFieldType dbfType = dbReader.getDBFFieldType(column); type.set(dbfType.toAttributeType()); return value; } } throw new NoAttributeFoundException(name); } } catch (IOException e) { throw new AttributeException(e); } }
[ "@", "SuppressWarnings", "(", "\"resource\"", ")", "@", "Pure", "public", "Object", "getRawValue", "(", "int", "recordNumber", ",", "String", "name", ",", "OutputParameter", "<", "AttributeType", ">", "type", ")", "throws", "AttributeException", "{", "try", "{",...
Replies the raw value that corresponds to the specified attribute name for the given record. @param recordNumber is the index of the record to read ({@code 0..recordCount-1}). @param name is the name of the attribute value to replies. @param type is the type of the replied value. Tis attribute will be set by this function. @return the value extracted from the pool. @throws AttributeException if an attribute cannot be read.
[ "Replies", "the", "raw", "value", "that", "corresponds", "to", "the", "specified", "attribute", "name", "for", "the", "given", "record", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/attr/DBaseFileAttributePool.java#L416-L438
samskivert/samskivert
src/main/java/com/samskivert/servlet/util/ParameterUtil.java
ParameterUtil.getLongParameter
public static long getLongParameter ( HttpServletRequest req, String name, long defval, String invalidDataMessage) throws DataValidationException { String value = getParameter(req, name, false); if (StringUtil.isBlank(value)) { return defval; } return parseLongParameter(value, invalidDataMessage); }
java
public static long getLongParameter ( HttpServletRequest req, String name, long defval, String invalidDataMessage) throws DataValidationException { String value = getParameter(req, name, false); if (StringUtil.isBlank(value)) { return defval; } return parseLongParameter(value, invalidDataMessage); }
[ "public", "static", "long", "getLongParameter", "(", "HttpServletRequest", "req", ",", "String", "name", ",", "long", "defval", ",", "String", "invalidDataMessage", ")", "throws", "DataValidationException", "{", "String", "value", "=", "getParameter", "(", "req", ...
Fetches the supplied parameter from the request and converts it to a long. If the parameter does not exist, <code>defval</code> is returned. If the parameter is not a well-formed integer, a data validation exception is thrown with the supplied message.
[ "Fetches", "the", "supplied", "parameter", "from", "the", "request", "and", "converts", "it", "to", "a", "long", ".", "If", "the", "parameter", "does", "not", "exist", "<code", ">", "defval<", "/", "code", ">", "is", "returned", ".", "If", "the", "parame...
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/servlet/util/ParameterUtil.java#L189-L198
taimos/dvalin
jaxrs/src/main/java/de/taimos/dvalin/jaxrs/websocket/ServerJSONWebSocketAdapter.java
ServerJSONWebSocketAdapter.sendObjectToSocket
protected final void sendObjectToSocket(Object objectToSend, WriteCallback cb) { Session sess = this.getSession(); if (sess != null) { String json; try { json = this.mapper.writeValueAsString(objectToSend); } catch (JsonProcessingException e) { throw new RuntimeException("Failed to serialize object", e); } sess.getRemote().sendString(json, cb); } }
java
protected final void sendObjectToSocket(Object objectToSend, WriteCallback cb) { Session sess = this.getSession(); if (sess != null) { String json; try { json = this.mapper.writeValueAsString(objectToSend); } catch (JsonProcessingException e) { throw new RuntimeException("Failed to serialize object", e); } sess.getRemote().sendString(json, cb); } }
[ "protected", "final", "void", "sendObjectToSocket", "(", "Object", "objectToSend", ",", "WriteCallback", "cb", ")", "{", "Session", "sess", "=", "this", ".", "getSession", "(", ")", ";", "if", "(", "sess", "!=", "null", ")", "{", "String", "json", ";", "...
send object to client and serialize it using JSON @param objectToSend the object to send @param cb the callback after sending the message
[ "send", "object", "to", "client", "and", "serialize", "it", "using", "JSON" ]
train
https://github.com/taimos/dvalin/blob/ff8f1bf594e43d7e8ca8de0b4da9f923b66a1a47/jaxrs/src/main/java/de/taimos/dvalin/jaxrs/websocket/ServerJSONWebSocketAdapter.java#L133-L144
carewebframework/carewebframework-vista
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/DynamicByteBuffer.java
DynamicByteBuffer.put
public void put(byte[] bytes, int start, int end) { byte[] buffer = chunk(); for (int i = start; i < end; i++) { if (position == buffer.length) { buffer = alloc(); } buffer[position++] = bytes[i]; size++; } }
java
public void put(byte[] bytes, int start, int end) { byte[] buffer = chunk(); for (int i = start; i < end; i++) { if (position == buffer.length) { buffer = alloc(); } buffer[position++] = bytes[i]; size++; } }
[ "public", "void", "put", "(", "byte", "[", "]", "bytes", ",", "int", "start", ",", "int", "end", ")", "{", "byte", "[", "]", "buffer", "=", "chunk", "(", ")", ";", "for", "(", "int", "i", "=", "start", ";", "i", "<", "end", ";", "i", "++", ...
Writes a range of bytes from the specified array. @param bytes Array containing the bytes to be written. @param start Start of the range (inclusive). @param end End of the range (exclusive).
[ "Writes", "a", "range", "of", "bytes", "from", "the", "specified", "array", "." ]
train
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/DynamicByteBuffer.java#L172-L183
craftercms/deployer
src/main/java/org/craftercms/deployer/utils/GitUtils.java
GitUtils.addRemote
private static void addRemote(Git git, String remoteName, String remoteUrl) throws GitAPIException, URISyntaxException { String currentUrl = git.getRepository().getConfig().getString("remote", remoteName, "url"); if (StringUtils.isNotEmpty(currentUrl)) { if (!currentUrl.equals(remoteUrl)) { RemoteSetUrlCommand remoteSetUrl = git.remoteSetUrl(); remoteSetUrl.setName(remoteName); remoteSetUrl.setUri(new URIish(remoteUrl)); remoteSetUrl.call(); } } else { RemoteAddCommand remoteAdd = git.remoteAdd(); remoteAdd.setName(remoteName); remoteAdd.setUri(new URIish(remoteUrl)); remoteAdd.call(); } }
java
private static void addRemote(Git git, String remoteName, String remoteUrl) throws GitAPIException, URISyntaxException { String currentUrl = git.getRepository().getConfig().getString("remote", remoteName, "url"); if (StringUtils.isNotEmpty(currentUrl)) { if (!currentUrl.equals(remoteUrl)) { RemoteSetUrlCommand remoteSetUrl = git.remoteSetUrl(); remoteSetUrl.setName(remoteName); remoteSetUrl.setUri(new URIish(remoteUrl)); remoteSetUrl.call(); } } else { RemoteAddCommand remoteAdd = git.remoteAdd(); remoteAdd.setName(remoteName); remoteAdd.setUri(new URIish(remoteUrl)); remoteAdd.call(); } }
[ "private", "static", "void", "addRemote", "(", "Git", "git", ",", "String", "remoteName", ",", "String", "remoteUrl", ")", "throws", "GitAPIException", ",", "URISyntaxException", "{", "String", "currentUrl", "=", "git", ".", "getRepository", "(", ")", ".", "ge...
Adds a remote if it doesn't exist. If the remote exists but the URL is different, updates the URL @param git the Git repo @param remoteName the name oif the remote @param remoteUrl the URL of the remote @throws GitAPIException if a Git error occurs @throws URISyntaxException if the remote URL is an invalid Git URL
[ "Adds", "a", "remote", "if", "it", "doesn", "t", "exist", ".", "If", "the", "remote", "exists", "but", "the", "URL", "is", "different", "updates", "the", "URL" ]
train
https://github.com/craftercms/deployer/blob/3ed446e3cc8af1055de2de6f871907f90ef27f63/src/main/java/org/craftercms/deployer/utils/GitUtils.java#L204-L220
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java
FeatureOverlayQuery.buildMapClickTableDataWithMapBounds
public FeatureTableData buildMapClickTableDataWithMapBounds(LatLng latLng, double zoom, BoundingBox mapBounds, double tolerance) { return buildMapClickTableDataWithMapBounds(latLng, zoom, mapBounds, tolerance, null); }
java
public FeatureTableData buildMapClickTableDataWithMapBounds(LatLng latLng, double zoom, BoundingBox mapBounds, double tolerance) { return buildMapClickTableDataWithMapBounds(latLng, zoom, mapBounds, tolerance, null); }
[ "public", "FeatureTableData", "buildMapClickTableDataWithMapBounds", "(", "LatLng", "latLng", ",", "double", "zoom", ",", "BoundingBox", "mapBounds", ",", "double", "tolerance", ")", "{", "return", "buildMapClickTableDataWithMapBounds", "(", "latLng", ",", "zoom", ",", ...
Perform a query based upon the map click location and build feature table data @param latLng location @param zoom current zoom level @param mapBounds map view bounds @param tolerance distance tolerance @return table data on what was clicked, or null @since 2.0.0
[ "Perform", "a", "query", "based", "upon", "the", "map", "click", "location", "and", "build", "feature", "table", "data" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java#L501-L503
apache/reef
lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/uploader/JobUploader.java
JobUploader.createJobFolder
public JobFolder createJobFolder(final String finalJobFolderPath) throws IOException { LOG.log(Level.FINE, "Final job submission Directory: " + finalJobFolderPath); return new JobFolder(this.fileSystem, new Path(finalJobFolderPath)); }
java
public JobFolder createJobFolder(final String finalJobFolderPath) throws IOException { LOG.log(Level.FINE, "Final job submission Directory: " + finalJobFolderPath); return new JobFolder(this.fileSystem, new Path(finalJobFolderPath)); }
[ "public", "JobFolder", "createJobFolder", "(", "final", "String", "finalJobFolderPath", ")", "throws", "IOException", "{", "LOG", ".", "log", "(", "Level", ".", "FINE", ",", "\"Final job submission Directory: \"", "+", "finalJobFolderPath", ")", ";", "return", "new"...
Convenience override for int ids. @param finalJobFolderPath @return @throws IOException
[ "Convenience", "override", "for", "int", "ids", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-yarn/src/main/java/org/apache/reef/runtime/yarn/client/uploader/JobUploader.java#L69-L72
azkaban/azkaban
azkaban-common/src/main/java/azkaban/executor/FetchActiveFlowDao.java
FetchActiveFlowDao.fetchUnfinishedFlowsMetadata
public Map<Integer, Pair<ExecutionReference, ExecutableFlow>> fetchUnfinishedFlowsMetadata() throws ExecutorManagerException { try { return this.dbOperator.query(FetchUnfinishedFlowsMetadata.FETCH_UNFINISHED_FLOWS_METADATA, new FetchUnfinishedFlowsMetadata()); } catch (final SQLException e) { throw new ExecutorManagerException("Error fetching unfinished flows metadata", e); } }
java
public Map<Integer, Pair<ExecutionReference, ExecutableFlow>> fetchUnfinishedFlowsMetadata() throws ExecutorManagerException { try { return this.dbOperator.query(FetchUnfinishedFlowsMetadata.FETCH_UNFINISHED_FLOWS_METADATA, new FetchUnfinishedFlowsMetadata()); } catch (final SQLException e) { throw new ExecutorManagerException("Error fetching unfinished flows metadata", e); } }
[ "public", "Map", "<", "Integer", ",", "Pair", "<", "ExecutionReference", ",", "ExecutableFlow", ">", ">", "fetchUnfinishedFlowsMetadata", "(", ")", "throws", "ExecutorManagerException", "{", "try", "{", "return", "this", ".", "dbOperator", ".", "query", "(", "Fe...
Fetch unfinished flows similar to {@link #fetchUnfinishedFlows}, excluding flow data. @return unfinished flows map @throws ExecutorManagerException the executor manager exception
[ "Fetch", "unfinished", "flows", "similar", "to", "{", "@link", "#fetchUnfinishedFlows", "}", "excluding", "flow", "data", "." ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-common/src/main/java/azkaban/executor/FetchActiveFlowDao.java#L129-L137
jcuda/jcuda
JCudaJava/src/main/java/jcuda/runtime/JCuda.java
JCuda.cudaMemcpyPeer
public static int cudaMemcpyPeer(Pointer dst, int dstDevice, Pointer src, int srcDevice, long count) { return checkResult(cudaMemcpyPeerNative(dst, dstDevice, src, srcDevice, count)); }
java
public static int cudaMemcpyPeer(Pointer dst, int dstDevice, Pointer src, int srcDevice, long count) { return checkResult(cudaMemcpyPeerNative(dst, dstDevice, src, srcDevice, count)); }
[ "public", "static", "int", "cudaMemcpyPeer", "(", "Pointer", "dst", ",", "int", "dstDevice", ",", "Pointer", "src", ",", "int", "srcDevice", ",", "long", "count", ")", "{", "return", "checkResult", "(", "cudaMemcpyPeerNative", "(", "dst", ",", "dstDevice", "...
Copies memory between two devices. <pre> cudaError_t cudaMemcpyPeer ( void* dst, int dstDevice, const void* src, int srcDevice, size_t count ) </pre> <div> <p>Copies memory between two devices. Copies memory from one device to memory on another device. <tt>dst</tt> is the base device pointer of the destination memory and <tt>dstDevice</tt> is the destination device. <tt>src</tt> is the base device pointer of the source memory and <tt>srcDevice</tt> is the source device. <tt>count</tt> specifies the number of bytes to copy. </p> <p>Note that this function is asynchronous with respect to the host, but serialized with respect all pending and future asynchronous work in to the current device, <tt>srcDevice</tt>, and <tt>dstDevice</tt> (use cudaMemcpyPeerAsync to avoid this synchronization). </p> <div> <span>Note:</span> <ul> <li> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </li> <li> <p>This function exhibits synchronous behavior for most use cases. </p> </li> </ul> </div> </p> </div> @param dst Destination device pointer @param dstDevice Destination device @param src Source device pointer @param srcDevice Source device @param count Size of memory copy in bytes @return cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidDevice @see JCuda#cudaMemcpy @see JCuda#cudaMemcpyAsync @see JCuda#cudaMemcpyPeerAsync @see JCuda#cudaMemcpy3DPeerAsync
[ "Copies", "memory", "between", "two", "devices", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L4673-L4676
VoltDB/voltdb
third_party/java/src/org/apache/zookeeper_voltpatches/server/DataTree.java
DataTree.serializeNode
void serializeNode(OutputArchive oa, StringBuilder path) throws IOException { String pathString = path.toString(); DataNode node = getNode(pathString); if (node == null) { return; } String children[] = null; synchronized (node) { scount++; oa.writeString(pathString, "path"); oa.writeRecord(node, "node"); Set<String> childs = node.getChildren(); if (childs != null) { children = childs.toArray(new String[childs.size()]); } } path.append('/'); int off = path.length(); if (children != null) { for (String child : children) { // since this is single buffer being resused // we need // to truncate the previous bytes of string. path.delete(off, Integer.MAX_VALUE); path.append(child); serializeNode(oa, path); } } }
java
void serializeNode(OutputArchive oa, StringBuilder path) throws IOException { String pathString = path.toString(); DataNode node = getNode(pathString); if (node == null) { return; } String children[] = null; synchronized (node) { scount++; oa.writeString(pathString, "path"); oa.writeRecord(node, "node"); Set<String> childs = node.getChildren(); if (childs != null) { children = childs.toArray(new String[childs.size()]); } } path.append('/'); int off = path.length(); if (children != null) { for (String child : children) { // since this is single buffer being resused // we need // to truncate the previous bytes of string. path.delete(off, Integer.MAX_VALUE); path.append(child); serializeNode(oa, path); } } }
[ "void", "serializeNode", "(", "OutputArchive", "oa", ",", "StringBuilder", "path", ")", "throws", "IOException", "{", "String", "pathString", "=", "path", ".", "toString", "(", ")", ";", "DataNode", "node", "=", "getNode", "(", "pathString", ")", ";", "if", ...
this method uses a stringbuilder to create a new path for children. This is faster than string appends ( str1 + str2). @param oa OutputArchive to write to. @param path a string builder. @throws IOException @throws InterruptedException
[ "this", "method", "uses", "a", "stringbuilder", "to", "create", "a", "new", "path", "for", "children", ".", "This", "is", "faster", "than", "string", "appends", "(", "str1", "+", "str2", ")", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/zookeeper_voltpatches/server/DataTree.java#L962-L990
di2e/Argo
ProbeSender/src/main/java/ws/argo/probe/ProbeSenderFactory.java
ProbeSenderFactory.createSNSProbeSender
public static ProbeSender createSNSProbeSender(String ak, String sk) throws ProbeSenderException { Transport snsTransport = new AmazonSNSTransport(ak, sk); ProbeSender gen = new ProbeSender(snsTransport); return gen; }
java
public static ProbeSender createSNSProbeSender(String ak, String sk) throws ProbeSenderException { Transport snsTransport = new AmazonSNSTransport(ak, sk); ProbeSender gen = new ProbeSender(snsTransport); return gen; }
[ "public", "static", "ProbeSender", "createSNSProbeSender", "(", "String", "ak", ",", "String", "sk", ")", "throws", "ProbeSenderException", "{", "Transport", "snsTransport", "=", "new", "AmazonSNSTransport", "(", "ak", ",", "sk", ")", ";", "ProbeSender", "gen", ...
Create a AmazonSNS transport ProbeSender using the default values. @param ak the amazon access key @param sk the amazon secret key @return configured ProbeSender instance @throws ProbeSenderException if something went wrong
[ "Create", "a", "AmazonSNS", "transport", "ProbeSender", "using", "the", "default", "values", "." ]
train
https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/ProbeSender/src/main/java/ws/argo/probe/ProbeSenderFactory.java#L108-L112
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java
SimpleDocTreeVisitor.visitDeprecated
@Override public R visitDeprecated(DeprecatedTree node, P p) { return defaultAction(node, p); }
java
@Override public R visitDeprecated(DeprecatedTree node, P p) { return defaultAction(node, p); }
[ "@", "Override", "public", "R", "visitDeprecated", "(", "DeprecatedTree", "node", ",", "P", "p", ")", "{", "return", "defaultAction", "(", "node", ",", "p", ")", ";", "}" ]
{@inheritDoc} This implementation calls {@code defaultAction}. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of {@code defaultAction}
[ "{", "@inheritDoc", "}", "This", "implementation", "calls", "{", "@code", "defaultAction", "}", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/SimpleDocTreeVisitor.java#L141-L144
OpenTSDB/opentsdb
src/uid/UniqueId.java
UniqueId.suggestAsync
public Deferred<List<String>> suggestAsync(final String search, final int max_results) { return new SuggestCB(search, max_results).search(); }
java
public Deferred<List<String>> suggestAsync(final String search, final int max_results) { return new SuggestCB(search, max_results).search(); }
[ "public", "Deferred", "<", "List", "<", "String", ">", ">", "suggestAsync", "(", "final", "String", "search", ",", "final", "int", "max_results", ")", "{", "return", "new", "SuggestCB", "(", "search", ",", "max_results", ")", ".", "search", "(", ")", ";"...
Attempts to find suggestions of names given a search term. @param search The search term (possibly empty). @return A list of known valid names that have UIDs that sort of match the search term. If the search term is empty, returns the first few terms. @throws HBaseException if there was a problem getting suggestions from HBase. @since 1.1
[ "Attempts", "to", "find", "suggestions", "of", "names", "given", "a", "search", "term", "." ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/uid/UniqueId.java#L1014-L1017
aws/aws-sdk-java
aws-java-sdk-sqs/src/main/java/com/amazonaws/services/sqs/model/ListQueueTagsResult.java
ListQueueTagsResult.withTags
public ListQueueTagsResult withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
java
public ListQueueTagsResult withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "ListQueueTagsResult", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> The list of all tags added to the specified queue. </p> @param tags The list of all tags added to the specified queue. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "list", "of", "all", "tags", "added", "to", "the", "specified", "queue", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-sqs/src/main/java/com/amazonaws/services/sqs/model/ListQueueTagsResult.java#L71-L74
casbin/jcasbin
src/main/java/org/casbin/jcasbin/main/ManagementEnforcer.java
ManagementEnforcer.removeNamedGroupingPolicy
public boolean removeNamedGroupingPolicy(String ptype, List<String> params) { boolean ruleRemoved = removePolicy("g", ptype, params); if (autoBuildRoleLinks) { buildRoleLinks(); } return ruleRemoved; }
java
public boolean removeNamedGroupingPolicy(String ptype, List<String> params) { boolean ruleRemoved = removePolicy("g", ptype, params); if (autoBuildRoleLinks) { buildRoleLinks(); } return ruleRemoved; }
[ "public", "boolean", "removeNamedGroupingPolicy", "(", "String", "ptype", ",", "List", "<", "String", ">", "params", ")", "{", "boolean", "ruleRemoved", "=", "removePolicy", "(", "\"g\"", ",", "ptype", ",", "params", ")", ";", "if", "(", "autoBuildRoleLinks", ...
removeNamedGroupingPolicy removes a role inheritance rule from the current named policy. @param ptype the policy type, can be "g", "g2", "g3", .. @param params the "g" policy rule. @return succeeds or not.
[ "removeNamedGroupingPolicy", "removes", "a", "role", "inheritance", "rule", "from", "the", "current", "named", "policy", "." ]
train
https://github.com/casbin/jcasbin/blob/b46d7a756b6c39cdb17e0600607e5fcdc66edd11/src/main/java/org/casbin/jcasbin/main/ManagementEnforcer.java#L509-L516
NoraUi/NoraUi
src/main/java/com/github/noraui/application/steps/CommonSteps.java
CommonSteps.updateRadioList
@Et("Je mets à jour la liste radio '(.*)-(.*)' avec '(.*)' à partir de ces valeurs:") @And("I update radio list '(.*)-(.*)' with '(.*)' from these values:") public void updateRadioList(String page, String elementName, String valueKeyOrKey, Map<String, String> printedValues) throws TechnicalException, FailureException { updateRadioList(Page.getInstance(page).getPageElementByKey('-' + elementName), valueKeyOrKey, printedValues); }
java
@Et("Je mets à jour la liste radio '(.*)-(.*)' avec '(.*)' à partir de ces valeurs:") @And("I update radio list '(.*)-(.*)' with '(.*)' from these values:") public void updateRadioList(String page, String elementName, String valueKeyOrKey, Map<String, String> printedValues) throws TechnicalException, FailureException { updateRadioList(Page.getInstance(page).getPageElementByKey('-' + elementName), valueKeyOrKey, printedValues); }
[ "@", "Et", "(", "\"Je mets à jour la liste radio '(.*)-(.*)' avec '(.*)' à partir de ces valeurs:\")\r", "", "@", "And", "(", "\"I update radio list '(.*)-(.*)' with '(.*)' from these values:\"", ")", "public", "void", "updateRadioList", "(", "String", "page", ",", "String", "ele...
Updates the value of html radio element with conditions using a map of keys/printed values. @param page The concerned page of elementName @param elementName is target element @param valueKeyOrKey Is valueKey (valueKey or input in context (after a save)) @param printedValues is the display value @throws TechnicalException is throws if you have a technical error (format, configuration, datas, ...) in NoraUi. Exception with {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_UNABLE_TO_SELECT_RADIO_BUTTON} message (with screenshot, with exception) @throws FailureException if the scenario encounters a functional error
[ "Updates", "the", "value", "of", "html", "radio", "element", "with", "conditions", "using", "a", "map", "of", "keys", "/", "printed", "values", "." ]
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/CommonSteps.java#L867-L871
tuenti/SmsRadar
library/src/main/java/com/tuenti/smsradar/SmsRadar.java
SmsRadar.initializeSmsRadarService
public static void initializeSmsRadarService(Context context, SmsListener smsListener) { SmsRadar.smsListener = smsListener; Intent intent = new Intent(context, SmsRadarService.class); context.startService(intent); }
java
public static void initializeSmsRadarService(Context context, SmsListener smsListener) { SmsRadar.smsListener = smsListener; Intent intent = new Intent(context, SmsRadarService.class); context.startService(intent); }
[ "public", "static", "void", "initializeSmsRadarService", "(", "Context", "context", ",", "SmsListener", "smsListener", ")", "{", "SmsRadar", ".", "smsListener", "=", "smsListener", ";", "Intent", "intent", "=", "new", "Intent", "(", "context", ",", "SmsRadarServic...
Starts the service and store the listener to be notified when a new incoming or outgoing sms be processed inside the SMS content provider @param context used to start the service @param smsListener to notify when the sms content provider gets a new sms
[ "Starts", "the", "service", "and", "store", "the", "listener", "to", "be", "notified", "when", "a", "new", "incoming", "or", "outgoing", "sms", "be", "processed", "inside", "the", "SMS", "content", "provider" ]
train
https://github.com/tuenti/SmsRadar/blob/598553c69c474634a1d4041a39f015f0b4c33a6d/library/src/main/java/com/tuenti/smsradar/SmsRadar.java#L39-L43
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java
Expressions.asBoolean
public static BooleanExpression asBoolean(Expression<Boolean> expr) { Expression<Boolean> underlyingMixin = ExpressionUtils.extract(expr); if (underlyingMixin instanceof PathImpl) { return new BooleanPath((PathImpl<Boolean>) underlyingMixin); } else if (underlyingMixin instanceof PredicateOperation) { return new BooleanOperation((PredicateOperation) underlyingMixin); } else if (underlyingMixin instanceof PredicateTemplate) { return new BooleanTemplate((PredicateTemplate) underlyingMixin); } else { return new BooleanExpression(underlyingMixin) { private static final long serialVersionUID = -8712299418891960222L; @Override public <R, C> R accept(Visitor<R, C> v, C context) { return this.mixin.accept(v, context); } }; } }
java
public static BooleanExpression asBoolean(Expression<Boolean> expr) { Expression<Boolean> underlyingMixin = ExpressionUtils.extract(expr); if (underlyingMixin instanceof PathImpl) { return new BooleanPath((PathImpl<Boolean>) underlyingMixin); } else if (underlyingMixin instanceof PredicateOperation) { return new BooleanOperation((PredicateOperation) underlyingMixin); } else if (underlyingMixin instanceof PredicateTemplate) { return new BooleanTemplate((PredicateTemplate) underlyingMixin); } else { return new BooleanExpression(underlyingMixin) { private static final long serialVersionUID = -8712299418891960222L; @Override public <R, C> R accept(Visitor<R, C> v, C context) { return this.mixin.accept(v, context); } }; } }
[ "public", "static", "BooleanExpression", "asBoolean", "(", "Expression", "<", "Boolean", ">", "expr", ")", "{", "Expression", "<", "Boolean", ">", "underlyingMixin", "=", "ExpressionUtils", ".", "extract", "(", "expr", ")", ";", "if", "(", "underlyingMixin", "...
Create a new BooleanExpression @param expr Expression of type Boolean @return new BooleanExpression
[ "Create", "a", "new", "BooleanExpression" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java#L1861-L1881
antlrjavaparser/antlr-java-parser
src/main/java/com/github/antlrjavaparser/ASTHelper.java
ASTHelper.createNameExpr
public static NameExpr createNameExpr(String qualifiedName) { String[] split = qualifiedName.split("\\."); NameExpr ret = new NameExpr(split[0]); for (int i = 1; i < split.length; i++) { ret = new QualifiedNameExpr(ret, split[i]); } return ret; }
java
public static NameExpr createNameExpr(String qualifiedName) { String[] split = qualifiedName.split("\\."); NameExpr ret = new NameExpr(split[0]); for (int i = 1; i < split.length; i++) { ret = new QualifiedNameExpr(ret, split[i]); } return ret; }
[ "public", "static", "NameExpr", "createNameExpr", "(", "String", "qualifiedName", ")", "{", "String", "[", "]", "split", "=", "qualifiedName", ".", "split", "(", "\"\\\\.\"", ")", ";", "NameExpr", "ret", "=", "new", "NameExpr", "(", "split", "[", "0", "]",...
Creates a new {@link NameExpr} from a qualified name.<br> The qualified name can contains "." (dot) characters. @param qualifiedName qualified name @return instanceof {@link NameExpr}
[ "Creates", "a", "new", "{", "@link", "NameExpr", "}", "from", "a", "qualified", "name", ".", "<br", ">", "The", "qualified", "name", "can", "contains", ".", "(", "dot", ")", "characters", "." ]
train
https://github.com/antlrjavaparser/antlr-java-parser/blob/077160deb44d952c40c442800abd91af7e6fe006/src/main/java/com/github/antlrjavaparser/ASTHelper.java#L85-L92
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java
TheMovieDbApi.postMovieRating
public StatusCode postMovieRating(int movieId, int rating, String sessionId, String guestSessionId) throws MovieDbException { return tmdbMovies.postMovieRating(movieId, rating, sessionId, guestSessionId); }
java
public StatusCode postMovieRating(int movieId, int rating, String sessionId, String guestSessionId) throws MovieDbException { return tmdbMovies.postMovieRating(movieId, rating, sessionId, guestSessionId); }
[ "public", "StatusCode", "postMovieRating", "(", "int", "movieId", ",", "int", "rating", ",", "String", "sessionId", ",", "String", "guestSessionId", ")", "throws", "MovieDbException", "{", "return", "tmdbMovies", ".", "postMovieRating", "(", "movieId", ",", "ratin...
This method lets users rate a movie. A valid session id or guest session id is required. @param sessionId sessionId @param movieId movieId @param rating rating @param guestSessionId guestSessionId @return @throws MovieDbException exception
[ "This", "method", "lets", "users", "rate", "a", "movie", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/TheMovieDbApi.java#L1057-L1059
OpenLiberty/open-liberty
dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/modelresolver/impl/AbstractPropertyResolver.java
AbstractPropertyResolver.getEndIndexOfNextProperty
private int getEndIndexOfNextProperty(final String str, final int startIndex) { if (str == null) { return -1; } final int startPropIndex = str.indexOf("${", startIndex); // we didn't find a property in this string if (startPropIndex == -1) { return -1; } final int endPropIndex = str.indexOf("}", startPropIndex); // This check allows something like this "Some filename is ${}" // Maybe we should require "${f}" ??? if (endPropIndex > startPropIndex) { return endPropIndex; } // if no variables like ${prop1} are in string, return null return -1; }
java
private int getEndIndexOfNextProperty(final String str, final int startIndex) { if (str == null) { return -1; } final int startPropIndex = str.indexOf("${", startIndex); // we didn't find a property in this string if (startPropIndex == -1) { return -1; } final int endPropIndex = str.indexOf("}", startPropIndex); // This check allows something like this "Some filename is ${}" // Maybe we should require "${f}" ??? if (endPropIndex > startPropIndex) { return endPropIndex; } // if no variables like ${prop1} are in string, return null return -1; }
[ "private", "int", "getEndIndexOfNextProperty", "(", "final", "String", "str", ",", "final", "int", "startIndex", ")", "{", "if", "(", "str", "==", "null", ")", "{", "return", "-", "1", ";", "}", "final", "int", "startPropIndex", "=", "str", ".", "indexOf...
A helper method to the get the index of the '}' character in the given String str with a valid property substitution. A valid property looks like ${batch.property} @param str The string to search. @param startIndex The index in str to start the search. @return The index of the '}' character or -1 if no valid property is found in str.
[ "A", "helper", "method", "to", "the", "get", "the", "index", "of", "the", "}", "character", "in", "the", "given", "String", "str", "with", "a", "valid", "property", "substitution", ".", "A", "valid", "property", "looks", "like", "$", "{", "batch", ".", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/modelresolver/impl/AbstractPropertyResolver.java#L269-L290
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.deposit_depositId_paidBills_billId_debt_operation_GET
public ArrayList<Long> deposit_depositId_paidBills_billId_debt_operation_GET(String depositId, String billId, Long depositOrderId) throws IOException { String qPath = "/me/deposit/{depositId}/paidBills/{billId}/debt/operation"; StringBuilder sb = path(qPath, depositId, billId); query(sb, "depositOrderId", depositOrderId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
java
public ArrayList<Long> deposit_depositId_paidBills_billId_debt_operation_GET(String depositId, String billId, Long depositOrderId) throws IOException { String qPath = "/me/deposit/{depositId}/paidBills/{billId}/debt/operation"; StringBuilder sb = path(qPath, depositId, billId); query(sb, "depositOrderId", depositOrderId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
[ "public", "ArrayList", "<", "Long", ">", "deposit_depositId_paidBills_billId_debt_operation_GET", "(", "String", "depositId", ",", "String", "billId", ",", "Long", "depositOrderId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/deposit/{depositId}/paid...
All operations related to these debts REST: GET /me/deposit/{depositId}/paidBills/{billId}/debt/operation @param depositOrderId [required] Filter the value of depositOrderId property (=) @param depositId [required] @param billId [required]
[ "All", "operations", "related", "to", "these", "debts" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L3164-L3170
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/common/Similarity.java
Similarity.goodmanKruskalGamma
public static double goodmanKruskalGamma(DoubleVector a, DoubleVector b) { check(a, b); // NOTE: slow n^2 version. Needs to be replaced at some point with the // n-log-n method and to take into account sparse vectors. -jurgens int length = a.length(); double numerator = 0; int concordant = 0; int discordant = 0; // For all pairs, track how many pairs satisfy the ordering for (int i = 0; i < length; ++i) { for (int j = i+1; j < length; ++j) { // NOTE: this value will be 1 if there exists an match or // "concordance" in the ordering of the two pairs. Otherwise // it, will be a -1 of the pairs are not matched or are // "discordant. double ai = a.get(i); double aj = a.get(j); double bi = b.get(i); double bj = b.get(j); // If there was a tied rank, don't count the comparisons towards // the concordance totals if (ai != aj && bi != bj) { if ((ai < aj && bi < bj) || (ai > aj && bi > bj)) concordant++; else discordant++; } } } int cd = concordant + discordant; return (cd == 0) ? 0 : ((double)(concordant - discordant)) / cd; }
java
public static double goodmanKruskalGamma(DoubleVector a, DoubleVector b) { check(a, b); // NOTE: slow n^2 version. Needs to be replaced at some point with the // n-log-n method and to take into account sparse vectors. -jurgens int length = a.length(); double numerator = 0; int concordant = 0; int discordant = 0; // For all pairs, track how many pairs satisfy the ordering for (int i = 0; i < length; ++i) { for (int j = i+1; j < length; ++j) { // NOTE: this value will be 1 if there exists an match or // "concordance" in the ordering of the two pairs. Otherwise // it, will be a -1 of the pairs are not matched or are // "discordant. double ai = a.get(i); double aj = a.get(j); double bi = b.get(i); double bj = b.get(j); // If there was a tied rank, don't count the comparisons towards // the concordance totals if (ai != aj && bi != bj) { if ((ai < aj && bi < bj) || (ai > aj && bi > bj)) concordant++; else discordant++; } } } int cd = concordant + discordant; return (cd == 0) ? 0 : ((double)(concordant - discordant)) / cd; }
[ "public", "static", "double", "goodmanKruskalGamma", "(", "DoubleVector", "a", ",", "DoubleVector", "b", ")", "{", "check", "(", "a", ",", "b", ")", ";", "// NOTE: slow n^2 version. Needs to be replaced at some point with the", "// n-log-n method and to take into account spa...
Computes the <a href="http://www.unesco.org/webworld/idams/advguide/Chapt4_2.htm">Goodman-Kruskal Gamma coefficient</a>, which is preferrable to Kendall's &tau; and Spearman's &rho; when there are many ties in the data. @throws IllegalArgumentException when the length of the two vectors are not the same.
[ "Computes", "the", "<a", "href", "=", "http", ":", "//", "www", ".", "unesco", ".", "org", "/", "webworld", "/", "idams", "/", "advguide", "/", "Chapt4_2", ".", "htm", ">", "Goodman", "-", "Kruskal", "Gamma", "coefficient<", "/", "a", ">", "which", "...
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/common/Similarity.java#L2241-L2278
alibaba/jstorm
jstorm-hdfs/src/main/java/com/alibaba/jstorm/hdfs/spout/FileLock.java
FileLock.tryLock
public static FileLock tryLock(FileSystem fs, Path fileToLock, Path lockDirPath, String spoutId) throws IOException { Path lockFile = new Path(lockDirPath, fileToLock.getName()); try { FSDataOutputStream ostream = HdfsUtils.tryCreateFile(fs, lockFile); if (ostream != null) { LOG.debug("Acquired lock on file {}. LockFile= {}, Spout = {}", fileToLock, lockFile, spoutId); return new FileLock(fs, lockFile, ostream, spoutId); } else { LOG.debug("Cannot lock file {} as its already locked. Spout = {}", fileToLock, spoutId); return null; } } catch (IOException e) { LOG.error("Error when acquiring lock on file " + fileToLock + " Spout = " + spoutId, e); throw e; } }
java
public static FileLock tryLock(FileSystem fs, Path fileToLock, Path lockDirPath, String spoutId) throws IOException { Path lockFile = new Path(lockDirPath, fileToLock.getName()); try { FSDataOutputStream ostream = HdfsUtils.tryCreateFile(fs, lockFile); if (ostream != null) { LOG.debug("Acquired lock on file {}. LockFile= {}, Spout = {}", fileToLock, lockFile, spoutId); return new FileLock(fs, lockFile, ostream, spoutId); } else { LOG.debug("Cannot lock file {} as its already locked. Spout = {}", fileToLock, spoutId); return null; } } catch (IOException e) { LOG.error("Error when acquiring lock on file " + fileToLock + " Spout = " + spoutId, e); throw e; } }
[ "public", "static", "FileLock", "tryLock", "(", "FileSystem", "fs", ",", "Path", "fileToLock", ",", "Path", "lockDirPath", ",", "String", "spoutId", ")", "throws", "IOException", "{", "Path", "lockFile", "=", "new", "Path", "(", "lockDirPath", ",", "fileToLock...
returns lock on file or null if file is already locked. throws if unexpected problem
[ "returns", "lock", "on", "file", "or", "null", "if", "file", "is", "already", "locked", ".", "throws", "if", "unexpected", "problem" ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-hdfs/src/main/java/com/alibaba/jstorm/hdfs/spout/FileLock.java#L113-L130
lastaflute/lastaflute
src/main/java/org/lastaflute/web/login/TypicalLoginAssist.java
TypicalLoginAssist.doLogin
protected void doLogin(LoginCredential credential, LoginSpecifiedOption option) throws LoginFailureException { handleLoginSuccess(findLoginUser(credential).orElseThrow(() -> { final String msg = "Not found the user by the credential: " + credential + ", " + option; return handleLoginFailure(msg, credential, OptionalThing.of(option)); }), option); }
java
protected void doLogin(LoginCredential credential, LoginSpecifiedOption option) throws LoginFailureException { handleLoginSuccess(findLoginUser(credential).orElseThrow(() -> { final String msg = "Not found the user by the credential: " + credential + ", " + option; return handleLoginFailure(msg, credential, OptionalThing.of(option)); }), option); }
[ "protected", "void", "doLogin", "(", "LoginCredential", "credential", ",", "LoginSpecifiedOption", "option", ")", "throws", "LoginFailureException", "{", "handleLoginSuccess", "(", "findLoginUser", "(", "credential", ")", ".", "orElseThrow", "(", "(", ")", "->", "{"...
Do actually login for the user by credential. @param credential The login credential for the login user. (NotNull) @param option The option of login specified by caller. (NotNull) @throws LoginFailureException When it fails to do login by the user info.
[ "Do", "actually", "login", "for", "the", "user", "by", "credential", "." ]
train
https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/web/login/TypicalLoginAssist.java#L280-L285
ibm-bluemix-mobile-services/bms-clientsdk-android-core
lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/api/MCAAuthorizationManager.java
MCAAuthorizationManager.registerAuthenticationListener
public void registerAuthenticationListener(String realm, AuthenticationListener listener) { if (realm == null || realm.isEmpty()) { throw new InvalidParameterException("The realm name can't be null or empty."); } if (listener == null) { throw new InvalidParameterException("The authentication listener object can't be null."); } ChallengeHandler handler = new ChallengeHandler(); handler.initialize(realm, listener); challengeHandlers.put(realm, handler); }
java
public void registerAuthenticationListener(String realm, AuthenticationListener listener) { if (realm == null || realm.isEmpty()) { throw new InvalidParameterException("The realm name can't be null or empty."); } if (listener == null) { throw new InvalidParameterException("The authentication listener object can't be null."); } ChallengeHandler handler = new ChallengeHandler(); handler.initialize(realm, listener); challengeHandlers.put(realm, handler); }
[ "public", "void", "registerAuthenticationListener", "(", "String", "realm", ",", "AuthenticationListener", "listener", ")", "{", "if", "(", "realm", "==", "null", "||", "realm", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "InvalidParameterException", "("...
Registers authentication listener for specified realm. @param realm authentication realm. @param listener authentication listener.
[ "Registers", "authentication", "listener", "for", "specified", "realm", "." ]
train
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core/blob/8db4f00d0d564792397bfc0e5bd57d52a238b858/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/api/MCAAuthorizationManager.java#L291-L303
encoway/edu
edu/src/main/java/com/encoway/edu/EventDrivenUpdatesMap.java
EventDrivenUpdatesMap.get
public String get(Iterable<String> events, String defaultValue) { final Iterator<String> iter = getSeparate(events, defaultValue).iterator(); StringBuilder builder = new StringBuilder(); if (iter.hasNext()) { builder.append(iter.next()); while (iter.hasNext()) { builder.append(EVENT_LISTENER_DELIMITER); builder.append(iter.next()); } } return builder.toString(); }
java
public String get(Iterable<String> events, String defaultValue) { final Iterator<String> iter = getSeparate(events, defaultValue).iterator(); StringBuilder builder = new StringBuilder(); if (iter.hasNext()) { builder.append(iter.next()); while (iter.hasNext()) { builder.append(EVENT_LISTENER_DELIMITER); builder.append(iter.next()); } } return builder.toString(); }
[ "public", "String", "get", "(", "Iterable", "<", "String", ">", "events", ",", "String", "defaultValue", ")", "{", "final", "Iterator", "<", "String", ">", "iter", "=", "getSeparate", "(", "events", ",", "defaultValue", ")", ".", "iterator", "(", ")", ";...
Returns a space separated list of component IDs of components registered for at least one the `events`. @param events a collection of events @param defaultValue will be returned if no component is registered for one of the `events` @return a space separated list of fully qualified component IDs or `defaultValue`
[ "Returns", "a", "space", "separated", "list", "of", "component", "IDs", "of", "components", "registered", "for", "at", "least", "one", "the", "events", "." ]
train
https://github.com/encoway/edu/blob/52ae92b2207f7d5668e212904359fbeb360f3f05/edu/src/main/java/com/encoway/edu/EventDrivenUpdatesMap.java#L100-L111
alipay/sofa-rpc
extension-impl/codec-protobuf/src/main/java/com/alipay/sofa/rpc/codec/protobuf/ProtobufHelper.java
ProtobufHelper.loadProtoClassToCache
private void loadProtoClassToCache(String key, Class clazz, String methodName) { Method pbMethod = null; Method[] methods = clazz.getMethods(); for (Method method : methods) { if (methodName.equals(method.getName())) { pbMethod = method; break; } } if (pbMethod == null) { throw new SofaRpcRuntimeException("Cannot found protobuf method: " + clazz.getName() + "." + methodName); } Class[] parameterTypes = pbMethod.getParameterTypes(); if (parameterTypes == null || parameterTypes.length != 1 || isProtoBufMessageObject(parameterTypes[0])) { throw new SofaRpcRuntimeException("class based protobuf: " + clazz.getName() + ", only support one protobuf parameter!"); } Class reqClass = parameterTypes[0]; requestClassCache.put(key, reqClass); Class resClass = pbMethod.getReturnType(); if (resClass == void.class || !isProtoBufMessageClass(resClass)) { throw new SofaRpcRuntimeException("class based protobuf: " + clazz.getName() + ", only support return protobuf message!"); } responseClassCache.put(key, resClass); }
java
private void loadProtoClassToCache(String key, Class clazz, String methodName) { Method pbMethod = null; Method[] methods = clazz.getMethods(); for (Method method : methods) { if (methodName.equals(method.getName())) { pbMethod = method; break; } } if (pbMethod == null) { throw new SofaRpcRuntimeException("Cannot found protobuf method: " + clazz.getName() + "." + methodName); } Class[] parameterTypes = pbMethod.getParameterTypes(); if (parameterTypes == null || parameterTypes.length != 1 || isProtoBufMessageObject(parameterTypes[0])) { throw new SofaRpcRuntimeException("class based protobuf: " + clazz.getName() + ", only support one protobuf parameter!"); } Class reqClass = parameterTypes[0]; requestClassCache.put(key, reqClass); Class resClass = pbMethod.getReturnType(); if (resClass == void.class || !isProtoBufMessageClass(resClass)) { throw new SofaRpcRuntimeException("class based protobuf: " + clazz.getName() + ", only support return protobuf message!"); } responseClassCache.put(key, resClass); }
[ "private", "void", "loadProtoClassToCache", "(", "String", "key", ",", "Class", "clazz", ",", "String", "methodName", ")", "{", "Method", "pbMethod", "=", "null", ";", "Method", "[", "]", "methods", "=", "clazz", ".", "getMethods", "(", ")", ";", "for", ...
加载protobuf接口里方法的参数和返回值类型到缓存,不需要传递 @param key 缓存的key @param clazz 接口名 @param methodName 方法名
[ "加载protobuf接口里方法的参数和返回值类型到缓存,不需要传递" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/codec-protobuf/src/main/java/com/alipay/sofa/rpc/codec/protobuf/ProtobufHelper.java#L118-L145
real-logic/agrona
agrona/src/main/java/org/agrona/collections/Int2ObjectHashMap.java
Int2ObjectHashMap.computeIfAbsent
public V computeIfAbsent(final int key, final IntFunction<? extends V> mappingFunction) { V value = getMapped(key); if (value == null) { value = mappingFunction.apply(key); if (value != null) { put(key, value); } } else { value = unmapNullValue(value); } return value; }
java
public V computeIfAbsent(final int key, final IntFunction<? extends V> mappingFunction) { V value = getMapped(key); if (value == null) { value = mappingFunction.apply(key); if (value != null) { put(key, value); } } else { value = unmapNullValue(value); } return value; }
[ "public", "V", "computeIfAbsent", "(", "final", "int", "key", ",", "final", "IntFunction", "<", "?", "extends", "V", ">", "mappingFunction", ")", "{", "V", "value", "=", "getMapped", "(", "key", ")", ";", "if", "(", "value", "==", "null", ")", "{", "...
Get a value for a given key, or if it does not exist then default the value via a {@link java.util.function.IntFunction} and put it in the map. <p> Primitive specialized version of {@link java.util.Map#computeIfAbsent}. @param key to search on. @param mappingFunction to provide a value if the get returns null. @return the value if found otherwise the default.
[ "Get", "a", "value", "for", "a", "given", "key", "or", "if", "it", "does", "not", "exist", "then", "default", "the", "value", "via", "a", "{", "@link", "java", ".", "util", ".", "function", ".", "IntFunction", "}", "and", "put", "it", "in", "the", ...
train
https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/collections/Int2ObjectHashMap.java#L254-L271
atomix/catalyst
serializer/src/main/java/io/atomix/catalyst/serializer/util/CatalystSerializableSerializer.java
CatalystSerializableSerializer.readObject
@SuppressWarnings("unchecked") private T readObject(Class<T> type, BufferInput<?> buffer, Serializer serializer) { try { Constructor<?> constructor = constructorMap.get(type); if (constructor == null) { try { constructor = type.getDeclaredConstructor(); constructor.setAccessible(true); constructorMap.put(type, constructor); } catch (NoSuchMethodException e) { throw new SerializationException("failed to instantiate reference: must provide a single argument constructor", e); } } T object = (T) constructor.newInstance(); object.readObject(buffer, serializer); return object; } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { throw new SerializationException("failed to instantiate object: must provide a no argument constructor", e); } }
java
@SuppressWarnings("unchecked") private T readObject(Class<T> type, BufferInput<?> buffer, Serializer serializer) { try { Constructor<?> constructor = constructorMap.get(type); if (constructor == null) { try { constructor = type.getDeclaredConstructor(); constructor.setAccessible(true); constructorMap.put(type, constructor); } catch (NoSuchMethodException e) { throw new SerializationException("failed to instantiate reference: must provide a single argument constructor", e); } } T object = (T) constructor.newInstance(); object.readObject(buffer, serializer); return object; } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { throw new SerializationException("failed to instantiate object: must provide a no argument constructor", e); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "T", "readObject", "(", "Class", "<", "T", ">", "type", ",", "BufferInput", "<", "?", ">", "buffer", ",", "Serializer", "serializer", ")", "{", "try", "{", "Constructor", "<", "?", ">", "cons...
Reads an object. @param type The object type. @param buffer The object buffer. @param serializer The serializer with which the object is being read. @return The object.
[ "Reads", "an", "object", "." ]
train
https://github.com/atomix/catalyst/blob/140e762cb975cd8ee1fd85119043c5b8bf917c5c/serializer/src/main/java/io/atomix/catalyst/serializer/util/CatalystSerializableSerializer.java#L115-L135
geomajas/geomajas-project-server
api/src/main/java/org/geomajas/layer/feature/attribute/AssociationValue.java
AssociationValue.setCurrencyAttribute
public void setCurrencyAttribute(String name, String value) { ensureAttributes(); Attribute attribute = new CurrencyAttribute(value); attribute.setEditable(isEditable(name)); getAllAttributes().put(name, attribute); }
java
public void setCurrencyAttribute(String name, String value) { ensureAttributes(); Attribute attribute = new CurrencyAttribute(value); attribute.setEditable(isEditable(name)); getAllAttributes().put(name, attribute); }
[ "public", "void", "setCurrencyAttribute", "(", "String", "name", ",", "String", "value", ")", "{", "ensureAttributes", "(", ")", ";", "Attribute", "attribute", "=", "new", "CurrencyAttribute", "(", "value", ")", ";", "attribute", ".", "setEditable", "(", "isEd...
Sets the specified currency attribute to the specified value. @param name name of the attribute @param value value of the attribute @since 1.9.0
[ "Sets", "the", "specified", "currency", "attribute", "to", "the", "specified", "value", "." ]
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/api/src/main/java/org/geomajas/layer/feature/attribute/AssociationValue.java#L232-L237