repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
mikepenz/Materialize
library/src/main/java/com/mikepenz/materialize/util/UIUtils.java
UIUtils.setTranslucentNavigationFlag
public static void setTranslucentNavigationFlag(Activity activity, boolean on) { """ helper method to set the TranslucentNavigationFlag @param on """ if (Build.VERSION.SDK_INT >= 19) { setFlag(activity, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, on); } }
java
public static void setTranslucentNavigationFlag(Activity activity, boolean on) { if (Build.VERSION.SDK_INT >= 19) { setFlag(activity, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, on); } }
[ "public", "static", "void", "setTranslucentNavigationFlag", "(", "Activity", "activity", ",", "boolean", "on", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "19", ")", "{", "setFlag", "(", "activity", ",", "WindowManager", ".", "LayoutParams", ".", "FLAG_TRANSLUCENT_NAVIGATION", ",", "on", ")", ";", "}", "}" ]
helper method to set the TranslucentNavigationFlag @param on
[ "helper", "method", "to", "set", "the", "TranslucentNavigationFlag" ]
train
https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/util/UIUtils.java#L211-L215
zaproxy/zaproxy
src/org/zaproxy/zap/authentication/GenericAuthenticationCredentials.java
GenericAuthenticationCredentials.getSetCredentialsForUserApiAction
public static ApiDynamicActionImplementor getSetCredentialsForUserApiAction( final AuthenticationMethodType methodType) { """ Gets the api action for setting a {@link GenericAuthenticationCredentials} for an User. @param methodType the method type for which this is called @return api action implementation """ return new ApiDynamicActionImplementor(ACTION_SET_CREDENTIALS, null, new String[] { PARAM_CONFIG_PARAMS }) { @Override public void handleAction(JSONObject params) throws ApiException { Context context = ApiUtils.getContextByParamId(params, UsersAPI.PARAM_CONTEXT_ID); int userId = ApiUtils.getIntParam(params, UsersAPI.PARAM_USER_ID); // Make sure the type of authentication method is compatible if (!methodType.isTypeForMethod(context.getAuthenticationMethod())) throw new ApiException(ApiException.Type.ILLEGAL_PARAMETER, "User's credentials should match authentication method type of the context: " + context.getAuthenticationMethod().getType().getName()); // NOTE: no need to check if extension is loaded as this method is called only if // the Users extension is loaded ExtensionUserManagement extensionUserManagement = Control.getSingleton() .getExtensionLoader().getExtension(ExtensionUserManagement.class); User user = extensionUserManagement.getContextUserAuthManager(context.getIndex()) .getUserById(userId); if (user == null) throw new ApiException(ApiException.Type.USER_NOT_FOUND, UsersAPI.PARAM_USER_ID); // Build and set the credentials GenericAuthenticationCredentials credentials = (GenericAuthenticationCredentials) context .getAuthenticationMethod().createAuthenticationCredentials(); for (String paramName : credentials.paramNames) credentials.setParam(paramName, ApiUtils.getNonEmptyStringParam(params, paramName)); user.setAuthenticationCredentials(credentials); } }; }
java
public static ApiDynamicActionImplementor getSetCredentialsForUserApiAction( final AuthenticationMethodType methodType) { return new ApiDynamicActionImplementor(ACTION_SET_CREDENTIALS, null, new String[] { PARAM_CONFIG_PARAMS }) { @Override public void handleAction(JSONObject params) throws ApiException { Context context = ApiUtils.getContextByParamId(params, UsersAPI.PARAM_CONTEXT_ID); int userId = ApiUtils.getIntParam(params, UsersAPI.PARAM_USER_ID); // Make sure the type of authentication method is compatible if (!methodType.isTypeForMethod(context.getAuthenticationMethod())) throw new ApiException(ApiException.Type.ILLEGAL_PARAMETER, "User's credentials should match authentication method type of the context: " + context.getAuthenticationMethod().getType().getName()); // NOTE: no need to check if extension is loaded as this method is called only if // the Users extension is loaded ExtensionUserManagement extensionUserManagement = Control.getSingleton() .getExtensionLoader().getExtension(ExtensionUserManagement.class); User user = extensionUserManagement.getContextUserAuthManager(context.getIndex()) .getUserById(userId); if (user == null) throw new ApiException(ApiException.Type.USER_NOT_FOUND, UsersAPI.PARAM_USER_ID); // Build and set the credentials GenericAuthenticationCredentials credentials = (GenericAuthenticationCredentials) context .getAuthenticationMethod().createAuthenticationCredentials(); for (String paramName : credentials.paramNames) credentials.setParam(paramName, ApiUtils.getNonEmptyStringParam(params, paramName)); user.setAuthenticationCredentials(credentials); } }; }
[ "public", "static", "ApiDynamicActionImplementor", "getSetCredentialsForUserApiAction", "(", "final", "AuthenticationMethodType", "methodType", ")", "{", "return", "new", "ApiDynamicActionImplementor", "(", "ACTION_SET_CREDENTIALS", ",", "null", ",", "new", "String", "[", "]", "{", "PARAM_CONFIG_PARAMS", "}", ")", "{", "@", "Override", "public", "void", "handleAction", "(", "JSONObject", "params", ")", "throws", "ApiException", "{", "Context", "context", "=", "ApiUtils", ".", "getContextByParamId", "(", "params", ",", "UsersAPI", ".", "PARAM_CONTEXT_ID", ")", ";", "int", "userId", "=", "ApiUtils", ".", "getIntParam", "(", "params", ",", "UsersAPI", ".", "PARAM_USER_ID", ")", ";", "// Make sure the type of authentication method is compatible", "if", "(", "!", "methodType", ".", "isTypeForMethod", "(", "context", ".", "getAuthenticationMethod", "(", ")", ")", ")", "throw", "new", "ApiException", "(", "ApiException", ".", "Type", ".", "ILLEGAL_PARAMETER", ",", "\"User's credentials should match authentication method type of the context: \"", "+", "context", ".", "getAuthenticationMethod", "(", ")", ".", "getType", "(", ")", ".", "getName", "(", ")", ")", ";", "// NOTE: no need to check if extension is loaded as this method is called only if", "// the Users extension is loaded", "ExtensionUserManagement", "extensionUserManagement", "=", "Control", ".", "getSingleton", "(", ")", ".", "getExtensionLoader", "(", ")", ".", "getExtension", "(", "ExtensionUserManagement", ".", "class", ")", ";", "User", "user", "=", "extensionUserManagement", ".", "getContextUserAuthManager", "(", "context", ".", "getIndex", "(", ")", ")", ".", "getUserById", "(", "userId", ")", ";", "if", "(", "user", "==", "null", ")", "throw", "new", "ApiException", "(", "ApiException", ".", "Type", ".", "USER_NOT_FOUND", ",", "UsersAPI", ".", "PARAM_USER_ID", ")", ";", "// Build and set the credentials", "GenericAuthenticationCredentials", "credentials", "=", "(", "GenericAuthenticationCredentials", ")", "context", ".", "getAuthenticationMethod", "(", ")", ".", "createAuthenticationCredentials", "(", ")", ";", "for", "(", "String", "paramName", ":", "credentials", ".", "paramNames", ")", "credentials", ".", "setParam", "(", "paramName", ",", "ApiUtils", ".", "getNonEmptyStringParam", "(", "params", ",", "paramName", ")", ")", ";", "user", ".", "setAuthenticationCredentials", "(", "credentials", ")", ";", "}", "}", ";", "}" ]
Gets the api action for setting a {@link GenericAuthenticationCredentials} for an User. @param methodType the method type for which this is called @return api action implementation
[ "Gets", "the", "api", "action", "for", "setting", "a", "{", "@link", "GenericAuthenticationCredentials", "}", "for", "an", "User", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/authentication/GenericAuthenticationCredentials.java#L125-L156
relayrides/pushy
micrometer-metrics-listener/src/main/java/com/turo/pushy/apns/metrics/micrometer/MicrometerApnsClientMetricsListener.java
MicrometerApnsClientMetricsListener.handleNotificationSent
@Override public void handleNotificationSent(final ApnsClient apnsClient, final long notificationId) { """ Records a successful attempt to send a notification and updates metrics accordingly. @param apnsClient the client that sent the notification; note that this is ignored by {@code MicrometerApnsClientMetricsListener} instances, which should always be used for exactly one client @param notificationId an opaque, unique identifier for the notification that was sent """ this.notificationStartTimes.put(notificationId, System.nanoTime()); this.sentNotifications.increment(); }
java
@Override public void handleNotificationSent(final ApnsClient apnsClient, final long notificationId) { this.notificationStartTimes.put(notificationId, System.nanoTime()); this.sentNotifications.increment(); }
[ "@", "Override", "public", "void", "handleNotificationSent", "(", "final", "ApnsClient", "apnsClient", ",", "final", "long", "notificationId", ")", "{", "this", ".", "notificationStartTimes", ".", "put", "(", "notificationId", ",", "System", ".", "nanoTime", "(", ")", ")", ";", "this", ".", "sentNotifications", ".", "increment", "(", ")", ";", "}" ]
Records a successful attempt to send a notification and updates metrics accordingly. @param apnsClient the client that sent the notification; note that this is ignored by {@code MicrometerApnsClientMetricsListener} instances, which should always be used for exactly one client @param notificationId an opaque, unique identifier for the notification that was sent
[ "Records", "a", "successful", "attempt", "to", "send", "a", "notification", "and", "updates", "metrics", "accordingly", "." ]
train
https://github.com/relayrides/pushy/blob/1f6f9a0e07d785c815d74c2320a8d87c80231d36/micrometer-metrics-listener/src/main/java/com/turo/pushy/apns/metrics/micrometer/MicrometerApnsClientMetricsListener.java#L196-L200
pippo-java/pippo
pippo-core/src/main/java/ro/pippo/core/DefaultErrorHandler.java
DefaultErrorHandler.renderDirectly
protected void renderDirectly(int statusCode, RouteContext routeContext) { """ Render the result directly (without template). @param routeContext """ if (application.getPippoSettings().isProd()) { routeContext.getResponse().commit(); } else { if (statusCode == HttpConstants.StatusCode.NOT_FOUND) { StringBuilder content = new StringBuilder(); content.append("<html><body>"); content.append("<pre>"); content.append("Cannot find a route for '"); content.append(routeContext.getRequestMethod()).append(' ').append(routeContext.getRequestUri()); content.append('\''); content.append('\n'); content.append("Available routes:"); content.append('\n'); List<Route> routes = application.getRouter().getRoutes(); for (Route route : routes) { content.append('\t').append(route.getRequestMethod()).append(' ').append(route.getUriPattern()); content.append('\n'); } content.append("</pre>"); content.append("</body></html>"); routeContext.send(content); } else if (statusCode == HttpConstants.StatusCode.INTERNAL_ERROR) { StringBuilder content = new StringBuilder(); content.append("<html><body>"); content.append("<pre>"); Error error = prepareError(statusCode, routeContext); content.append(error.toString()); content.append("</pre>"); content.append("</body></html>"); routeContext.send(content); } } }
java
protected void renderDirectly(int statusCode, RouteContext routeContext) { if (application.getPippoSettings().isProd()) { routeContext.getResponse().commit(); } else { if (statusCode == HttpConstants.StatusCode.NOT_FOUND) { StringBuilder content = new StringBuilder(); content.append("<html><body>"); content.append("<pre>"); content.append("Cannot find a route for '"); content.append(routeContext.getRequestMethod()).append(' ').append(routeContext.getRequestUri()); content.append('\''); content.append('\n'); content.append("Available routes:"); content.append('\n'); List<Route> routes = application.getRouter().getRoutes(); for (Route route : routes) { content.append('\t').append(route.getRequestMethod()).append(' ').append(route.getUriPattern()); content.append('\n'); } content.append("</pre>"); content.append("</body></html>"); routeContext.send(content); } else if (statusCode == HttpConstants.StatusCode.INTERNAL_ERROR) { StringBuilder content = new StringBuilder(); content.append("<html><body>"); content.append("<pre>"); Error error = prepareError(statusCode, routeContext); content.append(error.toString()); content.append("</pre>"); content.append("</body></html>"); routeContext.send(content); } } }
[ "protected", "void", "renderDirectly", "(", "int", "statusCode", ",", "RouteContext", "routeContext", ")", "{", "if", "(", "application", ".", "getPippoSettings", "(", ")", ".", "isProd", "(", ")", ")", "{", "routeContext", ".", "getResponse", "(", ")", ".", "commit", "(", ")", ";", "}", "else", "{", "if", "(", "statusCode", "==", "HttpConstants", ".", "StatusCode", ".", "NOT_FOUND", ")", "{", "StringBuilder", "content", "=", "new", "StringBuilder", "(", ")", ";", "content", ".", "append", "(", "\"<html><body>\"", ")", ";", "content", ".", "append", "(", "\"<pre>\"", ")", ";", "content", ".", "append", "(", "\"Cannot find a route for '\"", ")", ";", "content", ".", "append", "(", "routeContext", ".", "getRequestMethod", "(", ")", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "routeContext", ".", "getRequestUri", "(", ")", ")", ";", "content", ".", "append", "(", "'", "'", ")", ";", "content", ".", "append", "(", "'", "'", ")", ";", "content", ".", "append", "(", "\"Available routes:\"", ")", ";", "content", ".", "append", "(", "'", "'", ")", ";", "List", "<", "Route", ">", "routes", "=", "application", ".", "getRouter", "(", ")", ".", "getRoutes", "(", ")", ";", "for", "(", "Route", "route", ":", "routes", ")", "{", "content", ".", "append", "(", "'", "'", ")", ".", "append", "(", "route", ".", "getRequestMethod", "(", ")", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "route", ".", "getUriPattern", "(", ")", ")", ";", "content", ".", "append", "(", "'", "'", ")", ";", "}", "content", ".", "append", "(", "\"</pre>\"", ")", ";", "content", ".", "append", "(", "\"</body></html>\"", ")", ";", "routeContext", ".", "send", "(", "content", ")", ";", "}", "else", "if", "(", "statusCode", "==", "HttpConstants", ".", "StatusCode", ".", "INTERNAL_ERROR", ")", "{", "StringBuilder", "content", "=", "new", "StringBuilder", "(", ")", ";", "content", ".", "append", "(", "\"<html><body>\"", ")", ";", "content", ".", "append", "(", "\"<pre>\"", ")", ";", "Error", "error", "=", "prepareError", "(", "statusCode", ",", "routeContext", ")", ";", "content", ".", "append", "(", "error", ".", "toString", "(", ")", ")", ";", "content", ".", "append", "(", "\"</pre>\"", ")", ";", "content", ".", "append", "(", "\"</body></html>\"", ")", ";", "routeContext", ".", "send", "(", "content", ")", ";", "}", "}", "}" ]
Render the result directly (without template). @param routeContext
[ "Render", "the", "result", "directly", "(", "without", "template", ")", "." ]
train
https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/DefaultErrorHandler.java#L215-L256
jbundle/jbundle
base/message/core/src/main/java/org/jbundle/base/message/core/trx/TrxMessageHeader.java
TrxMessageHeader.put
public void put(String strKey, Object objData) { """ Return the state of this object as a properties object. @param strKey The key to return. @return The properties. """ if (m_mapMessageHeader == null) m_mapMessageHeader = new HashMap<String,Object>(); objData = m_mapMessageHeader.put(strKey, objData); }
java
public void put(String strKey, Object objData) { if (m_mapMessageHeader == null) m_mapMessageHeader = new HashMap<String,Object>(); objData = m_mapMessageHeader.put(strKey, objData); }
[ "public", "void", "put", "(", "String", "strKey", ",", "Object", "objData", ")", "{", "if", "(", "m_mapMessageHeader", "==", "null", ")", "m_mapMessageHeader", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "objData", "=", "m_mapMessageHeader", ".", "put", "(", "strKey", ",", "objData", ")", ";", "}" ]
Return the state of this object as a properties object. @param strKey The key to return. @return The properties.
[ "Return", "the", "state", "of", "this", "object", "as", "a", "properties", "object", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/core/src/main/java/org/jbundle/base/message/core/trx/TrxMessageHeader.java#L271-L276
landawn/AbacusUtil
src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java
PoolablePreparedStatement.setString
@Override public void setString(int parameterIndex, String x) throws SQLException { """ Method setString. @param parameterIndex @param x @throws SQLException @see java.sql.PreparedStatement#setString(int, String) """ internalStmt.setString(parameterIndex, x); }
java
@Override public void setString(int parameterIndex, String x) throws SQLException { internalStmt.setString(parameterIndex, x); }
[ "@", "Override", "public", "void", "setString", "(", "int", "parameterIndex", ",", "String", "x", ")", "throws", "SQLException", "{", "internalStmt", ".", "setString", "(", "parameterIndex", ",", "x", ")", ";", "}" ]
Method setString. @param parameterIndex @param x @throws SQLException @see java.sql.PreparedStatement#setString(int, String)
[ "Method", "setString", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java#L991-L994
shrinkwrap/shrinkwrap
impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/URLPackageScanner.java
URLPackageScanner.newInstance
public static URLPackageScanner newInstance(boolean addRecursively, final ClassLoader classLoader, final Callback callback, final String packageName) { """ Factory method to create an instance of URLPackageScanner. @param addRecursively flag to add child packages @param classLoader class loader that will have classes added @param callback Callback to invoke when a matching class is found @param packageName Package that will be scanned @return new instance of URLPackageScanner """ Validate.notNull(packageName, "Package name must be specified"); Validate.notNull(addRecursively, "AddRecursively must be specified"); Validate.notNull(classLoader, "ClassLoader must be specified"); Validate.notNull(callback, "Callback must be specified"); return new URLPackageScanner(packageName, addRecursively, classLoader, callback); }
java
public static URLPackageScanner newInstance(boolean addRecursively, final ClassLoader classLoader, final Callback callback, final String packageName) { Validate.notNull(packageName, "Package name must be specified"); Validate.notNull(addRecursively, "AddRecursively must be specified"); Validate.notNull(classLoader, "ClassLoader must be specified"); Validate.notNull(callback, "Callback must be specified"); return new URLPackageScanner(packageName, addRecursively, classLoader, callback); }
[ "public", "static", "URLPackageScanner", "newInstance", "(", "boolean", "addRecursively", ",", "final", "ClassLoader", "classLoader", ",", "final", "Callback", "callback", ",", "final", "String", "packageName", ")", "{", "Validate", ".", "notNull", "(", "packageName", ",", "\"Package name must be specified\"", ")", ";", "Validate", ".", "notNull", "(", "addRecursively", ",", "\"AddRecursively must be specified\"", ")", ";", "Validate", ".", "notNull", "(", "classLoader", ",", "\"ClassLoader must be specified\"", ")", ";", "Validate", ".", "notNull", "(", "callback", ",", "\"Callback must be specified\"", ")", ";", "return", "new", "URLPackageScanner", "(", "packageName", ",", "addRecursively", ",", "classLoader", ",", "callback", ")", ";", "}" ]
Factory method to create an instance of URLPackageScanner. @param addRecursively flag to add child packages @param classLoader class loader that will have classes added @param callback Callback to invoke when a matching class is found @param packageName Package that will be scanned @return new instance of URLPackageScanner
[ "Factory", "method", "to", "create", "an", "instance", "of", "URLPackageScanner", "." ]
train
https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/URLPackageScanner.java#L79-L87
Netflix/Hystrix
hystrix-core/src/main/java/com/netflix/hystrix/strategy/executionhook/HystrixCommandExecutionHook.java
HystrixCommandExecutionHook.onRunSuccess
@Deprecated public <T> T onRunSuccess(HystrixInvokable<T> commandInstance, T response) { """ DEPRECATED: Change usages of this to {@link #onExecutionEmit} if you want to add a hook for each value emitted by the command or to {@link #onExecutionSuccess} if you want to add a hook when the command successfully executes Invoked after successful execution of {@link HystrixCommand#run()} with response value. In a {@link HystrixCommand} using {@link ExecutionIsolationStrategy#THREAD}, this will get invoked if the Hystrix thread successfully runs, regardless of whether the calling thread encountered a timeout. @param commandInstance The executing HystrixCommand instance. @param response from {@link HystrixCommand#run()} @return T response object that can be modified, decorated, replaced or just returned as a pass-thru. @since 1.2 """ // pass-thru by default return response; }
java
@Deprecated public <T> T onRunSuccess(HystrixInvokable<T> commandInstance, T response) { // pass-thru by default return response; }
[ "@", "Deprecated", "public", "<", "T", ">", "T", "onRunSuccess", "(", "HystrixInvokable", "<", "T", ">", "commandInstance", ",", "T", "response", ")", "{", "// pass-thru by default", "return", "response", ";", "}" ]
DEPRECATED: Change usages of this to {@link #onExecutionEmit} if you want to add a hook for each value emitted by the command or to {@link #onExecutionSuccess} if you want to add a hook when the command successfully executes Invoked after successful execution of {@link HystrixCommand#run()} with response value. In a {@link HystrixCommand} using {@link ExecutionIsolationStrategy#THREAD}, this will get invoked if the Hystrix thread successfully runs, regardless of whether the calling thread encountered a timeout. @param commandInstance The executing HystrixCommand instance. @param response from {@link HystrixCommand#run()} @return T response object that can be modified, decorated, replaced or just returned as a pass-thru. @since 1.2
[ "DEPRECATED", ":", "Change", "usages", "of", "this", "to", "{", "@link", "#onExecutionEmit", "}", "if", "you", "want", "to", "add", "a", "hook", "for", "each", "value", "emitted", "by", "the", "command", "or", "to", "{", "@link", "#onExecutionSuccess", "}", "if", "you", "want", "to", "add", "a", "hook", "when", "the", "command", "successfully", "executes" ]
train
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/strategy/executionhook/HystrixCommandExecutionHook.java#L298-L302
davidmoten/rxjava-extras
src/main/java/com/github/davidmoten/rx/Transformers.java
Transformers.collectWhile
public static <T, R> Transformer<T, R> collectWhile(final Func0<R> factory, final Action2<? super R, ? super T> collect, final Func2<? super R, ? super T, Boolean> condition, final Func1<? super R, Boolean> isEmpty) { """ <p> Returns a {@link Transformer} that returns an {@link Observable} that is collected into {@code Collection} instances created by {@code factory} that are emitted when the collection and latest emission do not satisfy {@code condition} or on completion. <p> <img src= "https://github.com/davidmoten/rxjava-extras/blob/master/src/docs/collectWhile.png?raw=true" alt="marble diagram"> @param factory collection instance creator @param collect collection action @param condition returns true if and only if emission should be collected in current collection being prepared for emission @param isEmpty indicates that the collection is empty @param <T> generic type of source observable @param <R> collection type emitted by transformed Observable @return transformer as above """ Func3<R, T, Observer<R>, R> transition = new Func3<R, T, Observer<R>, R>() { @Override public R call(R collection, T t, Observer<R> observer) { if (condition.call(collection, t)) { collect.call(collection, t); return collection; } else { observer.onNext(collection); R r = factory.call(); collect.call(r, t); return r; } } }; Func2<R, Observer<R>, Boolean> completionAction = new Func2<R, Observer<R>, Boolean>() { @Override public Boolean call(R collection, Observer<R> observer) { if (!isEmpty.call(collection)) { observer.onNext(collection); } return true; } }; return Transformers.stateMachine(factory, transition, completionAction); }
java
public static <T, R> Transformer<T, R> collectWhile(final Func0<R> factory, final Action2<? super R, ? super T> collect, final Func2<? super R, ? super T, Boolean> condition, final Func1<? super R, Boolean> isEmpty) { Func3<R, T, Observer<R>, R> transition = new Func3<R, T, Observer<R>, R>() { @Override public R call(R collection, T t, Observer<R> observer) { if (condition.call(collection, t)) { collect.call(collection, t); return collection; } else { observer.onNext(collection); R r = factory.call(); collect.call(r, t); return r; } } }; Func2<R, Observer<R>, Boolean> completionAction = new Func2<R, Observer<R>, Boolean>() { @Override public Boolean call(R collection, Observer<R> observer) { if (!isEmpty.call(collection)) { observer.onNext(collection); } return true; } }; return Transformers.stateMachine(factory, transition, completionAction); }
[ "public", "static", "<", "T", ",", "R", ">", "Transformer", "<", "T", ",", "R", ">", "collectWhile", "(", "final", "Func0", "<", "R", ">", "factory", ",", "final", "Action2", "<", "?", "super", "R", ",", "?", "super", "T", ">", "collect", ",", "final", "Func2", "<", "?", "super", "R", ",", "?", "super", "T", ",", "Boolean", ">", "condition", ",", "final", "Func1", "<", "?", "super", "R", ",", "Boolean", ">", "isEmpty", ")", "{", "Func3", "<", "R", ",", "T", ",", "Observer", "<", "R", ">", ",", "R", ">", "transition", "=", "new", "Func3", "<", "R", ",", "T", ",", "Observer", "<", "R", ">", ",", "R", ">", "(", ")", "{", "@", "Override", "public", "R", "call", "(", "R", "collection", ",", "T", "t", ",", "Observer", "<", "R", ">", "observer", ")", "{", "if", "(", "condition", ".", "call", "(", "collection", ",", "t", ")", ")", "{", "collect", ".", "call", "(", "collection", ",", "t", ")", ";", "return", "collection", ";", "}", "else", "{", "observer", ".", "onNext", "(", "collection", ")", ";", "R", "r", "=", "factory", ".", "call", "(", ")", ";", "collect", ".", "call", "(", "r", ",", "t", ")", ";", "return", "r", ";", "}", "}", "}", ";", "Func2", "<", "R", ",", "Observer", "<", "R", ">", ",", "Boolean", ">", "completionAction", "=", "new", "Func2", "<", "R", ",", "Observer", "<", "R", ">", ",", "Boolean", ">", "(", ")", "{", "@", "Override", "public", "Boolean", "call", "(", "R", "collection", ",", "Observer", "<", "R", ">", "observer", ")", "{", "if", "(", "!", "isEmpty", ".", "call", "(", "collection", ")", ")", "{", "observer", ".", "onNext", "(", "collection", ")", ";", "}", "return", "true", ";", "}", "}", ";", "return", "Transformers", ".", "stateMachine", "(", "factory", ",", "transition", ",", "completionAction", ")", ";", "}" ]
<p> Returns a {@link Transformer} that returns an {@link Observable} that is collected into {@code Collection} instances created by {@code factory} that are emitted when the collection and latest emission do not satisfy {@code condition} or on completion. <p> <img src= "https://github.com/davidmoten/rxjava-extras/blob/master/src/docs/collectWhile.png?raw=true" alt="marble diagram"> @param factory collection instance creator @param collect collection action @param condition returns true if and only if emission should be collected in current collection being prepared for emission @param isEmpty indicates that the collection is empty @param <T> generic type of source observable @param <R> collection type emitted by transformed Observable @return transformer as above
[ "<p", ">", "Returns", "a", "{", "@link", "Transformer", "}", "that", "returns", "an", "{", "@link", "Observable", "}", "that", "is", "collected", "into", "{", "@code", "Collection", "}", "instances", "created", "by", "{", "@code", "factory", "}", "that", "are", "emitted", "when", "the", "collection", "and", "latest", "emission", "do", "not", "satisfy", "{", "@code", "condition", "}", "or", "on", "completion", "." ]
train
https://github.com/davidmoten/rxjava-extras/blob/a91d2ba7d454843250e0b0fce36084f9fb02a551/src/main/java/com/github/davidmoten/rx/Transformers.java#L544-L575
HanSolo/SteelSeries-Swing
src/main/java/eu/hansolo/steelseries/gauges/AbstractLinear.java
AbstractLinear.create_TRACK_Image
protected BufferedImage create_TRACK_Image(final int WIDTH, final int HEIGHT, final double MIN_VALUE, final double MAX_VALUE, final double TRACK_START, final double TRACK_SECTION, final double TRACK_STOP, final Color TRACK_START_COLOR, final Color TRACK_SECTION_COLOR, final Color TRACK_STOP_COLOR) { """ Returns the track image with the given values. @param WIDTH @param HEIGHT @param MIN_VALUE @param MAX_VALUE @param TRACK_START @param TRACK_SECTION @param TRACK_STOP @param TRACK_START_COLOR @param TRACK_SECTION_COLOR @param TRACK_STOP_COLOR @return a buffered image of the track colored with the given values """ return create_TRACK_Image(WIDTH, HEIGHT, MIN_VALUE, MAX_VALUE, TRACK_START, TRACK_SECTION, TRACK_STOP, TRACK_START_COLOR, TRACK_SECTION_COLOR, TRACK_STOP_COLOR, null); }
java
protected BufferedImage create_TRACK_Image(final int WIDTH, final int HEIGHT, final double MIN_VALUE, final double MAX_VALUE, final double TRACK_START, final double TRACK_SECTION, final double TRACK_STOP, final Color TRACK_START_COLOR, final Color TRACK_SECTION_COLOR, final Color TRACK_STOP_COLOR) { return create_TRACK_Image(WIDTH, HEIGHT, MIN_VALUE, MAX_VALUE, TRACK_START, TRACK_SECTION, TRACK_STOP, TRACK_START_COLOR, TRACK_SECTION_COLOR, TRACK_STOP_COLOR, null); }
[ "protected", "BufferedImage", "create_TRACK_Image", "(", "final", "int", "WIDTH", ",", "final", "int", "HEIGHT", ",", "final", "double", "MIN_VALUE", ",", "final", "double", "MAX_VALUE", ",", "final", "double", "TRACK_START", ",", "final", "double", "TRACK_SECTION", ",", "final", "double", "TRACK_STOP", ",", "final", "Color", "TRACK_START_COLOR", ",", "final", "Color", "TRACK_SECTION_COLOR", ",", "final", "Color", "TRACK_STOP_COLOR", ")", "{", "return", "create_TRACK_Image", "(", "WIDTH", ",", "HEIGHT", ",", "MIN_VALUE", ",", "MAX_VALUE", ",", "TRACK_START", ",", "TRACK_SECTION", ",", "TRACK_STOP", ",", "TRACK_START_COLOR", ",", "TRACK_SECTION_COLOR", ",", "TRACK_STOP_COLOR", ",", "null", ")", ";", "}" ]
Returns the track image with the given values. @param WIDTH @param HEIGHT @param MIN_VALUE @param MAX_VALUE @param TRACK_START @param TRACK_SECTION @param TRACK_STOP @param TRACK_START_COLOR @param TRACK_SECTION_COLOR @param TRACK_STOP_COLOR @return a buffered image of the track colored with the given values
[ "Returns", "the", "track", "image", "with", "the", "given", "values", "." ]
train
https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/gauges/AbstractLinear.java#L973-L980
onepf/OpenIAB
library/src/main/java/org/onepf/oms/appstore/googleUtils/Base64.java
Base64.decodeWebSafe
@NotNull public static byte[] decodeWebSafe(byte[] source, int off, int len) throws Base64DecoderException { """ Decodes web safe Base64 content in byte array format and returns the decoded byte array. Web safe encoding uses '-' instead of '+', '_' instead of '/' @param source the Base64 encoded data @param off the offset of where to begin decoding @param len the length of characters to decode @return decoded data """ return decode(source, off, len, WEBSAFE_DECODABET); }
java
@NotNull public static byte[] decodeWebSafe(byte[] source, int off, int len) throws Base64DecoderException { return decode(source, off, len, WEBSAFE_DECODABET); }
[ "@", "NotNull", "public", "static", "byte", "[", "]", "decodeWebSafe", "(", "byte", "[", "]", "source", ",", "int", "off", ",", "int", "len", ")", "throws", "Base64DecoderException", "{", "return", "decode", "(", "source", ",", "off", ",", "len", ",", "WEBSAFE_DECODABET", ")", ";", "}" ]
Decodes web safe Base64 content in byte array format and returns the decoded byte array. Web safe encoding uses '-' instead of '+', '_' instead of '/' @param source the Base64 encoded data @param off the offset of where to begin decoding @param len the length of characters to decode @return decoded data
[ "Decodes", "web", "safe", "Base64", "content", "in", "byte", "array", "format", "and", "returns", "the", "decoded", "byte", "array", ".", "Web", "safe", "encoding", "uses", "-", "instead", "of", "+", "_", "instead", "of", "/" ]
train
https://github.com/onepf/OpenIAB/blob/90552d53c5303b322940d96a0c4b7cb797d78760/library/src/main/java/org/onepf/oms/appstore/googleUtils/Base64.java#L514-L518
jmurty/java-xmlbuilder
src/main/java/com/jamesmurty/utils/BaseXMLBuilder.java
BaseXMLBuilder.elementBeforeImpl
protected Element elementBeforeImpl(String name) { """ Add a named XML element to the document as a sibling element that precedes the position of this builder node. When adding an element to a namespaced document, the new node will be assigned a namespace matching it's qualified name prefix (if any) or the document's default namespace. NOTE: If the element has a prefix that does not match any known namespaces, the element will be created without any namespace. @param name the name of the XML element. @throws IllegalStateException if you attempt to add a sibling element to a node where there are already one or more siblings that are text nodes. """ String prefix = getPrefixFromQualifiedName(name); String namespaceURI = this.xmlNode.lookupNamespaceURI(prefix); return elementBeforeImpl(name, namespaceURI); }
java
protected Element elementBeforeImpl(String name) { String prefix = getPrefixFromQualifiedName(name); String namespaceURI = this.xmlNode.lookupNamespaceURI(prefix); return elementBeforeImpl(name, namespaceURI); }
[ "protected", "Element", "elementBeforeImpl", "(", "String", "name", ")", "{", "String", "prefix", "=", "getPrefixFromQualifiedName", "(", "name", ")", ";", "String", "namespaceURI", "=", "this", ".", "xmlNode", ".", "lookupNamespaceURI", "(", "prefix", ")", ";", "return", "elementBeforeImpl", "(", "name", ",", "namespaceURI", ")", ";", "}" ]
Add a named XML element to the document as a sibling element that precedes the position of this builder node. When adding an element to a namespaced document, the new node will be assigned a namespace matching it's qualified name prefix (if any) or the document's default namespace. NOTE: If the element has a prefix that does not match any known namespaces, the element will be created without any namespace. @param name the name of the XML element. @throws IllegalStateException if you attempt to add a sibling element to a node where there are already one or more siblings that are text nodes.
[ "Add", "a", "named", "XML", "element", "to", "the", "document", "as", "a", "sibling", "element", "that", "precedes", "the", "position", "of", "this", "builder", "node", "." ]
train
https://github.com/jmurty/java-xmlbuilder/blob/7c224b8e8ed79808509322cb141dab5a88dd3cec/src/main/java/com/jamesmurty/utils/BaseXMLBuilder.java#L765-L769
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/pathfinding/MapTilePathModel.java
MapTilePathModel.getFreeTileAround
private CoordTile getFreeTileAround(Pathfindable mover, int tx, int ty, int tw, int th, int radius, Integer id) { """ Search a free area from this location. @param mover The object moving on map. @param tx The horizontal tile index. @param ty The vertical tile index. @param tw The width in tile. @param th The height in tile. @param radius The search radius. @param id The mover id. @return The free tile found (<code>null</code> if none). """ for (int ctx = tx - radius; ctx <= tx + radius; ctx++) { for (int cty = ty - radius; cty <= ty + radius; cty++) { if (isAreaAvailable(mover, ctx, cty, tw, th, id)) { return new CoordTile(ctx, cty); } } } return null; }
java
private CoordTile getFreeTileAround(Pathfindable mover, int tx, int ty, int tw, int th, int radius, Integer id) { for (int ctx = tx - radius; ctx <= tx + radius; ctx++) { for (int cty = ty - radius; cty <= ty + radius; cty++) { if (isAreaAvailable(mover, ctx, cty, tw, th, id)) { return new CoordTile(ctx, cty); } } } return null; }
[ "private", "CoordTile", "getFreeTileAround", "(", "Pathfindable", "mover", ",", "int", "tx", ",", "int", "ty", ",", "int", "tw", ",", "int", "th", ",", "int", "radius", ",", "Integer", "id", ")", "{", "for", "(", "int", "ctx", "=", "tx", "-", "radius", ";", "ctx", "<=", "tx", "+", "radius", ";", "ctx", "++", ")", "{", "for", "(", "int", "cty", "=", "ty", "-", "radius", ";", "cty", "<=", "ty", "+", "radius", ";", "cty", "++", ")", "{", "if", "(", "isAreaAvailable", "(", "mover", ",", "ctx", ",", "cty", ",", "tw", ",", "th", ",", "id", ")", ")", "{", "return", "new", "CoordTile", "(", "ctx", ",", "cty", ")", ";", "}", "}", "}", "return", "null", ";", "}" ]
Search a free area from this location. @param mover The object moving on map. @param tx The horizontal tile index. @param ty The vertical tile index. @param tw The width in tile. @param th The height in tile. @param radius The search radius. @param id The mover id. @return The free tile found (<code>null</code> if none).
[ "Search", "a", "free", "area", "from", "this", "location", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/pathfinding/MapTilePathModel.java#L212-L225
terrestris/shogun-core
src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java
HttpUtil.forwardPost
public static Response forwardPost(URI uri, HttpServletRequest request, boolean forwardHeaders) throws URISyntaxException, HttpException { """ Forward POST to uri based on given request @param uri uri The URI to forward to. @param request The original {@link HttpServletRequest} @param forwardHeaders Should headers of request should be forwarded @return @throws URISyntaxException @throws HttpException """ Header[] headersToForward = null; if (request != null && forwardHeaders) { headersToForward = HttpUtil.getHeadersFromRequest(request); } String ctString = request.getContentType(); ContentType ct = ContentType.parse(ctString); String body = getRequestBody(request); return HttpUtil.postBody(new HttpPost(uri), body, ct, null, headersToForward); }
java
public static Response forwardPost(URI uri, HttpServletRequest request, boolean forwardHeaders) throws URISyntaxException, HttpException { Header[] headersToForward = null; if (request != null && forwardHeaders) { headersToForward = HttpUtil.getHeadersFromRequest(request); } String ctString = request.getContentType(); ContentType ct = ContentType.parse(ctString); String body = getRequestBody(request); return HttpUtil.postBody(new HttpPost(uri), body, ct, null, headersToForward); }
[ "public", "static", "Response", "forwardPost", "(", "URI", "uri", ",", "HttpServletRequest", "request", ",", "boolean", "forwardHeaders", ")", "throws", "URISyntaxException", ",", "HttpException", "{", "Header", "[", "]", "headersToForward", "=", "null", ";", "if", "(", "request", "!=", "null", "&&", "forwardHeaders", ")", "{", "headersToForward", "=", "HttpUtil", ".", "getHeadersFromRequest", "(", "request", ")", ";", "}", "String", "ctString", "=", "request", ".", "getContentType", "(", ")", ";", "ContentType", "ct", "=", "ContentType", ".", "parse", "(", "ctString", ")", ";", "String", "body", "=", "getRequestBody", "(", "request", ")", ";", "return", "HttpUtil", ".", "postBody", "(", "new", "HttpPost", "(", "uri", ")", ",", "body", ",", "ct", ",", "null", ",", "headersToForward", ")", ";", "}" ]
Forward POST to uri based on given request @param uri uri The URI to forward to. @param request The original {@link HttpServletRequest} @param forwardHeaders Should headers of request should be forwarded @return @throws URISyntaxException @throws HttpException
[ "Forward", "POST", "to", "uri", "based", "on", "given", "request" ]
train
https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java#L1214-L1225
twotoasters/RecyclerViewLib
library/src/main/java/com/twotoasters/layoutmanager/BaseLayoutManager.java
BaseLayoutManager.recycleByRenderState
protected void recycleByRenderState(RecyclerView.Recycler recycler, RenderState renderState) { """ Helper method to call appropriate recycle method depending on current render layout direction @param recycler Current recycler that is attached to RecyclerView @param renderState Current render state. Right now, this object does not change but we may consider moving it out of this view so passing around as a parameter for now, rather than accessing {@link #mRenderState} @see #recycleViewsFromStart(com.twotoasters.android.support.v7.widget.RecyclerView.Recycler, int) @see #recycleViewsFromEnd(com.twotoasters.android.support.v7.widget.RecyclerView.Recycler, int) @see com.twotoasters.android.support.v7.widget.LinearLayoutManager.RenderState#mLayoutDirection """ if (renderState.mLayoutDirection == RenderState.LAYOUT_START) { recycleViewsFromEnd(recycler, renderState.mScrollingOffset); } else { recycleViewsFromStart(recycler, renderState.mScrollingOffset); } }
java
protected void recycleByRenderState(RecyclerView.Recycler recycler, RenderState renderState) { if (renderState.mLayoutDirection == RenderState.LAYOUT_START) { recycleViewsFromEnd(recycler, renderState.mScrollingOffset); } else { recycleViewsFromStart(recycler, renderState.mScrollingOffset); } }
[ "protected", "void", "recycleByRenderState", "(", "RecyclerView", ".", "Recycler", "recycler", ",", "RenderState", "renderState", ")", "{", "if", "(", "renderState", ".", "mLayoutDirection", "==", "RenderState", ".", "LAYOUT_START", ")", "{", "recycleViewsFromEnd", "(", "recycler", ",", "renderState", ".", "mScrollingOffset", ")", ";", "}", "else", "{", "recycleViewsFromStart", "(", "recycler", ",", "renderState", ".", "mScrollingOffset", ")", ";", "}", "}" ]
Helper method to call appropriate recycle method depending on current render layout direction @param recycler Current recycler that is attached to RecyclerView @param renderState Current render state. Right now, this object does not change but we may consider moving it out of this view so passing around as a parameter for now, rather than accessing {@link #mRenderState} @see #recycleViewsFromStart(com.twotoasters.android.support.v7.widget.RecyclerView.Recycler, int) @see #recycleViewsFromEnd(com.twotoasters.android.support.v7.widget.RecyclerView.Recycler, int) @see com.twotoasters.android.support.v7.widget.LinearLayoutManager.RenderState#mLayoutDirection
[ "Helper", "method", "to", "call", "appropriate", "recycle", "method", "depending", "on", "current", "render", "layout", "direction" ]
train
https://github.com/twotoasters/RecyclerViewLib/blob/2379fd5bbf57d4dfc8b28046b7ace950905c75f0/library/src/main/java/com/twotoasters/layoutmanager/BaseLayoutManager.java#L969-L975
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.order_orderId_status_GET
public OvhOrderStatusEnum order_orderId_status_GET(Long orderId) throws IOException { """ Return status of order REST: GET /me/order/{orderId}/status @param orderId [required] """ String qPath = "/me/order/{orderId}/status"; StringBuilder sb = path(qPath, orderId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrderStatusEnum.class); }
java
public OvhOrderStatusEnum order_orderId_status_GET(Long orderId) throws IOException { String qPath = "/me/order/{orderId}/status"; StringBuilder sb = path(qPath, orderId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrderStatusEnum.class); }
[ "public", "OvhOrderStatusEnum", "order_orderId_status_GET", "(", "Long", "orderId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/order/{orderId}/status\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "orderId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOrderStatusEnum", ".", "class", ")", ";", "}" ]
Return status of order REST: GET /me/order/{orderId}/status @param orderId [required]
[ "Return", "status", "of", "order" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L1884-L1889
joniles/mpxj
src/main/java/net/sf/mpxj/planner/PlannerWriter.java
PlannerWriter.writePredecessors
private void writePredecessors(Task mpxjTask, net.sf.mpxj.planner.schema.Task plannerTask) { """ This method writes predecessor data to a Planner file. We have to deal with a slight anomaly in this method that is introduced by the MPX file format. It would be possible for someone to create an MPX file with both the predecessor list and the unique ID predecessor list populated... which means that we must process both and avoid adding duplicate predecessors. Also interesting to note is that MSP98 populates the predecessor list, not the unique ID predecessor list, as you might expect. @param mpxjTask MPXJ task instance @param plannerTask planner task instance """ Predecessors plannerPredecessors = m_factory.createPredecessors(); plannerTask.setPredecessors(plannerPredecessors); List<Predecessor> predecessorList = plannerPredecessors.getPredecessor(); int id = 0; List<Relation> predecessors = mpxjTask.getPredecessors(); for (Relation rel : predecessors) { Integer taskUniqueID = rel.getTargetTask().getUniqueID(); Predecessor plannerPredecessor = m_factory.createPredecessor(); plannerPredecessor.setId(getIntegerString(++id)); plannerPredecessor.setPredecessorId(getIntegerString(taskUniqueID)); plannerPredecessor.setLag(getDurationString(rel.getLag())); plannerPredecessor.setType(RELATIONSHIP_TYPES.get(rel.getType())); predecessorList.add(plannerPredecessor); m_eventManager.fireRelationWrittenEvent(rel); } }
java
private void writePredecessors(Task mpxjTask, net.sf.mpxj.planner.schema.Task plannerTask) { Predecessors plannerPredecessors = m_factory.createPredecessors(); plannerTask.setPredecessors(plannerPredecessors); List<Predecessor> predecessorList = plannerPredecessors.getPredecessor(); int id = 0; List<Relation> predecessors = mpxjTask.getPredecessors(); for (Relation rel : predecessors) { Integer taskUniqueID = rel.getTargetTask().getUniqueID(); Predecessor plannerPredecessor = m_factory.createPredecessor(); plannerPredecessor.setId(getIntegerString(++id)); plannerPredecessor.setPredecessorId(getIntegerString(taskUniqueID)); plannerPredecessor.setLag(getDurationString(rel.getLag())); plannerPredecessor.setType(RELATIONSHIP_TYPES.get(rel.getType())); predecessorList.add(plannerPredecessor); m_eventManager.fireRelationWrittenEvent(rel); } }
[ "private", "void", "writePredecessors", "(", "Task", "mpxjTask", ",", "net", ".", "sf", ".", "mpxj", ".", "planner", ".", "schema", ".", "Task", "plannerTask", ")", "{", "Predecessors", "plannerPredecessors", "=", "m_factory", ".", "createPredecessors", "(", ")", ";", "plannerTask", ".", "setPredecessors", "(", "plannerPredecessors", ")", ";", "List", "<", "Predecessor", ">", "predecessorList", "=", "plannerPredecessors", ".", "getPredecessor", "(", ")", ";", "int", "id", "=", "0", ";", "List", "<", "Relation", ">", "predecessors", "=", "mpxjTask", ".", "getPredecessors", "(", ")", ";", "for", "(", "Relation", "rel", ":", "predecessors", ")", "{", "Integer", "taskUniqueID", "=", "rel", ".", "getTargetTask", "(", ")", ".", "getUniqueID", "(", ")", ";", "Predecessor", "plannerPredecessor", "=", "m_factory", ".", "createPredecessor", "(", ")", ";", "plannerPredecessor", ".", "setId", "(", "getIntegerString", "(", "++", "id", ")", ")", ";", "plannerPredecessor", ".", "setPredecessorId", "(", "getIntegerString", "(", "taskUniqueID", ")", ")", ";", "plannerPredecessor", ".", "setLag", "(", "getDurationString", "(", "rel", ".", "getLag", "(", ")", ")", ")", ";", "plannerPredecessor", ".", "setType", "(", "RELATIONSHIP_TYPES", ".", "get", "(", "rel", ".", "getType", "(", ")", ")", ")", ";", "predecessorList", ".", "add", "(", "plannerPredecessor", ")", ";", "m_eventManager", ".", "fireRelationWrittenEvent", "(", "rel", ")", ";", "}", "}" ]
This method writes predecessor data to a Planner file. We have to deal with a slight anomaly in this method that is introduced by the MPX file format. It would be possible for someone to create an MPX file with both the predecessor list and the unique ID predecessor list populated... which means that we must process both and avoid adding duplicate predecessors. Also interesting to note is that MSP98 populates the predecessor list, not the unique ID predecessor list, as you might expect. @param mpxjTask MPXJ task instance @param plannerTask planner task instance
[ "This", "method", "writes", "predecessor", "data", "to", "a", "Planner", "file", ".", "We", "have", "to", "deal", "with", "a", "slight", "anomaly", "in", "this", "method", "that", "is", "introduced", "by", "the", "MPX", "file", "format", ".", "It", "would", "be", "possible", "for", "someone", "to", "create", "an", "MPX", "file", "with", "both", "the", "predecessor", "list", "and", "the", "unique", "ID", "predecessor", "list", "populated", "...", "which", "means", "that", "we", "must", "process", "both", "and", "avoid", "adding", "duplicate", "predecessors", ".", "Also", "interesting", "to", "note", "is", "that", "MSP98", "populates", "the", "predecessor", "list", "not", "the", "unique", "ID", "predecessor", "list", "as", "you", "might", "expect", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/planner/PlannerWriter.java#L510-L529
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/compare/SimpleCompareFileExtensions.java
SimpleCompareFileExtensions.compareFilesByLength
public static boolean compareFilesByLength(final File sourceFile, final File fileToCompare) { """ Compare files by length. @param sourceFile the source file @param fileToCompare the file to compare @return true if the length are equal, otherwise false. """ return CompareFileExtensions .compareFiles(sourceFile, fileToCompare, true, true, false, true, true, true) .getLengthEquality(); }
java
public static boolean compareFilesByLength(final File sourceFile, final File fileToCompare) { return CompareFileExtensions .compareFiles(sourceFile, fileToCompare, true, true, false, true, true, true) .getLengthEquality(); }
[ "public", "static", "boolean", "compareFilesByLength", "(", "final", "File", "sourceFile", ",", "final", "File", "fileToCompare", ")", "{", "return", "CompareFileExtensions", ".", "compareFiles", "(", "sourceFile", ",", "fileToCompare", ",", "true", ",", "true", ",", "false", ",", "true", ",", "true", ",", "true", ")", ".", "getLengthEquality", "(", ")", ";", "}" ]
Compare files by length. @param sourceFile the source file @param fileToCompare the file to compare @return true if the length are equal, otherwise false.
[ "Compare", "files", "by", "length", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/compare/SimpleCompareFileExtensions.java#L180-L185
briandilley/jsonrpc4j
src/main/java/com/googlecode/jsonrpc4j/JsonRpcBasicServer.java
JsonRpcBasicServer.findBestMethodByParamsNode
private AMethodWithItsArgs findBestMethodByParamsNode(Set<Method> methods, JsonNode paramsNode) { """ Finds the {@link Method} from the supplied {@link Set} that best matches the rest of the arguments supplied and returns it as a {@link AMethodWithItsArgs} class. @param methods the {@link Method}s @param paramsNode the {@link JsonNode} passed as the parameters @return the {@link AMethodWithItsArgs} """ if (hasNoParameters(paramsNode)) { return findBestMethodUsingParamIndexes(methods, 0, null); } AMethodWithItsArgs matchedMethod; if (paramsNode.isArray()) { matchedMethod = findBestMethodUsingParamIndexes(methods, paramsNode.size(), ArrayNode.class.cast(paramsNode)); } else if (paramsNode.isObject()) { matchedMethod = findBestMethodUsingParamNames(methods, collectFieldNames(paramsNode), ObjectNode.class.cast(paramsNode)); } else { throw new IllegalArgumentException("Unknown params node type: " + paramsNode.toString()); } if (matchedMethod == null) { matchedMethod = findBestMethodForVarargs(methods, paramsNode); } return matchedMethod; }
java
private AMethodWithItsArgs findBestMethodByParamsNode(Set<Method> methods, JsonNode paramsNode) { if (hasNoParameters(paramsNode)) { return findBestMethodUsingParamIndexes(methods, 0, null); } AMethodWithItsArgs matchedMethod; if (paramsNode.isArray()) { matchedMethod = findBestMethodUsingParamIndexes(methods, paramsNode.size(), ArrayNode.class.cast(paramsNode)); } else if (paramsNode.isObject()) { matchedMethod = findBestMethodUsingParamNames(methods, collectFieldNames(paramsNode), ObjectNode.class.cast(paramsNode)); } else { throw new IllegalArgumentException("Unknown params node type: " + paramsNode.toString()); } if (matchedMethod == null) { matchedMethod = findBestMethodForVarargs(methods, paramsNode); } return matchedMethod; }
[ "private", "AMethodWithItsArgs", "findBestMethodByParamsNode", "(", "Set", "<", "Method", ">", "methods", ",", "JsonNode", "paramsNode", ")", "{", "if", "(", "hasNoParameters", "(", "paramsNode", ")", ")", "{", "return", "findBestMethodUsingParamIndexes", "(", "methods", ",", "0", ",", "null", ")", ";", "}", "AMethodWithItsArgs", "matchedMethod", ";", "if", "(", "paramsNode", ".", "isArray", "(", ")", ")", "{", "matchedMethod", "=", "findBestMethodUsingParamIndexes", "(", "methods", ",", "paramsNode", ".", "size", "(", ")", ",", "ArrayNode", ".", "class", ".", "cast", "(", "paramsNode", ")", ")", ";", "}", "else", "if", "(", "paramsNode", ".", "isObject", "(", ")", ")", "{", "matchedMethod", "=", "findBestMethodUsingParamNames", "(", "methods", ",", "collectFieldNames", "(", "paramsNode", ")", ",", "ObjectNode", ".", "class", ".", "cast", "(", "paramsNode", ")", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "\"Unknown params node type: \"", "+", "paramsNode", ".", "toString", "(", ")", ")", ";", "}", "if", "(", "matchedMethod", "==", "null", ")", "{", "matchedMethod", "=", "findBestMethodForVarargs", "(", "methods", ",", "paramsNode", ")", ";", "}", "return", "matchedMethod", ";", "}" ]
Finds the {@link Method} from the supplied {@link Set} that best matches the rest of the arguments supplied and returns it as a {@link AMethodWithItsArgs} class. @param methods the {@link Method}s @param paramsNode the {@link JsonNode} passed as the parameters @return the {@link AMethodWithItsArgs}
[ "Finds", "the", "{", "@link", "Method", "}", "from", "the", "supplied", "{", "@link", "Set", "}", "that", "best", "matches", "the", "rest", "of", "the", "arguments", "supplied", "and", "returns", "it", "as", "a", "{", "@link", "AMethodWithItsArgs", "}", "class", "." ]
train
https://github.com/briandilley/jsonrpc4j/blob/d749762c9295b92d893677a8c7be2a14dd43b3bb/src/main/java/com/googlecode/jsonrpc4j/JsonRpcBasicServer.java#L618-L634
xebialabs/overcast
src/main/java/com/xebialabs/overcast/OverthereUtil.java
OverthereUtil.copyFiles
public static void copyFiles(OverthereConnection srcHost, OverthereConnection dstHost, List<String> copySpec) { """ Copy files from srcHost to dstHost. Files are copied using overthere. So from file to file or from directory to directory. If copySpec's length is even then files/directories are copied pair wise. If copySpec's lenght is odd then everything is copied into the last entry. """ if (copySpec.isEmpty()) { return; } if (copySpec.size() % 2 == 0) { Iterator<String> toCopy = copySpec.iterator(); while (toCopy.hasNext()) { OverthereFile src = srcHost.getFile(toCopy.next()); OverthereFile dst = dstHost.getFile(toCopy.next()); src.copyTo(dst); } } else { List<String> srcFiles = copySpec.subList(0, copySpec.size() - 1); OverthereFile dst = dstHost.getFile(copySpec.get(copySpec.size() - 1)); Iterator<String> toCopy = srcFiles.iterator(); while (toCopy.hasNext()) { OverthereFile src = srcHost.getFile(toCopy.next()); src.copyTo(dst); } } }
java
public static void copyFiles(OverthereConnection srcHost, OverthereConnection dstHost, List<String> copySpec) { if (copySpec.isEmpty()) { return; } if (copySpec.size() % 2 == 0) { Iterator<String> toCopy = copySpec.iterator(); while (toCopy.hasNext()) { OverthereFile src = srcHost.getFile(toCopy.next()); OverthereFile dst = dstHost.getFile(toCopy.next()); src.copyTo(dst); } } else { List<String> srcFiles = copySpec.subList(0, copySpec.size() - 1); OverthereFile dst = dstHost.getFile(copySpec.get(copySpec.size() - 1)); Iterator<String> toCopy = srcFiles.iterator(); while (toCopy.hasNext()) { OverthereFile src = srcHost.getFile(toCopy.next()); src.copyTo(dst); } } }
[ "public", "static", "void", "copyFiles", "(", "OverthereConnection", "srcHost", ",", "OverthereConnection", "dstHost", ",", "List", "<", "String", ">", "copySpec", ")", "{", "if", "(", "copySpec", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "if", "(", "copySpec", ".", "size", "(", ")", "%", "2", "==", "0", ")", "{", "Iterator", "<", "String", ">", "toCopy", "=", "copySpec", ".", "iterator", "(", ")", ";", "while", "(", "toCopy", ".", "hasNext", "(", ")", ")", "{", "OverthereFile", "src", "=", "srcHost", ".", "getFile", "(", "toCopy", ".", "next", "(", ")", ")", ";", "OverthereFile", "dst", "=", "dstHost", ".", "getFile", "(", "toCopy", ".", "next", "(", ")", ")", ";", "src", ".", "copyTo", "(", "dst", ")", ";", "}", "}", "else", "{", "List", "<", "String", ">", "srcFiles", "=", "copySpec", ".", "subList", "(", "0", ",", "copySpec", ".", "size", "(", ")", "-", "1", ")", ";", "OverthereFile", "dst", "=", "dstHost", ".", "getFile", "(", "copySpec", ".", "get", "(", "copySpec", ".", "size", "(", ")", "-", "1", ")", ")", ";", "Iterator", "<", "String", ">", "toCopy", "=", "srcFiles", ".", "iterator", "(", ")", ";", "while", "(", "toCopy", ".", "hasNext", "(", ")", ")", "{", "OverthereFile", "src", "=", "srcHost", ".", "getFile", "(", "toCopy", ".", "next", "(", ")", ")", ";", "src", ".", "copyTo", "(", "dst", ")", ";", "}", "}", "}" ]
Copy files from srcHost to dstHost. Files are copied using overthere. So from file to file or from directory to directory. If copySpec's length is even then files/directories are copied pair wise. If copySpec's lenght is odd then everything is copied into the last entry.
[ "Copy", "files", "from", "srcHost", "to", "dstHost", ".", "Files", "are", "copied", "using", "overthere", ".", "So", "from", "file", "to", "file", "or", "from", "directory", "to", "directory", ".", "If", "copySpec", "s", "length", "is", "even", "then", "files", "/", "directories", "are", "copied", "pair", "wise", ".", "If", "copySpec", "s", "lenght", "is", "odd", "then", "everything", "is", "copied", "into", "the", "last", "entry", "." ]
train
https://github.com/xebialabs/overcast/blob/716e57b66870c9afe51edc3b6045863a34fb0061/src/main/java/com/xebialabs/overcast/OverthereUtil.java#L86-L108
gallandarakhneorg/afc
advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItinerary.java
BusItinerary.insertBusHaltBefore
public BusItineraryHalt insertBusHaltBefore(BusItineraryHalt beforeHalt, UUID id, BusItineraryHaltType type) { """ Insert newHalt before beforeHalt in the ordered list of {@link BusItineraryHalt}. @param beforeHalt the halt where insert the new halt @param id id of the new halt @param type the type of bus halt @return the added bus halt, otherwise <code>null</code> """ return this.insertBusHaltBefore(beforeHalt, id, null, type); }
java
public BusItineraryHalt insertBusHaltBefore(BusItineraryHalt beforeHalt, UUID id, BusItineraryHaltType type) { return this.insertBusHaltBefore(beforeHalt, id, null, type); }
[ "public", "BusItineraryHalt", "insertBusHaltBefore", "(", "BusItineraryHalt", "beforeHalt", ",", "UUID", "id", ",", "BusItineraryHaltType", "type", ")", "{", "return", "this", ".", "insertBusHaltBefore", "(", "beforeHalt", ",", "id", ",", "null", ",", "type", ")", ";", "}" ]
Insert newHalt before beforeHalt in the ordered list of {@link BusItineraryHalt}. @param beforeHalt the halt where insert the new halt @param id id of the new halt @param type the type of bus halt @return the added bus halt, otherwise <code>null</code>
[ "Insert", "newHalt", "before", "beforeHalt", "in", "the", "ordered", "list", "of", "{", "@link", "BusItineraryHalt", "}", ".", "@param", "beforeHalt", "the", "halt", "where", "insert", "the", "new", "halt", "@param", "id", "id", "of", "the", "new", "halt", "@param", "type", "the", "type", "of", "bus", "halt" ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItinerary.java#L1248-L1250
Azure/azure-sdk-for-java
network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java
VirtualNetworkGatewayConnectionsInner.updateTagsAsync
public Observable<VirtualNetworkGatewayConnectionListEntityInner> updateTagsAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, Map<String, String> tags) { """ Updates a virtual network gateway connection tags. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayConnectionName The name of the virtual network gateway connection. @param tags Resource tags. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return updateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, tags).map(new Func1<ServiceResponse<VirtualNetworkGatewayConnectionListEntityInner>, VirtualNetworkGatewayConnectionListEntityInner>() { @Override public VirtualNetworkGatewayConnectionListEntityInner call(ServiceResponse<VirtualNetworkGatewayConnectionListEntityInner> response) { return response.body(); } }); }
java
public Observable<VirtualNetworkGatewayConnectionListEntityInner> updateTagsAsync(String resourceGroupName, String virtualNetworkGatewayConnectionName, Map<String, String> tags) { return updateTagsWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayConnectionName, tags).map(new Func1<ServiceResponse<VirtualNetworkGatewayConnectionListEntityInner>, VirtualNetworkGatewayConnectionListEntityInner>() { @Override public VirtualNetworkGatewayConnectionListEntityInner call(ServiceResponse<VirtualNetworkGatewayConnectionListEntityInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualNetworkGatewayConnectionListEntityInner", ">", "updateTagsAsync", "(", "String", "resourceGroupName", ",", "String", "virtualNetworkGatewayConnectionName", ",", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "return", "updateTagsWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualNetworkGatewayConnectionName", ",", "tags", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "VirtualNetworkGatewayConnectionListEntityInner", ">", ",", "VirtualNetworkGatewayConnectionListEntityInner", ">", "(", ")", "{", "@", "Override", "public", "VirtualNetworkGatewayConnectionListEntityInner", "call", "(", "ServiceResponse", "<", "VirtualNetworkGatewayConnectionListEntityInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Updates a virtual network gateway connection tags. @param resourceGroupName The name of the resource group. @param virtualNetworkGatewayConnectionName The name of the virtual network gateway connection. @param tags Resource tags. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Updates", "a", "virtual", "network", "gateway", "connection", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/VirtualNetworkGatewayConnectionsInner.java#L638-L645
3pillarlabs/spring-data-simpledb
spring-data-simpledb-impl/src/main/java/org/springframework/data/simpledb/reflection/ReflectionUtils.java
ReflectionUtils.getPropertyField
public static Field getPropertyField(Class<?> clazz, String propertyPath) { """ Retrieve the {@link Field} corresponding to the propertyPath in the given class. @param clazz @param propertyPath @return """ Field propertyField = null; try { String[] properties = propertyPath.split("\\."); Field carField = getDeclaredFieldInHierarchy(clazz, properties[0]); if (properties.length == 1) { propertyField = carField; } else { String cdr = StringUtils.arrayToDelimitedString( Arrays.copyOfRange(properties, 1, properties.length), "."); propertyField = getPropertyField(carField.getType(), cdr); } } catch (Exception e) { throw new IllegalArgumentException("Error accessing propertyPath: " + propertyPath + " on class: " + clazz.getName(), e); } return propertyField; }
java
public static Field getPropertyField(Class<?> clazz, String propertyPath) { Field propertyField = null; try { String[] properties = propertyPath.split("\\."); Field carField = getDeclaredFieldInHierarchy(clazz, properties[0]); if (properties.length == 1) { propertyField = carField; } else { String cdr = StringUtils.arrayToDelimitedString( Arrays.copyOfRange(properties, 1, properties.length), "."); propertyField = getPropertyField(carField.getType(), cdr); } } catch (Exception e) { throw new IllegalArgumentException("Error accessing propertyPath: " + propertyPath + " on class: " + clazz.getName(), e); } return propertyField; }
[ "public", "static", "Field", "getPropertyField", "(", "Class", "<", "?", ">", "clazz", ",", "String", "propertyPath", ")", "{", "Field", "propertyField", "=", "null", ";", "try", "{", "String", "[", "]", "properties", "=", "propertyPath", ".", "split", "(", "\"\\\\.\"", ")", ";", "Field", "carField", "=", "getDeclaredFieldInHierarchy", "(", "clazz", ",", "properties", "[", "0", "]", ")", ";", "if", "(", "properties", ".", "length", "==", "1", ")", "{", "propertyField", "=", "carField", ";", "}", "else", "{", "String", "cdr", "=", "StringUtils", ".", "arrayToDelimitedString", "(", "Arrays", ".", "copyOfRange", "(", "properties", ",", "1", ",", "properties", ".", "length", ")", ",", "\".\"", ")", ";", "propertyField", "=", "getPropertyField", "(", "carField", ".", "getType", "(", ")", ",", "cdr", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Error accessing propertyPath: \"", "+", "propertyPath", "+", "\" on class: \"", "+", "clazz", ".", "getName", "(", ")", ",", "e", ")", ";", "}", "return", "propertyField", ";", "}" ]
Retrieve the {@link Field} corresponding to the propertyPath in the given class. @param clazz @param propertyPath @return
[ "Retrieve", "the", "{", "@link", "Field", "}", "corresponding", "to", "the", "propertyPath", "in", "the", "given", "class", "." ]
train
https://github.com/3pillarlabs/spring-data-simpledb/blob/f1e0eb4e48ec4674d3966e8f5bc04c95031f93ae/spring-data-simpledb-impl/src/main/java/org/springframework/data/simpledb/reflection/ReflectionUtils.java#L271-L289
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-cache/xwiki-commons-cache-infinispan/src/main/java/org/xwiki/cache/infinispan/internal/InfinispanConfigurationLoader.java
InfinispanConfigurationLoader.customizeEviction
private void customizeEviction(ConfigurationBuilder builder) { """ Customize the eviction configuration. @param buil the configuration builder @param configuration the configuration @return the configuration builder """ EntryEvictionConfiguration eec = (EntryEvictionConfiguration) getCacheConfiguration().get(EntryEvictionConfiguration.CONFIGURATIONID); if (eec != null && eec.getAlgorithm() == EntryEvictionConfiguration.Algorithm.LRU) { //////////////////// // Eviction // Max entries customizeEvictionMaxEntries(builder, eec); //////////////////// // Expiration // Wakeup interval customizeExpirationWakeUpInterval(builder, eec); // Max idle customizeExpirationMaxIdle(builder, eec); // Lifespan customizeExpirationLifespan(builder, eec); } }
java
private void customizeEviction(ConfigurationBuilder builder) { EntryEvictionConfiguration eec = (EntryEvictionConfiguration) getCacheConfiguration().get(EntryEvictionConfiguration.CONFIGURATIONID); if (eec != null && eec.getAlgorithm() == EntryEvictionConfiguration.Algorithm.LRU) { //////////////////// // Eviction // Max entries customizeEvictionMaxEntries(builder, eec); //////////////////// // Expiration // Wakeup interval customizeExpirationWakeUpInterval(builder, eec); // Max idle customizeExpirationMaxIdle(builder, eec); // Lifespan customizeExpirationLifespan(builder, eec); } }
[ "private", "void", "customizeEviction", "(", "ConfigurationBuilder", "builder", ")", "{", "EntryEvictionConfiguration", "eec", "=", "(", "EntryEvictionConfiguration", ")", "getCacheConfiguration", "(", ")", ".", "get", "(", "EntryEvictionConfiguration", ".", "CONFIGURATIONID", ")", ";", "if", "(", "eec", "!=", "null", "&&", "eec", ".", "getAlgorithm", "(", ")", "==", "EntryEvictionConfiguration", ".", "Algorithm", ".", "LRU", ")", "{", "////////////////////", "// Eviction", "// Max entries", "customizeEvictionMaxEntries", "(", "builder", ",", "eec", ")", ";", "////////////////////", "// Expiration", "// Wakeup interval", "customizeExpirationWakeUpInterval", "(", "builder", ",", "eec", ")", ";", "// Max idle", "customizeExpirationMaxIdle", "(", "builder", ",", "eec", ")", ";", "// Lifespan", "customizeExpirationLifespan", "(", "builder", ",", "eec", ")", ";", "}", "}" ]
Customize the eviction configuration. @param buil the configuration builder @param configuration the configuration @return the configuration builder
[ "Customize", "the", "eviction", "configuration", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-cache/xwiki-commons-cache-infinispan/src/main/java/org/xwiki/cache/infinispan/internal/InfinispanConfigurationLoader.java#L74-L96
googleapis/google-cloud-java
google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Statement.java
Statement.executeQuery
public ResultSet executeQuery(ReadContext context, Options.QueryOption... options) { """ Executes the query in {@code context}. {@code statement.executeQuery(context)} is exactly equivalent to {@code context.executeQuery(statement)}. @see ReadContext#executeQuery(Statement, Options.QueryOption...) """ return context.executeQuery(this, options); }
java
public ResultSet executeQuery(ReadContext context, Options.QueryOption... options) { return context.executeQuery(this, options); }
[ "public", "ResultSet", "executeQuery", "(", "ReadContext", "context", ",", "Options", ".", "QueryOption", "...", "options", ")", "{", "return", "context", ".", "executeQuery", "(", "this", ",", "options", ")", ";", "}" ]
Executes the query in {@code context}. {@code statement.executeQuery(context)} is exactly equivalent to {@code context.executeQuery(statement)}. @see ReadContext#executeQuery(Statement, Options.QueryOption...)
[ "Executes", "the", "query", "in", "{", "@code", "context", "}", ".", "{", "@code", "statement", ".", "executeQuery", "(", "context", ")", "}", "is", "exactly", "equivalent", "to", "{", "@code", "context", ".", "executeQuery", "(", "statement", ")", "}", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Statement.java#L135-L137
haifengl/smile
demo/src/main/java/smile/demo/SmileDemo.java
SmileDemo.createAndShowGUI
public static void createAndShowGUI(boolean exitOnClose) { """ Create the GUI and show it. For thread safety, this method should be invoked from the event dispatch thread. """ try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception ex) { try { // If Nimbus is not available, try system look and feel. UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { System.err.println(e); } } //Create and set up the window. JFrame frame = new JFrame("Smile Demo"); frame.setSize(new Dimension(1000, 1000)); frame.setLocationRelativeTo(null); if (exitOnClose) frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); else frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); //Add content to the window. frame.add(new SmileDemo()); //Display the window. frame.pack(); frame.setVisible(true); }
java
public static void createAndShowGUI(boolean exitOnClose) { try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception ex) { try { // If Nimbus is not available, try system look and feel. UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { System.err.println(e); } } //Create and set up the window. JFrame frame = new JFrame("Smile Demo"); frame.setSize(new Dimension(1000, 1000)); frame.setLocationRelativeTo(null); if (exitOnClose) frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); else frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); //Add content to the window. frame.add(new SmileDemo()); //Display the window. frame.pack(); frame.setVisible(true); }
[ "public", "static", "void", "createAndShowGUI", "(", "boolean", "exitOnClose", ")", "{", "try", "{", "for", "(", "LookAndFeelInfo", "info", ":", "UIManager", ".", "getInstalledLookAndFeels", "(", ")", ")", "{", "if", "(", "\"Nimbus\"", ".", "equals", "(", "info", ".", "getName", "(", ")", ")", ")", "{", "UIManager", ".", "setLookAndFeel", "(", "info", ".", "getClassName", "(", ")", ")", ";", "break", ";", "}", "}", "}", "catch", "(", "Exception", "ex", ")", "{", "try", "{", "// If Nimbus is not available, try system look and feel.", "UIManager", ".", "setLookAndFeel", "(", "UIManager", ".", "getSystemLookAndFeelClassName", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "err", ".", "println", "(", "e", ")", ";", "}", "}", "//Create and set up the window.", "JFrame", "frame", "=", "new", "JFrame", "(", "\"Smile Demo\"", ")", ";", "frame", ".", "setSize", "(", "new", "Dimension", "(", "1000", ",", "1000", ")", ")", ";", "frame", ".", "setLocationRelativeTo", "(", "null", ")", ";", "if", "(", "exitOnClose", ")", "frame", ".", "setDefaultCloseOperation", "(", "JFrame", ".", "EXIT_ON_CLOSE", ")", ";", "else", "frame", ".", "setDefaultCloseOperation", "(", "JFrame", ".", "DISPOSE_ON_CLOSE", ")", ";", "//Add content to the window.", "frame", ".", "add", "(", "new", "SmileDemo", "(", ")", ")", ";", "//Display the window.", "frame", ".", "pack", "(", ")", ";", "frame", ".", "setVisible", "(", "true", ")", ";", "}" ]
Create the GUI and show it. For thread safety, this method should be invoked from the event dispatch thread.
[ "Create", "the", "GUI", "and", "show", "it", ".", "For", "thread", "safety", "this", "method", "should", "be", "invoked", "from", "the", "event", "dispatch", "thread", "." ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/demo/src/main/java/smile/demo/SmileDemo.java#L542-L575
Azure/azure-sdk-for-java
datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/VirtualNetworkRulesInner.java
VirtualNetworkRulesInner.updateAsync
public Observable<VirtualNetworkRuleInner> updateAsync(String resourceGroupName, String accountName, String virtualNetworkRuleName, UpdateVirtualNetworkRuleParameters parameters) { """ Updates the specified virtual network rule. @param resourceGroupName The name of the Azure resource group. @param accountName The name of the Data Lake Store account. @param virtualNetworkRuleName The name of the virtual network rule to update. @param parameters Parameters supplied to update the virtual network rule. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualNetworkRuleInner object """ return updateWithServiceResponseAsync(resourceGroupName, accountName, virtualNetworkRuleName, parameters).map(new Func1<ServiceResponse<VirtualNetworkRuleInner>, VirtualNetworkRuleInner>() { @Override public VirtualNetworkRuleInner call(ServiceResponse<VirtualNetworkRuleInner> response) { return response.body(); } }); }
java
public Observable<VirtualNetworkRuleInner> updateAsync(String resourceGroupName, String accountName, String virtualNetworkRuleName, UpdateVirtualNetworkRuleParameters parameters) { return updateWithServiceResponseAsync(resourceGroupName, accountName, virtualNetworkRuleName, parameters).map(new Func1<ServiceResponse<VirtualNetworkRuleInner>, VirtualNetworkRuleInner>() { @Override public VirtualNetworkRuleInner call(ServiceResponse<VirtualNetworkRuleInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualNetworkRuleInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "virtualNetworkRuleName", ",", "UpdateVirtualNetworkRuleParameters", "parameters", ")", "{", "return", "updateWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "virtualNetworkRuleName", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "VirtualNetworkRuleInner", ">", ",", "VirtualNetworkRuleInner", ">", "(", ")", "{", "@", "Override", "public", "VirtualNetworkRuleInner", "call", "(", "ServiceResponse", "<", "VirtualNetworkRuleInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Updates the specified virtual network rule. @param resourceGroupName The name of the Azure resource group. @param accountName The name of the Data Lake Store account. @param virtualNetworkRuleName The name of the virtual network rule to update. @param parameters Parameters supplied to update the virtual network rule. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualNetworkRuleInner object
[ "Updates", "the", "specified", "virtual", "network", "rule", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakestore/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakestore/v2016_11_01/implementation/VirtualNetworkRulesInner.java#L538-L545
foundation-runtime/service-directory
1.2/sd-api/src/main/java/com/cisco/oss/foundation/directory/lookup/DirectoryLookupService.java
DirectoryLookupService.addNotificationHandler
public void addNotificationHandler(String serviceName, NotificationHandler handler) { """ Add a NotificationHandler to the Service. <p/> This method checks the duplicated NotificationHandler for the serviceName, if the NotificationHandler already exists for the serviceName, do nothing. @param serviceName the service name. @param handler the NotificationHandler for the service. """ ServiceInstanceUtils.validateServiceName(serviceName); if (handler == null) { throw new ServiceException(ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR, ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR.getMessageTemplate(), "NotificationHandler"); } List<InstanceChangeListener<ModelServiceInstance>> listeners = changeListenerMap.get(serviceName); if (listeners != null) { for (InstanceChangeListener<ModelServiceInstance> listener : listeners) { if (listener instanceof NotificationHandlerAdapter && ((NotificationHandlerAdapter) listener).getAdapter() == handler) { //exist, log error and return LOGGER.error("Try to register a handler {} that has already been registered.", handler); return; } } } addInstanceChangeListener(serviceName, new NotificationHandlerAdapter(handler)); }
java
public void addNotificationHandler(String serviceName, NotificationHandler handler) { ServiceInstanceUtils.validateServiceName(serviceName); if (handler == null) { throw new ServiceException(ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR, ErrorCode.SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR.getMessageTemplate(), "NotificationHandler"); } List<InstanceChangeListener<ModelServiceInstance>> listeners = changeListenerMap.get(serviceName); if (listeners != null) { for (InstanceChangeListener<ModelServiceInstance> listener : listeners) { if (listener instanceof NotificationHandlerAdapter && ((NotificationHandlerAdapter) listener).getAdapter() == handler) { //exist, log error and return LOGGER.error("Try to register a handler {} that has already been registered.", handler); return; } } } addInstanceChangeListener(serviceName, new NotificationHandlerAdapter(handler)); }
[ "public", "void", "addNotificationHandler", "(", "String", "serviceName", ",", "NotificationHandler", "handler", ")", "{", "ServiceInstanceUtils", ".", "validateServiceName", "(", "serviceName", ")", ";", "if", "(", "handler", "==", "null", ")", "{", "throw", "new", "ServiceException", "(", "ErrorCode", ".", "SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR", ",", "ErrorCode", ".", "SERVICE_DIRECTORY_NULL_ARGUMENT_ERROR", ".", "getMessageTemplate", "(", ")", ",", "\"NotificationHandler\"", ")", ";", "}", "List", "<", "InstanceChangeListener", "<", "ModelServiceInstance", ">", ">", "listeners", "=", "changeListenerMap", ".", "get", "(", "serviceName", ")", ";", "if", "(", "listeners", "!=", "null", ")", "{", "for", "(", "InstanceChangeListener", "<", "ModelServiceInstance", ">", "listener", ":", "listeners", ")", "{", "if", "(", "listener", "instanceof", "NotificationHandlerAdapter", "&&", "(", "(", "NotificationHandlerAdapter", ")", "listener", ")", ".", "getAdapter", "(", ")", "==", "handler", ")", "{", "//exist, log error and return", "LOGGER", ".", "error", "(", "\"Try to register a handler {} that has already been registered.\"", ",", "handler", ")", ";", "return", ";", "}", "}", "}", "addInstanceChangeListener", "(", "serviceName", ",", "new", "NotificationHandlerAdapter", "(", "handler", ")", ")", ";", "}" ]
Add a NotificationHandler to the Service. <p/> This method checks the duplicated NotificationHandler for the serviceName, if the NotificationHandler already exists for the serviceName, do nothing. @param serviceName the service name. @param handler the NotificationHandler for the service.
[ "Add", "a", "NotificationHandler", "to", "the", "Service", ".", "<p", "/", ">", "This", "method", "checks", "the", "duplicated", "NotificationHandler", "for", "the", "serviceName", "if", "the", "NotificationHandler", "already", "exists", "for", "the", "serviceName", "do", "nothing", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/1.2/sd-api/src/main/java/com/cisco/oss/foundation/directory/lookup/DirectoryLookupService.java#L411-L432
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/LongStream.java
LongStream.findLast
@NotNull public OptionalLong findLast() { """ Returns the last element wrapped by {@code OptionalLong} class. If stream is empty, returns {@code OptionalLong.empty()}. <p>This is a short-circuiting terminal operation. @return an {@code OptionalLong} with the last element or {@code OptionalLong.empty()} if the stream is empty @since 1.1.8 """ return reduce(new LongBinaryOperator() { @Override public long applyAsLong(long left, long right) { return right; } }); }
java
@NotNull public OptionalLong findLast() { return reduce(new LongBinaryOperator() { @Override public long applyAsLong(long left, long right) { return right; } }); }
[ "@", "NotNull", "public", "OptionalLong", "findLast", "(", ")", "{", "return", "reduce", "(", "new", "LongBinaryOperator", "(", ")", "{", "@", "Override", "public", "long", "applyAsLong", "(", "long", "left", ",", "long", "right", ")", "{", "return", "right", ";", "}", "}", ")", ";", "}" ]
Returns the last element wrapped by {@code OptionalLong} class. If stream is empty, returns {@code OptionalLong.empty()}. <p>This is a short-circuiting terminal operation. @return an {@code OptionalLong} with the last element or {@code OptionalLong.empty()} if the stream is empty @since 1.1.8
[ "Returns", "the", "last", "element", "wrapped", "by", "{", "@code", "OptionalLong", "}", "class", ".", "If", "stream", "is", "empty", "returns", "{", "@code", "OptionalLong", ".", "empty", "()", "}", "." ]
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/LongStream.java#L1165-L1173
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.deleteCustomEntityRoleAsync
public Observable<OperationStatus> deleteCustomEntityRoleAsync(UUID appId, String versionId, UUID entityId, UUID roleId) { """ Delete an entity role. @param appId The application ID. @param versionId The version ID. @param entityId The entity ID. @param roleId The entity role Id. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object """ return deleteCustomEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
java
public Observable<OperationStatus> deleteCustomEntityRoleAsync(UUID appId, String versionId, UUID entityId, UUID roleId) { return deleteCustomEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() { @Override public OperationStatus call(ServiceResponse<OperationStatus> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatus", ">", "deleteCustomEntityRoleAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ",", "UUID", "roleId", ")", "{", "return", "deleteCustomEntityRoleWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "entityId", ",", "roleId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "OperationStatus", ">", ",", "OperationStatus", ">", "(", ")", "{", "@", "Override", "public", "OperationStatus", "call", "(", "ServiceResponse", "<", "OperationStatus", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Delete an entity role. @param appId The application ID. @param versionId The version ID. @param entityId The entity ID. @param roleId The entity role Id. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatus object
[ "Delete", "an", "entity", "role", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L13897-L13904
VoltDB/voltdb
src/frontend/org/voltdb/utils/CatalogUtil.java
CatalogUtil.getAutoGenDDLFromJar
public static String getAutoGenDDLFromJar(InMemoryJarfile jarfile) throws IOException { """ Get the auto generated DDL from the catalog jar. @param jarfile in-memory catalog jar file @return Auto generated DDL stored in catalog.jar @throws IOException If the catalog or the auto generated ddl cannot be loaded. """ // Read the raw auto generated ddl bytes. byte[] ddlBytes = jarfile.get(VoltCompiler.AUTOGEN_DDL_FILE_NAME); if (ddlBytes == null) { throw new IOException("Auto generated schema DDL not found - please make sure the database is initialized with valid schema."); } String ddl = new String(ddlBytes, StandardCharsets.UTF_8); return ddl.trim(); }
java
public static String getAutoGenDDLFromJar(InMemoryJarfile jarfile) throws IOException { // Read the raw auto generated ddl bytes. byte[] ddlBytes = jarfile.get(VoltCompiler.AUTOGEN_DDL_FILE_NAME); if (ddlBytes == null) { throw new IOException("Auto generated schema DDL not found - please make sure the database is initialized with valid schema."); } String ddl = new String(ddlBytes, StandardCharsets.UTF_8); return ddl.trim(); }
[ "public", "static", "String", "getAutoGenDDLFromJar", "(", "InMemoryJarfile", "jarfile", ")", "throws", "IOException", "{", "// Read the raw auto generated ddl bytes.", "byte", "[", "]", "ddlBytes", "=", "jarfile", ".", "get", "(", "VoltCompiler", ".", "AUTOGEN_DDL_FILE_NAME", ")", ";", "if", "(", "ddlBytes", "==", "null", ")", "{", "throw", "new", "IOException", "(", "\"Auto generated schema DDL not found - please make sure the database is initialized with valid schema.\"", ")", ";", "}", "String", "ddl", "=", "new", "String", "(", "ddlBytes", ",", "StandardCharsets", ".", "UTF_8", ")", ";", "return", "ddl", ".", "trim", "(", ")", ";", "}" ]
Get the auto generated DDL from the catalog jar. @param jarfile in-memory catalog jar file @return Auto generated DDL stored in catalog.jar @throws IOException If the catalog or the auto generated ddl cannot be loaded.
[ "Get", "the", "auto", "generated", "DDL", "from", "the", "catalog", "jar", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/utils/CatalogUtil.java#L337-L347
UrielCh/ovh-java-sdk
ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java
ApiOvhIp.ip_antihack_ipBlocked_GET
public OvhBlockedIp ip_antihack_ipBlocked_GET(String ip, String ipBlocked) throws IOException { """ Get this object properties REST: GET /ip/{ip}/antihack/{ipBlocked} @param ip [required] @param ipBlocked [required] your IP """ String qPath = "/ip/{ip}/antihack/{ipBlocked}"; StringBuilder sb = path(qPath, ip, ipBlocked); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhBlockedIp.class); }
java
public OvhBlockedIp ip_antihack_ipBlocked_GET(String ip, String ipBlocked) throws IOException { String qPath = "/ip/{ip}/antihack/{ipBlocked}"; StringBuilder sb = path(qPath, ip, ipBlocked); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhBlockedIp.class); }
[ "public", "OvhBlockedIp", "ip_antihack_ipBlocked_GET", "(", "String", "ip", ",", "String", "ipBlocked", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ip/{ip}/antihack/{ipBlocked}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "ip", ",", "ipBlocked", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhBlockedIp", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /ip/{ip}/antihack/{ipBlocked} @param ip [required] @param ipBlocked [required] your IP
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L873-L878
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java
VelocityUtil.getContent
public static String getContent(VelocityEngine ve, String templateFileName, VelocityContext context) { """ 获得指定模板填充后的内容 @param ve 模板引擎 @param templateFileName 模板名称 @param context 上下文(变量值的容器) @return 模板和内容匹配后的内容 """ final StringWriter writer = new StringWriter(); // StringWriter不需要关闭 toWriter(ve, templateFileName, context, writer); return writer.toString(); }
java
public static String getContent(VelocityEngine ve, String templateFileName, VelocityContext context) { final StringWriter writer = new StringWriter(); // StringWriter不需要关闭 toWriter(ve, templateFileName, context, writer); return writer.toString(); }
[ "public", "static", "String", "getContent", "(", "VelocityEngine", "ve", ",", "String", "templateFileName", ",", "VelocityContext", "context", ")", "{", "final", "StringWriter", "writer", "=", "new", "StringWriter", "(", ")", ";", "// StringWriter不需要关闭\r", "toWriter", "(", "ve", ",", "templateFileName", ",", "context", ",", "writer", ")", ";", "return", "writer", ".", "toString", "(", ")", ";", "}" ]
获得指定模板填充后的内容 @param ve 模板引擎 @param templateFileName 模板名称 @param context 上下文(变量值的容器) @return 模板和内容匹配后的内容
[ "获得指定模板填充后的内容" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/velocity/VelocityUtil.java#L114-L118
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.toSpreadMap
public static SpreadMap toSpreadMap(Iterable self) { """ Creates a spreadable map from this iterable. <p> @param self an iterable @return a newly created SpreadMap @see groovy.lang.SpreadMap#SpreadMap(java.util.List) @see #toSpreadMap(java.util.Map) @since 2.4.0 """ if (self == null) throw new GroovyRuntimeException("Fail to convert Iterable to SpreadMap, because it is null."); else return toSpreadMap(asList(self)); }
java
public static SpreadMap toSpreadMap(Iterable self) { if (self == null) throw new GroovyRuntimeException("Fail to convert Iterable to SpreadMap, because it is null."); else return toSpreadMap(asList(self)); }
[ "public", "static", "SpreadMap", "toSpreadMap", "(", "Iterable", "self", ")", "{", "if", "(", "self", "==", "null", ")", "throw", "new", "GroovyRuntimeException", "(", "\"Fail to convert Iterable to SpreadMap, because it is null.\"", ")", ";", "else", "return", "toSpreadMap", "(", "asList", "(", "self", ")", ")", ";", "}" ]
Creates a spreadable map from this iterable. <p> @param self an iterable @return a newly created SpreadMap @see groovy.lang.SpreadMap#SpreadMap(java.util.List) @see #toSpreadMap(java.util.Map) @since 2.4.0
[ "Creates", "a", "spreadable", "map", "from", "this", "iterable", ".", "<p", ">" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L8577-L8582
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.putAt
public static void putAt(List self, IntRange range, Collection col) { """ List subscript assignment operator when given a range as the index and the assignment operand is a collection. Example: <pre class="groovyTestCase">def myList = [4, 3, 5, 1, 2, 8, 10] myList[3..5] = ["a", true] assert myList == [4, 3, 5, "a", true, 10]</pre> Items in the given range are replaced with items from the collection. @param self a List @param range the subset of the list to set @param col the collection of values to put at the given sublist @since 1.5.0 """ List sublist = resizeListWithRangeAndGetSublist(self, range); if (col.isEmpty()) return; sublist.addAll(col); }
java
public static void putAt(List self, IntRange range, Collection col) { List sublist = resizeListWithRangeAndGetSublist(self, range); if (col.isEmpty()) return; sublist.addAll(col); }
[ "public", "static", "void", "putAt", "(", "List", "self", ",", "IntRange", "range", ",", "Collection", "col", ")", "{", "List", "sublist", "=", "resizeListWithRangeAndGetSublist", "(", "self", ",", "range", ")", ";", "if", "(", "col", ".", "isEmpty", "(", ")", ")", "return", ";", "sublist", ".", "addAll", "(", "col", ")", ";", "}" ]
List subscript assignment operator when given a range as the index and the assignment operand is a collection. Example: <pre class="groovyTestCase">def myList = [4, 3, 5, 1, 2, 8, 10] myList[3..5] = ["a", true] assert myList == [4, 3, 5, "a", true, 10]</pre> Items in the given range are replaced with items from the collection. @param self a List @param range the subset of the list to set @param col the collection of values to put at the given sublist @since 1.5.0
[ "List", "subscript", "assignment", "operator", "when", "given", "a", "range", "as", "the", "index", "and", "the", "assignment", "operand", "is", "a", "collection", ".", "Example", ":", "<pre", "class", "=", "groovyTestCase", ">", "def", "myList", "=", "[", "4", "3", "5", "1", "2", "8", "10", "]", "myList", "[", "3", "..", "5", "]", "=", "[", "a", "true", "]", "assert", "myList", "==", "[", "4", "3", "5", "a", "true", "10", "]", "<", "/", "pre", ">" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L8044-L8048
azkaban/azkaban
az-core/src/main/java/azkaban/utils/Props.java
Props.getUri
public URI getUri(final String name, final URI defaultValue) { """ Returns the double representation of the value. If the value is null, then the default value is returned. If the value isn't a uri, then a IllegalArgumentException will be thrown. """ if (containsKey(name)) { return getUri(name); } else { return defaultValue; } }
java
public URI getUri(final String name, final URI defaultValue) { if (containsKey(name)) { return getUri(name); } else { return defaultValue; } }
[ "public", "URI", "getUri", "(", "final", "String", "name", ",", "final", "URI", "defaultValue", ")", "{", "if", "(", "containsKey", "(", "name", ")", ")", "{", "return", "getUri", "(", "name", ")", ";", "}", "else", "{", "return", "defaultValue", ";", "}", "}" ]
Returns the double representation of the value. If the value is null, then the default value is returned. If the value isn't a uri, then a IllegalArgumentException will be thrown.
[ "Returns", "the", "double", "representation", "of", "the", "value", ".", "If", "the", "value", "is", "null", "then", "the", "default", "value", "is", "returned", ".", "If", "the", "value", "isn", "t", "a", "uri", "then", "a", "IllegalArgumentException", "will", "be", "thrown", "." ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-core/src/main/java/azkaban/utils/Props.java#L629-L635
libgdx/box2dlights
src/box2dLight/RayHandler.java
RayHandler.useCustomViewport
public void useCustomViewport(int x, int y, int width, int height) { """ Sets rendering to custom viewport with specified position and size <p>Note: you will be responsible for update of viewport via this method in case of any changes (on resize) """ customViewport = true; viewportX = x; viewportY = y; viewportWidth = width; viewportHeight = height; }
java
public void useCustomViewport(int x, int y, int width, int height) { customViewport = true; viewportX = x; viewportY = y; viewportWidth = width; viewportHeight = height; }
[ "public", "void", "useCustomViewport", "(", "int", "x", ",", "int", "y", ",", "int", "width", ",", "int", "height", ")", "{", "customViewport", "=", "true", ";", "viewportX", "=", "x", ";", "viewportY", "=", "y", ";", "viewportWidth", "=", "width", ";", "viewportHeight", "=", "height", ";", "}" ]
Sets rendering to custom viewport with specified position and size <p>Note: you will be responsible for update of viewport via this method in case of any changes (on resize)
[ "Sets", "rendering", "to", "custom", "viewport", "with", "specified", "position", "and", "size", "<p", ">", "Note", ":", "you", "will", "be", "responsible", "for", "update", "of", "viewport", "via", "this", "method", "in", "case", "of", "any", "changes", "(", "on", "resize", ")" ]
train
https://github.com/libgdx/box2dlights/blob/08cf93a41464f71d32475aaa2fe280dc6af78ff3/src/box2dLight/RayHandler.java#L594-L600
io7m/jaffirm
com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Preconditions.java
Preconditions.checkPreconditionI
public static int checkPreconditionI( final int value, final IntPredicate predicate, final IntFunction<String> describer) { """ An {@code int} specialized version of {@link #checkPrecondition(Object, ContractConditionType)}. @param value The value @param predicate The predicate @param describer The describer for the predicate @return value @throws PreconditionViolationException If the predicate is false """ final boolean ok; try { ok = predicate.test(value); } catch (final Throwable e) { final Violations violations = singleViolation(failedPredicate(e)); throw new PreconditionViolationException( failedMessage(Integer.valueOf(value), violations), e, violations.count()); } return innerCheckI(value, ok, describer); }
java
public static int checkPreconditionI( final int value, final IntPredicate predicate, final IntFunction<String> describer) { final boolean ok; try { ok = predicate.test(value); } catch (final Throwable e) { final Violations violations = singleViolation(failedPredicate(e)); throw new PreconditionViolationException( failedMessage(Integer.valueOf(value), violations), e, violations.count()); } return innerCheckI(value, ok, describer); }
[ "public", "static", "int", "checkPreconditionI", "(", "final", "int", "value", ",", "final", "IntPredicate", "predicate", ",", "final", "IntFunction", "<", "String", ">", "describer", ")", "{", "final", "boolean", "ok", ";", "try", "{", "ok", "=", "predicate", ".", "test", "(", "value", ")", ";", "}", "catch", "(", "final", "Throwable", "e", ")", "{", "final", "Violations", "violations", "=", "singleViolation", "(", "failedPredicate", "(", "e", ")", ")", ";", "throw", "new", "PreconditionViolationException", "(", "failedMessage", "(", "Integer", ".", "valueOf", "(", "value", ")", ",", "violations", ")", ",", "e", ",", "violations", ".", "count", "(", ")", ")", ";", "}", "return", "innerCheckI", "(", "value", ",", "ok", ",", "describer", ")", ";", "}" ]
An {@code int} specialized version of {@link #checkPrecondition(Object, ContractConditionType)}. @param value The value @param predicate The predicate @param describer The describer for the predicate @return value @throws PreconditionViolationException If the predicate is false
[ "An", "{", "@code", "int", "}", "specialized", "version", "of", "{", "@link", "#checkPrecondition", "(", "Object", "ContractConditionType", ")", "}", "." ]
train
https://github.com/io7m/jaffirm/blob/c97d246242d381e48832838737418cfe4cb57b4d/com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Preconditions.java#L377-L392
hazelcast/hazelcast-kubernetes
src/main/java/com/hazelcast/kubernetes/RetryUtils.java
RetryUtils.retry
public static <T> T retry(Callable<T> callable, int retries, List<String> nonRetryableKeywords) { """ Calls {@code callable.call()} until it does not throw an exception (but no more than {@code retries} times). <p> Note that {@code callable} should be an idempotent operation which is a call to the Kubernetes master. <p> If {@code callable} throws an unchecked exception, it is wrapped into {@link HazelcastException}. """ int retryCount = 0; while (true) { try { return callable.call(); } catch (Exception e) { retryCount++; if (retryCount > retries || containsAnyOf(e, nonRetryableKeywords)) { throw ExceptionUtil.rethrow(e); } long waitIntervalMs = backoffIntervalForRetry(retryCount); LOGGER.warning( String.format("Couldn't discover Hazelcast members using Kubernetes API, [%s] retrying in %s seconds...", retryCount, waitIntervalMs / MS_IN_SECOND)); sleep(waitIntervalMs); } } }
java
public static <T> T retry(Callable<T> callable, int retries, List<String> nonRetryableKeywords) { int retryCount = 0; while (true) { try { return callable.call(); } catch (Exception e) { retryCount++; if (retryCount > retries || containsAnyOf(e, nonRetryableKeywords)) { throw ExceptionUtil.rethrow(e); } long waitIntervalMs = backoffIntervalForRetry(retryCount); LOGGER.warning( String.format("Couldn't discover Hazelcast members using Kubernetes API, [%s] retrying in %s seconds...", retryCount, waitIntervalMs / MS_IN_SECOND)); sleep(waitIntervalMs); } } }
[ "public", "static", "<", "T", ">", "T", "retry", "(", "Callable", "<", "T", ">", "callable", ",", "int", "retries", ",", "List", "<", "String", ">", "nonRetryableKeywords", ")", "{", "int", "retryCount", "=", "0", ";", "while", "(", "true", ")", "{", "try", "{", "return", "callable", ".", "call", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "retryCount", "++", ";", "if", "(", "retryCount", ">", "retries", "||", "containsAnyOf", "(", "e", ",", "nonRetryableKeywords", ")", ")", "{", "throw", "ExceptionUtil", ".", "rethrow", "(", "e", ")", ";", "}", "long", "waitIntervalMs", "=", "backoffIntervalForRetry", "(", "retryCount", ")", ";", "LOGGER", ".", "warning", "(", "String", ".", "format", "(", "\"Couldn't discover Hazelcast members using Kubernetes API, [%s] retrying in %s seconds...\"", ",", "retryCount", ",", "waitIntervalMs", "/", "MS_IN_SECOND", ")", ")", ";", "sleep", "(", "waitIntervalMs", ")", ";", "}", "}", "}" ]
Calls {@code callable.call()} until it does not throw an exception (but no more than {@code retries} times). <p> Note that {@code callable} should be an idempotent operation which is a call to the Kubernetes master. <p> If {@code callable} throws an unchecked exception, it is wrapped into {@link HazelcastException}.
[ "Calls", "{" ]
train
https://github.com/hazelcast/hazelcast-kubernetes/blob/b1144067addf56d1446a9e1007f5cb3290b86815/src/main/java/com/hazelcast/kubernetes/RetryUtils.java#L49-L66
google/auto
service/processor/src/main/java/com/google/auto/service/processor/AutoServiceProcessor.java
AutoServiceProcessor.getValueFieldOfClasses
private ImmutableSet<DeclaredType> getValueFieldOfClasses(AnnotationMirror annotationMirror) { """ Returns the contents of a {@code Class[]}-typed "value" field in a given {@code annotationMirror}. """ return getAnnotationValue(annotationMirror, "value") .accept( new SimpleAnnotationValueVisitor8<ImmutableSet<DeclaredType>, Void>() { @Override public ImmutableSet<DeclaredType> visitType(TypeMirror typeMirror, Void v) { // TODO(ronshapiro): class literals may not always be declared types, i.e. int.class, // int[].class return ImmutableSet.of(MoreTypes.asDeclared(typeMirror)); } @Override public ImmutableSet<DeclaredType> visitArray( List<? extends AnnotationValue> values, Void v) { return values .stream() .flatMap(value -> value.accept(this, null).stream()) .collect(toImmutableSet()); } }, null); }
java
private ImmutableSet<DeclaredType> getValueFieldOfClasses(AnnotationMirror annotationMirror) { return getAnnotationValue(annotationMirror, "value") .accept( new SimpleAnnotationValueVisitor8<ImmutableSet<DeclaredType>, Void>() { @Override public ImmutableSet<DeclaredType> visitType(TypeMirror typeMirror, Void v) { // TODO(ronshapiro): class literals may not always be declared types, i.e. int.class, // int[].class return ImmutableSet.of(MoreTypes.asDeclared(typeMirror)); } @Override public ImmutableSet<DeclaredType> visitArray( List<? extends AnnotationValue> values, Void v) { return values .stream() .flatMap(value -> value.accept(this, null).stream()) .collect(toImmutableSet()); } }, null); }
[ "private", "ImmutableSet", "<", "DeclaredType", ">", "getValueFieldOfClasses", "(", "AnnotationMirror", "annotationMirror", ")", "{", "return", "getAnnotationValue", "(", "annotationMirror", ",", "\"value\"", ")", ".", "accept", "(", "new", "SimpleAnnotationValueVisitor8", "<", "ImmutableSet", "<", "DeclaredType", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "ImmutableSet", "<", "DeclaredType", ">", "visitType", "(", "TypeMirror", "typeMirror", ",", "Void", "v", ")", "{", "// TODO(ronshapiro): class literals may not always be declared types, i.e. int.class,", "// int[].class", "return", "ImmutableSet", ".", "of", "(", "MoreTypes", ".", "asDeclared", "(", "typeMirror", ")", ")", ";", "}", "@", "Override", "public", "ImmutableSet", "<", "DeclaredType", ">", "visitArray", "(", "List", "<", "?", "extends", "AnnotationValue", ">", "values", ",", "Void", "v", ")", "{", "return", "values", ".", "stream", "(", ")", ".", "flatMap", "(", "value", "->", "value", ".", "accept", "(", "this", ",", "null", ")", ".", "stream", "(", ")", ")", ".", "collect", "(", "toImmutableSet", "(", ")", ")", ";", "}", "}", ",", "null", ")", ";", "}" ]
Returns the contents of a {@code Class[]}-typed "value" field in a given {@code annotationMirror}.
[ "Returns", "the", "contents", "of", "a", "{" ]
train
https://github.com/google/auto/blob/4158a5fa71f1ef763e683b627f4d29bc04cfde9d/service/processor/src/main/java/com/google/auto/service/processor/AutoServiceProcessor.java#L258-L279
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java
RTFEmbeddedObject.readDataBlock
private static int readDataBlock(String text, int offset, int length, List<byte[]> blocks) { """ Reads a data block and adds it to the list of blocks. @param text RTF data @param offset current offset @param length next block length @param blocks list of blocks @return next offset """ int bytes = length / 2; byte[] data = new byte[bytes]; for (int index = 0; index < bytes; index++) { data[index] = (byte) Integer.parseInt(text.substring(offset, offset + 2), 16); offset += 2; } blocks.add(data); return (offset); }
java
private static int readDataBlock(String text, int offset, int length, List<byte[]> blocks) { int bytes = length / 2; byte[] data = new byte[bytes]; for (int index = 0; index < bytes; index++) { data[index] = (byte) Integer.parseInt(text.substring(offset, offset + 2), 16); offset += 2; } blocks.add(data); return (offset); }
[ "private", "static", "int", "readDataBlock", "(", "String", "text", ",", "int", "offset", ",", "int", "length", ",", "List", "<", "byte", "[", "]", ">", "blocks", ")", "{", "int", "bytes", "=", "length", "/", "2", ";", "byte", "[", "]", "data", "=", "new", "byte", "[", "bytes", "]", ";", "for", "(", "int", "index", "=", "0", ";", "index", "<", "bytes", ";", "index", "++", ")", "{", "data", "[", "index", "]", "=", "(", "byte", ")", "Integer", ".", "parseInt", "(", "text", ".", "substring", "(", "offset", ",", "offset", "+", "2", ")", ",", "16", ")", ";", "offset", "+=", "2", ";", "}", "blocks", ".", "add", "(", "data", ")", ";", "return", "(", "offset", ")", ";", "}" ]
Reads a data block and adds it to the list of blocks. @param text RTF data @param offset current offset @param length next block length @param blocks list of blocks @return next offset
[ "Reads", "a", "data", "block", "and", "adds", "it", "to", "the", "list", "of", "blocks", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java#L369-L382
vtatai/srec
core/src/main/java/com/github/srec/util/Utils.java
Utils.groovyEvaluate
public static Object groovyEvaluate(ExecutionContext context, String expression) { """ Evaluates an expression using Groovy. All VarCommands inside the context are used in order to evaluate the given expression. @param context The EC @param expression The expression to evaluate @return The value """ Binding binding = new Binding(); for (Map.Entry<String, CommandSymbol> entry : context.getSymbols().entrySet()) { final CommandSymbol symbol = entry.getValue(); if (symbol instanceof VarCommand) { binding.setVariable(entry.getKey(), convertToJava(((VarCommand) symbol).getValue(context))); } } GroovyShell shell = new GroovyShell(binding); final Object o = shell.evaluate(expression); if (o instanceof GString) { return o.toString(); } return o; }
java
public static Object groovyEvaluate(ExecutionContext context, String expression) { Binding binding = new Binding(); for (Map.Entry<String, CommandSymbol> entry : context.getSymbols().entrySet()) { final CommandSymbol symbol = entry.getValue(); if (symbol instanceof VarCommand) { binding.setVariable(entry.getKey(), convertToJava(((VarCommand) symbol).getValue(context))); } } GroovyShell shell = new GroovyShell(binding); final Object o = shell.evaluate(expression); if (o instanceof GString) { return o.toString(); } return o; }
[ "public", "static", "Object", "groovyEvaluate", "(", "ExecutionContext", "context", ",", "String", "expression", ")", "{", "Binding", "binding", "=", "new", "Binding", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "CommandSymbol", ">", "entry", ":", "context", ".", "getSymbols", "(", ")", ".", "entrySet", "(", ")", ")", "{", "final", "CommandSymbol", "symbol", "=", "entry", ".", "getValue", "(", ")", ";", "if", "(", "symbol", "instanceof", "VarCommand", ")", "{", "binding", ".", "setVariable", "(", "entry", ".", "getKey", "(", ")", ",", "convertToJava", "(", "(", "(", "VarCommand", ")", "symbol", ")", ".", "getValue", "(", "context", ")", ")", ")", ";", "}", "}", "GroovyShell", "shell", "=", "new", "GroovyShell", "(", "binding", ")", ";", "final", "Object", "o", "=", "shell", ".", "evaluate", "(", "expression", ")", ";", "if", "(", "o", "instanceof", "GString", ")", "{", "return", "o", ".", "toString", "(", ")", ";", "}", "return", "o", ";", "}" ]
Evaluates an expression using Groovy. All VarCommands inside the context are used in order to evaluate the given expression. @param context The EC @param expression The expression to evaluate @return The value
[ "Evaluates", "an", "expression", "using", "Groovy", ".", "All", "VarCommands", "inside", "the", "context", "are", "used", "in", "order", "to", "evaluate", "the", "given", "expression", "." ]
train
https://github.com/vtatai/srec/blob/87fa6754a6a5f8569ef628db4d149eea04062568/core/src/main/java/com/github/srec/util/Utils.java#L243-L257
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java
Utils.isSubclassOf
public boolean isSubclassOf(TypeElement t1, TypeElement t2) { """ Test whether a class is a subclass of another class. @param t1 the candidate superclass. @param t2 the target @return true if t1 is a superclass of t2. """ return typeUtils.isSubtype(t1.asType(), t2.asType()); }
java
public boolean isSubclassOf(TypeElement t1, TypeElement t2) { return typeUtils.isSubtype(t1.asType(), t2.asType()); }
[ "public", "boolean", "isSubclassOf", "(", "TypeElement", "t1", ",", "TypeElement", "t2", ")", "{", "return", "typeUtils", ".", "isSubtype", "(", "t1", ".", "asType", "(", ")", ",", "t2", ".", "asType", "(", ")", ")", ";", "}" ]
Test whether a class is a subclass of another class. @param t1 the candidate superclass. @param t2 the target @return true if t1 is a superclass of t2.
[ "Test", "whether", "a", "class", "is", "a", "subclass", "of", "another", "class", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java#L216-L218
roskenet/springboot-javafx-support
src/main/java/de/felixroske/jfxsupport/AbstractFxmlView.java
AbstractFxmlView.loadSynchronously
private FXMLLoader loadSynchronously(final URL resource, final Optional<ResourceBundle> bundle) throws IllegalStateException { """ Load synchronously. @param resource the resource @param bundle the bundle @return the FXML loader @throws IllegalStateException the illegal state exception """ final FXMLLoader loader = new FXMLLoader(resource, bundle.orElse(null)); loader.setControllerFactory(this::createControllerForType); try { loader.load(); } catch (final IOException | IllegalStateException e) { throw new IllegalStateException("Cannot load " + getConventionalName(), e); } return loader; }
java
private FXMLLoader loadSynchronously(final URL resource, final Optional<ResourceBundle> bundle) throws IllegalStateException { final FXMLLoader loader = new FXMLLoader(resource, bundle.orElse(null)); loader.setControllerFactory(this::createControllerForType); try { loader.load(); } catch (final IOException | IllegalStateException e) { throw new IllegalStateException("Cannot load " + getConventionalName(), e); } return loader; }
[ "private", "FXMLLoader", "loadSynchronously", "(", "final", "URL", "resource", ",", "final", "Optional", "<", "ResourceBundle", ">", "bundle", ")", "throws", "IllegalStateException", "{", "final", "FXMLLoader", "loader", "=", "new", "FXMLLoader", "(", "resource", ",", "bundle", ".", "orElse", "(", "null", ")", ")", ";", "loader", ".", "setControllerFactory", "(", "this", "::", "createControllerForType", ")", ";", "try", "{", "loader", ".", "load", "(", ")", ";", "}", "catch", "(", "final", "IOException", "|", "IllegalStateException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Cannot load \"", "+", "getConventionalName", "(", ")", ",", "e", ")", ";", "}", "return", "loader", ";", "}" ]
Load synchronously. @param resource the resource @param bundle the bundle @return the FXML loader @throws IllegalStateException the illegal state exception
[ "Load", "synchronously", "." ]
train
https://github.com/roskenet/springboot-javafx-support/blob/aed1da178ecb204eb00508b3ce1e2a11d4fa9619/src/main/java/de/felixroske/jfxsupport/AbstractFxmlView.java#L153-L165
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernel.java
FactoryKernel.table1D_F32
public static Kernel1D_F32 table1D_F32(int radius, boolean normalized) { """ <p> Create an floating point table convolution kernel. If un-normalized then all the elements are equal to one, otherwise they are equal to one over the width. </p> <p> See {@link boofcv.alg.filter.convolve.ConvolveImageBox} or {@link boofcv.alg.filter.convolve.ConvolveImageMean} for faster ways to convolve these kernels. </p> @param radius kernel's radius. @return table kernel. """ Kernel1D_F32 ret = new Kernel1D_F32(radius * 2 + 1); float val = normalized ? 1.0f / ret.width : 1.0f; for (int i = 0; i < ret.data.length; i++) { ret.data[i] = val; } return ret; }
java
public static Kernel1D_F32 table1D_F32(int radius, boolean normalized) { Kernel1D_F32 ret = new Kernel1D_F32(radius * 2 + 1); float val = normalized ? 1.0f / ret.width : 1.0f; for (int i = 0; i < ret.data.length; i++) { ret.data[i] = val; } return ret; }
[ "public", "static", "Kernel1D_F32", "table1D_F32", "(", "int", "radius", ",", "boolean", "normalized", ")", "{", "Kernel1D_F32", "ret", "=", "new", "Kernel1D_F32", "(", "radius", "*", "2", "+", "1", ")", ";", "float", "val", "=", "normalized", "?", "1.0f", "/", "ret", ".", "width", ":", "1.0f", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "ret", ".", "data", ".", "length", ";", "i", "++", ")", "{", "ret", ".", "data", "[", "i", "]", "=", "val", ";", "}", "return", "ret", ";", "}" ]
<p> Create an floating point table convolution kernel. If un-normalized then all the elements are equal to one, otherwise they are equal to one over the width. </p> <p> See {@link boofcv.alg.filter.convolve.ConvolveImageBox} or {@link boofcv.alg.filter.convolve.ConvolveImageMean} for faster ways to convolve these kernels. </p> @param radius kernel's radius. @return table kernel.
[ "<p", ">", "Create", "an", "floating", "point", "table", "convolution", "kernel", ".", "If", "un", "-", "normalized", "then", "all", "the", "elements", "are", "equal", "to", "one", "otherwise", "they", "are", "equal", "to", "one", "over", "the", "width", ".", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/factory/filter/kernel/FactoryKernel.java#L152-L162
actframework/actframework
src/main/java/act/ws/WebSocketContext.java
WebSocketContext.sendToTagged
public WebSocketContext sendToTagged(String message, String tag) { """ Send message to all connections labeled with tag specified with self connection excluded @param message the message to be sent @param tag the string that tag the connections to be sent @return this context """ return sendToTagged(message, tag, false); }
java
public WebSocketContext sendToTagged(String message, String tag) { return sendToTagged(message, tag, false); }
[ "public", "WebSocketContext", "sendToTagged", "(", "String", "message", ",", "String", "tag", ")", "{", "return", "sendToTagged", "(", "message", ",", "tag", ",", "false", ")", ";", "}" ]
Send message to all connections labeled with tag specified with self connection excluded @param message the message to be sent @param tag the string that tag the connections to be sent @return this context
[ "Send", "message", "to", "all", "connections", "labeled", "with", "tag", "specified", "with", "self", "connection", "excluded" ]
train
https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/ws/WebSocketContext.java#L220-L222
alkacon/opencms-core
src/org/opencms/xml/containerpage/CmsADESessionCache.java
CmsADESessionCache.getTemplateBean
public TemplateBean getTemplateBean(String uri, boolean safe) { """ Gets the cached template bean for a given container page uri.<p> @param uri the container page uri @param safe if true, return a valid template bean even if it hasn't been cached before @return the template bean """ TemplateBean templateBean = m_templateBeanCache.get(uri); if ((templateBean != null) || !safe) { return templateBean; } return new TemplateBean("", ""); }
java
public TemplateBean getTemplateBean(String uri, boolean safe) { TemplateBean templateBean = m_templateBeanCache.get(uri); if ((templateBean != null) || !safe) { return templateBean; } return new TemplateBean("", ""); }
[ "public", "TemplateBean", "getTemplateBean", "(", "String", "uri", ",", "boolean", "safe", ")", "{", "TemplateBean", "templateBean", "=", "m_templateBeanCache", ".", "get", "(", "uri", ")", ";", "if", "(", "(", "templateBean", "!=", "null", ")", "||", "!", "safe", ")", "{", "return", "templateBean", ";", "}", "return", "new", "TemplateBean", "(", "\"\"", ",", "\"\"", ")", ";", "}" ]
Gets the cached template bean for a given container page uri.<p> @param uri the container page uri @param safe if true, return a valid template bean even if it hasn't been cached before @return the template bean
[ "Gets", "the", "cached", "template", "bean", "for", "a", "given", "container", "page", "uri", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsADESessionCache.java#L371-L378
azkaban/azkaban
az-core/src/main/java/azkaban/metrics/MetricsManager.java
MetricsManager.addGauge
public <T> void addGauge(final String name, final Supplier<T> gaugeFunc) { """ A {@link Gauge} is an instantaneous reading of a particular value. This method leverages Supplier, a Functional Interface, to get Generics metrics values. With this support, no matter what our interesting metrics is a Double or a Long, we could pass it to Metrics Parser. E.g., in {@link CommonMetrics#setupAllMetrics()}, we construct a supplier lambda by having a AtomicLong object and its get method, in order to collect dbConnection metric. """ this.registry.register(name, (Gauge<T>) gaugeFunc::get); }
java
public <T> void addGauge(final String name, final Supplier<T> gaugeFunc) { this.registry.register(name, (Gauge<T>) gaugeFunc::get); }
[ "public", "<", "T", ">", "void", "addGauge", "(", "final", "String", "name", ",", "final", "Supplier", "<", "T", ">", "gaugeFunc", ")", "{", "this", ".", "registry", ".", "register", "(", "name", ",", "(", "Gauge", "<", "T", ">", ")", "gaugeFunc", "::", "get", ")", ";", "}" ]
A {@link Gauge} is an instantaneous reading of a particular value. This method leverages Supplier, a Functional Interface, to get Generics metrics values. With this support, no matter what our interesting metrics is a Double or a Long, we could pass it to Metrics Parser. E.g., in {@link CommonMetrics#setupAllMetrics()}, we construct a supplier lambda by having a AtomicLong object and its get method, in order to collect dbConnection metric.
[ "A", "{", "@link", "Gauge", "}", "is", "an", "instantaneous", "reading", "of", "a", "particular", "value", ".", "This", "method", "leverages", "Supplier", "a", "Functional", "Interface", "to", "get", "Generics", "metrics", "values", ".", "With", "this", "support", "no", "matter", "what", "our", "interesting", "metrics", "is", "a", "Double", "or", "a", "Long", "we", "could", "pass", "it", "to", "Metrics", "Parser", "." ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-core/src/main/java/azkaban/metrics/MetricsManager.java#L80-L82
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/AbstractFrameModelingVisitor.java
AbstractFrameModelingVisitor.modelNormalInstruction
public void modelNormalInstruction(Instruction ins, int numWordsConsumed, int numWordsProduced) { """ Model the stack for instructions handled by handleNormalInstruction(). Subclasses may override to provide analysis-specific behavior. @param ins the Instruction to model @param numWordsConsumed number of stack words consumed @param numWordsProduced number of stack words produced """ modelInstruction(ins, numWordsConsumed, numWordsProduced, getDefaultValue()); }
java
public void modelNormalInstruction(Instruction ins, int numWordsConsumed, int numWordsProduced) { modelInstruction(ins, numWordsConsumed, numWordsProduced, getDefaultValue()); }
[ "public", "void", "modelNormalInstruction", "(", "Instruction", "ins", ",", "int", "numWordsConsumed", ",", "int", "numWordsProduced", ")", "{", "modelInstruction", "(", "ins", ",", "numWordsConsumed", ",", "numWordsProduced", ",", "getDefaultValue", "(", ")", ")", ";", "}" ]
Model the stack for instructions handled by handleNormalInstruction(). Subclasses may override to provide analysis-specific behavior. @param ins the Instruction to model @param numWordsConsumed number of stack words consumed @param numWordsProduced number of stack words produced
[ "Model", "the", "stack", "for", "instructions", "handled", "by", "handleNormalInstruction", "()", ".", "Subclasses", "may", "override", "to", "provide", "analysis", "-", "specific", "behavior", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/AbstractFrameModelingVisitor.java#L373-L375
jcuda/jcusparse
JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java
JCusparse.cusparseSroti
public static int cusparseSroti( cusparseHandle handle, int nnz, Pointer xVal, Pointer xInd, Pointer y, Pointer c, Pointer s, int idxBase) { """ Description: Givens rotation, where c and s are cosine and sine, x and y are sparse and dense vectors, respectively. """ return checkResult(cusparseSrotiNative(handle, nnz, xVal, xInd, y, c, s, idxBase)); }
java
public static int cusparseSroti( cusparseHandle handle, int nnz, Pointer xVal, Pointer xInd, Pointer y, Pointer c, Pointer s, int idxBase) { return checkResult(cusparseSrotiNative(handle, nnz, xVal, xInd, y, c, s, idxBase)); }
[ "public", "static", "int", "cusparseSroti", "(", "cusparseHandle", "handle", ",", "int", "nnz", ",", "Pointer", "xVal", ",", "Pointer", "xInd", ",", "Pointer", "y", ",", "Pointer", "c", ",", "Pointer", "s", ",", "int", "idxBase", ")", "{", "return", "checkResult", "(", "cusparseSrotiNative", "(", "handle", ",", "nnz", ",", "xVal", ",", "xInd", ",", "y", ",", "c", ",", "s", ",", "idxBase", ")", ")", ";", "}" ]
Description: Givens rotation, where c and s are cosine and sine, x and y are sparse and dense vectors, respectively.
[ "Description", ":", "Givens", "rotation", "where", "c", "and", "s", "are", "cosine", "and", "sine", "x", "and", "y", "are", "sparse", "and", "dense", "vectors", "respectively", "." ]
train
https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L1090-L1101
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/sign/up/SignupFormPanel.java
SignupFormPanel.newForm
@SuppressWarnings( { """ Factory method for creating the Form. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a Form. @param id the id @param model the model @return the form """ "unchecked", "rawtypes" }) protected Form<?> newForm(final String id, final IModel<? extends BaseUsernameSignUpModel> model) { return new Form(id, model); }
java
@SuppressWarnings({ "unchecked", "rawtypes" }) protected Form<?> newForm(final String id, final IModel<? extends BaseUsernameSignUpModel> model) { return new Form(id, model); }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", "}", ")", "protected", "Form", "<", "?", ">", "newForm", "(", "final", "String", "id", ",", "final", "IModel", "<", "?", "extends", "BaseUsernameSignUpModel", ">", "model", ")", "{", "return", "new", "Form", "(", "id", ",", "model", ")", ";", "}" ]
Factory method for creating the Form. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a Form. @param id the id @param model the model @return the form
[ "Factory", "method", "for", "creating", "the", "Form", ".", "This", "method", "is", "invoked", "in", "the", "constructor", "from", "the", "derived", "classes", "and", "can", "be", "overridden", "so", "users", "can", "provide", "their", "own", "version", "of", "a", "Form", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/sign/up/SignupFormPanel.java#L155-L160
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java
ArrayUtil.setOrAppend
public static Object setOrAppend(Object array, int index, Object value) { """ 将元素值设置为数组的某个位置,当给定的index大于数组长度,则追加 @param array 已有数组 @param index 位置,大于长度追加,否则替换 @param value 新值 @return 新数组或原有数组 @since 4.1.2 """ if(index < length(array)) { Array.set(array, index, value); return array; }else { return append(array, value); } }
java
public static Object setOrAppend(Object array, int index, Object value) { if(index < length(array)) { Array.set(array, index, value); return array; }else { return append(array, value); } }
[ "public", "static", "Object", "setOrAppend", "(", "Object", "array", ",", "int", "index", ",", "Object", "value", ")", "{", "if", "(", "index", "<", "length", "(", "array", ")", ")", "{", "Array", ".", "set", "(", "array", ",", "index", ",", "value", ")", ";", "return", "array", ";", "}", "else", "{", "return", "append", "(", "array", ",", "value", ")", ";", "}", "}" ]
将元素值设置为数组的某个位置,当给定的index大于数组长度,则追加 @param array 已有数组 @param index 位置,大于长度追加,否则替换 @param value 新值 @return 新数组或原有数组 @since 4.1.2
[ "将元素值设置为数组的某个位置,当给定的index大于数组长度,则追加" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L435-L442
fabric8io/fabric8-forge
addons/utils/src/main/java/io/fabric8/forge/addon/utils/MavenHelpers.java
MavenHelpers.ensureMavenDependencyAdded
public static boolean ensureMavenDependencyAdded(Project project, DependencyInstaller dependencyInstaller, String groupId, String artifactId, String scope) { """ Returns true if the dependency was added or false if its already there """ List<Dependency> dependencies = project.getFacet(DependencyFacet.class).getEffectiveDependencies(); for (Dependency d : dependencies) { if (groupId.equals(d.getCoordinate().getGroupId()) && artifactId.equals(d.getCoordinate().getArtifactId())) { getLOG().debug("Project already includes: " + groupId + ":" + artifactId + " for version: " + d.getCoordinate().getVersion()); return false; } } DependencyBuilder component = DependencyBuilder.create(). setGroupId(groupId). setArtifactId(artifactId); if (scope != null) { component.setScopeType(scope); } String version = MavenHelpers.getVersion(groupId, artifactId); if (Strings.isNotBlank(version)) { component = component.setVersion(version); getLOG().debug("Adding pom.xml dependency: " + groupId + ":" + artifactId + " version: " + version + " scope: " + scope); } else { getLOG().debug("No version could be found for: " + groupId + ":" + artifactId); } dependencyInstaller.install(project, component); return true; }
java
public static boolean ensureMavenDependencyAdded(Project project, DependencyInstaller dependencyInstaller, String groupId, String artifactId, String scope) { List<Dependency> dependencies = project.getFacet(DependencyFacet.class).getEffectiveDependencies(); for (Dependency d : dependencies) { if (groupId.equals(d.getCoordinate().getGroupId()) && artifactId.equals(d.getCoordinate().getArtifactId())) { getLOG().debug("Project already includes: " + groupId + ":" + artifactId + " for version: " + d.getCoordinate().getVersion()); return false; } } DependencyBuilder component = DependencyBuilder.create(). setGroupId(groupId). setArtifactId(artifactId); if (scope != null) { component.setScopeType(scope); } String version = MavenHelpers.getVersion(groupId, artifactId); if (Strings.isNotBlank(version)) { component = component.setVersion(version); getLOG().debug("Adding pom.xml dependency: " + groupId + ":" + artifactId + " version: " + version + " scope: " + scope); } else { getLOG().debug("No version could be found for: " + groupId + ":" + artifactId); } dependencyInstaller.install(project, component); return true; }
[ "public", "static", "boolean", "ensureMavenDependencyAdded", "(", "Project", "project", ",", "DependencyInstaller", "dependencyInstaller", ",", "String", "groupId", ",", "String", "artifactId", ",", "String", "scope", ")", "{", "List", "<", "Dependency", ">", "dependencies", "=", "project", ".", "getFacet", "(", "DependencyFacet", ".", "class", ")", ".", "getEffectiveDependencies", "(", ")", ";", "for", "(", "Dependency", "d", ":", "dependencies", ")", "{", "if", "(", "groupId", ".", "equals", "(", "d", ".", "getCoordinate", "(", ")", ".", "getGroupId", "(", ")", ")", "&&", "artifactId", ".", "equals", "(", "d", ".", "getCoordinate", "(", ")", ".", "getArtifactId", "(", ")", ")", ")", "{", "getLOG", "(", ")", ".", "debug", "(", "\"Project already includes: \"", "+", "groupId", "+", "\":\"", "+", "artifactId", "+", "\" for version: \"", "+", "d", ".", "getCoordinate", "(", ")", ".", "getVersion", "(", ")", ")", ";", "return", "false", ";", "}", "}", "DependencyBuilder", "component", "=", "DependencyBuilder", ".", "create", "(", ")", ".", "setGroupId", "(", "groupId", ")", ".", "setArtifactId", "(", "artifactId", ")", ";", "if", "(", "scope", "!=", "null", ")", "{", "component", ".", "setScopeType", "(", "scope", ")", ";", "}", "String", "version", "=", "MavenHelpers", ".", "getVersion", "(", "groupId", ",", "artifactId", ")", ";", "if", "(", "Strings", ".", "isNotBlank", "(", "version", ")", ")", "{", "component", "=", "component", ".", "setVersion", "(", "version", ")", ";", "getLOG", "(", ")", ".", "debug", "(", "\"Adding pom.xml dependency: \"", "+", "groupId", "+", "\":\"", "+", "artifactId", "+", "\" version: \"", "+", "version", "+", "\" scope: \"", "+", "scope", ")", ";", "}", "else", "{", "getLOG", "(", ")", ".", "debug", "(", "\"No version could be found for: \"", "+", "groupId", "+", "\":\"", "+", "artifactId", ")", ";", "}", "dependencyInstaller", ".", "install", "(", "project", ",", "component", ")", ";", "return", "true", ";", "}" ]
Returns true if the dependency was added or false if its already there
[ "Returns", "true", "if", "the", "dependency", "was", "added", "or", "false", "if", "its", "already", "there" ]
train
https://github.com/fabric8io/fabric8-forge/blob/a59871bae4d5c5d3ece10f1e8758e73663087f19/addons/utils/src/main/java/io/fabric8/forge/addon/utils/MavenHelpers.java#L121-L147
zaproxy/zaproxy
src/org/zaproxy/zap/utils/FontUtils.java
FontUtils.getFont
public static Font getFont (Font font, int style, Size size) { """ Gets the specified font with the specified style and size, correctly scaled @param style @param size @since 2.7.0 @return """ return getFont(font, size).deriveFont(style); }
java
public static Font getFont (Font font, int style, Size size) { return getFont(font, size).deriveFont(style); }
[ "public", "static", "Font", "getFont", "(", "Font", "font", ",", "int", "style", ",", "Size", "size", ")", "{", "return", "getFont", "(", "font", ",", "size", ")", ".", "deriveFont", "(", "style", ")", ";", "}" ]
Gets the specified font with the specified style and size, correctly scaled @param style @param size @since 2.7.0 @return
[ "Gets", "the", "specified", "font", "with", "the", "specified", "style", "and", "size", "correctly", "scaled" ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/utils/FontUtils.java#L190-L192
gallandarakhneorg/afc
core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/NaryTreeNode.java
NaryTreeNode.addChild
public final boolean addChild(int index, N newChild) { """ Add a child node at the specified index. @param index is the insertion index. @param newChild is the new child to insert. @return <code>true</code> on success, otherwise <code>false</code> """ if (newChild == null) { return false; } final int count = (this.children == null) ? 0 : this.children.size(); final N oldParent = newChild.getParentNode(); if (oldParent != this && oldParent != null) { newChild.removeFromParent(); } final int insertionIndex; if (this.children == null) { this.children = newInternalList(index + 1); } if (index < count) { // set the element insertionIndex = Math.max(index, 0); this.children.add(insertionIndex, newChild); } else { // Resize the array insertionIndex = this.children.size(); this.children.add(newChild); } ++this.notNullChildCount; newChild.setParentNodeReference(toN(), true); firePropertyChildAdded(insertionIndex, newChild); return true; }
java
public final boolean addChild(int index, N newChild) { if (newChild == null) { return false; } final int count = (this.children == null) ? 0 : this.children.size(); final N oldParent = newChild.getParentNode(); if (oldParent != this && oldParent != null) { newChild.removeFromParent(); } final int insertionIndex; if (this.children == null) { this.children = newInternalList(index + 1); } if (index < count) { // set the element insertionIndex = Math.max(index, 0); this.children.add(insertionIndex, newChild); } else { // Resize the array insertionIndex = this.children.size(); this.children.add(newChild); } ++this.notNullChildCount; newChild.setParentNodeReference(toN(), true); firePropertyChildAdded(insertionIndex, newChild); return true; }
[ "public", "final", "boolean", "addChild", "(", "int", "index", ",", "N", "newChild", ")", "{", "if", "(", "newChild", "==", "null", ")", "{", "return", "false", ";", "}", "final", "int", "count", "=", "(", "this", ".", "children", "==", "null", ")", "?", "0", ":", "this", ".", "children", ".", "size", "(", ")", ";", "final", "N", "oldParent", "=", "newChild", ".", "getParentNode", "(", ")", ";", "if", "(", "oldParent", "!=", "this", "&&", "oldParent", "!=", "null", ")", "{", "newChild", ".", "removeFromParent", "(", ")", ";", "}", "final", "int", "insertionIndex", ";", "if", "(", "this", ".", "children", "==", "null", ")", "{", "this", ".", "children", "=", "newInternalList", "(", "index", "+", "1", ")", ";", "}", "if", "(", "index", "<", "count", ")", "{", "// set the element", "insertionIndex", "=", "Math", ".", "max", "(", "index", ",", "0", ")", ";", "this", ".", "children", ".", "add", "(", "insertionIndex", ",", "newChild", ")", ";", "}", "else", "{", "// Resize the array", "insertionIndex", "=", "this", ".", "children", ".", "size", "(", ")", ";", "this", ".", "children", ".", "add", "(", "newChild", ")", ";", "}", "++", "this", ".", "notNullChildCount", ";", "newChild", ".", "setParentNodeReference", "(", "toN", "(", ")", ",", "true", ")", ";", "firePropertyChildAdded", "(", "insertionIndex", ",", "newChild", ")", ";", "return", "true", ";", "}" ]
Add a child node at the specified index. @param index is the insertion index. @param newChild is the new child to insert. @return <code>true</code> on success, otherwise <code>false</code>
[ "Add", "a", "child", "node", "at", "the", "specified", "index", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/NaryTreeNode.java#L341-L375
kuali/ojb-1.0.4
src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java
OjbMemberTagsHandler.isMethod
public void isMethod(String template, Properties attributes) throws XDocletException { """ The <code>isMethod</code> processes the template body if the current member is a method. @param template a <code>String</code> value @param attributes a <code>Properties</code> value @exception XDocletException if an error occurs @doc:tag type="block" """ if (getCurrentMethod() != null) { generate(template); } }
java
public void isMethod(String template, Properties attributes) throws XDocletException { if (getCurrentMethod() != null) { generate(template); } }
[ "public", "void", "isMethod", "(", "String", "template", ",", "Properties", "attributes", ")", "throws", "XDocletException", "{", "if", "(", "getCurrentMethod", "(", ")", "!=", "null", ")", "{", "generate", "(", "template", ")", ";", "}", "}" ]
The <code>isMethod</code> processes the template body if the current member is a method. @param template a <code>String</code> value @param attributes a <code>Properties</code> value @exception XDocletException if an error occurs @doc:tag type="block"
[ "The", "<code", ">", "isMethod<", "/", "code", ">", "processes", "the", "template", "body", "if", "the", "current", "member", "is", "a", "method", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/xdoclet/java/src/xdoclet/modules/ojb/OjbMemberTagsHandler.java#L134-L139
baratine/baratine
web/src/main/java/com/caucho/v5/io/SocketStream.java
SocketStream.readTimeout
@Override public int readTimeout(byte []buf, int offset, int length, long timeout) throws IOException { """ Reads bytes from the socket. @param buf byte buffer receiving the bytes @param offset offset into the buffer @param length number of bytes to read @return number of bytes read or -1 @exception throws ClientDisconnectException if the connection is dropped """ Socket s = _s; if (s == null) { return -1; } int oldTimeout = s.getSoTimeout(); s.setSoTimeout((int) timeout); try { int result = read(buf, offset, length); if (result >= 0) { return result; } else if (_is == null || _is.available() < 0) { return -1; } else { return ReadStream.READ_TIMEOUT; } } finally { s.setSoTimeout(oldTimeout); } }
java
@Override public int readTimeout(byte []buf, int offset, int length, long timeout) throws IOException { Socket s = _s; if (s == null) { return -1; } int oldTimeout = s.getSoTimeout(); s.setSoTimeout((int) timeout); try { int result = read(buf, offset, length); if (result >= 0) { return result; } else if (_is == null || _is.available() < 0) { return -1; } else { return ReadStream.READ_TIMEOUT; } } finally { s.setSoTimeout(oldTimeout); } }
[ "@", "Override", "public", "int", "readTimeout", "(", "byte", "[", "]", "buf", ",", "int", "offset", ",", "int", "length", ",", "long", "timeout", ")", "throws", "IOException", "{", "Socket", "s", "=", "_s", ";", "if", "(", "s", "==", "null", ")", "{", "return", "-", "1", ";", "}", "int", "oldTimeout", "=", "s", ".", "getSoTimeout", "(", ")", ";", "s", ".", "setSoTimeout", "(", "(", "int", ")", "timeout", ")", ";", "try", "{", "int", "result", "=", "read", "(", "buf", ",", "offset", ",", "length", ")", ";", "if", "(", "result", ">=", "0", ")", "{", "return", "result", ";", "}", "else", "if", "(", "_is", "==", "null", "||", "_is", ".", "available", "(", ")", "<", "0", ")", "{", "return", "-", "1", ";", "}", "else", "{", "return", "ReadStream", ".", "READ_TIMEOUT", ";", "}", "}", "finally", "{", "s", ".", "setSoTimeout", "(", "oldTimeout", ")", ";", "}", "}" ]
Reads bytes from the socket. @param buf byte buffer receiving the bytes @param offset offset into the buffer @param length number of bytes to read @return number of bytes read or -1 @exception throws ClientDisconnectException if the connection is dropped
[ "Reads", "bytes", "from", "the", "socket", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/io/SocketStream.java#L242-L270
steveash/jopenfst
src/main/java/com/github/steveash/jopenfst/operations/Determinize.java
Determinize.computeFinalWeight
private double computeFinalWeight(final int outputStateId, final DetStateTuple targetTuple, Deque<DetElement> finalQueue) { """ _this_ new outState a final state, and instead we queue it into a separate queue for later expansion """ UnionWeight<GallicWeight> result = this.unionSemiring.zero(); for (DetElement detElement : targetTuple.getElements()) { State inputState = this.getInputStateForId(detElement.inputStateId); if (this.semiring.isZero(inputState.getFinalWeight())) { continue; // not final so it wont contribute } UnionWeight<GallicWeight> origFinal = UnionWeight.createSingle(GallicWeight.createEmptyLabels( inputState.getFinalWeight())); result = this.unionSemiring.plus(result, this.unionSemiring.times(detElement.residual, origFinal)); } if (this.unionSemiring.isZero(result)) { return this.semiring.zero(); } if (result.size() == 1 && result.get(0).getLabels().isEmpty()) { // by good fortune the residual is just a weight, no path to expand so this new state can have a final weight // set now! with nothing to enqueue return result.get(0).getWeight(); } // this state can't be a final state because we have more path to emit so defer until later; we know that we cant // have any duplicate elements in the finalQueue since we only call computeFinalWeight once for each outputStateId finalQueue.addLast(new DetElement(outputStateId, result)); return this.semiring.zero(); // since we're deferring this weight can't be a final weight }
java
private double computeFinalWeight(final int outputStateId, final DetStateTuple targetTuple, Deque<DetElement> finalQueue) { UnionWeight<GallicWeight> result = this.unionSemiring.zero(); for (DetElement detElement : targetTuple.getElements()) { State inputState = this.getInputStateForId(detElement.inputStateId); if (this.semiring.isZero(inputState.getFinalWeight())) { continue; // not final so it wont contribute } UnionWeight<GallicWeight> origFinal = UnionWeight.createSingle(GallicWeight.createEmptyLabels( inputState.getFinalWeight())); result = this.unionSemiring.plus(result, this.unionSemiring.times(detElement.residual, origFinal)); } if (this.unionSemiring.isZero(result)) { return this.semiring.zero(); } if (result.size() == 1 && result.get(0).getLabels().isEmpty()) { // by good fortune the residual is just a weight, no path to expand so this new state can have a final weight // set now! with nothing to enqueue return result.get(0).getWeight(); } // this state can't be a final state because we have more path to emit so defer until later; we know that we cant // have any duplicate elements in the finalQueue since we only call computeFinalWeight once for each outputStateId finalQueue.addLast(new DetElement(outputStateId, result)); return this.semiring.zero(); // since we're deferring this weight can't be a final weight }
[ "private", "double", "computeFinalWeight", "(", "final", "int", "outputStateId", ",", "final", "DetStateTuple", "targetTuple", ",", "Deque", "<", "DetElement", ">", "finalQueue", ")", "{", "UnionWeight", "<", "GallicWeight", ">", "result", "=", "this", ".", "unionSemiring", ".", "zero", "(", ")", ";", "for", "(", "DetElement", "detElement", ":", "targetTuple", ".", "getElements", "(", ")", ")", "{", "State", "inputState", "=", "this", ".", "getInputStateForId", "(", "detElement", ".", "inputStateId", ")", ";", "if", "(", "this", ".", "semiring", ".", "isZero", "(", "inputState", ".", "getFinalWeight", "(", ")", ")", ")", "{", "continue", ";", "// not final so it wont contribute", "}", "UnionWeight", "<", "GallicWeight", ">", "origFinal", "=", "UnionWeight", ".", "createSingle", "(", "GallicWeight", ".", "createEmptyLabels", "(", "inputState", ".", "getFinalWeight", "(", ")", ")", ")", ";", "result", "=", "this", ".", "unionSemiring", ".", "plus", "(", "result", ",", "this", ".", "unionSemiring", ".", "times", "(", "detElement", ".", "residual", ",", "origFinal", ")", ")", ";", "}", "if", "(", "this", ".", "unionSemiring", ".", "isZero", "(", "result", ")", ")", "{", "return", "this", ".", "semiring", ".", "zero", "(", ")", ";", "}", "if", "(", "result", ".", "size", "(", ")", "==", "1", "&&", "result", ".", "get", "(", "0", ")", ".", "getLabels", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "// by good fortune the residual is just a weight, no path to expand so this new state can have a final weight", "// set now! with nothing to enqueue", "return", "result", ".", "get", "(", "0", ")", ".", "getWeight", "(", ")", ";", "}", "// this state can't be a final state because we have more path to emit so defer until later; we know that we cant", "// have any duplicate elements in the finalQueue since we only call computeFinalWeight once for each outputStateId", "finalQueue", ".", "addLast", "(", "new", "DetElement", "(", "outputStateId", ",", "result", ")", ")", ";", "return", "this", ".", "semiring", ".", "zero", "(", ")", ";", "// since we're deferring this weight can't be a final weight", "}" ]
_this_ new outState a final state, and instead we queue it into a separate queue for later expansion
[ "_this_", "new", "outState", "a", "final", "state", "and", "instead", "we", "queue", "it", "into", "a", "separate", "queue", "for", "later", "expansion" ]
train
https://github.com/steveash/jopenfst/blob/4c675203015c1cfad2072556cb532b6edc73261d/src/main/java/com/github/steveash/jopenfst/operations/Determinize.java#L278-L303
lets-blade/blade
src/main/java/com/blade/kit/ConvertKit.java
ConvertKit.outputStream2String
public static String outputStream2String(final OutputStream out, final String charsetName) { """ outputStream转string按编码 @param out 输出流 @param charsetName 编码格式 @return 字符串 """ if (out == null || isSpace(charsetName)) return null; try { return new String(outputStream2Bytes(out), charsetName); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return null; } }
java
public static String outputStream2String(final OutputStream out, final String charsetName) { if (out == null || isSpace(charsetName)) return null; try { return new String(outputStream2Bytes(out), charsetName); } catch (UnsupportedEncodingException e) { e.printStackTrace(); return null; } }
[ "public", "static", "String", "outputStream2String", "(", "final", "OutputStream", "out", ",", "final", "String", "charsetName", ")", "{", "if", "(", "out", "==", "null", "||", "isSpace", "(", "charsetName", ")", ")", "return", "null", ";", "try", "{", "return", "new", "String", "(", "outputStream2Bytes", "(", "out", ")", ",", "charsetName", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "return", "null", ";", "}", "}" ]
outputStream转string按编码 @param out 输出流 @param charsetName 编码格式 @return 字符串
[ "outputStream转string按编码" ]
train
https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/ConvertKit.java#L372-L380
apereo/cas
support/cas-server-support-saml-idp-metadata/src/main/java/org/apereo/cas/support/saml/services/idp/metadata/cache/resolver/BaseSamlRegisteredServiceMetadataResolver.java
BaseSamlRegisteredServiceMetadataResolver.addMetadataFiltersToMetadataResolver
protected void addMetadataFiltersToMetadataResolver(final AbstractMetadataResolver metadataProvider, final MetadataFilter... metadataFilterList) { """ Add metadata filters to metadata resolver. @param metadataProvider the metadata provider @param metadataFilterList the metadata filter list """ addMetadataFiltersToMetadataResolver(metadataProvider, Arrays.stream(metadataFilterList).collect(Collectors.toList())); }
java
protected void addMetadataFiltersToMetadataResolver(final AbstractMetadataResolver metadataProvider, final MetadataFilter... metadataFilterList) { addMetadataFiltersToMetadataResolver(metadataProvider, Arrays.stream(metadataFilterList).collect(Collectors.toList())); }
[ "protected", "void", "addMetadataFiltersToMetadataResolver", "(", "final", "AbstractMetadataResolver", "metadataProvider", ",", "final", "MetadataFilter", "...", "metadataFilterList", ")", "{", "addMetadataFiltersToMetadataResolver", "(", "metadataProvider", ",", "Arrays", ".", "stream", "(", "metadataFilterList", ")", ".", "collect", "(", "Collectors", ".", "toList", "(", ")", ")", ")", ";", "}" ]
Add metadata filters to metadata resolver. @param metadataProvider the metadata provider @param metadataFilterList the metadata filter list
[ "Add", "metadata", "filters", "to", "metadata", "resolver", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-metadata/src/main/java/org/apereo/cas/support/saml/services/idp/metadata/cache/resolver/BaseSamlRegisteredServiceMetadataResolver.java#L182-L184
googleapis/google-cloud-java
google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/ClusterControllerClient.java
ClusterControllerClient.getCluster
public final Cluster getCluster(String projectId, String region, String clusterName) { """ Gets the resource representation for a cluster in a project. <p>Sample code: <pre><code> try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { String projectId = ""; String region = ""; String clusterName = ""; Cluster response = clusterControllerClient.getCluster(projectId, region, clusterName); } </code></pre> @param projectId Required. The ID of the Google Cloud Platform project that the cluster belongs to. @param region Required. The Cloud Dataproc region in which to handle the request. @param clusterName Required. The cluster name. @throws com.google.api.gax.rpc.ApiException if the remote call fails """ GetClusterRequest request = GetClusterRequest.newBuilder() .setProjectId(projectId) .setRegion(region) .setClusterName(clusterName) .build(); return getCluster(request); }
java
public final Cluster getCluster(String projectId, String region, String clusterName) { GetClusterRequest request = GetClusterRequest.newBuilder() .setProjectId(projectId) .setRegion(region) .setClusterName(clusterName) .build(); return getCluster(request); }
[ "public", "final", "Cluster", "getCluster", "(", "String", "projectId", ",", "String", "region", ",", "String", "clusterName", ")", "{", "GetClusterRequest", "request", "=", "GetClusterRequest", ".", "newBuilder", "(", ")", ".", "setProjectId", "(", "projectId", ")", ".", "setRegion", "(", "region", ")", ".", "setClusterName", "(", "clusterName", ")", ".", "build", "(", ")", ";", "return", "getCluster", "(", "request", ")", ";", "}" ]
Gets the resource representation for a cluster in a project. <p>Sample code: <pre><code> try (ClusterControllerClient clusterControllerClient = ClusterControllerClient.create()) { String projectId = ""; String region = ""; String clusterName = ""; Cluster response = clusterControllerClient.getCluster(projectId, region, clusterName); } </code></pre> @param projectId Required. The ID of the Google Cloud Platform project that the cluster belongs to. @param region Required. The Cloud Dataproc region in which to handle the request. @param clusterName Required. The cluster name. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Gets", "the", "resource", "representation", "for", "a", "cluster", "in", "a", "project", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/ClusterControllerClient.java#L593-L602
paypal/SeLion
client/src/main/java/com/paypal/selion/internal/platform/pageyaml/GuiMapReaderFactory.java
GuiMapReaderFactory.getInstance
public static GuiMapReader getInstance(String pageDomain, String pageClassName) throws IOException { """ Method to get the reader instance depending on the input parameters. @param pageDomain domain folder under which the input data files are present. @param pageClassName Page class name. May not be <code>null</code>, empty, or whitespace. @return DataProvider instance @throws IOException """ logger.entering(new Object[]{pageDomain, pageClassName}); Preconditions.checkArgument(StringUtils.isNotBlank(pageClassName), "pageClassName can not be null, empty, or whitespace"); String guiDataDir = Config.getConfigProperty(ConfigProperty.GUI_DATA_DIR); String processedPageDomain = StringUtils.defaultString(pageDomain, ""); String rawDataFile = guiDataDir + "/" + processedPageDomain + "/" + pageClassName; if (processedPageDomain.isEmpty()) { rawDataFile = guiDataDir + "/" + pageClassName; } String yamlFile = rawDataFile + ".yaml"; String ymlFile = rawDataFile + ".yml"; GuiMapReader dataProvider; if (getFilePath(yamlFile) != null) { dataProvider = YamlReaderFactory.createInstance(yamlFile); } else if (getFilePath(ymlFile) != null) { dataProvider = YamlReaderFactory.createInstance(ymlFile); } else { // Should be a FileNotFoundException? FileNotFoundException e = new FileNotFoundException("Data file does not exist for " + rawDataFile + ". Supported file extensions: yaml, yml."); logger.log(Level.SEVERE, e.getMessage(), e); throw e; } logger.exiting(dataProvider); return dataProvider; }
java
public static GuiMapReader getInstance(String pageDomain, String pageClassName) throws IOException { logger.entering(new Object[]{pageDomain, pageClassName}); Preconditions.checkArgument(StringUtils.isNotBlank(pageClassName), "pageClassName can not be null, empty, or whitespace"); String guiDataDir = Config.getConfigProperty(ConfigProperty.GUI_DATA_DIR); String processedPageDomain = StringUtils.defaultString(pageDomain, ""); String rawDataFile = guiDataDir + "/" + processedPageDomain + "/" + pageClassName; if (processedPageDomain.isEmpty()) { rawDataFile = guiDataDir + "/" + pageClassName; } String yamlFile = rawDataFile + ".yaml"; String ymlFile = rawDataFile + ".yml"; GuiMapReader dataProvider; if (getFilePath(yamlFile) != null) { dataProvider = YamlReaderFactory.createInstance(yamlFile); } else if (getFilePath(ymlFile) != null) { dataProvider = YamlReaderFactory.createInstance(ymlFile); } else { // Should be a FileNotFoundException? FileNotFoundException e = new FileNotFoundException("Data file does not exist for " + rawDataFile + ". Supported file extensions: yaml, yml."); logger.log(Level.SEVERE, e.getMessage(), e); throw e; } logger.exiting(dataProvider); return dataProvider; }
[ "public", "static", "GuiMapReader", "getInstance", "(", "String", "pageDomain", ",", "String", "pageClassName", ")", "throws", "IOException", "{", "logger", ".", "entering", "(", "new", "Object", "[", "]", "{", "pageDomain", ",", "pageClassName", "}", ")", ";", "Preconditions", ".", "checkArgument", "(", "StringUtils", ".", "isNotBlank", "(", "pageClassName", ")", ",", "\"pageClassName can not be null, empty, or whitespace\"", ")", ";", "String", "guiDataDir", "=", "Config", ".", "getConfigProperty", "(", "ConfigProperty", ".", "GUI_DATA_DIR", ")", ";", "String", "processedPageDomain", "=", "StringUtils", ".", "defaultString", "(", "pageDomain", ",", "\"\"", ")", ";", "String", "rawDataFile", "=", "guiDataDir", "+", "\"/\"", "+", "processedPageDomain", "+", "\"/\"", "+", "pageClassName", ";", "if", "(", "processedPageDomain", ".", "isEmpty", "(", ")", ")", "{", "rawDataFile", "=", "guiDataDir", "+", "\"/\"", "+", "pageClassName", ";", "}", "String", "yamlFile", "=", "rawDataFile", "+", "\".yaml\"", ";", "String", "ymlFile", "=", "rawDataFile", "+", "\".yml\"", ";", "GuiMapReader", "dataProvider", ";", "if", "(", "getFilePath", "(", "yamlFile", ")", "!=", "null", ")", "{", "dataProvider", "=", "YamlReaderFactory", ".", "createInstance", "(", "yamlFile", ")", ";", "}", "else", "if", "(", "getFilePath", "(", "ymlFile", ")", "!=", "null", ")", "{", "dataProvider", "=", "YamlReaderFactory", ".", "createInstance", "(", "ymlFile", ")", ";", "}", "else", "{", "// Should be a FileNotFoundException?", "FileNotFoundException", "e", "=", "new", "FileNotFoundException", "(", "\"Data file does not exist for \"", "+", "rawDataFile", "+", "\". Supported file extensions: yaml, yml.\"", ")", ";", "logger", ".", "log", "(", "Level", ".", "SEVERE", ",", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "throw", "e", ";", "}", "logger", ".", "exiting", "(", "dataProvider", ")", ";", "return", "dataProvider", ";", "}" ]
Method to get the reader instance depending on the input parameters. @param pageDomain domain folder under which the input data files are present. @param pageClassName Page class name. May not be <code>null</code>, empty, or whitespace. @return DataProvider instance @throws IOException
[ "Method", "to", "get", "the", "reader", "instance", "depending", "on", "the", "input", "parameters", "." ]
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/internal/platform/pageyaml/GuiMapReaderFactory.java#L52-L82
Bernardo-MG/repository-pattern-java
src/main/java/com/wandrell/pattern/repository/jpa/JpaRepository.java
JpaRepository.buildQuery
private final Query buildQuery(final NamedParameterQueryData query) { """ Creates a {@code Query} from the data contained on the received {@code QueryData}. <p> The string query contained on the {@code QueryData} will be transformed into the {@code Query}, to which the parameters contained on that same received object will be applied. @param query the base query @return a {@code Query} created from the received {@code QueryData} """ final Query builtQuery; // Query created from the query data // Builds the base query builtQuery = getEntityManager().createQuery(query.getQuery()); // Applies the parameters for (final Entry<String, Object> entry : query.getParameters() .entrySet()) { builtQuery.setParameter(entry.getKey(), entry.getValue()); } return builtQuery; }
java
private final Query buildQuery(final NamedParameterQueryData query) { final Query builtQuery; // Query created from the query data // Builds the base query builtQuery = getEntityManager().createQuery(query.getQuery()); // Applies the parameters for (final Entry<String, Object> entry : query.getParameters() .entrySet()) { builtQuery.setParameter(entry.getKey(), entry.getValue()); } return builtQuery; }
[ "private", "final", "Query", "buildQuery", "(", "final", "NamedParameterQueryData", "query", ")", "{", "final", "Query", "builtQuery", ";", "// Query created from the query data", "// Builds the base query", "builtQuery", "=", "getEntityManager", "(", ")", ".", "createQuery", "(", "query", ".", "getQuery", "(", ")", ")", ";", "// Applies the parameters", "for", "(", "final", "Entry", "<", "String", ",", "Object", ">", "entry", ":", "query", ".", "getParameters", "(", ")", ".", "entrySet", "(", ")", ")", "{", "builtQuery", ".", "setParameter", "(", "entry", ".", "getKey", "(", ")", ",", "entry", ".", "getValue", "(", ")", ")", ";", "}", "return", "builtQuery", ";", "}" ]
Creates a {@code Query} from the data contained on the received {@code QueryData}. <p> The string query contained on the {@code QueryData} will be transformed into the {@code Query}, to which the parameters contained on that same received object will be applied. @param query the base query @return a {@code Query} created from the received {@code QueryData}
[ "Creates", "a", "{", "@code", "Query", "}", "from", "the", "data", "contained", "on", "the", "received", "{", "@code", "QueryData", "}", ".", "<p", ">", "The", "string", "query", "contained", "on", "the", "{", "@code", "QueryData", "}", "will", "be", "transformed", "into", "the", "{", "@code", "Query", "}", "to", "which", "the", "parameters", "contained", "on", "that", "same", "received", "object", "will", "be", "applied", "." ]
train
https://github.com/Bernardo-MG/repository-pattern-java/blob/e94d5bbf9aeeb45acc8485f3686a6e791b082ea8/src/main/java/com/wandrell/pattern/repository/jpa/JpaRepository.java#L328-L341
Netflix/governator
governator-core/src/main/java/com/netflix/governator/InjectorBuilder.java
InjectorBuilder.traceEachElement
@Deprecated public InjectorBuilder traceEachElement(ElementVisitor<String> visitor) { """ Iterator through all elements of the current module and write the output of the ElementVisitor to the logger at debug level. 'null' responses are ignored @param visitor @deprecated Use forEachElement(visitor, message -&gt; LOG.debug(message)); instead """ return forEachElement(visitor, message -> LOG.debug(message)); }
java
@Deprecated public InjectorBuilder traceEachElement(ElementVisitor<String> visitor) { return forEachElement(visitor, message -> LOG.debug(message)); }
[ "@", "Deprecated", "public", "InjectorBuilder", "traceEachElement", "(", "ElementVisitor", "<", "String", ">", "visitor", ")", "{", "return", "forEachElement", "(", "visitor", ",", "message", "->", "LOG", ".", "debug", "(", "message", ")", ")", ";", "}" ]
Iterator through all elements of the current module and write the output of the ElementVisitor to the logger at debug level. 'null' responses are ignored @param visitor @deprecated Use forEachElement(visitor, message -&gt; LOG.debug(message)); instead
[ "Iterator", "through", "all", "elements", "of", "the", "current", "module", "and", "write", "the", "output", "of", "the", "ElementVisitor", "to", "the", "logger", "at", "debug", "level", ".", "null", "responses", "are", "ignored", "@param", "visitor" ]
train
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-core/src/main/java/com/netflix/governator/InjectorBuilder.java#L111-L114
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/Context.java
Context.postConstruction
public EventSpace postConstruction() { """ Create the default space in this context. @return the created space. """ this.spaceRepository.postConstruction(); this.defaultSpace = createSpace(OpenEventSpaceSpecification.class, this.defaultSpaceID); if (this.defaultSpace == null) { // The default space could have been created before thanks to Hazelcast, // thus createSpace returns null because the space already exist, // in this case we return the already existing default space stored in the SpaceRepository this.defaultSpace = (OpenEventSpace) this.spaceRepository .getSpace(new SpaceID(this.id, this.defaultSpaceID, OpenEventSpaceSpecification.class)); } return this.defaultSpace; }
java
public EventSpace postConstruction() { this.spaceRepository.postConstruction(); this.defaultSpace = createSpace(OpenEventSpaceSpecification.class, this.defaultSpaceID); if (this.defaultSpace == null) { // The default space could have been created before thanks to Hazelcast, // thus createSpace returns null because the space already exist, // in this case we return the already existing default space stored in the SpaceRepository this.defaultSpace = (OpenEventSpace) this.spaceRepository .getSpace(new SpaceID(this.id, this.defaultSpaceID, OpenEventSpaceSpecification.class)); } return this.defaultSpace; }
[ "public", "EventSpace", "postConstruction", "(", ")", "{", "this", ".", "spaceRepository", ".", "postConstruction", "(", ")", ";", "this", ".", "defaultSpace", "=", "createSpace", "(", "OpenEventSpaceSpecification", ".", "class", ",", "this", ".", "defaultSpaceID", ")", ";", "if", "(", "this", ".", "defaultSpace", "==", "null", ")", "{", "// The default space could have been created before thanks to Hazelcast,", "// thus createSpace returns null because the space already exist,", "// in this case we return the already existing default space stored in the SpaceRepository", "this", ".", "defaultSpace", "=", "(", "OpenEventSpace", ")", "this", ".", "spaceRepository", ".", "getSpace", "(", "new", "SpaceID", "(", "this", ".", "id", ",", "this", ".", "defaultSpaceID", ",", "OpenEventSpaceSpecification", ".", "class", ")", ")", ";", "}", "return", "this", ".", "defaultSpace", ";", "}" ]
Create the default space in this context. @return the created space.
[ "Create", "the", "default", "space", "in", "this", "context", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/Context.java#L100-L111
landawn/AbacusUtil
src/com/landawn/abacus/util/N.java
N.binarySearch
public static int binarySearch(final char[] a, final int fromIndex, final int toIndex, final char key) { """ {@link Arrays#binarySearch(char[], int, int, char)} @param a @param fromIndex @param toIndex @param key @return """ return Array.binarySearch(a, fromIndex, toIndex, key); }
java
public static int binarySearch(final char[] a, final int fromIndex, final int toIndex, final char key) { return Array.binarySearch(a, fromIndex, toIndex, key); }
[ "public", "static", "int", "binarySearch", "(", "final", "char", "[", "]", "a", ",", "final", "int", "fromIndex", ",", "final", "int", "toIndex", ",", "final", "char", "key", ")", "{", "return", "Array", ".", "binarySearch", "(", "a", ",", "fromIndex", ",", "toIndex", ",", "key", ")", ";", "}" ]
{@link Arrays#binarySearch(char[], int, int, char)} @param a @param fromIndex @param toIndex @param key @return
[ "{", "@link", "Arrays#binarySearch", "(", "char", "[]", "int", "int", "char", ")", "}" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L12101-L12103
mnlipp/jgrapes
examples/src/org/jgrapes/http/demo/httpserver/FormProcessor.java
FormProcessor.onInput
@Handler public void onInput(Input<ByteBuffer> event, IOSubchannel channel) throws InterruptedException, UnsupportedEncodingException { """ Hanlde input. @param event the event @param channel the channel @throws InterruptedException the interrupted exception @throws UnsupportedEncodingException the unsupported encoding exception """ Optional<FormContext> ctx = channel.associated(this, FormContext.class); if (!ctx.isPresent()) { return; } ctx.get().fieldDecoder.addData(event.data()); if (!event.isEndOfRecord()) { return; } long invocations = (Long) ctx.get().session.computeIfAbsent( "invocations", key -> { return 0L; }); ctx.get().session.put("invocations", invocations + 1); HttpResponse response = ctx.get().request.response().get(); response.setStatus(HttpStatus.OK); response.setHasPayload(true); response.setField(HttpField.CONTENT_TYPE, MediaType.builder().setType("text", "plain") .setParameter("charset", "utf-8").build()); String data = "First name: " + ctx.get().fieldDecoder.fields().get("firstname") + "\r\n" + "Last name: " + ctx.get().fieldDecoder.fields().get("lastname") + "\r\n" + "Previous invocations: " + invocations; channel.respond(new Response(response)); ManagedBuffer<ByteBuffer> out = channel.byteBufferPool().acquire(); out.backingBuffer().put(data.getBytes("utf-8")); channel.respond(Output.fromSink(out, true)); }
java
@Handler public void onInput(Input<ByteBuffer> event, IOSubchannel channel) throws InterruptedException, UnsupportedEncodingException { Optional<FormContext> ctx = channel.associated(this, FormContext.class); if (!ctx.isPresent()) { return; } ctx.get().fieldDecoder.addData(event.data()); if (!event.isEndOfRecord()) { return; } long invocations = (Long) ctx.get().session.computeIfAbsent( "invocations", key -> { return 0L; }); ctx.get().session.put("invocations", invocations + 1); HttpResponse response = ctx.get().request.response().get(); response.setStatus(HttpStatus.OK); response.setHasPayload(true); response.setField(HttpField.CONTENT_TYPE, MediaType.builder().setType("text", "plain") .setParameter("charset", "utf-8").build()); String data = "First name: " + ctx.get().fieldDecoder.fields().get("firstname") + "\r\n" + "Last name: " + ctx.get().fieldDecoder.fields().get("lastname") + "\r\n" + "Previous invocations: " + invocations; channel.respond(new Response(response)); ManagedBuffer<ByteBuffer> out = channel.byteBufferPool().acquire(); out.backingBuffer().put(data.getBytes("utf-8")); channel.respond(Output.fromSink(out, true)); }
[ "@", "Handler", "public", "void", "onInput", "(", "Input", "<", "ByteBuffer", ">", "event", ",", "IOSubchannel", "channel", ")", "throws", "InterruptedException", ",", "UnsupportedEncodingException", "{", "Optional", "<", "FormContext", ">", "ctx", "=", "channel", ".", "associated", "(", "this", ",", "FormContext", ".", "class", ")", ";", "if", "(", "!", "ctx", ".", "isPresent", "(", ")", ")", "{", "return", ";", "}", "ctx", ".", "get", "(", ")", ".", "fieldDecoder", ".", "addData", "(", "event", ".", "data", "(", ")", ")", ";", "if", "(", "!", "event", ".", "isEndOfRecord", "(", ")", ")", "{", "return", ";", "}", "long", "invocations", "=", "(", "Long", ")", "ctx", ".", "get", "(", ")", ".", "session", ".", "computeIfAbsent", "(", "\"invocations\"", ",", "key", "->", "{", "return", "0L", ";", "}", ")", ";", "ctx", ".", "get", "(", ")", ".", "session", ".", "put", "(", "\"invocations\"", ",", "invocations", "+", "1", ")", ";", "HttpResponse", "response", "=", "ctx", ".", "get", "(", ")", ".", "request", ".", "response", "(", ")", ".", "get", "(", ")", ";", "response", ".", "setStatus", "(", "HttpStatus", ".", "OK", ")", ";", "response", ".", "setHasPayload", "(", "true", ")", ";", "response", ".", "setField", "(", "HttpField", ".", "CONTENT_TYPE", ",", "MediaType", ".", "builder", "(", ")", ".", "setType", "(", "\"text\"", ",", "\"plain\"", ")", ".", "setParameter", "(", "\"charset\"", ",", "\"utf-8\"", ")", ".", "build", "(", ")", ")", ";", "String", "data", "=", "\"First name: \"", "+", "ctx", ".", "get", "(", ")", ".", "fieldDecoder", ".", "fields", "(", ")", ".", "get", "(", "\"firstname\"", ")", "+", "\"\\r\\n\"", "+", "\"Last name: \"", "+", "ctx", ".", "get", "(", ")", ".", "fieldDecoder", ".", "fields", "(", ")", ".", "get", "(", "\"lastname\"", ")", "+", "\"\\r\\n\"", "+", "\"Previous invocations: \"", "+", "invocations", ";", "channel", ".", "respond", "(", "new", "Response", "(", "response", ")", ")", ";", "ManagedBuffer", "<", "ByteBuffer", ">", "out", "=", "channel", ".", "byteBufferPool", "(", ")", ".", "acquire", "(", ")", ";", "out", ".", "backingBuffer", "(", ")", ".", "put", "(", "data", ".", "getBytes", "(", "\"utf-8\"", ")", ")", ";", "channel", ".", "respond", "(", "Output", ".", "fromSink", "(", "out", ",", "true", ")", ")", ";", "}" ]
Hanlde input. @param event the event @param channel the channel @throws InterruptedException the interrupted exception @throws UnsupportedEncodingException the unsupported encoding exception
[ "Hanlde", "input", "." ]
train
https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/examples/src/org/jgrapes/http/demo/httpserver/FormProcessor.java#L108-L141
craftercms/commons
utilities/src/main/java/org/craftercms/commons/collections/MapUtils.java
MapUtils.deepMerge
@SuppressWarnings("unchecked") public static Map deepMerge(Map dst, Map src) { """ Deep merges two maps @param dst the map where elements will be merged into @param src the map with the elements to merge @return a deep merge of the two given maps. """ if (dst != null && src != null) { for (Object key : src.keySet()) { if (src.get(key) instanceof Map && dst.get(key) instanceof Map) { Map originalChild = (Map)dst.get(key); Map newChild = (Map)src.get(key); dst.put(key, deepMerge(originalChild, newChild)); } else { dst.put(key, src.get(key)); } } } return dst; }
java
@SuppressWarnings("unchecked") public static Map deepMerge(Map dst, Map src) { if (dst != null && src != null) { for (Object key : src.keySet()) { if (src.get(key) instanceof Map && dst.get(key) instanceof Map) { Map originalChild = (Map)dst.get(key); Map newChild = (Map)src.get(key); dst.put(key, deepMerge(originalChild, newChild)); } else { dst.put(key, src.get(key)); } } } return dst; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "Map", "deepMerge", "(", "Map", "dst", ",", "Map", "src", ")", "{", "if", "(", "dst", "!=", "null", "&&", "src", "!=", "null", ")", "{", "for", "(", "Object", "key", ":", "src", ".", "keySet", "(", ")", ")", "{", "if", "(", "src", ".", "get", "(", "key", ")", "instanceof", "Map", "&&", "dst", ".", "get", "(", "key", ")", "instanceof", "Map", ")", "{", "Map", "originalChild", "=", "(", "Map", ")", "dst", ".", "get", "(", "key", ")", ";", "Map", "newChild", "=", "(", "Map", ")", "src", ".", "get", "(", "key", ")", ";", "dst", ".", "put", "(", "key", ",", "deepMerge", "(", "originalChild", ",", "newChild", ")", ")", ";", "}", "else", "{", "dst", ".", "put", "(", "key", ",", "src", ".", "get", "(", "key", ")", ")", ";", "}", "}", "}", "return", "dst", ";", "}" ]
Deep merges two maps @param dst the map where elements will be merged into @param src the map with the elements to merge @return a deep merge of the two given maps.
[ "Deep", "merges", "two", "maps" ]
train
https://github.com/craftercms/commons/blob/3074fe49e56c2a4aae0832f40b17ae563335dc83/utilities/src/main/java/org/craftercms/commons/collections/MapUtils.java#L39-L54
anotheria/moskito
moskito-core/src/main/java/net/anotheria/moskito/core/dynamic/ProxyUtils.java
ProxyUtils.createServiceInstance
public static <T> T createServiceInstance(T impl, String category, String subsystem, Class<T> interf, Class<?>... additionalInterfaces) { """ Shortcut method to create service instance. Creates an instance with service interface name as instance name, custom category and subsystem, ServiceStatsCallHandler and ServiceStatsFactory. @param <T> @param impl @param category @param subsystem @param interf @param additionalInterfaces @return a newly created proxy of type T. """ return createServiceInstance(impl, null, category, subsystem, interf, additionalInterfaces); }
java
public static <T> T createServiceInstance(T impl, String category, String subsystem, Class<T> interf, Class<?>... additionalInterfaces){ return createServiceInstance(impl, null, category, subsystem, interf, additionalInterfaces); }
[ "public", "static", "<", "T", ">", "T", "createServiceInstance", "(", "T", "impl", ",", "String", "category", ",", "String", "subsystem", ",", "Class", "<", "T", ">", "interf", ",", "Class", "<", "?", ">", "...", "additionalInterfaces", ")", "{", "return", "createServiceInstance", "(", "impl", ",", "null", ",", "category", ",", "subsystem", ",", "interf", ",", "additionalInterfaces", ")", ";", "}" ]
Shortcut method to create service instance. Creates an instance with service interface name as instance name, custom category and subsystem, ServiceStatsCallHandler and ServiceStatsFactory. @param <T> @param impl @param category @param subsystem @param interf @param additionalInterfaces @return a newly created proxy of type T.
[ "Shortcut", "method", "to", "create", "service", "instance", ".", "Creates", "an", "instance", "with", "service", "interface", "name", "as", "instance", "name", "custom", "category", "and", "subsystem", "ServiceStatsCallHandler", "and", "ServiceStatsFactory", "." ]
train
https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/dynamic/ProxyUtils.java#L143-L145
powermock/powermock
powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java
PowerMock.expectPrivate
public static synchronized <T> IExpectationSetters<T> expectPrivate(Object instance, String methodName, Class<?> where, Object... arguments) throws Exception { """ Used to specify expectations on methods using the method name at a specific place in the class hierarchy (specified by the {@code where} parameter). Works on for example private or package private methods. """ return expectPrivate(instance, methodName, where, null, arguments); }
java
public static synchronized <T> IExpectationSetters<T> expectPrivate(Object instance, String methodName, Class<?> where, Object... arguments) throws Exception { return expectPrivate(instance, methodName, where, null, arguments); }
[ "public", "static", "synchronized", "<", "T", ">", "IExpectationSetters", "<", "T", ">", "expectPrivate", "(", "Object", "instance", ",", "String", "methodName", ",", "Class", "<", "?", ">", "where", ",", "Object", "...", "arguments", ")", "throws", "Exception", "{", "return", "expectPrivate", "(", "instance", ",", "methodName", ",", "where", ",", "null", ",", "arguments", ")", ";", "}" ]
Used to specify expectations on methods using the method name at a specific place in the class hierarchy (specified by the {@code where} parameter). Works on for example private or package private methods.
[ "Used", "to", "specify", "expectations", "on", "methods", "using", "the", "method", "name", "at", "a", "specific", "place", "in", "the", "class", "hierarchy", "(", "specified", "by", "the", "{" ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L1242-L1245
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDataPropertyDomainAxiomImpl_CustomFieldSerializer.java
OWLDataPropertyDomainAxiomImpl_CustomFieldSerializer.serializeInstance
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLDataPropertyDomainAxiomImpl instance) throws SerializationException { """ Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful """ serialize(streamWriter, instance); }
java
@Override public void serializeInstance(SerializationStreamWriter streamWriter, OWLDataPropertyDomainAxiomImpl instance) throws SerializationException { serialize(streamWriter, instance); }
[ "@", "Override", "public", "void", "serializeInstance", "(", "SerializationStreamWriter", "streamWriter", ",", "OWLDataPropertyDomainAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "serialize", "(", "streamWriter", ",", "instance", ")", ";", "}" ]
Serializes the content of the object into the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter}. @param streamWriter the {@link com.google.gwt.user.client.rpc.SerializationStreamWriter} to write the object's content to @param instance the object instance to serialize @throws com.google.gwt.user.client.rpc.SerializationException if the serialization operation is not successful
[ "Serializes", "the", "content", "of", "the", "object", "into", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamWriter", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDataPropertyDomainAxiomImpl_CustomFieldSerializer.java#L76-L79
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.opentracing.1.3/src/com/ibm/ws/microprofile/opentracing/OpenTracingService.java
OpenTracingService.isTraced
public static boolean isTraced(String classOperationName, String methodOperationName) { """ Return true if {@code methodOperationName} is not null (i.e. it represents something that has the {@code Traced} annotation) and if the {@code Traced} annotation was not explicitly set to {@code false}, or return true if {@code classOperationName} is not null (i.e. it represents something that has the {@code Traced} annotation) and the {@code Traced} annotation was not explicitly set to {@code false}, and the {@code methodOperationName} is not explicitly set to {@code false}. @param classOperationName The class operation name @param methodOperationName The method operation name @return See above """ return isTraced(methodOperationName) || (isTraced(classOperationName) && !OPERATION_NAME_UNTRACED.equals(methodOperationName)); }
java
public static boolean isTraced(String classOperationName, String methodOperationName) { return isTraced(methodOperationName) || (isTraced(classOperationName) && !OPERATION_NAME_UNTRACED.equals(methodOperationName)); }
[ "public", "static", "boolean", "isTraced", "(", "String", "classOperationName", ",", "String", "methodOperationName", ")", "{", "return", "isTraced", "(", "methodOperationName", ")", "||", "(", "isTraced", "(", "classOperationName", ")", "&&", "!", "OPERATION_NAME_UNTRACED", ".", "equals", "(", "methodOperationName", ")", ")", ";", "}" ]
Return true if {@code methodOperationName} is not null (i.e. it represents something that has the {@code Traced} annotation) and if the {@code Traced} annotation was not explicitly set to {@code false}, or return true if {@code classOperationName} is not null (i.e. it represents something that has the {@code Traced} annotation) and the {@code Traced} annotation was not explicitly set to {@code false}, and the {@code methodOperationName} is not explicitly set to {@code false}. @param classOperationName The class operation name @param methodOperationName The method operation name @return See above
[ "Return", "true", "if", "{", "@code", "methodOperationName", "}", "is", "not", "null", "(", "i", ".", "e", ".", "it", "represents", "something", "that", "has", "the", "{", "@code", "Traced", "}", "annotation", ")", "and", "if", "the", "{", "@code", "Traced", "}", "annotation", "was", "not", "explicitly", "set", "to", "{", "@code", "false", "}", "or", "return", "true", "if", "{", "@code", "classOperationName", "}", "is", "not", "null", "(", "i", ".", "e", ".", "it", "represents", "something", "that", "has", "the", "{", "@code", "Traced", "}", "annotation", ")", "and", "the", "{", "@code", "Traced", "}", "annotation", "was", "not", "explicitly", "set", "to", "{", "@code", "false", "}", "and", "the", "{", "@code", "methodOperationName", "}", "is", "not", "explicitly", "set", "to", "{", "@code", "false", "}", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.opentracing.1.3/src/com/ibm/ws/microprofile/opentracing/OpenTracingService.java#L87-L89
eserating/siren4j
src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java
ReflectingConverter.handleAddProperty
protected void handleAddProperty(EntityBuilder builder, String propName, Field currentField, Object obj) { """ Handles adding a property to an entity builder. Called by {@link ReflectingConverter#toEntity(Object, Field, Object, List)} for each property found. @param builder @param propName @param currentField @param obj """ builder.addProperty(propName, ReflectionUtils.getFieldValue(currentField, obj)); }
java
protected void handleAddProperty(EntityBuilder builder, String propName, Field currentField, Object obj) { builder.addProperty(propName, ReflectionUtils.getFieldValue(currentField, obj)); }
[ "protected", "void", "handleAddProperty", "(", "EntityBuilder", "builder", ",", "String", "propName", ",", "Field", "currentField", ",", "Object", "obj", ")", "{", "builder", ".", "addProperty", "(", "propName", ",", "ReflectionUtils", ".", "getFieldValue", "(", "currentField", ",", "obj", ")", ")", ";", "}" ]
Handles adding a property to an entity builder. Called by {@link ReflectingConverter#toEntity(Object, Field, Object, List)} for each property found. @param builder @param propName @param currentField @param obj
[ "Handles", "adding", "a", "property", "to", "an", "entity", "builder", ".", "Called", "by", "{", "@link", "ReflectingConverter#toEntity", "(", "Object", "Field", "Object", "List", ")", "}", "for", "each", "property", "found", "." ]
train
https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/converter/ReflectingConverter.java#L458-L460
jbundle/jbundle
thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/ParamDispatcher.java
ParamDispatcher.firePropertyChange
public void firePropertyChange(String propertyName, Object oldValue, Object newValue) { """ The firePropertyChange method was generated to support the propertyChange field. @param propertyName The property name. @param oldValue The old value. @param newValue The new value. """ if (propertyChange != null) propertyChange.firePropertyChange(propertyName, oldValue, newValue); }
java
public void firePropertyChange(String propertyName, Object oldValue, Object newValue) { if (propertyChange != null) propertyChange.firePropertyChange(propertyName, oldValue, newValue); }
[ "public", "void", "firePropertyChange", "(", "String", "propertyName", ",", "Object", "oldValue", ",", "Object", "newValue", ")", "{", "if", "(", "propertyChange", "!=", "null", ")", "propertyChange", ".", "firePropertyChange", "(", "propertyName", ",", "oldValue", ",", "newValue", ")", ";", "}" ]
The firePropertyChange method was generated to support the propertyChange field. @param propertyName The property name. @param oldValue The old value. @param newValue The new value.
[ "The", "firePropertyChange", "method", "was", "generated", "to", "support", "the", "propertyChange", "field", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/ParamDispatcher.java#L149-L153
Jsondb/jsondb-core
src/main/java/io/jsondb/crypto/CryptoUtil.java
CryptoUtil.encryptFields
public static void encryptFields(Object object, CollectionMetaData cmd, ICipher cipher) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { """ A utility method to encrypt the value of field marked by the @Secret annotation using its setter/mutator method. @param object the actual Object representing the POJO we want the Id of. @param cmd the CollectionMetaData object from which we can obtain the list containing names of fields which have the @Secret annotation @param cipher the actual cipher implementation to use @throws IllegalAccessException Error when invoking method for a @Secret annotated field due to permissions @throws IllegalArgumentException Error when invoking method for a @Secret annotated field due to wrong arguments @throws InvocationTargetException Error when invoking method for a @Secret annotated field, the method threw a exception """ for (String secretAnnotatedFieldName: cmd.getSecretAnnotatedFieldNames()) { Method getterMethod = cmd.getGetterMethodForFieldName(secretAnnotatedFieldName); Method setterMethod = cmd.getSetterMethodForFieldName(secretAnnotatedFieldName); String value; String encryptedValue = null; try { value = (String)getterMethod.invoke(object); if (null != value) { encryptedValue = cipher.encrypt(value); setterMethod.invoke(object, encryptedValue); } } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { logger.error("Error when invoking method for a @Secret annotated field", e); throw e; } } }
java
public static void encryptFields(Object object, CollectionMetaData cmd, ICipher cipher) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { for (String secretAnnotatedFieldName: cmd.getSecretAnnotatedFieldNames()) { Method getterMethod = cmd.getGetterMethodForFieldName(secretAnnotatedFieldName); Method setterMethod = cmd.getSetterMethodForFieldName(secretAnnotatedFieldName); String value; String encryptedValue = null; try { value = (String)getterMethod.invoke(object); if (null != value) { encryptedValue = cipher.encrypt(value); setterMethod.invoke(object, encryptedValue); } } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { logger.error("Error when invoking method for a @Secret annotated field", e); throw e; } } }
[ "public", "static", "void", "encryptFields", "(", "Object", "object", ",", "CollectionMetaData", "cmd", ",", "ICipher", "cipher", ")", "throws", "IllegalAccessException", ",", "IllegalArgumentException", ",", "InvocationTargetException", "{", "for", "(", "String", "secretAnnotatedFieldName", ":", "cmd", ".", "getSecretAnnotatedFieldNames", "(", ")", ")", "{", "Method", "getterMethod", "=", "cmd", ".", "getGetterMethodForFieldName", "(", "secretAnnotatedFieldName", ")", ";", "Method", "setterMethod", "=", "cmd", ".", "getSetterMethodForFieldName", "(", "secretAnnotatedFieldName", ")", ";", "String", "value", ";", "String", "encryptedValue", "=", "null", ";", "try", "{", "value", "=", "(", "String", ")", "getterMethod", ".", "invoke", "(", "object", ")", ";", "if", "(", "null", "!=", "value", ")", "{", "encryptedValue", "=", "cipher", ".", "encrypt", "(", "value", ")", ";", "setterMethod", ".", "invoke", "(", "object", ",", "encryptedValue", ")", ";", "}", "}", "catch", "(", "IllegalAccessException", "|", "IllegalArgumentException", "|", "InvocationTargetException", "e", ")", "{", "logger", ".", "error", "(", "\"Error when invoking method for a @Secret annotated field\"", ",", "e", ")", ";", "throw", "e", ";", "}", "}", "}" ]
A utility method to encrypt the value of field marked by the @Secret annotation using its setter/mutator method. @param object the actual Object representing the POJO we want the Id of. @param cmd the CollectionMetaData object from which we can obtain the list containing names of fields which have the @Secret annotation @param cipher the actual cipher implementation to use @throws IllegalAccessException Error when invoking method for a @Secret annotated field due to permissions @throws IllegalArgumentException Error when invoking method for a @Secret annotated field due to wrong arguments @throws InvocationTargetException Error when invoking method for a @Secret annotated field, the method threw a exception
[ "A", "utility", "method", "to", "encrypt", "the", "value", "of", "field", "marked", "by", "the" ]
train
https://github.com/Jsondb/jsondb-core/blob/c49654d1eee2ace4d5ca5be19730652a966ce7f4/src/main/java/io/jsondb/crypto/CryptoUtil.java#L58-L77
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns.java
ns.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { """ <pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre> """ ns_responses result = (ns_responses) service.get_payload_formatter().string_to_resource(ns_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_response_array); } ns[] result_ns = new ns[result.ns_response_array.length]; for(int i = 0; i < result.ns_response_array.length; i++) { result_ns[i] = result.ns_response_array[i].ns[0]; } return result_ns; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { ns_responses result = (ns_responses) service.get_payload_formatter().string_to_resource(ns_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_response_array); } ns[] result_ns = new ns[result.ns_response_array.length]; for(int i = 0; i < result.ns_response_array.length; i++) { result_ns[i] = result.ns_response_array[i].ns[0]; } return result_ns; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "ns_responses", "result", "=", "(", "ns_responses", ")", "service", ".", "get_payload_formatter", "(", ")", ".", "string_to_resource", "(", "ns_responses", ".", "class", ",", "response", ")", ";", "if", "(", "result", ".", "errorcode", "!=", "0", ")", "{", "if", "(", "result", ".", "errorcode", "==", "SESSION_NOT_EXISTS", ")", "service", ".", "clear_session", "(", ")", ";", "throw", "new", "nitro_exception", "(", "result", ".", "message", ",", "result", ".", "errorcode", ",", "(", "base_response", "[", "]", ")", "result", ".", "ns_response_array", ")", ";", "}", "ns", "[", "]", "result_ns", "=", "new", "ns", "[", "result", ".", "ns_response_array", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "result", ".", "ns_response_array", ".", "length", ";", "i", "++", ")", "{", "result_ns", "[", "i", "]", "=", "result", ".", "ns_response_array", "[", "i", "]", ".", "ns", "[", "0", "]", ";", "}", "return", "result_ns", ";", "}" ]
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns.java#L1040-L1057
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
FSNamesystem.getDatanode
public DatanodeDescriptor getDatanode(DatanodeID nodeID) throws IOException { """ Get data node by storage ID. @param nodeID @return DatanodeDescriptor or null if the node is not found. @throws IOException """ UnregisteredDatanodeException e = null; DatanodeDescriptor node = datanodeMap.get(nodeID.getStorageID()); if (node == null) { return null; } if (!node.getName().equals(nodeID.getName())) { e = new UnregisteredDatanodeException(nodeID, node); NameNode.stateChangeLog.fatal("BLOCK* NameSystem.getDatanode: " + e.getLocalizedMessage()); throw e; } return node; }
java
public DatanodeDescriptor getDatanode(DatanodeID nodeID) throws IOException { UnregisteredDatanodeException e = null; DatanodeDescriptor node = datanodeMap.get(nodeID.getStorageID()); if (node == null) { return null; } if (!node.getName().equals(nodeID.getName())) { e = new UnregisteredDatanodeException(nodeID, node); NameNode.stateChangeLog.fatal("BLOCK* NameSystem.getDatanode: " + e.getLocalizedMessage()); throw e; } return node; }
[ "public", "DatanodeDescriptor", "getDatanode", "(", "DatanodeID", "nodeID", ")", "throws", "IOException", "{", "UnregisteredDatanodeException", "e", "=", "null", ";", "DatanodeDescriptor", "node", "=", "datanodeMap", ".", "get", "(", "nodeID", ".", "getStorageID", "(", ")", ")", ";", "if", "(", "node", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "!", "node", ".", "getName", "(", ")", ".", "equals", "(", "nodeID", ".", "getName", "(", ")", ")", ")", "{", "e", "=", "new", "UnregisteredDatanodeException", "(", "nodeID", ",", "node", ")", ";", "NameNode", ".", "stateChangeLog", ".", "fatal", "(", "\"BLOCK* NameSystem.getDatanode: \"", "+", "e", ".", "getLocalizedMessage", "(", ")", ")", ";", "throw", "e", ";", "}", "return", "node", ";", "}" ]
Get data node by storage ID. @param nodeID @return DatanodeDescriptor or null if the node is not found. @throws IOException
[ "Get", "data", "node", "by", "storage", "ID", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L8417-L8430
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/map/feature/Feature.java
Feature.setImageUrlAttribute
public void setImageUrlAttribute(String name, String value) { """ Set attribute value of given type. @param name attribute name @param value attribute value """ Attribute attribute = getAttributes().get(name); if (!(attribute instanceof ImageUrlAttribute)) { throw new IllegalStateException("Cannot set imageUrl value on attribute with different type, " + attribute.getClass().getName() + " setting value " + value); } ((ImageUrlAttribute) attribute).setValue(value); }
java
public void setImageUrlAttribute(String name, String value) { Attribute attribute = getAttributes().get(name); if (!(attribute instanceof ImageUrlAttribute)) { throw new IllegalStateException("Cannot set imageUrl value on attribute with different type, " + attribute.getClass().getName() + " setting value " + value); } ((ImageUrlAttribute) attribute).setValue(value); }
[ "public", "void", "setImageUrlAttribute", "(", "String", "name", ",", "String", "value", ")", "{", "Attribute", "attribute", "=", "getAttributes", "(", ")", ".", "get", "(", "name", ")", ";", "if", "(", "!", "(", "attribute", "instanceof", "ImageUrlAttribute", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Cannot set imageUrl value on attribute with different type, \"", "+", "attribute", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\" setting value \"", "+", "value", ")", ";", "}", "(", "(", "ImageUrlAttribute", ")", "attribute", ")", ".", "setValue", "(", "value", ")", ";", "}" ]
Set attribute value of given type. @param name attribute name @param value attribute value
[ "Set", "attribute", "value", "of", "given", "type", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/feature/Feature.java#L290-L297
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnGatewaysInner.java
P2sVpnGatewaysInner.updateTagsAsync
public Observable<P2SVpnGatewayInner> updateTagsAsync(String resourceGroupName, String gatewayName) { """ Updates virtual wan p2s vpn gateway tags. @param resourceGroupName The resource group name of the P2SVpnGateway. @param gatewayName The name of the gateway. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return updateTagsWithServiceResponseAsync(resourceGroupName, gatewayName).map(new Func1<ServiceResponse<P2SVpnGatewayInner>, P2SVpnGatewayInner>() { @Override public P2SVpnGatewayInner call(ServiceResponse<P2SVpnGatewayInner> response) { return response.body(); } }); }
java
public Observable<P2SVpnGatewayInner> updateTagsAsync(String resourceGroupName, String gatewayName) { return updateTagsWithServiceResponseAsync(resourceGroupName, gatewayName).map(new Func1<ServiceResponse<P2SVpnGatewayInner>, P2SVpnGatewayInner>() { @Override public P2SVpnGatewayInner call(ServiceResponse<P2SVpnGatewayInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "P2SVpnGatewayInner", ">", "updateTagsAsync", "(", "String", "resourceGroupName", ",", "String", "gatewayName", ")", "{", "return", "updateTagsWithServiceResponseAsync", "(", "resourceGroupName", ",", "gatewayName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "P2SVpnGatewayInner", ">", ",", "P2SVpnGatewayInner", ">", "(", ")", "{", "@", "Override", "public", "P2SVpnGatewayInner", "call", "(", "ServiceResponse", "<", "P2SVpnGatewayInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Updates virtual wan p2s vpn gateway tags. @param resourceGroupName The resource group name of the P2SVpnGateway. @param gatewayName The name of the gateway. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Updates", "virtual", "wan", "p2s", "vpn", "gateway", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnGatewaysInner.java#L415-L422
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/config/jmx/JawrApplicationConfigManager.java
JawrApplicationConfigManager.areEquals
public boolean areEquals(String str1, String str2, String str3) { """ Returns true if the 3 string are equals. @param str1 the first string @param str2 the 2nd string @param str3 the 3rd string @return true if the 3 string are equals. """ return (str1 == null && str2 == null && str3 == null || str1 != null && str2 != null && str3 != null && str1.equals(str2) && str2.equals(str3)); }
java
public boolean areEquals(String str1, String str2, String str3) { return (str1 == null && str2 == null && str3 == null || str1 != null && str2 != null && str3 != null && str1.equals(str2) && str2.equals(str3)); }
[ "public", "boolean", "areEquals", "(", "String", "str1", ",", "String", "str2", ",", "String", "str3", ")", "{", "return", "(", "str1", "==", "null", "&&", "str2", "==", "null", "&&", "str3", "==", "null", "||", "str1", "!=", "null", "&&", "str2", "!=", "null", "&&", "str3", "!=", "null", "&&", "str1", ".", "equals", "(", "str2", ")", "&&", "str2", ".", "equals", "(", "str3", ")", ")", ";", "}" ]
Returns true if the 3 string are equals. @param str1 the first string @param str2 the 2nd string @param str3 the 3rd string @return true if the 3 string are equals.
[ "Returns", "true", "if", "the", "3", "string", "are", "equals", "." ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/config/jmx/JawrApplicationConfigManager.java#L622-L626
OpenNTF/JavascriptAggregator
jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/DojoHttpTransport.java
DojoHttpTransport.endResponse
protected String endResponse(HttpServletRequest request, Object arg) { """ Handles the {@link com.ibm.jaggr.core.transport.IHttpTransport.LayerContributionType#END_RESPONSE} layer listener event @param request the http request object @param arg null @return the layer contribution """ String result = ""; //$NON-NLS-1$ @SuppressWarnings("unchecked") Set<String> requiredModules = (Set<String>)request.getAttribute(ADD_REQUIRE_DEPS_REQATTRNAME); if (requiredModules != null && !requiredModules.isEmpty()) { // issue a require call for the required modules StringBuffer sb = new StringBuffer(); sb.append("require(["); //$NON-NLS-1$ int i = 0; for (String name : requiredModules) { sb.append(i++ > 0 ? "," : "").append("\"").append(name).append("\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ } sb.append("]);"); //$NON-NLS-1$ result = sb.toString(); } return result; }
java
protected String endResponse(HttpServletRequest request, Object arg) { String result = ""; //$NON-NLS-1$ @SuppressWarnings("unchecked") Set<String> requiredModules = (Set<String>)request.getAttribute(ADD_REQUIRE_DEPS_REQATTRNAME); if (requiredModules != null && !requiredModules.isEmpty()) { // issue a require call for the required modules StringBuffer sb = new StringBuffer(); sb.append("require(["); //$NON-NLS-1$ int i = 0; for (String name : requiredModules) { sb.append(i++ > 0 ? "," : "").append("\"").append(name).append("\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ } sb.append("]);"); //$NON-NLS-1$ result = sb.toString(); } return result; }
[ "protected", "String", "endResponse", "(", "HttpServletRequest", "request", ",", "Object", "arg", ")", "{", "String", "result", "=", "\"\"", ";", "//$NON-NLS-1$\r", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "Set", "<", "String", ">", "requiredModules", "=", "(", "Set", "<", "String", ">", ")", "request", ".", "getAttribute", "(", "ADD_REQUIRE_DEPS_REQATTRNAME", ")", ";", "if", "(", "requiredModules", "!=", "null", "&&", "!", "requiredModules", ".", "isEmpty", "(", ")", ")", "{", "// issue a require call for the required modules\r", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "sb", ".", "append", "(", "\"require([\"", ")", ";", "//$NON-NLS-1$\r", "int", "i", "=", "0", ";", "for", "(", "String", "name", ":", "requiredModules", ")", "{", "sb", ".", "append", "(", "i", "++", ">", "0", "?", "\",\"", ":", "\"\"", ")", ".", "append", "(", "\"\\\"\"", ")", ".", "append", "(", "name", ")", ".", "append", "(", "\"\\\"\"", ")", ";", "//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$\r", "}", "sb", ".", "append", "(", "\"]);\"", ")", ";", "//$NON-NLS-1$\r", "result", "=", "sb", ".", "toString", "(", ")", ";", "}", "return", "result", ";", "}" ]
Handles the {@link com.ibm.jaggr.core.transport.IHttpTransport.LayerContributionType#END_RESPONSE} layer listener event @param request the http request object @param arg null @return the layer contribution
[ "Handles", "the", "{", "@link", "com", ".", "ibm", ".", "jaggr", ".", "core", ".", "transport", ".", "IHttpTransport", ".", "LayerContributionType#END_RESPONSE", "}", "layer", "listener", "event" ]
train
https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/transport/DojoHttpTransport.java#L410-L426
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/offline/OfflineMessageManager.java
OfflineMessageManager.getMessages
public List<Message> getMessages(final List<String> nodes) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { """ Returns a List of the offline <tt>Messages</tt> whose stamp matches the specified request. The request will include the list of stamps that uniquely identifies the offline messages to retrieve. The returned offline messages will not be deleted from the server. Use {@link #deleteMessages(java.util.List)} to delete the messages. @param nodes the list of stamps that uniquely identifies offline message. @return a List with the offline <tt>Messages</tt> that were received as part of this request. @throws XMPPErrorException If the user is not allowed to make this request or the server does not support offline message retrieval. @throws NoResponseException if there was no response from the server. @throws NotConnectedException @throws InterruptedException """ List<Message> messages = new ArrayList<>(nodes.size()); OfflineMessageRequest request = new OfflineMessageRequest(); for (String node : nodes) { OfflineMessageRequest.Item item = new OfflineMessageRequest.Item(node); item.setAction("view"); request.addItem(item); } // Filter offline messages that were requested by this request StanzaFilter messageFilter = new AndFilter(PACKET_FILTER, new StanzaFilter() { @Override public boolean accept(Stanza packet) { OfflineMessageInfo info = packet.getExtension("offline", namespace); return nodes.contains(info.getNode()); } }); int pendingNodes = nodes.size(); try (StanzaCollector messageCollector = connection.createStanzaCollector(messageFilter)) { connection.createStanzaCollectorAndSend(request).nextResultOrThrow(); // Collect the received offline messages Message message; do { message = messageCollector.nextResult(); if (message != null) { messages.add(message); pendingNodes--; } else if (message == null && pendingNodes > 0) { LOGGER.log(Level.WARNING, "Did not receive all expected offline messages. " + pendingNodes + " are missing."); } } while (message != null && pendingNodes > 0); } return messages; }
java
public List<Message> getMessages(final List<String> nodes) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { List<Message> messages = new ArrayList<>(nodes.size()); OfflineMessageRequest request = new OfflineMessageRequest(); for (String node : nodes) { OfflineMessageRequest.Item item = new OfflineMessageRequest.Item(node); item.setAction("view"); request.addItem(item); } // Filter offline messages that were requested by this request StanzaFilter messageFilter = new AndFilter(PACKET_FILTER, new StanzaFilter() { @Override public boolean accept(Stanza packet) { OfflineMessageInfo info = packet.getExtension("offline", namespace); return nodes.contains(info.getNode()); } }); int pendingNodes = nodes.size(); try (StanzaCollector messageCollector = connection.createStanzaCollector(messageFilter)) { connection.createStanzaCollectorAndSend(request).nextResultOrThrow(); // Collect the received offline messages Message message; do { message = messageCollector.nextResult(); if (message != null) { messages.add(message); pendingNodes--; } else if (message == null && pendingNodes > 0) { LOGGER.log(Level.WARNING, "Did not receive all expected offline messages. " + pendingNodes + " are missing."); } } while (message != null && pendingNodes > 0); } return messages; }
[ "public", "List", "<", "Message", ">", "getMessages", "(", "final", "List", "<", "String", ">", "nodes", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "List", "<", "Message", ">", "messages", "=", "new", "ArrayList", "<>", "(", "nodes", ".", "size", "(", ")", ")", ";", "OfflineMessageRequest", "request", "=", "new", "OfflineMessageRequest", "(", ")", ";", "for", "(", "String", "node", ":", "nodes", ")", "{", "OfflineMessageRequest", ".", "Item", "item", "=", "new", "OfflineMessageRequest", ".", "Item", "(", "node", ")", ";", "item", ".", "setAction", "(", "\"view\"", ")", ";", "request", ".", "addItem", "(", "item", ")", ";", "}", "// Filter offline messages that were requested by this request", "StanzaFilter", "messageFilter", "=", "new", "AndFilter", "(", "PACKET_FILTER", ",", "new", "StanzaFilter", "(", ")", "{", "@", "Override", "public", "boolean", "accept", "(", "Stanza", "packet", ")", "{", "OfflineMessageInfo", "info", "=", "packet", ".", "getExtension", "(", "\"offline\"", ",", "namespace", ")", ";", "return", "nodes", ".", "contains", "(", "info", ".", "getNode", "(", ")", ")", ";", "}", "}", ")", ";", "int", "pendingNodes", "=", "nodes", ".", "size", "(", ")", ";", "try", "(", "StanzaCollector", "messageCollector", "=", "connection", ".", "createStanzaCollector", "(", "messageFilter", ")", ")", "{", "connection", ".", "createStanzaCollectorAndSend", "(", "request", ")", ".", "nextResultOrThrow", "(", ")", ";", "// Collect the received offline messages", "Message", "message", ";", "do", "{", "message", "=", "messageCollector", ".", "nextResult", "(", ")", ";", "if", "(", "message", "!=", "null", ")", "{", "messages", ".", "add", "(", "message", ")", ";", "pendingNodes", "--", ";", "}", "else", "if", "(", "message", "==", "null", "&&", "pendingNodes", ">", "0", ")", "{", "LOGGER", ".", "log", "(", "Level", ".", "WARNING", ",", "\"Did not receive all expected offline messages. \"", "+", "pendingNodes", "+", "\" are missing.\"", ")", ";", "}", "}", "while", "(", "message", "!=", "null", "&&", "pendingNodes", ">", "0", ")", ";", "}", "return", "messages", ";", "}" ]
Returns a List of the offline <tt>Messages</tt> whose stamp matches the specified request. The request will include the list of stamps that uniquely identifies the offline messages to retrieve. The returned offline messages will not be deleted from the server. Use {@link #deleteMessages(java.util.List)} to delete the messages. @param nodes the list of stamps that uniquely identifies offline message. @return a List with the offline <tt>Messages</tt> that were received as part of this request. @throws XMPPErrorException If the user is not allowed to make this request or the server does not support offline message retrieval. @throws NoResponseException if there was no response from the server. @throws NotConnectedException @throws InterruptedException
[ "Returns", "a", "List", "of", "the", "offline", "<tt", ">", "Messages<", "/", "tt", ">", "whose", "stamp", "matches", "the", "specified", "request", ".", "The", "request", "will", "include", "the", "list", "of", "stamps", "that", "uniquely", "identifies", "the", "offline", "messages", "to", "retrieve", ".", "The", "returned", "offline", "messages", "will", "not", "be", "deleted", "from", "the", "server", ".", "Use", "{", "@link", "#deleteMessages", "(", "java", ".", "util", ".", "List", ")", "}", "to", "delete", "the", "messages", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/offline/OfflineMessageManager.java#L150-L184
Azure/azure-sdk-for-java
recoveryservices.backup/resource-manager/v2017_07_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2017_07_01/implementation/ProtectionIntentsInner.java
ProtectionIntentsInner.validateAsync
public Observable<PreValidateEnableBackupResponseInner> validateAsync(String azureRegion, PreValidateEnableBackupRequest parameters) { """ It will validate followings 1. Vault capacity 2. VM is already protected 3. Any VM related configuration passed in properties. @param azureRegion Azure region to hit Api @param parameters Enable backup validation request on Virtual Machine @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PreValidateEnableBackupResponseInner object """ return validateWithServiceResponseAsync(azureRegion, parameters).map(new Func1<ServiceResponse<PreValidateEnableBackupResponseInner>, PreValidateEnableBackupResponseInner>() { @Override public PreValidateEnableBackupResponseInner call(ServiceResponse<PreValidateEnableBackupResponseInner> response) { return response.body(); } }); }
java
public Observable<PreValidateEnableBackupResponseInner> validateAsync(String azureRegion, PreValidateEnableBackupRequest parameters) { return validateWithServiceResponseAsync(azureRegion, parameters).map(new Func1<ServiceResponse<PreValidateEnableBackupResponseInner>, PreValidateEnableBackupResponseInner>() { @Override public PreValidateEnableBackupResponseInner call(ServiceResponse<PreValidateEnableBackupResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "PreValidateEnableBackupResponseInner", ">", "validateAsync", "(", "String", "azureRegion", ",", "PreValidateEnableBackupRequest", "parameters", ")", "{", "return", "validateWithServiceResponseAsync", "(", "azureRegion", ",", "parameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "PreValidateEnableBackupResponseInner", ">", ",", "PreValidateEnableBackupResponseInner", ">", "(", ")", "{", "@", "Override", "public", "PreValidateEnableBackupResponseInner", "call", "(", "ServiceResponse", "<", "PreValidateEnableBackupResponseInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
It will validate followings 1. Vault capacity 2. VM is already protected 3. Any VM related configuration passed in properties. @param azureRegion Azure region to hit Api @param parameters Enable backup validation request on Virtual Machine @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PreValidateEnableBackupResponseInner object
[ "It", "will", "validate", "followings", "1", ".", "Vault", "capacity", "2", ".", "VM", "is", "already", "protected", "3", ".", "Any", "VM", "related", "configuration", "passed", "in", "properties", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2017_07_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2017_07_01/implementation/ProtectionIntentsInner.java#L112-L119
gosu-lang/gosu-lang
gosu-core-api/src/main/java/gw/util/GosuCollectionUtil.java
GosuCollectionUtil.startsWith
public static boolean startsWith( List<?> list, List<?> prefix ) { """ {@link String#startsWith(String)} for Lists. @return true iff list is at least as big as prefix, and if the first prefix.size() elements are element-wise equal to the elements of prefix. """ if( list.size() < prefix.size() ) { return false; } Iterator<?> listIter = list.iterator(); for( Object prefixElement : prefix ) { boolean b = listIter.hasNext(); assert b : "list claims to have at least as many elements as prefix, but its iterator is exhausted first"; if( !GosuObjectUtil.equals( prefixElement, listIter.next() ) ) { return false; } } return true; }
java
public static boolean startsWith( List<?> list, List<?> prefix ) { if( list.size() < prefix.size() ) { return false; } Iterator<?> listIter = list.iterator(); for( Object prefixElement : prefix ) { boolean b = listIter.hasNext(); assert b : "list claims to have at least as many elements as prefix, but its iterator is exhausted first"; if( !GosuObjectUtil.equals( prefixElement, listIter.next() ) ) { return false; } } return true; }
[ "public", "static", "boolean", "startsWith", "(", "List", "<", "?", ">", "list", ",", "List", "<", "?", ">", "prefix", ")", "{", "if", "(", "list", ".", "size", "(", ")", "<", "prefix", ".", "size", "(", ")", ")", "{", "return", "false", ";", "}", "Iterator", "<", "?", ">", "listIter", "=", "list", ".", "iterator", "(", ")", ";", "for", "(", "Object", "prefixElement", ":", "prefix", ")", "{", "boolean", "b", "=", "listIter", ".", "hasNext", "(", ")", ";", "assert", "b", ":", "\"list claims to have at least as many elements as prefix, but its iterator is exhausted first\"", ";", "if", "(", "!", "GosuObjectUtil", ".", "equals", "(", "prefixElement", ",", "listIter", ".", "next", "(", ")", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
{@link String#startsWith(String)} for Lists. @return true iff list is at least as big as prefix, and if the first prefix.size() elements are element-wise equal to the elements of prefix.
[ "{", "@link", "String#startsWith", "(", "String", ")", "}", "for", "Lists", "." ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuCollectionUtil.java#L70-L88
apache/flink
flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java
Graph.validate
public Boolean validate(GraphValidator<K, VV, EV> validator) throws Exception { """ Function that checks whether a Graph is a valid Graph, as defined by the given {@link GraphValidator}. @return true if the Graph is valid. """ return validator.validate(this); }
java
public Boolean validate(GraphValidator<K, VV, EV> validator) throws Exception { return validator.validate(this); }
[ "public", "Boolean", "validate", "(", "GraphValidator", "<", "K", ",", "VV", ",", "EV", ">", "validator", ")", "throws", "Exception", "{", "return", "validator", ".", "validate", "(", "this", ")", ";", "}" ]
Function that checks whether a Graph is a valid Graph, as defined by the given {@link GraphValidator}. @return true if the Graph is valid.
[ "Function", "that", "checks", "whether", "a", "Graph", "is", "a", "valid", "Graph", "as", "defined", "by", "the", "given", "{", "@link", "GraphValidator", "}", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L446-L448
rzwitserloot/lombok
src/core/lombok/javac/apt/LombokProcessor.java
LombokProcessor.getJavacProcessingEnvironment
public JavacProcessingEnvironment getJavacProcessingEnvironment(Object procEnv) { """ This class casts the given processing environment to a JavacProcessingEnvironment. In case of gradle incremental compilation, the delegate ProcessingEnvironment of the gradle wrapper is returned. """ if (procEnv instanceof JavacProcessingEnvironment) return (JavacProcessingEnvironment) procEnv; // try to find a "delegate" field in the object, and use this to try to obtain a JavacProcessingEnvironment for (Class<?> procEnvClass = procEnv.getClass(); procEnvClass != null; procEnvClass = procEnvClass.getSuperclass()) { try { return getJavacProcessingEnvironment(tryGetDelegateField(procEnvClass, procEnv)); } catch (final Exception e) { // delegate field was not found, try on superclass } } processingEnv.getMessager().printMessage(Kind.WARNING, "Can't get the delegate of the gradle IncrementalProcessingEnvironment. Lombok won't work."); return null; }
java
public JavacProcessingEnvironment getJavacProcessingEnvironment(Object procEnv) { if (procEnv instanceof JavacProcessingEnvironment) return (JavacProcessingEnvironment) procEnv; // try to find a "delegate" field in the object, and use this to try to obtain a JavacProcessingEnvironment for (Class<?> procEnvClass = procEnv.getClass(); procEnvClass != null; procEnvClass = procEnvClass.getSuperclass()) { try { return getJavacProcessingEnvironment(tryGetDelegateField(procEnvClass, procEnv)); } catch (final Exception e) { // delegate field was not found, try on superclass } } processingEnv.getMessager().printMessage(Kind.WARNING, "Can't get the delegate of the gradle IncrementalProcessingEnvironment. Lombok won't work."); return null; }
[ "public", "JavacProcessingEnvironment", "getJavacProcessingEnvironment", "(", "Object", "procEnv", ")", "{", "if", "(", "procEnv", "instanceof", "JavacProcessingEnvironment", ")", "return", "(", "JavacProcessingEnvironment", ")", "procEnv", ";", "// try to find a \"delegate\" field in the object, and use this to try to obtain a JavacProcessingEnvironment", "for", "(", "Class", "<", "?", ">", "procEnvClass", "=", "procEnv", ".", "getClass", "(", ")", ";", "procEnvClass", "!=", "null", ";", "procEnvClass", "=", "procEnvClass", ".", "getSuperclass", "(", ")", ")", "{", "try", "{", "return", "getJavacProcessingEnvironment", "(", "tryGetDelegateField", "(", "procEnvClass", ",", "procEnv", ")", ")", ";", "}", "catch", "(", "final", "Exception", "e", ")", "{", "// delegate field was not found, try on superclass", "}", "}", "processingEnv", ".", "getMessager", "(", ")", ".", "printMessage", "(", "Kind", ".", "WARNING", ",", "\"Can't get the delegate of the gradle IncrementalProcessingEnvironment. Lombok won't work.\"", ")", ";", "return", "null", ";", "}" ]
This class casts the given processing environment to a JavacProcessingEnvironment. In case of gradle incremental compilation, the delegate ProcessingEnvironment of the gradle wrapper is returned.
[ "This", "class", "casts", "the", "given", "processing", "environment", "to", "a", "JavacProcessingEnvironment", ".", "In", "case", "of", "gradle", "incremental", "compilation", "the", "delegate", "ProcessingEnvironment", "of", "the", "gradle", "wrapper", "is", "returned", "." ]
train
https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/apt/LombokProcessor.java#L409-L424
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/FileOperations.java
FileOperations.getFilePropertiesFromTask
public FileProperties getFilePropertiesFromTask(String jobId, String taskId, String fileName) throws BatchErrorException, IOException { """ Gets information about a file from the specified task's directory on its compute node. @param jobId The ID of the job containing the task. @param taskId The ID of the task. @param fileName The name of the file to retrieve. @return A {@link FileProperties} instance containing information about the file. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. """ return getFilePropertiesFromTask(jobId, taskId, fileName, null); }
java
public FileProperties getFilePropertiesFromTask(String jobId, String taskId, String fileName) throws BatchErrorException, IOException { return getFilePropertiesFromTask(jobId, taskId, fileName, null); }
[ "public", "FileProperties", "getFilePropertiesFromTask", "(", "String", "jobId", ",", "String", "taskId", ",", "String", "fileName", ")", "throws", "BatchErrorException", ",", "IOException", "{", "return", "getFilePropertiesFromTask", "(", "jobId", ",", "taskId", ",", "fileName", ",", "null", ")", ";", "}" ]
Gets information about a file from the specified task's directory on its compute node. @param jobId The ID of the job containing the task. @param taskId The ID of the task. @param fileName The name of the file to retrieve. @return A {@link FileProperties} instance containing information about the file. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Gets", "information", "about", "a", "file", "from", "the", "specified", "task", "s", "directory", "on", "its", "compute", "node", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/FileOperations.java#L330-L332
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/BandwidthClient.java
BandwidthClient.generateGetRequest
protected HttpGet generateGetRequest(final String path, final Map<String, Object> paramMap) { """ Helper method to build the GET request for the server. @param path the path. @param paramMap the parameters map. @return the get object. """ final List<NameValuePair> pairs = new ArrayList<NameValuePair>(); for (final String key : paramMap.keySet()) { pairs.add(new BasicNameValuePair(key, paramMap.get(key).toString())); } final URI uri = buildUri(path, pairs); return new HttpGet(uri); }
java
protected HttpGet generateGetRequest(final String path, final Map<String, Object> paramMap) { final List<NameValuePair> pairs = new ArrayList<NameValuePair>(); for (final String key : paramMap.keySet()) { pairs.add(new BasicNameValuePair(key, paramMap.get(key).toString())); } final URI uri = buildUri(path, pairs); return new HttpGet(uri); }
[ "protected", "HttpGet", "generateGetRequest", "(", "final", "String", "path", ",", "final", "Map", "<", "String", ",", "Object", ">", "paramMap", ")", "{", "final", "List", "<", "NameValuePair", ">", "pairs", "=", "new", "ArrayList", "<", "NameValuePair", ">", "(", ")", ";", "for", "(", "final", "String", "key", ":", "paramMap", ".", "keySet", "(", ")", ")", "{", "pairs", ".", "add", "(", "new", "BasicNameValuePair", "(", "key", ",", "paramMap", ".", "get", "(", "key", ")", ".", "toString", "(", ")", ")", ")", ";", "}", "final", "URI", "uri", "=", "buildUri", "(", "path", ",", "pairs", ")", ";", "return", "new", "HttpGet", "(", "uri", ")", ";", "}" ]
Helper method to build the GET request for the server. @param path the path. @param paramMap the parameters map. @return the get object.
[ "Helper", "method", "to", "build", "the", "GET", "request", "for", "the", "server", "." ]
train
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/BandwidthClient.java#L610-L617
xmlunit/xmlunit
xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/ElementNameQualifier.java
ElementNameQualifier.qualifyForComparison
public boolean qualifyForComparison(Element control, Element test) { """ Determine whether two elements qualify for further Difference comparison. @param control @param test @return true if the two elements qualify for further comparison based on their similar namespace URI and non-namespaced tag name, false otherwise """ return ElementSelectors.byName.canBeCompared(control, test); }
java
public boolean qualifyForComparison(Element control, Element test) { return ElementSelectors.byName.canBeCompared(control, test); }
[ "public", "boolean", "qualifyForComparison", "(", "Element", "control", ",", "Element", "test", ")", "{", "return", "ElementSelectors", ".", "byName", ".", "canBeCompared", "(", "control", ",", "test", ")", ";", "}" ]
Determine whether two elements qualify for further Difference comparison. @param control @param test @return true if the two elements qualify for further comparison based on their similar namespace URI and non-namespaced tag name, false otherwise
[ "Determine", "whether", "two", "elements", "qualify", "for", "further", "Difference", "comparison", "." ]
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/ElementNameQualifier.java#L59-L61
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java
SarlBatchCompiler.createTempDir
protected File createTempDir(String namePrefix) { """ Create a temporary subdirectory inside the root temp directory. @param namePrefix the prefix for the folder name. @return the temp directory. @see #getTempDirectory() """ final File tempDir = new File(getTempDirectory(), namePrefix); cleanFolder(tempDir, ACCEPT_ALL_FILTER, true, true); if (!tempDir.mkdirs()) { throw new RuntimeException(MessageFormat.format(Messages.SarlBatchCompiler_8, tempDir.getAbsolutePath())); } this.tempFolders.add(tempDir); return tempDir; }
java
protected File createTempDir(String namePrefix) { final File tempDir = new File(getTempDirectory(), namePrefix); cleanFolder(tempDir, ACCEPT_ALL_FILTER, true, true); if (!tempDir.mkdirs()) { throw new RuntimeException(MessageFormat.format(Messages.SarlBatchCompiler_8, tempDir.getAbsolutePath())); } this.tempFolders.add(tempDir); return tempDir; }
[ "protected", "File", "createTempDir", "(", "String", "namePrefix", ")", "{", "final", "File", "tempDir", "=", "new", "File", "(", "getTempDirectory", "(", ")", ",", "namePrefix", ")", ";", "cleanFolder", "(", "tempDir", ",", "ACCEPT_ALL_FILTER", ",", "true", ",", "true", ")", ";", "if", "(", "!", "tempDir", ".", "mkdirs", "(", ")", ")", "{", "throw", "new", "RuntimeException", "(", "MessageFormat", ".", "format", "(", "Messages", ".", "SarlBatchCompiler_8", ",", "tempDir", ".", "getAbsolutePath", "(", ")", ")", ")", ";", "}", "this", ".", "tempFolders", ".", "add", "(", "tempDir", ")", ";", "return", "tempDir", ";", "}" ]
Create a temporary subdirectory inside the root temp directory. @param namePrefix the prefix for the folder name. @return the temp directory. @see #getTempDirectory()
[ "Create", "a", "temporary", "subdirectory", "inside", "the", "root", "temp", "directory", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/batch/SarlBatchCompiler.java#L1902-L1910
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/tools/DFSAdmin.java
DFSAdmin.refreshNamenodes
public int refreshNamenodes(String[] argv, int i) throws IOException { """ Refresh the namenodes served by the {@link DataNode}. Usage: java DFSAdmin -refreshNamenodes datanodehost:port @param argv List of of command line parameters. @param idx The index of the command that is being processed. @exception IOException if an error accoured wile accessing the file or path. @return exitcode 0 on success, non-zero on failure """ ClientDatanodeProtocol datanode = null; String dnAddr = (argv.length == 2) ? argv[i] : null; try { datanode = getClientDatanodeProtocol(dnAddr); if (datanode != null) { datanode.refreshNamenodes(); return 0; } else { return -1; } } finally { if (datanode != null && Proxy.isProxyClass(datanode.getClass())) { RPC.stopProxy(datanode); } } }
java
public int refreshNamenodes(String[] argv, int i) throws IOException { ClientDatanodeProtocol datanode = null; String dnAddr = (argv.length == 2) ? argv[i] : null; try { datanode = getClientDatanodeProtocol(dnAddr); if (datanode != null) { datanode.refreshNamenodes(); return 0; } else { return -1; } } finally { if (datanode != null && Proxy.isProxyClass(datanode.getClass())) { RPC.stopProxy(datanode); } } }
[ "public", "int", "refreshNamenodes", "(", "String", "[", "]", "argv", ",", "int", "i", ")", "throws", "IOException", "{", "ClientDatanodeProtocol", "datanode", "=", "null", ";", "String", "dnAddr", "=", "(", "argv", ".", "length", "==", "2", ")", "?", "argv", "[", "i", "]", ":", "null", ";", "try", "{", "datanode", "=", "getClientDatanodeProtocol", "(", "dnAddr", ")", ";", "if", "(", "datanode", "!=", "null", ")", "{", "datanode", ".", "refreshNamenodes", "(", ")", ";", "return", "0", ";", "}", "else", "{", "return", "-", "1", ";", "}", "}", "finally", "{", "if", "(", "datanode", "!=", "null", "&&", "Proxy", ".", "isProxyClass", "(", "datanode", ".", "getClass", "(", ")", ")", ")", "{", "RPC", ".", "stopProxy", "(", "datanode", ")", ";", "}", "}", "}" ]
Refresh the namenodes served by the {@link DataNode}. Usage: java DFSAdmin -refreshNamenodes datanodehost:port @param argv List of of command line parameters. @param idx The index of the command that is being processed. @exception IOException if an error accoured wile accessing the file or path. @return exitcode 0 on success, non-zero on failure
[ "Refresh", "the", "namenodes", "served", "by", "the", "{" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/tools/DFSAdmin.java#L832-L848
RogerParkinson/madura-objects-parent
madura-objects/src/main/java/org/springframework/context/support/JdbcMessageSource.java
JdbcMessageSource.resolveCodeInternal
protected MessageFormat resolveCodeInternal(String code, Locale locale) { """ Check in base the message associated with the given code and locale @param code the code of the message to solve @param locale the locale to check against @return a MessageFormat if one were found, either for the given locale or for the default on, or null if nothing could be found """ String result; lastQuery = System.currentTimeMillis(); try { result = (String) jdbcTemplate.queryForObject(sqlStatement, new Object[] { code, locale.toString() }, String.class); } catch (IncorrectResultSizeDataAccessException e) { if (locale != null) { // Retry without a locale if we checked with one before try { result = (String) jdbcTemplate.queryForObject(sqlStatement, new Object[] { code, null }, String.class); } catch (IncorrectResultSizeDataAccessException ex) { return null; } } else { return null; } } return new MessageFormat(result, locale); }
java
protected MessageFormat resolveCodeInternal(String code, Locale locale) { String result; lastQuery = System.currentTimeMillis(); try { result = (String) jdbcTemplate.queryForObject(sqlStatement, new Object[] { code, locale.toString() }, String.class); } catch (IncorrectResultSizeDataAccessException e) { if (locale != null) { // Retry without a locale if we checked with one before try { result = (String) jdbcTemplate.queryForObject(sqlStatement, new Object[] { code, null }, String.class); } catch (IncorrectResultSizeDataAccessException ex) { return null; } } else { return null; } } return new MessageFormat(result, locale); }
[ "protected", "MessageFormat", "resolveCodeInternal", "(", "String", "code", ",", "Locale", "locale", ")", "{", "String", "result", ";", "lastQuery", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "try", "{", "result", "=", "(", "String", ")", "jdbcTemplate", ".", "queryForObject", "(", "sqlStatement", ",", "new", "Object", "[", "]", "{", "code", ",", "locale", ".", "toString", "(", ")", "}", ",", "String", ".", "class", ")", ";", "}", "catch", "(", "IncorrectResultSizeDataAccessException", "e", ")", "{", "if", "(", "locale", "!=", "null", ")", "{", "// Retry without a locale if we checked with one before", "try", "{", "result", "=", "(", "String", ")", "jdbcTemplate", ".", "queryForObject", "(", "sqlStatement", ",", "new", "Object", "[", "]", "{", "code", ",", "null", "}", ",", "String", ".", "class", ")", ";", "}", "catch", "(", "IncorrectResultSizeDataAccessException", "ex", ")", "{", "return", "null", ";", "}", "}", "else", "{", "return", "null", ";", "}", "}", "return", "new", "MessageFormat", "(", "result", ",", "locale", ")", ";", "}" ]
Check in base the message associated with the given code and locale @param code the code of the message to solve @param locale the locale to check against @return a MessageFormat if one were found, either for the given locale or for the default on, or null if nothing could be found
[ "Check", "in", "base", "the", "message", "associated", "with", "the", "given", "code", "and", "locale" ]
train
https://github.com/RogerParkinson/madura-objects-parent/blob/9b5385dd0437611f0ce8506f63646e018d06fb8e/madura-objects/src/main/java/org/springframework/context/support/JdbcMessageSource.java#L100-L123
banq/jdonframework
JdonAccessory/jdon-struts1x/src/main/java/com/jdon/model/handler/HandlerMethodMetaArgsFactory.java
HandlerMethodMetaArgsFactory.createGetMethod
public MethodMetaArgs createGetMethod(HandlerMetaDef handlerMetaDef, Object keyValue) { """ create find method the service's find method parameter type must be String type @param handlerMetaDef @param keyValue @return MethodMetaArgs instance """ String p_methodName = handlerMetaDef.getFindMethod(); if (p_methodName == null) { Debug.logError("[JdonFramework] not configure the findMethod parameter: <getMethod name=XXXXX /> ", module); } if (keyValue == null) { Debug.logError("[JdonFramework] not found model's key value:" + handlerMetaDef.getModelMapping().getKeyName() + "=? in request parameters", module); } return createCRUDMethodMetaArgs(p_methodName, keyValue); }
java
public MethodMetaArgs createGetMethod(HandlerMetaDef handlerMetaDef, Object keyValue) { String p_methodName = handlerMetaDef.getFindMethod(); if (p_methodName == null) { Debug.logError("[JdonFramework] not configure the findMethod parameter: <getMethod name=XXXXX /> ", module); } if (keyValue == null) { Debug.logError("[JdonFramework] not found model's key value:" + handlerMetaDef.getModelMapping().getKeyName() + "=? in request parameters", module); } return createCRUDMethodMetaArgs(p_methodName, keyValue); }
[ "public", "MethodMetaArgs", "createGetMethod", "(", "HandlerMetaDef", "handlerMetaDef", ",", "Object", "keyValue", ")", "{", "String", "p_methodName", "=", "handlerMetaDef", ".", "getFindMethod", "(", ")", ";", "if", "(", "p_methodName", "==", "null", ")", "{", "Debug", ".", "logError", "(", "\"[JdonFramework] not configure the findMethod parameter: <getMethod name=XXXXX /> \"", ",", "module", ")", ";", "}", "if", "(", "keyValue", "==", "null", ")", "{", "Debug", ".", "logError", "(", "\"[JdonFramework] not found model's key value:\"", "+", "handlerMetaDef", ".", "getModelMapping", "(", ")", ".", "getKeyName", "(", ")", "+", "\"=? in request parameters\"", ",", "module", ")", ";", "}", "return", "createCRUDMethodMetaArgs", "(", "p_methodName", ",", "keyValue", ")", ";", "}" ]
create find method the service's find method parameter type must be String type @param handlerMetaDef @param keyValue @return MethodMetaArgs instance
[ "create", "find", "method", "the", "service", "s", "find", "method", "parameter", "type", "must", "be", "String", "type" ]
train
https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/JdonAccessory/jdon-struts1x/src/main/java/com/jdon/model/handler/HandlerMethodMetaArgsFactory.java#L61-L72
lucee/Lucee
core/src/main/java/lucee/runtime/type/util/QueryUtil.java
QueryUtil.getValue
@Deprecated public static Object getValue(QueryColumn column, int row) { """ return the value at the given position (row), returns the default empty value ("" or null) for wrong row or null values. this method only exist for backward compatibility and should not be used for new functinality @param column @param row @return @deprecated use instead QueryColumn.get(int,Object) """// print.ds(); if (NullSupportHelper.full()) return column.get(row, null); Object v = column.get(row, ""); return v == null ? "" : v; }
java
@Deprecated public static Object getValue(QueryColumn column, int row) {// print.ds(); if (NullSupportHelper.full()) return column.get(row, null); Object v = column.get(row, ""); return v == null ? "" : v; }
[ "@", "Deprecated", "public", "static", "Object", "getValue", "(", "QueryColumn", "column", ",", "int", "row", ")", "{", "// print.ds();", "if", "(", "NullSupportHelper", ".", "full", "(", ")", ")", "return", "column", ".", "get", "(", "row", ",", "null", ")", ";", "Object", "v", "=", "column", ".", "get", "(", "row", ",", "\"\"", ")", ";", "return", "v", "==", "null", "?", "\"\"", ":", "v", ";", "}" ]
return the value at the given position (row), returns the default empty value ("" or null) for wrong row or null values. this method only exist for backward compatibility and should not be used for new functinality @param column @param row @return @deprecated use instead QueryColumn.get(int,Object)
[ "return", "the", "value", "at", "the", "given", "position", "(", "row", ")", "returns", "the", "default", "empty", "value", "(", "or", "null", ")", "for", "wrong", "row", "or", "null", "values", ".", "this", "method", "only", "exist", "for", "backward", "compatibility", "and", "should", "not", "be", "used", "for", "new", "functinality" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/QueryUtil.java#L354-L359
neoremind/fluent-validator
fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/FluentValidator.java
FluentValidator.putAttribute2Context
public FluentValidator putAttribute2Context(String key, Object value) { """ 将键值对放入上下文 @param key 键 @param value 值 @return FluentValidator """ if (context == null) { context = new ValidatorContext(); } context.setAttribute(key, value); return this; }
java
public FluentValidator putAttribute2Context(String key, Object value) { if (context == null) { context = new ValidatorContext(); } context.setAttribute(key, value); return this; }
[ "public", "FluentValidator", "putAttribute2Context", "(", "String", "key", ",", "Object", "value", ")", "{", "if", "(", "context", "==", "null", ")", "{", "context", "=", "new", "ValidatorContext", "(", ")", ";", "}", "context", ".", "setAttribute", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
将键值对放入上下文 @param key 键 @param value 值 @return FluentValidator
[ "将键值对放入上下文" ]
train
https://github.com/neoremind/fluent-validator/blob/b516970591aa9468b44ba63938b98ec341fd6ead/fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/FluentValidator.java#L100-L106
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.deleteProject
public void deleteProject(CmsDbContext dbc, CmsProject deleteProject, boolean resetResources) throws CmsException { """ Deletes a project.<p> Only the admin or the owner of the project can do this. @param dbc the current database context @param deleteProject the project to be deleted @param resetResources if true, the resources of the project to delete will be reset to their online state, or deleted if they have no online state @throws CmsException if something goes wrong """ CmsUUID projectId = deleteProject.getUuid(); if (resetResources) { // changed/new/deleted files in the specified project List<CmsResource> modifiedFiles = readChangedResourcesInsideProject(dbc, projectId, RCPRM_FILES_ONLY_MODE); // changed/new/deleted folders in the specified project List<CmsResource> modifiedFolders = readChangedResourcesInsideProject( dbc, projectId, RCPRM_FOLDERS_ONLY_MODE); resetResourcesInProject(dbc, projectId, modifiedFiles, modifiedFolders); } // unlock all resources in the project m_lockManager.removeResourcesInProject(deleteProject.getUuid(), true); m_monitor.clearAccessControlListCache(); m_monitor.clearResourceCache(); // set project to online project if current project is the one which will be deleted if (projectId.equals(dbc.currentProject().getUuid())) { dbc.getRequestContext().setCurrentProject(readProject(dbc, CmsProject.ONLINE_PROJECT_ID)); } // delete the project itself getProjectDriver(dbc).deleteProject(dbc, deleteProject); m_monitor.uncacheProject(deleteProject); // fire the corresponding event OpenCms.fireCmsEvent( new CmsEvent( I_CmsEventListener.EVENT_PROJECT_MODIFIED, Collections.<String, Object> singletonMap("project", deleteProject))); }
java
public void deleteProject(CmsDbContext dbc, CmsProject deleteProject, boolean resetResources) throws CmsException { CmsUUID projectId = deleteProject.getUuid(); if (resetResources) { // changed/new/deleted files in the specified project List<CmsResource> modifiedFiles = readChangedResourcesInsideProject(dbc, projectId, RCPRM_FILES_ONLY_MODE); // changed/new/deleted folders in the specified project List<CmsResource> modifiedFolders = readChangedResourcesInsideProject( dbc, projectId, RCPRM_FOLDERS_ONLY_MODE); resetResourcesInProject(dbc, projectId, modifiedFiles, modifiedFolders); } // unlock all resources in the project m_lockManager.removeResourcesInProject(deleteProject.getUuid(), true); m_monitor.clearAccessControlListCache(); m_monitor.clearResourceCache(); // set project to online project if current project is the one which will be deleted if (projectId.equals(dbc.currentProject().getUuid())) { dbc.getRequestContext().setCurrentProject(readProject(dbc, CmsProject.ONLINE_PROJECT_ID)); } // delete the project itself getProjectDriver(dbc).deleteProject(dbc, deleteProject); m_monitor.uncacheProject(deleteProject); // fire the corresponding event OpenCms.fireCmsEvent( new CmsEvent( I_CmsEventListener.EVENT_PROJECT_MODIFIED, Collections.<String, Object> singletonMap("project", deleteProject))); }
[ "public", "void", "deleteProject", "(", "CmsDbContext", "dbc", ",", "CmsProject", "deleteProject", ",", "boolean", "resetResources", ")", "throws", "CmsException", "{", "CmsUUID", "projectId", "=", "deleteProject", ".", "getUuid", "(", ")", ";", "if", "(", "resetResources", ")", "{", "// changed/new/deleted files in the specified project", "List", "<", "CmsResource", ">", "modifiedFiles", "=", "readChangedResourcesInsideProject", "(", "dbc", ",", "projectId", ",", "RCPRM_FILES_ONLY_MODE", ")", ";", "// changed/new/deleted folders in the specified project", "List", "<", "CmsResource", ">", "modifiedFolders", "=", "readChangedResourcesInsideProject", "(", "dbc", ",", "projectId", ",", "RCPRM_FOLDERS_ONLY_MODE", ")", ";", "resetResourcesInProject", "(", "dbc", ",", "projectId", ",", "modifiedFiles", ",", "modifiedFolders", ")", ";", "}", "// unlock all resources in the project", "m_lockManager", ".", "removeResourcesInProject", "(", "deleteProject", ".", "getUuid", "(", ")", ",", "true", ")", ";", "m_monitor", ".", "clearAccessControlListCache", "(", ")", ";", "m_monitor", ".", "clearResourceCache", "(", ")", ";", "// set project to online project if current project is the one which will be deleted", "if", "(", "projectId", ".", "equals", "(", "dbc", ".", "currentProject", "(", ")", ".", "getUuid", "(", ")", ")", ")", "{", "dbc", ".", "getRequestContext", "(", ")", ".", "setCurrentProject", "(", "readProject", "(", "dbc", ",", "CmsProject", ".", "ONLINE_PROJECT_ID", ")", ")", ";", "}", "// delete the project itself", "getProjectDriver", "(", "dbc", ")", ".", "deleteProject", "(", "dbc", ",", "deleteProject", ")", ";", "m_monitor", ".", "uncacheProject", "(", "deleteProject", ")", ";", "// fire the corresponding event", "OpenCms", ".", "fireCmsEvent", "(", "new", "CmsEvent", "(", "I_CmsEventListener", ".", "EVENT_PROJECT_MODIFIED", ",", "Collections", ".", "<", "String", ",", "Object", ">", "singletonMap", "(", "\"project\"", ",", "deleteProject", ")", ")", ")", ";", "}" ]
Deletes a project.<p> Only the admin or the owner of the project can do this. @param dbc the current database context @param deleteProject the project to be deleted @param resetResources if true, the resources of the project to delete will be reset to their online state, or deleted if they have no online state @throws CmsException if something goes wrong
[ "Deletes", "a", "project", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L2703-L2738
denisneuling/apitrary.jar
apitrary-api-client/src/main/java/com/apitrary/api/client/util/ClassUtil.java
ClassUtil.getValueOf
@SuppressWarnings("unchecked") public static <T> T getValueOf(Field field, Object reference, Class<?> referenceClazz, Class<T> valueType) { """ <p> getValueOf. </p> @param field a {@link java.lang.reflect.Field} object. @param valueType a {@link java.lang.Class} object. @param <T> a T object. @return a T object. """ try { field.setAccessible(true); Object toReturn = (T) field.get(reference); if (String.class.isInstance(valueType.getClass()) && !String.class.isInstance(toReturn.getClass())) { toReturn = toReturn.toString(); } return (T) toReturn; } catch (Exception e) { log.warning(e.getClass().getSimpleName() + ": " + e.getMessage()); return null; } }
java
@SuppressWarnings("unchecked") public static <T> T getValueOf(Field field, Object reference, Class<?> referenceClazz, Class<T> valueType) { try { field.setAccessible(true); Object toReturn = (T) field.get(reference); if (String.class.isInstance(valueType.getClass()) && !String.class.isInstance(toReturn.getClass())) { toReturn = toReturn.toString(); } return (T) toReturn; } catch (Exception e) { log.warning(e.getClass().getSimpleName() + ": " + e.getMessage()); return null; } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "getValueOf", "(", "Field", "field", ",", "Object", "reference", ",", "Class", "<", "?", ">", "referenceClazz", ",", "Class", "<", "T", ">", "valueType", ")", "{", "try", "{", "field", ".", "setAccessible", "(", "true", ")", ";", "Object", "toReturn", "=", "(", "T", ")", "field", ".", "get", "(", "reference", ")", ";", "if", "(", "String", ".", "class", ".", "isInstance", "(", "valueType", ".", "getClass", "(", ")", ")", "&&", "!", "String", ".", "class", ".", "isInstance", "(", "toReturn", ".", "getClass", "(", ")", ")", ")", "{", "toReturn", "=", "toReturn", ".", "toString", "(", ")", ";", "}", "return", "(", "T", ")", "toReturn", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "warning", "(", "e", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", "+", "\": \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "return", "null", ";", "}", "}" ]
<p> getValueOf. </p> @param field a {@link java.lang.reflect.Field} object. @param valueType a {@link java.lang.Class} object. @param <T> a T object. @return a T object.
[ "<p", ">", "getValueOf", ".", "<", "/", "p", ">" ]
train
https://github.com/denisneuling/apitrary.jar/blob/b7f639a1e735c60ba2b1b62851926757f5de8628/apitrary-api-client/src/main/java/com/apitrary/api/client/util/ClassUtil.java#L185-L198
mirage-sql/mirage
src/main/java/com/miragesql/miragesql/util/MirageUtil.java
MirageUtil.getColumnName
public static String getColumnName(EntityOperator entityOperator, Class<?> clazz, PropertyDesc pd, NameConverter nameConverter) { """ Returns the column name from the property. <p> If the property has {@link Column} annotation then this method returns the annotated column name, otherwise creates column name from the property name using {@link NameConverter}. @param entityOperator the entity operator @param pd the property @param clazz the class @param nameConverter the name converter @return the column name """ ColumnInfo column = entityOperator.getColumnInfo(clazz, pd, nameConverter); if(column != null){ return column.name; } else { return nameConverter.propertyToColumn(pd.getPropertyName()); } }
java
public static String getColumnName(EntityOperator entityOperator, Class<?> clazz, PropertyDesc pd, NameConverter nameConverter){ ColumnInfo column = entityOperator.getColumnInfo(clazz, pd, nameConverter); if(column != null){ return column.name; } else { return nameConverter.propertyToColumn(pd.getPropertyName()); } }
[ "public", "static", "String", "getColumnName", "(", "EntityOperator", "entityOperator", ",", "Class", "<", "?", ">", "clazz", ",", "PropertyDesc", "pd", ",", "NameConverter", "nameConverter", ")", "{", "ColumnInfo", "column", "=", "entityOperator", ".", "getColumnInfo", "(", "clazz", ",", "pd", ",", "nameConverter", ")", ";", "if", "(", "column", "!=", "null", ")", "{", "return", "column", ".", "name", ";", "}", "else", "{", "return", "nameConverter", ".", "propertyToColumn", "(", "pd", ".", "getPropertyName", "(", ")", ")", ";", "}", "}" ]
Returns the column name from the property. <p> If the property has {@link Column} annotation then this method returns the annotated column name, otherwise creates column name from the property name using {@link NameConverter}. @param entityOperator the entity operator @param pd the property @param clazz the class @param nameConverter the name converter @return the column name
[ "Returns", "the", "column", "name", "from", "the", "property", ".", "<p", ">", "If", "the", "property", "has", "{", "@link", "Column", "}", "annotation", "then", "this", "method", "returns", "the", "annotated", "column", "name", "otherwise", "creates", "column", "name", "from", "the", "property", "name", "using", "{", "@link", "NameConverter", "}", "." ]
train
https://github.com/mirage-sql/mirage/blob/29a44b7ad267b5a48bc250cd0ef7d74813d46889/src/main/java/com/miragesql/miragesql/util/MirageUtil.java#L102-L109
litsec/swedish-eid-shibboleth-base
shibboleth-base/shibboleth-extensions/src/main/java/se/litsec/shibboleth/idp/authn/service/impl/AbstractAuthenticationBaseService.java
AbstractAuthenticationBaseService.getLogString
protected String getLogString(ProfileRequestContext<?, ?> context) { """ Returns a string to include in logging statements. The returned log string contains information about the current request being processed. The format on the log string is {@code key1='value1',key2='value2', ...}. @param context request context @return a string to be used in log entries """ try { AuthnRequest authnRequest = this.getAuthnRequest(context); return String.format("request-id='%s',sp='%s'", authnRequest.getID(), authnRequest.getIssuer().getValue()); } catch (Exception e) { return ""; } }
java
protected String getLogString(ProfileRequestContext<?, ?> context) { try { AuthnRequest authnRequest = this.getAuthnRequest(context); return String.format("request-id='%s',sp='%s'", authnRequest.getID(), authnRequest.getIssuer().getValue()); } catch (Exception e) { return ""; } }
[ "protected", "String", "getLogString", "(", "ProfileRequestContext", "<", "?", ",", "?", ">", "context", ")", "{", "try", "{", "AuthnRequest", "authnRequest", "=", "this", ".", "getAuthnRequest", "(", "context", ")", ";", "return", "String", ".", "format", "(", "\"request-id='%s',sp='%s'\"", ",", "authnRequest", ".", "getID", "(", ")", ",", "authnRequest", ".", "getIssuer", "(", ")", ".", "getValue", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "\"\"", ";", "}", "}" ]
Returns a string to include in logging statements. The returned log string contains information about the current request being processed. The format on the log string is {@code key1='value1',key2='value2', ...}. @param context request context @return a string to be used in log entries
[ "Returns", "a", "string", "to", "include", "in", "logging", "statements", ".", "The", "returned", "log", "string", "contains", "information", "about", "the", "current", "request", "being", "processed", ".", "The", "format", "on", "the", "log", "string", "is", "{", "@code", "key1", "=", "value1", "key2", "=", "value2", "...", "}", "." ]
train
https://github.com/litsec/swedish-eid-shibboleth-base/blob/aaaa467ff61f07d7dfa31627fb36851a37da6804/shibboleth-base/shibboleth-extensions/src/main/java/se/litsec/shibboleth/idp/authn/service/impl/AbstractAuthenticationBaseService.java#L83-L91
zxing/zxing
android/src/com/google/zxing/client/android/HttpHelper.java
HttpHelper.downloadViaHttp
public static CharSequence downloadViaHttp(String uri, ContentType type) throws IOException { """ Downloads the entire resource instead of part. @param uri URI to retrieve @param type expected text-like MIME type of that content @return content as a {@code String} @throws IOException if the content can't be retrieved because of a bad URI, network problem, etc. @see #downloadViaHttp(String, HttpHelper.ContentType, int) """ return downloadViaHttp(uri, type, Integer.MAX_VALUE); }
java
public static CharSequence downloadViaHttp(String uri, ContentType type) throws IOException { return downloadViaHttp(uri, type, Integer.MAX_VALUE); }
[ "public", "static", "CharSequence", "downloadViaHttp", "(", "String", "uri", ",", "ContentType", "type", ")", "throws", "IOException", "{", "return", "downloadViaHttp", "(", "uri", ",", "type", ",", "Integer", ".", "MAX_VALUE", ")", ";", "}" ]
Downloads the entire resource instead of part. @param uri URI to retrieve @param type expected text-like MIME type of that content @return content as a {@code String} @throws IOException if the content can't be retrieved because of a bad URI, network problem, etc. @see #downloadViaHttp(String, HttpHelper.ContentType, int)
[ "Downloads", "the", "entire", "resource", "instead", "of", "part", "." ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/android/src/com/google/zxing/client/android/HttpHelper.java#L68-L70