repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/util/logging/PlatformLogger.java
PlatformLogger.redirectToJavaLoggerProxy
private void redirectToJavaLoggerProxy() { DefaultLoggerProxy lp = DefaultLoggerProxy.class.cast(this.loggerProxy); JavaLoggerProxy jlp = new JavaLoggerProxy(lp.name, lp.level); // the order of assignments is important this.javaLoggerProxy = jlp; // isLoggable checks javaLoggerProxy if set this.loggerProxy = jlp; }
java
private void redirectToJavaLoggerProxy() { DefaultLoggerProxy lp = DefaultLoggerProxy.class.cast(this.loggerProxy); JavaLoggerProxy jlp = new JavaLoggerProxy(lp.name, lp.level); // the order of assignments is important this.javaLoggerProxy = jlp; // isLoggable checks javaLoggerProxy if set this.loggerProxy = jlp; }
[ "private", "void", "redirectToJavaLoggerProxy", "(", ")", "{", "DefaultLoggerProxy", "lp", "=", "DefaultLoggerProxy", ".", "class", ".", "cast", "(", "this", ".", "loggerProxy", ")", ";", "JavaLoggerProxy", "jlp", "=", "new", "JavaLoggerProxy", "(", "lp", ".", ...
Creates a new JavaLoggerProxy and redirects the platform logger to it
[ "Creates", "a", "new", "JavaLoggerProxy", "and", "redirects", "the", "platform", "logger", "to", "it" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/util/logging/PlatformLogger.java#L225-L231
StanKocken/EfficientAdapter
efficientadapter/src/main/java/com/skocken/efficientadapter/lib/util/ViewHelper.java
ViewHelper.setBackground
public static void setBackground(EfficientCacheView cacheView, int viewId, Drawable drawable) { View view = cacheView.findViewByIdEfficient(viewId); if (view != null) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { view.setBackgroundDrawable(drawable); } else { view.setBackground(drawable); } } }
java
public static void setBackground(EfficientCacheView cacheView, int viewId, Drawable drawable) { View view = cacheView.findViewByIdEfficient(viewId); if (view != null) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { view.setBackgroundDrawable(drawable); } else { view.setBackground(drawable); } } }
[ "public", "static", "void", "setBackground", "(", "EfficientCacheView", "cacheView", ",", "int", "viewId", ",", "Drawable", "drawable", ")", "{", "View", "view", "=", "cacheView", ".", "findViewByIdEfficient", "(", "viewId", ")", ";", "if", "(", "view", "!=", ...
Equivalent to calling View.setBackground @param cacheView The cache of views to get the view from @param viewId The id of the view whose background should change @param drawable The new background for the view
[ "Equivalent", "to", "calling", "View", ".", "setBackground" ]
train
https://github.com/StanKocken/EfficientAdapter/blob/0bcc3a20182cbce9d7901e1e2a9104251637167d/efficientadapter/src/main/java/com/skocken/efficientadapter/lib/util/ViewHelper.java#L38-L47
eclipse/hawkbit
hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaRolloutManagement.java
JpaRolloutManagement.scheduleRolloutGroup
private boolean scheduleRolloutGroup(final JpaRollout rollout, final JpaRolloutGroup group) { final long targetsInGroup = rolloutTargetGroupRepository.countByRolloutGroup(group); final long countOfActions = actionRepository.countByRolloutAndRolloutGroup(rollout, group); long actionsLeft = targetsInGroup - countOfActions; if (actionsLeft > 0) { actionsLeft -= createActionsForRolloutGroup(rollout, group); } if (actionsLeft <= 0) { group.setStatus(RolloutGroupStatus.SCHEDULED); rolloutGroupRepository.save(group); return true; } return false; }
java
private boolean scheduleRolloutGroup(final JpaRollout rollout, final JpaRolloutGroup group) { final long targetsInGroup = rolloutTargetGroupRepository.countByRolloutGroup(group); final long countOfActions = actionRepository.countByRolloutAndRolloutGroup(rollout, group); long actionsLeft = targetsInGroup - countOfActions; if (actionsLeft > 0) { actionsLeft -= createActionsForRolloutGroup(rollout, group); } if (actionsLeft <= 0) { group.setStatus(RolloutGroupStatus.SCHEDULED); rolloutGroupRepository.save(group); return true; } return false; }
[ "private", "boolean", "scheduleRolloutGroup", "(", "final", "JpaRollout", "rollout", ",", "final", "JpaRolloutGroup", "group", ")", "{", "final", "long", "targetsInGroup", "=", "rolloutTargetGroupRepository", ".", "countByRolloutGroup", "(", "group", ")", ";", "final"...
Schedules a group of the rollout. Scheduled Actions are created to achieve this. The creation of those Actions is allowed to fail.
[ "Schedules", "a", "group", "of", "the", "rollout", ".", "Scheduled", "Actions", "are", "created", "to", "achieve", "this", ".", "The", "creation", "of", "those", "Actions", "is", "allowed", "to", "fail", "." ]
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaRolloutManagement.java#L542-L557
Netflix/conductor
common/src/main/java/com/netflix/conductor/common/metadata/tasks/TaskResult.java
TaskResult.addOutputData
public TaskResult addOutputData(String key, Object value) { this.outputData.put(key, value); return this; }
java
public TaskResult addOutputData(String key, Object value) { this.outputData.put(key, value); return this; }
[ "public", "TaskResult", "addOutputData", "(", "String", "key", ",", "Object", "value", ")", "{", "this", ".", "outputData", ".", "put", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Adds output @param key output field @param value value @return current instance
[ "Adds", "output" ]
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/common/src/main/java/com/netflix/conductor/common/metadata/tasks/TaskResult.java#L193-L196
CenturyLinkCloud/mdw
mdw-common/src/com/centurylink/mdw/util/StringHelper.java
StringHelper.Replace
public static String Replace(String aSrcStr, String aSearchStr, String aReplaceStr) { if (aSrcStr == null || aSearchStr == null || aReplaceStr == null) return aSrcStr; if (aSearchStr.length() == 0 || aSrcStr.length() == 0 || aSrcStr.indexOf(aSearchStr) == -1) { return aSrcStr; } StringBuffer mBuff = new StringBuffer(); int mSrcStrLen, mSearchStrLen; mSrcStrLen = aSrcStr.length(); mSearchStrLen = aSearchStr.length(); for (int i = 0, j = 0; i < mSrcStrLen; i = j + mSearchStrLen) { j = aSrcStr.indexOf(aSearchStr, i); if (j == -1) { mBuff.append(aSrcStr.substring(i)); break; } mBuff.append(aSrcStr.substring(i, j)); mBuff.append(aReplaceStr); } return mBuff.toString(); }
java
public static String Replace(String aSrcStr, String aSearchStr, String aReplaceStr) { if (aSrcStr == null || aSearchStr == null || aReplaceStr == null) return aSrcStr; if (aSearchStr.length() == 0 || aSrcStr.length() == 0 || aSrcStr.indexOf(aSearchStr) == -1) { return aSrcStr; } StringBuffer mBuff = new StringBuffer(); int mSrcStrLen, mSearchStrLen; mSrcStrLen = aSrcStr.length(); mSearchStrLen = aSearchStr.length(); for (int i = 0, j = 0; i < mSrcStrLen; i = j + mSearchStrLen) { j = aSrcStr.indexOf(aSearchStr, i); if (j == -1) { mBuff.append(aSrcStr.substring(i)); break; } mBuff.append(aSrcStr.substring(i, j)); mBuff.append(aReplaceStr); } return mBuff.toString(); }
[ "public", "static", "String", "Replace", "(", "String", "aSrcStr", ",", "String", "aSearchStr", ",", "String", "aReplaceStr", ")", "{", "if", "(", "aSrcStr", "==", "null", "||", "aSearchStr", "==", "null", "||", "aReplaceStr", "==", "null", ")", "return", ...
Replaces the 'search string' with 'replace string' in a given 'source string' @param aSrcStr A source String value. @param aSearchStr A String value to be searched for in the source String. @param aReplaceStr A String value that replaces the search String. @return A String with the 'search string' replaced by 'replace string'.
[ "Replaces", "the", "search", "string", "with", "replace", "string", "in", "a", "given", "source", "string" ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/util/StringHelper.java#L817-L842
azkaban/azkaban
azkaban-common/src/main/java/azkaban/executor/ExecutionController.java
ExecutionController.isFlowRunning
@Override public boolean isFlowRunning(final int projectId, final String flowId) { boolean isRunning = false; try { isRunning = isFlowRunningHelper(projectId, flowId, this.executorLoader.fetchUnfinishedFlows().values()); } catch (final ExecutorManagerException e) { logger.error( "Failed to check if the flow is running for project " + projectId + ", flow " + flowId, e); } return isRunning; }
java
@Override public boolean isFlowRunning(final int projectId, final String flowId) { boolean isRunning = false; try { isRunning = isFlowRunningHelper(projectId, flowId, this.executorLoader.fetchUnfinishedFlows().values()); } catch (final ExecutorManagerException e) { logger.error( "Failed to check if the flow is running for project " + projectId + ", flow " + flowId, e); } return isRunning; }
[ "@", "Override", "public", "boolean", "isFlowRunning", "(", "final", "int", "projectId", ",", "final", "String", "flowId", ")", "{", "boolean", "isRunning", "=", "false", ";", "try", "{", "isRunning", "=", "isFlowRunningHelper", "(", "projectId", ",", "flowId"...
Checks whether the given flow has an active (running, non-dispatched) execution from database. {@inheritDoc}
[ "Checks", "whether", "the", "given", "flow", "has", "an", "active", "(", "running", "non", "-", "dispatched", ")", "execution", "from", "database", ".", "{" ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-common/src/main/java/azkaban/executor/ExecutionController.java#L216-L229
rnorth/visible-assertions
src/main/java/org/rnorth/visibleassertions/VisibleAssertions.java
VisibleAssertions.assertTrue
public static void assertTrue(String message, boolean value) { if (value) { pass(message); } else { fail(message, null); } }
java
public static void assertTrue(String message, boolean value) { if (value) { pass(message); } else { fail(message, null); } }
[ "public", "static", "void", "assertTrue", "(", "String", "message", ",", "boolean", "value", ")", "{", "if", "(", "value", ")", "{", "pass", "(", "message", ")", ";", "}", "else", "{", "fail", "(", "message", ",", "null", ")", ";", "}", "}" ]
Assert that a value is true. <p> If the assertion passes, a green tick will be shown. If the assertion fails, a red cross will be shown. @param message message to display alongside the assertion outcome @param value value to test
[ "Assert", "that", "a", "value", "is", "true", ".", "<p", ">", "If", "the", "assertion", "passes", "a", "green", "tick", "will", "be", "shown", ".", "If", "the", "assertion", "fails", "a", "red", "cross", "will", "be", "shown", "." ]
train
https://github.com/rnorth/visible-assertions/blob/6d7a7724db40ac0e9f87279553f814b790310b3b/src/main/java/org/rnorth/visibleassertions/VisibleAssertions.java#L125-L131
javamelody/javamelody
javamelody-core/src/main/java/net/bull/javamelody/internal/publish/Graphite.java
Graphite.checkNoReturnedData
private void checkNoReturnedData(Socket socket) throws IOException { final InputStream input = socket.getInputStream(); if (input.available() > 0) { final byte[] bytes = new byte[1000]; final int toRead = Math.min(input.available(), bytes.length); final int read = input.read(bytes, 0, toRead); if (read > 0) { final String msg = "Data returned by graphite server when expecting no response! " + "Probably aimed at wrong socket or server. Make sure you " + "are publishing to the data port, not the dashboard port. First " + read + " bytes of response: " + new String(bytes, 0, read, "UTF-8"); LOG.warn(msg, new IOException(msg)); } } }
java
private void checkNoReturnedData(Socket socket) throws IOException { final InputStream input = socket.getInputStream(); if (input.available() > 0) { final byte[] bytes = new byte[1000]; final int toRead = Math.min(input.available(), bytes.length); final int read = input.read(bytes, 0, toRead); if (read > 0) { final String msg = "Data returned by graphite server when expecting no response! " + "Probably aimed at wrong socket or server. Make sure you " + "are publishing to the data port, not the dashboard port. First " + read + " bytes of response: " + new String(bytes, 0, read, "UTF-8"); LOG.warn(msg, new IOException(msg)); } } }
[ "private", "void", "checkNoReturnedData", "(", "Socket", "socket", ")", "throws", "IOException", "{", "final", "InputStream", "input", "=", "socket", ".", "getInputStream", "(", ")", ";", "if", "(", "input", ".", "available", "(", ")", ">", "0", ")", "{", ...
The graphite protocol is a "one-way" streaming protocol and as such there is no easy way to check that we are sending the output to the wrong place. We can aim the graphite writer at any listening socket and it will never care if the data is being correctly handled. By logging any returned bytes we can help make it obvious that it's talking to the wrong server/socket. In particular if its aimed at the web port of a graphite server this will make it print out the HTTP error message. @param socket Socket @throws IOException e
[ "The", "graphite", "protocol", "is", "a", "one", "-", "way", "streaming", "protocol", "and", "as", "such", "there", "is", "no", "easy", "way", "to", "check", "that", "we", "are", "sending", "the", "output", "to", "the", "wrong", "place", ".", "We", "ca...
train
https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-core/src/main/java/net/bull/javamelody/internal/publish/Graphite.java#L150-L164
groupon/odo
proxylib/src/main/java/com/groupon/odo/proxylib/OverrideService.java
OverrideService.disableAllOverrides
public void disableAllOverrides(int pathID, String clientUUID, int overrideType) { PreparedStatement statement = null; try (Connection sqlConnection = sqlService.getConnection()) { ArrayList<Integer> enabledOverrides = new ArrayList<Integer>(); enabledOverrides.add(Constants.PLUGIN_REQUEST_HEADER_OVERRIDE_ADD); enabledOverrides.add(Constants.PLUGIN_REQUEST_HEADER_OVERRIDE_REMOVE); enabledOverrides.add(Constants.PLUGIN_REQUEST_OVERRIDE_CUSTOM); enabledOverrides.add(Constants.PLUGIN_REQUEST_OVERRIDE_CUSTOM_POST_BODY); String overridePlaceholders = preparePlaceHolders(enabledOverrides.size()); statement = sqlConnection.prepareStatement( "DELETE FROM " + Constants.DB_TABLE_ENABLED_OVERRIDE + " WHERE " + Constants.ENABLED_OVERRIDES_PATH_ID + " = ? " + " AND " + Constants.GENERIC_CLIENT_UUID + " = ? " + " AND " + Constants.ENABLED_OVERRIDES_OVERRIDE_ID + (overrideType == Constants.OVERRIDE_TYPE_RESPONSE ? " NOT" : "") + " IN ( " + overridePlaceholders + " )" ); statement.setInt(1, pathID); statement.setString(2, clientUUID); for (int i = 3; i <= enabledOverrides.size() + 2; ++i) { statement.setInt(i, enabledOverrides.get(i - 3)); } statement.execute(); } catch (Exception e) { e.printStackTrace(); } finally { try { if (statement != null) { statement.close(); } } catch (Exception e) { } } }
java
public void disableAllOverrides(int pathID, String clientUUID, int overrideType) { PreparedStatement statement = null; try (Connection sqlConnection = sqlService.getConnection()) { ArrayList<Integer> enabledOverrides = new ArrayList<Integer>(); enabledOverrides.add(Constants.PLUGIN_REQUEST_HEADER_OVERRIDE_ADD); enabledOverrides.add(Constants.PLUGIN_REQUEST_HEADER_OVERRIDE_REMOVE); enabledOverrides.add(Constants.PLUGIN_REQUEST_OVERRIDE_CUSTOM); enabledOverrides.add(Constants.PLUGIN_REQUEST_OVERRIDE_CUSTOM_POST_BODY); String overridePlaceholders = preparePlaceHolders(enabledOverrides.size()); statement = sqlConnection.prepareStatement( "DELETE FROM " + Constants.DB_TABLE_ENABLED_OVERRIDE + " WHERE " + Constants.ENABLED_OVERRIDES_PATH_ID + " = ? " + " AND " + Constants.GENERIC_CLIENT_UUID + " = ? " + " AND " + Constants.ENABLED_OVERRIDES_OVERRIDE_ID + (overrideType == Constants.OVERRIDE_TYPE_RESPONSE ? " NOT" : "") + " IN ( " + overridePlaceholders + " )" ); statement.setInt(1, pathID); statement.setString(2, clientUUID); for (int i = 3; i <= enabledOverrides.size() + 2; ++i) { statement.setInt(i, enabledOverrides.get(i - 3)); } statement.execute(); } catch (Exception e) { e.printStackTrace(); } finally { try { if (statement != null) { statement.close(); } } catch (Exception e) { } } }
[ "public", "void", "disableAllOverrides", "(", "int", "pathID", ",", "String", "clientUUID", ",", "int", "overrideType", ")", "{", "PreparedStatement", "statement", "=", "null", ";", "try", "(", "Connection", "sqlConnection", "=", "sqlService", ".", "getConnection"...
Disable all overrides for a specified path with overrideType @param pathID ID of path containing overrides @param clientUUID UUID of client @param overrideType Override type identifier
[ "Disable", "all", "overrides", "for", "a", "specified", "path", "with", "overrideType" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxylib/src/main/java/com/groupon/odo/proxylib/OverrideService.java#L559-L595
Impetus/Kundera
src/kundera-elastic-search/src/main/java/com/impetus/client/es/utils/ESResponseWrapper.java
ESResponseWrapper.validateBucket
private boolean validateBucket(boolean left, boolean right, String logicalOperation) { logger.debug("Logical opertation " + logicalOperation + " found in having clause"); if (Expression.AND.equalsIgnoreCase(logicalOperation)) { return left && right; } else if (Expression.OR.equalsIgnoreCase(logicalOperation)) { return left || right; } else { logger.error(logicalOperation + " in having clause is not supported in Kundera"); throw new UnsupportedOperationException(logicalOperation + " in having clause is not supported in Kundera"); } }
java
private boolean validateBucket(boolean left, boolean right, String logicalOperation) { logger.debug("Logical opertation " + logicalOperation + " found in having clause"); if (Expression.AND.equalsIgnoreCase(logicalOperation)) { return left && right; } else if (Expression.OR.equalsIgnoreCase(logicalOperation)) { return left || right; } else { logger.error(logicalOperation + " in having clause is not supported in Kundera"); throw new UnsupportedOperationException(logicalOperation + " in having clause is not supported in Kundera"); } }
[ "private", "boolean", "validateBucket", "(", "boolean", "left", ",", "boolean", "right", ",", "String", "logicalOperation", ")", "{", "logger", ".", "debug", "(", "\"Logical opertation \"", "+", "logicalOperation", "+", "\" found in having clause\"", ")", ";", "if",...
Validate bucket. @param left the left @param right the right @param logicalOperation the logical operation @return true, if successful
[ "Validate", "bucket", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-elastic-search/src/main/java/com/impetus/client/es/utils/ESResponseWrapper.java#L446-L462
DV8FromTheWorld/JDA
src/main/java/net/dv8tion/jda/core/utils/PermissionUtil.java
PermissionUtil.getEffectivePermission
public static long getEffectivePermission(Channel channel, Member member) { Checks.notNull(channel, "Channel"); Checks.notNull(member, "Member"); Checks.check(channel.getGuild().equals(member.getGuild()), "Provided channel and provided member are not of the same guild!"); if (member.isOwner()) { // Owner effectively has all permissions return Permission.ALL_PERMISSIONS; } long permission = getEffectivePermission(member); final long admin = Permission.ADMINISTRATOR.getRawValue(); if (isApplied(permission, admin)) return Permission.ALL_PERMISSIONS; AtomicLong allow = new AtomicLong(0); AtomicLong deny = new AtomicLong(0); getExplicitOverrides(channel, member, allow, deny); permission = apply(permission, allow.get(), deny.get()); final long viewChannel = Permission.VIEW_CHANNEL.getRawValue(); //When the permission to view the channel is not applied it is not granted // This means that we have no access to this channel at all return isApplied(permission, viewChannel) ? permission : 0; /* // currently discord doesn't implicitly grant permissions that the user can grant others // so instead the user has to explicitly make an override to grant them the permission in order to be granted that permission // yes this makes no sense but what can i do, the devs don't like changing things apparently... // I've been told half a year ago this would be changed but nothing happens // so instead I'll just bend over for them so people get "correct" permission checks... // // only time will tell if something happens and I can finally re-implement this section wew final long managePerms = Permission.MANAGE_PERMISSIONS.getRawValue(); final long manageChannel = Permission.MANAGE_CHANNEL.getRawValue(); if ((permission & (managePerms | manageChannel)) != 0) { // In channels, MANAGE_CHANNEL and MANAGE_PERMISSIONS grant full text/voice permissions permission |= Permission.ALL_TEXT_PERMISSIONS | Permission.ALL_VOICE_PERMISSIONS; } */ }
java
public static long getEffectivePermission(Channel channel, Member member) { Checks.notNull(channel, "Channel"); Checks.notNull(member, "Member"); Checks.check(channel.getGuild().equals(member.getGuild()), "Provided channel and provided member are not of the same guild!"); if (member.isOwner()) { // Owner effectively has all permissions return Permission.ALL_PERMISSIONS; } long permission = getEffectivePermission(member); final long admin = Permission.ADMINISTRATOR.getRawValue(); if (isApplied(permission, admin)) return Permission.ALL_PERMISSIONS; AtomicLong allow = new AtomicLong(0); AtomicLong deny = new AtomicLong(0); getExplicitOverrides(channel, member, allow, deny); permission = apply(permission, allow.get(), deny.get()); final long viewChannel = Permission.VIEW_CHANNEL.getRawValue(); //When the permission to view the channel is not applied it is not granted // This means that we have no access to this channel at all return isApplied(permission, viewChannel) ? permission : 0; /* // currently discord doesn't implicitly grant permissions that the user can grant others // so instead the user has to explicitly make an override to grant them the permission in order to be granted that permission // yes this makes no sense but what can i do, the devs don't like changing things apparently... // I've been told half a year ago this would be changed but nothing happens // so instead I'll just bend over for them so people get "correct" permission checks... // // only time will tell if something happens and I can finally re-implement this section wew final long managePerms = Permission.MANAGE_PERMISSIONS.getRawValue(); final long manageChannel = Permission.MANAGE_CHANNEL.getRawValue(); if ((permission & (managePerms | manageChannel)) != 0) { // In channels, MANAGE_CHANNEL and MANAGE_PERMISSIONS grant full text/voice permissions permission |= Permission.ALL_TEXT_PERMISSIONS | Permission.ALL_VOICE_PERMISSIONS; } */ }
[ "public", "static", "long", "getEffectivePermission", "(", "Channel", "channel", ",", "Member", "member", ")", "{", "Checks", ".", "notNull", "(", "channel", ",", "\"Channel\"", ")", ";", "Checks", ".", "notNull", "(", "member", ",", "\"Member\"", ")", ";", ...
Gets the {@code long} representation of the effective permissions allowed for this {@link net.dv8tion.jda.core.entities.Member Member} in this {@link net.dv8tion.jda.core.entities.Channel Channel}. This can be used in conjunction with {@link net.dv8tion.jda.core.Permission#getPermissions(long) Permission.getPermissions(long)} to easily get a list of all {@link net.dv8tion.jda.core.Permission Permissions} that this member can use in this {@link net.dv8tion.jda.core.entities.Channel Channel}. <br>This functions very similarly to how {@link net.dv8tion.jda.core.entities.Role#getPermissionsRaw() Role.getPermissionsRaw()}. @param channel The {@link net.dv8tion.jda.core.entities.Channel Channel} being checked. @param member The {@link net.dv8tion.jda.core.entities.Member Member} whose permissions are being checked. @throws IllegalArgumentException if any of the provided parameters is {@code null} or the provided entities are not from the same guild @return The {@code long} representation of the effective permissions that this {@link net.dv8tion.jda.core.entities.Member Member} has in this {@link net.dv8tion.jda.core.entities.Channel Channel}.
[ "Gets", "the", "{", "@code", "long", "}", "representation", "of", "the", "effective", "permissions", "allowed", "for", "this", "{", "@link", "net", ".", "dv8tion", ".", "jda", ".", "core", ".", "entities", ".", "Member", "Member", "}", "in", "this", "{",...
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/utils/PermissionUtil.java#L361-L404
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/transform/fft/DiscreteFourierTransformOps.java
DiscreteFourierTransformOps.realToComplex
public static void realToComplex(GrayF64 real , InterleavedF64 complex ) { checkImageArguments(real,complex); for( int y = 0; y < complex.height; y++ ) { int indexReal = real.startIndex + y*real.stride; int indexComplex = complex.startIndex + y*complex.stride; for( int x = 0; x < real.width; x++, indexReal++ , indexComplex += 2 ) { complex.data[indexComplex] = real.data[indexReal]; complex.data[indexComplex+1] = 0; } } }
java
public static void realToComplex(GrayF64 real , InterleavedF64 complex ) { checkImageArguments(real,complex); for( int y = 0; y < complex.height; y++ ) { int indexReal = real.startIndex + y*real.stride; int indexComplex = complex.startIndex + y*complex.stride; for( int x = 0; x < real.width; x++, indexReal++ , indexComplex += 2 ) { complex.data[indexComplex] = real.data[indexReal]; complex.data[indexComplex+1] = 0; } } }
[ "public", "static", "void", "realToComplex", "(", "GrayF64", "real", ",", "InterleavedF64", "complex", ")", "{", "checkImageArguments", "(", "real", ",", "complex", ")", ";", "for", "(", "int", "y", "=", "0", ";", "y", "<", "complex", ".", "height", ";",...
Converts a regular image into a complex interleaved image with the imaginary component set to zero. @param real (Input) Regular image. @param complex (Output) Equivalent complex image.
[ "Converts", "a", "regular", "image", "into", "a", "complex", "interleaved", "image", "with", "the", "imaginary", "component", "set", "to", "zero", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/fft/DiscreteFourierTransformOps.java#L374-L386
CODAIT/stocator
src/main/java/com/ibm/stocator/fs/ObjectStoreVisitor.java
ObjectStoreVisitor.getStoreClient
public static IStoreClient getStoreClient(URI fsuri, Configuration conf) throws IOException { final String fsSchema = fsuri.toString().substring(0, fsuri.toString().indexOf("://")); final ClassLoader classLoader = ObjectStoreVisitor.class.getClassLoader(); String[] supportedSchemas = conf.get("fs.stocator.scheme.list", Constants.SWIFT).split(","); for (String scheme: supportedSchemas) { final String supportedScheme = conf.get("fs.stocator." + scheme.trim() + ".scheme", Constants.SWIFT2D); final String implementation = conf.get("fs.stocator." + scheme.trim() + ".impl", "com.ibm.stocator.fs.swift.SwiftAPIClient"); LOG.debug("Stocator schema space : {}, provided {}. Implementation {}", fsSchema, supportedScheme, implementation); if (fsSchema.equals(supportedScheme)) { LOG.info("Stocator registered as {} for {}", fsSchema, fsuri.toString()); IStoreClient storeClient; try { LOG.debug("Load implementation class {}", implementation); if (fsSchema.equals("cos") || fsSchema.equals("s3d")) { LOG.debug("Load direct init for COSAPIClient. Overwrite {}", implementation); storeClient = new COSAPIClient(fsuri, conf); } else { final Class<?> aClass = classLoader.loadClass(implementation); storeClient = (IStoreClient) aClass.getConstructor(URI.class, Configuration.class).newInstance(fsuri, conf); } } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException | SecurityException | ClassNotFoundException e) { LOG.error("Exception in load implementation class {}: {}", implementation, e.getMessage()); throw new IOException("No object store for: " + fsSchema, e); } try { storeClient.initiate(supportedScheme); return storeClient; } catch (IOException e) { LOG.error(e.getMessage()); throw e; } } } throw new IOException("No object store for: " + fsSchema); }
java
public static IStoreClient getStoreClient(URI fsuri, Configuration conf) throws IOException { final String fsSchema = fsuri.toString().substring(0, fsuri.toString().indexOf("://")); final ClassLoader classLoader = ObjectStoreVisitor.class.getClassLoader(); String[] supportedSchemas = conf.get("fs.stocator.scheme.list", Constants.SWIFT).split(","); for (String scheme: supportedSchemas) { final String supportedScheme = conf.get("fs.stocator." + scheme.trim() + ".scheme", Constants.SWIFT2D); final String implementation = conf.get("fs.stocator." + scheme.trim() + ".impl", "com.ibm.stocator.fs.swift.SwiftAPIClient"); LOG.debug("Stocator schema space : {}, provided {}. Implementation {}", fsSchema, supportedScheme, implementation); if (fsSchema.equals(supportedScheme)) { LOG.info("Stocator registered as {} for {}", fsSchema, fsuri.toString()); IStoreClient storeClient; try { LOG.debug("Load implementation class {}", implementation); if (fsSchema.equals("cos") || fsSchema.equals("s3d")) { LOG.debug("Load direct init for COSAPIClient. Overwrite {}", implementation); storeClient = new COSAPIClient(fsuri, conf); } else { final Class<?> aClass = classLoader.loadClass(implementation); storeClient = (IStoreClient) aClass.getConstructor(URI.class, Configuration.class).newInstance(fsuri, conf); } } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException | SecurityException | ClassNotFoundException e) { LOG.error("Exception in load implementation class {}: {}", implementation, e.getMessage()); throw new IOException("No object store for: " + fsSchema, e); } try { storeClient.initiate(supportedScheme); return storeClient; } catch (IOException e) { LOG.error(e.getMessage()); throw e; } } } throw new IOException("No object store for: " + fsSchema); }
[ "public", "static", "IStoreClient", "getStoreClient", "(", "URI", "fsuri", ",", "Configuration", "conf", ")", "throws", "IOException", "{", "final", "String", "fsSchema", "=", "fsuri", ".", "toString", "(", ")", ".", "substring", "(", "0", ",", "fsuri", ".",...
fs.stocator.scheme.list contains comma separated list of the provided back-end storage drivers. If none provided or key is not present, then 'swift' is the default value. For each provided scheme: fs.stocator.provided scheme.scheme - scheme value. If none provided, 'swift2d' is the default value fs.stocator.provided scheme.impl - scheme implementation class. If non provided 'com.ibm.stocator.fs.swift.SwiftAPIClient' is the default value If the schema of fsuri equals one of the supported schema, then code will dynamically load the implementation class. Example of the Stocator configuration: {@code <property> <name>fs.stocator.scheme.list</name><value>swift,swift2d,test123</value> </property> <property> <name>fs.stocator.swift.scheme</name><value>swift</value> </property> <property> <name>fs.stocator.swift.impl</name><value>com.ibm.stocator.fs.swift.SwiftAPIClient</value> </property> <property> <name>fs.stocator.swift2d.scheme</name><value>swift2d</value> </property> <property> <name>fs.stocator.swift2d.impl</name><value>com.ibm.stocator.fs.swift.SwiftAPIClient</value> </property> <property> <name>fs.stocator.test123.scheme</name><value>test123</value> </property> <property> <name>fs.stocator.test123.impl</name><value>some.class.Test123Client</value> </property> } Access Stocator via: {@code swift://<container>.<service>/object(s) swift2d://<container>.<service>/object(s) test123://<container>.<service>/object(s) } @param fsuri uri to process @param conf provided configuration @return IStoreClient implementation @throws IOException if error
[ "fs", ".", "stocator", ".", "scheme", ".", "list", "contains", "comma", "separated", "list", "of", "the", "provided", "back", "-", "end", "storage", "drivers", ".", "If", "none", "provided", "or", "key", "is", "not", "present", "then", "swift", "is", "th...
train
https://github.com/CODAIT/stocator/blob/35969cadd2e8faa6fdac45e8bec1799fdd3d8299/src/main/java/com/ibm/stocator/fs/ObjectStoreVisitor.java#L98-L139
DV8FromTheWorld/JDA
src/main/java/net/dv8tion/jda/core/requests/RestAction.java
RestAction.queueAfter
public ScheduledFuture<?> queueAfter(long delay, TimeUnit unit) { return queueAfter(delay, unit, api.get().getRateLimitPool()); }
java
public ScheduledFuture<?> queueAfter(long delay, TimeUnit unit) { return queueAfter(delay, unit, api.get().getRateLimitPool()); }
[ "public", "ScheduledFuture", "<", "?", ">", "queueAfter", "(", "long", "delay", ",", "TimeUnit", "unit", ")", "{", "return", "queueAfter", "(", "delay", ",", "unit", ",", "api", ".", "get", "(", ")", ".", "getRateLimitPool", "(", ")", ")", ";", "}" ]
Schedules a call to {@link #queue()} to be executed after the specified {@code delay}. <br>This is an <b>asynchronous</b> operation that will return a {@link java.util.concurrent.ScheduledFuture ScheduledFuture} representing the task. <p>This operation gives no access to the response value. <br>Use {@link #queueAfter(long, java.util.concurrent.TimeUnit, java.util.function.Consumer)} to access the success consumer for {@link #queue(java.util.function.Consumer)}! <p>The global JDA {@link java.util.concurrent.ScheduledExecutorService ScheduledExecutorService} is used for this operation. <br>You can change the core pool size for this Executor through {@link net.dv8tion.jda.core.JDABuilder#setCorePoolSize(int) JDABuilder.setCorePoolSize(int)} or provide your own Executor with {@link #queueAfter(long, java.util.concurrent.TimeUnit, java.util.concurrent.ScheduledExecutorService)} @param delay The delay after which this computation should be executed, negative to execute immediately @param unit The {@link java.util.concurrent.TimeUnit TimeUnit} to convert the specified {@code delay} @throws java.lang.IllegalArgumentException If the provided TimeUnit is {@code null} @return {@link java.util.concurrent.ScheduledFuture ScheduledFuture} representing the delayed operation
[ "Schedules", "a", "call", "to", "{", "@link", "#queue", "()", "}", "to", "be", "executed", "after", "the", "specified", "{", "@code", "delay", "}", ".", "<br", ">", "This", "is", "an", "<b", ">", "asynchronous<", "/", "b", ">", "operation", "that", "...
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/requests/RestAction.java#L566-L569
alkacon/opencms-core
src/org/opencms/configuration/CmsVfsConfiguration.java
CmsVfsConfiguration.getXsdTranslator
public CmsResourceTranslator getXsdTranslator() { String[] array = m_xsdTranslationEnabled ? new String[m_xsdTranslations.size()] : new String[0]; for (int i = 0; i < m_xsdTranslations.size(); i++) { array[i] = m_xsdTranslations.get(i); } return new CmsResourceTranslator(array, true); }
java
public CmsResourceTranslator getXsdTranslator() { String[] array = m_xsdTranslationEnabled ? new String[m_xsdTranslations.size()] : new String[0]; for (int i = 0; i < m_xsdTranslations.size(); i++) { array[i] = m_xsdTranslations.get(i); } return new CmsResourceTranslator(array, true); }
[ "public", "CmsResourceTranslator", "getXsdTranslator", "(", ")", "{", "String", "[", "]", "array", "=", "m_xsdTranslationEnabled", "?", "new", "String", "[", "m_xsdTranslations", ".", "size", "(", ")", "]", ":", "new", "String", "[", "0", "]", ";", "for", ...
Returns the XSD translator that has been initialized with the configured XSD translation rules.<p> @return the XSD translator
[ "Returns", "the", "XSD", "translator", "that", "has", "been", "initialized", "with", "the", "configured", "XSD", "translation", "rules", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/CmsVfsConfiguration.java#L864-L871
paoding-code/paoding-rose
paoding-rose-jade/src/main/java/net/paoding/rose/jade/statement/expression/util/ExqlUtils.java
ExqlUtils.asCollection
public static Collection<?> asCollection(Object obj) { if (obj == null) { return Collections.EMPTY_SET; // 返回空集合 } else if (obj.getClass().isArray()) { return Arrays.asList(asArray(obj)); } else if (obj instanceof Collection<?>) { return (Collection<?>) obj; // List, Set, Collection 直接返回 } else if (obj instanceof Map<?, ?>) { return ((Map<?, ?>) obj).entrySet(); // 映射表, 返回条目的集合 } else { return Arrays.asList(obj); // 其他类型, 返回包含单个对象的集合 } }
java
public static Collection<?> asCollection(Object obj) { if (obj == null) { return Collections.EMPTY_SET; // 返回空集合 } else if (obj.getClass().isArray()) { return Arrays.asList(asArray(obj)); } else if (obj instanceof Collection<?>) { return (Collection<?>) obj; // List, Set, Collection 直接返回 } else if (obj instanceof Map<?, ?>) { return ((Map<?, ?>) obj).entrySet(); // 映射表, 返回条目的集合 } else { return Arrays.asList(obj); // 其他类型, 返回包含单个对象的集合 } }
[ "public", "static", "Collection", "<", "?", ">", "asCollection", "(", "Object", "obj", ")", "{", "if", "(", "obj", "==", "null", ")", "{", "return", "Collections", ".", "EMPTY_SET", ";", "// 返回空集合", "}", "else", "if", "(", "obj", ".", "getClass", "(", ...
将对象转换成: Collection 集合。 @param obj - 用于转换的对象 @return Collection 集合
[ "将对象转换成", ":", "Collection", "集合。" ]
train
https://github.com/paoding-code/paoding-rose/blob/8b512704174dd6cba95e544c7d6ab66105cb8ec4/paoding-rose-jade/src/main/java/net/paoding/rose/jade/statement/expression/util/ExqlUtils.java#L146-L168
OpenLiberty/open-liberty
dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/util/MethodAttribUtils.java
MethodAttribUtils.findMatchingMethod
static Method findMatchingMethod(Map<String, List<Method>> methodsByName, com.ibm.ws.javaee.dd.ejb.Method me) { List<Method> methods = methodsByName.get(me.getMethodName()); if (methods == null) { return null; } List<String> meParms = me.getMethodParamList(); if (meParms == null) { return methods.get(0); } for (Method method : methods) { if (DDUtil.methodParamsMatch(meParms, method.getParameterTypes())) { return method; } } return null; }
java
static Method findMatchingMethod(Map<String, List<Method>> methodsByName, com.ibm.ws.javaee.dd.ejb.Method me) { List<Method> methods = methodsByName.get(me.getMethodName()); if (methods == null) { return null; } List<String> meParms = me.getMethodParamList(); if (meParms == null) { return methods.get(0); } for (Method method : methods) { if (DDUtil.methodParamsMatch(meParms, method.getParameterTypes())) { return method; } } return null; }
[ "static", "Method", "findMatchingMethod", "(", "Map", "<", "String", ",", "List", "<", "Method", ">", ">", "methodsByName", ",", "com", ".", "ibm", ".", "ws", ".", "javaee", ".", "dd", ".", "ejb", ".", "Method", "me", ")", "{", "List", "<", "Method",...
Finds the first matching method in a map of method name to list of methods.
[ "Finds", "the", "first", "matching", "method", "in", "a", "map", "of", "method", "name", "to", "list", "of", "methods", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/util/MethodAttribUtils.java#L641-L659
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/PatternMatchingFunctions.java
PatternMatchingFunctions.regexpPosition
public static Expression regexpPosition(String expression, String pattern) { return regexpPosition(x(expression), pattern); }
java
public static Expression regexpPosition(String expression, String pattern) { return regexpPosition(x(expression), pattern); }
[ "public", "static", "Expression", "regexpPosition", "(", "String", "expression", ",", "String", "pattern", ")", "{", "return", "regexpPosition", "(", "x", "(", "expression", ")", ",", "pattern", ")", ";", "}" ]
Returned expression results in the first position of the regular expression pattern within the string, or -1.
[ "Returned", "expression", "results", "in", "the", "first", "position", "of", "the", "regular", "expression", "pattern", "within", "the", "string", "or", "-", "1", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/PatternMatchingFunctions.java#L77-L79
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/InitIfSubFieldHandler.java
InitIfSubFieldHandler.doSetData
public int doSetData(Object fieldPtr, boolean bDisplayOption, int iMoveMode) { int iErrorCode = DBConstants.NORMAL_RETURN; boolean bSubExists = (this.getOwner().getRecord().getListener(SubFileFilter.class.getName()) != null); if (bSubExists) iErrorCode = super.doSetData(fieldPtr, bDisplayOption, iMoveMode); return iErrorCode; }
java
public int doSetData(Object fieldPtr, boolean bDisplayOption, int iMoveMode) { int iErrorCode = DBConstants.NORMAL_RETURN; boolean bSubExists = (this.getOwner().getRecord().getListener(SubFileFilter.class.getName()) != null); if (bSubExists) iErrorCode = super.doSetData(fieldPtr, bDisplayOption, iMoveMode); return iErrorCode; }
[ "public", "int", "doSetData", "(", "Object", "fieldPtr", ",", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "int", "iErrorCode", "=", "DBConstants", ".", "NORMAL_RETURN", ";", "boolean", "bSubExists", "=", "(", "this", ".", "getOwner", "(", ...
Move the physical binary data to this field. If there is not SubFileFilter, then don't allow the field to be inited. @param objData the raw data to set the basefield to. @param bDisplayOption If true, display the change. @param iMoveMode The type of move being done (init/read/screen). @return The error code (or NORMAL_RETURN if okay).
[ "Move", "the", "physical", "binary", "data", "to", "this", "field", ".", "If", "there", "is", "not", "SubFileFilter", "then", "don", "t", "allow", "the", "field", "to", "be", "inited", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/InitIfSubFieldHandler.java#L61-L68
foundation-runtime/monitoring
monitoring-jmx-lib/src/main/java/com/cisco/oss/foundation/monitoring/RMIRegistryManager.java
RMIRegistryManager.startOutProcRMIRegistry
public static boolean startOutProcRMIRegistry(Configuration configuration, final int port) { LOGGER.info("Starting rmiregistry on port " + port); try { Registry registryStarted = RegistryFinder.getInstance().getRegistry(configuration, port); if (registryStarted != null) { LOGGER.info("rmiregistry started on " + port); } else { LOGGER.error("Failed to start rmiregistry on " + port); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return false; //return startProcess(port, JAVA_HOME_RMI_REGISTRY) || startProcess(port, RMI_REGISTRY); }
java
public static boolean startOutProcRMIRegistry(Configuration configuration, final int port) { LOGGER.info("Starting rmiregistry on port " + port); try { Registry registryStarted = RegistryFinder.getInstance().getRegistry(configuration, port); if (registryStarted != null) { LOGGER.info("rmiregistry started on " + port); } else { LOGGER.error("Failed to start rmiregistry on " + port); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return false; //return startProcess(port, JAVA_HOME_RMI_REGISTRY) || startProcess(port, RMI_REGISTRY); }
[ "public", "static", "boolean", "startOutProcRMIRegistry", "(", "Configuration", "configuration", ",", "final", "int", "port", ")", "{", "LOGGER", ".", "info", "(", "\"Starting rmiregistry on port \"", "+", "port", ")", ";", "try", "{", "Registry", "registryStarted",...
Starts rmiregistry in a separate process on the specified port. @param port on which the rmiregistry needs to be started @return true if successful, false otherwise
[ "Starts", "rmiregistry", "in", "a", "separate", "process", "on", "the", "specified", "port", "." ]
train
https://github.com/foundation-runtime/monitoring/blob/a85ec72dc5558f787704fb13d9125a5803403ee5/monitoring-jmx-lib/src/main/java/com/cisco/oss/foundation/monitoring/RMIRegistryManager.java#L130-L146
pac4j/pac4j
pac4j-saml/src/main/java/org/pac4j/saml/util/SAML2Utils.java
SAML2Utils.normalizePortNumbersInUri
private static URI normalizePortNumbersInUri(final URI uri) throws URISyntaxException { int port = uri.getPort(); final String scheme = uri.getScheme(); if (SCHEME_HTTP.equals(scheme) && port == DEFAULT_HTTP_PORT) { port = -1; } if (SCHEME_HTTPS.equals(scheme) && port == DEFAULT_HTTPS_PORT) { port = -1; } final URI result = new URI(scheme, uri.getUserInfo(), uri.getHost(), port, uri.getPath(), uri.getQuery(), uri.getFragment()); return result; }
java
private static URI normalizePortNumbersInUri(final URI uri) throws URISyntaxException { int port = uri.getPort(); final String scheme = uri.getScheme(); if (SCHEME_HTTP.equals(scheme) && port == DEFAULT_HTTP_PORT) { port = -1; } if (SCHEME_HTTPS.equals(scheme) && port == DEFAULT_HTTPS_PORT) { port = -1; } final URI result = new URI(scheme, uri.getUserInfo(), uri.getHost(), port, uri.getPath(), uri.getQuery(), uri.getFragment()); return result; }
[ "private", "static", "URI", "normalizePortNumbersInUri", "(", "final", "URI", "uri", ")", "throws", "URISyntaxException", "{", "int", "port", "=", "uri", ".", "getPort", "(", ")", ";", "final", "String", "scheme", "=", "uri", ".", "getScheme", "(", ")", ";...
Normalizes a URI. If it contains the default port for the used scheme, the method replaces the port with "default". @param uri The URI to normalize. @return A normalized URI. @throws URISyntaxException If a URI cannot be created because of wrong syntax.
[ "Normalizes", "a", "URI", ".", "If", "it", "contains", "the", "default", "port", "for", "the", "used", "scheme", "the", "method", "replaces", "the", "port", "with", "default", "." ]
train
https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-saml/src/main/java/org/pac4j/saml/util/SAML2Utils.java#L79-L92
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/SnapshotsInner.java
SnapshotsInner.beginRevokeAccessAsync
public Observable<OperationStatusResponseInner> beginRevokeAccessAsync(String resourceGroupName, String snapshotName) { return beginRevokeAccessWithServiceResponseAsync(resourceGroupName, snapshotName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
java
public Observable<OperationStatusResponseInner> beginRevokeAccessAsync(String resourceGroupName, String snapshotName) { return beginRevokeAccessWithServiceResponseAsync(resourceGroupName, snapshotName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatusResponseInner", ">", "beginRevokeAccessAsync", "(", "String", "resourceGroupName", ",", "String", "snapshotName", ")", "{", "return", "beginRevokeAccessWithServiceResponseAsync", "(", "resourceGroupName", ",", "snapshotName", ")", ...
Revokes access to a snapshot. @param resourceGroupName The name of the resource group. @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the OperationStatusResponseInner object
[ "Revokes", "access", "to", "a", "snapshot", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/SnapshotsInner.java#L1218-L1225
dejv78/javafx-commons
jfx-controls/src/main/java/dejv/jfx/controls/radialmenu1/internal/RadialMenuItem.java
RadialMenuItem.setupMenuButton
public static void setupMenuButton(ButtonBase button, RadialMenuParams params, Node graphic, String tooltip, boolean addStyle) { button.minWidthProperty().bind(params.buttonSizeProperty()); button.minHeightProperty().bind(params.buttonSizeProperty()); button.prefWidthProperty().bind(params.buttonSizeProperty()); button.prefHeightProperty().bind(params.buttonSizeProperty()); button.maxWidthProperty().bind(params.buttonSizeProperty()); button.maxHeightProperty().bind(params.buttonSizeProperty()); if (addStyle) { button.getStylesheets().addAll(params.getStyleSheets()); } button.setId(params.getStyleId()); button.getStyleClass().addAll(params.getStyleClasses()); button.setGraphic(graphic); button.setTooltip(new Tooltip(tooltip)); }
java
public static void setupMenuButton(ButtonBase button, RadialMenuParams params, Node graphic, String tooltip, boolean addStyle) { button.minWidthProperty().bind(params.buttonSizeProperty()); button.minHeightProperty().bind(params.buttonSizeProperty()); button.prefWidthProperty().bind(params.buttonSizeProperty()); button.prefHeightProperty().bind(params.buttonSizeProperty()); button.maxWidthProperty().bind(params.buttonSizeProperty()); button.maxHeightProperty().bind(params.buttonSizeProperty()); if (addStyle) { button.getStylesheets().addAll(params.getStyleSheets()); } button.setId(params.getStyleId()); button.getStyleClass().addAll(params.getStyleClasses()); button.setGraphic(graphic); button.setTooltip(new Tooltip(tooltip)); }
[ "public", "static", "void", "setupMenuButton", "(", "ButtonBase", "button", ",", "RadialMenuParams", "params", ",", "Node", "graphic", ",", "String", "tooltip", ",", "boolean", "addStyle", ")", "{", "button", ".", "minWidthProperty", "(", ")", ".", "bind", "("...
Setup the round button. @param button Button to setup @param params Customization parameters @param graphic Graphics contents @param tooltip Tooltip text
[ "Setup", "the", "round", "button", "." ]
train
https://github.com/dejv78/javafx-commons/blob/ea846eeeb4ed43a7628a40931a3e6f27d513592f/jfx-controls/src/main/java/dejv/jfx/controls/radialmenu1/internal/RadialMenuItem.java#L176-L192
thelinmichael/spotify-web-api-java
src/main/java/com/wrapper/spotify/SpotifyApi.java
SpotifyApi.checkUsersFollowPlaylist
public CheckUsersFollowPlaylistRequest.Builder checkUsersFollowPlaylist( String owner_id, String playlist_id, String[] ids) { return new CheckUsersFollowPlaylistRequest.Builder(accessToken) .setDefaults(httpManager, scheme, host, port) .owner_id(owner_id) .playlist_id(playlist_id) .ids(concat(ids, ',')); }
java
public CheckUsersFollowPlaylistRequest.Builder checkUsersFollowPlaylist( String owner_id, String playlist_id, String[] ids) { return new CheckUsersFollowPlaylistRequest.Builder(accessToken) .setDefaults(httpManager, scheme, host, port) .owner_id(owner_id) .playlist_id(playlist_id) .ids(concat(ids, ',')); }
[ "public", "CheckUsersFollowPlaylistRequest", ".", "Builder", "checkUsersFollowPlaylist", "(", "String", "owner_id", ",", "String", "playlist_id", ",", "String", "[", "]", "ids", ")", "{", "return", "new", "CheckUsersFollowPlaylistRequest", ".", "Builder", "(", "access...
Check to see if one or more Spotify users are following a specified playlist. @param owner_id The Spotify User ID of the person who owns the playlist. @param playlist_id The Spotify ID of the playlist. @param ids A list of Spotify User IDs; the IDs of the users that you want to check to see if they follow the playlist. Maximum: 5 IDs. @return A {@link CheckUsersFollowPlaylistRequest.Builder}. @see <a href="https://developer.spotify.com/web-api/user-guide/#spotify-uris-and-ids">Spotify: URLs &amp; IDs</a>
[ "Check", "to", "see", "if", "one", "or", "more", "Spotify", "users", "are", "following", "a", "specified", "playlist", "." ]
train
https://github.com/thelinmichael/spotify-web-api-java/blob/c06b8512344c0310d0c1df362fa267879021da2e/src/main/java/com/wrapper/spotify/SpotifyApi.java#L630-L637
deephacks/confit
provider-hbase-filter/src/main/java/org/deephacks/confit/internal/hbase/Bytes.java
Bytes.setInt
public static void setInt(final byte[] b, final int n, final int offset) { b[offset + 0] = (byte) (n >>> 24); b[offset + 1] = (byte) (n >>> 16); b[offset + 2] = (byte) (n >>> 8); b[offset + 3] = (byte) (n >>> 0); }
java
public static void setInt(final byte[] b, final int n, final int offset) { b[offset + 0] = (byte) (n >>> 24); b[offset + 1] = (byte) (n >>> 16); b[offset + 2] = (byte) (n >>> 8); b[offset + 3] = (byte) (n >>> 0); }
[ "public", "static", "void", "setInt", "(", "final", "byte", "[", "]", "b", ",", "final", "int", "n", ",", "final", "int", "offset", ")", "{", "b", "[", "offset", "+", "0", "]", "=", "(", "byte", ")", "(", "n", ">>>", "24", ")", ";", "b", "[",...
Writes a big-endian 4-byte int at an offset in the given array. @param b The array to write to. @param offset The offset in the array to start writing at. @throws IndexOutOfBoundsException if the byte array is too small.
[ "Writes", "a", "big", "-", "endian", "4", "-", "byte", "int", "at", "an", "offset", "in", "the", "given", "array", "." ]
train
https://github.com/deephacks/confit/blob/4e6d4ee5fed32cbc5104433e61de1bcf1b360832/provider-hbase-filter/src/main/java/org/deephacks/confit/internal/hbase/Bytes.java#L185-L190
lastaflute/lastaflute
src/main/java/org/lastaflute/web/login/TypicalLoginAssist.java
TypicalLoginAssist.doRememberMe
protected boolean doRememberMe(ID userId, String expireDate, RememberMeLoginSpecifiedOption option) { final boolean updateToken = option.isUpdateToken(); final boolean silentLogin = option.isSilentLogin(); if (logger.isDebugEnabled()) { final StringBuilder sb = new StringBuilder(); sb.append("...Doing remember-me: user=").append(userId); sb.append(", expire=").append(expireDate); if (updateToken) { sb.append(", updateToken"); } if (silentLogin) { sb.append(", silently"); } logger.debug(sb.toString()); } try { identityLogin(userId, op -> op.rememberMe(updateToken).silentLogin(silentLogin)); return true; } catch (NumberFormatException invalidUserKey) { // just in case // to know invalid user key or bug logger.debug("*The user key might be invalid: {}, {}", userId, invalidUserKey.getMessage()); return false; } catch (LoginFailureException autoLoginFailed) { return false; } }
java
protected boolean doRememberMe(ID userId, String expireDate, RememberMeLoginSpecifiedOption option) { final boolean updateToken = option.isUpdateToken(); final boolean silentLogin = option.isSilentLogin(); if (logger.isDebugEnabled()) { final StringBuilder sb = new StringBuilder(); sb.append("...Doing remember-me: user=").append(userId); sb.append(", expire=").append(expireDate); if (updateToken) { sb.append(", updateToken"); } if (silentLogin) { sb.append(", silently"); } logger.debug(sb.toString()); } try { identityLogin(userId, op -> op.rememberMe(updateToken).silentLogin(silentLogin)); return true; } catch (NumberFormatException invalidUserKey) { // just in case // to know invalid user key or bug logger.debug("*The user key might be invalid: {}, {}", userId, invalidUserKey.getMessage()); return false; } catch (LoginFailureException autoLoginFailed) { return false; } }
[ "protected", "boolean", "doRememberMe", "(", "ID", "userId", ",", "String", "expireDate", ",", "RememberMeLoginSpecifiedOption", "option", ")", "{", "final", "boolean", "updateToken", "=", "option", ".", "isUpdateToken", "(", ")", ";", "final", "boolean", "silentL...
Do actually remember-me for the user. @param userId The ID of the login user, used by identity login. (NotNull) @param expireDate The string expression for expire date of remember-me access token. (NotNull) @param option The option of remember-me login specified by caller. (NotNull) @return Is the remember-me success?
[ "Do", "actually", "remember", "-", "me", "for", "the", "user", "." ]
train
https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/web/login/TypicalLoginAssist.java#L635-L660
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverter.java
TypeConverter.convertToDouble
public static double convertToDouble (@Nullable final Object aSrcValue, final double dDefault) { final Double aValue = convert (aSrcValue, Double.class, null); return aValue == null ? dDefault : aValue.doubleValue (); }
java
public static double convertToDouble (@Nullable final Object aSrcValue, final double dDefault) { final Double aValue = convert (aSrcValue, Double.class, null); return aValue == null ? dDefault : aValue.doubleValue (); }
[ "public", "static", "double", "convertToDouble", "(", "@", "Nullable", "final", "Object", "aSrcValue", ",", "final", "double", "dDefault", ")", "{", "final", "Double", "aValue", "=", "convert", "(", "aSrcValue", ",", "Double", ".", "class", ",", "null", ")",...
Convert the passed source value to double @param aSrcValue The source value. May be <code>null</code>. @param dDefault The default value to be returned if an error occurs during type conversion. @return The converted value. @throws RuntimeException If the converter itself throws an exception @see TypeConverterProviderBestMatch
[ "Convert", "the", "passed", "source", "value", "to", "double" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/typeconvert/TypeConverter.java#L255-L259
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.domain_task_mailinglist_id_GET
public OvhTaskMl domain_task_mailinglist_id_GET(String domain, Long id) throws IOException { String qPath = "/email/domain/{domain}/task/mailinglist/{id}"; StringBuilder sb = path(qPath, domain, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhTaskMl.class); }
java
public OvhTaskMl domain_task_mailinglist_id_GET(String domain, Long id) throws IOException { String qPath = "/email/domain/{domain}/task/mailinglist/{id}"; StringBuilder sb = path(qPath, domain, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhTaskMl.class); }
[ "public", "OvhTaskMl", "domain_task_mailinglist_id_GET", "(", "String", "domain", ",", "Long", "id", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/domain/{domain}/task/mailinglist/{id}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", "...
Get this object properties REST: GET /email/domain/{domain}/task/mailinglist/{id} @param domain [required] Name of your domain name @param id [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L1129-L1134
alkacon/opencms-core
src/org/opencms/xml/containerpage/CmsXmlGroupContainerFactory.java
CmsXmlGroupContainerFactory.getCache
private static CmsXmlGroupContainer getCache(CmsObject cms, CmsResource resource, boolean keepEncoding) { if (resource instanceof I_CmsHistoryResource) { return null; } return getCache().getCacheGroupContainer( getCache().getCacheKey(resource.getStructureId(), keepEncoding), cms.getRequestContext().getCurrentProject().isOnlineProject()); }
java
private static CmsXmlGroupContainer getCache(CmsObject cms, CmsResource resource, boolean keepEncoding) { if (resource instanceof I_CmsHistoryResource) { return null; } return getCache().getCacheGroupContainer( getCache().getCacheKey(resource.getStructureId(), keepEncoding), cms.getRequestContext().getCurrentProject().isOnlineProject()); }
[ "private", "static", "CmsXmlGroupContainer", "getCache", "(", "CmsObject", "cms", ",", "CmsResource", "resource", ",", "boolean", "keepEncoding", ")", "{", "if", "(", "resource", "instanceof", "I_CmsHistoryResource", ")", "{", "return", "null", ";", "}", "return",...
Returns the cached group container.<p> @param cms the cms context @param resource the group container resource @param keepEncoding if to keep the encoding while unmarshalling @return the cached group container, or <code>null</code> if not found
[ "Returns", "the", "cached", "group", "container", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsXmlGroupContainerFactory.java#L401-L409
ModeShape/modeshape
connectors/modeshape-connector-cmis/src/main/java/org/modeshape/connector/cmis/CmisConnector.java
CmisConnector.cmisDocument
public Document cmisDocument( CmisObject cmisObject ) { org.apache.chemistry.opencmis.client.api.Document doc = (org.apache.chemistry.opencmis.client.api.Document)cmisObject; DocumentWriter writer = newDocument(ObjectId.toString(ObjectId.Type.OBJECT, doc.getId())); ObjectType objectType = cmisObject.getType(); if (objectType.isBaseType()) { writer.setPrimaryType(NodeType.NT_FILE); } else { writer.setPrimaryType(objectType.getId()); } List<Folder> parents = doc.getParents(); ArrayList<String> parentIds = new ArrayList<String>(); for (Folder f : parents) { parentIds.add(ObjectId.toString(ObjectId.Type.OBJECT, f.getId())); } writer.setParents(parentIds); writer.addMixinType(NodeType.MIX_REFERENCEABLE); writer.addMixinType(NodeType.MIX_LAST_MODIFIED); // document specific property conversation cmisProperties(doc, writer); writer.addChild(ObjectId.toString(ObjectId.Type.CONTENT, doc.getId()), JcrConstants.JCR_CONTENT); writer.addMixinType("mode:accessControllable"); writer.addChild(ObjectId.toString(ObjectId.Type.ACL, cmisObject.getId()), "mode:acl"); return writer.document(); }
java
public Document cmisDocument( CmisObject cmisObject ) { org.apache.chemistry.opencmis.client.api.Document doc = (org.apache.chemistry.opencmis.client.api.Document)cmisObject; DocumentWriter writer = newDocument(ObjectId.toString(ObjectId.Type.OBJECT, doc.getId())); ObjectType objectType = cmisObject.getType(); if (objectType.isBaseType()) { writer.setPrimaryType(NodeType.NT_FILE); } else { writer.setPrimaryType(objectType.getId()); } List<Folder> parents = doc.getParents(); ArrayList<String> parentIds = new ArrayList<String>(); for (Folder f : parents) { parentIds.add(ObjectId.toString(ObjectId.Type.OBJECT, f.getId())); } writer.setParents(parentIds); writer.addMixinType(NodeType.MIX_REFERENCEABLE); writer.addMixinType(NodeType.MIX_LAST_MODIFIED); // document specific property conversation cmisProperties(doc, writer); writer.addChild(ObjectId.toString(ObjectId.Type.CONTENT, doc.getId()), JcrConstants.JCR_CONTENT); writer.addMixinType("mode:accessControllable"); writer.addChild(ObjectId.toString(ObjectId.Type.ACL, cmisObject.getId()), "mode:acl"); return writer.document(); }
[ "public", "Document", "cmisDocument", "(", "CmisObject", "cmisObject", ")", "{", "org", ".", "apache", ".", "chemistry", ".", "opencmis", ".", "client", ".", "api", ".", "Document", "doc", "=", "(", "org", ".", "apache", ".", "chemistry", ".", "opencmis", ...
Translates cmis document object to JCR node. @param cmisObject cmis document node @return JCR node document.
[ "Translates", "cmis", "document", "object", "to", "JCR", "node", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/connectors/modeshape-connector-cmis/src/main/java/org/modeshape/connector/cmis/CmisConnector.java#L780-L809
alkacon/opencms-core
src/org/opencms/loader/CmsResourceManager.java
CmsResourceManager.getMimeType
public String getMimeType(String filename, String encoding) { return getMimeType(filename, encoding, MIMETYPE_HTML); }
java
public String getMimeType(String filename, String encoding) { return getMimeType(filename, encoding, MIMETYPE_HTML); }
[ "public", "String", "getMimeType", "(", "String", "filename", ",", "String", "encoding", ")", "{", "return", "getMimeType", "(", "filename", ",", "encoding", ",", "MIMETYPE_HTML", ")", ";", "}" ]
Returns the MIME type for a specified file name.<p> If an encoding parameter that is not <code>null</code> is provided, the returned MIME type is extended with a <code>; charset={encoding}</code> setting.<p> If no MIME type for the given filename can be determined, the default <code>{@link #MIMETYPE_HTML}</code> is used.<p> @param filename the file name to check the MIME type for @param encoding the default encoding (charset) in case of MIME types is of type "text" @return the MIME type for a specified file
[ "Returns", "the", "MIME", "type", "for", "a", "specified", "file", "name", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsResourceManager.java#L790-L793
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/Context.java
Context.setUserAttribute
public void setUserAttribute(final String _key, final String _value, final UserAttributesDefinition _definition) throws EFapsException { if (containsSessionAttribute(UserAttributesSet.CONTEXTMAPKEY)) { ((UserAttributesSet) getSessionAttribute(UserAttributesSet.CONTEXTMAPKEY)).set(_key, _value, _definition); } else { throw new EFapsException(Context.class, "getUserAttributes.NoSessionAttribute"); } }
java
public void setUserAttribute(final String _key, final String _value, final UserAttributesDefinition _definition) throws EFapsException { if (containsSessionAttribute(UserAttributesSet.CONTEXTMAPKEY)) { ((UserAttributesSet) getSessionAttribute(UserAttributesSet.CONTEXTMAPKEY)).set(_key, _value, _definition); } else { throw new EFapsException(Context.class, "getUserAttributes.NoSessionAttribute"); } }
[ "public", "void", "setUserAttribute", "(", "final", "String", "_key", ",", "final", "String", "_value", ",", "final", "UserAttributesDefinition", "_definition", ")", "throws", "EFapsException", "{", "if", "(", "containsSessionAttribute", "(", "UserAttributesSet", ".",...
Set a new UserAttribute for the UserAttribute of the Person this Context.The UserAttributes are stored in the {@link #sessionAttributes} Map, therefore are thought to be valid for one session. @param _key Key of the UserAttribute @param _value Value of the UserAttribute @param _definition Definition @throws EFapsException on error
[ "Set", "a", "new", "UserAttribute", "for", "the", "UserAttribute", "of", "the", "Person", "this", "Context", ".", "The", "UserAttributes", "are", "stored", "in", "the", "{", "@link", "#sessionAttributes", "}", "Map", "therefore", "are", "thought", "to", "be", ...
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/Context.java#L685-L695
Wikidata/Wikidata-Toolkit
wdtk-examples/src/main/java/org/wikidata/wdtk/examples/GenderRatioProcessor.java
GenderRatioProcessor.addNewGenderName
private void addNewGenderName(EntityIdValue entityIdValue, String name) { this.genderNames.put(entityIdValue, name); this.genderNamesList.add(entityIdValue); }
java
private void addNewGenderName(EntityIdValue entityIdValue, String name) { this.genderNames.put(entityIdValue, name); this.genderNamesList.add(entityIdValue); }
[ "private", "void", "addNewGenderName", "(", "EntityIdValue", "entityIdValue", ",", "String", "name", ")", "{", "this", ".", "genderNames", ".", "put", "(", "entityIdValue", ",", "name", ")", ";", "this", ".", "genderNamesList", ".", "add", "(", "entityIdValue"...
Adds a new gender item and an initial name. @param entityIdValue the item representing the gender @param name the label to use for representing the gender
[ "Adds", "a", "new", "gender", "item", "and", "an", "initial", "name", "." ]
train
https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-examples/src/main/java/org/wikidata/wdtk/examples/GenderRatioProcessor.java#L415-L418
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/stats/Counters.java
Counters.L2NormalizeInPlace
public static <E, C extends Counter<E>> Counter<E> L2NormalizeInPlace(Counter<E> c) { return multiplyInPlace(c, 1.0 / L2Norm(c)); }
java
public static <E, C extends Counter<E>> Counter<E> L2NormalizeInPlace(Counter<E> c) { return multiplyInPlace(c, 1.0 / L2Norm(c)); }
[ "public", "static", "<", "E", ",", "C", "extends", "Counter", "<", "E", ">", ">", "Counter", "<", "E", ">", "L2NormalizeInPlace", "(", "Counter", "<", "E", ">", "c", ")", "{", "return", "multiplyInPlace", "(", "c", ",", "1.0", "/", "L2Norm", "(", "...
L2 normalize a counter in place. @param c The {@link Counter} to be L2 normalized. This counter is modified @return the passed in counter l2-normalized
[ "L2", "normalize", "a", "counter", "in", "place", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/Counters.java#L1312-L1314
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/StringUtils.java
StringUtils.objectToColumnString
public static String objectToColumnString(Object object, String delimiter, String[] fieldNames) throws IllegalAccessException, NoSuchFieldException, NoSuchMethodException, InvocationTargetException { StringBuilder sb = new StringBuilder(); for (int i = 0; i < fieldNames.length; i++) { if (sb.length() > 0) { sb.append(delimiter); } try { Field field = object.getClass().getDeclaredField(fieldNames[i]); sb.append(field.get(object)) ; } catch (IllegalAccessException ex) { Method method = object.getClass().getDeclaredMethod("get" + StringUtils.capitalize(fieldNames[i])); sb.append(method.invoke(object)); } } return sb.toString(); }
java
public static String objectToColumnString(Object object, String delimiter, String[] fieldNames) throws IllegalAccessException, NoSuchFieldException, NoSuchMethodException, InvocationTargetException { StringBuilder sb = new StringBuilder(); for (int i = 0; i < fieldNames.length; i++) { if (sb.length() > 0) { sb.append(delimiter); } try { Field field = object.getClass().getDeclaredField(fieldNames[i]); sb.append(field.get(object)) ; } catch (IllegalAccessException ex) { Method method = object.getClass().getDeclaredMethod("get" + StringUtils.capitalize(fieldNames[i])); sb.append(method.invoke(object)); } } return sb.toString(); }
[ "public", "static", "String", "objectToColumnString", "(", "Object", "object", ",", "String", "delimiter", ",", "String", "[", "]", "fieldNames", ")", "throws", "IllegalAccessException", ",", "NoSuchFieldException", ",", "NoSuchMethodException", ",", "InvocationTargetEx...
Converts an object into a tab delimited string with given fields Requires the object has public access for the specified fields @param object Object to convert @param delimiter delimiter @param fieldNames fieldnames @return String representing object
[ "Converts", "an", "object", "into", "a", "tab", "delimited", "string", "with", "given", "fields", "Requires", "the", "object", "has", "public", "access", "for", "the", "specified", "fields" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/StringUtils.java#L1389-L1406
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringHelper.java
StringHelper.getOccurrenceCount
@Nonnegative public static int getOccurrenceCount (@Nullable final String sText, final char cSearch) { int ret = 0; final int nTextLength = getLength (sText); if (nTextLength >= 1) { int nLastIndex = 0; int nIndex; do { // Start searching from the last result nIndex = getIndexOf (sText, nLastIndex, cSearch); if (nIndex != STRING_NOT_FOUND) { // Match found ++ret; // Identify the next starting position (relative index + number of // search strings) nLastIndex = nIndex + 1; } } while (nIndex != STRING_NOT_FOUND); } return ret; }
java
@Nonnegative public static int getOccurrenceCount (@Nullable final String sText, final char cSearch) { int ret = 0; final int nTextLength = getLength (sText); if (nTextLength >= 1) { int nLastIndex = 0; int nIndex; do { // Start searching from the last result nIndex = getIndexOf (sText, nLastIndex, cSearch); if (nIndex != STRING_NOT_FOUND) { // Match found ++ret; // Identify the next starting position (relative index + number of // search strings) nLastIndex = nIndex + 1; } } while (nIndex != STRING_NOT_FOUND); } return ret; }
[ "@", "Nonnegative", "public", "static", "int", "getOccurrenceCount", "(", "@", "Nullable", "final", "String", "sText", ",", "final", "char", "cSearch", ")", "{", "int", "ret", "=", "0", ";", "final", "int", "nTextLength", "=", "getLength", "(", "sText", ")...
Count the number of occurrences of cSearch within sText. @param sText The text to search in. May be <code>null</code>. @param cSearch The character to search for. @return A non-negative number of occurrences.
[ "Count", "the", "number", "of", "occurrences", "of", "cSearch", "within", "sText", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L3194-L3219
diirt/util
src/main/java/org/epics/util/array/ListMath.java
ListMath.add
public static ListDouble add(final ListNumber data1, final ListNumber data2) { if (data1.size() != data2.size()) throw new IllegalArgumentException("Can't sum ListNumbers of different size (" + data1.size() + " - " + data2.size() + ")"); return new ListDouble() { @Override public double getDouble(int index) { return data1.getDouble(index) + data2.getDouble(index); } @Override public int size() { return data1.size(); } }; }
java
public static ListDouble add(final ListNumber data1, final ListNumber data2) { if (data1.size() != data2.size()) throw new IllegalArgumentException("Can't sum ListNumbers of different size (" + data1.size() + " - " + data2.size() + ")"); return new ListDouble() { @Override public double getDouble(int index) { return data1.getDouble(index) + data2.getDouble(index); } @Override public int size() { return data1.size(); } }; }
[ "public", "static", "ListDouble", "add", "(", "final", "ListNumber", "data1", ",", "final", "ListNumber", "data2", ")", "{", "if", "(", "data1", ".", "size", "(", ")", "!=", "data2", ".", "size", "(", ")", ")", "throw", "new", "IllegalArgumentException", ...
Returns a list where each element is the sum of the elements of the two lists at the same index. The lists have to match in size. @param data1 a list of numbers @param data2 another list of numbers @return result[x] = data1[x] + data2[x]
[ "Returns", "a", "list", "where", "each", "element", "is", "the", "sum", "of", "the", "elements", "of", "the", "two", "lists", "at", "the", "same", "index", ".", "The", "lists", "have", "to", "match", "in", "size", "." ]
train
https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/array/ListMath.java#L214-L229
canoo/dolphin-platform
platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/mbean/DolphinContextMBeanRegistry.java
DolphinContextMBeanRegistry.registerController
public Subscription registerController(Class<?> controllerClass, String controllerId, ModelProvider modelProvider) { Assert.requireNonNull(controllerClass, "controllerClass"); Assert.requireNonBlank(controllerId, "controllerId"); Assert.requireNonNull(modelProvider, "modelProvider"); DolphinControllerInfoMBean mBean = new DolphinControllerInfo(dolphinContextId, controllerClass, controllerId, modelProvider); return MBeanRegistry.getInstance().register(mBean, new MBeanDescription("com.canoo.dolphin", controllerClass.getSimpleName(), "controller")); }
java
public Subscription registerController(Class<?> controllerClass, String controllerId, ModelProvider modelProvider) { Assert.requireNonNull(controllerClass, "controllerClass"); Assert.requireNonBlank(controllerId, "controllerId"); Assert.requireNonNull(modelProvider, "modelProvider"); DolphinControllerInfoMBean mBean = new DolphinControllerInfo(dolphinContextId, controllerClass, controllerId, modelProvider); return MBeanRegistry.getInstance().register(mBean, new MBeanDescription("com.canoo.dolphin", controllerClass.getSimpleName(), "controller")); }
[ "public", "Subscription", "registerController", "(", "Class", "<", "?", ">", "controllerClass", ",", "String", "controllerId", ",", "ModelProvider", "modelProvider", ")", "{", "Assert", ".", "requireNonNull", "(", "controllerClass", ",", "\"controllerClass\"", ")", ...
Register a new Dolphin Platform controller as a MBean @param controllerClass the controller class @param controllerId the controller id @param modelProvider the model provider @return the subscription for deregistration
[ "Register", "a", "new", "Dolphin", "Platform", "controller", "as", "a", "MBean" ]
train
https://github.com/canoo/dolphin-platform/blob/fb99c1fab24df80d2fa094d8688b546140146874/platform/dolphin-platform-remoting-server/src/main/java/com/canoo/dp/impl/server/mbean/DolphinContextMBeanRegistry.java#L62-L68
hsiafan/requests
src/main/java/net/dongliu/requests/utils/CookieDateUtil.java
CookieDateUtil.parseDate
@Nullable public static Date parseDate(String dateValue, Collection<String> dateFormats) { return parseDate(dateValue, dateFormats, DEFAULT_TWO_DIGIT_YEAR_START); }
java
@Nullable public static Date parseDate(String dateValue, Collection<String> dateFormats) { return parseDate(dateValue, dateFormats, DEFAULT_TWO_DIGIT_YEAR_START); }
[ "@", "Nullable", "public", "static", "Date", "parseDate", "(", "String", "dateValue", ",", "Collection", "<", "String", ">", "dateFormats", ")", "{", "return", "parseDate", "(", "dateValue", ",", "dateFormats", ",", "DEFAULT_TWO_DIGIT_YEAR_START", ")", ";", "}" ...
Parses the date value using the given date formats. @param dateValue the date value to parse @param dateFormats the date formats to use @return the parsed date
[ "Parses", "the", "date", "value", "using", "the", "given", "date", "formats", "." ]
train
https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/utils/CookieDateUtil.java#L70-L73
alkacon/opencms-core
src/org/opencms/search/CmsSearchManager.java
CmsSearchManager.addDetailContent
private void addDetailContent(CmsObject adminCms, Set<CmsResource> containerPages, String containerPage) { if (CmsDetailOnlyContainerUtil.isDetailContainersPage(adminCms, containerPage)) { try { CmsResource detailRes = adminCms.readResource( CmsDetailOnlyContainerUtil.getDetailContentPath(containerPage), CmsResourceFilter.IGNORE_EXPIRATION); containerPages.add(detailRes); } catch (Throwable e) { if (LOG.isWarnEnabled()) { LOG.warn(e.getLocalizedMessage(), e); } } } }
java
private void addDetailContent(CmsObject adminCms, Set<CmsResource> containerPages, String containerPage) { if (CmsDetailOnlyContainerUtil.isDetailContainersPage(adminCms, containerPage)) { try { CmsResource detailRes = adminCms.readResource( CmsDetailOnlyContainerUtil.getDetailContentPath(containerPage), CmsResourceFilter.IGNORE_EXPIRATION); containerPages.add(detailRes); } catch (Throwable e) { if (LOG.isWarnEnabled()) { LOG.warn(e.getLocalizedMessage(), e); } } } }
[ "private", "void", "addDetailContent", "(", "CmsObject", "adminCms", ",", "Set", "<", "CmsResource", ">", "containerPages", ",", "String", "containerPage", ")", "{", "if", "(", "CmsDetailOnlyContainerUtil", ".", "isDetailContainersPage", "(", "adminCms", ",", "conta...
Checks if the given containerpage is used as a detail containers and adds the related detail content to the resource set.<p> @param adminCms the cms context @param containerPages the containerpages @param containerPage the container page site path
[ "Checks", "if", "the", "given", "containerpage", "is", "used", "as", "a", "detail", "containers", "and", "adds", "the", "related", "detail", "content", "to", "the", "resource", "set", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearchManager.java#L3104-L3119
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java
AiMaterial.getTextureMapModeW
public AiTextureMapMode getTextureMapModeW(AiTextureType type, int index) { checkTexRange(type, index); Property p = getProperty(PropertyKey.TEX_MAP_MODE_W.m_key); if (null == p || null == p.getData()) { return (AiTextureMapMode) m_defaults.get( PropertyKey.TEX_MAP_MODE_W); } return AiTextureMapMode.fromRawValue(p.getData()); }
java
public AiTextureMapMode getTextureMapModeW(AiTextureType type, int index) { checkTexRange(type, index); Property p = getProperty(PropertyKey.TEX_MAP_MODE_W.m_key); if (null == p || null == p.getData()) { return (AiTextureMapMode) m_defaults.get( PropertyKey.TEX_MAP_MODE_W); } return AiTextureMapMode.fromRawValue(p.getData()); }
[ "public", "AiTextureMapMode", "getTextureMapModeW", "(", "AiTextureType", "type", ",", "int", "index", ")", "{", "checkTexRange", "(", "type", ",", "index", ")", ";", "Property", "p", "=", "getProperty", "(", "PropertyKey", ".", "TEX_MAP_MODE_W", ".", "m_key", ...
Returns the texture mapping mode for the w axis.<p> If missing, defaults to {@link AiTextureMapMode#CLAMP} @param type the texture type @param index the index in the texture stack @return the texture mapping mode
[ "Returns", "the", "texture", "mapping", "mode", "for", "the", "w", "axis", ".", "<p", ">" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java#L1138-L1149
gocd/gocd
plugin-infra/go-plugin-api/src/main/java/com/thoughtworks/go/plugin/api/config/Property.java
Property.with
final public <T> Property with(Option<T> option, T value) { if(value != null){ options.addOrSet(option, value); } return this; }
java
final public <T> Property with(Option<T> option, T value) { if(value != null){ options.addOrSet(option, value); } return this; }
[ "final", "public", "<", "T", ">", "Property", "with", "(", "Option", "<", "T", ">", "option", ",", "T", "value", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "options", ".", "addOrSet", "(", "option", ",", "value", ")", ";", "}", "return...
Adds an option @param option Option type to be added @param value Option value @param <T> Type of option value @return current property instance (this)
[ "Adds", "an", "option" ]
train
https://github.com/gocd/gocd/blob/59a8480e23d6c06de39127635108dff57603cb71/plugin-infra/go-plugin-api/src/main/java/com/thoughtworks/go/plugin/api/config/Property.java#L91-L96
k0shk0sh/PermissionHelper
permission/src/main/java/com/fastaccess/permission/base/PermissionHelper.java
PermissionHelper.isPermissionGranted
public static boolean isPermissionGranted(@NonNull Context context, @NonNull String permission) { return ActivityCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED; }
java
public static boolean isPermissionGranted(@NonNull Context context, @NonNull String permission) { return ActivityCompat.checkSelfPermission(context, permission) == PackageManager.PERMISSION_GRANTED; }
[ "public", "static", "boolean", "isPermissionGranted", "(", "@", "NonNull", "Context", "context", ",", "@", "NonNull", "String", "permission", ")", "{", "return", "ActivityCompat", ".", "checkSelfPermission", "(", "context", ",", "permission", ")", "==", "PackageMa...
return true if permission is granted, false otherwise. <p/> can be used outside of activity.
[ "return", "true", "if", "permission", "is", "granted", "false", "otherwise", ".", "<p", "/", ">", "can", "be", "used", "outside", "of", "activity", "." ]
train
https://github.com/k0shk0sh/PermissionHelper/blob/04edce2af49981d1dd321bcdfbe981a1000b29d7/permission/src/main/java/com/fastaccess/permission/base/PermissionHelper.java#L337-L339
alipay/sofa-rpc
core/api/src/main/java/com/alipay/sofa/rpc/filter/FilterChain.java
FilterChain.buildConsumerChain
public static FilterChain buildConsumerChain(ConsumerConfig<?> consumerConfig, FilterInvoker lastFilter) { return new FilterChain(selectActualFilters(consumerConfig, CONSUMER_AUTO_ACTIVES), lastFilter, consumerConfig); }
java
public static FilterChain buildConsumerChain(ConsumerConfig<?> consumerConfig, FilterInvoker lastFilter) { return new FilterChain(selectActualFilters(consumerConfig, CONSUMER_AUTO_ACTIVES), lastFilter, consumerConfig); }
[ "public", "static", "FilterChain", "buildConsumerChain", "(", "ConsumerConfig", "<", "?", ">", "consumerConfig", ",", "FilterInvoker", "lastFilter", ")", "{", "return", "new", "FilterChain", "(", "selectActualFilters", "(", "consumerConfig", ",", "CONSUMER_AUTO_ACTIVES"...
构造调用端的执行链 @param consumerConfig consumer配置 @param lastFilter 最后一个filter @return filter执行链
[ "构造调用端的执行链" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/api/src/main/java/com/alipay/sofa/rpc/filter/FilterChain.java#L156-L158
virgo47/javasimon
javaee/src/main/java/org/javasimon/javaee/SimonServletFilterUtils.java
SimonServletFilterUtils.initRequestReporter
public static RequestReporter initRequestReporter(FilterConfig filterConfig) { String className = filterConfig.getInitParameter(SimonServletFilter.INIT_PARAM_REQUEST_REPORTER_CLASS); if (className == null) { return new DefaultRequestReporter(); } else { try { return (RequestReporter) Class.forName(className).newInstance(); } catch (ClassNotFoundException | IllegalAccessException | InstantiationException classNotFoundException) { throw new IllegalArgumentException("Invalid Request reporter class name", classNotFoundException); } } }
java
public static RequestReporter initRequestReporter(FilterConfig filterConfig) { String className = filterConfig.getInitParameter(SimonServletFilter.INIT_PARAM_REQUEST_REPORTER_CLASS); if (className == null) { return new DefaultRequestReporter(); } else { try { return (RequestReporter) Class.forName(className).newInstance(); } catch (ClassNotFoundException | IllegalAccessException | InstantiationException classNotFoundException) { throw new IllegalArgumentException("Invalid Request reporter class name", classNotFoundException); } } }
[ "public", "static", "RequestReporter", "initRequestReporter", "(", "FilterConfig", "filterConfig", ")", "{", "String", "className", "=", "filterConfig", ".", "getInitParameter", "(", "SimonServletFilter", ".", "INIT_PARAM_REQUEST_REPORTER_CLASS", ")", ";", "if", "(", "c...
Returns RequestReporter for the class specified for context parameter {@link SimonServletFilter#INIT_PARAM_REQUEST_REPORTER_CLASS}.
[ "Returns", "RequestReporter", "for", "the", "class", "specified", "for", "context", "parameter", "{" ]
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/javaee/src/main/java/org/javasimon/javaee/SimonServletFilterUtils.java#L134-L146
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/StringValueMap.java
StringValueMap.setAsObject
public void setAsObject(String key, Object value) { put(key, StringConverter.toNullableString(value)); }
java
public void setAsObject(String key, Object value) { put(key, StringConverter.toNullableString(value)); }
[ "public", "void", "setAsObject", "(", "String", "key", ",", "Object", "value", ")", "{", "put", "(", "key", ",", "StringConverter", ".", "toNullableString", "(", "value", ")", ")", ";", "}" ]
Sets a new value to map element specified by its index. When the index is not defined, it resets the entire map value. This method has double purpose because method overrides are not supported in JavaScript. @param key (optional) a key of the element to set @param value a new element or map value.
[ "Sets", "a", "new", "value", "to", "map", "element", "specified", "by", "its", "index", ".", "When", "the", "index", "is", "not", "defined", "it", "resets", "the", "entire", "map", "value", ".", "This", "method", "has", "double", "purpose", "because", "m...
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/StringValueMap.java#L123-L125
grails/gorm-hibernate5
grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/query/AbstractHibernateCriteriaBuilder.java
AbstractHibernateCriteriaBuilder.sqlProjection
protected void sqlProjection(String sql, String columnAlias, Type type) { sqlProjection(sql, Collections.singletonList(columnAlias), Collections.singletonList(type)); }
java
protected void sqlProjection(String sql, String columnAlias, Type type) { sqlProjection(sql, Collections.singletonList(columnAlias), Collections.singletonList(type)); }
[ "protected", "void", "sqlProjection", "(", "String", "sql", ",", "String", "columnAlias", ",", "Type", "type", ")", "{", "sqlProjection", "(", "sql", ",", "Collections", ".", "singletonList", "(", "columnAlias", ")", ",", "Collections", ".", "singletonList", "...
Adds a sql projection to the criteria @param sql SQL projecting a single value @param columnAlias column alias for the projected value @param type the type of the projected value
[ "Adds", "a", "sql", "projection", "to", "the", "criteria" ]
train
https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/query/AbstractHibernateCriteriaBuilder.java#L163-L165
mapbox/mapbox-java
services-geojson/src/main/java/com/mapbox/geojson/FeatureCollection.java
FeatureCollection.fromFeatures
public static FeatureCollection fromFeatures(@NonNull Feature[] features) { return new FeatureCollection(TYPE, null, Arrays.asList(features)); }
java
public static FeatureCollection fromFeatures(@NonNull Feature[] features) { return new FeatureCollection(TYPE, null, Arrays.asList(features)); }
[ "public", "static", "FeatureCollection", "fromFeatures", "(", "@", "NonNull", "Feature", "[", "]", "features", ")", "{", "return", "new", "FeatureCollection", "(", "TYPE", ",", "null", ",", "Arrays", ".", "asList", "(", "features", ")", ")", ";", "}" ]
Create a new instance of this class by giving the feature collection an array of {@link Feature}s. The array of features itself isn't null but it can be empty and have a length of 0. @param features an array of features @return a new instance of this class defined by the values passed inside this static factory method @since 1.0.0
[ "Create", "a", "new", "instance", "of", "this", "class", "by", "giving", "the", "feature", "collection", "an", "array", "of", "{", "@link", "Feature", "}", "s", ".", "The", "array", "of", "features", "itself", "isn", "t", "null", "but", "it", "can", "b...
train
https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/FeatureCollection.java#L81-L83
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerUtils.java
DockerUtils.pushImage
public static void pushImage(String imageTag, String username, String password, String host) throws IOException { final AuthConfig authConfig = new AuthConfig(); authConfig.withUsername(username); authConfig.withPassword(password); DockerClient dockerClient = null; try { dockerClient = getDockerClient(host); dockerClient.pushImageCmd(imageTag).withAuthConfig(authConfig).exec(new PushImageResultCallback()).awaitSuccess(); } finally { closeQuietly(dockerClient); } }
java
public static void pushImage(String imageTag, String username, String password, String host) throws IOException { final AuthConfig authConfig = new AuthConfig(); authConfig.withUsername(username); authConfig.withPassword(password); DockerClient dockerClient = null; try { dockerClient = getDockerClient(host); dockerClient.pushImageCmd(imageTag).withAuthConfig(authConfig).exec(new PushImageResultCallback()).awaitSuccess(); } finally { closeQuietly(dockerClient); } }
[ "public", "static", "void", "pushImage", "(", "String", "imageTag", ",", "String", "username", ",", "String", "password", ",", "String", "host", ")", "throws", "IOException", "{", "final", "AuthConfig", "authConfig", "=", "new", "AuthConfig", "(", ")", ";", ...
Push docker image using the docker java client. @param imageTag @param username @param password @param host
[ "Push", "docker", "image", "using", "the", "docker", "java", "client", "." ]
train
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerUtils.java#L52-L64
facebookarchive/hadoop-20
src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerDispatcher.java
ServerDispatcher.handleSuccessfulDispatch
@Override public void handleSuccessfulDispatch(long clientId, long sentTime) { ClientData clientData = core.getClientData(clientId); if (sentTime == -1 || clientData == null) return; clientData.markedAsFailedTime = -1; if (clientData.markedAsFailedTime != -1) { LOG.info("Unmarking " + clientId + " at " + sentTime); } clientData.lastSentTime = sentTime; }
java
@Override public void handleSuccessfulDispatch(long clientId, long sentTime) { ClientData clientData = core.getClientData(clientId); if (sentTime == -1 || clientData == null) return; clientData.markedAsFailedTime = -1; if (clientData.markedAsFailedTime != -1) { LOG.info("Unmarking " + clientId + " at " + sentTime); } clientData.lastSentTime = sentTime; }
[ "@", "Override", "public", "void", "handleSuccessfulDispatch", "(", "long", "clientId", ",", "long", "sentTime", ")", "{", "ClientData", "clientData", "=", "core", ".", "getClientData", "(", "clientId", ")", ";", "if", "(", "sentTime", "==", "-", "1", "||", ...
Called each time a handleNotification or heartbeat Thrift call is successful. @param clientId the id of the client on which the call was successful. @param sentTime the time at which the call was made. Nothing happens if this is -1.
[ "Called", "each", "time", "a", "handleNotification", "or", "heartbeat", "Thrift", "call", "is", "successful", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/namespace-notifier/src/java/org/apache/hadoop/hdfs/notifier/server/ServerDispatcher.java#L414-L426
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/json/JsonWriter.java
JsonWriter.stringify
public static String stringify(Object object, boolean prettyPrint) throws IOException { if (prettyPrint) { return stringify(object, DEFAULT_INDENT_STRING); } else { return stringify(object, null); } }
java
public static String stringify(Object object, boolean prettyPrint) throws IOException { if (prettyPrint) { return stringify(object, DEFAULT_INDENT_STRING); } else { return stringify(object, null); } }
[ "public", "static", "String", "stringify", "(", "Object", "object", ",", "boolean", "prettyPrint", ")", "throws", "IOException", "{", "if", "(", "prettyPrint", ")", "{", "return", "stringify", "(", "object", ",", "DEFAULT_INDENT_STRING", ")", ";", "}", "else",...
Converts an object to a JSON formatted string. If pretty-printing is enabled, includes spaces, tabs and new-lines to make the format more readable. The default indentation string is a tab character. @param object an object to convert to a JSON formatted string @param prettyPrint enables or disables pretty-printing @return the JSON formatted string @throws IOException if an I/O error has occurred
[ "Converts", "an", "object", "to", "a", "JSON", "formatted", "string", ".", "If", "pretty", "-", "printing", "is", "enabled", "includes", "spaces", "tabs", "and", "new", "-", "lines", "to", "make", "the", "format", "more", "readable", ".", "The", "default",...
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/json/JsonWriter.java#L497-L503
kaazing/gateway
mina.netty/src/main/java/org/kaazing/mina/core/buffer/AbstractIoBufferEx.java
AbstractIoBufferEx.autoExpand
private AbstractIoBufferEx autoExpand(int pos, int expectedRemaining) { if (isAutoExpand()) { expand(pos, expectedRemaining, true, autoExpander); } return this; }
java
private AbstractIoBufferEx autoExpand(int pos, int expectedRemaining) { if (isAutoExpand()) { expand(pos, expectedRemaining, true, autoExpander); } return this; }
[ "private", "AbstractIoBufferEx", "autoExpand", "(", "int", "pos", ",", "int", "expectedRemaining", ")", "{", "if", "(", "isAutoExpand", "(", ")", ")", "{", "expand", "(", "pos", ",", "expectedRemaining", ",", "true", ",", "autoExpander", ")", ";", "}", "re...
This method forwards the call to {@link #expand(int)} only when <tt>autoExpand</tt> property is <tt>true</tt>.
[ "This", "method", "forwards", "the", "call", "to", "{" ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.netty/src/main/java/org/kaazing/mina/core/buffer/AbstractIoBufferEx.java#L2680-L2685
jbundle/jbundle
main/screen/src/main/java/org/jbundle/main/user/screen/UserEntryScreen.java
UserEntryScreen.addToolbars
public ToolScreen addToolbars() { return new MaintToolbar(null, this, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, null) { public void setupMiddleSFields() { String strSubmitText = MenuConstants.SUBMIT; if (this.getTask() != null) if (this.getTask().getApplication() != null) strSubmitText = this.getTask().getApplication().getResources(ResourceConstants.MAIN_RESOURCE, true).getString(strSubmitText); new SCannedBox(this.getNextLocation(ScreenConstants.RIGHT_OF_LAST_BUTTON_WITH_GAP, ScreenConstants.SET_ANCHOR), this, null, ScreenConstants.DEFAULT_DISPLAY, null, strSubmitText, MenuConstants.SUBMIT, MenuConstants.SUBMIT, null); new SCannedBox(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.SET_ANCHOR), this, null, ScreenConstants.DEFAULT_DISPLAY, MenuConstants.RESET); } }; }
java
public ToolScreen addToolbars() { return new MaintToolbar(null, this, null, ScreenConstants.DONT_DISPLAY_FIELD_DESC, null) { public void setupMiddleSFields() { String strSubmitText = MenuConstants.SUBMIT; if (this.getTask() != null) if (this.getTask().getApplication() != null) strSubmitText = this.getTask().getApplication().getResources(ResourceConstants.MAIN_RESOURCE, true).getString(strSubmitText); new SCannedBox(this.getNextLocation(ScreenConstants.RIGHT_OF_LAST_BUTTON_WITH_GAP, ScreenConstants.SET_ANCHOR), this, null, ScreenConstants.DEFAULT_DISPLAY, null, strSubmitText, MenuConstants.SUBMIT, MenuConstants.SUBMIT, null); new SCannedBox(this.getNextLocation(ScreenConstants.NEXT_LOGICAL, ScreenConstants.SET_ANCHOR), this, null, ScreenConstants.DEFAULT_DISPLAY, MenuConstants.RESET); } }; }
[ "public", "ToolScreen", "addToolbars", "(", ")", "{", "return", "new", "MaintToolbar", "(", "null", ",", "this", ",", "null", ",", "ScreenConstants", ".", "DONT_DISPLAY_FIELD_DESC", ",", "null", ")", "{", "public", "void", "setupMiddleSFields", "(", ")", "{", ...
Add the toolbars that belong with this screen. @return The new toolbar.
[ "Add", "the", "toolbars", "that", "belong", "with", "this", "screen", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/screen/src/main/java/org/jbundle/main/user/screen/UserEntryScreen.java#L113-L127
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRVertexBuffer.java
GVRVertexBuffer.setIntVec
public void setIntVec(String attributeName, IntBuffer data, int stride, int offset) { if (!NativeVertexBuffer.setIntVec(getNative(), attributeName, data, stride, offset)) { throw new IllegalArgumentException("Attribute name " + attributeName + " cannot be updated"); } }
java
public void setIntVec(String attributeName, IntBuffer data, int stride, int offset) { if (!NativeVertexBuffer.setIntVec(getNative(), attributeName, data, stride, offset)) { throw new IllegalArgumentException("Attribute name " + attributeName + " cannot be updated"); } }
[ "public", "void", "setIntVec", "(", "String", "attributeName", ",", "IntBuffer", "data", ",", "int", "stride", ",", "int", "offset", ")", "{", "if", "(", "!", "NativeVertexBuffer", ".", "setIntVec", "(", "getNative", "(", ")", ",", "attributeName", ",", "d...
Updates a vertex attribute from an integer buffer. All of the entries of the input buffer are copied into the storage for the named vertex attribute. Other vertex attributes are not affected. The attribute name must be one of the attributes named in the descriptor passed to the constructor. <p> All vertex attributes have the same number of entries. If this is the first attribute added to the vertex buffer, the size of the input data array will determine the number of vertices. Updating subsequent attributes will fail if the data array size is not consistent. For example, if you create a vertex buffer with descriptor "... float4 a_bone_weights int4 a_bone_indices" and provide an array of 16 ints this will result in a vertex count of 4. The corresponding data array for the "a_bone_indices" attribute should also contain 16 floats. @param attributeName name of the attribute to update @param data IntBuffer containing the new values @param stride number of ints in the attribute @param offset offset from start of array of where to start copying source data @throws IllegalArgumentException if attribute name not in descriptor or buffer is wrong size
[ "Updates", "a", "vertex", "attribute", "from", "an", "integer", "buffer", ".", "All", "of", "the", "entries", "of", "the", "input", "buffer", "are", "copied", "into", "the", "storage", "for", "the", "named", "vertex", "attribute", ".", "Other", "vertex", "...
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRVertexBuffer.java#L493-L499
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java
NodeIndexer.addNodeName
protected void addNodeName(Document doc, String namespaceURI, String localName) throws RepositoryException { String name = mappings.getNamespacePrefixByURI(namespaceURI) + ":" + localName; doc.add(new Field(FieldNames.LABEL, name, Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS)); // as of version 3, also index combination of namespace URI and local name if (indexFormatVersion.getVersion() >= IndexFormatVersion.V3.getVersion()) { doc.add(new Field(FieldNames.NAMESPACE_URI, namespaceURI, Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS)); doc.add(new Field(FieldNames.LOCAL_NAME, localName, Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS)); } }
java
protected void addNodeName(Document doc, String namespaceURI, String localName) throws RepositoryException { String name = mappings.getNamespacePrefixByURI(namespaceURI) + ":" + localName; doc.add(new Field(FieldNames.LABEL, name, Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS)); // as of version 3, also index combination of namespace URI and local name if (indexFormatVersion.getVersion() >= IndexFormatVersion.V3.getVersion()) { doc.add(new Field(FieldNames.NAMESPACE_URI, namespaceURI, Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS)); doc.add(new Field(FieldNames.LOCAL_NAME, localName, Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS)); } }
[ "protected", "void", "addNodeName", "(", "Document", "doc", ",", "String", "namespaceURI", ",", "String", "localName", ")", "throws", "RepositoryException", "{", "String", "name", "=", "mappings", ".", "getNamespacePrefixByURI", "(", "namespaceURI", ")", "+", "\":...
Depending on the index format version adds one or two fields to the document for the node name. @param doc the lucene document. @param namespaceURI the namespace URI of the node name. @param localName the local name of the node. @throws RepositoryException
[ "Depending", "on", "the", "index", "format", "version", "adds", "one", "or", "two", "fields", "to", "the", "document", "for", "the", "node", "name", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java#L1052-L1062
eclipse/hawkbit
hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaControllerManagement.java
JpaControllerManagement.updateTargetStatus
private Target updateTargetStatus(final JpaTarget toUpdate, final URI address) { boolean storeEager = isStoreEager(toUpdate, address); if (TargetUpdateStatus.UNKNOWN.equals(toUpdate.getUpdateStatus())) { toUpdate.setUpdateStatus(TargetUpdateStatus.REGISTERED); storeEager = true; } if (storeEager || !queue.offer(new TargetPoll(toUpdate))) { toUpdate.setAddress(address.toString()); toUpdate.setLastTargetQuery(System.currentTimeMillis()); afterCommit.afterCommit(() -> eventPublisher.publishEvent(new TargetPollEvent(toUpdate, bus.getId()))); return targetRepository.save(toUpdate); } return toUpdate; }
java
private Target updateTargetStatus(final JpaTarget toUpdate, final URI address) { boolean storeEager = isStoreEager(toUpdate, address); if (TargetUpdateStatus.UNKNOWN.equals(toUpdate.getUpdateStatus())) { toUpdate.setUpdateStatus(TargetUpdateStatus.REGISTERED); storeEager = true; } if (storeEager || !queue.offer(new TargetPoll(toUpdate))) { toUpdate.setAddress(address.toString()); toUpdate.setLastTargetQuery(System.currentTimeMillis()); afterCommit.afterCommit(() -> eventPublisher.publishEvent(new TargetPollEvent(toUpdate, bus.getId()))); return targetRepository.save(toUpdate); } return toUpdate; }
[ "private", "Target", "updateTargetStatus", "(", "final", "JpaTarget", "toUpdate", ",", "final", "URI", "address", ")", "{", "boolean", "storeEager", "=", "isStoreEager", "(", "toUpdate", ",", "address", ")", ";", "if", "(", "TargetUpdateStatus", ".", "UNKNOWN", ...
Stores target directly to DB in case either {@link Target#getAddress()} or {@link Target#getUpdateStatus()} changes or the buffer queue is full.
[ "Stores", "target", "directly", "to", "DB", "in", "case", "either", "{", "@link", "Target#getAddress", "()", "}", "or", "{", "@link", "Target#getUpdateStatus", "()", "}", "changes", "or", "the", "buffer", "queue", "is", "full", "." ]
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaControllerManagement.java#L483-L501
svenkubiak/mangooio
mangooio-core/src/main/java/io/mangoo/routing/handlers/InboundCookiesHandler.java
InboundCookiesHandler.getSessionCookie
@SuppressWarnings("unchecked") protected Session getSessionCookie(HttpServerExchange exchange) { Session session = Session.create() .withContent(new HashMap<>()) .withAuthenticity(MangooUtils.randomString(STRING_LENGTH)); if (this.config.getSessionCookieExpires() > 0) { session.withExpires(LocalDateTime.now().plusSeconds(this.config.getSessionCookieExpires())); } String cookieValue = getCookieValue(exchange, this.config.getSessionCookieName()); if (StringUtils.isNotBlank(cookieValue)) { try { String decryptedValue = Application.getInstance(Crypto.class).decrypt(cookieValue, this.config.getSessionCookieEncryptionKey()); JwtConsumer jwtConsumer = new JwtConsumerBuilder() .setVerificationKey(new HmacKey(this.config.getSessionCookieSignKey().getBytes(StandardCharsets.UTF_8))) .setJwsAlgorithmConstraints(new AlgorithmConstraints(ConstraintType.WHITELIST, AlgorithmIdentifiers.HMAC_SHA512)) .build(); JwtClaims jwtClaims = jwtConsumer.processToClaims(decryptedValue); String expiresClaim = jwtClaims.getClaimValue(ClaimKey.EXPIRES.toString(), String.class); if (("-1").equals(expiresClaim)) { session = Session.create() .withContent(MangooUtils.copyMap(jwtClaims.getClaimValue(ClaimKey.DATA.toString(), Map.class))) .withAuthenticity(jwtClaims.getClaimValue(ClaimKey.AUTHENTICITY.toString(), String.class)); } else if (LocalDateTime.parse(jwtClaims.getClaimValue(ClaimKey.EXPIRES.toString(), String.class), DateUtils.formatter).isAfter(LocalDateTime.now())) { session = Session.create() .withContent(MangooUtils.copyMap(jwtClaims.getClaimValue(ClaimKey.DATA.toString(), Map.class))) .withAuthenticity(jwtClaims.getClaimValue(ClaimKey.AUTHENTICITY.toString(), String.class)) .withExpires(LocalDateTime.parse(jwtClaims.getClaimValue(ClaimKey.EXPIRES.toString(), String.class), DateUtils.formatter)); } else { //Ignore this and use default session } } catch (MalformedClaimException | InvalidJwtException e) { LOG.error("Failed to parse session cookie", e); session.invalidate(); } } return session; }
java
@SuppressWarnings("unchecked") protected Session getSessionCookie(HttpServerExchange exchange) { Session session = Session.create() .withContent(new HashMap<>()) .withAuthenticity(MangooUtils.randomString(STRING_LENGTH)); if (this.config.getSessionCookieExpires() > 0) { session.withExpires(LocalDateTime.now().plusSeconds(this.config.getSessionCookieExpires())); } String cookieValue = getCookieValue(exchange, this.config.getSessionCookieName()); if (StringUtils.isNotBlank(cookieValue)) { try { String decryptedValue = Application.getInstance(Crypto.class).decrypt(cookieValue, this.config.getSessionCookieEncryptionKey()); JwtConsumer jwtConsumer = new JwtConsumerBuilder() .setVerificationKey(new HmacKey(this.config.getSessionCookieSignKey().getBytes(StandardCharsets.UTF_8))) .setJwsAlgorithmConstraints(new AlgorithmConstraints(ConstraintType.WHITELIST, AlgorithmIdentifiers.HMAC_SHA512)) .build(); JwtClaims jwtClaims = jwtConsumer.processToClaims(decryptedValue); String expiresClaim = jwtClaims.getClaimValue(ClaimKey.EXPIRES.toString(), String.class); if (("-1").equals(expiresClaim)) { session = Session.create() .withContent(MangooUtils.copyMap(jwtClaims.getClaimValue(ClaimKey.DATA.toString(), Map.class))) .withAuthenticity(jwtClaims.getClaimValue(ClaimKey.AUTHENTICITY.toString(), String.class)); } else if (LocalDateTime.parse(jwtClaims.getClaimValue(ClaimKey.EXPIRES.toString(), String.class), DateUtils.formatter).isAfter(LocalDateTime.now())) { session = Session.create() .withContent(MangooUtils.copyMap(jwtClaims.getClaimValue(ClaimKey.DATA.toString(), Map.class))) .withAuthenticity(jwtClaims.getClaimValue(ClaimKey.AUTHENTICITY.toString(), String.class)) .withExpires(LocalDateTime.parse(jwtClaims.getClaimValue(ClaimKey.EXPIRES.toString(), String.class), DateUtils.formatter)); } else { //Ignore this and use default session } } catch (MalformedClaimException | InvalidJwtException e) { LOG.error("Failed to parse session cookie", e); session.invalidate(); } } return session; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "Session", "getSessionCookie", "(", "HttpServerExchange", "exchange", ")", "{", "Session", "session", "=", "Session", ".", "create", "(", ")", ".", "withContent", "(", "new", "HashMap", "<>", "(", ...
Retrieves the current session from the HttpServerExchange @param exchange The Undertow HttpServerExchange
[ "Retrieves", "the", "current", "session", "from", "the", "HttpServerExchange" ]
train
https://github.com/svenkubiak/mangooio/blob/b3beb6d09510dbbab0ed947d5069c463e1fda6e7/mangooio-core/src/main/java/io/mangoo/routing/handlers/InboundCookiesHandler.java#L75-L116
ironjacamar/ironjacamar
sjc/src/main/java/org/ironjacamar/sjc/Main.java
Main.configurationString
private static String configurationString(Properties properties, String key, String defaultValue) { if (properties != null) { return properties.getProperty(key, defaultValue); } return defaultValue; }
java
private static String configurationString(Properties properties, String key, String defaultValue) { if (properties != null) { return properties.getProperty(key, defaultValue); } return defaultValue; }
[ "private", "static", "String", "configurationString", "(", "Properties", "properties", ",", "String", "key", ",", "String", "defaultValue", ")", "{", "if", "(", "properties", "!=", "null", ")", "{", "return", "properties", ".", "getProperty", "(", "key", ",", ...
Get configuration string @param properties The properties @param key The key @param defaultValue The default value @return The value
[ "Get", "configuration", "string" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/sjc/src/main/java/org/ironjacamar/sjc/Main.java#L428-L436
vipshop/vjtools
vjkit/src/main/java/com/vip/vjtools/vjkit/reflect/ReflectionUtil.java
ReflectionUtil.getMethod
public static Method getMethod(final Class<?> clazz, final String methodName, Class<?>... parameterTypes) { Method method = MethodUtils.getMatchingMethod(clazz, methodName, parameterTypes); if (method != null) { makeAccessible(method); } return method; }
java
public static Method getMethod(final Class<?> clazz, final String methodName, Class<?>... parameterTypes) { Method method = MethodUtils.getMatchingMethod(clazz, methodName, parameterTypes); if (method != null) { makeAccessible(method); } return method; }
[ "public", "static", "Method", "getMethod", "(", "final", "Class", "<", "?", ">", "clazz", ",", "final", "String", "methodName", ",", "Class", "<", "?", ">", "...", "parameterTypes", ")", "{", "Method", "method", "=", "MethodUtils", ".", "getMatchingMethod", ...
循环向上转型, 获取对象的DeclaredMethod, 并强制设置为可访问. 如向上转型到Object仍无法找到, 返回null. 匹配函数名+参数类型. 方法需要被多次调用时,先使用本函数先取得Method,然后调用Method.invoke(Object obj, Object... args) 因为getMethod() 不能获取父类的private函数, 因此采用循环向上的getDeclaredMethod();
[ "循环向上转型", "获取对象的DeclaredMethod", "并强制设置为可访问", "." ]
train
https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjkit/src/main/java/com/vip/vjtools/vjkit/reflect/ReflectionUtil.java#L75-L81
xerial/snappy-java
src/main/java/org/xerial/snappy/Snappy.java
Snappy.isValidCompressedBuffer
public static boolean isValidCompressedBuffer(byte[] input, int offset, int length) throws IOException { if (input == null) { throw new NullPointerException("input is null"); } return impl.isValidCompressedBuffer(input, offset, length); }
java
public static boolean isValidCompressedBuffer(byte[] input, int offset, int length) throws IOException { if (input == null) { throw new NullPointerException("input is null"); } return impl.isValidCompressedBuffer(input, offset, length); }
[ "public", "static", "boolean", "isValidCompressedBuffer", "(", "byte", "[", "]", "input", ",", "int", "offset", ",", "int", "length", ")", "throws", "IOException", "{", "if", "(", "input", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ...
Returns true iff the contents of compressed buffer [offset, offset+length) can be uncompressed successfully. Does not return the uncompressed data. Takes time proportional to the input length, but is usually at least a factor of four faster than actual decompression.
[ "Returns", "true", "iff", "the", "contents", "of", "compressed", "buffer", "[", "offset", "offset", "+", "length", ")", "can", "be", "uncompressed", "successfully", ".", "Does", "not", "return", "the", "uncompressed", "data", ".", "Takes", "time", "proportiona...
train
https://github.com/xerial/snappy-java/blob/9df6ed7bbce88186c82f2e7cdcb7b974421b3340/src/main/java/org/xerial/snappy/Snappy.java#L321-L328
xcesco/kripton
kripton/src/main/java/com/abubusoft/kripton/xml/XMLSerializer.java
XMLSerializer.writeBinary
public void writeBinary(byte[] value, int start, int length) throws IOException { text(Base64Utils.encode(value, start, length)); }
java
public void writeBinary(byte[] value, int start, int length) throws IOException { text(Base64Utils.encode(value, start, length)); }
[ "public", "void", "writeBinary", "(", "byte", "[", "]", "value", ",", "int", "start", ",", "int", "length", ")", "throws", "IOException", "{", "text", "(", "Base64Utils", ".", "encode", "(", "value", ",", "start", ",", "length", ")", ")", ";", "}" ]
Write binary. @param value the value @param start the start @param length the length @throws IOException Signals that an I/O exception has occurred.
[ "Write", "binary", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton/src/main/java/com/abubusoft/kripton/xml/XMLSerializer.java#L1621-L1623
gallandarakhneorg/afc
core/text/src/main/java/org/arakhne/afc/text/TextUtil.java
TextUtil.cutStringAsArray
public static void cutStringAsArray(String text, CutStringCritera critera, List<String> output) { cutStringAlgo(text, critera, new CutStringToArray(output)); }
java
public static void cutStringAsArray(String text, CutStringCritera critera, List<String> output) { cutStringAlgo(text, critera, new CutStringToArray(output)); }
[ "public", "static", "void", "cutStringAsArray", "(", "String", "text", ",", "CutStringCritera", "critera", ",", "List", "<", "String", ">", "output", ")", "{", "cutStringAlgo", "(", "text", ",", "critera", ",", "new", "CutStringToArray", "(", "output", ")", ...
Format the text to be sure that each line is not more longer than the specified critera. @param text is the string to cut @param critera is the critera to respect. @param output is the given {@code text} splitted in lines separated by <code>\n</code>. @since 4.0
[ "Format", "the", "text", "to", "be", "sure", "that", "each", "line", "is", "not", "more", "longer", "than", "the", "specified", "critera", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/text/src/main/java/org/arakhne/afc/text/TextUtil.java#L412-L414
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.api_credential_credentialId_GET
public OvhCredential api_credential_credentialId_GET(Long credentialId) throws IOException { String qPath = "/me/api/credential/{credentialId}"; StringBuilder sb = path(qPath, credentialId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhCredential.class); }
java
public OvhCredential api_credential_credentialId_GET(Long credentialId) throws IOException { String qPath = "/me/api/credential/{credentialId}"; StringBuilder sb = path(qPath, credentialId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhCredential.class); }
[ "public", "OvhCredential", "api_credential_credentialId_GET", "(", "Long", "credentialId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/api/credential/{credentialId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "credentialId", ")"...
Get this object properties REST: GET /me/api/credential/{credentialId} @param credentialId [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L475-L480
OpenLiberty/open-liberty
dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/Director.java
Director.fireDownloadProgressEvent
public void fireDownloadProgressEvent(int progress, RepositoryResource installResource) throws InstallException { if (installResource.getType().equals(ResourceType.FEATURE)) { Visibility v = ((EsaResource) installResource).getVisibility(); if (v.equals(Visibility.PUBLIC) || v.equals(Visibility.INSTALL)) { EsaResource esar = (EsaResource) installResource; String resourceName = (esar.getShortName() == null) ? installResource.getName() : esar.getShortName(); fireProgressEvent(InstallProgressEvent.DOWNLOAD, progress, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_DOWNLOADING", resourceName), true); } else if (!firePublicAssetOnly) { fireProgressEvent(InstallProgressEvent.DOWNLOAD, progress, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_DOWNLOADING_DEPENDENCY"), true); } } else if (installResource.getType().equals(ResourceType.PRODUCTSAMPLE) || installResource.getType().equals(ResourceType.OPENSOURCE)) { fireProgressEvent(InstallProgressEvent.DOWNLOAD, progress, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_DOWNLOADING", installResource.getName()), true); } }
java
public void fireDownloadProgressEvent(int progress, RepositoryResource installResource) throws InstallException { if (installResource.getType().equals(ResourceType.FEATURE)) { Visibility v = ((EsaResource) installResource).getVisibility(); if (v.equals(Visibility.PUBLIC) || v.equals(Visibility.INSTALL)) { EsaResource esar = (EsaResource) installResource; String resourceName = (esar.getShortName() == null) ? installResource.getName() : esar.getShortName(); fireProgressEvent(InstallProgressEvent.DOWNLOAD, progress, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_DOWNLOADING", resourceName), true); } else if (!firePublicAssetOnly) { fireProgressEvent(InstallProgressEvent.DOWNLOAD, progress, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_DOWNLOADING_DEPENDENCY"), true); } } else if (installResource.getType().equals(ResourceType.PRODUCTSAMPLE) || installResource.getType().equals(ResourceType.OPENSOURCE)) { fireProgressEvent(InstallProgressEvent.DOWNLOAD, progress, Messages.INSTALL_KERNEL_MESSAGES.getLogMessage("STATE_DOWNLOADING", installResource.getName()), true); } }
[ "public", "void", "fireDownloadProgressEvent", "(", "int", "progress", ",", "RepositoryResource", "installResource", ")", "throws", "InstallException", "{", "if", "(", "installResource", ".", "getType", "(", ")", ".", "equals", "(", "ResourceType", ".", "FEATURE", ...
Fires a download progress event to be displayed @param progress the progress integer @param installResource the install resource necessitating the progress event @throws InstallException
[ "Fires", "a", "download", "progress", "event", "to", "be", "displayed" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/Director.java#L221-L235
iipc/webarchive-commons
src/main/java/org/archive/io/warc/WARCReader.java
WARCReader.createArchiveRecord
protected WARCRecord createArchiveRecord(InputStream is, long offset) throws IOException { return (WARCRecord)currentRecord(new WARCRecord(is, getReaderIdentifier(), offset, isDigest(), isStrict())); }
java
protected WARCRecord createArchiveRecord(InputStream is, long offset) throws IOException { return (WARCRecord)currentRecord(new WARCRecord(is, getReaderIdentifier(), offset, isDigest(), isStrict())); }
[ "protected", "WARCRecord", "createArchiveRecord", "(", "InputStream", "is", ",", "long", "offset", ")", "throws", "IOException", "{", "return", "(", "WARCRecord", ")", "currentRecord", "(", "new", "WARCRecord", "(", "is", ",", "getReaderIdentifier", "(", ")", ",...
Create new WARC record. Encapsulate housekeeping that has to do w/ creating new Record. @param is InputStream to use. @param offset Absolute offset into WARC file. @return A WARCRecord. @throws IOException
[ "Create", "new", "WARC", "record", ".", "Encapsulate", "housekeeping", "that", "has", "to", "do", "w", "/", "creating", "new", "Record", "." ]
train
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/io/warc/WARCReader.java#L92-L96
iig-uni-freiburg/SEWOL
src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContext.java
ProcessContext.addDataUsageFor
public void addDataUsageFor(String activity, String attribute, DataUsage dataUsage) throws CompatibilityException { validateActivity(activity); validateAttribute(attribute); Validate.notNull(dataUsage); if (activityDataUsage.get(activity) == null) { activityDataUsage.put(activity, new HashMap<>()); } if (activityDataUsage.get(activity).get(attribute) == null) { activityDataUsage.get(activity).put(attribute, new HashSet<>()); } activityDataUsage.get(activity).get(attribute).add(dataUsage); }
java
public void addDataUsageFor(String activity, String attribute, DataUsage dataUsage) throws CompatibilityException { validateActivity(activity); validateAttribute(attribute); Validate.notNull(dataUsage); if (activityDataUsage.get(activity) == null) { activityDataUsage.put(activity, new HashMap<>()); } if (activityDataUsage.get(activity).get(attribute) == null) { activityDataUsage.get(activity).put(attribute, new HashSet<>()); } activityDataUsage.get(activity).get(attribute).add(dataUsage); }
[ "public", "void", "addDataUsageFor", "(", "String", "activity", ",", "String", "attribute", ",", "DataUsage", "dataUsage", ")", "throws", "CompatibilityException", "{", "validateActivity", "(", "activity", ")", ";", "validateAttribute", "(", "attribute", ")", ";", ...
Adds a data attribute for an activity together with its usage.<br> The given activity/attributes have to be known by the context, i.e. be contained in the activity/attribute list.<br> When dataUsage is null, then no usage is added. @param activity Activity for which the attribute usage is set. @param attribute Attribute used by the given activity. @param dataUsage Usage of the data attribute by the given activity. @throws ParameterException @throws CompatibilityException @throws IllegalArgumentException IllegalArgumentException If the given activity/attributes are not known. @see #getActivities() @see #getAttributes() @see #setAttributes(Set)
[ "Adds", "a", "data", "attribute", "for", "an", "activity", "together", "with", "its", "usage", ".", "<br", ">", "The", "given", "activity", "/", "attributes", "have", "to", "be", "known", "by", "the", "context", "i", ".", "e", ".", "be", "contained", "...
train
https://github.com/iig-uni-freiburg/SEWOL/blob/e791cb07a6e62ecf837d760d58a25f32fbf6bbca/src/de/uni/freiburg/iig/telematik/sewol/context/process/ProcessContext.java#L652-L663
Harium/keel
src/main/java/com/harium/keel/catalano/math/ComplexNumber.java
ComplexNumber.Exp
public static ComplexNumber Exp(ComplexNumber z1) { ComplexNumber x, y; x = new ComplexNumber(Math.exp(z1.real), 0.0); y = new ComplexNumber(Math.cos(z1.imaginary), Math.sin(z1.imaginary)); return Multiply(x, y); }
java
public static ComplexNumber Exp(ComplexNumber z1) { ComplexNumber x, y; x = new ComplexNumber(Math.exp(z1.real), 0.0); y = new ComplexNumber(Math.cos(z1.imaginary), Math.sin(z1.imaginary)); return Multiply(x, y); }
[ "public", "static", "ComplexNumber", "Exp", "(", "ComplexNumber", "z1", ")", "{", "ComplexNumber", "x", ",", "y", ";", "x", "=", "new", "ComplexNumber", "(", "Math", ".", "exp", "(", "z1", ".", "real", ")", ",", "0.0", ")", ";", "y", "=", "new", "C...
Calculates exponent (e raised to the specified power) of a complex number. @param z1 A Complex Number instance. @return Returns new ComplexNumber instance containing the exponent of the specified complex number.
[ "Calculates", "exponent", "(", "e", "raised", "to", "the", "specified", "power", ")", "of", "a", "complex", "number", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/ComplexNumber.java#L477-L483
eserating/siren4j
src/main/java/com/google/code/siren4j/component/builder/EntityBuilder.java
EntityBuilder.addProperty
public EntityBuilder addProperty(String name, Object value) { if(StringUtils.isBlank(name)) { throw new IllegalArgumentException("name cannot be null or empty."); } addStep("_addProperty", new Object[] { name, value }, new Class<?>[]{String.class, Object.class}, true); return this; }
java
public EntityBuilder addProperty(String name, Object value) { if(StringUtils.isBlank(name)) { throw new IllegalArgumentException("name cannot be null or empty."); } addStep("_addProperty", new Object[] { name, value }, new Class<?>[]{String.class, Object.class}, true); return this; }
[ "public", "EntityBuilder", "addProperty", "(", "String", "name", ",", "Object", "value", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "name", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"name cannot be null or empty.\"", ")", ";...
Adds a single property to the entity to be built. Properties are optional according to the Siren specification. @param name cannot be <code>null</code> or empty. @param value may be <code>null</code> or empty. @return <code>this</code> builder, never <code>null</code>.
[ "Adds", "a", "single", "property", "to", "the", "entity", "to", "be", "built", ".", "Properties", "are", "optional", "according", "to", "the", "Siren", "specification", "." ]
train
https://github.com/eserating/siren4j/blob/f12e3185076ad920352ec4f6eb2a071a3683505f/src/main/java/com/google/code/siren4j/component/builder/EntityBuilder.java#L161-L167
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java
TrainingsImpl.getTagsAsync
public Observable<List<Tag>> getTagsAsync(UUID projectId, GetTagsOptionalParameter getTagsOptionalParameter) { return getTagsWithServiceResponseAsync(projectId, getTagsOptionalParameter).map(new Func1<ServiceResponse<List<Tag>>, List<Tag>>() { @Override public List<Tag> call(ServiceResponse<List<Tag>> response) { return response.body(); } }); }
java
public Observable<List<Tag>> getTagsAsync(UUID projectId, GetTagsOptionalParameter getTagsOptionalParameter) { return getTagsWithServiceResponseAsync(projectId, getTagsOptionalParameter).map(new Func1<ServiceResponse<List<Tag>>, List<Tag>>() { @Override public List<Tag> call(ServiceResponse<List<Tag>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "Tag", ">", ">", "getTagsAsync", "(", "UUID", "projectId", ",", "GetTagsOptionalParameter", "getTagsOptionalParameter", ")", "{", "return", "getTagsWithServiceResponseAsync", "(", "projectId", ",", "getTagsOptionalParameter", ")...
Get the tags for a given project and iteration. @param projectId The project id @param getTagsOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;Tag&gt; object
[ "Get", "the", "tags", "for", "a", "given", "project", "and", "iteration", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L478-L485
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/create/ST_MakePoint.java
ST_MakePoint.createPoint
public static Point createPoint(double x, double y, double z) throws SQLException { return GF.createPoint(new Coordinate(x, y, z)); }
java
public static Point createPoint(double x, double y, double z) throws SQLException { return GF.createPoint(new Coordinate(x, y, z)); }
[ "public", "static", "Point", "createPoint", "(", "double", "x", ",", "double", "y", ",", "double", "z", ")", "throws", "SQLException", "{", "return", "GF", ".", "createPoint", "(", "new", "Coordinate", "(", "x", ",", "y", ",", "z", ")", ")", ";", "}"...
Constructs POINT from three doubles. @param x X-coordinate @param y Y-coordinate @param z Z-coordinate @return The POINT constructed from the given coordinates @throws SQLException
[ "Constructs", "POINT", "from", "three", "doubles", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/create/ST_MakePoint.java#L69-L71
gallandarakhneorg/afc
maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java
AbstractArakhneMojo.findFiles
public final synchronized void findFiles(File directory, FileFilter filter, Map<? super File, File> fileOut) { findFiles(directory, filter, fileOut, null); }
java
public final synchronized void findFiles(File directory, FileFilter filter, Map<? super File, File> fileOut) { findFiles(directory, filter, fileOut, null); }
[ "public", "final", "synchronized", "void", "findFiles", "(", "File", "directory", ",", "FileFilter", "filter", ",", "Map", "<", "?", "super", "File", ",", "File", ">", "fileOut", ")", "{", "findFiles", "(", "directory", ",", "filter", ",", "fileOut", ",", ...
Replies a map of files which are found on the file system. The map has the found files as keys and the search directory as values. @param directory is the directory to search in. @param filter is the file selector @param fileOut is the list of files to fill.
[ "Replies", "a", "map", "of", "files", "which", "are", "found", "on", "the", "file", "system", ".", "The", "map", "has", "the", "found", "files", "as", "keys", "and", "the", "search", "directory", "as", "values", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java#L719-L721
Azure/azure-sdk-for-java
cognitiveservices/data-plane/search/bingimagesearch/src/main/java/com/microsoft/azure/cognitiveservices/search/imagesearch/implementation/BingImagesImpl.java
BingImagesImpl.trendingWithServiceResponseAsync
public Observable<ServiceResponse<TrendingImages>> trendingWithServiceResponseAsync(TrendingOptionalParameter trendingOptionalParameter) { final String acceptLanguage = trendingOptionalParameter != null ? trendingOptionalParameter.acceptLanguage() : null; final String userAgent = trendingOptionalParameter != null ? trendingOptionalParameter.userAgent() : this.client.userAgent(); final String clientId = trendingOptionalParameter != null ? trendingOptionalParameter.clientId() : null; final String clientIp = trendingOptionalParameter != null ? trendingOptionalParameter.clientIp() : null; final String location = trendingOptionalParameter != null ? trendingOptionalParameter.location() : null; final String countryCode = trendingOptionalParameter != null ? trendingOptionalParameter.countryCode() : null; final String market = trendingOptionalParameter != null ? trendingOptionalParameter.market() : null; final SafeSearch safeSearch = trendingOptionalParameter != null ? trendingOptionalParameter.safeSearch() : null; final String setLang = trendingOptionalParameter != null ? trendingOptionalParameter.setLang() : null; return trendingWithServiceResponseAsync(acceptLanguage, userAgent, clientId, clientIp, location, countryCode, market, safeSearch, setLang); }
java
public Observable<ServiceResponse<TrendingImages>> trendingWithServiceResponseAsync(TrendingOptionalParameter trendingOptionalParameter) { final String acceptLanguage = trendingOptionalParameter != null ? trendingOptionalParameter.acceptLanguage() : null; final String userAgent = trendingOptionalParameter != null ? trendingOptionalParameter.userAgent() : this.client.userAgent(); final String clientId = trendingOptionalParameter != null ? trendingOptionalParameter.clientId() : null; final String clientIp = trendingOptionalParameter != null ? trendingOptionalParameter.clientIp() : null; final String location = trendingOptionalParameter != null ? trendingOptionalParameter.location() : null; final String countryCode = trendingOptionalParameter != null ? trendingOptionalParameter.countryCode() : null; final String market = trendingOptionalParameter != null ? trendingOptionalParameter.market() : null; final SafeSearch safeSearch = trendingOptionalParameter != null ? trendingOptionalParameter.safeSearch() : null; final String setLang = trendingOptionalParameter != null ? trendingOptionalParameter.setLang() : null; return trendingWithServiceResponseAsync(acceptLanguage, userAgent, clientId, clientIp, location, countryCode, market, safeSearch, setLang); }
[ "public", "Observable", "<", "ServiceResponse", "<", "TrendingImages", ">", ">", "trendingWithServiceResponseAsync", "(", "TrendingOptionalParameter", "trendingOptionalParameter", ")", "{", "final", "String", "acceptLanguage", "=", "trendingOptionalParameter", "!=", "null", ...
The Image Trending Search API lets you search on Bing and get back a list of images that are trending based on search requests made by others. The images are broken out into different categories. For example, Popular People Searches. For a list of markets that support trending images, see [Trending Images](https://docs.microsoft.com/en-us/azure/cognitive-services/bing-image-search/trending-images). @param trendingOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the TrendingImages object
[ "The", "Image", "Trending", "Search", "API", "lets", "you", "search", "on", "Bing", "and", "get", "back", "a", "list", "of", "images", "that", "are", "trending", "based", "on", "search", "requests", "made", "by", "others", ".", "The", "images", "are", "b...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/search/bingimagesearch/src/main/java/com/microsoft/azure/cognitiveservices/search/imagesearch/implementation/BingImagesImpl.java#L824-L836
alkacon/opencms-core
src/org/opencms/ui/apps/scheduler/CmsJobManagerApp.java
CmsJobManagerApp.openEditDialog
public CmsJobEditView openEditDialog(String jobId, boolean copy) { if (m_dialogWindow != null) { m_dialogWindow.close(); } m_dialogWindow = CmsBasicDialog.prepareWindow(DialogWidth.wide); CmsScheduledJobInfo job = null; if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(jobId)) { job = getElement(jobId); } CmsScheduledJobInfo jobCopy; if (job == null) { jobCopy = new CmsScheduledJobInfo(); jobCopy.setContextInfo(new CmsContextInfo()); m_dialogWindow.setCaption( CmsVaadinUtils.getMessageText( org.opencms.workplace.tools.scheduler.Messages.GUI_NEWJOB_ADMIN_TOOL_NAME_0)); } else { jobCopy = job.clone(); jobCopy.setActive(job.isActive()); if (copy) { jobCopy.clearId(); m_dialogWindow.setCaption( CmsVaadinUtils.getMessageText( org.opencms.ui.Messages.GUI_SCHEDULER_TITLE_COPY_1, job.getJobName())); } else { m_dialogWindow.setCaption( CmsVaadinUtils.getMessageText( org.opencms.workplace.tools.scheduler.Messages.GUI_JOBS_LIST_ACTION_EDIT_NAME_0)); } } CmsJobEditView editPanel = new CmsJobEditView(this, jobCopy); editPanel.loadFromBean(jobCopy); m_dialogWindow.setContent(editPanel); A_CmsUI.get().addWindow(m_dialogWindow); m_dialogWindow.center(); return editPanel; }
java
public CmsJobEditView openEditDialog(String jobId, boolean copy) { if (m_dialogWindow != null) { m_dialogWindow.close(); } m_dialogWindow = CmsBasicDialog.prepareWindow(DialogWidth.wide); CmsScheduledJobInfo job = null; if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(jobId)) { job = getElement(jobId); } CmsScheduledJobInfo jobCopy; if (job == null) { jobCopy = new CmsScheduledJobInfo(); jobCopy.setContextInfo(new CmsContextInfo()); m_dialogWindow.setCaption( CmsVaadinUtils.getMessageText( org.opencms.workplace.tools.scheduler.Messages.GUI_NEWJOB_ADMIN_TOOL_NAME_0)); } else { jobCopy = job.clone(); jobCopy.setActive(job.isActive()); if (copy) { jobCopy.clearId(); m_dialogWindow.setCaption( CmsVaadinUtils.getMessageText( org.opencms.ui.Messages.GUI_SCHEDULER_TITLE_COPY_1, job.getJobName())); } else { m_dialogWindow.setCaption( CmsVaadinUtils.getMessageText( org.opencms.workplace.tools.scheduler.Messages.GUI_JOBS_LIST_ACTION_EDIT_NAME_0)); } } CmsJobEditView editPanel = new CmsJobEditView(this, jobCopy); editPanel.loadFromBean(jobCopy); m_dialogWindow.setContent(editPanel); A_CmsUI.get().addWindow(m_dialogWindow); m_dialogWindow.center(); return editPanel; }
[ "public", "CmsJobEditView", "openEditDialog", "(", "String", "jobId", ",", "boolean", "copy", ")", "{", "if", "(", "m_dialogWindow", "!=", "null", ")", "{", "m_dialogWindow", ".", "close", "(", ")", ";", "}", "m_dialogWindow", "=", "CmsBasicDialog", ".", "pr...
Creates the edit view for the given job id.<p> @param jobId the id of the job to edit, or null to create a new job @param copy <code>true</code> to create a copy of the given job @return the edit view
[ "Creates", "the", "edit", "view", "for", "the", "given", "job", "id", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/scheduler/CmsJobManagerApp.java#L151-L191
apereo/cas
support/cas-server-support-ws-sts-api/src/main/java/org/apereo/cas/support/util/CryptoUtils.java
CryptoUtils.getSecurityProperties
public static Properties getSecurityProperties(final String file, final String psw, final String alias) { val p = new Properties(); p.put("org.apache.ws.security.crypto.provider", "org.apache.ws.security.components.crypto.Merlin"); p.put("org.apache.ws.security.crypto.merlin.keystore.type", "jks"); p.put("org.apache.ws.security.crypto.merlin.keystore.password", psw); p.put("org.apache.ws.security.crypto.merlin.keystore.file", file); if (StringUtils.isNotBlank(alias)) { p.put("org.apache.ws.security.crypto.merlin.keystore.alias", alias); } return p; }
java
public static Properties getSecurityProperties(final String file, final String psw, final String alias) { val p = new Properties(); p.put("org.apache.ws.security.crypto.provider", "org.apache.ws.security.components.crypto.Merlin"); p.put("org.apache.ws.security.crypto.merlin.keystore.type", "jks"); p.put("org.apache.ws.security.crypto.merlin.keystore.password", psw); p.put("org.apache.ws.security.crypto.merlin.keystore.file", file); if (StringUtils.isNotBlank(alias)) { p.put("org.apache.ws.security.crypto.merlin.keystore.alias", alias); } return p; }
[ "public", "static", "Properties", "getSecurityProperties", "(", "final", "String", "file", ",", "final", "String", "psw", ",", "final", "String", "alias", ")", "{", "val", "p", "=", "new", "Properties", "(", ")", ";", "p", ".", "put", "(", "\"org.apache.ws...
Gets security properties. @param file the file @param psw the psw @param alias the alias @return the security properties
[ "Gets", "security", "properties", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-ws-sts-api/src/main/java/org/apereo/cas/support/util/CryptoUtils.java#L37-L47
alkacon/opencms-core
src/org/opencms/ui/apps/CmsWorkplaceAppManager.java
CmsWorkplaceAppManager.getEditorForType
public I_CmsEditor getEditorForType(I_CmsResourceType type, boolean plainText) { List<I_CmsEditor> editors = new ArrayList<I_CmsEditor>(); for (int i = 0; i < EDITORS.length; i++) { if (EDITORS[i].matchesType(type, plainText)) { editors.add(EDITORS[i]); } } I_CmsEditor result = null; if (editors.size() == 1) { result = editors.get(0); } else if (editors.size() > 1) { Collections.sort(editors, new Comparator<I_CmsEditor>() { public int compare(I_CmsEditor o1, I_CmsEditor o2) { return o1.getPriority() > o2.getPriority() ? -1 : 1; } }); result = editors.get(0); } return result; }
java
public I_CmsEditor getEditorForType(I_CmsResourceType type, boolean plainText) { List<I_CmsEditor> editors = new ArrayList<I_CmsEditor>(); for (int i = 0; i < EDITORS.length; i++) { if (EDITORS[i].matchesType(type, plainText)) { editors.add(EDITORS[i]); } } I_CmsEditor result = null; if (editors.size() == 1) { result = editors.get(0); } else if (editors.size() > 1) { Collections.sort(editors, new Comparator<I_CmsEditor>() { public int compare(I_CmsEditor o1, I_CmsEditor o2) { return o1.getPriority() > o2.getPriority() ? -1 : 1; } }); result = editors.get(0); } return result; }
[ "public", "I_CmsEditor", "getEditorForType", "(", "I_CmsResourceType", "type", ",", "boolean", "plainText", ")", "{", "List", "<", "I_CmsEditor", ">", "editors", "=", "new", "ArrayList", "<", "I_CmsEditor", ">", "(", ")", ";", "for", "(", "int", "i", "=", ...
Returns the editor for the given resource type.<p> @param type the resource type to edit @param plainText if plain text editing is required @return the editor
[ "Returns", "the", "editor", "for", "the", "given", "resource", "type", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/CmsWorkplaceAppManager.java#L499-L521
vanilladb/vanillacore
src/main/java/org/vanilladb/core/storage/index/Index.java
Index.searchCost
public static long searchCost(IndexType idxType, SearchKeyType keyType, long totRecs, long matchRecs) { if (idxType == IndexType.HASH) return HashIndex.searchCost(keyType, totRecs, matchRecs); else if (idxType == IndexType.BTREE) return BTreeIndex.searchCost(keyType, totRecs, matchRecs); else throw new IllegalArgumentException("unsupported index type"); }
java
public static long searchCost(IndexType idxType, SearchKeyType keyType, long totRecs, long matchRecs) { if (idxType == IndexType.HASH) return HashIndex.searchCost(keyType, totRecs, matchRecs); else if (idxType == IndexType.BTREE) return BTreeIndex.searchCost(keyType, totRecs, matchRecs); else throw new IllegalArgumentException("unsupported index type"); }
[ "public", "static", "long", "searchCost", "(", "IndexType", "idxType", ",", "SearchKeyType", "keyType", ",", "long", "totRecs", ",", "long", "matchRecs", ")", "{", "if", "(", "idxType", "==", "IndexType", ".", "HASH", ")", "return", "HashIndex", ".", "search...
Estimates the number of block accesses required to find all index records matching a search range, given the specified numbers of total records and matching records. <p> This number does <em>not</em> include the block accesses required to retrieve data records. </p> @param idxType the index type @param keyType the type of the search key @param totRecs the total number of records in the table @param matchRecs the number of matching records @return the estimated the number of block accesses
[ "Estimates", "the", "number", "of", "block", "accesses", "required", "to", "find", "all", "index", "records", "matching", "a", "search", "range", "given", "the", "specified", "numbers", "of", "total", "records", "and", "matching", "records", ".", "<p", ">", ...
train
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/index/Index.java#L49-L56
cdapio/tigon
tigon-api/src/main/java/co/cask/tigon/internal/io/Schema.java
Schema.arrayOf
public static Schema arrayOf(Schema componentSchema) { return new Schema(Type.ARRAY, null, componentSchema, null, null, null, null, null); }
java
public static Schema arrayOf(Schema componentSchema) { return new Schema(Type.ARRAY, null, componentSchema, null, null, null, null, null); }
[ "public", "static", "Schema", "arrayOf", "(", "Schema", "componentSchema", ")", "{", "return", "new", "Schema", "(", "Type", ".", "ARRAY", ",", "null", ",", "componentSchema", ",", "null", ",", "null", ",", "null", ",", "null", ",", "null", ")", ";", "...
Creates an {@link Type#ARRAY ARRAY} {@link Schema} of the given component type. @param componentSchema Schema of the array component. @return A {@link Schema} of {@link Type#ARRAY ARRAY} type.
[ "Creates", "an", "{" ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-api/src/main/java/co/cask/tigon/internal/io/Schema.java#L175-L177
zutnop/telekom-workflow-engine
telekom-workflow-engine/src/main/java/ee/telekom/workflow/api/NodeBuilder.java
NodeBuilder.findPartnerNodeId
private int findPartnerNodeId( Tree<Row> current, Type type ){ switch( type ) { case JOIN_FIRST: case JOIN_ALL: case WHILE_DO_END: // The partner is the previous sibling which is the SPLIT or WHILE_DO_BEGIN return current.getPrevious().getContent().getId(); case DO_WHILE_BEGIN: // The partner is the next sibling which is the DO_WHILE_END return current.getNext().getContent().getMainElement().getId(); case END_IF: // The partner is the first previous IF (there may be ELSE_IF and ELSE siblings between IF and this END_IF) Tree<Row> if_ = current; while( !Type.IF.equals( if_.getContent().getType() ) ){ if_ = if_.getPrevious(); } return if_.getContent().getId(); default : throw new IllegalStateException(); } }
java
private int findPartnerNodeId( Tree<Row> current, Type type ){ switch( type ) { case JOIN_FIRST: case JOIN_ALL: case WHILE_DO_END: // The partner is the previous sibling which is the SPLIT or WHILE_DO_BEGIN return current.getPrevious().getContent().getId(); case DO_WHILE_BEGIN: // The partner is the next sibling which is the DO_WHILE_END return current.getNext().getContent().getMainElement().getId(); case END_IF: // The partner is the first previous IF (there may be ELSE_IF and ELSE siblings between IF and this END_IF) Tree<Row> if_ = current; while( !Type.IF.equals( if_.getContent().getType() ) ){ if_ = if_.getPrevious(); } return if_.getContent().getId(); default : throw new IllegalStateException(); } }
[ "private", "int", "findPartnerNodeId", "(", "Tree", "<", "Row", ">", "current", ",", "Type", "type", ")", "{", "switch", "(", "type", ")", "{", "case", "JOIN_FIRST", ":", "case", "JOIN_ALL", ":", "case", "WHILE_DO_END", ":", "// The partner is the previous sib...
Some node producing elements do not define an id themselves but deduce their id based on their block-opening or block-closing partner. E.g. a WHILE_DO_END deduces its id based on its WHILE_DO_BEGIN partner.
[ "Some", "node", "producing", "elements", "do", "not", "define", "an", "id", "themselves", "but", "deduce", "their", "id", "based", "on", "their", "block", "-", "opening", "or", "block", "-", "closing", "partner", ".", "E", ".", "g", ".", "a", "WHILE_DO_E...
train
https://github.com/zutnop/telekom-workflow-engine/blob/f471f1f94013b3e2d56b4c9380e86e3a92c2ee29/telekom-workflow-engine/src/main/java/ee/telekom/workflow/api/NodeBuilder.java#L176-L196
apache/flink
flink-scala/src/main/java/org/apache/flink/api/scala/operators/ScalaCsvOutputFormat.java
ScalaCsvOutputFormat.setInputType
@Override public void setInputType(TypeInformation<?> type, ExecutionConfig executionConfig) { if (!type.isTupleType()) { throw new InvalidProgramException("The " + ScalaCsvOutputFormat.class.getSimpleName() + " can only be used to write tuple data sets."); } }
java
@Override public void setInputType(TypeInformation<?> type, ExecutionConfig executionConfig) { if (!type.isTupleType()) { throw new InvalidProgramException("The " + ScalaCsvOutputFormat.class.getSimpleName() + " can only be used to write tuple data sets."); } }
[ "@", "Override", "public", "void", "setInputType", "(", "TypeInformation", "<", "?", ">", "type", ",", "ExecutionConfig", "executionConfig", ")", "{", "if", "(", "!", "type", ".", "isTupleType", "(", ")", ")", "{", "throw", "new", "InvalidProgramException", ...
The purpose of this method is solely to check whether the data type to be processed is in fact a tuple type.
[ "The", "purpose", "of", "this", "method", "is", "solely", "to", "check", "whether", "the", "data", "type", "to", "be", "processed", "is", "in", "fact", "a", "tuple", "type", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-scala/src/main/java/org/apache/flink/api/scala/operators/ScalaCsvOutputFormat.java#L223-L229
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/LocPathIterator.java
LocPathIterator.setRoot
public void setRoot(int context, Object environment) { m_context = context; XPathContext xctxt = (XPathContext)environment; m_execContext = xctxt; m_cdtm = xctxt.getDTM(context); m_currentContextNode = context; // only if top level? // Yech, shouldn't have to do this. -sb if(null == m_prefixResolver) m_prefixResolver = xctxt.getNamespaceContext(); m_lastFetched = DTM.NULL; m_foundLast = false; m_pos = 0; m_length = -1; if (m_isTopLevel) this.m_stackFrame = xctxt.getVarStack().getStackFrame(); // reset(); }
java
public void setRoot(int context, Object environment) { m_context = context; XPathContext xctxt = (XPathContext)environment; m_execContext = xctxt; m_cdtm = xctxt.getDTM(context); m_currentContextNode = context; // only if top level? // Yech, shouldn't have to do this. -sb if(null == m_prefixResolver) m_prefixResolver = xctxt.getNamespaceContext(); m_lastFetched = DTM.NULL; m_foundLast = false; m_pos = 0; m_length = -1; if (m_isTopLevel) this.m_stackFrame = xctxt.getVarStack().getStackFrame(); // reset(); }
[ "public", "void", "setRoot", "(", "int", "context", ",", "Object", "environment", ")", "{", "m_context", "=", "context", ";", "XPathContext", "xctxt", "=", "(", "XPathContext", ")", "environment", ";", "m_execContext", "=", "xctxt", ";", "m_cdtm", "=", "xctx...
Initialize the context values for this expression after it is cloned. @param context The XPath runtime context for this transformation.
[ "Initialize", "the", "context", "values", "for", "this", "expression", "after", "it", "is", "cloned", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/LocPathIterator.java#L357-L381
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapAdapter.java
LdapAdapter.getAncestors
private void getAncestors(Entity entity, LdapEntry ldapEntry, AncestorControl ancesCtrl) throws WIMException { if (ancesCtrl == null) { return; } List<String> propNames = ancesCtrl.getProperties(); int level = ancesCtrl.getLevel(); List<String> ancesTypes = getEntityTypes(ancesCtrl); String[] bases = getBases(ancesCtrl, ancesTypes); String dn = ldapEntry.getDN(); List<String> ancestorDns = iLdapConn.getAncestorDNs(dn, level); Entity parentEntity = entity; for (int i = 0; i < ancestorDns.size(); i++) { String ancesDn = ancestorDns.get(i); if (ancesDn.length() == 0) { continue; } if (LdapHelper.isUnderBases(ancesDn, bases)) { LdapEntry ancesEntry = iLdapConn.getEntityByIdentifier(ancesDn, null, null, ancesTypes, propNames, false, false); String ancesType = ancesEntry.getType(); Entity ancestor = null; if (ancesTypes.contains(ancesType)) { ancestor = createEntityFromLdapEntry(parentEntity, SchemaConstants.DO_PARENT, ancesEntry, propNames); } else { ancestor = createEntityFromLdapEntry(parentEntity, SchemaConstants.DO_PARENT, ancesEntry, null); } parentEntity = ancestor; } } }
java
private void getAncestors(Entity entity, LdapEntry ldapEntry, AncestorControl ancesCtrl) throws WIMException { if (ancesCtrl == null) { return; } List<String> propNames = ancesCtrl.getProperties(); int level = ancesCtrl.getLevel(); List<String> ancesTypes = getEntityTypes(ancesCtrl); String[] bases = getBases(ancesCtrl, ancesTypes); String dn = ldapEntry.getDN(); List<String> ancestorDns = iLdapConn.getAncestorDNs(dn, level); Entity parentEntity = entity; for (int i = 0; i < ancestorDns.size(); i++) { String ancesDn = ancestorDns.get(i); if (ancesDn.length() == 0) { continue; } if (LdapHelper.isUnderBases(ancesDn, bases)) { LdapEntry ancesEntry = iLdapConn.getEntityByIdentifier(ancesDn, null, null, ancesTypes, propNames, false, false); String ancesType = ancesEntry.getType(); Entity ancestor = null; if (ancesTypes.contains(ancesType)) { ancestor = createEntityFromLdapEntry(parentEntity, SchemaConstants.DO_PARENT, ancesEntry, propNames); } else { ancestor = createEntityFromLdapEntry(parentEntity, SchemaConstants.DO_PARENT, ancesEntry, null); } parentEntity = ancestor; } } }
[ "private", "void", "getAncestors", "(", "Entity", "entity", ",", "LdapEntry", "ldapEntry", ",", "AncestorControl", "ancesCtrl", ")", "throws", "WIMException", "{", "if", "(", "ancesCtrl", "==", "null", ")", "{", "return", ";", "}", "List", "<", "String", ">"...
Method to get the ancestors of the given entity. @param entity @param ldapEntry @param ancesCtrl @throws WIMException
[ "Method", "to", "get", "the", "ancestors", "of", "the", "given", "entity", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.adapter.ldap/src/com/ibm/ws/security/wim/adapter/ldap/LdapAdapter.java#L2579-L2610
apache/incubator-gobblin
gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/InnerMetricContext.java
InnerMetricContext.getGauges
@Override public SortedMap<String, Gauge> getGauges(MetricFilter filter) { return getSimplyNamedMetrics(Gauge.class, Optional.of(filter)); }
java
@Override public SortedMap<String, Gauge> getGauges(MetricFilter filter) { return getSimplyNamedMetrics(Gauge.class, Optional.of(filter)); }
[ "@", "Override", "public", "SortedMap", "<", "String", ",", "Gauge", ">", "getGauges", "(", "MetricFilter", "filter", ")", "{", "return", "getSimplyNamedMetrics", "(", "Gauge", ".", "class", ",", "Optional", ".", "of", "(", "filter", ")", ")", ";", "}" ]
See {@link com.codahale.metrics.MetricRegistry#getGauges(com.codahale.metrics.MetricFilter)}. <p> This method will return fully-qualified metric names if the {@link MetricContext} is configured to report fully-qualified metric names. </p>
[ "See", "{", "@link", "com", ".", "codahale", ".", "metrics", ".", "MetricRegistry#getGauges", "(", "com", ".", "codahale", ".", "metrics", ".", "MetricFilter", ")", "}", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/InnerMetricContext.java#L190-L193
ModeShape/modeshape
web/modeshape-web-explorer/src/main/java/org/modeshape/web/BinaryContentUploadServlet.java
BinaryContentUploadServlet.processRequest
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { List<FileItem> items; // Parse the request try { items = upload.parseRequest(request); } catch (FileUploadException e) { throw new ServletException(e); } String repository = getParameter(items, REPOSITORY_NAME_PARAMETER); String workspace = getParameter(items, WORKSPACE_NAME_PARAMETER); String path = getParameter(items, NODE_PATH_PARAMETER); String pname = getParameter(items, PROPERTY_NAME_PARAMETER); if (logger.isDebugEnabled()) { logger.debug(String.format("Upload %s at %s/%s%s", pname, repository, workspace, path)); } String mimeType = getContentType(items); Connector connector = (Connector) request.getSession().getAttribute(REPOSITORY_CONNECTOR); try { Session session = connector.find(repository).session(workspace); ValueFactory valueFactory = session.getValueFactory(); Binary bin = valueFactory.createBinary(getStream(items)); Node node = session.getNode(path); node.setProperty(pname, bin); node.setProperty(MIME_TYPE, mimeType); bin.dispose(); } catch (Exception e) { throw new ServletException(e); } String uri = request.getContextPath() + String.format(DESTINATION_URL, repository, workspace, path); response.sendRedirect(uri); }
java
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { List<FileItem> items; // Parse the request try { items = upload.parseRequest(request); } catch (FileUploadException e) { throw new ServletException(e); } String repository = getParameter(items, REPOSITORY_NAME_PARAMETER); String workspace = getParameter(items, WORKSPACE_NAME_PARAMETER); String path = getParameter(items, NODE_PATH_PARAMETER); String pname = getParameter(items, PROPERTY_NAME_PARAMETER); if (logger.isDebugEnabled()) { logger.debug(String.format("Upload %s at %s/%s%s", pname, repository, workspace, path)); } String mimeType = getContentType(items); Connector connector = (Connector) request.getSession().getAttribute(REPOSITORY_CONNECTOR); try { Session session = connector.find(repository).session(workspace); ValueFactory valueFactory = session.getValueFactory(); Binary bin = valueFactory.createBinary(getStream(items)); Node node = session.getNode(path); node.setProperty(pname, bin); node.setProperty(MIME_TYPE, mimeType); bin.dispose(); } catch (Exception e) { throw new ServletException(e); } String uri = request.getContextPath() + String.format(DESTINATION_URL, repository, workspace, path); response.sendRedirect(uri); }
[ "protected", "void", "processRequest", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "ServletException", ",", "IOException", "{", "List", "<", "FileItem", ">", "items", ";", "// Parse the request", "try", "{", "items", ...
Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods. @param request servlet request @param response servlet response @throws ServletException if a servlet-specific error occurs @throws IOException if an I/O error occurs
[ "Processes", "requests", "for", "both", "HTTP", "<code", ">", "GET<", "/", "code", ">", "and", "<code", ">", "POST<", "/", "code", ">", "methods", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/web/modeshape-web-explorer/src/main/java/org/modeshape/web/BinaryContentUploadServlet.java#L68-L108
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java
Frame.getArgument
@Deprecated public ValueType getArgument(InvokeInstruction ins, ConstantPoolGen cpg, int i, int numArguments) throws DataflowAnalysisException { SignatureParser sigParser = new SignatureParser(ins.getSignature(cpg)); return getArgument(ins, cpg, i, sigParser); }
java
@Deprecated public ValueType getArgument(InvokeInstruction ins, ConstantPoolGen cpg, int i, int numArguments) throws DataflowAnalysisException { SignatureParser sigParser = new SignatureParser(ins.getSignature(cpg)); return getArgument(ins, cpg, i, sigParser); }
[ "@", "Deprecated", "public", "ValueType", "getArgument", "(", "InvokeInstruction", "ins", ",", "ConstantPoolGen", "cpg", ",", "int", "i", ",", "int", "numArguments", ")", "throws", "DataflowAnalysisException", "{", "SignatureParser", "sigParser", "=", "new", "Signat...
Get the <i>i</i>th argument passed to given method invocation. @param ins the method invocation instruction @param cpg the ConstantPoolGen for the class containing the method @param i index of the argument; 0 for the first argument, etc. @param numArguments total number of arguments to the method @return the <i>i</i>th argument @throws DataflowAnalysisException
[ "Get", "the", "<i", ">", "i<", "/", "i", ">", "th", "argument", "passed", "to", "given", "method", "invocation", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Frame.java#L387-L392
janvanbesien/java-ipv6
src/main/java/com/googlecode/ipv6/IPv6AddressPool.java
IPv6AddressPool.fromRangeAndSubnet
public static IPv6AddressPool fromRangeAndSubnet(final IPv6AddressRange range, final IPv6NetworkMask allocationSubnetSize) { // in the beginning, all is free return new IPv6AddressPool(range, allocationSubnetSize, new TreeSet<IPv6AddressRange>(Arrays.asList(range)), null); }
java
public static IPv6AddressPool fromRangeAndSubnet(final IPv6AddressRange range, final IPv6NetworkMask allocationSubnetSize) { // in the beginning, all is free return new IPv6AddressPool(range, allocationSubnetSize, new TreeSet<IPv6AddressRange>(Arrays.asList(range)), null); }
[ "public", "static", "IPv6AddressPool", "fromRangeAndSubnet", "(", "final", "IPv6AddressRange", "range", ",", "final", "IPv6NetworkMask", "allocationSubnetSize", ")", "{", "// in the beginning, all is free", "return", "new", "IPv6AddressPool", "(", "range", ",", "allocationS...
Create a pool of the given range (boundaries inclusive) which is completely free. The given subnet size is the network mask (thus size) of the allocated subnets in this range. This constructor verifies that the whole range is "aligned" with subnets of this size (i.e. there should not be a waste of space in the beginning or end which is smaller than one subnet of the given subnet size). @param range range from within to allocate @param allocationSubnetSize size of the subnets that will be allocated @return ipv6 address pool
[ "Create", "a", "pool", "of", "the", "given", "range", "(", "boundaries", "inclusive", ")", "which", "is", "completely", "free", ".", "The", "given", "subnet", "size", "is", "the", "network", "mask", "(", "thus", "size", ")", "of", "the", "allocated", "su...
train
https://github.com/janvanbesien/java-ipv6/blob/9af15b4a6c0074f9fa23dfa030027c631b9c2f78/src/main/java/com/googlecode/ipv6/IPv6AddressPool.java#L57-L62
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ObjectUtility.java
ObjectUtility.notEquals
public static boolean notEquals(final Object object1, final Object object2) { return object1 != null && !object1.equals(object2) || object1 == null && object2 != null; }
java
public static boolean notEquals(final Object object1, final Object object2) { return object1 != null && !object1.equals(object2) || object1 == null && object2 != null; }
[ "public", "static", "boolean", "notEquals", "(", "final", "Object", "object1", ",", "final", "Object", "object2", ")", "{", "return", "object1", "!=", "null", "&&", "!", "object1", ".", "equals", "(", "object2", ")", "||", "object1", "==", "null", "&&", ...
Return true if the object are NOT equals.<br /> This method is NullPointerException-proof @param object1 first object to compare @param object2 second object to compare @return true if the object are NOT equals
[ "Return", "true", "if", "the", "object", "are", "NOT", "equals", ".", "<br", "/", ">", "This", "method", "is", "NullPointerException", "-", "proof" ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ObjectUtility.java#L62-L64
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/oauth/OAuthFlowImpl.java
OAuthFlowImpl.refreshToken
public Token refreshToken(Token token) throws OAuthTokenException, JSONSerializerException, HttpClientException, URISyntaxException, InvalidRequestException { // Prepare the hash String doHash = clientSecret + "|" + token.getRefreshToken(); MessageDigest md; try { md = MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("Your JVM does not support SHA-256, which is required for OAuth with Smartsheet.", e); } byte[] digest; try { digest = md.digest(doHash.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } //String hash = javax.xml.bind.DatatypeConverter.printHexBinary(digest); String hash = org.apache.commons.codec.binary.Hex.encodeHexString(digest); // Create a map of the parameters Map<String,Object> params = new HashMap<String,Object>(); params.put("grant_type", "refresh_token"); params.put("client_id",clientId); params.put("refresh_token",token.getRefreshToken()); params.put("redirect_uri", redirectURL); params.put("hash",hash); // Generate the URL and get the token return requestToken(QueryUtil.generateUrl(tokenURL, params)); }
java
public Token refreshToken(Token token) throws OAuthTokenException, JSONSerializerException, HttpClientException, URISyntaxException, InvalidRequestException { // Prepare the hash String doHash = clientSecret + "|" + token.getRefreshToken(); MessageDigest md; try { md = MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("Your JVM does not support SHA-256, which is required for OAuth with Smartsheet.", e); } byte[] digest; try { digest = md.digest(doHash.getBytes("UTF-8")); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } //String hash = javax.xml.bind.DatatypeConverter.printHexBinary(digest); String hash = org.apache.commons.codec.binary.Hex.encodeHexString(digest); // Create a map of the parameters Map<String,Object> params = new HashMap<String,Object>(); params.put("grant_type", "refresh_token"); params.put("client_id",clientId); params.put("refresh_token",token.getRefreshToken()); params.put("redirect_uri", redirectURL); params.put("hash",hash); // Generate the URL and get the token return requestToken(QueryUtil.generateUrl(tokenURL, params)); }
[ "public", "Token", "refreshToken", "(", "Token", "token", ")", "throws", "OAuthTokenException", ",", "JSONSerializerException", ",", "HttpClientException", ",", "URISyntaxException", ",", "InvalidRequestException", "{", "// Prepare the hash", "String", "doHash", "=", "cli...
Refresh token. Exceptions: - IllegalArgumentException : if token is null. - InvalidTokenRequestException : if the token request is invalid - InvalidOAuthClientException : if the client information is invalid - InvalidOAuthGrantException : if the authorization code or refresh token is invalid or expired, the redirect_uri does not match, or the hash value does not match the client secret and/or code - UnsupportedOAuthGrantTypeException : if the grant type is invalid - OAuthTokenException : if any other error occurred during the operation @param token the token to refresh @return the refreshed token @throws NoSuchAlgorithmException the no such algorithm exception @throws UnsupportedEncodingException the unsupported encoding exception @throws OAuthTokenException the o auth token exception @throws JSONSerializerException the JSON serializer exception @throws HttpClientException the http client exception @throws URISyntaxException the URI syntax exception @throws InvalidRequestException the invalid request exception
[ "Refresh", "token", "." ]
train
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/oauth/OAuthFlowImpl.java#L302-L331
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/cache/document/DocumentTranslator.java
DocumentTranslator.getChildReferencesFromBlock
protected ChildReferences getChildReferencesFromBlock( Document block, boolean allowsSNS ) { if (!block.containsField(CHILDREN)) { return ImmutableChildReferences.EMPTY_CHILD_REFERENCES; } return ImmutableChildReferences.create(this, block, CHILDREN, allowsSNS); }
java
protected ChildReferences getChildReferencesFromBlock( Document block, boolean allowsSNS ) { if (!block.containsField(CHILDREN)) { return ImmutableChildReferences.EMPTY_CHILD_REFERENCES; } return ImmutableChildReferences.create(this, block, CHILDREN, allowsSNS); }
[ "protected", "ChildReferences", "getChildReferencesFromBlock", "(", "Document", "block", ",", "boolean", "allowsSNS", ")", "{", "if", "(", "!", "block", ".", "containsField", "(", "CHILDREN", ")", ")", "{", "return", "ImmutableChildReferences", ".", "EMPTY_CHILD_REF...
Reads the children of the given block and returns a {@link ChildReferences} instance. @param block a {@code non-null} {@link Document} representing a block of children @param allowsSNS {@code true} if the child references instance should be SNS aware, {@code false} otherwise @return a {@code non-null} child references instance
[ "Reads", "the", "children", "of", "the", "given", "block", "and", "returns", "a", "{", "@link", "ChildReferences", "}", "instance", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/cache/document/DocumentTranslator.java#L917-L922
tango-controls/JTango
server/src/main/java/org/tango/server/build/DevicePropertyBuilder.java
DevicePropertyBuilder.build
public void build(final Class<?> clazz, final Field field, final DeviceImpl device, final Object businessObject) throws DevFailed { xlogger.entry(); try { // Inject each device property final DeviceProperty annot = field.getAnnotation(DeviceProperty.class); final String fieldName = field.getName(); String propName; if (annot.name().equals("")) { propName = fieldName; } else { propName = annot.name(); } logger.debug("Has a DeviceProperty : {}", propName); BuilderUtils.checkStatic(field); String setterName = BuilderUtils.SET + fieldName.substring(0, 1).toUpperCase(Locale.ENGLISH) + fieldName.substring(1); Method setter = null; try { setter = businessObject.getClass().getMethod(setterName, field.getType()); } catch (final NoSuchMethodException e) { if (fieldName.startsWith(BuilderUtils.IS)) { setterName = BuilderUtils.SET + fieldName.substring(2); try { setter = businessObject.getClass().getMethod(setterName, field.getType()); } catch (final NoSuchMethodException e1) { throw DevFailedUtils.newDevFailed(e); } } else { throw DevFailedUtils.newDevFailed(e); } } final DevicePropertyImpl property = new DevicePropertyImpl(propName, annot.description(), setter, businessObject, device.getName(), device.getClassName(), annot.isMandatory(), annot.defaultValue()); device.addDeviceProperty(property); } catch (final IllegalArgumentException e) { throw DevFailedUtils.newDevFailed(e); } xlogger.exit(); }
java
public void build(final Class<?> clazz, final Field field, final DeviceImpl device, final Object businessObject) throws DevFailed { xlogger.entry(); try { // Inject each device property final DeviceProperty annot = field.getAnnotation(DeviceProperty.class); final String fieldName = field.getName(); String propName; if (annot.name().equals("")) { propName = fieldName; } else { propName = annot.name(); } logger.debug("Has a DeviceProperty : {}", propName); BuilderUtils.checkStatic(field); String setterName = BuilderUtils.SET + fieldName.substring(0, 1).toUpperCase(Locale.ENGLISH) + fieldName.substring(1); Method setter = null; try { setter = businessObject.getClass().getMethod(setterName, field.getType()); } catch (final NoSuchMethodException e) { if (fieldName.startsWith(BuilderUtils.IS)) { setterName = BuilderUtils.SET + fieldName.substring(2); try { setter = businessObject.getClass().getMethod(setterName, field.getType()); } catch (final NoSuchMethodException e1) { throw DevFailedUtils.newDevFailed(e); } } else { throw DevFailedUtils.newDevFailed(e); } } final DevicePropertyImpl property = new DevicePropertyImpl(propName, annot.description(), setter, businessObject, device.getName(), device.getClassName(), annot.isMandatory(), annot.defaultValue()); device.addDeviceProperty(property); } catch (final IllegalArgumentException e) { throw DevFailedUtils.newDevFailed(e); } xlogger.exit(); }
[ "public", "void", "build", "(", "final", "Class", "<", "?", ">", "clazz", ",", "final", "Field", "field", ",", "final", "DeviceImpl", "device", ",", "final", "Object", "businessObject", ")", "throws", "DevFailed", "{", "xlogger", ".", "entry", "(", ")", ...
Create device property {@link DeviceProperty} @param clazz @param field @param device @param businessObject @throws DevFailed
[ "Create", "device", "property", "{", "@link", "DeviceProperty", "}" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/build/DevicePropertyBuilder.java#L62-L101
finmath/finmath-lib
src/main/java/net/finmath/marketdata/model/bond/Bond.java
Bond.getValueWithGivenSpreadOverCurve
public double getValueWithGivenSpreadOverCurve(double evaluationTime,Curve referenceCurve, double spread, AnalyticModel model) { double value=0; for(int periodIndex=0; periodIndex<schedule.getNumberOfPeriods();periodIndex++) { double paymentDate = schedule.getPayment(periodIndex); value+= paymentDate>evaluationTime ? getCouponPayment(periodIndex,model)*Math.exp(-spread*paymentDate)*referenceCurve.getValue(paymentDate): 0.0; } double paymentDate = schedule.getPayment(schedule.getNumberOfPeriods()-1); return paymentDate>evaluationTime ? value+Math.exp(-spread*paymentDate)*referenceCurve.getValue(paymentDate):0.0; }
java
public double getValueWithGivenSpreadOverCurve(double evaluationTime,Curve referenceCurve, double spread, AnalyticModel model) { double value=0; for(int periodIndex=0; periodIndex<schedule.getNumberOfPeriods();periodIndex++) { double paymentDate = schedule.getPayment(periodIndex); value+= paymentDate>evaluationTime ? getCouponPayment(periodIndex,model)*Math.exp(-spread*paymentDate)*referenceCurve.getValue(paymentDate): 0.0; } double paymentDate = schedule.getPayment(schedule.getNumberOfPeriods()-1); return paymentDate>evaluationTime ? value+Math.exp(-spread*paymentDate)*referenceCurve.getValue(paymentDate):0.0; }
[ "public", "double", "getValueWithGivenSpreadOverCurve", "(", "double", "evaluationTime", ",", "Curve", "referenceCurve", ",", "double", "spread", ",", "AnalyticModel", "model", ")", "{", "double", "value", "=", "0", ";", "for", "(", "int", "periodIndex", "=", "0...
Returns the value of the sum of discounted cash flows of the bond where the discounting is done with the given reference curve and an additional spread. This method can be used for optimizer. @param evaluationTime The evaluation time as double. Cash flows prior and including this time are not considered. @param referenceCurve The reference curve used for discounting the coupon payments. @param spread The spread which should be added to the discount curve. @param model The model under which the product is valued. @return The value of the bond for the given curve and spread.
[ "Returns", "the", "value", "of", "the", "sum", "of", "discounted", "cash", "flows", "of", "the", "bond", "where", "the", "discounting", "is", "done", "with", "the", "given", "reference", "curve", "and", "an", "additional", "spread", ".", "This", "method", ...
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/model/bond/Bond.java#L235-L244
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/bytebuffer/WsByteBufferUtils.java
WsByteBufferUtils.putByteArrayValue
public static void putByteArrayValue(WsByteBuffer[] list, byte[] value, boolean bFlipLast) { if (null == list || null == value) { return; } if (value.length > getTotalCapacity(list)) { throw new IllegalArgumentException("Buffers not large enough"); } int remaining = value.length; int offset = 0; // current offset into the value int avail = 0; for (int i = 0; i < list.length; i++) { avail = list[i].limit() - list[i].position(); if (remaining <= avail) { list[i].put(value, offset, remaining); if (bFlipLast) { list[i].flip(); } break; } list[i].put(value, offset, avail); list[i].flip(); offset += avail; remaining -= avail; } }
java
public static void putByteArrayValue(WsByteBuffer[] list, byte[] value, boolean bFlipLast) { if (null == list || null == value) { return; } if (value.length > getTotalCapacity(list)) { throw new IllegalArgumentException("Buffers not large enough"); } int remaining = value.length; int offset = 0; // current offset into the value int avail = 0; for (int i = 0; i < list.length; i++) { avail = list[i].limit() - list[i].position(); if (remaining <= avail) { list[i].put(value, offset, remaining); if (bFlipLast) { list[i].flip(); } break; } list[i].put(value, offset, avail); list[i].flip(); offset += avail; remaining -= avail; } }
[ "public", "static", "void", "putByteArrayValue", "(", "WsByteBuffer", "[", "]", "list", ",", "byte", "[", "]", "value", ",", "boolean", "bFlipLast", ")", "{", "if", "(", "null", "==", "list", "||", "null", "==", "value", ")", "{", "return", ";", "}", ...
Store a byte[] into a wsbb[]. This will fill out each wsbb until all of the bytes are written. It will throw an exception if there is not enough space. Users must pass in a boolean to determine whether or not to flip() the last buffer -- i.e. pass in true if this is the only put you're doing, otherwise pass in false. Any intermediate buffers that are filled to capacity will be flip()'d automatically. A null input value will result in a no-op. @param list @param value @param bFlipLast
[ "Store", "a", "byte", "[]", "into", "a", "wsbb", "[]", ".", "This", "will", "fill", "out", "each", "wsbb", "until", "all", "of", "the", "bytes", "are", "written", ".", "It", "will", "throw", "an", "exception", "if", "there", "is", "not", "enough", "s...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/bytebuffer/WsByteBufferUtils.java#L417-L441
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/mps/syslog_ui_cmd.java
syslog_ui_cmd.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { syslog_ui_cmd_responses result = (syslog_ui_cmd_responses) service.get_payload_formatter().string_to_resource(syslog_ui_cmd_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.syslog_ui_cmd_response_array); } syslog_ui_cmd[] result_syslog_ui_cmd = new syslog_ui_cmd[result.syslog_ui_cmd_response_array.length]; for(int i = 0; i < result.syslog_ui_cmd_response_array.length; i++) { result_syslog_ui_cmd[i] = result.syslog_ui_cmd_response_array[i].syslog_ui_cmd[0]; } return result_syslog_ui_cmd; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { syslog_ui_cmd_responses result = (syslog_ui_cmd_responses) service.get_payload_formatter().string_to_resource(syslog_ui_cmd_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.syslog_ui_cmd_response_array); } syslog_ui_cmd[] result_syslog_ui_cmd = new syslog_ui_cmd[result.syslog_ui_cmd_response_array.length]; for(int i = 0; i < result.syslog_ui_cmd_response_array.length; i++) { result_syslog_ui_cmd[i] = result.syslog_ui_cmd_response_array[i].syslog_ui_cmd[0]; } return result_syslog_ui_cmd; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "syslog_ui_cmd_responses", "result", "=", "(", "syslog_ui_cmd_responses", ")", "service", ".", "get_payload_fo...
<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/mps/syslog_ui_cmd.java#L562-L579
crnk-project/crnk-framework
crnk-core/src/main/java/io/crnk/core/engine/internal/utils/ClassUtils.java
ClassUtils.findClassField
public static Field findClassField(Class<?> beanClass, String fieldName) { Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { for (Field field : currentClass.getDeclaredFields()) { if (field.isSynthetic()) { continue; } if (field.getName().equals(fieldName)) { return field; } } currentClass = currentClass.getSuperclass(); } return null; }
java
public static Field findClassField(Class<?> beanClass, String fieldName) { Class<?> currentClass = beanClass; while (currentClass != null && currentClass != Object.class) { for (Field field : currentClass.getDeclaredFields()) { if (field.isSynthetic()) { continue; } if (field.getName().equals(fieldName)) { return field; } } currentClass = currentClass.getSuperclass(); } return null; }
[ "public", "static", "Field", "findClassField", "(", "Class", "<", "?", ">", "beanClass", ",", "String", "fieldName", ")", "{", "Class", "<", "?", ">", "currentClass", "=", "beanClass", ";", "while", "(", "currentClass", "!=", "null", "&&", "currentClass", ...
Tries to find a class fields. Supports inheritance and doesn't return synthetic fields. @param beanClass class to be searched for @param fieldName field name @return a list of found fields
[ "Tries", "to", "find", "a", "class", "fields", ".", "Supports", "inheritance", "and", "doesn", "t", "return", "synthetic", "fields", "." ]
train
https://github.com/crnk-project/crnk-framework/blob/2fd3ef9a991788d46fd2e83b43c8ea37cbaf8681/crnk-core/src/main/java/io/crnk/core/engine/internal/utils/ClassUtils.java#L103-L119
revapi/revapi
revapi-maven-utils/src/main/java/org/revapi/maven/utils/ArtifactResolver.java
ArtifactResolver.resolveNewestMatching
public Artifact resolveNewestMatching(String gav, @Nullable String upToVersion, Pattern versionMatcher, boolean remoteOnly, boolean upToInclusive) throws VersionRangeResolutionException, ArtifactResolutionException { Artifact artifact = new DefaultArtifact(gav); artifact = artifact.setVersion(upToVersion == null ? "[,)" : "[," + upToVersion + (upToInclusive ? "]" : ")")); VersionRangeRequest rangeRequest = new VersionRangeRequest(artifact, repositories, null); RepositorySystemSession session = remoteOnly ? makeRemoteOnly(this.session) : this.session; VersionRangeResult result = repositorySystem.resolveVersionRange(session, rangeRequest); List<Version> versions = new ArrayList<>(result.getVersions()); Collections.reverse(versions); for(Version v : versions) { if (versionMatcher.matcher(v.toString()).matches()) { return resolveArtifact(artifact.setVersion(v.toString()), session); } } throw new VersionRangeResolutionException(result) { @Override public String getMessage() { return "Failed to find a version of artifact '" + gav + "' that would correspond to an expression '" + versionMatcher + "'. The versions found were: " + versions; } }; }
java
public Artifact resolveNewestMatching(String gav, @Nullable String upToVersion, Pattern versionMatcher, boolean remoteOnly, boolean upToInclusive) throws VersionRangeResolutionException, ArtifactResolutionException { Artifact artifact = new DefaultArtifact(gav); artifact = artifact.setVersion(upToVersion == null ? "[,)" : "[," + upToVersion + (upToInclusive ? "]" : ")")); VersionRangeRequest rangeRequest = new VersionRangeRequest(artifact, repositories, null); RepositorySystemSession session = remoteOnly ? makeRemoteOnly(this.session) : this.session; VersionRangeResult result = repositorySystem.resolveVersionRange(session, rangeRequest); List<Version> versions = new ArrayList<>(result.getVersions()); Collections.reverse(versions); for(Version v : versions) { if (versionMatcher.matcher(v.toString()).matches()) { return resolveArtifact(artifact.setVersion(v.toString()), session); } } throw new VersionRangeResolutionException(result) { @Override public String getMessage() { return "Failed to find a version of artifact '" + gav + "' that would correspond to an expression '" + versionMatcher + "'. The versions found were: " + versions; } }; }
[ "public", "Artifact", "resolveNewestMatching", "(", "String", "gav", ",", "@", "Nullable", "String", "upToVersion", ",", "Pattern", "versionMatcher", ",", "boolean", "remoteOnly", ",", "boolean", "upToInclusive", ")", "throws", "VersionRangeResolutionException", ",", ...
Tries to find the newest version of the artifact that matches given regular expression. The found version will be older than the {@code upToVersion} or newest available if {@code upToVersion} is null. @param gav the coordinates of the artifact. The version part is ignored @param upToVersion the version up to which the versions will be matched @param versionMatcher the matcher to match the version @param remoteOnly true if only remotely available artifacts should be considered @param upToInclusive whether the {@code upToVersion} should be considered inclusive or exclusive @return the resolved artifact @throws VersionRangeResolutionException
[ "Tries", "to", "find", "the", "newest", "version", "of", "the", "artifact", "that", "matches", "given", "regular", "expression", ".", "The", "found", "version", "will", "be", "older", "than", "the", "{", "@code", "upToVersion", "}", "or", "newest", "availabl...
train
https://github.com/revapi/revapi/blob/e070b136d977441ab96fdce067a13e7e0423295b/revapi-maven-utils/src/main/java/org/revapi/maven/utils/ArtifactResolver.java#L99-L128
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/mathematics/regularization/L1Regularizer.java
L1Regularizer.updateWeights
public static <K> void updateWeights(double l1, double learningRate, Map<K, Double> weights, Map<K, Double> newWeights) { if(l1 > 0.0) { /* //SGD-L1 (Naive) for(Map.Entry<K, Double> e : weights.entrySet()) { K column = e.getKey(); newWeights.put(column, newWeights.get(column) + l1*Math.signum(e.getValue())*(-learningRate)); } */ //SGDL1 (Clipping) for(Map.Entry<K, Double> e : newWeights.entrySet()) { K column = e.getKey(); double wi_k_intermediate = e.getValue(); //the weight wi_k+1/2 as seen on the paper if(wi_k_intermediate > 0.0) { newWeights.put(column, Math.max(0.0, wi_k_intermediate - l1*wi_k_intermediate)); } else if(wi_k_intermediate < 0.0) { newWeights.put(column, Math.min(0.0, wi_k_intermediate + l1*wi_k_intermediate)); } } } }
java
public static <K> void updateWeights(double l1, double learningRate, Map<K, Double> weights, Map<K, Double> newWeights) { if(l1 > 0.0) { /* //SGD-L1 (Naive) for(Map.Entry<K, Double> e : weights.entrySet()) { K column = e.getKey(); newWeights.put(column, newWeights.get(column) + l1*Math.signum(e.getValue())*(-learningRate)); } */ //SGDL1 (Clipping) for(Map.Entry<K, Double> e : newWeights.entrySet()) { K column = e.getKey(); double wi_k_intermediate = e.getValue(); //the weight wi_k+1/2 as seen on the paper if(wi_k_intermediate > 0.0) { newWeights.put(column, Math.max(0.0, wi_k_intermediate - l1*wi_k_intermediate)); } else if(wi_k_intermediate < 0.0) { newWeights.put(column, Math.min(0.0, wi_k_intermediate + l1*wi_k_intermediate)); } } } }
[ "public", "static", "<", "K", ">", "void", "updateWeights", "(", "double", "l1", ",", "double", "learningRate", ",", "Map", "<", "K", ",", "Double", ">", "weights", ",", "Map", "<", "K", ",", "Double", ">", "newWeights", ")", "{", "if", "(", "l1", ...
Updates the weights by applying the L1 regularization. @param l1 @param learningRate @param weights @param newWeights @param <K>
[ "Updates", "the", "weights", "by", "applying", "the", "L1", "regularization", "." ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/mathematics/regularization/L1Regularizer.java#L39-L61
w3c/epubcheck
src/main/java/com/adobe/epubcheck/vocab/VocabUtil.java
VocabUtil.parsePropertyList
public static Set<Property> parsePropertyList(String value, Map<String, ? extends Vocab> vocabs, ValidationContext context, EPUBLocation location) { return parseProperties(value, vocabs, true, context, location); }
java
public static Set<Property> parsePropertyList(String value, Map<String, ? extends Vocab> vocabs, ValidationContext context, EPUBLocation location) { return parseProperties(value, vocabs, true, context, location); }
[ "public", "static", "Set", "<", "Property", ">", "parsePropertyList", "(", "String", "value", ",", "Map", "<", "String", ",", "?", "extends", "Vocab", ">", "vocabs", ",", "ValidationContext", "context", ",", "EPUBLocation", "location", ")", "{", "return", "p...
Parses a space-separated list of property values, and report validation errors on the fly. @param value the value to parse. @param vocabs a map of prefix to vocabularies. @param context the validation context (report, locale, path, etc). @param location the location in the validated file. @return
[ "Parses", "a", "space", "-", "separated", "list", "of", "property", "values", "and", "report", "validation", "errors", "on", "the", "fly", "." ]
train
https://github.com/w3c/epubcheck/blob/4d5a24d9f2878a2a5497eb11c036cc18fe2c0a78/src/main/java/com/adobe/epubcheck/vocab/VocabUtil.java#L76-L80
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/managementgraph/ManagementGraphIterator.java
ManagementGraphIterator.currentGateLeadsToOtherStage
private boolean currentGateLeadsToOtherStage(final TraversalEntry te, final boolean forward) { final ManagementGroupVertex groupVertex = te.getManagementVertex().getGroupVertex(); if (forward) { if (te.getCurrentGate() >= groupVertex.getNumberOfForwardEdges()) { return false; } final ManagementGroupEdge edge = groupVertex.getForwardEdge(te.getCurrentGate()); if (edge.getTarget().getStageNumber() == groupVertex.getStageNumber()) { return false; } } else { if (te.getCurrentGate() >= groupVertex.getNumberOfBackwardEdges()) { return false; } final ManagementGroupEdge edge = groupVertex.getBackwardEdge(te.getCurrentGate()); if (edge.getSource().getStageNumber() == groupVertex.getStageNumber()) { return false; } } return true; }
java
private boolean currentGateLeadsToOtherStage(final TraversalEntry te, final boolean forward) { final ManagementGroupVertex groupVertex = te.getManagementVertex().getGroupVertex(); if (forward) { if (te.getCurrentGate() >= groupVertex.getNumberOfForwardEdges()) { return false; } final ManagementGroupEdge edge = groupVertex.getForwardEdge(te.getCurrentGate()); if (edge.getTarget().getStageNumber() == groupVertex.getStageNumber()) { return false; } } else { if (te.getCurrentGate() >= groupVertex.getNumberOfBackwardEdges()) { return false; } final ManagementGroupEdge edge = groupVertex.getBackwardEdge(te.getCurrentGate()); if (edge.getSource().getStageNumber() == groupVertex.getStageNumber()) { return false; } } return true; }
[ "private", "boolean", "currentGateLeadsToOtherStage", "(", "final", "TraversalEntry", "te", ",", "final", "boolean", "forward", ")", "{", "final", "ManagementGroupVertex", "groupVertex", "=", "te", ".", "getManagementVertex", "(", ")", ".", "getGroupVertex", "(", ")...
Checks if the current gate leads to another stage or not. @param te the current traversal entry @param forward <code>true</code> if the graph should be traversed in correct order, <code>false</code> to traverse it in reverse order @return <code>true</code> if current gate leads to another stage, otherwise <code>false</code>
[ "Checks", "if", "the", "current", "gate", "leads", "to", "another", "stage", "or", "not", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/managementgraph/ManagementGraphIterator.java#L414-L442
FitLayout/classify
src/main/java/org/fit/layout/classify/articles/ArticleFeatureExtractor.java
ArticleFeatureExtractor.lrAligned
private int lrAligned(Area a1, Area a2) { if (a1.getX1() == a2.getX1()) return (a1.getX2() == a2.getX2()) ? 2 : 1; else if (a1.getX2() == a2.getX2()) return 1; else return 0; }
java
private int lrAligned(Area a1, Area a2) { if (a1.getX1() == a2.getX1()) return (a1.getX2() == a2.getX2()) ? 2 : 1; else if (a1.getX2() == a2.getX2()) return 1; else return 0; }
[ "private", "int", "lrAligned", "(", "Area", "a1", ",", "Area", "a2", ")", "{", "if", "(", "a1", ".", "getX1", "(", ")", "==", "a2", ".", "getX1", "(", ")", ")", "return", "(", "a1", ".", "getX2", "(", ")", "==", "a2", ".", "getX2", "(", ")", ...
Checks if the areas are left- or right-aligned. @return 0 if not, 1 if yes, 2 if both left and right
[ "Checks", "if", "the", "areas", "are", "left", "-", "or", "right", "-", "aligned", "." ]
train
https://github.com/FitLayout/classify/blob/0b43ceb2f0be4e6d26263491893884d811f0d605/src/main/java/org/fit/layout/classify/articles/ArticleFeatureExtractor.java#L307-L315
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.collectAll
@Deprecated public static Collection collectAll(Collection self, Collection collector, Closure transform) { return collectNested((Iterable)self, collector, transform); }
java
@Deprecated public static Collection collectAll(Collection self, Collection collector, Closure transform) { return collectNested((Iterable)self, collector, transform); }
[ "@", "Deprecated", "public", "static", "Collection", "collectAll", "(", "Collection", "self", ",", "Collection", "collector", ",", "Closure", "transform", ")", "{", "return", "collectNested", "(", "(", "Iterable", ")", "self", ",", "collector", ",", "transform",...
Deprecated alias for collectNested @deprecated Use collectNested instead @see #collectNested(Iterable, Collection, Closure)
[ "Deprecated", "alias", "for", "collectNested" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L3713-L3716
jboss/jboss-jsf-api_spec
src/main/java/javax/faces/application/ResourceHandlerWrapper.java
ResourceHandlerWrapper.createViewResource
@Override public ViewResource createViewResource(FacesContext context, String resourceName) { return getWrapped().createViewResource(context, resourceName); }
java
@Override public ViewResource createViewResource(FacesContext context, String resourceName) { return getWrapped().createViewResource(context, resourceName); }
[ "@", "Override", "public", "ViewResource", "createViewResource", "(", "FacesContext", "context", ",", "String", "resourceName", ")", "{", "return", "getWrapped", "(", ")", ".", "createViewResource", "(", "context", ",", "resourceName", ")", ";", "}" ]
<p class="changed_added_2_2">The default behavior of this method is to call {@link ResourceHandler#createViewResource} on the wrapped {@link ResourceHandler} object.</p>
[ "<p", "class", "=", "changed_added_2_2", ">", "The", "default", "behavior", "of", "this", "method", "is", "to", "call", "{" ]
train
https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/application/ResourceHandlerWrapper.java#L122-L125