repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
aspectran/aspectran
core/src/main/java/com/aspectran/core/support/i18n/message/MessageSourceSupport.java
MessageSourceSupport.createMessageFormat
protected MessageFormat createMessageFormat(String msg, Locale locale) { return new MessageFormat((msg != null ? msg : ""), locale); }
java
protected MessageFormat createMessageFormat(String msg, Locale locale) { return new MessageFormat((msg != null ? msg : ""), locale); }
[ "protected", "MessageFormat", "createMessageFormat", "(", "String", "msg", ",", "Locale", "locale", ")", "{", "return", "new", "MessageFormat", "(", "(", "msg", "!=", "null", "?", "msg", ":", "\"\"", ")", ",", "locale", ")", ";", "}" ]
Create a MessageFormat for the given message and Locale. @param msg the message to create a MessageFormat for @param locale the Locale to create a MessageFormat for @return the MessageFormat instance
[ "Create", "a", "MessageFormat", "for", "the", "given", "message", "and", "Locale", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/support/i18n/message/MessageSourceSupport.java#L155-L157
aws/aws-sdk-java
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/transfer/TransferManager.java
TransferManager.uploadFileList
public MultipleFileUpload uploadFileList(String bucketName, String virtualDirectoryKeyPrefix, File directory, List<File> files,ObjectMetadataProvider metadataProvider) { return uploadFileList(bucketName, virtualDirectoryKeyPrefix, directory, files, metadataProvider,null); }
java
public MultipleFileUpload uploadFileList(String bucketName, String virtualDirectoryKeyPrefix, File directory, List<File> files,ObjectMetadataProvider metadataProvider) { return uploadFileList(bucketName, virtualDirectoryKeyPrefix, directory, files, metadataProvider,null); }
[ "public", "MultipleFileUpload", "uploadFileList", "(", "String", "bucketName", ",", "String", "virtualDirectoryKeyPrefix", ",", "File", "directory", ",", "List", "<", "File", ">", "files", ",", "ObjectMetadataProvider", "metadataProvider", ")", "{", "return", "uploadF...
Uploads all specified files to the bucket named, constructing relative keys depending on the commonParentDirectory given. <p> S3 will overwrite any existing objects that happen to have the same key, just as when uploading individual files, so use with caution. </p> <p> If you are uploading <a href="http://aws.amazon.com/kms/">AWS KMS</a>-encrypted objects, you need to specify the correct region of the bucket on your client and configure AWS Signature Version 4 for added security. For more information on how to do this, see http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html# specify-signature-version </p> @param bucketName The name of the bucket to upload objects to. @param virtualDirectoryKeyPrefix The key prefix of the virtual directory to upload to. Use the null or empty string to upload files to the root of the bucket. @param directory The common parent directory of files to upload. The keys of the files in the list of files are constructed relative to this directory and the virtualDirectoryKeyPrefix. @param files A list of files to upload. The keys of the files are calculated relative to the common parent directory and the virtualDirectoryKeyPrefix. @param metadataProvider A callback of type <code>ObjectMetadataProvider</code> which is used to provide metadata for each file being uploaded.
[ "Uploads", "all", "specified", "files", "to", "the", "bucket", "named", "constructing", "relative", "keys", "depending", "on", "the", "commonParentDirectory", "given", ".", "<p", ">", "S3", "will", "overwrite", "any", "existing", "objects", "that", "happen", "to...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/transfer/TransferManager.java#L1677-L1679
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderSelector.java
LeaderSelector.getLeader
public Participant getLeader() throws Exception { Collection<String> participantNodes = mutex.getParticipantNodes(); return getLeader(client, participantNodes); }
java
public Participant getLeader() throws Exception { Collection<String> participantNodes = mutex.getParticipantNodes(); return getLeader(client, participantNodes); }
[ "public", "Participant", "getLeader", "(", ")", "throws", "Exception", "{", "Collection", "<", "String", ">", "participantNodes", "=", "mutex", ".", "getParticipantNodes", "(", ")", ";", "return", "getLeader", "(", "client", ",", "participantNodes", ")", ";", ...
<p> Return the id for the current leader. If for some reason there is no current leader, a dummy participant is returned. </p> <p> <p> <B>NOTE</B> - this method polls the ZK server. Therefore it can possibly return a value that does not match {@link #hasLeadership()} as hasLeadership uses a local field of the class. </p> @return leader @throws Exception ZK errors, interruptions, etc.
[ "<p", ">", "Return", "the", "id", "for", "the", "current", "leader", ".", "If", "for", "some", "reason", "there", "is", "no", "current", "leader", "a", "dummy", "participant", "is", "returned", ".", "<", "/", "p", ">", "<p", ">", "<p", ">", "<B", "...
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderSelector.java#L334-L338
jronrun/benayn
benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java
Uris.getRawQuery
public static String getRawQuery(final URI uri, final boolean strict) { return esc(strict).escapeQuery(Strings.emptyToNull(uri.getRawQuery())); }
java
public static String getRawQuery(final URI uri, final boolean strict) { return esc(strict).escapeQuery(Strings.emptyToNull(uri.getRawQuery())); }
[ "public", "static", "String", "getRawQuery", "(", "final", "URI", "uri", ",", "final", "boolean", "strict", ")", "{", "return", "esc", "(", "strict", ")", ".", "escapeQuery", "(", "Strings", ".", "emptyToNull", "(", "uri", ".", "getRawQuery", "(", ")", "...
Returns the raw (and normalized) query of the given URI, or null if it is empty. @param uri the URI to extract query from @param strict whether or not to do strict escaping @return the query or null if it is undefined
[ "Returns", "the", "raw", "(", "and", "normalized", ")", "query", "of", "the", "given", "URI", "or", "null", "if", "it", "is", "empty", "." ]
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java#L242-L244
intuit/QuickBooks-V3-Java-SDK
ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/HTTPURLConnectionInterceptor.java
HTTPURLConnectionInterceptor.populateRequestHeaders
private void populateRequestHeaders(HttpURLConnection httpUrlConnection, Map<String, String> requestHeaders) { Set<String> keySet = requestHeaders.keySet(); Iterator<String> keySetIterator = keySet.iterator(); while (keySetIterator.hasNext()) { String key = keySetIterator.next(); String value = requestHeaders.get(key); httpUrlConnection.setRequestProperty(key, value); } PropertyHelper propertyHelper = PropertyHelper.getInstance(); String requestSource = propertyHelper.getRequestSource() + propertyHelper.getVersion(); if(propertyHelper.getRequestSourceHeader() != null){ httpUrlConnection.setRequestProperty(propertyHelper.getRequestSourceHeader(), requestSource); } }
java
private void populateRequestHeaders(HttpURLConnection httpUrlConnection, Map<String, String> requestHeaders) { Set<String> keySet = requestHeaders.keySet(); Iterator<String> keySetIterator = keySet.iterator(); while (keySetIterator.hasNext()) { String key = keySetIterator.next(); String value = requestHeaders.get(key); httpUrlConnection.setRequestProperty(key, value); } PropertyHelper propertyHelper = PropertyHelper.getInstance(); String requestSource = propertyHelper.getRequestSource() + propertyHelper.getVersion(); if(propertyHelper.getRequestSourceHeader() != null){ httpUrlConnection.setRequestProperty(propertyHelper.getRequestSourceHeader(), requestSource); } }
[ "private", "void", "populateRequestHeaders", "(", "HttpURLConnection", "httpUrlConnection", ",", "Map", "<", "String", ",", "String", ">", "requestHeaders", ")", "{", "Set", "<", "String", ">", "keySet", "=", "requestHeaders", ".", "keySet", "(", ")", ";", "It...
Method to populate the HTTP request headers by reading it from the requestHeaders Map
[ "Method", "to", "populate", "the", "HTTP", "request", "headers", "by", "reading", "it", "from", "the", "requestHeaders", "Map" ]
train
https://github.com/intuit/QuickBooks-V3-Java-SDK/blob/59f988d0776d46620d0b34711c411b2b5b1da06b/ipp-v3-java-devkit/src/main/java/com/intuit/ipp/interceptors/HTTPURLConnectionInterceptor.java#L132-L149
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.newInstance
@SuppressWarnings("unchecked") public static <T> T newInstance(Class<T> c, Object[] args) { if (args == null) args = new Object[]{null}; return (T) InvokerHelper.invokeConstructorOf(c, args); }
java
@SuppressWarnings("unchecked") public static <T> T newInstance(Class<T> c, Object[] args) { if (args == null) args = new Object[]{null}; return (T) InvokerHelper.invokeConstructorOf(c, args); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "newInstance", "(", "Class", "<", "T", ">", "c", ",", "Object", "[", "]", "args", ")", "{", "if", "(", "args", "==", "null", ")", "args", "=", "new", "Objec...
Helper to construct a new instance from the given arguments. The constructor is called based on the number and types in the args array. Use <code>newInstance(null)</code> or simply <code>newInstance()</code> for the default (no-arg) constructor. @param c a class @param args the constructor arguments @return a new instance of this class. @since 1.0
[ "Helper", "to", "construct", "a", "new", "instance", "from", "the", "given", "arguments", ".", "The", "constructor", "is", "called", "based", "on", "the", "number", "and", "types", "in", "the", "args", "array", ".", "Use", "<code", ">", "newInstance", "(",...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L17212-L17216
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfContentByte.java
PdfContentByte.addOutline
public void addOutline(PdfOutline outline, String name) { checkWriter(); pdf.addOutline(outline, name); }
java
public void addOutline(PdfOutline outline, String name) { checkWriter(); pdf.addOutline(outline, name); }
[ "public", "void", "addOutline", "(", "PdfOutline", "outline", ",", "String", "name", ")", "{", "checkWriter", "(", ")", ";", "pdf", ".", "addOutline", "(", "outline", ",", "name", ")", ";", "}" ]
Adds a named outline to the document. @param outline the outline @param name the name for the local destination
[ "Adds", "a", "named", "outline", "to", "the", "document", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfContentByte.java#L1652-L1655
WASdev/ci.maven
liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/MavenProjectUtil.java
MavenProjectUtil.getPluginGoalExecution
public static PluginExecution getPluginGoalExecution(Plugin plugin, String goal) throws PluginScenarioException { List<PluginExecution> executions = plugin.getExecutions(); for(Iterator<PluginExecution> iterator = executions.iterator(); iterator.hasNext();) { PluginExecution execution = (PluginExecution) iterator.next(); if(execution.getGoals().contains(goal)) { return execution; } } throw new PluginScenarioException("Could not find goal " + goal + " on plugin " + plugin.getKey()); }
java
public static PluginExecution getPluginGoalExecution(Plugin plugin, String goal) throws PluginScenarioException { List<PluginExecution> executions = plugin.getExecutions(); for(Iterator<PluginExecution> iterator = executions.iterator(); iterator.hasNext();) { PluginExecution execution = (PluginExecution) iterator.next(); if(execution.getGoals().contains(goal)) { return execution; } } throw new PluginScenarioException("Could not find goal " + goal + " on plugin " + plugin.getKey()); }
[ "public", "static", "PluginExecution", "getPluginGoalExecution", "(", "Plugin", "plugin", ",", "String", "goal", ")", "throws", "PluginScenarioException", "{", "List", "<", "PluginExecution", ">", "executions", "=", "plugin", ".", "getExecutions", "(", ")", ";", "...
Get an execution of a plugin @param plugin @param goal @return the execution object @throws PluginScenarioException
[ "Get", "an", "execution", "of", "a", "plugin" ]
train
https://github.com/WASdev/ci.maven/blob/4fcf2d314299a4c02e2c740e4fc99a4f6aba6918/liberty-maven-plugin/src/main/java/net/wasdev/wlp/maven/plugins/utils/MavenProjectUtil.java#L80-L90
jayantk/jklol
src/com/jayantkrish/jklol/util/IoUtils.java
IoUtils.serializeObjectToFile
public static void serializeObjectToFile(Object object, String filename) { FileOutputStream fos = null; ObjectOutputStream out = null; try { fos = new FileOutputStream(filename); out = new ObjectOutputStream(fos); out.writeObject(object); out.close(); } catch(IOException ex) { ex.printStackTrace(); System.exit(1); } }
java
public static void serializeObjectToFile(Object object, String filename) { FileOutputStream fos = null; ObjectOutputStream out = null; try { fos = new FileOutputStream(filename); out = new ObjectOutputStream(fos); out.writeObject(object); out.close(); } catch(IOException ex) { ex.printStackTrace(); System.exit(1); } }
[ "public", "static", "void", "serializeObjectToFile", "(", "Object", "object", ",", "String", "filename", ")", "{", "FileOutputStream", "fos", "=", "null", ";", "ObjectOutputStream", "out", "=", "null", ";", "try", "{", "fos", "=", "new", "FileOutputStream", "(...
Serializes {@code object} into {@code filename}. @param filename @param object
[ "Serializes", "{", "@code", "object", "}", "into", "{", "@code", "filename", "}", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/util/IoUtils.java#L144-L156
leancloud/java-sdk-all
realtime/src/main/java/cn/leancloud/im/v2/AVIMConversation.java
AVIMConversation.queryMessagesByType
public void queryMessagesByType(int msgType, int limit, final AVIMMessagesQueryCallback callback) { queryMessagesByType(msgType, null, 0, limit, callback); }
java
public void queryMessagesByType(int msgType, int limit, final AVIMMessagesQueryCallback callback) { queryMessagesByType(msgType, null, 0, limit, callback); }
[ "public", "void", "queryMessagesByType", "(", "int", "msgType", ",", "int", "limit", ",", "final", "AVIMMessagesQueryCallback", "callback", ")", "{", "queryMessagesByType", "(", "msgType", ",", "null", ",", "0", ",", "limit", ",", "callback", ")", ";", "}" ]
获取特停类型的历史消息。 注意:这个操作总是会从云端获取记录。 另,该函数和 queryMessagesByType(type, msgId, timestamp, limit, callback) 配合使用可以实现翻页效果。 @param msgType 消息类型,可以参看 `AVIMMessageType` 里的定义。 @param limit 本批次希望获取的消息数量。 @param callback 结果回调函数
[ "获取特停类型的历史消息。", "注意:这个操作总是会从云端获取记录。", "另,该函数和", "queryMessagesByType", "(", "type", "msgId", "timestamp", "limit", "callback", ")", "配合使用可以实现翻页效果。" ]
train
https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/realtime/src/main/java/cn/leancloud/im/v2/AVIMConversation.java#L787-L789
atomix/atomix
protocols/primary-backup/src/main/java/io/atomix/protocols/backup/service/impl/PrimaryBackupServiceContext.java
PrimaryBackupServiceContext.getOrCreateSession
public PrimaryBackupSession getOrCreateSession(long sessionId, MemberId memberId) { PrimaryBackupSession session = sessions.get(sessionId); if (session == null) { session = createSession(sessionId, memberId); } return session; }
java
public PrimaryBackupSession getOrCreateSession(long sessionId, MemberId memberId) { PrimaryBackupSession session = sessions.get(sessionId); if (session == null) { session = createSession(sessionId, memberId); } return session; }
[ "public", "PrimaryBackupSession", "getOrCreateSession", "(", "long", "sessionId", ",", "MemberId", "memberId", ")", "{", "PrimaryBackupSession", "session", "=", "sessions", ".", "get", "(", "sessionId", ")", ";", "if", "(", "session", "==", "null", ")", "{", "...
Gets or creates a service session. @param sessionId the session to create @param memberId the owning node ID @return the service session
[ "Gets", "or", "creates", "a", "service", "session", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/protocols/primary-backup/src/main/java/io/atomix/protocols/backup/service/impl/PrimaryBackupServiceContext.java#L534-L540
DV8FromTheWorld/JDA
src/main/java/net/dv8tion/jda/core/utils/PermissionUtil.java
PermissionUtil.getExplicitPermission
public static long getExplicitPermission(Channel channel, Member member) { Checks.notNull(channel, "Channel"); Checks.notNull(member, "Member"); final Guild guild = member.getGuild(); checkGuild(channel.getGuild(), guild, "Member"); long permission = getExplicitPermission(member); AtomicLong allow = new AtomicLong(0); AtomicLong deny = new AtomicLong(0); // populates allow/deny getExplicitOverrides(channel, member, allow, deny); return apply(permission, allow.get(), deny.get()); }
java
public static long getExplicitPermission(Channel channel, Member member) { Checks.notNull(channel, "Channel"); Checks.notNull(member, "Member"); final Guild guild = member.getGuild(); checkGuild(channel.getGuild(), guild, "Member"); long permission = getExplicitPermission(member); AtomicLong allow = new AtomicLong(0); AtomicLong deny = new AtomicLong(0); // populates allow/deny getExplicitOverrides(channel, member, allow, deny); return apply(permission, allow.get(), deny.get()); }
[ "public", "static", "long", "getExplicitPermission", "(", "Channel", "channel", ",", "Member", "member", ")", "{", "Checks", ".", "notNull", "(", "channel", ",", "\"Channel\"", ")", ";", "Checks", ".", "notNull", "(", "member", ",", "\"Member\"", ")", ";", ...
Retrieves the explicit permissions of the specified {@link net.dv8tion.jda.core.entities.Member Member} in its hosting {@link net.dv8tion.jda.core.entities.Guild Guild} and specific {@link net.dv8tion.jda.core.entities.Channel Channel}. <br>This method does not calculate the owner in. <b>Allowed permissions override denied permissions of {@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverrides}!</b> <p>All permissions returned are explicitly granted to this Member via its {@link net.dv8tion.jda.core.entities.Role Roles}. <br>Permissions like {@link net.dv8tion.jda.core.Permission#ADMINISTRATOR Permission.ADMINISTRATOR} do not grant other permissions in this value. <p>This factor in all {@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverrides} that affect this member and only grants the ones that are explicitly given. @param channel The target channel of which to check {@link net.dv8tion.jda.core.entities.PermissionOverride PermissionOverrides} @param member The non-null {@link net.dv8tion.jda.core.entities.Member Member} for which to get implicit permissions @throws IllegalArgumentException If any of the arguments is {@code null} or the specified entities are not from the same {@link net.dv8tion.jda.core.entities.Guild Guild} @return Primitive (unsigned) long value with the implicit permissions of the specified member in the specified channel @since 3.1
[ "Retrieves", "the", "explicit", "permissions", "of", "the", "specified", "{", "@link", "net", ".", "dv8tion", ".", "jda", ".", "core", ".", "entities", ".", "Member", "Member", "}", "in", "its", "hosting", "{", "@link", "net", ".", "dv8tion", ".", "jda",...
train
https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/utils/PermissionUtil.java#L510-L527
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/Having.java
Having.orderBy
@NonNull @Override public OrderBy orderBy(@NonNull Ordering... orderings) { if (orderings == null) { throw new IllegalArgumentException("orderings is null."); } return new OrderBy(this, Arrays.asList(orderings)); }
java
@NonNull @Override public OrderBy orderBy(@NonNull Ordering... orderings) { if (orderings == null) { throw new IllegalArgumentException("orderings is null."); } return new OrderBy(this, Arrays.asList(orderings)); }
[ "@", "NonNull", "@", "Override", "public", "OrderBy", "orderBy", "(", "@", "NonNull", "Ordering", "...", "orderings", ")", "{", "if", "(", "orderings", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"orderings is null.\"", ")", ";",...
Create and chain an ORDER BY component for specifying the orderings of the query result. @param orderings an array of the ORDER BY expressions. @return the ORDER BY component.
[ "Create", "and", "chain", "an", "ORDER", "BY", "component", "for", "specifying", "the", "orderings", "of", "the", "query", "result", "." ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/Having.java#L54-L61
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Image.java
Image.getSubImage
public Image getSubImage(int x,int y,int width,int height) { init(); float newTextureOffsetX = ((x / (float) this.width) * textureWidth) + textureOffsetX; float newTextureOffsetY = ((y / (float) this.height) * textureHeight) + textureOffsetY; float newTextureWidth = ((width / (float) this.width) * textureWidth); float newTextureHeight = ((height / (float) this.height) * textureHeight); Image sub = new Image(); sub.inited = true; sub.texture = this.texture; sub.textureOffsetX = newTextureOffsetX; sub.textureOffsetY = newTextureOffsetY; sub.textureWidth = newTextureWidth; sub.textureHeight = newTextureHeight; sub.width = width; sub.height = height; sub.ref = ref; sub.centerX = width / 2; sub.centerY = height / 2; return sub; }
java
public Image getSubImage(int x,int y,int width,int height) { init(); float newTextureOffsetX = ((x / (float) this.width) * textureWidth) + textureOffsetX; float newTextureOffsetY = ((y / (float) this.height) * textureHeight) + textureOffsetY; float newTextureWidth = ((width / (float) this.width) * textureWidth); float newTextureHeight = ((height / (float) this.height) * textureHeight); Image sub = new Image(); sub.inited = true; sub.texture = this.texture; sub.textureOffsetX = newTextureOffsetX; sub.textureOffsetY = newTextureOffsetY; sub.textureWidth = newTextureWidth; sub.textureHeight = newTextureHeight; sub.width = width; sub.height = height; sub.ref = ref; sub.centerX = width / 2; sub.centerY = height / 2; return sub; }
[ "public", "Image", "getSubImage", "(", "int", "x", ",", "int", "y", ",", "int", "width", ",", "int", "height", ")", "{", "init", "(", ")", ";", "float", "newTextureOffsetX", "=", "(", "(", "x", "/", "(", "float", ")", "this", ".", "width", ")", "...
Get a sub-part of this image. Note that the create image retains a reference to the image data so should anything change it will affect sub-images too. @param x The x coordinate of the sub-image @param y The y coordinate of the sub-image @param width The width of the sub-image @param height The height of the sub-image @return The image represent the sub-part of this image
[ "Get", "a", "sub", "-", "part", "of", "this", "image", ".", "Note", "that", "the", "create", "image", "retains", "a", "reference", "to", "the", "image", "data", "so", "should", "anything", "change", "it", "will", "affect", "sub", "-", "images", "too", ...
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Image.java#L958-L981
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/AbstractCodeGen.java
AbstractCodeGen.writeLogging
protected void writeLogging(Definition def, Writer out, int indent, String level, String content, String... params) throws IOException { writeIndent(out, indent); if (def.isSupportJbossLogging()) { out.write("log.trace"); int size = params.length; if (size > 0) out.write("f"); out.write("(\"" + content + "("); for (int i = 0; i < size; i++) { out.write("%s"); if (i < size - 1) out.write(", "); } out.write(")\""); for (int i = 0; i < size; i++) { out.write(", "); out.write(params[i]); } out.write(");"); } else { out.write("log.finest(\"" + content + "()\");"); } writeEol(out); }
java
protected void writeLogging(Definition def, Writer out, int indent, String level, String content, String... params) throws IOException { writeIndent(out, indent); if (def.isSupportJbossLogging()) { out.write("log.trace"); int size = params.length; if (size > 0) out.write("f"); out.write("(\"" + content + "("); for (int i = 0; i < size; i++) { out.write("%s"); if (i < size - 1) out.write(", "); } out.write(")\""); for (int i = 0; i < size; i++) { out.write(", "); out.write(params[i]); } out.write(");"); } else { out.write("log.finest(\"" + content + "()\");"); } writeEol(out); }
[ "protected", "void", "writeLogging", "(", "Definition", "def", ",", "Writer", "out", ",", "int", "indent", ",", "String", "level", ",", "String", "content", ",", "String", "...", "params", ")", "throws", "IOException", "{", "writeIndent", "(", "out", ",", ...
output logging @param def definition @param out Writer @param indent indent @param level logging level @param content logging content @param params logging params @throws IOException ioException
[ "output", "logging" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/AbstractCodeGen.java#L360-L390
groupon/robo-remote
RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java
Solo2.enterTextAndWait
public void enterTextAndWait(int fieldResource, String value) { EditText textBox = (EditText) this.getView(fieldResource); this.enterText(textBox, value); this.waitForText(value); }
java
public void enterTextAndWait(int fieldResource, String value) { EditText textBox = (EditText) this.getView(fieldResource); this.enterText(textBox, value); this.waitForText(value); }
[ "public", "void", "enterTextAndWait", "(", "int", "fieldResource", ",", "String", "value", ")", "{", "EditText", "textBox", "=", "(", "EditText", ")", "this", ".", "getView", "(", "fieldResource", ")", ";", "this", ".", "enterText", "(", "textBox", ",", "v...
Enter text into a given field resource id @param fieldResource - Resource id of a field (R.id.*) @param value - value to enter into the given field
[ "Enter", "text", "into", "a", "given", "field", "resource", "id" ]
train
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteServer/apklib/src/main/com/groupon/roboremote/roboremoteserver/robotium/Solo2.java#L274-L279
spring-projects/spring-security-oauth
spring-security-oauth/src/main/java/org/springframework/security/oauth/consumer/filter/OAuthConsumerProcessingFilter.java
OAuthConsumerProcessingFilter.getAccessTokenDependencies
protected Set<String> getAccessTokenDependencies(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) { Set<String> deps = new TreeSet<String>(); if (getObjectDefinitionSource() != null) { FilterInvocation invocation = new FilterInvocation(request, response, filterChain); Collection<ConfigAttribute> attributes = getObjectDefinitionSource().getAttributes(invocation); if (attributes != null) { for (ConfigAttribute attribute : attributes) { deps.add(attribute.getAttribute()); } } } return deps; }
java
protected Set<String> getAccessTokenDependencies(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) { Set<String> deps = new TreeSet<String>(); if (getObjectDefinitionSource() != null) { FilterInvocation invocation = new FilterInvocation(request, response, filterChain); Collection<ConfigAttribute> attributes = getObjectDefinitionSource().getAttributes(invocation); if (attributes != null) { for (ConfigAttribute attribute : attributes) { deps.add(attribute.getAttribute()); } } } return deps; }
[ "protected", "Set", "<", "String", ">", "getAccessTokenDependencies", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ",", "FilterChain", "filterChain", ")", "{", "Set", "<", "String", ">", "deps", "=", "new", "TreeSet", "<", "String"...
Loads the access token dependencies for the given request. This will be a set of {@link ProtectedResourceDetails#getId() resource ids} for which an OAuth access token is required. @param request The request. @param response The response @param filterChain The filter chain @return The access token dependencies (could be empty).
[ "Loads", "the", "access", "token", "dependencies", "for", "the", "given", "request", ".", "This", "will", "be", "a", "set", "of", "{", "@link", "ProtectedResourceDetails#getId", "()", "resource", "ids", "}", "for", "which", "an", "OAuth", "access", "token", ...
train
https://github.com/spring-projects/spring-security-oauth/blob/bbae0027eceb2c74a21ac26bbc86142dc732ffbe/spring-security-oauth/src/main/java/org/springframework/security/oauth/consumer/filter/OAuthConsumerProcessingFilter.java#L123-L136
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Location.java
Location.prefix
public Location prefix( Location other ) { if( isSameStrand( other ) ) { if( other.mStart >= mStart ) { return new Location( mStart, (other.mStart < mEnd)? other.mStart: mEnd ); } else { //other is out of bounds -- no prefix throw new IndexOutOfBoundsException( "Specified location not within this location." ); } } else { throw new IllegalArgumentException( "Locations are on opposite strands." ); } }
java
public Location prefix( Location other ) { if( isSameStrand( other ) ) { if( other.mStart >= mStart ) { return new Location( mStart, (other.mStart < mEnd)? other.mStart: mEnd ); } else { //other is out of bounds -- no prefix throw new IndexOutOfBoundsException( "Specified location not within this location." ); } } else { throw new IllegalArgumentException( "Locations are on opposite strands." ); } }
[ "public", "Location", "prefix", "(", "Location", "other", ")", "{", "if", "(", "isSameStrand", "(", "other", ")", ")", "{", "if", "(", "other", ".", "mStart", ">=", "mStart", ")", "{", "return", "new", "Location", "(", "mStart", ",", "(", "other", "....
The part of this location before the other location (not inclusive). @param other The other location. @return The part of this location before the other location. @throws IllegalArgumentException Locations are on opposite strands. @throws IndexOutOfBoundsException This location does not contain other location.
[ "The", "part", "of", "this", "location", "before", "the", "other", "location", "(", "not", "inclusive", ")", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Location.java#L499-L518
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java
ArrayFunctions.arrayConcat
public static Expression arrayConcat(Expression expression1, Expression expression2) { return x("ARRAY_CONCAT(" + expression1.toString() + ", " + expression2.toString() + ")"); }
java
public static Expression arrayConcat(Expression expression1, Expression expression2) { return x("ARRAY_CONCAT(" + expression1.toString() + ", " + expression2.toString() + ")"); }
[ "public", "static", "Expression", "arrayConcat", "(", "Expression", "expression1", ",", "Expression", "expression2", ")", "{", "return", "x", "(", "\"ARRAY_CONCAT(\"", "+", "expression1", ".", "toString", "(", ")", "+", "\", \"", "+", "expression2", ".", "toStri...
Returned expression results in new array with the concatenation of the input arrays.
[ "Returned", "expression", "results", "in", "new", "array", "with", "the", "concatenation", "of", "the", "input", "arrays", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java#L90-L92
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/BreakIterator.java
BreakIterator.getBreakInstance
@Deprecated public static BreakIterator getBreakInstance(ULocale where, int kind) { if (where == null) { throw new NullPointerException("Specified locale is null"); } if (iterCache[kind] != null) { BreakIteratorCache cache = (BreakIteratorCache)iterCache[kind].get(); if (cache != null) { if (cache.getLocale().equals(where)) { return cache.createBreakInstance(); } } } // sigh, all to avoid linking in ICULocaleData... BreakIterator result = getShim().createBreakIterator(where, kind); BreakIteratorCache cache = new BreakIteratorCache(where, result); iterCache[kind] = CacheValue.getInstance(cache); if (result instanceof RuleBasedBreakIterator) { RuleBasedBreakIterator rbbi = (RuleBasedBreakIterator)result; rbbi.setBreakType(kind); } return result; }
java
@Deprecated public static BreakIterator getBreakInstance(ULocale where, int kind) { if (where == null) { throw new NullPointerException("Specified locale is null"); } if (iterCache[kind] != null) { BreakIteratorCache cache = (BreakIteratorCache)iterCache[kind].get(); if (cache != null) { if (cache.getLocale().equals(where)) { return cache.createBreakInstance(); } } } // sigh, all to avoid linking in ICULocaleData... BreakIterator result = getShim().createBreakIterator(where, kind); BreakIteratorCache cache = new BreakIteratorCache(where, result); iterCache[kind] = CacheValue.getInstance(cache); if (result instanceof RuleBasedBreakIterator) { RuleBasedBreakIterator rbbi = (RuleBasedBreakIterator)result; rbbi.setBreakType(kind); } return result; }
[ "@", "Deprecated", "public", "static", "BreakIterator", "getBreakInstance", "(", "ULocale", "where", ",", "int", "kind", ")", "{", "if", "(", "where", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"Specified locale is null\"", ")", ";", ...
Returns a particular kind of BreakIterator for a locale. Avoids writing a switch statement with getXYZInstance(where) calls. @deprecated This API is ICU internal only. @hide original deprecated declaration @hide draft / provisional / internal are hidden on Android
[ "Returns", "a", "particular", "kind", "of", "BreakIterator", "for", "a", "locale", ".", "Avoids", "writing", "a", "switch", "statement", "with", "getXYZInstance", "(", "where", ")", "calls", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/BreakIterator.java#L806-L831
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java
HtmlTree.A_ID
public static HtmlTree A_ID(String id, Content body) { HtmlTree htmltree = new HtmlTree(HtmlTag.A); htmltree.addAttr(HtmlAttr.ID, nullCheck(id)); htmltree.addContent(nullCheck(body)); return htmltree; }
java
public static HtmlTree A_ID(String id, Content body) { HtmlTree htmltree = new HtmlTree(HtmlTag.A); htmltree.addAttr(HtmlAttr.ID, nullCheck(id)); htmltree.addContent(nullCheck(body)); return htmltree; }
[ "public", "static", "HtmlTree", "A_ID", "(", "String", "id", ",", "Content", "body", ")", "{", "HtmlTree", "htmltree", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "A", ")", ";", "htmltree", ".", "addAttr", "(", "HtmlAttr", ".", "ID", ",", "nullCheck", ...
Generates an HTML anchor tag with id attribute and a body. @param id id for the anchor tag @param body body for the anchor tag @return an HtmlTree object
[ "Generates", "an", "HTML", "anchor", "tag", "with", "id", "attribute", "and", "a", "body", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java#L260-L265
alb-i986/selenium-tinafw
src/main/java/me/alb_i986/selenium/tinafw/ui/PageHelper.java
PageHelper.loopFindOrRefresh
public static WebElement loopFindOrRefresh(int maxRefreshes, By locator, WebDriver driver) { for (int i = 0; i < maxRefreshes; i++) { WebElement element; try { // implicitly wait element = driver.findElement(locator); // if no exception is thrown, then we can exit the loop return element; } catch(NoSuchElementException e) { // if implicit wait times out, then refresh page and continue the loop logger.info("after implicit wait, element " + locator + " is still not present: refreshing page and trying again"); Navigation.refreshPage(driver); } } return null; }
java
public static WebElement loopFindOrRefresh(int maxRefreshes, By locator, WebDriver driver) { for (int i = 0; i < maxRefreshes; i++) { WebElement element; try { // implicitly wait element = driver.findElement(locator); // if no exception is thrown, then we can exit the loop return element; } catch(NoSuchElementException e) { // if implicit wait times out, then refresh page and continue the loop logger.info("after implicit wait, element " + locator + " is still not present: refreshing page and trying again"); Navigation.refreshPage(driver); } } return null; }
[ "public", "static", "WebElement", "loopFindOrRefresh", "(", "int", "maxRefreshes", ",", "By", "locator", ",", "WebDriver", "driver", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "maxRefreshes", ";", "i", "++", ")", "{", "WebElement", "eleme...
Implicitly wait for an element. Then, if the element cannot be found, refresh the page. Try finding the element again, reiterating for maxRefreshes times or until the element is found. Finally, return the element. @param maxRefreshes max num of iterations of the loop @param locator the locator for the element we want to find @param driver @return the element identified by the given locator; null if the element is not found after the last iteration
[ "Implicitly", "wait", "for", "an", "element", ".", "Then", "if", "the", "element", "cannot", "be", "found", "refresh", "the", "page", ".", "Try", "finding", "the", "element", "again", "reiterating", "for", "maxRefreshes", "times", "or", "until", "the", "elem...
train
https://github.com/alb-i986/selenium-tinafw/blob/91c66720cda9f69751f96c58c0a0624b2222186e/src/main/java/me/alb_i986/selenium/tinafw/ui/PageHelper.java#L131-L146
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/MapFixture.java
MapFixture.setIntValueForIn
public void setIntValueForIn(int value, String name, Map<String, Object> map) { setValueForIn(Integer.valueOf(value), name, map); }
java
public void setIntValueForIn(int value, String name, Map<String, Object> map) { setValueForIn(Integer.valueOf(value), name, map); }
[ "public", "void", "setIntValueForIn", "(", "int", "value", ",", "String", "name", ",", "Map", "<", "String", ",", "Object", ">", "map", ")", "{", "setValueForIn", "(", "Integer", ".", "valueOf", "(", "value", ")", ",", "name", ",", "map", ")", ";", "...
Stores integer value in map. @param value value to be passed. @param name name to use this value for. @param map map to store value in.
[ "Stores", "integer", "value", "in", "map", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/MapFixture.java#L55-L57
esigate/esigate
esigate-core/src/main/java/org/esigate/util/UriUtils.java
UriUtils.concatPath
public static URI concatPath(URI base, String relPath) { String resultPath = base.getPath() + StringUtils.stripStart(relPath, "/"); try { return new URI(base.getScheme(), base.getUserInfo(), base.getHost(), base.getPort(), resultPath, null, null); } catch (URISyntaxException e) { throw new InvalidUriException(e); } }
java
public static URI concatPath(URI base, String relPath) { String resultPath = base.getPath() + StringUtils.stripStart(relPath, "/"); try { return new URI(base.getScheme(), base.getUserInfo(), base.getHost(), base.getPort(), resultPath, null, null); } catch (URISyntaxException e) { throw new InvalidUriException(e); } }
[ "public", "static", "URI", "concatPath", "(", "URI", "base", ",", "String", "relPath", ")", "{", "String", "resultPath", "=", "base", ".", "getPath", "(", ")", "+", "StringUtils", ".", "stripStart", "(", "relPath", ",", "\"/\"", ")", ";", "try", "{", "...
Concatenates 2 {@link URI} by taking the beginning of the first (up to the path) and the end of the other (starting from the path). While concatenating, checks that there is no doubled "/" character between the path fragments. @param base the base uri @param relPath the path to concatenate with the base uri @return the concatenated uri
[ "Concatenates", "2", "{", "@link", "URI", "}", "by", "taking", "the", "beginning", "of", "the", "first", "(", "up", "to", "the", "path", ")", "and", "the", "end", "of", "the", "other", "(", "starting", "from", "the", "path", ")", ".", "While", "conca...
train
https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/util/UriUtils.java#L326-L333
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/AbstractPrintQuery.java
AbstractPrintQuery.addSelect
public AbstractPrintQuery addSelect(final String... _selectStmts) throws EFapsException { if (isMarked4execute()) { for (final String selectStmt : _selectStmts) { final OneSelect oneselect = new OneSelect(this, selectStmt); this.allSelects.add(oneselect); this.selectStmt2OneSelect.put(selectStmt, oneselect); oneselect.analyzeSelectStmt(); } } return this; }
java
public AbstractPrintQuery addSelect(final String... _selectStmts) throws EFapsException { if (isMarked4execute()) { for (final String selectStmt : _selectStmts) { final OneSelect oneselect = new OneSelect(this, selectStmt); this.allSelects.add(oneselect); this.selectStmt2OneSelect.put(selectStmt, oneselect); oneselect.analyzeSelectStmt(); } } return this; }
[ "public", "AbstractPrintQuery", "addSelect", "(", "final", "String", "...", "_selectStmts", ")", "throws", "EFapsException", "{", "if", "(", "isMarked4execute", "(", ")", ")", "{", "for", "(", "final", "String", "selectStmt", ":", "_selectStmts", ")", "{", "fi...
Add an select to the PrintQuery. A select is something like: <code>class[Emperador_Products_ClassFloorLaminate].linkto[SurfaceAttrId].attribute[Value]</code> <br> The use of the key words like "class" etc is mandatory. Contrary to {@link #addPhrase(String, String)} the values will not be parsed! The values will not be editable. @param _selectStmts selectStatments to be added @return this PrintQuery @throws EFapsException on error
[ "Add", "an", "select", "to", "the", "PrintQuery", ".", "A", "select", "is", "something", "like", ":", "<code", ">", "class", "[", "Emperador_Products_ClassFloorLaminate", "]", ".", "linkto", "[", "SurfaceAttrId", "]", ".", "attribute", "[", "Value", "]", "<"...
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/AbstractPrintQuery.java#L702-L714
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/images/ImageGenerator.java
ImageGenerator.addFeaturePath
public void addFeaturePath( String featurePath, String filter ) { if (!featurePaths.contains(featurePath)) { featurePaths.add(featurePath); if (filter == null) { filter = ""; } featureFilter.add(filter); } }
java
public void addFeaturePath( String featurePath, String filter ) { if (!featurePaths.contains(featurePath)) { featurePaths.add(featurePath); if (filter == null) { filter = ""; } featureFilter.add(filter); } }
[ "public", "void", "addFeaturePath", "(", "String", "featurePath", ",", "String", "filter", ")", "{", "if", "(", "!", "featurePaths", ".", "contains", "(", "featurePath", ")", ")", "{", "featurePaths", ".", "add", "(", "featurePath", ")", ";", "if", "(", ...
Add a new feature file path. <p>The order will be considered. First paths are drawn first.</p> @param featurePath the path to add.
[ "Add", "a", "new", "feature", "file", "path", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/images/ImageGenerator.java#L184-L192
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractController.java
AbstractController.callCommand
protected Wave callCommand(final Class<? extends CommandBean<? extends WaveBean>> commandClass, final WaveBean waveBean, final WaveBean... waveBeans) { return model().callCommand(commandClass, waveBean, waveBeans); }
java
protected Wave callCommand(final Class<? extends CommandBean<? extends WaveBean>> commandClass, final WaveBean waveBean, final WaveBean... waveBeans) { return model().callCommand(commandClass, waveBean, waveBeans); }
[ "protected", "Wave", "callCommand", "(", "final", "Class", "<", "?", "extends", "CommandBean", "<", "?", "extends", "WaveBean", ">", ">", "commandClass", ",", "final", "WaveBean", "waveBean", ",", "final", "WaveBean", "...", "waveBeans", ")", "{", "return", ...
Redirect to {@link Model#callCommand(Class, WaveBean)}. @param commandClass the command class to call @param waveBean the WaveBean that holds all required data @param waveBeans the extra Wave Beans that holds all other required data @param <WB> the type of the wave bean to used @return the wave created and sent to JIT, be careful when you use a strong reference it can hold a lot of objects
[ "Redirect", "to", "{", "@link", "Model#callCommand", "(", "Class", "WaveBean", ")", "}", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/ui/AbstractController.java#L283-L285
samskivert/samskivert
src/main/java/com/samskivert/servlet/SiteResourceLoader.java
SiteResourceLoader.getBundle
protected SiteResourceBundle getBundle (int siteId) throws IOException { // look up the site resource bundle for this site SiteResourceBundle bundle = _bundles.get(siteId); // if we haven't got one, create one if (bundle == null) { // obtain the string identifier for this site String ident = _siteIdent.getSiteString(siteId); // compose that with the jar file directory to obtain the // path to the site-specific jar file File file = new File(_jarPath, ident + JAR_EXTENSION); // create a handle for this site-specific jar file bundle = new SiteResourceBundle(file); // cache our new bundle _bundles.put(siteId, bundle); } return bundle; }
java
protected SiteResourceBundle getBundle (int siteId) throws IOException { // look up the site resource bundle for this site SiteResourceBundle bundle = _bundles.get(siteId); // if we haven't got one, create one if (bundle == null) { // obtain the string identifier for this site String ident = _siteIdent.getSiteString(siteId); // compose that with the jar file directory to obtain the // path to the site-specific jar file File file = new File(_jarPath, ident + JAR_EXTENSION); // create a handle for this site-specific jar file bundle = new SiteResourceBundle(file); // cache our new bundle _bundles.put(siteId, bundle); } return bundle; }
[ "protected", "SiteResourceBundle", "getBundle", "(", "int", "siteId", ")", "throws", "IOException", "{", "// look up the site resource bundle for this site", "SiteResourceBundle", "bundle", "=", "_bundles", ".", "get", "(", "siteId", ")", ";", "// if we haven't got one, cre...
Obtains the site-specific jar file for the specified site. This should only be called when the lock for this site is held.
[ "Obtains", "the", "site", "-", "specific", "jar", "file", "for", "the", "specified", "site", ".", "This", "should", "only", "be", "called", "when", "the", "lock", "for", "this", "site", "is", "held", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/servlet/SiteResourceLoader.java#L200-L220
BioPAX/Paxtools
pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java
PatternBox.modifiedPESimple
public static Pattern modifiedPESimple() { Pattern p = new Pattern(EntityReference.class, "modified ER"); p.add(erToPE(), "modified ER", "first PE"); p.add(participatesInConv(), "first PE", "Conversion"); p.add(new ConversionSide(ConversionSide.Type.OTHER_SIDE), "first PE", "Conversion", "second PE"); p.add(equal(false), "first PE", "second PE"); p.add(peToER(), "second PE", "modified ER"); return p; }
java
public static Pattern modifiedPESimple() { Pattern p = new Pattern(EntityReference.class, "modified ER"); p.add(erToPE(), "modified ER", "first PE"); p.add(participatesInConv(), "first PE", "Conversion"); p.add(new ConversionSide(ConversionSide.Type.OTHER_SIDE), "first PE", "Conversion", "second PE"); p.add(equal(false), "first PE", "second PE"); p.add(peToER(), "second PE", "modified ER"); return p; }
[ "public", "static", "Pattern", "modifiedPESimple", "(", ")", "{", "Pattern", "p", "=", "new", "Pattern", "(", "EntityReference", ".", "class", ",", "\"modified ER\"", ")", ";", "p", ".", "add", "(", "erToPE", "(", ")", ",", "\"modified ER\"", ",", "\"first...
Pattern for an EntityReference has distinct PhysicalEntities associated with both left and right of a Conversion. @return the pattern
[ "Pattern", "for", "an", "EntityReference", "has", "distinct", "PhysicalEntities", "associated", "with", "both", "left", "and", "right", "of", "a", "Conversion", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java#L795-L804
simonpercic/CollectionHelper
collectionhelper/src/main/java/com/github/simonpercic/collectionhelper/CollectionHelper.java
CollectionHelper.singleIndexOf
public static <T> int singleIndexOf(Collection<T> items, Predicate<T> predicate) { int result = NOT_FOUND_INDEX; if (!isEmpty(items)) { int index = 0; for (T item : items) { if (predicate.apply(item)) { if (result == NOT_FOUND_INDEX) { result = index; } else { throw new InvalidOperationException("Multiple items match!"); } } index++; } } return result; }
java
public static <T> int singleIndexOf(Collection<T> items, Predicate<T> predicate) { int result = NOT_FOUND_INDEX; if (!isEmpty(items)) { int index = 0; for (T item : items) { if (predicate.apply(item)) { if (result == NOT_FOUND_INDEX) { result = index; } else { throw new InvalidOperationException("Multiple items match!"); } } index++; } } return result; }
[ "public", "static", "<", "T", ">", "int", "singleIndexOf", "(", "Collection", "<", "T", ">", "items", ",", "Predicate", "<", "T", ">", "predicate", ")", "{", "int", "result", "=", "NOT_FOUND_INDEX", ";", "if", "(", "!", "isEmpty", "(", "items", ")", ...
Returns the index of the only element in a collection that matches the given predicate. Returns {#NOT_FOUND_INDEX} if no element matches the given predicate. Throws a {@link InvalidOperationException} if there is more than 1 element matching the predicate. @param items source items @param predicate predicate function @param <T> type of elements in the source collection @return index of the only element that matches the given predicate or {#NOT_FOUND_INDEX} if no element matches the given predicate @throws InvalidOperationException if there is more than 1 element matching the predicate
[ "Returns", "the", "index", "of", "the", "only", "element", "in", "a", "collection", "that", "matches", "the", "given", "predicate", ".", "Returns", "{", "#NOT_FOUND_INDEX", "}", "if", "no", "element", "matches", "the", "given", "predicate", ".", "Throws", "a...
train
https://github.com/simonpercic/CollectionHelper/blob/2425390ac14f3b6c0a7b04464cf5670060f2dc54/collectionhelper/src/main/java/com/github/simonpercic/collectionhelper/CollectionHelper.java#L234-L253
wisdom-framework/wisdom
core/wisdom-api/src/main/java/org/wisdom/api/router/RouteUtils.java
RouteUtils.getPrefixedUri
public static String getPrefixedUri(String prefix, String uri) { String localURI = uri; if (localURI.length() > 0) { // Put a / between the prefix and the tail only if: // the prefix does not ends with a / // the tail does not start with a / // the tail starts with an alphanumeric character. if (!localURI.startsWith("/") && !prefix.endsWith("/") && Character.isLetterOrDigit(localURI.indexOf(0))) { localURI = prefix + "/" + localURI; } else { localURI = prefix + localURI; } } else { // Empty tail, just return the prefix. return prefix; } return localURI; }
java
public static String getPrefixedUri(String prefix, String uri) { String localURI = uri; if (localURI.length() > 0) { // Put a / between the prefix and the tail only if: // the prefix does not ends with a / // the tail does not start with a / // the tail starts with an alphanumeric character. if (!localURI.startsWith("/") && !prefix.endsWith("/") && Character.isLetterOrDigit(localURI.indexOf(0))) { localURI = prefix + "/" + localURI; } else { localURI = prefix + localURI; } } else { // Empty tail, just return the prefix. return prefix; } return localURI; }
[ "public", "static", "String", "getPrefixedUri", "(", "String", "prefix", ",", "String", "uri", ")", "{", "String", "localURI", "=", "uri", ";", "if", "(", "localURI", ".", "length", "(", ")", ">", "0", ")", "{", "// Put a / between the prefix and the tail only...
Prepends the given prefix to the given uri. @param prefix the prefix @param uri the uri @return the full uri
[ "Prepends", "the", "given", "prefix", "to", "the", "given", "uri", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-api/src/main/java/org/wisdom/api/router/RouteUtils.java#L204-L223
Whiley/WhileyCompiler
src/main/java/wyc/io/WhileyFileParser.java
WhileyFileParser.parseConditionExpression
private Expr parseConditionExpression(EnclosingScope scope, boolean terminated) { int start = index; Token lookahead; // First, attempt to parse quantifiers (e.g. some, all, no, etc) if ((lookahead = tryAndMatch(terminated, Some, All)) != null) { return parseQuantifierExpression(lookahead, scope, terminated); } Expr lhs = parseShiftExpression(scope, terminated); lookahead = tryAndMatch(terminated, LessEquals, LeftAngle, GreaterEquals, RightAngle, EqualsEquals, NotEquals, Is, Subset, SubsetEquals, Superset, SupersetEquals); if (lookahead != null && lookahead.kind == Is) { Type type = parseType(scope); lhs = annotateSourceLocation(new Expr.Is(lhs, type), start); } else if (lookahead != null) { Expr rhs = parseShiftExpression(scope, terminated); // switch (lookahead.kind) { case LessEquals: lhs = new Expr.IntegerLessThanOrEqual(lhs, rhs); break; case LeftAngle: lhs = new Expr.IntegerLessThan(lhs, rhs); break; case GreaterEquals: lhs = new Expr.IntegerGreaterThanOrEqual(lhs, rhs); break; case RightAngle: lhs = new Expr.IntegerGreaterThan(lhs, rhs); break; case EqualsEquals: lhs = new Expr.Equal(lhs, rhs); break; case NotEquals: lhs = new Expr.NotEqual(lhs, rhs); break; default: throw new RuntimeException("deadcode"); // dead-code } lhs = annotateSourceLocation(lhs,start); } return lhs; }
java
private Expr parseConditionExpression(EnclosingScope scope, boolean terminated) { int start = index; Token lookahead; // First, attempt to parse quantifiers (e.g. some, all, no, etc) if ((lookahead = tryAndMatch(terminated, Some, All)) != null) { return parseQuantifierExpression(lookahead, scope, terminated); } Expr lhs = parseShiftExpression(scope, terminated); lookahead = tryAndMatch(terminated, LessEquals, LeftAngle, GreaterEquals, RightAngle, EqualsEquals, NotEquals, Is, Subset, SubsetEquals, Superset, SupersetEquals); if (lookahead != null && lookahead.kind == Is) { Type type = parseType(scope); lhs = annotateSourceLocation(new Expr.Is(lhs, type), start); } else if (lookahead != null) { Expr rhs = parseShiftExpression(scope, terminated); // switch (lookahead.kind) { case LessEquals: lhs = new Expr.IntegerLessThanOrEqual(lhs, rhs); break; case LeftAngle: lhs = new Expr.IntegerLessThan(lhs, rhs); break; case GreaterEquals: lhs = new Expr.IntegerGreaterThanOrEqual(lhs, rhs); break; case RightAngle: lhs = new Expr.IntegerGreaterThan(lhs, rhs); break; case EqualsEquals: lhs = new Expr.Equal(lhs, rhs); break; case NotEquals: lhs = new Expr.NotEqual(lhs, rhs); break; default: throw new RuntimeException("deadcode"); // dead-code } lhs = annotateSourceLocation(lhs,start); } return lhs; }
[ "private", "Expr", "parseConditionExpression", "(", "EnclosingScope", "scope", ",", "boolean", "terminated", ")", "{", "int", "start", "=", "index", ";", "Token", "lookahead", ";", "// First, attempt to parse quantifiers (e.g. some, all, no, etc)", "if", "(", "(", "look...
Parse a condition expression. @param scope The enclosing scope for this statement, which determines the set of visible (i.e. declared) variables and also the current indentation level. @param terminated This indicates that the expression is known to be terminated (or not). An expression that's known to be terminated is one which is guaranteed to be followed by something. This is important because it means that we can ignore any newline characters encountered in parsing this expression, and that we'll never overrun the end of the expression (i.e. because there's guaranteed to be something which terminates this expression). A classic situation where terminated is true is when parsing an expression surrounded in braces. In such case, we know the right-brace will always terminate this expression. @return
[ "Parse", "a", "condition", "expression", "." ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L1856-L1902
anotheria/moskito
moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/AbstractMoskitoAspect.java
AbstractMoskitoAspect.createMethodLevelAccumulators
private void createMethodLevelAccumulators(final OnDemandStatsProducer<S> producer, final Method method) { //several @Accumulators in accumulators holder final Accumulates accAnnotationHolderMethods = AnnotationUtils.findAnnotation(method, Accumulates.class); if (accAnnotationHolderMethods != null) createAccumulators(producer, method, accAnnotationHolderMethods.value()); //If there is no @Accumulates annotation but @Accumulate is present final Accumulate annotation = AnnotationUtils.findAnnotation(method, Accumulate.class); createAccumulators(producer, method, annotation); }
java
private void createMethodLevelAccumulators(final OnDemandStatsProducer<S> producer, final Method method) { //several @Accumulators in accumulators holder final Accumulates accAnnotationHolderMethods = AnnotationUtils.findAnnotation(method, Accumulates.class); if (accAnnotationHolderMethods != null) createAccumulators(producer, method, accAnnotationHolderMethods.value()); //If there is no @Accumulates annotation but @Accumulate is present final Accumulate annotation = AnnotationUtils.findAnnotation(method, Accumulate.class); createAccumulators(producer, method, annotation); }
[ "private", "void", "createMethodLevelAccumulators", "(", "final", "OnDemandStatsProducer", "<", "S", ">", "producer", ",", "final", "Method", "method", ")", "{", "//several @Accumulators in accumulators holder", "final", "Accumulates", "accAnnotationHolderMethods", "=", "An...
Create method level accumulators. @param producer {@link OnDemandStatsProducer} @param method annotated method
[ "Create", "method", "level", "accumulators", "." ]
train
https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-aop/src/main/java/net/anotheria/moskito/aop/aspect/AbstractMoskitoAspect.java#L213-L222
michael-rapp/AndroidMaterialDialog
example/src/main/java/de/mrapp/android/dialog/example/PreferenceFragment.java
PreferenceFragment.createSingleChoiceListener
private OnClickListener createSingleChoiceListener() { return new OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int position) { String text = getString(R.string.single_choice_listener_text); showToast(String.format(text, position)); } }; }
java
private OnClickListener createSingleChoiceListener() { return new OnClickListener() { @Override public void onClick(final DialogInterface dialog, final int position) { String text = getString(R.string.single_choice_listener_text); showToast(String.format(text, position)); } }; }
[ "private", "OnClickListener", "createSingleChoiceListener", "(", ")", "{", "return", "new", "OnClickListener", "(", ")", "{", "@", "Override", "public", "void", "onClick", "(", "final", "DialogInterface", "dialog", ",", "final", "int", "position", ")", "{", "Str...
Creates and returns a listener, which allows to show a toast, which indicates when a single choice list item of a dialog has been selected or unselected. @return The listener, which has been created, as an instance of the type {@link OnClickListener}
[ "Creates", "and", "returns", "a", "listener", "which", "allows", "to", "show", "a", "toast", "which", "indicates", "when", "a", "single", "choice", "list", "item", "of", "a", "dialog", "has", "been", "selected", "or", "unselected", "." ]
train
https://github.com/michael-rapp/AndroidMaterialDialog/blob/8990eed72ee5f5a9720836ee708f71ac0d43053b/example/src/main/java/de/mrapp/android/dialog/example/PreferenceFragment.java#L496-L506
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationChangeListener.java
DestinationChangeListener.getDestinationLocalitySet
private Set getDestinationLocalitySet (BaseDestinationHandler destinationHandler, Capability capability) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getDestinationLocalitySet", new Object[]{destinationHandler, capability}); // Check if the localisation should be deleted Set localitySet = null; //Get the locality sets as known by admin try { localitySet = _messageProcessor.getSIBDestinationLocalitySet(null, destinationHandler.getUuid().toString(), true); } catch(SIBExceptionBase e) { // FFDC FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.DestinationChangeListener.getDestinationLocalitySet", "1:368:1.45", this); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getDestinationLocalitySet", localitySet); return localitySet; }
java
private Set getDestinationLocalitySet (BaseDestinationHandler destinationHandler, Capability capability) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getDestinationLocalitySet", new Object[]{destinationHandler, capability}); // Check if the localisation should be deleted Set localitySet = null; //Get the locality sets as known by admin try { localitySet = _messageProcessor.getSIBDestinationLocalitySet(null, destinationHandler.getUuid().toString(), true); } catch(SIBExceptionBase e) { // FFDC FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.DestinationChangeListener.getDestinationLocalitySet", "1:368:1.45", this); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getDestinationLocalitySet", localitySet); return localitySet; }
[ "private", "Set", "getDestinationLocalitySet", "(", "BaseDestinationHandler", "destinationHandler", ",", "Capability", "capability", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr...
Retrieve the Locality Set defined in Admin. @param destinationHandler @param capability @return
[ "Retrieve", "the", "Locality", "Set", "defined", "in", "Admin", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationChangeListener.java#L302-L330
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/persistence/objectManager/PersistableImpl.java
PersistableImpl.updateMetaDataOnly
public void updateMetaDataOnly(Transaction tran, Persistable persistable) throws PersistenceException, ObjectManagerException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "updateMetaDataOnly", new Object[] { "Tran=" + tran, "Persistable=" + persistable }); // Defect 585163 // Get the meta data object to work with. This may involve // pulling it off disk if it has fallen out of memory. PersistableMetaData metaData = getMetaData(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "MetaData=" + metaData); tran.lock(metaData); // Update the MetaData with the cached values metaData.setLockID(persistable.getLockID()); metaData.setRedeliveredCount(persistable.getRedeliveredCount()); tran.replace(metaData); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "updateMetaDataOnly", "MetaData=" + metaData); }
java
public void updateMetaDataOnly(Transaction tran, Persistable persistable) throws PersistenceException, ObjectManagerException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "updateMetaDataOnly", new Object[] { "Tran=" + tran, "Persistable=" + persistable }); // Defect 585163 // Get the meta data object to work with. This may involve // pulling it off disk if it has fallen out of memory. PersistableMetaData metaData = getMetaData(); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "MetaData=" + metaData); tran.lock(metaData); // Update the MetaData with the cached values metaData.setLockID(persistable.getLockID()); metaData.setRedeliveredCount(persistable.getRedeliveredCount()); tran.replace(metaData); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "updateMetaDataOnly", "MetaData=" + metaData); }
[ "public", "void", "updateMetaDataOnly", "(", "Transaction", "tran", ",", "Persistable", "persistable", ")", "throws", "PersistenceException", ",", "ObjectManagerException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isE...
Only update the persistent copy of the meta data associated with this Persistable. This variant is for a cached persistable in which the lock ID has been cached by the task. @param tran The ObjectManager transaction under which the update of the data is carried out. @exception ObjectManagerException
[ "Only", "update", "the", "persistent", "copy", "of", "the", "meta", "data", "associated", "with", "this", "Persistable", ".", "This", "variant", "is", "for", "a", "cached", "persistable", "in", "which", "the", "lock", "ID", "has", "been", "cached", "by", "...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/persistence/objectManager/PersistableImpl.java#L679-L702
indeedeng/util
urlparsing/src/main/java/com/indeed/util/urlparsing/ParseUtils.java
ParseUtils.parseUnsignedLong
public static long parseUnsignedLong(CharSequence s, final int start, final int end) throws NumberFormatException { long ret = 0; for (int i = start; i < end; i++) { final char c = s.charAt(i); if (c < '0' || c > '9') { throw new NumberFormatException("Not a valid base-10 digit: " + c + " in " + s.subSequence(start, end)); } final int val = c - '0'; ret = ret * 10 + val; } return ret; }
java
public static long parseUnsignedLong(CharSequence s, final int start, final int end) throws NumberFormatException { long ret = 0; for (int i = start; i < end; i++) { final char c = s.charAt(i); if (c < '0' || c > '9') { throw new NumberFormatException("Not a valid base-10 digit: " + c + " in " + s.subSequence(start, end)); } final int val = c - '0'; ret = ret * 10 + val; } return ret; }
[ "public", "static", "long", "parseUnsignedLong", "(", "CharSequence", "s", ",", "final", "int", "start", ",", "final", "int", "end", ")", "throws", "NumberFormatException", "{", "long", "ret", "=", "0", ";", "for", "(", "int", "i", "=", "start", ";", "i"...
Parses out a long value from the provided string, equivalent to Long.parseLong(s.substring(start, end)), but has significantly less overhead, no object creation and later garbage collection required @throws {@link NumberFormatException} if it encounters any character that is not [0-9].
[ "Parses", "out", "a", "long", "value", "from", "the", "provided", "string", "equivalent", "to", "Long", ".", "parseLong", "(", "s", ".", "substring", "(", "start", "end", "))", "but", "has", "significantly", "less", "overhead", "no", "object", "creation", ...
train
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/urlparsing/src/main/java/com/indeed/util/urlparsing/ParseUtils.java#L80-L91
jcuda/jcuda
JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java
JCudaDriver.cuParamSetv
@Deprecated public static int cuParamSetv(CUfunction hfunc, int offset, Pointer ptr, int numbytes) { return checkResult(cuParamSetvNative(hfunc, offset, ptr, numbytes)); }
java
@Deprecated public static int cuParamSetv(CUfunction hfunc, int offset, Pointer ptr, int numbytes) { return checkResult(cuParamSetvNative(hfunc, offset, ptr, numbytes)); }
[ "@", "Deprecated", "public", "static", "int", "cuParamSetv", "(", "CUfunction", "hfunc", ",", "int", "offset", ",", "Pointer", "ptr", ",", "int", "numbytes", ")", "{", "return", "checkResult", "(", "cuParamSetvNative", "(", "hfunc", ",", "offset", ",", "ptr"...
Adds arbitrary data to the function's argument list. <pre> CUresult cuParamSetv ( CUfunction hfunc, int offset, void* ptr, unsigned int numbytes ) </pre> <div> <p>Adds arbitrary data to the function's argument list. Deprecated Copies an arbitrary amount of data (specified in <tt>numbytes</tt>) from <tt>ptr</tt> into the parameter space of the kernel corresponding to <tt>hfunc</tt>. <tt>offset</tt> is a byte offset. </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param hfunc Kernel to add data to @param offset Offset to add data to argument list @param ptr Pointer to arbitrary data @param numbytes Size of data to copy in bytes @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE @see JCudaDriver#cuFuncSetBlockShape @see JCudaDriver#cuFuncSetSharedSize @see JCudaDriver#cuFuncGetAttribute @see JCudaDriver#cuParamSetSize @see JCudaDriver#cuParamSetf @see JCudaDriver#cuParamSeti @see JCudaDriver#cuLaunch @see JCudaDriver#cuLaunchGrid @see JCudaDriver#cuLaunchGridAsync @see JCudaDriver#cuLaunchKernel @deprecated Deprecated in CUDA
[ "Adds", "arbitrary", "data", "to", "the", "function", "s", "argument", "list", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L11899-L11903
kubernetes-client/java
kubernetes/src/main/java/io/kubernetes/client/ApiClient.java
ApiClient.buildCall
public Call buildCall(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, formParams, authNames, progressRequestListener); return httpClient.newCall(request); }
java
public Call buildCall(String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Request request = buildRequest(path, method, queryParams, collectionQueryParams, body, headerParams, formParams, authNames, progressRequestListener); return httpClient.newCall(request); }
[ "public", "Call", "buildCall", "(", "String", "path", ",", "String", "method", ",", "List", "<", "Pair", ">", "queryParams", ",", "List", "<", "Pair", ">", "collectionQueryParams", ",", "Object", "body", ",", "Map", "<", "String", ",", "String", ">", "he...
Build HTTP call with the given options. @param path The sub-path of the HTTP URL @param method The request method, one of "GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH" and "DELETE" @param queryParams The query parameters @param collectionQueryParams The collection query parameters @param body The request body object @param headerParams The header parameters @param formParams The form parameters @param authNames The authentications to apply @param progressRequestListener Progress request listener @return The HTTP call @throws ApiException If fail to serialize the request body object
[ "Build", "HTTP", "call", "with", "the", "given", "options", "." ]
train
https://github.com/kubernetes-client/java/blob/7413e98bd904f09d1ad00fb60e8c6ff787f3f560/kubernetes/src/main/java/io/kubernetes/client/ApiClient.java#L905-L909
ReactiveX/RxJavaFX
src/main/java/io/reactivex/rxjavafx/transformers/FxFlowableTransformers.java
FxFlowableTransformers.doOnCompleteCount
public static <T> FlowableTransformer<T,T> doOnCompleteCount(Consumer<Integer> onComplete) { return obs -> obs.lift(new FlowableEmissionCounter<>(new CountObserver(null,onComplete,null))); }
java
public static <T> FlowableTransformer<T,T> doOnCompleteCount(Consumer<Integer> onComplete) { return obs -> obs.lift(new FlowableEmissionCounter<>(new CountObserver(null,onComplete,null))); }
[ "public", "static", "<", "T", ">", "FlowableTransformer", "<", "T", ",", "T", ">", "doOnCompleteCount", "(", "Consumer", "<", "Integer", ">", "onComplete", ")", "{", "return", "obs", "->", "obs", ".", "lift", "(", "new", "FlowableEmissionCounter", "<>", "(...
Performs an action on onComplete with the provided emission count @param onComplete @param <T>
[ "Performs", "an", "action", "on", "onComplete", "with", "the", "provided", "emission", "count" ]
train
https://github.com/ReactiveX/RxJavaFX/blob/8f44d4cc1caba9a8919f01cb1897aaea5514c7e5/src/main/java/io/reactivex/rxjavafx/transformers/FxFlowableTransformers.java#L123-L125
codecentric/zucchini
zucchini-web/src/main/java/de/codecentric/zucchini/web/util/WebAssert.java
WebAssert.findElementOrFail
public static WebElement findElementOrFail(WebDriver webDriver, By element) { try { return webDriver.findElement(element); } catch (NoSuchElementException e) { fail(String.format("Element %s should exist but it does not.", element.toString()), e); } /** * Never reached since {@link de.codecentric.zucchini.bdd.util.Assert#fail(String)} fail()} throws * {@link java.lang.AssertionError}. */ return null; }
java
public static WebElement findElementOrFail(WebDriver webDriver, By element) { try { return webDriver.findElement(element); } catch (NoSuchElementException e) { fail(String.format("Element %s should exist but it does not.", element.toString()), e); } /** * Never reached since {@link de.codecentric.zucchini.bdd.util.Assert#fail(String)} fail()} throws * {@link java.lang.AssertionError}. */ return null; }
[ "public", "static", "WebElement", "findElementOrFail", "(", "WebDriver", "webDriver", ",", "By", "element", ")", "{", "try", "{", "return", "webDriver", ".", "findElement", "(", "element", ")", ";", "}", "catch", "(", "NoSuchElementException", "e", ")", "{", ...
Tries to find a specific element and fails if the element could not be found. @param webDriver The web driver. @param element The element. @return The found element.
[ "Tries", "to", "find", "a", "specific", "element", "and", "fails", "if", "the", "element", "could", "not", "be", "found", "." ]
train
https://github.com/codecentric/zucchini/blob/61541cd8ce666ef21ad943486a7c0eb53310ed5a/zucchini-web/src/main/java/de/codecentric/zucchini/web/util/WebAssert.java#L37-L48
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.updateSubscriptionNotes
public Subscription updateSubscriptionNotes(final String uuid, final SubscriptionNotes subscriptionNotes) { return doPUT(SubscriptionNotes.SUBSCRIPTION_RESOURCE + "/" + uuid + "/notes", subscriptionNotes, Subscription.class); }
java
public Subscription updateSubscriptionNotes(final String uuid, final SubscriptionNotes subscriptionNotes) { return doPUT(SubscriptionNotes.SUBSCRIPTION_RESOURCE + "/" + uuid + "/notes", subscriptionNotes, Subscription.class); }
[ "public", "Subscription", "updateSubscriptionNotes", "(", "final", "String", "uuid", ",", "final", "SubscriptionNotes", "subscriptionNotes", ")", "{", "return", "doPUT", "(", "SubscriptionNotes", ".", "SUBSCRIPTION_RESOURCE", "+", "\"/\"", "+", "uuid", "+", "\"/notes\...
Update to a particular {@link Subscription}'s notes by it's UUID <p> Returns information about a single subscription. @param uuid UUID of the subscription to preview an update for @param subscriptionNotes SubscriptionNotes object @return Subscription the updated subscription
[ "Update", "to", "a", "particular", "{", "@link", "Subscription", "}", "s", "notes", "by", "it", "s", "UUID", "<p", ">", "Returns", "information", "about", "a", "single", "subscription", "." ]
train
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L620-L623
xmlet/XsdAsmFaster
src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java
XsdAsmInterfaces.groupMethod
private InterfaceInfo groupMethod(String groupName, XsdChoice choiceElement, XsdAll allElement, XsdSequence sequenceElement, String className, int interfaceIndex, String apiName){ if (allElement != null) { return iterativeCreation(allElement, className, interfaceIndex + 1, apiName, groupName).get(0); } if (choiceElement != null) { return iterativeCreation(choiceElement, className, interfaceIndex + 1, apiName, groupName).get(0); } if (sequenceElement != null) { iterativeCreation(sequenceElement, className, interfaceIndex + 1, apiName, groupName); } return new InterfaceInfo(TEXT_GROUP); }
java
private InterfaceInfo groupMethod(String groupName, XsdChoice choiceElement, XsdAll allElement, XsdSequence sequenceElement, String className, int interfaceIndex, String apiName){ if (allElement != null) { return iterativeCreation(allElement, className, interfaceIndex + 1, apiName, groupName).get(0); } if (choiceElement != null) { return iterativeCreation(choiceElement, className, interfaceIndex + 1, apiName, groupName).get(0); } if (sequenceElement != null) { iterativeCreation(sequenceElement, className, interfaceIndex + 1, apiName, groupName); } return new InterfaceInfo(TEXT_GROUP); }
[ "private", "InterfaceInfo", "groupMethod", "(", "String", "groupName", ",", "XsdChoice", "choiceElement", ",", "XsdAll", "allElement", ",", "XsdSequence", "sequenceElement", ",", "String", "className", ",", "int", "interfaceIndex", ",", "String", "apiName", ")", "{"...
Delegates the interface generation to one of the possible {@link XsdGroup} element children. @param groupName The group name of the {@link XsdGroup} element. @param choiceElement The child {@link XsdChoice}. @param allElement The child {@link XsdAll}. @param sequenceElement The child {@link XsdSequence}. @param className The className of the element which contains this group. @param interfaceIndex The current interface index that serves as a base to distinguish interface names. @param apiName The name of the generated fluent interface. @return A {@link InterfaceInfo} object containing relevant interface information.
[ "Delegates", "the", "interface", "generation", "to", "one", "of", "the", "possible", "{" ]
train
https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java#L346-L360
rhuss/jolokia
agent/core/src/main/java/org/jolokia/converter/json/BeanExtractor.java
BeanExtractor.addAttributes
@SuppressWarnings("PMD.UnnecessaryCaseChange") private void addAttributes(List<String> pAttrs, Method pMethod) { String name = pMethod.getName(); for (String pref : GETTER_PREFIX) { if (name.startsWith(pref) && name.length() > pref.length() && pMethod.getParameterTypes().length == 0) { int len = pref.length(); String firstLetter = name.substring(len,len+1); // Only for getter compliant to the beans conventions (first letter after prefix is upper case) if (firstLetter.toUpperCase().equals(firstLetter)) { String attribute = new StringBuffer(firstLetter.toLowerCase()). append(name.substring(len+1)).toString(); pAttrs.add(attribute); } } } }
java
@SuppressWarnings("PMD.UnnecessaryCaseChange") private void addAttributes(List<String> pAttrs, Method pMethod) { String name = pMethod.getName(); for (String pref : GETTER_PREFIX) { if (name.startsWith(pref) && name.length() > pref.length() && pMethod.getParameterTypes().length == 0) { int len = pref.length(); String firstLetter = name.substring(len,len+1); // Only for getter compliant to the beans conventions (first letter after prefix is upper case) if (firstLetter.toUpperCase().equals(firstLetter)) { String attribute = new StringBuffer(firstLetter.toLowerCase()). append(name.substring(len+1)).toString(); pAttrs.add(attribute); } } } }
[ "@", "SuppressWarnings", "(", "\"PMD.UnnecessaryCaseChange\"", ")", "private", "void", "addAttributes", "(", "List", "<", "String", ">", "pAttrs", ",", "Method", "pMethod", ")", "{", "String", "name", "=", "pMethod", ".", "getName", "(", ")", ";", "for", "("...
Add attributes, which are taken from get methods to the given list
[ "Add", "attributes", "which", "are", "taken", "from", "get", "methods", "to", "the", "given", "list" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/converter/json/BeanExtractor.java#L228-L245
alkacon/opencms-core
src/org/opencms/jsp/CmsJspTagEdit.java
CmsJspTagEdit.getNewLink
public static String getNewLink(CmsObject cms, I_CmsResourceType resType, String creationSitemap) { String contextPath = getContextRootPath(cms, creationSitemap); StringBuffer newLink = new StringBuffer(NEW_LINK_IDENTIFIER); newLink.append('|'); newLink.append(contextPath); newLink.append('|'); newLink.append(resType.getTypeName()); return newLink.toString(); }
java
public static String getNewLink(CmsObject cms, I_CmsResourceType resType, String creationSitemap) { String contextPath = getContextRootPath(cms, creationSitemap); StringBuffer newLink = new StringBuffer(NEW_LINK_IDENTIFIER); newLink.append('|'); newLink.append(contextPath); newLink.append('|'); newLink.append(resType.getTypeName()); return newLink.toString(); }
[ "public", "static", "String", "getNewLink", "(", "CmsObject", "cms", ",", "I_CmsResourceType", "resType", ",", "String", "creationSitemap", ")", "{", "String", "contextPath", "=", "getContextRootPath", "(", "cms", ",", "creationSitemap", ")", ";", "StringBuffer", ...
Creates the String specifying where which type of resource has to be created.<p> @param cms the CMS context @param resType the resource type to create @param creationSitemap the creation sitemap parameter @return The String identifying which type of resource has to be created where.<p> @see #createResource(CmsObject, String, Locale, String, String, String, String)
[ "Creates", "the", "String", "specifying", "where", "which", "type", "of", "resource", "has", "to", "be", "created", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagEdit.java#L159-L169
jbundle/jbundle
base/message/core/src/main/java/org/jbundle/base/message/core/tree/Registry.java
Registry.getNameValueLeaf
public NameValue getNameValueLeaf(BaseMessageHeader header, boolean bAddIfNotFound) { Object[][] mxString = header.getNameValueTree(); NameValue node = this; if (mxString != null) { for (int i = 0; i < mxString.length; i++) { node = node.getNameValueNode((String)mxString[i][MessageConstants.NAME], mxString[i][MessageConstants.VALUE], bAddIfNotFound); if (node == null) return null; } } return node; }
java
public NameValue getNameValueLeaf(BaseMessageHeader header, boolean bAddIfNotFound) { Object[][] mxString = header.getNameValueTree(); NameValue node = this; if (mxString != null) { for (int i = 0; i < mxString.length; i++) { node = node.getNameValueNode((String)mxString[i][MessageConstants.NAME], mxString[i][MessageConstants.VALUE], bAddIfNotFound); if (node == null) return null; } } return node; }
[ "public", "NameValue", "getNameValueLeaf", "(", "BaseMessageHeader", "header", ",", "boolean", "bAddIfNotFound", ")", "{", "Object", "[", "]", "[", "]", "mxString", "=", "header", ".", "getNameValueTree", "(", ")", ";", "NameValue", "node", "=", "this", ";", ...
Get the value node at the end of this name/value chain. @param header The message header that contains the name/value tree. @oaram bAddIfNotFound Add the value if it is not found. @return The node at the end of the name/value tree.
[ "Get", "the", "value", "node", "at", "the", "end", "of", "this", "name", "/", "value", "chain", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/core/src/main/java/org/jbundle/base/message/core/tree/Registry.java#L143-L157
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/MultiColumnText.java
MultiColumnText.addSimpleColumn
public void addSimpleColumn(float left, float right) { ColumnDef newCol = new ColumnDef(left, right); columnDefs.add(newCol); }
java
public void addSimpleColumn(float left, float right) { ColumnDef newCol = new ColumnDef(left, right); columnDefs.add(newCol); }
[ "public", "void", "addSimpleColumn", "(", "float", "left", ",", "float", "right", ")", "{", "ColumnDef", "newCol", "=", "new", "ColumnDef", "(", "left", ",", "right", ")", ";", "columnDefs", ".", "add", "(", "newCol", ")", ";", "}" ]
Add a simple rectangular column with specified left and right x position boundaries. @param left left boundary @param right right boundary
[ "Add", "a", "simple", "rectangular", "column", "with", "specified", "left", "and", "right", "x", "position", "boundaries", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/MultiColumnText.java#L204-L207
igniterealtime/Smack
smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoManager.java
OmemoManager.getInstanceFor
public static synchronized OmemoManager getInstanceFor(XMPPConnection connection) { TreeMap<Integer, OmemoManager> managers = INSTANCES.get(connection); if (managers == null) { managers = new TreeMap<>(); INSTANCES.put(connection, managers); } OmemoManager manager; if (managers.size() == 0) { manager = new OmemoManager(connection, UNKNOWN_DEVICE_ID); managers.put(UNKNOWN_DEVICE_ID, manager); } else { manager = managers.get(managers.firstKey()); } return manager; }
java
public static synchronized OmemoManager getInstanceFor(XMPPConnection connection) { TreeMap<Integer, OmemoManager> managers = INSTANCES.get(connection); if (managers == null) { managers = new TreeMap<>(); INSTANCES.put(connection, managers); } OmemoManager manager; if (managers.size() == 0) { manager = new OmemoManager(connection, UNKNOWN_DEVICE_ID); managers.put(UNKNOWN_DEVICE_ID, manager); } else { manager = managers.get(managers.firstKey()); } return manager; }
[ "public", "static", "synchronized", "OmemoManager", "getInstanceFor", "(", "XMPPConnection", "connection", ")", "{", "TreeMap", "<", "Integer", ",", "OmemoManager", ">", "managers", "=", "INSTANCES", ".", "get", "(", "connection", ")", ";", "if", "(", "managers"...
Returns an OmemoManager instance for the given connection. If there was one manager for the connection before, return it. If there were multiple managers before, return the one with the lowest deviceId. If there was no manager before, return a new one. As soon as the connection gets authenticated, the manager will look for local deviceIDs and select the lowest one as its id. If there are not local deviceIds, the manager will assign itself a random id. @param connection XmppConnection. @return manager
[ "Returns", "an", "OmemoManager", "instance", "for", "the", "given", "connection", ".", "If", "there", "was", "one", "manager", "for", "the", "connection", "before", "return", "it", ".", "If", "there", "were", "multiple", "managers", "before", "return", "the", ...
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoManager.java#L185-L203
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java
DataStream.timeWindowAll
public AllWindowedStream<T, TimeWindow> timeWindowAll(Time size, Time slide) { if (environment.getStreamTimeCharacteristic() == TimeCharacteristic.ProcessingTime) { return windowAll(SlidingProcessingTimeWindows.of(size, slide)); } else { return windowAll(SlidingEventTimeWindows.of(size, slide)); } }
java
public AllWindowedStream<T, TimeWindow> timeWindowAll(Time size, Time slide) { if (environment.getStreamTimeCharacteristic() == TimeCharacteristic.ProcessingTime) { return windowAll(SlidingProcessingTimeWindows.of(size, slide)); } else { return windowAll(SlidingEventTimeWindows.of(size, slide)); } }
[ "public", "AllWindowedStream", "<", "T", ",", "TimeWindow", ">", "timeWindowAll", "(", "Time", "size", ",", "Time", "slide", ")", "{", "if", "(", "environment", ".", "getStreamTimeCharacteristic", "(", ")", "==", "TimeCharacteristic", ".", "ProcessingTime", ")",...
Windows this {@code DataStream} into sliding time windows. <p>This is a shortcut for either {@code .window(SlidingEventTimeWindows.of(size, slide))} or {@code .window(SlidingProcessingTimeWindows.of(size, slide))} depending on the time characteristic set using {@link org.apache.flink.streaming.api.environment.StreamExecutionEnvironment#setStreamTimeCharacteristic(org.apache.flink.streaming.api.TimeCharacteristic)} <p>Note: This operation is inherently non-parallel since all elements have to pass through the same operator instance. @param size The size of the window.
[ "Windows", "this", "{", "@code", "DataStream", "}", "into", "sliding", "time", "windows", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/DataStream.java#L764-L770
exoplatform/jcr
exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MembershipHandlerImpl.java
MembershipHandlerImpl.findMembershipsByUser
private MembershipsByUserWrapper findMembershipsByUser(Session session, String userName) throws Exception { Node userNode; try { userNode = utils.getUserNode(session, userName); } catch (PathNotFoundException e) { return new MembershipsByUserWrapper(new ArrayList<Membership>(), new ArrayList<Node>()); } List<Membership> memberships = new ArrayList<Membership>(); List<Node> refUserNodes = new ArrayList<Node>(); PropertyIterator refUserProps = userNode.getReferences(); while (refUserProps.hasNext()) { Node refUserNode = refUserProps.nextProperty().getParent(); Node groupNode = refUserNode.getParent().getParent(); memberships.addAll(findMembershipsByUserAndGroup(session, refUserNode, groupNode)); refUserNodes.add(refUserNode); } return new MembershipsByUserWrapper(memberships, refUserNodes); }
java
private MembershipsByUserWrapper findMembershipsByUser(Session session, String userName) throws Exception { Node userNode; try { userNode = utils.getUserNode(session, userName); } catch (PathNotFoundException e) { return new MembershipsByUserWrapper(new ArrayList<Membership>(), new ArrayList<Node>()); } List<Membership> memberships = new ArrayList<Membership>(); List<Node> refUserNodes = new ArrayList<Node>(); PropertyIterator refUserProps = userNode.getReferences(); while (refUserProps.hasNext()) { Node refUserNode = refUserProps.nextProperty().getParent(); Node groupNode = refUserNode.getParent().getParent(); memberships.addAll(findMembershipsByUserAndGroup(session, refUserNode, groupNode)); refUserNodes.add(refUserNode); } return new MembershipsByUserWrapper(memberships, refUserNodes); }
[ "private", "MembershipsByUserWrapper", "findMembershipsByUser", "(", "Session", "session", ",", "String", "userName", ")", "throws", "Exception", "{", "Node", "userNode", ";", "try", "{", "userNode", "=", "utils", ".", "getUserNode", "(", "session", ",", "userName...
Use this method to find all the memberships of an user in any group.
[ "Use", "this", "method", "to", "find", "all", "the", "memberships", "of", "an", "user", "in", "any", "group", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MembershipHandlerImpl.java#L380-L406
westnordost/osmapi
src/main/java/de/westnordost/osmapi/map/MapDataDao.java
MapDataDao.updateChangeset
public void updateChangeset(long changesetId, final Map<String, String> tags) { osm.makeAuthenticatedRequest("changeset/"+changesetId, "PUT", createOsmChangesetTagsWriter(tags), null); }
java
public void updateChangeset(long changesetId, final Map<String, String> tags) { osm.makeAuthenticatedRequest("changeset/"+changesetId, "PUT", createOsmChangesetTagsWriter(tags), null); }
[ "public", "void", "updateChangeset", "(", "long", "changesetId", ",", "final", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "osm", ".", "makeAuthenticatedRequest", "(", "\"changeset/\"", "+", "changesetId", ",", "\"PUT\"", ",", "createOsmChangeset...
Set new the tags of a changeset (the old set of tags is deleted) @param tags the new tags of this changeset @throws OsmConflictException if the changeset has already been closed @throws OsmNotFoundException if the changeset does not exist (yet) @throws OsmAuthorizationException if the application does not have permission to edit the map (Permission.MODIFY_MAP)
[ "Set", "new", "the", "tags", "of", "a", "changeset", "(", "the", "old", "set", "of", "tags", "is", "deleted", ")" ]
train
https://github.com/westnordost/osmapi/blob/dda6978fd12e117d0cf17812bc22037f61e22c4b/src/main/java/de/westnordost/osmapi/map/MapDataDao.java#L146-L150
gresrun/jesque
src/main/java/net/greghaines/jesque/utils/JesqueUtils.java
JesqueUtils.recreateThrowable
public static Throwable recreateThrowable(final String type, final String message, final List<String> backtrace) throws ParseException, ClassNotFoundException, NoSuchConstructorException, AmbiguousConstructorException, ReflectiveOperationException { final LinkedList<String> bTrace = new LinkedList<String>(backtrace); Throwable cause = null; StackTraceElement[] stes = null; while (!bTrace.isEmpty()) { stes = recreateStackTrace(bTrace); if (!bTrace.isEmpty()) { final String line = bTrace.removeLast().substring(BT_CAUSED_BY_PREFIX.length()); final String[] classNameAndMsg = COLON_SPACE_PATTERN.split(line, 2); final String msg = (classNameAndMsg.length == 2) ? classNameAndMsg[1] : null; cause = instantiateThrowable(classNameAndMsg[0], msg, cause, stes); } } return instantiateThrowable(type, message, cause, stes); }
java
public static Throwable recreateThrowable(final String type, final String message, final List<String> backtrace) throws ParseException, ClassNotFoundException, NoSuchConstructorException, AmbiguousConstructorException, ReflectiveOperationException { final LinkedList<String> bTrace = new LinkedList<String>(backtrace); Throwable cause = null; StackTraceElement[] stes = null; while (!bTrace.isEmpty()) { stes = recreateStackTrace(bTrace); if (!bTrace.isEmpty()) { final String line = bTrace.removeLast().substring(BT_CAUSED_BY_PREFIX.length()); final String[] classNameAndMsg = COLON_SPACE_PATTERN.split(line, 2); final String msg = (classNameAndMsg.length == 2) ? classNameAndMsg[1] : null; cause = instantiateThrowable(classNameAndMsg[0], msg, cause, stes); } } return instantiateThrowable(type, message, cause, stes); }
[ "public", "static", "Throwable", "recreateThrowable", "(", "final", "String", "type", ",", "final", "String", "message", ",", "final", "List", "<", "String", ">", "backtrace", ")", "throws", "ParseException", ",", "ClassNotFoundException", ",", "NoSuchConstructorExc...
Recreate an exception from a type name, a message and a backtrace (created from <code>JesqueUtils.createBacktrace(Throwable)</code>). <p> <b>Limitations:</b><br> This method cannot recreate Throwables with unusual/custom Constructors. <ul> <li>If the message is non-null and the cause is null, there must be a Constructor with a single String as it's only parameter.</li> <li>If the message is non-null and the cause is non-null, there must be a Constructor with a single String as it's only parameter or a Constructor with a String and a Throwable as its parameters.</li> <li>If the message is null and the cause is null, there must be either a no-arg Constructor or a Constructor with a single String as it's only parameter.</li> <li>If the message is null and the cause is non-null, there must be either a no-arg Constructor, a Constructor with a single String as its only parameter or a Constructor with a String and a Throwable as its parameters.</li> </ul> @param type the String name of the Throwable type @param message the message of the exception @param backtrace the backtrace of the exception @return a new Throwable of the given type with the given message and given backtrace/causes @throws ParseException if there is a problem parsing the given backtrace @throws ClassNotFoundException if the given type is not available @throws NoSuchConstructorException if there is not a common constructor available for the given type @throws AmbiguousConstructorException if there is more than one constructor that is viable @throws InstantiationException if there is a problem instantiating the given type @throws IllegalAccessException if the common constructor is not visible @throws InvocationTargetException if the constructor threw an exception @see JesqueUtils#createBacktrace(Throwable)
[ "Recreate", "an", "exception", "from", "a", "type", "name", "a", "message", "and", "a", "backtrace", "(", "created", "from", "<code", ">", "JesqueUtils", ".", "createBacktrace", "(", "Throwable", ")", "<", "/", "code", ">", ")", ".", "<p", ">", "<b", "...
train
https://github.com/gresrun/jesque/blob/44749183dccc40962a94c2af547ea7d0d880b5d1/src/main/java/net/greghaines/jesque/utils/JesqueUtils.java#L210-L226
wildfly-swarm-archive/ARCHIVE-wildfly-swarm
batch-jberet/api/src/main/java/org/wildfly/swarm/batch/jberet/BatchFraction.java
BatchFraction.jdbcJobRepository
public BatchFraction jdbcJobRepository(final String name, final DatasourcesFraction datasource) { return jdbcJobRepository(new JDBCJobRepository<>(name).dataSource(datasource.getKey())); }
java
public BatchFraction jdbcJobRepository(final String name, final DatasourcesFraction datasource) { return jdbcJobRepository(new JDBCJobRepository<>(name).dataSource(datasource.getKey())); }
[ "public", "BatchFraction", "jdbcJobRepository", "(", "final", "String", "name", ",", "final", "DatasourcesFraction", "datasource", ")", "{", "return", "jdbcJobRepository", "(", "new", "JDBCJobRepository", "<>", "(", "name", ")", ".", "dataSource", "(", "datasource",...
Creates a new JDBC job repository. @param name the name for the job repository @param datasource the datasource to use to connect to the database @return this fraction
[ "Creates", "a", "new", "JDBC", "job", "repository", "." ]
train
https://github.com/wildfly-swarm-archive/ARCHIVE-wildfly-swarm/blob/28ef71bcfa743a7267666e0ed2919c37b356c09b/batch-jberet/api/src/main/java/org/wildfly/swarm/batch/jberet/BatchFraction.java#L130-L132
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java
StyleUtils.setFeatureStyle
public static boolean setFeatureStyle(PolygonOptions polygonOptions, FeatureStyleExtension featureStyleExtension, FeatureRow featureRow, float density) { FeatureStyle featureStyle = featureStyleExtension.getFeatureStyle(featureRow); return setFeatureStyle(polygonOptions, featureStyle, density); }
java
public static boolean setFeatureStyle(PolygonOptions polygonOptions, FeatureStyleExtension featureStyleExtension, FeatureRow featureRow, float density) { FeatureStyle featureStyle = featureStyleExtension.getFeatureStyle(featureRow); return setFeatureStyle(polygonOptions, featureStyle, density); }
[ "public", "static", "boolean", "setFeatureStyle", "(", "PolygonOptions", "polygonOptions", ",", "FeatureStyleExtension", "featureStyleExtension", ",", "FeatureRow", "featureRow", ",", "float", "density", ")", "{", "FeatureStyle", "featureStyle", "=", "featureStyleExtension"...
Set the feature row style into the polygon options @param polygonOptions polygon options @param featureStyleExtension feature style extension @param featureRow feature row @param density display density: {@link android.util.DisplayMetrics#density} @return true if style was set into the polygon options
[ "Set", "the", "feature", "row", "style", "into", "the", "polygon", "options" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java#L537-L542
chhh/MSFTBX
MSFileToolbox/src/main/java/umich/ms/util/base64/Base64Slow.java
Base64Slow.decodeToString
public static String decodeToString(byte[] bytes, String enc) throws UnsupportedEncodingException { return new String(decode(bytes), enc); }
java
public static String decodeToString(byte[] bytes, String enc) throws UnsupportedEncodingException { return new String(decode(bytes), enc); }
[ "public", "static", "String", "decodeToString", "(", "byte", "[", "]", "bytes", ",", "String", "enc", ")", "throws", "UnsupportedEncodingException", "{", "return", "new", "String", "(", "decode", "(", "bytes", ")", ",", "enc", ")", ";", "}" ]
Decode Base64 encoded bytes. Characters that are not part of the Base64 alphabet are ignored in the input. @param bytes The data to decode. @param enc Character encoding to use when converting to and from bytes. @return A decoded String. @throws UnsupportedEncodingException if the character encoding specified is not supported. @since ostermillerutils 1.02.16
[ "Decode", "Base64", "encoded", "bytes", ".", "Characters", "that", "are", "not", "part", "of", "the", "Base64", "alphabet", "are", "ignored", "in", "the", "input", "." ]
train
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/base64/Base64Slow.java#L586-L589
Canadensys/canadensys-core
src/main/java/net/canadensys/utils/NumberUtils.java
NumberUtils.parseNumber
public static <T> T parseNumber(String value, Class<T> targetClass, T defaultValue){ T number = parseNumber(value,targetClass); if(number == null){ return defaultValue; } return number; }
java
public static <T> T parseNumber(String value, Class<T> targetClass, T defaultValue){ T number = parseNumber(value,targetClass); if(number == null){ return defaultValue; } return number; }
[ "public", "static", "<", "T", ">", "T", "parseNumber", "(", "String", "value", ",", "Class", "<", "T", ">", "targetClass", ",", "T", "defaultValue", ")", "{", "T", "number", "=", "parseNumber", "(", "value", ",", "targetClass", ")", ";", "if", "(", "...
Tries to parse value into the targetClass. The implementation is no elegant, but it's faster than targetClass.getConstructor(String.class).newInstance(value); @param value @param targetClass @param defaultValue default value to return if the value can not be parsed. @return T instance of value or defaultValue if the parsing failed
[ "Tries", "to", "parse", "value", "into", "the", "targetClass", ".", "The", "implementation", "is", "no", "elegant", "but", "it", "s", "faster", "than", "targetClass", ".", "getConstructor", "(", "String", ".", "class", ")", ".", "newInstance", "(", "value", ...
train
https://github.com/Canadensys/canadensys-core/blob/5e13569f7c0f4cdc7080da72643ff61123ad76fd/src/main/java/net/canadensys/utils/NumberUtils.java#L60-L66
apache/reef
lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/client/FileSet.java
FileSet.copyTo
void copyTo(final File destinationFolder) throws IOException { for (final File f : this.theFiles) { final File destinationFile = new File(destinationFolder, f.getName()); Files.copy(f.toPath(), destinationFile.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING); } }
java
void copyTo(final File destinationFolder) throws IOException { for (final File f : this.theFiles) { final File destinationFile = new File(destinationFolder, f.getName()); Files.copy(f.toPath(), destinationFile.toPath(), java.nio.file.StandardCopyOption.REPLACE_EXISTING); } }
[ "void", "copyTo", "(", "final", "File", "destinationFolder", ")", "throws", "IOException", "{", "for", "(", "final", "File", "f", ":", "this", ".", "theFiles", ")", "{", "final", "File", "destinationFile", "=", "new", "File", "(", "destinationFolder", ",", ...
Copies all files in the current FileSet to the given destinationFolder. @param destinationFolder the folder where the files shall be copied to. @throws IOException
[ "Copies", "all", "files", "in", "the", "current", "FileSet", "to", "the", "given", "destinationFolder", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-local/src/main/java/org/apache/reef/runtime/local/client/FileSet.java#L79-L84
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/time/DateUtils.java
DateUtils.toCalendar
@GwtIncompatible("incompatible method") public static Calendar toCalendar(final Date date, final TimeZone tz) { final Calendar c = Calendar.getInstance(tz); c.setTime(date); return c; }
java
@GwtIncompatible("incompatible method") public static Calendar toCalendar(final Date date, final TimeZone tz) { final Calendar c = Calendar.getInstance(tz); c.setTime(date); return c; }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "static", "Calendar", "toCalendar", "(", "final", "Date", "date", ",", "final", "TimeZone", "tz", ")", "{", "final", "Calendar", "c", "=", "Calendar", ".", "getInstance", "(", "tz", ")", ...
Converts a {@code Date} of a given {@code TimeZone} into a {@code Calendar} @param date the date to convert to a Calendar @param tz the time zone of the {@code date} @return the created Calendar @throws NullPointerException if {@code date} or {@code tz} is null
[ "Converts", "a", "{" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DateUtils.java#L681-L686
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/i18n/dao/GeneratedDi18nDaoImpl.java
GeneratedDi18nDaoImpl.queryByCreatedBy
public Iterable<Di18n> queryByCreatedBy(java.lang.String createdBy) { return queryByField(null, Di18nMapper.Field.CREATEDBY.getFieldName(), createdBy); }
java
public Iterable<Di18n> queryByCreatedBy(java.lang.String createdBy) { return queryByField(null, Di18nMapper.Field.CREATEDBY.getFieldName(), createdBy); }
[ "public", "Iterable", "<", "Di18n", ">", "queryByCreatedBy", "(", "java", ".", "lang", ".", "String", "createdBy", ")", "{", "return", "queryByField", "(", "null", ",", "Di18nMapper", ".", "Field", ".", "CREATEDBY", ".", "getFieldName", "(", ")", ",", "cre...
query-by method for field createdBy @param createdBy the specified attribute @return an Iterable of Di18ns for the specified createdBy
[ "query", "-", "by", "method", "for", "field", "createdBy" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/i18n/dao/GeneratedDi18nDaoImpl.java#L52-L54
apache/groovy
subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java
SwingGroovyMethods.leftShift
public static TableColumnModel leftShift(TableColumnModel self, TableColumn column) { self.addColumn(column); return self; }
java
public static TableColumnModel leftShift(TableColumnModel self, TableColumn column) { self.addColumn(column); return self; }
[ "public", "static", "TableColumnModel", "leftShift", "(", "TableColumnModel", "self", ",", "TableColumn", "column", ")", "{", "self", ".", "addColumn", "(", "column", ")", ";", "return", "self", ";", "}" ]
Overloads the left shift operator to provide an easy way to add columns to a TableColumnModel. @param self a TableColumnModel @param column a TableColumn to be added to the model. @return same model, after the value was added to it. @since 1.6.4
[ "Overloads", "the", "left", "shift", "operator", "to", "provide", "an", "easy", "way", "to", "add", "columns", "to", "a", "TableColumnModel", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L593-L596
antopen/alipay-sdk-java
src/main/java/com/alipay/api/internal/util/XmlUtils.java
XmlUtils.validateXml
public static void validateXml(Node doc, InputStream schemaStream) throws AlipayApiException { try { Source source = new StreamSource(schemaStream); Schema schema = SchemaFactory.newInstance( XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(source); Validator validator = schema.newValidator(); validator.validate(new DOMSource(doc)); } catch (SAXException e) { throw new AlipayApiException("XML_VALIDATE_ERROR", e); } catch (IOException e) { throw new AlipayApiException("XML_READ_ERROR", e); } finally { if (schemaStream != null) { try { schemaStream.close(); } catch (IOException e) { // nothing to do } } } }
java
public static void validateXml(Node doc, InputStream schemaStream) throws AlipayApiException { try { Source source = new StreamSource(schemaStream); Schema schema = SchemaFactory.newInstance( XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(source); Validator validator = schema.newValidator(); validator.validate(new DOMSource(doc)); } catch (SAXException e) { throw new AlipayApiException("XML_VALIDATE_ERROR", e); } catch (IOException e) { throw new AlipayApiException("XML_READ_ERROR", e); } finally { if (schemaStream != null) { try { schemaStream.close(); } catch (IOException e) { // nothing to do } } } }
[ "public", "static", "void", "validateXml", "(", "Node", "doc", ",", "InputStream", "schemaStream", ")", "throws", "AlipayApiException", "{", "try", "{", "Source", "source", "=", "new", "StreamSource", "(", "schemaStream", ")", ";", "Schema", "schema", "=", "Sc...
Validates the element tree context via given XML schema file. @param doc the XML document to validate @param schemaStream the XML schema file input stream @throws ApiException error occurs if validation fail
[ "Validates", "the", "element", "tree", "context", "via", "given", "XML", "schema", "file", "." ]
train
https://github.com/antopen/alipay-sdk-java/blob/e82aeac7d0239330ee173c7e393596e51e41c1cd/src/main/java/com/alipay/api/internal/util/XmlUtils.java#L536-L558
meltmedia/cadmium
core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java
WarUtils.addFilterMapping
public static void addFilterMapping(Document doc, Element root) { Element filterMapping = doc.createElement("filter-mapping"); Element filterName = doc.createElement("filter-name"); filterName.appendChild(doc.createTextNode("ShiroFilter")); filterMapping.appendChild(filterName); Element urlPattern = doc.createElement("url-pattern"); urlPattern.appendChild(doc.createTextNode("/*")); filterMapping.appendChild(urlPattern); addDispatchers(doc, filterMapping, "REQUEST", "FORWARD", "INCLUDE", "ERROR"); addRelativeTo(root, filterMapping, "filter-mapping", true); }
java
public static void addFilterMapping(Document doc, Element root) { Element filterMapping = doc.createElement("filter-mapping"); Element filterName = doc.createElement("filter-name"); filterName.appendChild(doc.createTextNode("ShiroFilter")); filterMapping.appendChild(filterName); Element urlPattern = doc.createElement("url-pattern"); urlPattern.appendChild(doc.createTextNode("/*")); filterMapping.appendChild(urlPattern); addDispatchers(doc, filterMapping, "REQUEST", "FORWARD", "INCLUDE", "ERROR"); addRelativeTo(root, filterMapping, "filter-mapping", true); }
[ "public", "static", "void", "addFilterMapping", "(", "Document", "doc", ",", "Element", "root", ")", "{", "Element", "filterMapping", "=", "doc", ".", "createElement", "(", "\"filter-mapping\"", ")", ";", "Element", "filterName", "=", "doc", ".", "createElement"...
Adds the filter mapping for the shiro filter to a web.xml file. @param doc The xml DOM document to create the new xml elements with. @param root The xml Element node to add the filter mapping to.
[ "Adds", "the", "filter", "mapping", "for", "the", "shiro", "filter", "to", "a", "web", ".", "xml", "file", "." ]
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/WarUtils.java#L331-L343
ngageoint/geopackage-java
src/main/java/mil/nga/geopackage/property/GeoPackageJavaProperties.java
GeoPackageJavaProperties.getProperty
public static String getProperty(String base, String property) { return getProperty(base, property, true); }
java
public static String getProperty(String base, String property) { return getProperty(base, property, true); }
[ "public", "static", "String", "getProperty", "(", "String", "base", ",", "String", "property", ")", "{", "return", "getProperty", "(", "base", ",", "property", ",", "true", ")", ";", "}" ]
Get a required property by base property and property name @param base base property @param property property @return property value
[ "Get", "a", "required", "property", "by", "base", "property", "and", "property", "name" ]
train
https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/property/GeoPackageJavaProperties.java#L69-L71
samskivert/samskivert
src/main/java/com/samskivert/swing/util/MenuUtil.java
MenuUtil.addMenuItem
public static JMenuItem addMenuItem ( JMenu menu, String name, int mnem, KeyStroke accel, Object target, String callbackName) { JMenuItem item = createItem(name, Integer.valueOf(mnem), accel); item.addActionListener(new ReflectedAction(target, callbackName)); menu.add(item); return item; }
java
public static JMenuItem addMenuItem ( JMenu menu, String name, int mnem, KeyStroke accel, Object target, String callbackName) { JMenuItem item = createItem(name, Integer.valueOf(mnem), accel); item.addActionListener(new ReflectedAction(target, callbackName)); menu.add(item); return item; }
[ "public", "static", "JMenuItem", "addMenuItem", "(", "JMenu", "menu", ",", "String", "name", ",", "int", "mnem", ",", "KeyStroke", "accel", ",", "Object", "target", ",", "String", "callbackName", ")", "{", "JMenuItem", "item", "=", "createItem", "(", "name",...
Adds a new menu item to the menu with the specified name and attributes. The supplied method name will be called (it must have the same signature as {@link ActionListener#actionPerformed} but can be named whatever you like) when the menu item is selected. @param menu the menu to add the item to. @param name the item name. @param mnem the mnemonic key for the item. @param accel the keystroke for the item or null if none. @param target the object on which to invoke a method when the menu is selected. @param callbackName the name of the method to invoke when the menu is selected. @return the new menu item.
[ "Adds", "a", "new", "menu", "item", "to", "the", "menu", "with", "the", "specified", "name", "and", "attributes", ".", "The", "supplied", "method", "name", "will", "be", "called", "(", "it", "must", "have", "the", "same", "signature", "as", "{", "@link",...
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/swing/util/MenuUtil.java#L120-L127
reactor/reactor-netty
src/main/java/reactor/netty/http/client/HttpClient.java
HttpClient.baseUrl
public final HttpClient baseUrl(String baseUrl) { Objects.requireNonNull(baseUrl, "baseUrl"); return tcpConfiguration(tcp -> tcp.bootstrap(b -> HttpClientConfiguration.baseUrl(b, baseUrl))); }
java
public final HttpClient baseUrl(String baseUrl) { Objects.requireNonNull(baseUrl, "baseUrl"); return tcpConfiguration(tcp -> tcp.bootstrap(b -> HttpClientConfiguration.baseUrl(b, baseUrl))); }
[ "public", "final", "HttpClient", "baseUrl", "(", "String", "baseUrl", ")", "{", "Objects", ".", "requireNonNull", "(", "baseUrl", ",", "\"baseUrl\"", ")", ";", "return", "tcpConfiguration", "(", "tcp", "->", "tcp", ".", "bootstrap", "(", "b", "->", "HttpClie...
Configure URI to use for this request/response @param baseUrl a default base url that can be fully sufficient for request or can be used to prepend future {@link UriConfiguration#uri} calls. @return the appropriate sending or receiving contract
[ "Configure", "URI", "to", "use", "for", "this", "request", "/", "response" ]
train
https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/http/client/HttpClient.java#L370-L373
sagiegurari/fax4j
src/main/java/org/fax4j/spi/http/TemplateFaxJob2HTTPRequestConverter.java
TemplateFaxJob2HTTPRequestConverter.formatHTTPURLParameters
protected String formatHTTPURLParameters(HTTPFaxClientSpi faxClientSpi,FaxJob faxJob) { //get URL parameters String urlParametersTemplate=faxClientSpi.getHTTPURLParameters(); //format URL parameters String urlParameters=SpiUtil.formatTemplate(urlParametersTemplate,faxJob,SpiUtil.URL_ENCODER,false,false); return urlParameters; }
java
protected String formatHTTPURLParameters(HTTPFaxClientSpi faxClientSpi,FaxJob faxJob) { //get URL parameters String urlParametersTemplate=faxClientSpi.getHTTPURLParameters(); //format URL parameters String urlParameters=SpiUtil.formatTemplate(urlParametersTemplate,faxJob,SpiUtil.URL_ENCODER,false,false); return urlParameters; }
[ "protected", "String", "formatHTTPURLParameters", "(", "HTTPFaxClientSpi", "faxClientSpi", ",", "FaxJob", "faxJob", ")", "{", "//get URL parameters", "String", "urlParametersTemplate", "=", "faxClientSpi", ".", "getHTTPURLParameters", "(", ")", ";", "//format URL parameters...
This function formats the HTTP URL parameters. @param faxClientSpi The HTTP fax client SPI @param faxJob The fax job object @return The formatted HTTP URL parameters
[ "This", "function", "formats", "the", "HTTP", "URL", "parameters", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/http/TemplateFaxJob2HTTPRequestConverter.java#L328-L337
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/basic/servicegroup_binding.java
servicegroup_binding.get
public static servicegroup_binding get(nitro_service service, String servicegroupname) throws Exception{ servicegroup_binding obj = new servicegroup_binding(); obj.set_servicegroupname(servicegroupname); servicegroup_binding response = (servicegroup_binding) obj.get_resource(service); return response; }
java
public static servicegroup_binding get(nitro_service service, String servicegroupname) throws Exception{ servicegroup_binding obj = new servicegroup_binding(); obj.set_servicegroupname(servicegroupname); servicegroup_binding response = (servicegroup_binding) obj.get_resource(service); return response; }
[ "public", "static", "servicegroup_binding", "get", "(", "nitro_service", "service", ",", "String", "servicegroupname", ")", "throws", "Exception", "{", "servicegroup_binding", "obj", "=", "new", "servicegroup_binding", "(", ")", ";", "obj", ".", "set_servicegroupname"...
Use this API to fetch servicegroup_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "servicegroup_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/basic/servicegroup_binding.java#L125-L130
irmen/Pyrolite
java/src/main/java/net/razorvine/pyro/PyroProxy.java
PyroProxy.setattr
public void setattr(String attr, Object value) throws PickleException, PyroException, IOException { this.internal_call("__setattr__", null, 0, false, attr, value); }
java
public void setattr(String attr, Object value) throws PickleException, PyroException, IOException { this.internal_call("__setattr__", null, 0, false, attr, value); }
[ "public", "void", "setattr", "(", "String", "attr", ",", "Object", "value", ")", "throws", "PickleException", ",", "PyroException", ",", "IOException", "{", "this", ".", "internal_call", "(", "\"__setattr__\"", ",", "null", ",", "0", ",", "false", ",", "attr...
Set a new value on a remote attribute. @param attr the attribute name @param value the new value for the attribute
[ "Set", "a", "new", "value", "on", "a", "remote", "attribute", "." ]
train
https://github.com/irmen/Pyrolite/blob/060bc3c9069cd31560b6da4f67280736fb2cdf63/java/src/main/java/net/razorvine/pyro/PyroProxy.java#L203-L205
fernandospr/java-wns
src/main/java/ar/com/fernandospr/wns/WnsService.java
WnsService.pushToast
public WnsNotificationResponse pushToast(String channelUri, WnsNotificationRequestOptional optional, WnsToast toast) throws WnsException { return this.client.push(xmlResourceBuilder, channelUri, toast, this.retryPolicy, optional); }
java
public WnsNotificationResponse pushToast(String channelUri, WnsNotificationRequestOptional optional, WnsToast toast) throws WnsException { return this.client.push(xmlResourceBuilder, channelUri, toast, this.retryPolicy, optional); }
[ "public", "WnsNotificationResponse", "pushToast", "(", "String", "channelUri", ",", "WnsNotificationRequestOptional", "optional", ",", "WnsToast", "toast", ")", "throws", "WnsException", "{", "return", "this", ".", "client", ".", "push", "(", "xmlResourceBuilder", ","...
Pushes a toast to channelUri using optional headers @param channelUri @param optional @param toast which should be built with {@link ar.com.fernandospr.wns.model.builders.WnsToastBuilder} @return WnsNotificationResponse please see response headers from <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response">http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response</a> @throws WnsException when authentication fails
[ "Pushes", "a", "toast", "to", "channelUri", "using", "optional", "headers" ]
train
https://github.com/fernandospr/java-wns/blob/cd621b9c17d1e706f6284e0913531d834904a90d/src/main/java/ar/com/fernandospr/wns/WnsService.java#L134-L136
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/TaskState.java
TaskState.updateRecordMetrics
public synchronized void updateRecordMetrics(long recordsWritten, int branchIndex) { TaskMetrics metrics = TaskMetrics.get(this); // chopping branch index from metric name // String forkBranchId = ForkOperatorUtils.getForkId(this.taskId, branchIndex); String forkBranchId = TaskMetrics.taskInstanceRemoved(this.taskId); Counter taskRecordCounter = metrics.getCounter(MetricGroup.TASK.name(), forkBranchId, RECORDS); long inc = recordsWritten - taskRecordCounter.getCount(); taskRecordCounter.inc(inc); metrics.getMeter(MetricGroup.TASK.name(), forkBranchId, RECORDS_PER_SECOND).mark(inc); metrics.getCounter(MetricGroup.JOB.name(), this.jobId, RECORDS).inc(inc); metrics.getMeter(MetricGroup.JOB.name(), this.jobId, RECORDS_PER_SECOND).mark(inc); }
java
public synchronized void updateRecordMetrics(long recordsWritten, int branchIndex) { TaskMetrics metrics = TaskMetrics.get(this); // chopping branch index from metric name // String forkBranchId = ForkOperatorUtils.getForkId(this.taskId, branchIndex); String forkBranchId = TaskMetrics.taskInstanceRemoved(this.taskId); Counter taskRecordCounter = metrics.getCounter(MetricGroup.TASK.name(), forkBranchId, RECORDS); long inc = recordsWritten - taskRecordCounter.getCount(); taskRecordCounter.inc(inc); metrics.getMeter(MetricGroup.TASK.name(), forkBranchId, RECORDS_PER_SECOND).mark(inc); metrics.getCounter(MetricGroup.JOB.name(), this.jobId, RECORDS).inc(inc); metrics.getMeter(MetricGroup.JOB.name(), this.jobId, RECORDS_PER_SECOND).mark(inc); }
[ "public", "synchronized", "void", "updateRecordMetrics", "(", "long", "recordsWritten", ",", "int", "branchIndex", ")", "{", "TaskMetrics", "metrics", "=", "TaskMetrics", ".", "get", "(", "this", ")", ";", "// chopping branch index from metric name", "// String forkBran...
Update record-level metrics. @param recordsWritten number of records written by the writer @param branchIndex fork branch index @deprecated see {@link org.apache.gobblin.instrumented.writer.InstrumentedDataWriterBase}.
[ "Update", "record", "-", "level", "metrics", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/TaskState.java#L256-L268
census-instrumentation/opencensus-java
contrib/agent/src/main/java/io/opencensus/contrib/agent/AgentMain.java
AgentMain.premain
public static void premain(String agentArgs, Instrumentation instrumentation) throws Exception { checkNotNull(instrumentation, "instrumentation"); logger.fine("Initializing."); // The classes in bootstrap.jar, such as ContextManger and ContextStrategy, will be referenced // from classes loaded by the bootstrap classloader. Thus, these classes have to be loaded by // the bootstrap classloader, too. instrumentation.appendToBootstrapClassLoaderSearch( new JarFile(Resources.getResourceAsTempFile("bootstrap.jar"))); checkLoadedByBootstrapClassloader(ContextTrampoline.class); checkLoadedByBootstrapClassloader(ContextStrategy.class); Settings settings = Settings.load(); AgentBuilder agentBuilder = new AgentBuilder.Default() .disableClassFormatChanges() .with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION) .with(new AgentBuilderListener()) .ignore(none()); for (Instrumenter instrumenter : ServiceLoader.load(Instrumenter.class)) { agentBuilder = instrumenter.instrument(agentBuilder, settings); } agentBuilder.installOn(instrumentation); logger.fine("Initialized."); }
java
public static void premain(String agentArgs, Instrumentation instrumentation) throws Exception { checkNotNull(instrumentation, "instrumentation"); logger.fine("Initializing."); // The classes in bootstrap.jar, such as ContextManger and ContextStrategy, will be referenced // from classes loaded by the bootstrap classloader. Thus, these classes have to be loaded by // the bootstrap classloader, too. instrumentation.appendToBootstrapClassLoaderSearch( new JarFile(Resources.getResourceAsTempFile("bootstrap.jar"))); checkLoadedByBootstrapClassloader(ContextTrampoline.class); checkLoadedByBootstrapClassloader(ContextStrategy.class); Settings settings = Settings.load(); AgentBuilder agentBuilder = new AgentBuilder.Default() .disableClassFormatChanges() .with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION) .with(new AgentBuilderListener()) .ignore(none()); for (Instrumenter instrumenter : ServiceLoader.load(Instrumenter.class)) { agentBuilder = instrumenter.instrument(agentBuilder, settings); } agentBuilder.installOn(instrumentation); logger.fine("Initialized."); }
[ "public", "static", "void", "premain", "(", "String", "agentArgs", ",", "Instrumentation", "instrumentation", ")", "throws", "Exception", "{", "checkNotNull", "(", "instrumentation", ",", "\"instrumentation\"", ")", ";", "logger", ".", "fine", "(", "\"Initializing.\...
Initializes the OpenCensus Agent for Java. @param agentArgs agent options, passed as a single string by the JVM @param instrumentation the {@link Instrumentation} object provided by the JVM for instrumenting Java programming language code @throws Exception if initialization of the agent fails @see java.lang.instrument @since 0.6
[ "Initializes", "the", "OpenCensus", "Agent", "for", "Java", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/contrib/agent/src/main/java/io/opencensus/contrib/agent/AgentMain.java#L64-L91
JadiraOrg/jadira
jms/src/main/java/org/jadira/jms/template/BatchedJmsTemplate.java
BatchedJmsTemplate.receiveSelectedAndConvertBatch
public List<Object> receiveSelectedAndConvertBatch(Destination destination, String messageSelector) throws JmsException { return receiveSelectedAndConvertBatch(destination, messageSelector, getBatchSize()); }
java
public List<Object> receiveSelectedAndConvertBatch(Destination destination, String messageSelector) throws JmsException { return receiveSelectedAndConvertBatch(destination, messageSelector, getBatchSize()); }
[ "public", "List", "<", "Object", ">", "receiveSelectedAndConvertBatch", "(", "Destination", "destination", ",", "String", "messageSelector", ")", "throws", "JmsException", "{", "return", "receiveSelectedAndConvertBatch", "(", "destination", ",", "messageSelector", ",", ...
Receive a batch of up to default batch size for given Destination and message selector and convert each message in the batch. Other than batching this method is the same as {@link JmsTemplate#receiveSelectedAndConvert(Destination, String)} @return A list of {@link Message} @param destination The Destination @param messageSelector The Selector @throws JmsException The {@link JmsException}
[ "Receive", "a", "batch", "of", "up", "to", "default", "batch", "size", "for", "given", "Destination", "and", "message", "selector", "and", "convert", "each", "message", "in", "the", "batch", ".", "Other", "than", "batching", "this", "method", "is", "the", ...
train
https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/jms/src/main/java/org/jadira/jms/template/BatchedJmsTemplate.java#L381-L384
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_timeCondition_serviceName_options_PUT
public void billingAccount_timeCondition_serviceName_options_PUT(String billingAccount, String serviceName, OvhTimeConditionOptions body) throws IOException { String qPath = "/telephony/{billingAccount}/timeCondition/{serviceName}/options"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
java
public void billingAccount_timeCondition_serviceName_options_PUT(String billingAccount, String serviceName, OvhTimeConditionOptions body) throws IOException { String qPath = "/telephony/{billingAccount}/timeCondition/{serviceName}/options"; StringBuilder sb = path(qPath, billingAccount, serviceName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "billingAccount_timeCondition_serviceName_options_PUT", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "OvhTimeConditionOptions", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/timeConditi...
Alter this object properties REST: PUT /telephony/{billingAccount}/timeCondition/{serviceName}/options @param body [required] New object properties @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L5883-L5887
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/sequences/SequenceGibbsSampler.java
SequenceGibbsSampler.sampleSequenceRepeatedly
public void sampleSequenceRepeatedly(SequenceModel model, int numSamples) { int[] sequence = getRandomSequence(model); sampleSequenceRepeatedly(model, sequence, numSamples); }
java
public void sampleSequenceRepeatedly(SequenceModel model, int numSamples) { int[] sequence = getRandomSequence(model); sampleSequenceRepeatedly(model, sequence, numSamples); }
[ "public", "void", "sampleSequenceRepeatedly", "(", "SequenceModel", "model", ",", "int", "numSamples", ")", "{", "int", "[", "]", "sequence", "=", "getRandomSequence", "(", "model", ")", ";", "sampleSequenceRepeatedly", "(", "model", ",", "sequence", ",", "numSa...
Samples the sequence repeatedly, making numSamples passes over the entire sequence. Destructively modifies the sequence in place.
[ "Samples", "the", "sequence", "repeatedly", "making", "numSamples", "passes", "over", "the", "entire", "sequence", ".", "Destructively", "modifies", "the", "sequence", "in", "place", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/sequences/SequenceGibbsSampler.java#L179-L182
artikcloud/artikcloud-java
src/main/java/cloud/artik/api/SubscriptionsApi.java
SubscriptionsApi.getMessages
public NotifMessagesResponse getMessages(String notifId, Integer offset, Integer count, String order) throws ApiException { ApiResponse<NotifMessagesResponse> resp = getMessagesWithHttpInfo(notifId, offset, count, order); return resp.getData(); }
java
public NotifMessagesResponse getMessages(String notifId, Integer offset, Integer count, String order) throws ApiException { ApiResponse<NotifMessagesResponse> resp = getMessagesWithHttpInfo(notifId, offset, count, order); return resp.getData(); }
[ "public", "NotifMessagesResponse", "getMessages", "(", "String", "notifId", ",", "Integer", "offset", ",", "Integer", "count", ",", "String", "order", ")", "throws", "ApiException", "{", "ApiResponse", "<", "NotifMessagesResponse", ">", "resp", "=", "getMessagesWith...
Get Messages Get Messages @param notifId Notification ID. (required) @param offset Offset for pagination. (optional) @param count Desired count of items in the result set. (optional) @param order Sort order of results by ts. Either &#39;asc&#39; or &#39;desc&#39;. (optional) @return NotifMessagesResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Get", "Messages", "Get", "Messages" ]
train
https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/SubscriptionsApi.java#L499-L502
atomix/atomix
protocols/raft/src/main/java/io/atomix/protocols/raft/roles/AbstractAppender.java
AbstractAppender.buildAppendRequest
protected AppendRequest buildAppendRequest(RaftMemberContext member, long lastIndex) { final RaftLogReader reader = member.getLogReader(); // If the log is empty then send an empty commit. // If the next index hasn't yet been set then we send an empty commit first. // If the next index is greater than the last index then send an empty commit. // If the member failed to respond to recent communication send an empty commit. This // helps avoid doing expensive work until we can ascertain the member is back up. if (!reader.hasNext()) { return buildAppendEmptyRequest(member); } else if (member.getFailureCount() > 0) { return buildAppendEmptyRequest(member); } else { return buildAppendEntriesRequest(member, lastIndex); } }
java
protected AppendRequest buildAppendRequest(RaftMemberContext member, long lastIndex) { final RaftLogReader reader = member.getLogReader(); // If the log is empty then send an empty commit. // If the next index hasn't yet been set then we send an empty commit first. // If the next index is greater than the last index then send an empty commit. // If the member failed to respond to recent communication send an empty commit. This // helps avoid doing expensive work until we can ascertain the member is back up. if (!reader.hasNext()) { return buildAppendEmptyRequest(member); } else if (member.getFailureCount() > 0) { return buildAppendEmptyRequest(member); } else { return buildAppendEntriesRequest(member, lastIndex); } }
[ "protected", "AppendRequest", "buildAppendRequest", "(", "RaftMemberContext", "member", ",", "long", "lastIndex", ")", "{", "final", "RaftLogReader", "reader", "=", "member", ".", "getLogReader", "(", ")", ";", "// If the log is empty then send an empty commit.", "// If t...
Builds an append request. @param member The member to which to send the request. @return The append request.
[ "Builds", "an", "append", "request", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/protocols/raft/src/main/java/io/atomix/protocols/raft/roles/AbstractAppender.java#L74-L89
lessthanoptimal/ejml
main/ejml-simple/src/org/ejml/equation/Equation.java
Equation.addSubMatrixVariables
private void addSubMatrixVariables(List<TokenList.Token> inputs, List<Variable> variables) { for (int i = 0; i < inputs.size(); i++) { TokenList.Token t = inputs.get(i); if( t.getType() != Type.VARIABLE ) throw new ParseError("Expected variables only in sub-matrix input, not "+t.getType()); Variable v = t.getVariable(); if( v.getType() == VariableType.INTEGER_SEQUENCE || isVariableInteger(t) ) { variables.add(v); } else { throw new ParseError("Expected an integer, integer sequence, or array range to define a submatrix"); } } }
java
private void addSubMatrixVariables(List<TokenList.Token> inputs, List<Variable> variables) { for (int i = 0; i < inputs.size(); i++) { TokenList.Token t = inputs.get(i); if( t.getType() != Type.VARIABLE ) throw new ParseError("Expected variables only in sub-matrix input, not "+t.getType()); Variable v = t.getVariable(); if( v.getType() == VariableType.INTEGER_SEQUENCE || isVariableInteger(t) ) { variables.add(v); } else { throw new ParseError("Expected an integer, integer sequence, or array range to define a submatrix"); } } }
[ "private", "void", "addSubMatrixVariables", "(", "List", "<", "TokenList", ".", "Token", ">", "inputs", ",", "List", "<", "Variable", ">", "variables", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "inputs", ".", "size", "(", ")", ";", ...
Goes through the token lists and adds all the variables which can be used to define a sub-matrix. If anything else is found an excpetion is thrown
[ "Goes", "through", "the", "token", "lists", "and", "adds", "all", "the", "variables", "which", "can", "be", "used", "to", "define", "a", "sub", "-", "matrix", ".", "If", "anything", "else", "is", "found", "an", "excpetion", "is", "thrown" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L832-L844
census-instrumentation/opencensus-java
impl_core/src/main/java/io/opencensus/implcore/stats/MeasureToViewMap.java
MeasureToViewMap.getView
@javax.annotation.Nullable synchronized ViewData getView(View.Name viewName, Clock clock, State state) { MutableViewData view = getMutableViewData(viewName); return view == null ? null : view.toViewData(clock.now(), state); }
java
@javax.annotation.Nullable synchronized ViewData getView(View.Name viewName, Clock clock, State state) { MutableViewData view = getMutableViewData(viewName); return view == null ? null : view.toViewData(clock.now(), state); }
[ "@", "javax", ".", "annotation", ".", "Nullable", "synchronized", "ViewData", "getView", "(", "View", ".", "Name", "viewName", ",", "Clock", "clock", ",", "State", "state", ")", "{", "MutableViewData", "view", "=", "getMutableViewData", "(", "viewName", ")", ...
Returns a {@link ViewData} corresponding to the given {@link View.Name}.
[ "Returns", "a", "{" ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/impl_core/src/main/java/io/opencensus/implcore/stats/MeasureToViewMap.java#L72-L76
opentelecoms-org/jsmpp
jsmpp/src/main/java/org/jsmpp/util/RelativeTimeFormatter.java
RelativeTimeFormatter.format
public String format(Calendar calendar) { // As the relative period is calculated on epoch (timeInMillis), no TimeZone information is needed Calendar smscCalendar = Calendar.getInstance(); return format(calendar, smscCalendar); }
java
public String format(Calendar calendar) { // As the relative period is calculated on epoch (timeInMillis), no TimeZone information is needed Calendar smscCalendar = Calendar.getInstance(); return format(calendar, smscCalendar); }
[ "public", "String", "format", "(", "Calendar", "calendar", ")", "{", "// As the relative period is calculated on epoch (timeInMillis), no TimeZone information is needed", "Calendar", "smscCalendar", "=", "Calendar", ".", "getInstance", "(", ")", ";", "return", "format", "(", ...
Return the relative time against current (SMSC) datetime. @param calendar the datetime. @return The relative time between the calendar date and the SMSC calendar date.
[ "Return", "the", "relative", "time", "against", "current", "(", "SMSC", ")", "datetime", "." ]
train
https://github.com/opentelecoms-org/jsmpp/blob/acc15e73e7431deabc803731971b15323315baaf/jsmpp/src/main/java/org/jsmpp/util/RelativeTimeFormatter.java#L51-L55
JodaOrg/joda-time
src/main/java/org/joda/time/format/PeriodFormatterBuilder.java
PeriodFormatterBuilder.appendPrefix
public PeriodFormatterBuilder appendPrefix(String[] regularExpressions, String[] prefixes) { if (regularExpressions == null || prefixes == null || regularExpressions.length < 1 || regularExpressions.length != prefixes.length) { throw new IllegalArgumentException(); } return appendPrefix(new RegExAffix(regularExpressions, prefixes)); }
java
public PeriodFormatterBuilder appendPrefix(String[] regularExpressions, String[] prefixes) { if (regularExpressions == null || prefixes == null || regularExpressions.length < 1 || regularExpressions.length != prefixes.length) { throw new IllegalArgumentException(); } return appendPrefix(new RegExAffix(regularExpressions, prefixes)); }
[ "public", "PeriodFormatterBuilder", "appendPrefix", "(", "String", "[", "]", "regularExpressions", ",", "String", "[", "]", "prefixes", ")", "{", "if", "(", "regularExpressions", "==", "null", "||", "prefixes", "==", "null", "||", "regularExpressions", ".", "len...
Append a field prefix which applies only to the next appended field. If the field is not printed, neither is the prefix. <p> The value is converted to String. During parsing, the prefix is selected based on the match with the regular expression. The index of the first regular expression that matches value converted to String nominates the prefix. If none of the regular expressions match the value converted to String then the last prefix is selected. <p> An example usage for English might look like this: <pre> appendPrefix(new String[] { &quot;&circ;1$&quot;, &quot;.*&quot; }, new String[] { &quot; year&quot;, &quot; years&quot; }) </pre> <p> Please note that for languages with simple mapping (singular and plural prefix only - like the one above) the {@link #appendPrefix(String, String)} method will produce in a slightly faster formatter and that {@link #appendPrefix(String[], String[])} method should be only used when the mapping between values and prefixes is more complicated than the difference between singular and plural. @param regularExpressions an array of regular expressions, at least one element, length has to match the length of prefixes parameter @param prefixes an array of prefixes, at least one element, length has to match the length of regularExpressions parameter @return this PeriodFormatterBuilder @throws IllegalStateException if no field exists to append to @see #appendPrefix @since 2.5
[ "Append", "a", "field", "prefix", "which", "applies", "only", "to", "the", "next", "appended", "field", ".", "If", "the", "field", "is", "not", "printed", "neither", "is", "the", "prefix", ".", "<p", ">", "The", "value", "is", "converted", "to", "String"...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/PeriodFormatterBuilder.java#L416-L422
SimiaCryptus/utilities
java-util/src/main/java/com/simiacryptus/util/binary/BitOutputStream.java
BitOutputStream.writeVarShort
public void writeVarShort(final short value, int optimal) throws IOException { if (value < 0) throw new IllegalArgumentException(); int[] varShortDepths = {optimal, 16}; final int bitLength = new Bits(value).bitLength; int type = Arrays.binarySearch(varShortDepths, bitLength); if (type < 0) { type = -type - 1; } this.write(new Bits(type, 1)); this.write(new Bits(value, varShortDepths[type])); }
java
public void writeVarShort(final short value, int optimal) throws IOException { if (value < 0) throw new IllegalArgumentException(); int[] varShortDepths = {optimal, 16}; final int bitLength = new Bits(value).bitLength; int type = Arrays.binarySearch(varShortDepths, bitLength); if (type < 0) { type = -type - 1; } this.write(new Bits(type, 1)); this.write(new Bits(value, varShortDepths[type])); }
[ "public", "void", "writeVarShort", "(", "final", "short", "value", ",", "int", "optimal", ")", "throws", "IOException", "{", "if", "(", "value", "<", "0", ")", "throw", "new", "IllegalArgumentException", "(", ")", ";", "int", "[", "]", "varShortDepths", "=...
Write var short. @param value the value @param optimal the optimal @throws IOException the io exception
[ "Write", "var", "short", "." ]
train
https://github.com/SimiaCryptus/utilities/blob/b5a5e73449aae57de7dbfca2ed7a074432c5b17e/java-util/src/main/java/com/simiacryptus/util/binary/BitOutputStream.java#L227-L237
actframework/actframework
src/main/java/act/ws/WebSocketContext.java
WebSocketContext.sendToPeers
public WebSocketContext sendToPeers(String message, boolean excludeSelf) { return sendToConnections(message, url, manager.urlRegistry(), excludeSelf); }
java
public WebSocketContext sendToPeers(String message, boolean excludeSelf) { return sendToConnections(message, url, manager.urlRegistry(), excludeSelf); }
[ "public", "WebSocketContext", "sendToPeers", "(", "String", "message", ",", "boolean", "excludeSelf", ")", "{", "return", "sendToConnections", "(", "message", ",", "url", ",", "manager", ".", "urlRegistry", "(", ")", ",", "excludeSelf", ")", ";", "}" ]
Send message to all connections connected to the same URL of this context @param message the message to be sent @param excludeSelf whether the connection of this context should be sent to @return this context
[ "Send", "message", "to", "all", "connections", "connected", "to", "the", "same", "URL", "of", "this", "context" ]
train
https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/ws/WebSocketContext.java#L185-L187
VoltDB/voltdb
src/frontend/org/voltdb/planner/AbstractParsedStmt.java
AbstractParsedStmt.defineCommonTableScanShared
protected StmtCommonTableScanShared defineCommonTableScanShared(String tableName, int stmtId) { assert (m_commonTableSharedMap.get(tableName) == null); StmtCommonTableScanShared answer = new StmtCommonTableScanShared(tableName, stmtId); m_commonTableSharedMap.put(tableName, answer); return answer; }
java
protected StmtCommonTableScanShared defineCommonTableScanShared(String tableName, int stmtId) { assert (m_commonTableSharedMap.get(tableName) == null); StmtCommonTableScanShared answer = new StmtCommonTableScanShared(tableName, stmtId); m_commonTableSharedMap.put(tableName, answer); return answer; }
[ "protected", "StmtCommonTableScanShared", "defineCommonTableScanShared", "(", "String", "tableName", ",", "int", "stmtId", ")", "{", "assert", "(", "m_commonTableSharedMap", ".", "get", "(", "tableName", ")", "==", "null", ")", ";", "StmtCommonTableScanShared", "answe...
Lookup or define the shared part of a common table by name. This happens when the common table name is first encountered. For example, in the SQL: "with name as ( select * from ttt ) select name as a, name as b" the name "name" is a common table name. It's not an alias. This is comparable to defining a table name in the catalog, but it does not persist past the current statement. So it does not make any sense to make it a catalog entry. @param tableName The table name, not the table alias.
[ "Lookup", "or", "define", "the", "shared", "part", "of", "a", "common", "table", "by", "name", ".", "This", "happens", "when", "the", "common", "table", "name", "is", "first", "encountered", ".", "For", "example", "in", "the", "SQL", ":", "with", "name",...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/planner/AbstractParsedStmt.java#L1511-L1516
apiman/apiman
manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/util/ExceptionFactory.java
ExceptionFactory.clientVersionNotFoundException
public static final ClientVersionNotFoundException clientVersionNotFoundException(String clientId, String version) { return new ClientVersionNotFoundException(Messages.i18n.format("clientVersionDoesNotExist", clientId, version)); //$NON-NLS-1$ }
java
public static final ClientVersionNotFoundException clientVersionNotFoundException(String clientId, String version) { return new ClientVersionNotFoundException(Messages.i18n.format("clientVersionDoesNotExist", clientId, version)); //$NON-NLS-1$ }
[ "public", "static", "final", "ClientVersionNotFoundException", "clientVersionNotFoundException", "(", "String", "clientId", ",", "String", "version", ")", "{", "return", "new", "ClientVersionNotFoundException", "(", "Messages", ".", "i18n", ".", "format", "(", "\"client...
Creates an exception from an client id and version. @param clientId the client id @param version the client version @return the exception
[ "Creates", "an", "exception", "from", "an", "client", "id", "and", "version", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/rest-impl/src/main/java/io/apiman/manager/api/rest/impl/util/ExceptionFactory.java#L183-L185
tdomzal/junit-docker-rule
src/main/java/pl/domzal/junit/docker/rule/DockerRuleBuilder.java
DockerRuleBuilder.waitForMessage
public DockerRuleBuilder waitForMessage(String waitForMessage, int waitSeconds) { this.waitConditions.add(WaitFor.logMessage(waitForMessage)); this.waitForSeconds = waitSeconds; return this; }
java
public DockerRuleBuilder waitForMessage(String waitForMessage, int waitSeconds) { this.waitConditions.add(WaitFor.logMessage(waitForMessage)); this.waitForSeconds = waitSeconds; return this; }
[ "public", "DockerRuleBuilder", "waitForMessage", "(", "String", "waitForMessage", ",", "int", "waitSeconds", ")", "{", "this", ".", "waitConditions", ".", "add", "(", "WaitFor", ".", "logMessage", "(", "waitForMessage", ")", ")", ";", "this", ".", "waitForSecond...
Like {@link #waitForMessage(String)} with specified max wait time. @param waitForMessage Message to wait for. @param waitSeconds Number of seconds to wait. @deprecated Use two separate calls instead: (1) {@link #waitFor(StartCondition)} with {@link WaitFor#logMessage(String)} as argument, (2) {@link #waitForTimeout(int)}.
[ "Like", "{", "@link", "#waitForMessage", "(", "String", ")", "}", "with", "specified", "max", "wait", "time", "." ]
train
https://github.com/tdomzal/junit-docker-rule/blob/5a0ba2fd095d201530d3f9e614bc5e88d0afaeb2/src/main/java/pl/domzal/junit/docker/rule/DockerRuleBuilder.java#L131-L135
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/URIDestinationCreator.java
URIDestinationCreator.createDestinationFromURI
public Destination createDestinationFromURI(String uri, int qmProcessing) throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "createDestinationFromURI", new Object[]{uri, qmProcessing}); Destination result = null; if (uri != null) { result = processURI(uri, qmProcessing, null); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "createDestinationFromURI", result); return result; }
java
public Destination createDestinationFromURI(String uri, int qmProcessing) throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "createDestinationFromURI", new Object[]{uri, qmProcessing}); Destination result = null; if (uri != null) { result = processURI(uri, qmProcessing, null); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "createDestinationFromURI", result); return result; }
[ "public", "Destination", "createDestinationFromURI", "(", "String", "uri", ",", "int", "qmProcessing", ")", "throws", "JMSException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr...
Create a Destination object from a full URI format String. @param uri The URI format string describing the destination. If null, method returns null. If not null, must begin with either queue:// or topic://, otherwise an ?? exception is thrown. @param qmProcessing flag to indicate how to deal with QMs in MA88 queue URIs. @return a fully configured Destination object (either JmsQueueImpl or JmsTopicImpl) @throws JMSException if createDestinationFromString throws it.
[ "Create", "a", "Destination", "object", "from", "a", "full", "URI", "format", "String", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/URIDestinationCreator.java#L993-L1001
aws/aws-sdk-java
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/S3V4AuthErrorRetryStrategy.java
S3V4AuthErrorRetryStrategy.redirectToS3External
private AuthRetryParameters redirectToS3External() { AWSS3V4Signer v4Signer = buildSigV4Signer(Regions.US_EAST_1.getName()); try { URI bucketEndpoint = new URI( String.format("https://%s.s3-external-1.amazonaws.com", endpointResolver.getBucketName())); return buildRetryParams(v4Signer, bucketEndpoint); } catch (URISyntaxException e) { throw new SdkClientException( "Failed to re-send the request to \"s3-external-1.amazonaws.com\". " + V4_REGION_WARNING, e); } }
java
private AuthRetryParameters redirectToS3External() { AWSS3V4Signer v4Signer = buildSigV4Signer(Regions.US_EAST_1.getName()); try { URI bucketEndpoint = new URI( String.format("https://%s.s3-external-1.amazonaws.com", endpointResolver.getBucketName())); return buildRetryParams(v4Signer, bucketEndpoint); } catch (URISyntaxException e) { throw new SdkClientException( "Failed to re-send the request to \"s3-external-1.amazonaws.com\". " + V4_REGION_WARNING, e); } }
[ "private", "AuthRetryParameters", "redirectToS3External", "(", ")", "{", "AWSS3V4Signer", "v4Signer", "=", "buildSigV4Signer", "(", "Regions", ".", "US_EAST_1", ".", "getName", "(", ")", ")", ";", "try", "{", "URI", "bucketEndpoint", "=", "new", "URI", "(", "S...
If the response doesn't have the x-amz-region header we have to resort to sending a request to s3-external-1 @return
[ "If", "the", "response", "doesn", "t", "have", "the", "x", "-", "amz", "-", "region", "header", "we", "have", "to", "resort", "to", "sending", "a", "request", "to", "s3", "-", "external", "-", "1" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/S3V4AuthErrorRetryStrategy.java#L97-L107
datacleaner/DataCleaner
engine/core/src/main/java/org/datacleaner/data/TransformedInputRow.java
TransformedInputRow.of
public static TransformedInputRow of(final InputRow row) { if (row instanceof TransformedInputRow) { // re-use existing transformed input row. return (TransformedInputRow) row; } else { return new TransformedInputRow(row, row.getId()); } }
java
public static TransformedInputRow of(final InputRow row) { if (row instanceof TransformedInputRow) { // re-use existing transformed input row. return (TransformedInputRow) row; } else { return new TransformedInputRow(row, row.getId()); } }
[ "public", "static", "TransformedInputRow", "of", "(", "final", "InputRow", "row", ")", "{", "if", "(", "row", "instanceof", "TransformedInputRow", ")", "{", "// re-use existing transformed input row.", "return", "(", "TransformedInputRow", ")", "row", ";", "}", "els...
Constructs a {@link TransformedInputRow} based on another row, or returns the row if it is already a {@link TransformedInputRow}. @param row @return
[ "Constructs", "a", "{", "@link", "TransformedInputRow", "}", "based", "on", "another", "row", "or", "returns", "the", "row", "if", "it", "is", "already", "a", "{", "@link", "TransformedInputRow", "}", "." ]
train
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/engine/core/src/main/java/org/datacleaner/data/TransformedInputRow.java#L86-L93
openwms/org.openwms
org.openwms.core.util/src/main/java/org/openwms/core/aop/FireAfterTransactionAspect.java
FireAfterTransactionAspect.fireEventAsync
@Async public void fireEventAsync(Object publisher, FireAfterTransactionAsynchronous events) throws Exception { for (int i = 0; i < events.events().length; i++) { Class<? extends EventObject> event = events.events()[i]; if (RootApplicationEvent.class.isAssignableFrom(event)) { LOGGER.debug("Sending event: [{}]", event); ctx.publishEvent((RootApplicationEvent) event.getConstructor(Object.class).newInstance(publisher)); } } }
java
@Async public void fireEventAsync(Object publisher, FireAfterTransactionAsynchronous events) throws Exception { for (int i = 0; i < events.events().length; i++) { Class<? extends EventObject> event = events.events()[i]; if (RootApplicationEvent.class.isAssignableFrom(event)) { LOGGER.debug("Sending event: [{}]", event); ctx.publishEvent((RootApplicationEvent) event.getConstructor(Object.class).newInstance(publisher)); } } }
[ "@", "Async", "public", "void", "fireEventAsync", "(", "Object", "publisher", ",", "FireAfterTransactionAsynchronous", "events", ")", "throws", "Exception", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "events", ".", "events", "(", ")", ".", "leng...
Only {@link ApplicationEvent}s are created and published over Springs {@link ApplicationContext}. @param publisher The instance that is publishing the event @param events Stores a list of event classes to fire @throws Exception Any exception is re-thrown
[ "Only", "{", "@link", "ApplicationEvent", "}", "s", "are", "created", "and", "published", "over", "Springs", "{", "@link", "ApplicationContext", "}", "." ]
train
https://github.com/openwms/org.openwms/blob/b24a95c5d09a7ec3c723d7e107d1cb0039d06a7e/org.openwms.core.util/src/main/java/org/openwms/core/aop/FireAfterTransactionAspect.java#L94-L103
apache/incubator-gobblin
gobblin-service/src/main/java/org/apache/gobblin/service/modules/core/GitFlowGraphMonitor.java
GitFlowGraphMonitor.removeFlowEdge
private void removeFlowEdge(DiffEntry change) { if (checkFilePath(change.getOldPath(), EDGE_FILE_DEPTH)) { Path edgeFilePath = new Path(this.repositoryDir, change.getOldPath()); try { Config config = getEdgeConfigWithOverrides(ConfigFactory.empty(), edgeFilePath); String edgeId = config.getString(FlowGraphConfigurationKeys.FLOW_EDGE_ID_KEY); if (!this.flowGraph.deleteFlowEdge(edgeId)) { log.warn("Could not remove edge {} from FlowGraph; skipping", edgeId); } else { log.info("Removed edge {} from FlowGraph", edgeId); } } catch (Exception e) { log.warn("Could not remove edge defined in {} due to exception {}", edgeFilePath, e.getMessage()); } } }
java
private void removeFlowEdge(DiffEntry change) { if (checkFilePath(change.getOldPath(), EDGE_FILE_DEPTH)) { Path edgeFilePath = new Path(this.repositoryDir, change.getOldPath()); try { Config config = getEdgeConfigWithOverrides(ConfigFactory.empty(), edgeFilePath); String edgeId = config.getString(FlowGraphConfigurationKeys.FLOW_EDGE_ID_KEY); if (!this.flowGraph.deleteFlowEdge(edgeId)) { log.warn("Could not remove edge {} from FlowGraph; skipping", edgeId); } else { log.info("Removed edge {} from FlowGraph", edgeId); } } catch (Exception e) { log.warn("Could not remove edge defined in {} due to exception {}", edgeFilePath, e.getMessage()); } } }
[ "private", "void", "removeFlowEdge", "(", "DiffEntry", "change", ")", "{", "if", "(", "checkFilePath", "(", "change", ".", "getOldPath", "(", ")", ",", "EDGE_FILE_DEPTH", ")", ")", "{", "Path", "edgeFilePath", "=", "new", "Path", "(", "this", ".", "reposit...
Remove a {@link FlowEdge} from the {@link FlowGraph}. The method uses {@link FlowEdgeFactory} to construct the edgeId of the {@link FlowEdge} from the config file and uses it to delete the associated {@link FlowEdge}. @param change
[ "Remove", "a", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-service/src/main/java/org/apache/gobblin/service/modules/core/GitFlowGraphMonitor.java#L249-L264
alkacon/opencms-core
src/org/opencms/i18n/CmsLocaleManager.java
CmsLocaleManager.getDefaultLocale
public Locale getDefaultLocale(CmsObject cms, CmsResource resource) { List<Locale> defaultLocales = getDefaultLocales(cms, resource); Locale result; if (defaultLocales.size() > 0) { result = defaultLocales.get(0); } else { result = getDefaultLocale(); } return result; }
java
public Locale getDefaultLocale(CmsObject cms, CmsResource resource) { List<Locale> defaultLocales = getDefaultLocales(cms, resource); Locale result; if (defaultLocales.size() > 0) { result = defaultLocales.get(0); } else { result = getDefaultLocale(); } return result; }
[ "public", "Locale", "getDefaultLocale", "(", "CmsObject", "cms", ",", "CmsResource", "resource", ")", "{", "List", "<", "Locale", ">", "defaultLocales", "=", "getDefaultLocales", "(", "cms", ",", "resource", ")", ";", "Locale", "result", ";", "if", "(", "def...
Returns the "the" default locale for the given resource.<p> It's possible to override the system default (see {@link #getDefaultLocale()}) by setting the property <code>{@link CmsPropertyDefinition#PROPERTY_LOCALE}</code> to a comma separated list of locale names. This property is inherited from the parent folders. This method will return the first locale from that list.<p> The default locale must be contained in the set of configured available locales, see {@link #getAvailableLocales()}. In case an invalid locale has been set with the property, this locale is ignored and the same result as {@link #getDefaultLocale()} is returned.<p> In case the property <code>{@link CmsPropertyDefinition#PROPERTY_LOCALE}</code> has not been set on the resource or a parent folder, this method returns the same result as {@link #getDefaultLocale()}.<p> @param cms the current cms permission object @param resource the resource @return an array of default locale names @see #getDefaultLocales() @see #getDefaultLocales(CmsObject, String)
[ "Returns", "the", "the", "default", "locale", "for", "the", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsLocaleManager.java#L728-L738
stevespringett/Alpine
alpine/src/main/java/alpine/persistence/AlpineQueryManager.java
AlpineQueryManager.createEventServiceLog
public EventServiceLog createEventServiceLog(Class<? extends Subscriber> clazz) { if (LoggableSubscriber.class.isAssignableFrom(clazz)) { pm.currentTransaction().begin(); final EventServiceLog log = new EventServiceLog(); log.setSubscriberClass(clazz.getCanonicalName()); log.setStarted(new Timestamp(new Date().getTime())); pm.makePersistent(log); pm.currentTransaction().commit(); return getObjectById(EventServiceLog.class, log.getId()); } return null; }
java
public EventServiceLog createEventServiceLog(Class<? extends Subscriber> clazz) { if (LoggableSubscriber.class.isAssignableFrom(clazz)) { pm.currentTransaction().begin(); final EventServiceLog log = new EventServiceLog(); log.setSubscriberClass(clazz.getCanonicalName()); log.setStarted(new Timestamp(new Date().getTime())); pm.makePersistent(log); pm.currentTransaction().commit(); return getObjectById(EventServiceLog.class, log.getId()); } return null; }
[ "public", "EventServiceLog", "createEventServiceLog", "(", "Class", "<", "?", "extends", "Subscriber", ">", "clazz", ")", "{", "if", "(", "LoggableSubscriber", ".", "class", ".", "isAssignableFrom", "(", "clazz", ")", ")", "{", "pm", ".", "currentTransaction", ...
Creates a new EventServiceLog. This method will automatically determine if the subscriber is an implementation of {@link LoggableSubscriber} and if so, will log the event. If not, then nothing will be logged and this method will return null. @param clazz the class of the subscriber task that handles the event @return a new EventServiceLog
[ "Creates", "a", "new", "EventServiceLog", ".", "This", "method", "will", "automatically", "determine", "if", "the", "subscriber", "is", "an", "implementation", "of", "{" ]
train
https://github.com/stevespringett/Alpine/blob/6c5ef5e1ba4f38922096f1307d3950c09edb3093/alpine/src/main/java/alpine/persistence/AlpineQueryManager.java#L659-L670
exoplatform/jcr
exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MembershipHandlerImpl.java
MembershipHandlerImpl.findMembershipsByUserAndGroup
private Collection<Membership> findMembershipsByUserAndGroup(Session session, String userName, String groupId) throws Exception { Node groupNode; Node refUserNode; try { groupNode = utils.getGroupNode(session, groupId); refUserNode = groupNode.getNode(JCROrganizationServiceImpl.JOS_MEMBERSHIP).getNode(userName); } catch (PathNotFoundException e) { return new ArrayList<Membership>(); } return findMembershipsByUserAndGroup(session, refUserNode, groupNode); }
java
private Collection<Membership> findMembershipsByUserAndGroup(Session session, String userName, String groupId) throws Exception { Node groupNode; Node refUserNode; try { groupNode = utils.getGroupNode(session, groupId); refUserNode = groupNode.getNode(JCROrganizationServiceImpl.JOS_MEMBERSHIP).getNode(userName); } catch (PathNotFoundException e) { return new ArrayList<Membership>(); } return findMembershipsByUserAndGroup(session, refUserNode, groupNode); }
[ "private", "Collection", "<", "Membership", ">", "findMembershipsByUserAndGroup", "(", "Session", "session", ",", "String", "userName", ",", "String", "groupId", ")", "throws", "Exception", "{", "Node", "groupNode", ";", "Node", "refUserNode", ";", "try", "{", "...
Use this method to find all the memberships of an user in a group.
[ "Use", "this", "method", "to", "find", "all", "the", "memberships", "of", "an", "user", "in", "a", "group", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.ext.services/src/main/java/org/exoplatform/services/jcr/ext/organization/MembershipHandlerImpl.java#L427-L443
haifengl/smile
math/src/main/java/smile/math/matrix/PowerIteration.java
PowerIteration.ax
private static double ax(Matrix A, double[] x, double[] y, double p) { A.ax(x, y); if (p != 0.0) { for (int i = 0; i < y.length; i++) { y[i] -= p * x[i]; } } double lambda = y[0]; for (int i = 1; i < y.length; i++) { if (Math.abs(y[i]) > Math.abs(lambda)) { lambda = y[i]; } } for (int i = 0; i < y.length; i++) { x[i] = y[i] / lambda; } return lambda; }
java
private static double ax(Matrix A, double[] x, double[] y, double p) { A.ax(x, y); if (p != 0.0) { for (int i = 0; i < y.length; i++) { y[i] -= p * x[i]; } } double lambda = y[0]; for (int i = 1; i < y.length; i++) { if (Math.abs(y[i]) > Math.abs(lambda)) { lambda = y[i]; } } for (int i = 0; i < y.length; i++) { x[i] = y[i] / lambda; } return lambda; }
[ "private", "static", "double", "ax", "(", "Matrix", "A", ",", "double", "[", "]", "x", ",", "double", "[", "]", "y", ",", "double", "p", ")", "{", "A", ".", "ax", "(", "x", ",", "y", ")", ";", "if", "(", "p", "!=", "0.0", ")", "{", "for", ...
Calculate and normalize y = (A - pI) x. Returns the largest element of y in magnitude.
[ "Calculate", "and", "normalize", "y", "=", "(", "A", "-", "pI", ")", "x", ".", "Returns", "the", "largest", "element", "of", "y", "in", "magnitude", "." ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/matrix/PowerIteration.java#L174-L195
ruifigueira/platypus
src/main/java/platypus/internal/Classes.java
Classes.getAllInterfaces
private static void getAllInterfaces(Class<?> cls, Collection<Class<?>> interfacesFound) { while (cls != null) { Class<?>[] interfaces = cls.getInterfaces(); for (int i = 0; i < interfaces.length; i++) { interfacesFound.add(interfaces[i]); getAllInterfaces(interfaces[i], interfacesFound); } cls = cls.getSuperclass(); } }
java
private static void getAllInterfaces(Class<?> cls, Collection<Class<?>> interfacesFound) { while (cls != null) { Class<?>[] interfaces = cls.getInterfaces(); for (int i = 0; i < interfaces.length; i++) { interfacesFound.add(interfaces[i]); getAllInterfaces(interfaces[i], interfacesFound); } cls = cls.getSuperclass(); } }
[ "private", "static", "void", "getAllInterfaces", "(", "Class", "<", "?", ">", "cls", ",", "Collection", "<", "Class", "<", "?", ">", ">", "interfacesFound", ")", "{", "while", "(", "cls", "!=", "null", ")", "{", "Class", "<", "?", ">", "[", "]", "i...
Get the interfaces for the specified class. @param cls the class to look up, may be <code>null</code> @param interfacesFound the <code>Set</code> of interfaces for the class
[ "Get", "the", "interfaces", "for", "the", "specified", "class", "." ]
train
https://github.com/ruifigueira/platypus/blob/d848de1a7af1171307e955cb73783efd626a8af8/src/main/java/platypus/internal/Classes.java#L54-L65
antlrjavaparser/antlr-java-parser
src/main/java/com/github/antlrjavaparser/ASTHelper.java
ASTHelper.createParameter
public static Parameter createParameter(Type type, String name) { return new Parameter(type, new VariableDeclaratorId(name)); }
java
public static Parameter createParameter(Type type, String name) { return new Parameter(type, new VariableDeclaratorId(name)); }
[ "public", "static", "Parameter", "createParameter", "(", "Type", "type", ",", "String", "name", ")", "{", "return", "new", "Parameter", "(", "type", ",", "new", "VariableDeclaratorId", "(", "name", ")", ")", ";", "}" ]
Creates a new {@link Parameter}. @param type type of the parameter @param name name of the parameter @return instance of {@link Parameter}
[ "Creates", "a", "new", "{", "@link", "Parameter", "}", "." ]
train
https://github.com/antlrjavaparser/antlr-java-parser/blob/077160deb44d952c40c442800abd91af7e6fe006/src/main/java/com/github/antlrjavaparser/ASTHelper.java#L103-L105
beanshell/beanshell
src/main/java/bsh/Reflect.java
Reflect.invokeCompiledCommand
public static Object invokeCompiledCommand( Class<?> commandClass, Object [] args, Interpreter interpreter, CallStack callstack, SimpleNode callerInfo ) throws UtilEvalError { // add interpereter and namespace to args list Object[] invokeArgs = new Object[args.length + 2]; invokeArgs[0] = interpreter; invokeArgs[1] = callstack; System.arraycopy( args, 0, invokeArgs, 2, args.length ); BshClassManager bcm = interpreter.getClassManager(); try { return invokeStaticMethod( bcm, commandClass, "invoke", invokeArgs, callerInfo ); } catch ( InvocationTargetException e ) { throw new UtilEvalError( "Error in compiled command: " + e.getCause(), e ); } catch ( ReflectError e ) { throw new UtilEvalError("Error invoking compiled command: " + e, e ); } }
java
public static Object invokeCompiledCommand( Class<?> commandClass, Object [] args, Interpreter interpreter, CallStack callstack, SimpleNode callerInfo ) throws UtilEvalError { // add interpereter and namespace to args list Object[] invokeArgs = new Object[args.length + 2]; invokeArgs[0] = interpreter; invokeArgs[1] = callstack; System.arraycopy( args, 0, invokeArgs, 2, args.length ); BshClassManager bcm = interpreter.getClassManager(); try { return invokeStaticMethod( bcm, commandClass, "invoke", invokeArgs, callerInfo ); } catch ( InvocationTargetException e ) { throw new UtilEvalError( "Error in compiled command: " + e.getCause(), e ); } catch ( ReflectError e ) { throw new UtilEvalError("Error invoking compiled command: " + e, e ); } }
[ "public", "static", "Object", "invokeCompiledCommand", "(", "Class", "<", "?", ">", "commandClass", ",", "Object", "[", "]", "args", ",", "Interpreter", "interpreter", ",", "CallStack", "callstack", ",", "SimpleNode", "callerInfo", ")", "throws", "UtilEvalError", ...
A command may be implemented as a compiled Java class containing one or more static invoke() methods of the correct signature. The invoke() methods must accept two additional leading arguments of the interpreter and callstack, respectively. e.g. invoke(interpreter, callstack, ... ) This method adds the arguments and invokes the static method, returning the result.
[ "A", "command", "may", "be", "implemented", "as", "a", "compiled", "Java", "class", "containing", "one", "or", "more", "static", "invoke", "()", "methods", "of", "the", "correct", "signature", ".", "The", "invoke", "()", "methods", "must", "accept", "two", ...
train
https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/Reflect.java#L653-L673
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java
CPInstancePersistenceImpl.removeByC_ST
@Override public void removeByC_ST(long CPDefinitionId, int status) { for (CPInstance cpInstance : findByC_ST(CPDefinitionId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpInstance); } }
java
@Override public void removeByC_ST(long CPDefinitionId, int status) { for (CPInstance cpInstance : findByC_ST(CPDefinitionId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpInstance); } }
[ "@", "Override", "public", "void", "removeByC_ST", "(", "long", "CPDefinitionId", ",", "int", "status", ")", "{", "for", "(", "CPInstance", "cpInstance", ":", "findByC_ST", "(", "CPDefinitionId", ",", "status", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil...
Removes all the cp instances where CPDefinitionId = &#63; and status = &#63; from the database. @param CPDefinitionId the cp definition ID @param status the status
[ "Removes", "all", "the", "cp", "instances", "where", "CPDefinitionId", "=", "&#63", ";", "and", "status", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java#L5040-L5046
sagiegurari/fax4j
src/main/java/org/fax4j/spi/windows/WindowsFaxClientSpiHelper.java
WindowsFaxClientSpiHelper.loadNativeLibrary
public static void loadNativeLibrary(Logger logger) { synchronized(WindowsFaxClientSpiHelper.NATIVE_LOCK) { if(!WindowsFaxClientSpiHelper.nativeLibraryLoaded) { try { //get temporary directory File directory=IOHelper.getFax4jInternalTemporaryDirectory(); //get dll path File dllFile=new File(directory,"fax4j.dll"); //get path String path=dllFile.getPath(); //load native library System.load(path); logger.logDebug(new Object[]{"Loaded native library runtime path."},null); //set flag WindowsFaxClientSpiHelper.nativeLibraryLoaded=true; } catch(Throwable throwable) { logger.logError(new Object[]{"Error while loading native library from runtime path."},throwable); } if(!WindowsFaxClientSpiHelper.nativeLibraryLoaded) { try { //load native library System.loadLibrary("fax4j"); logger.logDebug(new Object[]{"Loaded native library from native path."},null); //set flag WindowsFaxClientSpiHelper.nativeLibraryLoaded=true; } catch(Throwable throwable) { logger.logError(new Object[]{"Error while loading native library from native path."},throwable); } } } } }
java
public static void loadNativeLibrary(Logger logger) { synchronized(WindowsFaxClientSpiHelper.NATIVE_LOCK) { if(!WindowsFaxClientSpiHelper.nativeLibraryLoaded) { try { //get temporary directory File directory=IOHelper.getFax4jInternalTemporaryDirectory(); //get dll path File dllFile=new File(directory,"fax4j.dll"); //get path String path=dllFile.getPath(); //load native library System.load(path); logger.logDebug(new Object[]{"Loaded native library runtime path."},null); //set flag WindowsFaxClientSpiHelper.nativeLibraryLoaded=true; } catch(Throwable throwable) { logger.logError(new Object[]{"Error while loading native library from runtime path."},throwable); } if(!WindowsFaxClientSpiHelper.nativeLibraryLoaded) { try { //load native library System.loadLibrary("fax4j"); logger.logDebug(new Object[]{"Loaded native library from native path."},null); //set flag WindowsFaxClientSpiHelper.nativeLibraryLoaded=true; } catch(Throwable throwable) { logger.logError(new Object[]{"Error while loading native library from native path."},throwable); } } } } }
[ "public", "static", "void", "loadNativeLibrary", "(", "Logger", "logger", ")", "{", "synchronized", "(", "WindowsFaxClientSpiHelper", ".", "NATIVE_LOCK", ")", "{", "if", "(", "!", "WindowsFaxClientSpiHelper", ".", "nativeLibraryLoaded", ")", "{", "try", "{", "//ge...
Loads the native library if not loaded before. @param logger The logger
[ "Loads", "the", "native", "library", "if", "not", "loaded", "before", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/windows/WindowsFaxClientSpiHelper.java#L95-L142
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/Compare.java
Compare.compareDistance
private static boolean compareDistance(final String title1, final String title2, int distance) { return StringUtils.getLevenshteinDistance(title1, title2) <= distance; }
java
private static boolean compareDistance(final String title1, final String title2, int distance) { return StringUtils.getLevenshteinDistance(title1, title2) <= distance; }
[ "private", "static", "boolean", "compareDistance", "(", "final", "String", "title1", ",", "final", "String", "title2", ",", "int", "distance", ")", "{", "return", "StringUtils", ".", "getLevenshteinDistance", "(", "title1", ",", "title2", ")", "<=", "distance", ...
Compare the Levenshtein Distance between the two strings @param title1 title @param title2 title @param distance max distance
[ "Compare", "the", "Levenshtein", "Distance", "between", "the", "two", "strings" ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/Compare.java#L129-L131