repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
facebookarchive/hadoop-20
src/tools/org/apache/hadoop/tools/rumen/ZombieJob.java
ZombieJob.maskTaskID
private TaskID maskTaskID(TaskID taskId) { """ Mask the job ID part in a {@link TaskID}. @param taskId raw {@link TaskID} read from trace @return masked {@link TaskID} with empty {@link JobID}. """ JobID jobId = new JobID(); return new TaskID(jobId, taskId.isMap(), taskId.getId()); }
java
private TaskID maskTaskID(TaskID taskId) { JobID jobId = new JobID(); return new TaskID(jobId, taskId.isMap(), taskId.getId()); }
[ "private", "TaskID", "maskTaskID", "(", "TaskID", "taskId", ")", "{", "JobID", "jobId", "=", "new", "JobID", "(", ")", ";", "return", "new", "TaskID", "(", "jobId", ",", "taskId", ".", "isMap", "(", ")", ",", "taskId", ".", "getId", "(", ")", ")", ...
Mask the job ID part in a {@link TaskID}. @param taskId raw {@link TaskID} read from trace @return masked {@link TaskID} with empty {@link JobID}.
[ "Mask", "the", "job", "ID", "part", "in", "a", "{", "@link", "TaskID", "}", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/tools/org/apache/hadoop/tools/rumen/ZombieJob.java#L279-L282
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CollationElementIterator.java
CollationElementIterator.setText
public void setText(UCharacterIterator source) { """ Set a new source string iterator for iteration, and reset the offset to the beginning of the text. <p>The source iterator's integrity will be preserved since a new copy will be created for use. @param source the new source string iterator for iteration. """ string_ = source.getText(); // TODO: do we need to remember the source string in a field? // Note: In C++, we just setText(source.getText()). // In Java, we actually operate on a character iterator. // (The old code apparently did so only for a CharacterIterator; // for a UCharacterIterator it also just used source.getText()). // TODO: do we need to remember the cloned iterator in a field? UCharacterIterator src; try { src = (UCharacterIterator) source.clone(); } catch (CloneNotSupportedException e) { // Fall back to ICU 52 behavior of iterating over the text contents // of the UCharacterIterator. setText(source.getText()); return; } src.setToStart(); CollationIterator newIter; boolean numeric = rbc_.settings.readOnly().isNumeric(); if (rbc_.settings.readOnly().dontCheckFCD()) { newIter = new IterCollationIterator(rbc_.data, numeric, src); } else { newIter = new FCDIterCollationIterator(rbc_.data, numeric, src, 0); } iter_ = newIter; otherHalf_ = 0; dir_ = 0; }
java
public void setText(UCharacterIterator source) { string_ = source.getText(); // TODO: do we need to remember the source string in a field? // Note: In C++, we just setText(source.getText()). // In Java, we actually operate on a character iterator. // (The old code apparently did so only for a CharacterIterator; // for a UCharacterIterator it also just used source.getText()). // TODO: do we need to remember the cloned iterator in a field? UCharacterIterator src; try { src = (UCharacterIterator) source.clone(); } catch (CloneNotSupportedException e) { // Fall back to ICU 52 behavior of iterating over the text contents // of the UCharacterIterator. setText(source.getText()); return; } src.setToStart(); CollationIterator newIter; boolean numeric = rbc_.settings.readOnly().isNumeric(); if (rbc_.settings.readOnly().dontCheckFCD()) { newIter = new IterCollationIterator(rbc_.data, numeric, src); } else { newIter = new FCDIterCollationIterator(rbc_.data, numeric, src, 0); } iter_ = newIter; otherHalf_ = 0; dir_ = 0; }
[ "public", "void", "setText", "(", "UCharacterIterator", "source", ")", "{", "string_", "=", "source", ".", "getText", "(", ")", ";", "// TODO: do we need to remember the source string in a field?", "// Note: In C++, we just setText(source.getText()).", "// In Java, we actually op...
Set a new source string iterator for iteration, and reset the offset to the beginning of the text. <p>The source iterator's integrity will be preserved since a new copy will be created for use. @param source the new source string iterator for iteration.
[ "Set", "a", "new", "source", "string", "iterator", "for", "iteration", "and", "reset", "the", "offset", "to", "the", "beginning", "of", "the", "text", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CollationElementIterator.java#L514-L541
RuedigerMoeller/kontraktor
modules/reactive-streams/src/main/java/org/nustaq/kontraktor/reactivestreams/impl/KxPublisherActor.java
KxPublisherActor._subscribe
public IPromise<KSubscription> _subscribe( Callback subscriber ) { """ private / as validation needs to be done synchronously, its on callerside. This is the async part of impl """ if ( subscribers == null ) subscribers = new HashMap<>(); int id = subsIdCount++; KSubscription subs = new KSubscription(self(), id); subscribers.put( id, new SubscriberEntry(id, subs, subscriber) ); return new Promise<>(subs); }
java
public IPromise<KSubscription> _subscribe( Callback subscriber ) { if ( subscribers == null ) subscribers = new HashMap<>(); int id = subsIdCount++; KSubscription subs = new KSubscription(self(), id); subscribers.put( id, new SubscriberEntry(id, subs, subscriber) ); return new Promise<>(subs); }
[ "public", "IPromise", "<", "KSubscription", ">", "_subscribe", "(", "Callback", "subscriber", ")", "{", "if", "(", "subscribers", "==", "null", ")", "subscribers", "=", "new", "HashMap", "<>", "(", ")", ";", "int", "id", "=", "subsIdCount", "++", ";", "K...
private / as validation needs to be done synchronously, its on callerside. This is the async part of impl
[ "private", "/", "as", "validation", "needs", "to", "be", "done", "synchronously", "its", "on", "callerside", ".", "This", "is", "the", "async", "part", "of", "impl" ]
train
https://github.com/RuedigerMoeller/kontraktor/blob/d5f3817f9476f3786187b8ef00400b7a4f25a404/modules/reactive-streams/src/main/java/org/nustaq/kontraktor/reactivestreams/impl/KxPublisherActor.java#L144-L151
javamelody/javamelody
javamelody-core/src/main/java/net/bull/javamelody/JspWrapper.java
JspWrapper.invoke
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { """ Intercepte une exécution de méthode sur une façade. @param proxy Object @param method Method @param args Object[] @return Object @throws Throwable t """ final String methodName = method.getName(); // != for perf (strings interned: != is ok) if ("include" != methodName && "forward" != methodName) { // NOPMD return method.invoke(requestDispatcher, args); } boolean systemError = false; try { final String pathWithoutParameters; final int indexOf = path.indexOf('?'); if (indexOf != -1) { pathWithoutParameters = path.substring(0, indexOf); } else { pathWithoutParameters = path; } JSP_COUNTER.bindContextIncludingCpu(pathWithoutParameters); return method.invoke(requestDispatcher, args); } catch (final InvocationTargetException e) { if (e.getCause() instanceof Error) { // on catche Error pour avoir les erreurs systèmes // mais pas Exception qui sont fonctionnelles en général systemError = true; } throw e; } finally { // on enregistre la requête dans les statistiques JSP_COUNTER.addRequestForCurrentContext(systemError); } }
java
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { final String methodName = method.getName(); // != for perf (strings interned: != is ok) if ("include" != methodName && "forward" != methodName) { // NOPMD return method.invoke(requestDispatcher, args); } boolean systemError = false; try { final String pathWithoutParameters; final int indexOf = path.indexOf('?'); if (indexOf != -1) { pathWithoutParameters = path.substring(0, indexOf); } else { pathWithoutParameters = path; } JSP_COUNTER.bindContextIncludingCpu(pathWithoutParameters); return method.invoke(requestDispatcher, args); } catch (final InvocationTargetException e) { if (e.getCause() instanceof Error) { // on catche Error pour avoir les erreurs systèmes // mais pas Exception qui sont fonctionnelles en général systemError = true; } throw e; } finally { // on enregistre la requête dans les statistiques JSP_COUNTER.addRequestForCurrentContext(systemError); } }
[ "@", "Override", "public", "Object", "invoke", "(", "Object", "proxy", ",", "Method", "method", ",", "Object", "[", "]", "args", ")", "throws", "Throwable", "{", "final", "String", "methodName", "=", "method", ".", "getName", "(", ")", ";", "// != for perf...
Intercepte une exécution de méthode sur une façade. @param proxy Object @param method Method @param args Object[] @return Object @throws Throwable t
[ "Intercepte", "une", "exécution", "de", "méthode", "sur", "une", "façade", "." ]
train
https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-core/src/main/java/net/bull/javamelody/JspWrapper.java#L135-L164
aws/aws-sdk-java
aws-java-sdk-alexaforbusiness/src/main/java/com/amazonaws/services/alexaforbusiness/model/PutSkillAuthorizationRequest.java
PutSkillAuthorizationRequest.withAuthorizationResult
public PutSkillAuthorizationRequest withAuthorizationResult(java.util.Map<String, String> authorizationResult) { """ <p> The authorization result specific to OAUTH code grant output. "Code” must be populated in the AuthorizationResult map to establish the authorization. </p> @param authorizationResult The authorization result specific to OAUTH code grant output. "Code” must be populated in the AuthorizationResult map to establish the authorization. @return Returns a reference to this object so that method calls can be chained together. """ setAuthorizationResult(authorizationResult); return this; }
java
public PutSkillAuthorizationRequest withAuthorizationResult(java.util.Map<String, String> authorizationResult) { setAuthorizationResult(authorizationResult); return this; }
[ "public", "PutSkillAuthorizationRequest", "withAuthorizationResult", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "authorizationResult", ")", "{", "setAuthorizationResult", "(", "authorizationResult", ")", ";", "return", "this", ";", "}" ...
<p> The authorization result specific to OAUTH code grant output. "Code” must be populated in the AuthorizationResult map to establish the authorization. </p> @param authorizationResult The authorization result specific to OAUTH code grant output. "Code” must be populated in the AuthorizationResult map to establish the authorization. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "authorization", "result", "specific", "to", "OAUTH", "code", "grant", "output", ".", "Code”", "must", "be", "populated", "in", "the", "AuthorizationResult", "map", "to", "establish", "the", "authorization", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-alexaforbusiness/src/main/java/com/amazonaws/services/alexaforbusiness/model/PutSkillAuthorizationRequest.java#L89-L92
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/res/XMLMessages.java
XMLMessages.createXMLMessage
public static final String createXMLMessage(String msgKey, Object args[]) { """ Creates a message from the specified key and replacement arguments, localized to the given locale. @param msgKey The key for the message text. @param args The arguments to be used as replacement text in the message created. @return The formatted message string. """ // BEGIN android-changed // don't localize exceptions return createMsg(XMLBundle, msgKey, args); // END android-changed }
java
public static final String createXMLMessage(String msgKey, Object args[]) { // BEGIN android-changed // don't localize exceptions return createMsg(XMLBundle, msgKey, args); // END android-changed }
[ "public", "static", "final", "String", "createXMLMessage", "(", "String", "msgKey", ",", "Object", "args", "[", "]", ")", "{", "// BEGIN android-changed", "// don't localize exceptions", "return", "createMsg", "(", "XMLBundle", ",", "msgKey", ",", "args", ")", ...
Creates a message from the specified key and replacement arguments, localized to the given locale. @param msgKey The key for the message text. @param args The arguments to be used as replacement text in the message created. @return The formatted message string.
[ "Creates", "a", "message", "from", "the", "specified", "key", "and", "replacement", "arguments", "localized", "to", "the", "given", "locale", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/res/XMLMessages.java#L77-L83
Alluxio/alluxio
core/server/master/src/main/java/alluxio/master/file/activesync/ActiveSyncManager.java
ActiveSyncManager.recoverFromStopSync
public void recoverFromStopSync(AlluxioURI uri, long mountId) { """ Recover from a stop sync operation. @param uri uri to stop sync @param mountId mount id of the uri """ if (mSyncPathStatus.containsKey(uri)) { // nothing to recover from, since the syncPathStatus still contains syncPoint return; } try { // the init sync thread has been removed, to reestablish sync, we need to sync again MountTable.Resolution resolution = mMountTable.resolve(uri); startInitSync(uri, resolution); launchPollingThread(resolution.getMountId(), SyncInfo.INVALID_TXID); } catch (Throwable t) { LOG.warn("Recovering from stop syncing failed {}", t); } }
java
public void recoverFromStopSync(AlluxioURI uri, long mountId) { if (mSyncPathStatus.containsKey(uri)) { // nothing to recover from, since the syncPathStatus still contains syncPoint return; } try { // the init sync thread has been removed, to reestablish sync, we need to sync again MountTable.Resolution resolution = mMountTable.resolve(uri); startInitSync(uri, resolution); launchPollingThread(resolution.getMountId(), SyncInfo.INVALID_TXID); } catch (Throwable t) { LOG.warn("Recovering from stop syncing failed {}", t); } }
[ "public", "void", "recoverFromStopSync", "(", "AlluxioURI", "uri", ",", "long", "mountId", ")", "{", "if", "(", "mSyncPathStatus", ".", "containsKey", "(", "uri", ")", ")", "{", "// nothing to recover from, since the syncPathStatus still contains syncPoint", "return", "...
Recover from a stop sync operation. @param uri uri to stop sync @param mountId mount id of the uri
[ "Recover", "from", "a", "stop", "sync", "operation", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/activesync/ActiveSyncManager.java#L634-L647
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/utils/SdkUtils.java
SdkUtils.setColorsThumb
public static void setColorsThumb(TextView initialsView, int backgroundColor, int strokeColor) { """ Sets the the background thumb color for the account view to one of the material colors @param initialsView view where the thumbs will be shown """ GradientDrawable drawable = (GradientDrawable) initialsView.getResources().getDrawable(R.drawable.boxsdk_thumb_background); drawable.setColorFilter(backgroundColor, PorterDuff.Mode.MULTIPLY); if (Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { drawable.setStroke(3, strokeColor); initialsView.setBackground(drawable); } else { drawable.setStroke(3, strokeColor); initialsView.setBackgroundDrawable(drawable); } }
java
public static void setColorsThumb(TextView initialsView, int backgroundColor, int strokeColor) { GradientDrawable drawable = (GradientDrawable) initialsView.getResources().getDrawable(R.drawable.boxsdk_thumb_background); drawable.setColorFilter(backgroundColor, PorterDuff.Mode.MULTIPLY); if (Build.VERSION.SDK_INT > Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) { drawable.setStroke(3, strokeColor); initialsView.setBackground(drawable); } else { drawable.setStroke(3, strokeColor); initialsView.setBackgroundDrawable(drawable); } }
[ "public", "static", "void", "setColorsThumb", "(", "TextView", "initialsView", ",", "int", "backgroundColor", ",", "int", "strokeColor", ")", "{", "GradientDrawable", "drawable", "=", "(", "GradientDrawable", ")", "initialsView", ".", "getResources", "(", ")", "."...
Sets the the background thumb color for the account view to one of the material colors @param initialsView view where the thumbs will be shown
[ "Sets", "the", "the", "background", "thumb", "color", "for", "the", "account", "view", "to", "one", "of", "the", "material", "colors" ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/utils/SdkUtils.java#L599-L609
trustathsh/ifmapj
src/main/java/util/CanonicalXML.java
CanonicalXML.startElement
@Override public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { """ Receive notification of the start of an element. <p/> <p>By default, do nothing. Application writers may override this method in a subclass to take specific actions at the start of each element (such as allocating a new tree node or writing output to a file).</p> @param uri The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed. @param localName The local name (without prefix), or the empty string if Namespace processing is not being performed. @param qName The qualified name (with prefix), or the empty string if qualified names are not available. @param atts The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object. @throws org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception. @see org.xml.sax.ContentHandler#startElement """ flushChars(); write("<"); write(qName); // output the namespaces outputAttributes(mNamespaces); // output the attributes outputAttributes(atts); write(">"); mNamespaces.clear(); }
java
@Override public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { flushChars(); write("<"); write(qName); // output the namespaces outputAttributes(mNamespaces); // output the attributes outputAttributes(atts); write(">"); mNamespaces.clear(); }
[ "@", "Override", "public", "void", "startElement", "(", "String", "uri", ",", "String", "localName", ",", "String", "qName", ",", "Attributes", "atts", ")", "throws", "SAXException", "{", "flushChars", "(", ")", ";", "write", "(", "\"<\"", ")", ";", "write...
Receive notification of the start of an element. <p/> <p>By default, do nothing. Application writers may override this method in a subclass to take specific actions at the start of each element (such as allocating a new tree node or writing output to a file).</p> @param uri The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed. @param localName The local name (without prefix), or the empty string if Namespace processing is not being performed. @param qName The qualified name (with prefix), or the empty string if qualified names are not available. @param atts The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object. @throws org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception. @see org.xml.sax.ContentHandler#startElement
[ "Receive", "notification", "of", "the", "start", "of", "an", "element", ".", "<p", "/", ">", "<p", ">", "By", "default", "do", "nothing", ".", "Application", "writers", "may", "override", "this", "method", "in", "a", "subclass", "to", "take", "specific", ...
train
https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/util/CanonicalXML.java#L211-L222
Ordinastie/MalisisCore
src/main/java/net/malisis/core/registry/MalisisRegistry.java
MalisisRegistry.registerItemRenderer
@SideOnly(Side.CLIENT) public static void registerItemRenderer(Item item, IItemRenderer renderer) { """ Registers a {@link IItemRenderer} for the {@link Item}. @param item the item @param renderer the renderer """ clientRegistry.itemRenderers.put(checkNotNull(item), checkNotNull(renderer)); }
java
@SideOnly(Side.CLIENT) public static void registerItemRenderer(Item item, IItemRenderer renderer) { clientRegistry.itemRenderers.put(checkNotNull(item), checkNotNull(renderer)); }
[ "@", "SideOnly", "(", "Side", ".", "CLIENT", ")", "public", "static", "void", "registerItemRenderer", "(", "Item", "item", ",", "IItemRenderer", "renderer", ")", "{", "clientRegistry", ".", "itemRenderers", ".", "put", "(", "checkNotNull", "(", "item", ")", ...
Registers a {@link IItemRenderer} for the {@link Item}. @param item the item @param renderer the renderer
[ "Registers", "a", "{", "@link", "IItemRenderer", "}", "for", "the", "{", "@link", "Item", "}", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/registry/MalisisRegistry.java#L213-L217
OpenLiberty/open-liberty
dev/com.ibm.ws.collector/src/com/ibm/ws/collector/Collector.java
Collector.validateTags
private static void validateTags(String[] tagList, ArrayList<String> validList, ArrayList<String> invalidList) { """ Filter out tags with escaping characters and invalid characters, restrict to only alphabetical and numeric characters @param tagList @return """ for (String tag : tagList) { tag = tag.trim(); if (tag.contains("\\") || tag.contains(" ") || tag.contains("\n") || tag.contains("-") || tag.equals("")) { invalidList.add(tag); } else { validList.add(tag); } } }
java
private static void validateTags(String[] tagList, ArrayList<String> validList, ArrayList<String> invalidList) { for (String tag : tagList) { tag = tag.trim(); if (tag.contains("\\") || tag.contains(" ") || tag.contains("\n") || tag.contains("-") || tag.equals("")) { invalidList.add(tag); } else { validList.add(tag); } } }
[ "private", "static", "void", "validateTags", "(", "String", "[", "]", "tagList", ",", "ArrayList", "<", "String", ">", "validList", ",", "ArrayList", "<", "String", ">", "invalidList", ")", "{", "for", "(", "String", "tag", ":", "tagList", ")", "{", "tag...
Filter out tags with escaping characters and invalid characters, restrict to only alphabetical and numeric characters @param tagList @return
[ "Filter", "out", "tags", "with", "escaping", "characters", "and", "invalid", "characters", "restrict", "to", "only", "alphabetical", "and", "numeric", "characters" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.collector/src/com/ibm/ws/collector/Collector.java#L279-L288
LAW-Unimi/BUbiNG
src/it/unimi/di/law/bubing/frontier/Workbench.java
Workbench.getWorkbenchEntry
public WorkbenchEntry getWorkbenchEntry(final byte[] address) { """ Returns a workbench entry for the given address, possibly creating one. The entry may or may not be on the {@link Workbench} currently. @param address an IP address in byte-array form. @return a workbench entry for {@code address} (possibly a new one). """ WorkbenchEntry workbenchEntry; synchronized (address2WorkbenchEntry) { workbenchEntry = address2WorkbenchEntry.get(address); if (workbenchEntry == null) address2WorkbenchEntry.add(workbenchEntry = new WorkbenchEntry(address, broken)); } return workbenchEntry; }
java
public WorkbenchEntry getWorkbenchEntry(final byte[] address) { WorkbenchEntry workbenchEntry; synchronized (address2WorkbenchEntry) { workbenchEntry = address2WorkbenchEntry.get(address); if (workbenchEntry == null) address2WorkbenchEntry.add(workbenchEntry = new WorkbenchEntry(address, broken)); } return workbenchEntry; }
[ "public", "WorkbenchEntry", "getWorkbenchEntry", "(", "final", "byte", "[", "]", "address", ")", "{", "WorkbenchEntry", "workbenchEntry", ";", "synchronized", "(", "address2WorkbenchEntry", ")", "{", "workbenchEntry", "=", "address2WorkbenchEntry", ".", "get", "(", ...
Returns a workbench entry for the given address, possibly creating one. The entry may or may not be on the {@link Workbench} currently. @param address an IP address in byte-array form. @return a workbench entry for {@code address} (possibly a new one).
[ "Returns", "a", "workbench", "entry", "for", "the", "given", "address", "possibly", "creating", "one", ".", "The", "entry", "may", "or", "may", "not", "be", "on", "the", "{", "@link", "Workbench", "}", "currently", "." ]
train
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/bubing/frontier/Workbench.java#L117-L124
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/RepositoryException.java
RepositoryException.backoff
public static <E extends Throwable> int backoff(E e, int retryCount, int milliseconds) throws E { """ One strategy for resolving an optimistic lock failure is to try the operation again, after waiting some bounded random amount of time. This method is provided as a convenience, to support such a random wait. <p> A retry count is required as well, which is decremented and returned by this method. If the retry count is zero (or less) when this method is called, then this exception is thrown again, indicating retry failure. @param retryCount current retry count, if zero, throw this exception again @param milliseconds upper bound on the random amount of time to wait @return retryCount minus one @throws E if retry count is zero """ if (retryCount <= 0) { // Workaround apparent compiler bug. org.cojen.util.ThrowUnchecked.fire(e); } if (milliseconds > 0) { Random rnd = cRandom; if (rnd == null) { cRandom = rnd = new Random(); } if ((milliseconds = rnd.nextInt(milliseconds)) > 0) { try { Thread.sleep(milliseconds); } catch (InterruptedException e2) { } return retryCount - 1; } } Thread.yield(); return retryCount - 1; }
java
public static <E extends Throwable> int backoff(E e, int retryCount, int milliseconds) throws E { if (retryCount <= 0) { // Workaround apparent compiler bug. org.cojen.util.ThrowUnchecked.fire(e); } if (milliseconds > 0) { Random rnd = cRandom; if (rnd == null) { cRandom = rnd = new Random(); } if ((milliseconds = rnd.nextInt(milliseconds)) > 0) { try { Thread.sleep(milliseconds); } catch (InterruptedException e2) { } return retryCount - 1; } } Thread.yield(); return retryCount - 1; }
[ "public", "static", "<", "E", "extends", "Throwable", ">", "int", "backoff", "(", "E", "e", ",", "int", "retryCount", ",", "int", "milliseconds", ")", "throws", "E", "{", "if", "(", "retryCount", "<=", "0", ")", "{", "// Workaround apparent compiler bug.\r",...
One strategy for resolving an optimistic lock failure is to try the operation again, after waiting some bounded random amount of time. This method is provided as a convenience, to support such a random wait. <p> A retry count is required as well, which is decremented and returned by this method. If the retry count is zero (or less) when this method is called, then this exception is thrown again, indicating retry failure. @param retryCount current retry count, if zero, throw this exception again @param milliseconds upper bound on the random amount of time to wait @return retryCount minus one @throws E if retry count is zero
[ "One", "strategy", "for", "resolving", "an", "optimistic", "lock", "failure", "is", "to", "try", "the", "operation", "again", "after", "waiting", "some", "bounded", "random", "amount", "of", "time", ".", "This", "method", "is", "provided", "as", "a", "conven...
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/RepositoryException.java#L71-L93
Azure/azure-sdk-for-java
iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java
IotHubResourcesInner.createEventHubConsumerGroupAsync
public Observable<EventHubConsumerGroupInfoInner> createEventHubConsumerGroupAsync(String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { """ Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. @param resourceGroupName The name of the resource group that contains the IoT hub. @param resourceName The name of the IoT hub. @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. @param name The name of the consumer group to add. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the EventHubConsumerGroupInfoInner object """ return createEventHubConsumerGroupWithServiceResponseAsync(resourceGroupName, resourceName, eventHubEndpointName, name).map(new Func1<ServiceResponse<EventHubConsumerGroupInfoInner>, EventHubConsumerGroupInfoInner>() { @Override public EventHubConsumerGroupInfoInner call(ServiceResponse<EventHubConsumerGroupInfoInner> response) { return response.body(); } }); }
java
public Observable<EventHubConsumerGroupInfoInner> createEventHubConsumerGroupAsync(String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { return createEventHubConsumerGroupWithServiceResponseAsync(resourceGroupName, resourceName, eventHubEndpointName, name).map(new Func1<ServiceResponse<EventHubConsumerGroupInfoInner>, EventHubConsumerGroupInfoInner>() { @Override public EventHubConsumerGroupInfoInner call(ServiceResponse<EventHubConsumerGroupInfoInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "EventHubConsumerGroupInfoInner", ">", "createEventHubConsumerGroupAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "String", "eventHubEndpointName", ",", "String", "name", ")", "{", "return", "createEventHubConsum...
Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. @param resourceGroupName The name of the resource group that contains the IoT hub. @param resourceName The name of the IoT hub. @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. @param name The name of the consumer group to add. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the EventHubConsumerGroupInfoInner object
[ "Add", "a", "consumer", "group", "to", "an", "Event", "Hub", "-", "compatible", "endpoint", "in", "an", "IoT", "hub", ".", "Add", "a", "consumer", "group", "to", "an", "Event", "Hub", "-", "compatible", "endpoint", "in", "an", "IoT", "hub", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L1905-L1912
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java
GeneratedDUserDaoImpl.queryByFriends
public Iterable<DUser> queryByFriends(java.lang.Object friends) { """ query-by method for field friends @param friends the specified attribute @return an Iterable of DUsers for the specified friends """ return queryByField(null, DUserMapper.Field.FRIENDS.getFieldName(), friends); }
java
public Iterable<DUser> queryByFriends(java.lang.Object friends) { return queryByField(null, DUserMapper.Field.FRIENDS.getFieldName(), friends); }
[ "public", "Iterable", "<", "DUser", ">", "queryByFriends", "(", "java", ".", "lang", ".", "Object", "friends", ")", "{", "return", "queryByField", "(", "null", ",", "DUserMapper", ".", "Field", ".", "FRIENDS", ".", "getFieldName", "(", ")", ",", "friends",...
query-by method for field friends @param friends the specified attribute @return an Iterable of DUsers for the specified friends
[ "query", "-", "by", "method", "for", "field", "friends" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java#L160-L162
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/IDNA.java
IDNA.convertIDNToASCII
@Deprecated public static StringBuffer convertIDNToASCII(UCharacterIterator src, int options) throws StringPrepParseException { """ IDNA2003: Convenience function that implements the IDNToASCII operation as defined in the IDNA RFC. This operation is done on complete domain names, e.g: "www.example.com". It is important to note that this operation can fail. If it fails, then the input domain name cannot be used as an Internationalized Domain Name and the application should have methods defined to deal with the failure. <b>Note:</b> IDNA RFC specifies that a conformant application should divide a domain name into separate labels, decide whether to apply allowUnassigned and useSTD3ASCIIRules on each, and then convert. This function does not offer that level of granularity. The options once set will apply to all labels in the domain name @param src The input string as UCharacterIterator to be processed @param options A bit set of options: - IDNA.DEFAULT Use default options, i.e., do not process unassigned code points and do not use STD3 ASCII rules If unassigned code points are found the operation fails with ParseException. - IDNA.ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations If this option is set, the unassigned code points are in the input are treated as normal Unicode code points. - IDNA.USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions If this option is set and the input does not satisfy STD3 rules, the operation will fail with ParseException @return StringBuffer the converted String @deprecated ICU 55 Use UTS 46 instead via {@link #getUTS46Instance(int)}. @hide original deprecated declaration """ return convertIDNToASCII(src.getText(), options); }
java
@Deprecated public static StringBuffer convertIDNToASCII(UCharacterIterator src, int options) throws StringPrepParseException{ return convertIDNToASCII(src.getText(), options); }
[ "@", "Deprecated", "public", "static", "StringBuffer", "convertIDNToASCII", "(", "UCharacterIterator", "src", ",", "int", "options", ")", "throws", "StringPrepParseException", "{", "return", "convertIDNToASCII", "(", "src", ".", "getText", "(", ")", ",", "options", ...
IDNA2003: Convenience function that implements the IDNToASCII operation as defined in the IDNA RFC. This operation is done on complete domain names, e.g: "www.example.com". It is important to note that this operation can fail. If it fails, then the input domain name cannot be used as an Internationalized Domain Name and the application should have methods defined to deal with the failure. <b>Note:</b> IDNA RFC specifies that a conformant application should divide a domain name into separate labels, decide whether to apply allowUnassigned and useSTD3ASCIIRules on each, and then convert. This function does not offer that level of granularity. The options once set will apply to all labels in the domain name @param src The input string as UCharacterIterator to be processed @param options A bit set of options: - IDNA.DEFAULT Use default options, i.e., do not process unassigned code points and do not use STD3 ASCII rules If unassigned code points are found the operation fails with ParseException. - IDNA.ALLOW_UNASSIGNED Unassigned values can be converted to ASCII for query operations If this option is set, the unassigned code points are in the input are treated as normal Unicode code points. - IDNA.USE_STD3_RULES Use STD3 ASCII rules for host name syntax restrictions If this option is set and the input does not satisfy STD3 rules, the operation will fail with ParseException @return StringBuffer the converted String @deprecated ICU 55 Use UTS 46 instead via {@link #getUTS46Instance(int)}. @hide original deprecated declaration
[ "IDNA2003", ":", "Convenience", "function", "that", "implements", "the", "IDNToASCII", "operation", "as", "defined", "in", "the", "IDNA", "RFC", ".", "This", "operation", "is", "done", "on", "complete", "domain", "names", "e", ".", "g", ":", "www", ".", "e...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/IDNA.java#L579-L583
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_service_serviceName_voiceConsumption_consumptionId_GET
public OvhVoiceConsumption billingAccount_service_serviceName_voiceConsumption_consumptionId_GET(String billingAccount, String serviceName, Long consumptionId) throws IOException { """ Get this object properties REST: GET /telephony/{billingAccount}/service/{serviceName}/voiceConsumption/{consumptionId} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param consumptionId [required] """ String qPath = "/telephony/{billingAccount}/service/{serviceName}/voiceConsumption/{consumptionId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, consumptionId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhVoiceConsumption.class); }
java
public OvhVoiceConsumption billingAccount_service_serviceName_voiceConsumption_consumptionId_GET(String billingAccount, String serviceName, Long consumptionId) throws IOException { String qPath = "/telephony/{billingAccount}/service/{serviceName}/voiceConsumption/{consumptionId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, consumptionId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhVoiceConsumption.class); }
[ "public", "OvhVoiceConsumption", "billingAccount_service_serviceName_voiceConsumption_consumptionId_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "consumptionId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billi...
Get this object properties REST: GET /telephony/{billingAccount}/service/{serviceName}/voiceConsumption/{consumptionId} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param consumptionId [required]
[ "Get", "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#L3745-L3750
actframework/actframework
src/main/java/act/event/EventBus.java
EventBus.bindAsync
public synchronized EventBus bindAsync(SysEventId sysEventId, SysEventListener sysEventListener) { """ Bind an {@link SysEventListener} to a {@link SysEventId} asynchronously. **Note** this method is not supposed to be called by user application directly. @param sysEventId the {@link SysEventId system event ID} @param sysEventListener an instance of {@link SysEventListener} @return this event bus instance """ return _bind(asyncSysEventListeners, sysEventId, sysEventListener); }
java
public synchronized EventBus bindAsync(SysEventId sysEventId, SysEventListener sysEventListener) { return _bind(asyncSysEventListeners, sysEventId, sysEventListener); }
[ "public", "synchronized", "EventBus", "bindAsync", "(", "SysEventId", "sysEventId", ",", "SysEventListener", "sysEventListener", ")", "{", "return", "_bind", "(", "asyncSysEventListeners", ",", "sysEventId", ",", "sysEventListener", ")", ";", "}" ]
Bind an {@link SysEventListener} to a {@link SysEventId} asynchronously. **Note** this method is not supposed to be called by user application directly. @param sysEventId the {@link SysEventId system event ID} @param sysEventListener an instance of {@link SysEventListener} @return this event bus instance
[ "Bind", "an", "{", "@link", "SysEventListener", "}", "to", "a", "{", "@link", "SysEventId", "}", "asynchronously", "." ]
train
https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/event/EventBus.java#L696-L698
alipay/sofa-rpc
core/common/src/main/java/com/alipay/sofa/rpc/common/utils/CommonUtils.java
CommonUtils.parseNum
public static <T extends Number> T parseNum(T num, T defaultInt) { """ 取数值 @param num 数字 @param defaultInt 默认值 @param <T> 数字的子类 @return int """ return num == null ? defaultInt : num; }
java
public static <T extends Number> T parseNum(T num, T defaultInt) { return num == null ? defaultInt : num; }
[ "public", "static", "<", "T", "extends", "Number", ">", "T", "parseNum", "(", "T", "num", ",", "T", "defaultInt", ")", "{", "return", "num", "==", "null", "?", "defaultInt", ":", "num", ";", "}" ]
取数值 @param num 数字 @param defaultInt 默认值 @param <T> 数字的子类 @return int
[ "取数值" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/common/src/main/java/com/alipay/sofa/rpc/common/utils/CommonUtils.java#L155-L157
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupsInner.java
SyncGroupsInner.cancelSyncAsync
public Observable<Void> cancelSyncAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { """ Cancels a sync group synchronization. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database on which the sync group is hosted. @param syncGroupName The name of the sync group. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful. """ return cancelSyncWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> cancelSyncAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName) { return cancelSyncWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "cancelSyncAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "String", "syncGroupName", ")", "{", "return", "cancelSyncWithServiceResponseAsync", "(", "resourceGroupName...
Cancels a sync group synchronization. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database on which the sync group is hosted. @param syncGroupName The name of the sync group. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Cancels", "a", "sync", "group", "synchronization", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncGroupsInner.java#L945-L952
cogroo/cogroo4
cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/util/EqualsUtils.java
EqualsUtils.areStringEquals
public static boolean areStringEquals(String string1, String string2) { """ Checks if two strings are equals. The strings can be both null, one of them null or none of them null. @param string1 from tree element @param string2 from rule element @return true if and only if the two strings are equal (both equal or both null) """ /* string1 string2 outcome * null null true * null x false * x null false * x y false * x x true */ // XXX both null must be unequal? If yes, boolean must be too? if (string1 == null && string2 == null) { return false; } else if (string1 != null && !string1.equals(string2)) { return false; } else if (string2 != null && !string2.equals(string1)) { return false; } return true; }
java
public static boolean areStringEquals(String string1, String string2) { /* string1 string2 outcome * null null true * null x false * x null false * x y false * x x true */ // XXX both null must be unequal? If yes, boolean must be too? if (string1 == null && string2 == null) { return false; } else if (string1 != null && !string1.equals(string2)) { return false; } else if (string2 != null && !string2.equals(string1)) { return false; } return true; }
[ "public", "static", "boolean", "areStringEquals", "(", "String", "string1", ",", "String", "string2", ")", "{", "/* string1\tstring2\toutcome\r\n\t\t * null\t\tnull\ttrue\r\n\t\t * null\t\tx\t\tfalse\r\n\t\t * x\t\tnull\tfalse\r\n\t\t * x\t\ty\t\tfalse\r\n\t\t * x\t\tx\t\ttrue\r\n\t\t */", ...
Checks if two strings are equals. The strings can be both null, one of them null or none of them null. @param string1 from tree element @param string2 from rule element @return true if and only if the two strings are equal (both equal or both null)
[ "Checks", "if", "two", "strings", "are", "equals", ".", "The", "strings", "can", "be", "both", "null", "one", "of", "them", "null", "or", "none", "of", "them", "null", "." ]
train
https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-gc/src/main/java/org/cogroo/tools/checker/rules/util/EqualsUtils.java#L152-L169
rundeck/rundeck
core/src/main/java/com/dtolabs/utils/Streams.java
Streams.copyStreamWithFilterSet
public static void copyStreamWithFilterSet(final InputStream in, final OutputStream out, final FilterSet set) throws IOException { """ Read the data from the input stream and write to the outputstream, filtering with an Ant FilterSet. @param in inputstream @param out outputstream @param set FilterSet to use @throws java.io.IOException if thrown by underlying io operations """ final BufferedReader reader = new BufferedReader(new InputStreamReader(in)); final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out)); String lSep = System.getProperty("line.separator"); String line = reader.readLine(); while (null != line) { writer.write(set.replaceTokens(line)); writer.write(lSep); line = reader.readLine(); } writer.flush(); }
java
public static void copyStreamWithFilterSet(final InputStream in, final OutputStream out, final FilterSet set) throws IOException { final BufferedReader reader = new BufferedReader(new InputStreamReader(in)); final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out)); String lSep = System.getProperty("line.separator"); String line = reader.readLine(); while (null != line) { writer.write(set.replaceTokens(line)); writer.write(lSep); line = reader.readLine(); } writer.flush(); }
[ "public", "static", "void", "copyStreamWithFilterSet", "(", "final", "InputStream", "in", ",", "final", "OutputStream", "out", ",", "final", "FilterSet", "set", ")", "throws", "IOException", "{", "final", "BufferedReader", "reader", "=", "new", "BufferedReader", "...
Read the data from the input stream and write to the outputstream, filtering with an Ant FilterSet. @param in inputstream @param out outputstream @param set FilterSet to use @throws java.io.IOException if thrown by underlying io operations
[ "Read", "the", "data", "from", "the", "input", "stream", "and", "write", "to", "the", "outputstream", "filtering", "with", "an", "Ant", "FilterSet", "." ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/utils/Streams.java#L148-L160
zxing/zxing
core/src/main/java/com/google/zxing/pdf417/encoder/PDF417ErrorCorrection.java
PDF417ErrorCorrection.generateErrorCorrection
static String generateErrorCorrection(CharSequence dataCodewords, int errorCorrectionLevel) { """ Generates the error correction codewords according to 4.10 in ISO/IEC 15438:2001(E). @param dataCodewords the data codewords @param errorCorrectionLevel the error correction level (0-8) @return the String representing the error correction codewords """ int k = getErrorCorrectionCodewordCount(errorCorrectionLevel); char[] e = new char[k]; int sld = dataCodewords.length(); for (int i = 0; i < sld; i++) { int t1 = (dataCodewords.charAt(i) + e[e.length - 1]) % 929; int t2; int t3; for (int j = k - 1; j >= 1; j--) { t2 = (t1 * EC_COEFFICIENTS[errorCorrectionLevel][j]) % 929; t3 = 929 - t2; e[j] = (char) ((e[j - 1] + t3) % 929); } t2 = (t1 * EC_COEFFICIENTS[errorCorrectionLevel][0]) % 929; t3 = 929 - t2; e[0] = (char) (t3 % 929); } StringBuilder sb = new StringBuilder(k); for (int j = k - 1; j >= 0; j--) { if (e[j] != 0) { e[j] = (char) (929 - e[j]); } sb.append(e[j]); } return sb.toString(); }
java
static String generateErrorCorrection(CharSequence dataCodewords, int errorCorrectionLevel) { int k = getErrorCorrectionCodewordCount(errorCorrectionLevel); char[] e = new char[k]; int sld = dataCodewords.length(); for (int i = 0; i < sld; i++) { int t1 = (dataCodewords.charAt(i) + e[e.length - 1]) % 929; int t2; int t3; for (int j = k - 1; j >= 1; j--) { t2 = (t1 * EC_COEFFICIENTS[errorCorrectionLevel][j]) % 929; t3 = 929 - t2; e[j] = (char) ((e[j - 1] + t3) % 929); } t2 = (t1 * EC_COEFFICIENTS[errorCorrectionLevel][0]) % 929; t3 = 929 - t2; e[0] = (char) (t3 % 929); } StringBuilder sb = new StringBuilder(k); for (int j = k - 1; j >= 0; j--) { if (e[j] != 0) { e[j] = (char) (929 - e[j]); } sb.append(e[j]); } return sb.toString(); }
[ "static", "String", "generateErrorCorrection", "(", "CharSequence", "dataCodewords", ",", "int", "errorCorrectionLevel", ")", "{", "int", "k", "=", "getErrorCorrectionCodewordCount", "(", "errorCorrectionLevel", ")", ";", "char", "[", "]", "e", "=", "new", "char", ...
Generates the error correction codewords according to 4.10 in ISO/IEC 15438:2001(E). @param dataCodewords the data codewords @param errorCorrectionLevel the error correction level (0-8) @return the String representing the error correction codewords
[ "Generates", "the", "error", "correction", "codewords", "according", "to", "4", ".", "10", "in", "ISO", "/", "IEC", "15438", ":", "2001", "(", "E", ")", "." ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/pdf417/encoder/PDF417ErrorCorrection.java#L177-L202
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/config/JawrConfig.java
JawrConfig.getBooleanProperty
public boolean getBooleanProperty(String propertyName, boolean defaultValue) { """ Returns the boolean property value @param propertyName the property name @param defaultValue the default value @return the boolean property value """ return Boolean.valueOf(getProperty(propertyName, Boolean.toString(defaultValue))); }
java
public boolean getBooleanProperty(String propertyName, boolean defaultValue) { return Boolean.valueOf(getProperty(propertyName, Boolean.toString(defaultValue))); }
[ "public", "boolean", "getBooleanProperty", "(", "String", "propertyName", ",", "boolean", "defaultValue", ")", "{", "return", "Boolean", ".", "valueOf", "(", "getProperty", "(", "propertyName", ",", "Boolean", ".", "toString", "(", "defaultValue", ")", ")", ")",...
Returns the boolean property value @param propertyName the property name @param defaultValue the default value @return the boolean property value
[ "Returns", "the", "boolean", "property", "value" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/config/JawrConfig.java#L1330-L1333
bbossgroups/bboss-elasticsearch
bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/RestClientUtil.java
RestClientUtil.addDateDocumentsWithIdOptions
public String addDateDocumentsWithIdOptions(String indexName, String indexType, List<Object> beans,String docIdField,String refreshOption) throws ElasticSearchException { """ 批量创建索引,根据时间格式建立新的索引表 @param indexName @param indexType @param beans @param docIdField 对象中作为文档id的Field @return @throws ElasticSearchException """ return addDocumentsWithIdField(this.indexNameBuilder.getIndexName(indexName), indexType, beans,docIdField,refreshOption); }
java
public String addDateDocumentsWithIdOptions(String indexName, String indexType, List<Object> beans,String docIdField,String refreshOption) throws ElasticSearchException{ return addDocumentsWithIdField(this.indexNameBuilder.getIndexName(indexName), indexType, beans,docIdField,refreshOption); }
[ "public", "String", "addDateDocumentsWithIdOptions", "(", "String", "indexName", ",", "String", "indexType", ",", "List", "<", "Object", ">", "beans", ",", "String", "docIdField", ",", "String", "refreshOption", ")", "throws", "ElasticSearchException", "{", "return"...
批量创建索引,根据时间格式建立新的索引表 @param indexName @param indexType @param beans @param docIdField 对象中作为文档id的Field @return @throws ElasticSearchException
[ "批量创建索引", "根据时间格式建立新的索引表" ]
train
https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/RestClientUtil.java#L3708-L3710
amaembo/streamex
src/main/java/one/util/streamex/LongStreamEx.java
LongStreamEx.foldLeft
public long foldLeft(long seed, LongBinaryOperator accumulator) { """ Folds the elements of this stream using the provided seed object and accumulation function, going left to right. This is equivalent to: <pre> {@code long result = seed; for (long element : this stream) result = accumulator.apply(result, element) return result; } </pre> <p> This is a terminal operation. <p> This method cannot take all the advantages of parallel streams as it must process elements strictly left to right. If your accumulator function is associative, consider using {@link #reduce(long, LongBinaryOperator)} method. <p> For parallel stream it's not guaranteed that accumulator will always be executed in the same thread. @param seed the starting value @param accumulator a <a href="package-summary.html#NonInterference">non-interfering </a>, <a href="package-summary.html#Statelessness">stateless</a> function for incorporating an additional element into a result @return the result of the folding @see #reduce(long, LongBinaryOperator) @see #foldLeft(LongBinaryOperator) @since 0.4.0 """ long[] box = new long[] { seed }; forEachOrdered(t -> box[0] = accumulator.applyAsLong(box[0], t)); return box[0]; }
java
public long foldLeft(long seed, LongBinaryOperator accumulator) { long[] box = new long[] { seed }; forEachOrdered(t -> box[0] = accumulator.applyAsLong(box[0], t)); return box[0]; }
[ "public", "long", "foldLeft", "(", "long", "seed", ",", "LongBinaryOperator", "accumulator", ")", "{", "long", "[", "]", "box", "=", "new", "long", "[", "]", "{", "seed", "}", ";", "forEachOrdered", "(", "t", "->", "box", "[", "0", "]", "=", "accumul...
Folds the elements of this stream using the provided seed object and accumulation function, going left to right. This is equivalent to: <pre> {@code long result = seed; for (long element : this stream) result = accumulator.apply(result, element) return result; } </pre> <p> This is a terminal operation. <p> This method cannot take all the advantages of parallel streams as it must process elements strictly left to right. If your accumulator function is associative, consider using {@link #reduce(long, LongBinaryOperator)} method. <p> For parallel stream it's not guaranteed that accumulator will always be executed in the same thread. @param seed the starting value @param accumulator a <a href="package-summary.html#NonInterference">non-interfering </a>, <a href="package-summary.html#Statelessness">stateless</a> function for incorporating an additional element into a result @return the result of the folding @see #reduce(long, LongBinaryOperator) @see #foldLeft(LongBinaryOperator) @since 0.4.0
[ "Folds", "the", "elements", "of", "this", "stream", "using", "the", "provided", "seed", "object", "and", "accumulation", "function", "going", "left", "to", "right", ".", "This", "is", "equivalent", "to", ":" ]
train
https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/LongStreamEx.java#L753-L757
protostuff/protostuff
protostuff-api/src/main/java/io/protostuff/UnsignedNumberUtil.java
UnsignedNumberUtil.unsignedLongToString
private static String unsignedLongToString(long x, int radix) { """ Returns a string representation of {@code x} for the given radix, where {@code x} is treated as unsigned. @param x the value to convert to a string. @param radix the radix to use while working with {@code x} @throws IllegalArgumentException if {@code radix} is not between {@link Character#MIN_RADIX} and {@link Character#MAX_RADIX}. """ if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX) { throw new IllegalArgumentException("Invalid radix: " + radix); } if (x == 0) { // Simply return "0" return "0"; } else { char[] buf = new char[64]; int i = buf.length; if (x < 0) { // Separate off the last digit using unsigned division. That will leave // a number that is nonnegative as a signed integer. long quotient = divide(x, radix); long rem = x - quotient * radix; buf[--i] = Character.forDigit((int) rem, radix); x = quotient; } // Simple modulo/division approach while (x > 0) { buf[--i] = Character.forDigit((int) (x % radix), radix); x /= radix; } // Generate string return new String(buf, i, buf.length - i); } }
java
private static String unsignedLongToString(long x, int radix) { if (radix < Character.MIN_RADIX || radix > Character.MAX_RADIX) { throw new IllegalArgumentException("Invalid radix: " + radix); } if (x == 0) { // Simply return "0" return "0"; } else { char[] buf = new char[64]; int i = buf.length; if (x < 0) { // Separate off the last digit using unsigned division. That will leave // a number that is nonnegative as a signed integer. long quotient = divide(x, radix); long rem = x - quotient * radix; buf[--i] = Character.forDigit((int) rem, radix); x = quotient; } // Simple modulo/division approach while (x > 0) { buf[--i] = Character.forDigit((int) (x % radix), radix); x /= radix; } // Generate string return new String(buf, i, buf.length - i); } }
[ "private", "static", "String", "unsignedLongToString", "(", "long", "x", ",", "int", "radix", ")", "{", "if", "(", "radix", "<", "Character", ".", "MIN_RADIX", "||", "radix", ">", "Character", ".", "MAX_RADIX", ")", "{", "throw", "new", "IllegalArgumentExcep...
Returns a string representation of {@code x} for the given radix, where {@code x} is treated as unsigned. @param x the value to convert to a string. @param radix the radix to use while working with {@code x} @throws IllegalArgumentException if {@code radix} is not between {@link Character#MIN_RADIX} and {@link Character#MAX_RADIX}.
[ "Returns", "a", "string", "representation", "of", "{", "@code", "x", "}", "for", "the", "given", "radix", "where", "{", "@code", "x", "}", "is", "treated", "as", "unsigned", "." ]
train
https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-api/src/main/java/io/protostuff/UnsignedNumberUtil.java#L355-L388
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/config/ConfigValidator.java
ConfigValidator.checkEvictionConfig
@SuppressWarnings("ConstantConditions") public static void checkEvictionConfig(EvictionConfig evictionConfig, boolean isNearCache) { """ Checks if a {@link EvictionConfig} is valid in its context. @param evictionConfig the {@link EvictionConfig} @param isNearCache {@code true} if the config is for a Near Cache, {@code false} otherwise """ if (evictionConfig == null) { throw new IllegalArgumentException("Eviction config cannot be null!"); } EvictionPolicy evictionPolicy = evictionConfig.getEvictionPolicy(); String comparatorClassName = evictionConfig.getComparatorClassName(); EvictionPolicyComparator comparator = evictionConfig.getComparator(); checkEvictionConfig(evictionPolicy, comparatorClassName, comparator, isNearCache); }
java
@SuppressWarnings("ConstantConditions") public static void checkEvictionConfig(EvictionConfig evictionConfig, boolean isNearCache) { if (evictionConfig == null) { throw new IllegalArgumentException("Eviction config cannot be null!"); } EvictionPolicy evictionPolicy = evictionConfig.getEvictionPolicy(); String comparatorClassName = evictionConfig.getComparatorClassName(); EvictionPolicyComparator comparator = evictionConfig.getComparator(); checkEvictionConfig(evictionPolicy, comparatorClassName, comparator, isNearCache); }
[ "@", "SuppressWarnings", "(", "\"ConstantConditions\"", ")", "public", "static", "void", "checkEvictionConfig", "(", "EvictionConfig", "evictionConfig", ",", "boolean", "isNearCache", ")", "{", "if", "(", "evictionConfig", "==", "null", ")", "{", "throw", "new", "...
Checks if a {@link EvictionConfig} is valid in its context. @param evictionConfig the {@link EvictionConfig} @param isNearCache {@code true} if the config is for a Near Cache, {@code false} otherwise
[ "Checks", "if", "a", "{", "@link", "EvictionConfig", "}", "is", "valid", "in", "its", "context", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/config/ConfigValidator.java#L231-L241
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/lib/CombineFileInputFormat.java
CombineFileInputFormat.sortBlocksBySize
private void sortBlocksBySize(Map<String, List<OneBlockInfo>> nodeToBlocks) { """ Sort the blocks on each node by size, largest to smallest @param nodeToBlocks Map of nodes to all blocks on that node """ OneBlockInfoSizeComparator comparator = new OneBlockInfoSizeComparator(); for (Entry<String, List<OneBlockInfo>> entry : nodeToBlocks.entrySet()) { Collections.sort(entry.getValue(), comparator); } }
java
private void sortBlocksBySize(Map<String, List<OneBlockInfo>> nodeToBlocks) { OneBlockInfoSizeComparator comparator = new OneBlockInfoSizeComparator(); for (Entry<String, List<OneBlockInfo>> entry : nodeToBlocks.entrySet()) { Collections.sort(entry.getValue(), comparator); } }
[ "private", "void", "sortBlocksBySize", "(", "Map", "<", "String", ",", "List", "<", "OneBlockInfo", ">", ">", "nodeToBlocks", ")", "{", "OneBlockInfoSizeComparator", "comparator", "=", "new", "OneBlockInfoSizeComparator", "(", ")", ";", "for", "(", "Entry", "<",...
Sort the blocks on each node by size, largest to smallest @param nodeToBlocks Map of nodes to all blocks on that node
[ "Sort", "the", "blocks", "on", "each", "node", "by", "size", "largest", "to", "smallest" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/lib/CombineFileInputFormat.java#L456-L461
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PtoPInputHandler.java
PtoPInputHandler.sendAckMessage
@Override public void sendAckMessage(SIBUuid8 sourceMEUuid, SIBUuid12 destUuid, SIBUuid8 busUuid, long ackPrefix, int priority, Reliability reliability, SIBUuid12 stream, boolean consolidate) throws SIResourceException { """ sendAckMessage is called from preCommitCallback after the message has been delivered to the final destination """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "sendAckMessage", new Long(ackPrefix)); ControlAck ackMsg = createControlAckMessage(); // As we are using the Guaranteed Header - set all the attributes as // well as the ones we want. SIMPUtils.setGuaranteedDeliveryProperties(ackMsg, _messageProcessor.getMessagingEngineUuid(), sourceMEUuid, stream, null, destUuid, ProtocolType.UNICASTOUTPUT, GDConfig.PROTOCOL_VERSION); ackMsg.setPriority(priority); ackMsg.setReliability(reliability); ackMsg.setAckPrefix(ackPrefix); // Send Ack messages at the priority of the original message +1 sendToME(ackMsg, sourceMEUuid, busUuid, priority + 1); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "sendAckMessage"); }
java
@Override public void sendAckMessage(SIBUuid8 sourceMEUuid, SIBUuid12 destUuid, SIBUuid8 busUuid, long ackPrefix, int priority, Reliability reliability, SIBUuid12 stream, boolean consolidate) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "sendAckMessage", new Long(ackPrefix)); ControlAck ackMsg = createControlAckMessage(); // As we are using the Guaranteed Header - set all the attributes as // well as the ones we want. SIMPUtils.setGuaranteedDeliveryProperties(ackMsg, _messageProcessor.getMessagingEngineUuid(), sourceMEUuid, stream, null, destUuid, ProtocolType.UNICASTOUTPUT, GDConfig.PROTOCOL_VERSION); ackMsg.setPriority(priority); ackMsg.setReliability(reliability); ackMsg.setAckPrefix(ackPrefix); // Send Ack messages at the priority of the original message +1 sendToME(ackMsg, sourceMEUuid, busUuid, priority + 1); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "sendAckMessage"); }
[ "@", "Override", "public", "void", "sendAckMessage", "(", "SIBUuid8", "sourceMEUuid", ",", "SIBUuid12", "destUuid", ",", "SIBUuid8", "busUuid", ",", "long", "ackPrefix", ",", "int", "priority", ",", "Reliability", "reliability", ",", "SIBUuid12", "stream", ",", ...
sendAckMessage is called from preCommitCallback after the message has been delivered to the final destination
[ "sendAckMessage", "is", "called", "from", "preCommitCallback", "after", "the", "message", "has", "been", "delivered", "to", "the", "final", "destination" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PtoPInputHandler.java#L1293-L1330
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPP14Reader.java
MPP14Reader.processViewPropertyData
private void processViewPropertyData() throws IOException { """ This method process the data held in the props file specific to the visual appearance of the project data. """ Props14 props = new Props14(m_inputStreamFactory.getInstance(m_viewDir, "Props")); byte[] data = props.getByteArray(Props.FONT_BASES); if (data != null) { processBaseFonts(data); } ProjectProperties properties = m_file.getProjectProperties(); properties.setShowProjectSummaryTask(props.getBoolean(Props.SHOW_PROJECT_SUMMARY_TASK)); }
java
private void processViewPropertyData() throws IOException { Props14 props = new Props14(m_inputStreamFactory.getInstance(m_viewDir, "Props")); byte[] data = props.getByteArray(Props.FONT_BASES); if (data != null) { processBaseFonts(data); } ProjectProperties properties = m_file.getProjectProperties(); properties.setShowProjectSummaryTask(props.getBoolean(Props.SHOW_PROJECT_SUMMARY_TASK)); }
[ "private", "void", "processViewPropertyData", "(", ")", "throws", "IOException", "{", "Props14", "props", "=", "new", "Props14", "(", "m_inputStreamFactory", ".", "getInstance", "(", "m_viewDir", ",", "\"Props\"", ")", ")", ";", "byte", "[", "]", "data", "=", ...
This method process the data held in the props file specific to the visual appearance of the project data.
[ "This", "method", "process", "the", "data", "held", "in", "the", "props", "file", "specific", "to", "the", "visual", "appearance", "of", "the", "project", "data", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP14Reader.java#L755-L766
icode/ameba
src/main/java/ameba/db/ebean/support/ModelResourceStructure.java
ModelResourceStructure.applyUriQuery
protected FutureRowCount applyUriQuery(final Query<MODEL> query, boolean needPageList) { """ apply uri query parameter on query @param query Query @param needPageList need page list @return page list count or null @see ModelInterceptor#applyUriQuery(MultivaluedMap, SpiQuery, InjectionManager, boolean) """ return ModelInterceptor.applyUriQuery(uriInfo.getQueryParameters(), (SpiQuery) query, manager, needPageList); }
java
protected FutureRowCount applyUriQuery(final Query<MODEL> query, boolean needPageList) { return ModelInterceptor.applyUriQuery(uriInfo.getQueryParameters(), (SpiQuery) query, manager, needPageList); }
[ "protected", "FutureRowCount", "applyUriQuery", "(", "final", "Query", "<", "MODEL", ">", "query", ",", "boolean", "needPageList", ")", "{", "return", "ModelInterceptor", ".", "applyUriQuery", "(", "uriInfo", ".", "getQueryParameters", "(", ")", ",", "(", "SpiQu...
apply uri query parameter on query @param query Query @param needPageList need page list @return page list count or null @see ModelInterceptor#applyUriQuery(MultivaluedMap, SpiQuery, InjectionManager, boolean)
[ "apply", "uri", "query", "parameter", "on", "query" ]
train
https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/support/ModelResourceStructure.java#L1002-L1004
alkacon/opencms-core
src/org/opencms/db/CmsLoginManager.java
CmsLoginManager.setLoginMessage
public void setLoginMessage(CmsObject cms, CmsLoginMessage message) throws CmsRoleViolationException { """ Sets the login message to display if a user logs in.<p> This operation requires that the current user has role permissions of <code>{@link CmsRole#ROOT_ADMIN}</code>.<p> @param cms the current OpenCms user context @param message the message to set @throws CmsRoleViolationException in case the current user does not have the required role permissions """ if (OpenCms.getRunLevel() >= OpenCms.RUNLEVEL_3_SHELL_ACCESS) { // during configuration phase no permission check id required OpenCms.getRoleManager().checkRole(cms, CmsRole.ROOT_ADMIN); } m_loginMessage = message; if (m_loginMessage != null) { m_loginMessage.setFrozen(); } }
java
public void setLoginMessage(CmsObject cms, CmsLoginMessage message) throws CmsRoleViolationException { if (OpenCms.getRunLevel() >= OpenCms.RUNLEVEL_3_SHELL_ACCESS) { // during configuration phase no permission check id required OpenCms.getRoleManager().checkRole(cms, CmsRole.ROOT_ADMIN); } m_loginMessage = message; if (m_loginMessage != null) { m_loginMessage.setFrozen(); } }
[ "public", "void", "setLoginMessage", "(", "CmsObject", "cms", ",", "CmsLoginMessage", "message", ")", "throws", "CmsRoleViolationException", "{", "if", "(", "OpenCms", ".", "getRunLevel", "(", ")", ">=", "OpenCms", ".", "RUNLEVEL_3_SHELL_ACCESS", ")", "{", "// dur...
Sets the login message to display if a user logs in.<p> This operation requires that the current user has role permissions of <code>{@link CmsRole#ROOT_ADMIN}</code>.<p> @param cms the current OpenCms user context @param message the message to set @throws CmsRoleViolationException in case the current user does not have the required role permissions
[ "Sets", "the", "login", "message", "to", "display", "if", "a", "user", "logs", "in", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsLoginManager.java#L679-L689
mabe02/lanterna
src/main/java/com/googlecode/lanterna/terminal/ansi/UnixLikeTerminal.java
UnixLikeTerminal.acquire
protected void acquire() throws IOException { """ Effectively taking over the terminal and enabling it for Lanterna to use, by turning off echo and canonical mode, adding resize listeners and optionally trap unix signals. This should be called automatically by the constructor of any end-user class extending from {@link UnixLikeTerminal} @throws IOException If there was an I/O error """ //Make sure to set an initial size onResized(80, 24); saveTerminalSettings(); canonicalMode(false); keyEchoEnabled(false); if(catchSpecialCharacters) { keyStrokeSignalsEnabled(false); } registerTerminalResizeListener(new Runnable() { @Override public void run() { // This will trigger a resize notification as the size will be different than before try { getTerminalSize(); } catch(IOException ignore) { // Not much to do here, we can't re-throw it } } }); Runtime.getRuntime().addShutdownHook(shutdownHook); acquired = true; }
java
protected void acquire() throws IOException { //Make sure to set an initial size onResized(80, 24); saveTerminalSettings(); canonicalMode(false); keyEchoEnabled(false); if(catchSpecialCharacters) { keyStrokeSignalsEnabled(false); } registerTerminalResizeListener(new Runnable() { @Override public void run() { // This will trigger a resize notification as the size will be different than before try { getTerminalSize(); } catch(IOException ignore) { // Not much to do here, we can't re-throw it } } }); Runtime.getRuntime().addShutdownHook(shutdownHook); acquired = true; }
[ "protected", "void", "acquire", "(", ")", "throws", "IOException", "{", "//Make sure to set an initial size", "onResized", "(", "80", ",", "24", ")", ";", "saveTerminalSettings", "(", ")", ";", "canonicalMode", "(", "false", ")", ";", "keyEchoEnabled", "(", "fal...
Effectively taking over the terminal and enabling it for Lanterna to use, by turning off echo and canonical mode, adding resize listeners and optionally trap unix signals. This should be called automatically by the constructor of any end-user class extending from {@link UnixLikeTerminal} @throws IOException If there was an I/O error
[ "Effectively", "taking", "over", "the", "terminal", "and", "enabling", "it", "for", "Lanterna", "to", "use", "by", "turning", "off", "echo", "and", "canonical", "mode", "adding", "resize", "listeners", "and", "optionally", "trap", "unix", "signals", ".", "This...
train
https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/terminal/ansi/UnixLikeTerminal.java#L82-L106
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/KeyEncoder.java
KeyEncoder.encodeDesc
public static void encodeDesc(double value, byte[] dst, int dstOffset) { """ Encodes the given double into exactly 8 bytes for descending order. @param value double value to encode @param dst destination for encoded bytes @param dstOffset offset into destination array """ long bits = Double.doubleToLongBits(value); if (bits >= 0) { bits ^= 0x7fffffffffffffffL; } int w = (int)(bits >> 32); dst[dstOffset ] = (byte)(w >> 24); dst[dstOffset + 1] = (byte)(w >> 16); dst[dstOffset + 2] = (byte)(w >> 8); dst[dstOffset + 3] = (byte)w; w = (int)bits; dst[dstOffset + 4] = (byte)(w >> 24); dst[dstOffset + 5] = (byte)(w >> 16); dst[dstOffset + 6] = (byte)(w >> 8); dst[dstOffset + 7] = (byte)w; }
java
public static void encodeDesc(double value, byte[] dst, int dstOffset) { long bits = Double.doubleToLongBits(value); if (bits >= 0) { bits ^= 0x7fffffffffffffffL; } int w = (int)(bits >> 32); dst[dstOffset ] = (byte)(w >> 24); dst[dstOffset + 1] = (byte)(w >> 16); dst[dstOffset + 2] = (byte)(w >> 8); dst[dstOffset + 3] = (byte)w; w = (int)bits; dst[dstOffset + 4] = (byte)(w >> 24); dst[dstOffset + 5] = (byte)(w >> 16); dst[dstOffset + 6] = (byte)(w >> 8); dst[dstOffset + 7] = (byte)w; }
[ "public", "static", "void", "encodeDesc", "(", "double", "value", ",", "byte", "[", "]", "dst", ",", "int", "dstOffset", ")", "{", "long", "bits", "=", "Double", ".", "doubleToLongBits", "(", "value", ")", ";", "if", "(", "bits", ">=", "0", ")", "{",...
Encodes the given double into exactly 8 bytes for descending order. @param value double value to encode @param dst destination for encoded bytes @param dstOffset offset into destination array
[ "Encodes", "the", "given", "double", "into", "exactly", "8", "bytes", "for", "descending", "order", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/KeyEncoder.java#L270-L285
infinispan/infinispan
core/src/main/java/org/infinispan/atomic/AtomicMapLookup.java
AtomicMapLookup.getFineGrainedAtomicMap
public static <MK, K, V> FineGrainedAtomicMap<K, V> getFineGrainedAtomicMap(Cache<MK, ?> cache, MK key) { """ Retrieves a fine grained atomic map from a given cache, stored under a given key. If a fine grained atomic map did not exist, one is created and registered in an atomic fashion. @param cache underlying cache @param key key under which the atomic map exists @param <MK> key param of the cache @param <K> key param of the AtomicMap @param <V> value param of the AtomicMap @return an AtomicMap """ return getFineGrainedAtomicMap(cache, key, true); }
java
public static <MK, K, V> FineGrainedAtomicMap<K, V> getFineGrainedAtomicMap(Cache<MK, ?> cache, MK key) { return getFineGrainedAtomicMap(cache, key, true); }
[ "public", "static", "<", "MK", ",", "K", ",", "V", ">", "FineGrainedAtomicMap", "<", "K", ",", "V", ">", "getFineGrainedAtomicMap", "(", "Cache", "<", "MK", ",", "?", ">", "cache", ",", "MK", "key", ")", "{", "return", "getFineGrainedAtomicMap", "(", "...
Retrieves a fine grained atomic map from a given cache, stored under a given key. If a fine grained atomic map did not exist, one is created and registered in an atomic fashion. @param cache underlying cache @param key key under which the atomic map exists @param <MK> key param of the cache @param <K> key param of the AtomicMap @param <V> value param of the AtomicMap @return an AtomicMap
[ "Retrieves", "a", "fine", "grained", "atomic", "map", "from", "a", "given", "cache", "stored", "under", "a", "given", "key", ".", "If", "a", "fine", "grained", "atomic", "map", "did", "not", "exist", "one", "is", "created", "and", "registered", "in", "an...
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/atomic/AtomicMapLookup.java#L48-L50
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java
SARLQuickfixProvider.fixDuplicateTopElements
@Fix(IssueCodes.DUPLICATE_TYPE_NAME) public void fixDuplicateTopElements(Issue issue, IssueResolutionAcceptor acceptor) { """ Quick fix for "Duplicate type". @param issue the issue. @param acceptor the quick fix acceptor. """ MemberRemoveModification.accept(this, issue, acceptor); }
java
@Fix(IssueCodes.DUPLICATE_TYPE_NAME) public void fixDuplicateTopElements(Issue issue, IssueResolutionAcceptor acceptor) { MemberRemoveModification.accept(this, issue, acceptor); }
[ "@", "Fix", "(", "IssueCodes", ".", "DUPLICATE_TYPE_NAME", ")", "public", "void", "fixDuplicateTopElements", "(", "Issue", "issue", ",", "IssueResolutionAcceptor", "acceptor", ")", "{", "MemberRemoveModification", ".", "accept", "(", "this", ",", "issue", ",", "ac...
Quick fix for "Duplicate type". @param issue the issue. @param acceptor the quick fix acceptor.
[ "Quick", "fix", "for", "Duplicate", "type", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L667-L670
playn/playn
core/src/playn/core/json/JsonArray.java
JsonArray.getNumber
public float getNumber(int key, float default_) { """ Returns the {@link Float} at the given index, or the default if it does not exist or is the wrong type. """ Object o = get(key); return o instanceof Number ? ((Number)o).floatValue() : default_; }
java
public float getNumber(int key, float default_) { Object o = get(key); return o instanceof Number ? ((Number)o).floatValue() : default_; }
[ "public", "float", "getNumber", "(", "int", "key", ",", "float", "default_", ")", "{", "Object", "o", "=", "get", "(", "key", ")", ";", "return", "o", "instanceof", "Number", "?", "(", "(", "Number", ")", "o", ")", ".", "floatValue", "(", ")", ":",...
Returns the {@link Float} at the given index, or the default if it does not exist or is the wrong type.
[ "Returns", "the", "{" ]
train
https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/json/JsonArray.java#L133-L136
casmi/casmi
src/main/java/casmi/graphics/material/Material.java
Material.setEmissive
public void setEmissive(float red, float green, float blue) { """ Sets the emissive color of the material used for drawing shapes drawn to the screen. @param red The red color of the emissive. @param green The green color of the emissive. @param blue The blue color of the emissive. """ emissive[0] = red; emissive[1] = green; emissive[2] = blue; Em = true; }
java
public void setEmissive(float red, float green, float blue){ emissive[0] = red; emissive[1] = green; emissive[2] = blue; Em = true; }
[ "public", "void", "setEmissive", "(", "float", "red", ",", "float", "green", ",", "float", "blue", ")", "{", "emissive", "[", "0", "]", "=", "red", ";", "emissive", "[", "1", "]", "=", "green", ";", "emissive", "[", "2", "]", "=", "blue", ";", "E...
Sets the emissive color of the material used for drawing shapes drawn to the screen. @param red The red color of the emissive. @param green The green color of the emissive. @param blue The blue color of the emissive.
[ "Sets", "the", "emissive", "color", "of", "the", "material", "used", "for", "drawing", "shapes", "drawn", "to", "the", "screen", "." ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/material/Material.java#L210-L215
BlueBrain/bluima
modules/bluima_typesystem/src/main/java/ch/epfl/bbp/uima/genia/Event.java
Event.setCauses_event
public void setCauses_event(int i, Event v) { """ indexed setter for causes_event - sets an indexed value - @generated @param i index in the array to set @param v value to set into the array """ if (Event_Type.featOkTst && ((Event_Type)jcasType).casFeat_causes_event == null) jcasType.jcas.throwFeatMissing("causes_event", "ch.epfl.bbp.uima.genia.Event"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Event_Type)jcasType).casFeatCode_causes_event), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Event_Type)jcasType).casFeatCode_causes_event), i, jcasType.ll_cas.ll_getFSRef(v));}
java
public void setCauses_event(int i, Event v) { if (Event_Type.featOkTst && ((Event_Type)jcasType).casFeat_causes_event == null) jcasType.jcas.throwFeatMissing("causes_event", "ch.epfl.bbp.uima.genia.Event"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Event_Type)jcasType).casFeatCode_causes_event), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Event_Type)jcasType).casFeatCode_causes_event), i, jcasType.ll_cas.ll_getFSRef(v));}
[ "public", "void", "setCauses_event", "(", "int", "i", ",", "Event", "v", ")", "{", "if", "(", "Event_Type", ".", "featOkTst", "&&", "(", "(", "Event_Type", ")", "jcasType", ")", ".", "casFeat_causes_event", "==", "null", ")", "jcasType", ".", "jcas", "."...
indexed setter for causes_event - sets an indexed value - @generated @param i index in the array to set @param v value to set into the array
[ "indexed", "setter", "for", "causes_event", "-", "sets", "an", "indexed", "value", "-" ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/ch/epfl/bbp/uima/genia/Event.java#L317-L321
cdk/cdk
tool/formula/src/main/java/org/openscience/cdk/tools/manipulator/MolecularFormulaRangeManipulator.java
MolecularFormulaRangeManipulator.getMinimalFormula
public static IMolecularFormula getMinimalFormula(MolecularFormulaRange mfRange, IChemObjectBuilder builder) { """ Returns the minimal occurrence of the IIsotope into IMolecularFormula from this MolelecularFormulaRange. @param mfRange The MolecularFormulaRange to analyze @return A IMolecularFormula containing the minimal occurrence of each isotope """ IMolecularFormula formula = builder.newInstance(IMolecularFormula.class); for (IIsotope isotope : mfRange.isotopes()) { formula.addIsotope(isotope, mfRange.getIsotopeCountMin(isotope)); } return formula; }
java
public static IMolecularFormula getMinimalFormula(MolecularFormulaRange mfRange, IChemObjectBuilder builder) { IMolecularFormula formula = builder.newInstance(IMolecularFormula.class); for (IIsotope isotope : mfRange.isotopes()) { formula.addIsotope(isotope, mfRange.getIsotopeCountMin(isotope)); } return formula; }
[ "public", "static", "IMolecularFormula", "getMinimalFormula", "(", "MolecularFormulaRange", "mfRange", ",", "IChemObjectBuilder", "builder", ")", "{", "IMolecularFormula", "formula", "=", "builder", ".", "newInstance", "(", "IMolecularFormula", ".", "class", ")", ";", ...
Returns the minimal occurrence of the IIsotope into IMolecularFormula from this MolelecularFormulaRange. @param mfRange The MolecularFormulaRange to analyze @return A IMolecularFormula containing the minimal occurrence of each isotope
[ "Returns", "the", "minimal", "occurrence", "of", "the", "IIsotope", "into", "IMolecularFormula", "from", "this", "MolelecularFormulaRange", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/formula/src/main/java/org/openscience/cdk/tools/manipulator/MolecularFormulaRangeManipulator.java#L108-L116
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java
MSPDIWriter.writePredecessors
private void writePredecessors(Project.Tasks.Task xml, Task mpx) { """ This method writes predecessor data to an MSPDI file. We have to deal with a slight anomaly in this method that is introduced by the MPX file format. It would be possible for someone to create an MPX file with both the predecessor list and the unique ID predecessor list populated... which means that we must process both and avoid adding duplicate predecessors. Also interesting to note is that MSP98 populates the predecessor list, not the unique ID predecessor list, as you might expect. @param xml MSPDI task data @param mpx MPX task data """ List<Project.Tasks.Task.PredecessorLink> list = xml.getPredecessorLink(); List<Relation> predecessors = mpx.getPredecessors(); for (Relation rel : predecessors) { Integer taskUniqueID = rel.getTargetTask().getUniqueID(); list.add(writePredecessor(taskUniqueID, rel.getType(), rel.getLag())); m_eventManager.fireRelationWrittenEvent(rel); } }
java
private void writePredecessors(Project.Tasks.Task xml, Task mpx) { List<Project.Tasks.Task.PredecessorLink> list = xml.getPredecessorLink(); List<Relation> predecessors = mpx.getPredecessors(); for (Relation rel : predecessors) { Integer taskUniqueID = rel.getTargetTask().getUniqueID(); list.add(writePredecessor(taskUniqueID, rel.getType(), rel.getLag())); m_eventManager.fireRelationWrittenEvent(rel); } }
[ "private", "void", "writePredecessors", "(", "Project", ".", "Tasks", ".", "Task", "xml", ",", "Task", "mpx", ")", "{", "List", "<", "Project", ".", "Tasks", ".", "Task", ".", "PredecessorLink", ">", "list", "=", "xml", ".", "getPredecessorLink", "(", ")...
This method writes predecessor data to an MSPDI file. We have to deal with a slight anomaly in this method that is introduced by the MPX file format. It would be possible for someone to create an MPX file with both the predecessor list and the unique ID predecessor list populated... which means that we must process both and avoid adding duplicate predecessors. Also interesting to note is that MSP98 populates the predecessor list, not the unique ID predecessor list, as you might expect. @param xml MSPDI task data @param mpx MPX task data
[ "This", "method", "writes", "predecessor", "data", "to", "an", "MSPDI", "file", ".", "We", "have", "to", "deal", "with", "a", "slight", "anomaly", "in", "this", "method", "that", "is", "introduced", "by", "the", "MPX", "file", "format", ".", "It", "would...
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L1387-L1398
Impetus/Kundera
src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/datahandler/CassandraDataHandlerBase.java
CassandraDataHandlerBase.onDiscriminatorColumn
private void onDiscriminatorColumn(ThriftRow tr, long timestamp, EntityType entityType) { """ On discriminator column. @param tr the tr @param timestamp the timestamp @param entityType the entity type """ String discrColumn = ((AbstractManagedType) entityType).getDiscriminatorColumn(); String discrValue = ((AbstractManagedType) entityType).getDiscriminatorValue(); // No need to check for empty or blank, as considering it as valid name // for nosql! if (discrColumn != null && discrValue != null) { Column column = prepareColumn(PropertyAccessorHelper.getBytes(discrValue), PropertyAccessorHelper.getBytes(discrColumn), timestamp, 0); tr.addColumn(column); } }
java
private void onDiscriminatorColumn(ThriftRow tr, long timestamp, EntityType entityType) { String discrColumn = ((AbstractManagedType) entityType).getDiscriminatorColumn(); String discrValue = ((AbstractManagedType) entityType).getDiscriminatorValue(); // No need to check for empty or blank, as considering it as valid name // for nosql! if (discrColumn != null && discrValue != null) { Column column = prepareColumn(PropertyAccessorHelper.getBytes(discrValue), PropertyAccessorHelper.getBytes(discrColumn), timestamp, 0); tr.addColumn(column); } }
[ "private", "void", "onDiscriminatorColumn", "(", "ThriftRow", "tr", ",", "long", "timestamp", ",", "EntityType", "entityType", ")", "{", "String", "discrColumn", "=", "(", "(", "AbstractManagedType", ")", "entityType", ")", ".", "getDiscriminatorColumn", "(", ")",...
On discriminator column. @param tr the tr @param timestamp the timestamp @param entityType the entity type
[ "On", "discriminator", "column", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/datahandler/CassandraDataHandlerBase.java#L1948-L1961
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/JDBCDriverService.java
JDBCDriverService.classNotFound
private SQLException classNotFound(Object interfaceNames, Set<String> packagesSearched, String dsId, Throwable cause) { """ Returns an exception to raise when the data source class is not found. @param interfaceNames names of data source interface(s) or java.sql.Driver for which we could not find an implementation class. @param packagesSearched packages in or beneath which we have searched for data source implementation classes. @param dsId identifier for the data source that is using this JDBC driver. @param cause error that already occurred. Null if not applicable. @return an exception to raise when the data source class is not found. """ if (cause instanceof SQLException) return (SQLException) cause; // TODO need an appropriate message when sharedLib is null and classes are loaded from the application String sharedLibId = sharedLib.id(); // Determine the list of folders that should contain the JDBC driver files. Collection<String> driverJARs = getClasspath(sharedLib, false); String message = sharedLibId.startsWith("com.ibm.ws.jdbc.jdbcDriver-") ? AdapterUtil.getNLSMessage("DSRA4001.no.suitable.driver.nested", interfaceNames, dsId, driverJARs, packagesSearched) : AdapterUtil.getNLSMessage("DSRA4000.no.suitable.driver", interfaceNames, dsId, sharedLibId, driverJARs, packagesSearched); return new SQLNonTransientException(message, cause); }
java
private SQLException classNotFound(Object interfaceNames, Set<String> packagesSearched, String dsId, Throwable cause) { if (cause instanceof SQLException) return (SQLException) cause; // TODO need an appropriate message when sharedLib is null and classes are loaded from the application String sharedLibId = sharedLib.id(); // Determine the list of folders that should contain the JDBC driver files. Collection<String> driverJARs = getClasspath(sharedLib, false); String message = sharedLibId.startsWith("com.ibm.ws.jdbc.jdbcDriver-") ? AdapterUtil.getNLSMessage("DSRA4001.no.suitable.driver.nested", interfaceNames, dsId, driverJARs, packagesSearched) : AdapterUtil.getNLSMessage("DSRA4000.no.suitable.driver", interfaceNames, dsId, sharedLibId, driverJARs, packagesSearched); return new SQLNonTransientException(message, cause); }
[ "private", "SQLException", "classNotFound", "(", "Object", "interfaceNames", ",", "Set", "<", "String", ">", "packagesSearched", ",", "String", "dsId", ",", "Throwable", "cause", ")", "{", "if", "(", "cause", "instanceof", "SQLException", ")", "return", "(", "...
Returns an exception to raise when the data source class is not found. @param interfaceNames names of data source interface(s) or java.sql.Driver for which we could not find an implementation class. @param packagesSearched packages in or beneath which we have searched for data source implementation classes. @param dsId identifier for the data source that is using this JDBC driver. @param cause error that already occurred. Null if not applicable. @return an exception to raise when the data source class is not found.
[ "Returns", "an", "exception", "to", "raise", "when", "the", "data", "source", "class", "is", "not", "found", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/JDBCDriverService.java#L206-L221
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/execution/workflow/steps/node/impl/DefaultScriptFileNodeStepUtils.java
DefaultScriptFileNodeStepUtils.removeArgsForOsFamily
@Override public ExecArgList removeArgsForOsFamily(String filepath, String osFamily) { """ Return ExecArgList for removing a file for the given OS family @param filepath path @param osFamily family @return arg list """ if ("windows".equalsIgnoreCase(osFamily)) { return ExecArgList.fromStrings(false, "del", filepath); } else { return ExecArgList.fromStrings(false, "rm", "-f", filepath); } }
java
@Override public ExecArgList removeArgsForOsFamily(String filepath, String osFamily) { if ("windows".equalsIgnoreCase(osFamily)) { return ExecArgList.fromStrings(false, "del", filepath); } else { return ExecArgList.fromStrings(false, "rm", "-f", filepath); } }
[ "@", "Override", "public", "ExecArgList", "removeArgsForOsFamily", "(", "String", "filepath", ",", "String", "osFamily", ")", "{", "if", "(", "\"windows\"", ".", "equalsIgnoreCase", "(", "osFamily", ")", ")", "{", "return", "ExecArgList", ".", "fromStrings", "("...
Return ExecArgList for removing a file for the given OS family @param filepath path @param osFamily family @return arg list
[ "Return", "ExecArgList", "for", "removing", "a", "file", "for", "the", "given", "OS", "family" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/execution/workflow/steps/node/impl/DefaultScriptFileNodeStepUtils.java#L332-L339
apache/incubator-gobblin
gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/writer/commands/TeradataBufferedInserter.java
TeradataBufferedInserter.getColumnPosSqlTypes
private Map<Integer, Integer> getColumnPosSqlTypes() { """ Creates a mapping between column positions and their data types @return A map containing the position of the columns along with their data type as value """ try { final Map<Integer, Integer> columnPosSqlTypes = Maps.newHashMap(); ParameterMetaData pMetaData = this.insertPstmtForFixedBatch.getParameterMetaData(); for (int i = 1; i <= pMetaData.getParameterCount(); i++) { columnPosSqlTypes.put(i, pMetaData.getParameterType(i)); } return columnPosSqlTypes; } catch (SQLException e) { throw new RuntimeException("Cannot retrieve columns types for batch insert", e); } }
java
private Map<Integer, Integer> getColumnPosSqlTypes() { try { final Map<Integer, Integer> columnPosSqlTypes = Maps.newHashMap(); ParameterMetaData pMetaData = this.insertPstmtForFixedBatch.getParameterMetaData(); for (int i = 1; i <= pMetaData.getParameterCount(); i++) { columnPosSqlTypes.put(i, pMetaData.getParameterType(i)); } return columnPosSqlTypes; } catch (SQLException e) { throw new RuntimeException("Cannot retrieve columns types for batch insert", e); } }
[ "private", "Map", "<", "Integer", ",", "Integer", ">", "getColumnPosSqlTypes", "(", ")", "{", "try", "{", "final", "Map", "<", "Integer", ",", "Integer", ">", "columnPosSqlTypes", "=", "Maps", ".", "newHashMap", "(", ")", ";", "ParameterMetaData", "pMetaData...
Creates a mapping between column positions and their data types @return A map containing the position of the columns along with their data type as value
[ "Creates", "a", "mapping", "between", "column", "positions", "and", "their", "data", "types" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-sql/src/main/java/org/apache/gobblin/writer/commands/TeradataBufferedInserter.java#L108-L119
hyperledger/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/security/CryptoPrimitives.java
CryptoPrimitives.addCACertificateToTrustStore
public void addCACertificateToTrustStore(File caCertPem, String alias) throws CryptoException, InvalidArgumentException { """ addCACertificateToTrustStore adds a CA cert to the set of certificates used for signature validation @param caCertPem an X.509 certificate in PEM format @param alias an alias associated with the certificate. Used as shorthand for the certificate during crypto operations @throws CryptoException @throws InvalidArgumentException """ if (caCertPem == null) { throw new InvalidArgumentException("The certificate cannot be null"); } if (alias == null || alias.isEmpty()) { throw new InvalidArgumentException("You must assign an alias to a certificate when adding to the trust store"); } try { try (BufferedInputStream bis = new BufferedInputStream(new ByteArrayInputStream(FileUtils.readFileToByteArray(caCertPem)))) { Certificate caCert = cf.generateCertificate(bis); addCACertificateToTrustStore(caCert, alias); } } catch (CertificateException | IOException e) { throw new CryptoException("Unable to add CA certificate to trust store. Error: " + e.getMessage(), e); } }
java
public void addCACertificateToTrustStore(File caCertPem, String alias) throws CryptoException, InvalidArgumentException { if (caCertPem == null) { throw new InvalidArgumentException("The certificate cannot be null"); } if (alias == null || alias.isEmpty()) { throw new InvalidArgumentException("You must assign an alias to a certificate when adding to the trust store"); } try { try (BufferedInputStream bis = new BufferedInputStream(new ByteArrayInputStream(FileUtils.readFileToByteArray(caCertPem)))) { Certificate caCert = cf.generateCertificate(bis); addCACertificateToTrustStore(caCert, alias); } } catch (CertificateException | IOException e) { throw new CryptoException("Unable to add CA certificate to trust store. Error: " + e.getMessage(), e); } }
[ "public", "void", "addCACertificateToTrustStore", "(", "File", "caCertPem", ",", "String", "alias", ")", "throws", "CryptoException", ",", "InvalidArgumentException", "{", "if", "(", "caCertPem", "==", "null", ")", "{", "throw", "new", "InvalidArgumentException", "(...
addCACertificateToTrustStore adds a CA cert to the set of certificates used for signature validation @param caCertPem an X.509 certificate in PEM format @param alias an alias associated with the certificate. Used as shorthand for the certificate during crypto operations @throws CryptoException @throws InvalidArgumentException
[ "addCACertificateToTrustStore", "adds", "a", "CA", "cert", "to", "the", "set", "of", "certificates", "used", "for", "signature", "validation" ]
train
https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/security/CryptoPrimitives.java#L398-L418
Azure/azure-sdk-for-java
compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/SnapshotsInner.java
SnapshotsInner.beginUpdateAsync
public Observable<SnapshotInner> beginUpdateAsync(String resourceGroupName, String snapshotName, SnapshotUpdate snapshot) { """ Updates (patches) a snapshot. @param resourceGroupName The name of the resource group. @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. @param snapshot Snapshot object supplied in the body of the Patch snapshot operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SnapshotInner object """ return beginUpdateWithServiceResponseAsync(resourceGroupName, snapshotName, snapshot).map(new Func1<ServiceResponse<SnapshotInner>, SnapshotInner>() { @Override public SnapshotInner call(ServiceResponse<SnapshotInner> response) { return response.body(); } }); }
java
public Observable<SnapshotInner> beginUpdateAsync(String resourceGroupName, String snapshotName, SnapshotUpdate snapshot) { return beginUpdateWithServiceResponseAsync(resourceGroupName, snapshotName, snapshot).map(new Func1<ServiceResponse<SnapshotInner>, SnapshotInner>() { @Override public SnapshotInner call(ServiceResponse<SnapshotInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "SnapshotInner", ">", "beginUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "snapshotName", ",", "SnapshotUpdate", "snapshot", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "snapshot...
Updates (patches) a snapshot. @param resourceGroupName The name of the resource group. @param snapshotName The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters. @param snapshot Snapshot object supplied in the body of the Patch snapshot operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SnapshotInner object
[ "Updates", "(", "patches", ")", "a", "snapshot", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/SnapshotsInner.java#L420-L427
dkpro/dkpro-jwpl
de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/api/RevisionApi.java
RevisionApi.checkMapping
protected int checkMapping(final int articleID, final int revisionCounter) throws SQLException { """ This method maps the chronological order to the revisionCounter. @param articleID ID of the article @param revisionCounter chronological position @return position in the chronological order @throws SQLException if an error occurs while accesing the database. """ PreparedStatement statement = null; ResultSet result = null; // Check for the correct revisionCounter mapping try { statement = this.connection.prepareStatement("SELECT Mapping " + "FROM index_chronological " + "WHERE ArticleID=? LIMIT 1"); statement.setInt(1, articleID); result = statement.executeQuery(); if (result.next()) { String mapping = result.getString(1); return getMapping(mapping, revisionCounter); } } finally { if (statement != null) { statement.close(); } if (result != null) { result.close(); } } return revisionCounter; }
java
protected int checkMapping(final int articleID, final int revisionCounter) throws SQLException { PreparedStatement statement = null; ResultSet result = null; // Check for the correct revisionCounter mapping try { statement = this.connection.prepareStatement("SELECT Mapping " + "FROM index_chronological " + "WHERE ArticleID=? LIMIT 1"); statement.setInt(1, articleID); result = statement.executeQuery(); if (result.next()) { String mapping = result.getString(1); return getMapping(mapping, revisionCounter); } } finally { if (statement != null) { statement.close(); } if (result != null) { result.close(); } } return revisionCounter; }
[ "protected", "int", "checkMapping", "(", "final", "int", "articleID", ",", "final", "int", "revisionCounter", ")", "throws", "SQLException", "{", "PreparedStatement", "statement", "=", "null", ";", "ResultSet", "result", "=", "null", ";", "// Check for the correct r...
This method maps the chronological order to the revisionCounter. @param articleID ID of the article @param revisionCounter chronological position @return position in the chronological order @throws SQLException if an error occurs while accesing the database.
[ "This", "method", "maps", "the", "chronological", "order", "to", "the", "revisionCounter", "." ]
train
https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/api/RevisionApi.java#L1575-L1606
jamesdbloom/mockserver
mockserver-client-java/src/main/java/org/mockserver/client/MockServerClient.java
MockServerClient.retrieveRecordedRequests
public String retrieveRecordedRequests(HttpRequest httpRequest, Format format) { """ Retrieve the recorded requests that match the httpRequest parameter, use null for the parameter to retrieve all requests @param httpRequest the http request that is matched against when deciding whether to return each request, use null for the parameter to retrieve for all requests @param format the format to retrieve the expectations, either JAVA or JSON @return an array of all requests that have been recorded by the MockServer in the order they have been received and including duplicates where the same request has been received multiple times """ HttpResponse httpResponse = sendRequest( request() .withMethod("PUT") .withPath(calculatePath("retrieve")) .withQueryStringParameter("type", RetrieveType.REQUESTS.name()) .withQueryStringParameter("format", format.name()) .withBody(httpRequest != null ? httpRequestSerializer.serialize(httpRequest) : "", StandardCharsets.UTF_8) ); return httpResponse.getBodyAsString(); }
java
public String retrieveRecordedRequests(HttpRequest httpRequest, Format format) { HttpResponse httpResponse = sendRequest( request() .withMethod("PUT") .withPath(calculatePath("retrieve")) .withQueryStringParameter("type", RetrieveType.REQUESTS.name()) .withQueryStringParameter("format", format.name()) .withBody(httpRequest != null ? httpRequestSerializer.serialize(httpRequest) : "", StandardCharsets.UTF_8) ); return httpResponse.getBodyAsString(); }
[ "public", "String", "retrieveRecordedRequests", "(", "HttpRequest", "httpRequest", ",", "Format", "format", ")", "{", "HttpResponse", "httpResponse", "=", "sendRequest", "(", "request", "(", ")", ".", "withMethod", "(", "\"PUT\"", ")", ".", "withPath", "(", "cal...
Retrieve the recorded requests that match the httpRequest parameter, use null for the parameter to retrieve all requests @param httpRequest the http request that is matched against when deciding whether to return each request, use null for the parameter to retrieve for all requests @param format the format to retrieve the expectations, either JAVA or JSON @return an array of all requests that have been recorded by the MockServer in the order they have been received and including duplicates where the same request has been received multiple times
[ "Retrieve", "the", "recorded", "requests", "that", "match", "the", "httpRequest", "parameter", "use", "null", "for", "the", "parameter", "to", "retrieve", "all", "requests" ]
train
https://github.com/jamesdbloom/mockserver/blob/8b84fdd877e57b4eb780c9f8c8b1d65bcb448025/mockserver-client-java/src/main/java/org/mockserver/client/MockServerClient.java#L399-L409
dita-ot/dita-ot
src/main/java/org/dita/dost/module/DebugAndFilterModule.java
DebugAndFilterModule.getRelativePathFromOut
private static String getRelativePathFromOut(final File overflowingFile, final Job job) { """ Just for the overflowing files. @param overflowingFile overflowingFile @return relative system path to out which ends in {@link java.io.File#separator File.separator} """ final URI relativePath = URLUtils.getRelativePath(job.getInputFile(), overflowingFile.toURI()); final File outputDir = job.getOutputDir().getAbsoluteFile(); final File outputPathName = new File(outputDir, "index.html"); final File finalOutFilePathName = resolve(outputDir, relativePath.getPath()); final File finalRelativePathName = FileUtils.getRelativePath(finalOutFilePathName, outputPathName); File parentDir = finalRelativePathName.getParentFile(); if (parentDir == null || parentDir.getPath().isEmpty()) { parentDir = new File("."); } return parentDir.getPath() + File.separator; }
java
private static String getRelativePathFromOut(final File overflowingFile, final Job job) { final URI relativePath = URLUtils.getRelativePath(job.getInputFile(), overflowingFile.toURI()); final File outputDir = job.getOutputDir().getAbsoluteFile(); final File outputPathName = new File(outputDir, "index.html"); final File finalOutFilePathName = resolve(outputDir, relativePath.getPath()); final File finalRelativePathName = FileUtils.getRelativePath(finalOutFilePathName, outputPathName); File parentDir = finalRelativePathName.getParentFile(); if (parentDir == null || parentDir.getPath().isEmpty()) { parentDir = new File("."); } return parentDir.getPath() + File.separator; }
[ "private", "static", "String", "getRelativePathFromOut", "(", "final", "File", "overflowingFile", ",", "final", "Job", "job", ")", "{", "final", "URI", "relativePath", "=", "URLUtils", ".", "getRelativePath", "(", "job", ".", "getInputFile", "(", ")", ",", "ov...
Just for the overflowing files. @param overflowingFile overflowingFile @return relative system path to out which ends in {@link java.io.File#separator File.separator}
[ "Just", "for", "the", "overflowing", "files", "." ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/DebugAndFilterModule.java#L527-L538
mgormley/agiga
src/main/java/edu/jhu/agiga/AgigaSentenceReader.java
AgigaSentenceReader.parseParse
private String parseParse(VTDNav vn) throws NavException, PilotException { """ Assumes the position of vn is at a AgigaConstants.SENTENCE tag @return """ require (vn.matchElement(AgigaConstants.SENTENCE)); // Move to the <parse> tag require (vn.toElement(VTDNav.FC, AgigaConstants.PARSE)); String parseText = vn.toString(vn.getText()); return parseText; }
java
private String parseParse(VTDNav vn) throws NavException, PilotException { require (vn.matchElement(AgigaConstants.SENTENCE)); // Move to the <parse> tag require (vn.toElement(VTDNav.FC, AgigaConstants.PARSE)); String parseText = vn.toString(vn.getText()); return parseText; }
[ "private", "String", "parseParse", "(", "VTDNav", "vn", ")", "throws", "NavException", ",", "PilotException", "{", "require", "(", "vn", ".", "matchElement", "(", "AgigaConstants", ".", "SENTENCE", ")", ")", ";", "// Move to the <parse> tag", "require", "(", "vn...
Assumes the position of vn is at a AgigaConstants.SENTENCE tag @return
[ "Assumes", "the", "position", "of", "vn", "is", "at", "a", "AgigaConstants", ".", "SENTENCE", "tag" ]
train
https://github.com/mgormley/agiga/blob/d61db78e3fa9d2470122d869a9ab798cb07eea3b/src/main/java/edu/jhu/agiga/AgigaSentenceReader.java#L299-L308
apereo/cas
support/cas-server-support-saml-idp-core/src/main/java/org/apereo/cas/support/saml/services/idp/metadata/SamlRegisteredServiceServiceProviderMetadataFacade.java
SamlRegisteredServiceServiceProviderMetadataFacade.get
public static Optional<SamlRegisteredServiceServiceProviderMetadataFacade> get(final SamlRegisteredServiceCachingMetadataResolver resolver, final SamlRegisteredService registeredService, final RequestAbstractType request) { """ Adapt saml metadata and parse. Acts as a facade. @param resolver the resolver @param registeredService the service @param request the request @return the saml metadata adaptor """ return get(resolver, registeredService, SamlIdPUtils.getIssuerFromSamlObject(request)); }
java
public static Optional<SamlRegisteredServiceServiceProviderMetadataFacade> get(final SamlRegisteredServiceCachingMetadataResolver resolver, final SamlRegisteredService registeredService, final RequestAbstractType request) { return get(resolver, registeredService, SamlIdPUtils.getIssuerFromSamlObject(request)); }
[ "public", "static", "Optional", "<", "SamlRegisteredServiceServiceProviderMetadataFacade", ">", "get", "(", "final", "SamlRegisteredServiceCachingMetadataResolver", "resolver", ",", "final", "SamlRegisteredService", "registeredService", ",", "final", "RequestAbstractType", "reque...
Adapt saml metadata and parse. Acts as a facade. @param resolver the resolver @param registeredService the service @param request the request @return the saml metadata adaptor
[ "Adapt", "saml", "metadata", "and", "parse", ".", "Acts", "as", "a", "facade", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-core/src/main/java/org/apereo/cas/support/saml/services/idp/metadata/SamlRegisteredServiceServiceProviderMetadataFacade.java#L79-L83
rythmengine/rythmengine
src/main/java/org/rythmengine/template/TemplateBase.java
TemplateBase.__addLayoutSection
private void __addLayoutSection(String name, String section, boolean def) { """ Add layout section. Should not be used in user application or template @param name @param section """ Map<String, String> m = def ? layoutSections0 : layoutSections; if (m.containsKey(name)) return; m.put(name, section); }
java
private void __addLayoutSection(String name, String section, boolean def) { Map<String, String> m = def ? layoutSections0 : layoutSections; if (m.containsKey(name)) return; m.put(name, section); }
[ "private", "void", "__addLayoutSection", "(", "String", "name", ",", "String", "section", ",", "boolean", "def", ")", "{", "Map", "<", "String", ",", "String", ">", "m", "=", "def", "?", "layoutSections0", ":", "layoutSections", ";", "if", "(", "m", ".",...
Add layout section. Should not be used in user application or template @param name @param section
[ "Add", "layout", "section", ".", "Should", "not", "be", "used", "in", "user", "application", "or", "template" ]
train
https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/template/TemplateBase.java#L313-L317
WiQuery/wiquery
wiquery-core/src/main/java/org/odlabs/wiquery/core/options/Options.java
Options.putString
public Options putString(String key, IModel<String> value) { """ <p> Puts a {@link String} value for the given option name. </p> @param key the option name. @param value the {@link String} value. """ putOption(key, new StringOption(value)); return this; }
java
public Options putString(String key, IModel<String> value) { putOption(key, new StringOption(value)); return this; }
[ "public", "Options", "putString", "(", "String", "key", ",", "IModel", "<", "String", ">", "value", ")", "{", "putOption", "(", "key", ",", "new", "StringOption", "(", "value", ")", ")", ";", "return", "this", ";", "}" ]
<p> Puts a {@link String} value for the given option name. </p> @param key the option name. @param value the {@link String} value.
[ "<p", ">", "Puts", "a", "{", "@link", "String", "}", "value", "for", "the", "given", "option", "name", ".", "<", "/", "p", ">" ]
train
https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-core/src/main/java/org/odlabs/wiquery/core/options/Options.java#L564-L568
aws/aws-sdk-java
aws-java-sdk-simpledb/src/main/java/com/amazonaws/services/simpledb/util/SimpleDBUtils.java
SimpleDBUtils.encodeZeroPadding
public static String encodeZeroPadding(long number, int maxNumDigits) { """ Encodes positive long value into a string by zero-padding the value up to the specified number of digits. @param number positive long to be encoded @param maxNumDigits maximum number of digits in the largest value in the data set @return string representation of the zero-padded long """ String longString = Long.toString(number); int numZeroes = maxNumDigits - longString.length(); StringBuffer strBuffer = new StringBuffer(numZeroes + longString.length()); for (int i = 0; i < numZeroes; i++) { strBuffer.insert(i, '0'); } strBuffer.append(longString); return strBuffer.toString(); }
java
public static String encodeZeroPadding(long number, int maxNumDigits) { String longString = Long.toString(number); int numZeroes = maxNumDigits - longString.length(); StringBuffer strBuffer = new StringBuffer(numZeroes + longString.length()); for (int i = 0; i < numZeroes; i++) { strBuffer.insert(i, '0'); } strBuffer.append(longString); return strBuffer.toString(); }
[ "public", "static", "String", "encodeZeroPadding", "(", "long", "number", ",", "int", "maxNumDigits", ")", "{", "String", "longString", "=", "Long", ".", "toString", "(", "number", ")", ";", "int", "numZeroes", "=", "maxNumDigits", "-", "longString", ".", "l...
Encodes positive long value into a string by zero-padding the value up to the specified number of digits. @param number positive long to be encoded @param maxNumDigits maximum number of digits in the largest value in the data set @return string representation of the zero-padded long
[ "Encodes", "positive", "long", "value", "into", "a", "string", "by", "zero", "-", "padding", "the", "value", "up", "to", "the", "specified", "number", "of", "digits", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-simpledb/src/main/java/com/amazonaws/services/simpledb/util/SimpleDBUtils.java#L64-L73
operasoftware/operaprestodriver
src/com/opera/core/systems/runner/launcher/OperaLauncherProtocol.java
OperaLauncherProtocol.sendRequest
public ResponseEncapsulation sendRequest(MessageType type, byte[] body) throws IOException { """ Send a request and receive a result. @param type the request type to be sent @param body the serialized request payload @return the response @throws IOException if socket read error or protocol parse error """ sendRequestHeader(type, (body != null) ? body.length : 0); if (body != null) { os.write(body); } return recvMessage(); }
java
public ResponseEncapsulation sendRequest(MessageType type, byte[] body) throws IOException { sendRequestHeader(type, (body != null) ? body.length : 0); if (body != null) { os.write(body); } return recvMessage(); }
[ "public", "ResponseEncapsulation", "sendRequest", "(", "MessageType", "type", ",", "byte", "[", "]", "body", ")", "throws", "IOException", "{", "sendRequestHeader", "(", "type", ",", "(", "body", "!=", "null", ")", "?", "body", ".", "length", ":", "0", ")"...
Send a request and receive a result. @param type the request type to be sent @param body the serialized request payload @return the response @throws IOException if socket read error or protocol parse error
[ "Send", "a", "request", "and", "receive", "a", "result", "." ]
train
https://github.com/operasoftware/operaprestodriver/blob/1ccceda80f1c1a0489171d17dcaa6e7b18fb4c01/src/com/opera/core/systems/runner/launcher/OperaLauncherProtocol.java#L148-L154
jbossws/jbossws-common
src/main/java/org/jboss/ws/common/DOMUtils.java
DOMUtils.node2String
public static String node2String(final Node node, boolean prettyPrint) throws UnsupportedEncodingException { """ Converts XML node in specified pretty mode using UTF-8 encoding to string. @param node XML document or element @param prettyPrint whether XML have to be pretty formated @return XML string @throws Exception if some error occurs """ return node2String(node, prettyPrint, Constants.DEFAULT_XML_CHARSET); }
java
public static String node2String(final Node node, boolean prettyPrint) throws UnsupportedEncodingException { return node2String(node, prettyPrint, Constants.DEFAULT_XML_CHARSET); }
[ "public", "static", "String", "node2String", "(", "final", "Node", "node", ",", "boolean", "prettyPrint", ")", "throws", "UnsupportedEncodingException", "{", "return", "node2String", "(", "node", ",", "prettyPrint", ",", "Constants", ".", "DEFAULT_XML_CHARSET", ")",...
Converts XML node in specified pretty mode using UTF-8 encoding to string. @param node XML document or element @param prettyPrint whether XML have to be pretty formated @return XML string @throws Exception if some error occurs
[ "Converts", "XML", "node", "in", "specified", "pretty", "mode", "using", "UTF", "-", "8", "encoding", "to", "string", "." ]
train
https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/DOMUtils.java#L457-L460
google/closure-templates
java/src/com/google/template/soy/parsepasses/contextautoesc/RawTextContextUpdater.java
RawTextContextUpdater.makeCssUriTransition
private static Transition makeCssUriTransition(Pattern regex, final UriType uriType) { """ Matches the beginning of a CSS URI with the delimiter, if any, in group 1. """ return new Transition(regex) { @Override Context computeNextContext(Context prior, Matcher matcher) { String delim = matcher.group(1); HtmlContext state; if ("\"".equals(delim)) { state = HtmlContext.CSS_DQ_URI; } else if ("'".equals(delim)) { state = HtmlContext.CSS_SQ_URI; } else { state = HtmlContext.CSS_URI; } return prior .toBuilder() .withState(state) .withUriType(uriType) .withUriPart(UriPart.START) .build(); } }; }
java
private static Transition makeCssUriTransition(Pattern regex, final UriType uriType) { return new Transition(regex) { @Override Context computeNextContext(Context prior, Matcher matcher) { String delim = matcher.group(1); HtmlContext state; if ("\"".equals(delim)) { state = HtmlContext.CSS_DQ_URI; } else if ("'".equals(delim)) { state = HtmlContext.CSS_SQ_URI; } else { state = HtmlContext.CSS_URI; } return prior .toBuilder() .withState(state) .withUriType(uriType) .withUriPart(UriPart.START) .build(); } }; }
[ "private", "static", "Transition", "makeCssUriTransition", "(", "Pattern", "regex", ",", "final", "UriType", "uriType", ")", "{", "return", "new", "Transition", "(", "regex", ")", "{", "@", "Override", "Context", "computeNextContext", "(", "Context", "prior", ",...
Matches the beginning of a CSS URI with the delimiter, if any, in group 1.
[ "Matches", "the", "beginning", "of", "a", "CSS", "URI", "with", "the", "delimiter", "if", "any", "in", "group", "1", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/RawTextContextUpdater.java#L595-L616
UrielCh/ovh-java-sdk
ovh-java-sdk-freefax/src/main/java/net/minidev/ovh/api/ApiOvhFreefax.java
ApiOvhFreefax.credits_GET
public OvhBalanceInformations credits_GET() throws IOException { """ Get the credit balance and the remaining pages available for all our freefax REST: GET /freefax/credits """ String qPath = "/freefax/credits"; StringBuilder sb = path(qPath); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhBalanceInformations.class); }
java
public OvhBalanceInformations credits_GET() throws IOException { String qPath = "/freefax/credits"; StringBuilder sb = path(qPath); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhBalanceInformations.class); }
[ "public", "OvhBalanceInformations", "credits_GET", "(", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/freefax/credits\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET...
Get the credit balance and the remaining pages available for all our freefax REST: GET /freefax/credits
[ "Get", "the", "credit", "balance", "and", "the", "remaining", "pages", "available", "for", "all", "our", "freefax" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-freefax/src/main/java/net/minidev/ovh/api/ApiOvhFreefax.java#L204-L209
RestComm/sip-servlets
containers/tomcat-7/src/main/java/org/mobicents/servlet/sip/startup/SipStandardContext.java
SipStandardContext.addInjectionTarget
private void addInjectionTarget(Injectable resource, Map<String, Map<String, String>> injectionMap) { """ Copied from Tomcat 7 StandardContext @param resource @param injectionMap """ List<InjectionTarget> injectionTargets = resource.getInjectionTargets(); if (injectionTargets != null && injectionTargets.size() > 0) { String jndiName = resource.getName(); for (InjectionTarget injectionTarget: injectionTargets) { String clazz = injectionTarget.getTargetClass(); Map<String, String> injections = injectionMap.get(clazz); if (injections == null) { injections = new HashMap<String, String>(); injectionMap.put(clazz, injections); } injections.put(injectionTarget.getTargetName(), jndiName); } } }
java
private void addInjectionTarget(Injectable resource, Map<String, Map<String, String>> injectionMap) { List<InjectionTarget> injectionTargets = resource.getInjectionTargets(); if (injectionTargets != null && injectionTargets.size() > 0) { String jndiName = resource.getName(); for (InjectionTarget injectionTarget: injectionTargets) { String clazz = injectionTarget.getTargetClass(); Map<String, String> injections = injectionMap.get(clazz); if (injections == null) { injections = new HashMap<String, String>(); injectionMap.put(clazz, injections); } injections.put(injectionTarget.getTargetName(), jndiName); } } }
[ "private", "void", "addInjectionTarget", "(", "Injectable", "resource", ",", "Map", "<", "String", ",", "Map", "<", "String", ",", "String", ">", ">", "injectionMap", ")", "{", "List", "<", "InjectionTarget", ">", "injectionTargets", "=", "resource", ".", "g...
Copied from Tomcat 7 StandardContext @param resource @param injectionMap
[ "Copied", "from", "Tomcat", "7", "StandardContext" ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/containers/tomcat-7/src/main/java/org/mobicents/servlet/sip/startup/SipStandardContext.java#L1501-L1515
stackify/stackify-api-java
src/main/java/com/stackify/api/common/EnvironmentDetails.java
EnvironmentDetails.getEnvironmentDetail
public static EnvironmentDetail getEnvironmentDetail(final String application, final String environment) { """ Creates an environment details object with system information @param application The configured application name @param environment The configured application environment @return The EnvironmentDetail object """ // lookup the host name String hostName = getHostName(); // lookup the current path String currentPath = System.getProperty("user.dir"); // build the environment details EnvironmentDetail.Builder environmentBuilder = EnvironmentDetail.newBuilder(); environmentBuilder.deviceName(hostName); environmentBuilder.appLocation(currentPath); environmentBuilder.configuredAppName(application); environmentBuilder.configuredEnvironmentName(environment); return environmentBuilder.build(); }
java
public static EnvironmentDetail getEnvironmentDetail(final String application, final String environment) { // lookup the host name String hostName = getHostName(); // lookup the current path String currentPath = System.getProperty("user.dir"); // build the environment details EnvironmentDetail.Builder environmentBuilder = EnvironmentDetail.newBuilder(); environmentBuilder.deviceName(hostName); environmentBuilder.appLocation(currentPath); environmentBuilder.configuredAppName(application); environmentBuilder.configuredEnvironmentName(environment); return environmentBuilder.build(); }
[ "public", "static", "EnvironmentDetail", "getEnvironmentDetail", "(", "final", "String", "application", ",", "final", "String", "environment", ")", "{", "// lookup the host name", "String", "hostName", "=", "getHostName", "(", ")", ";", "// lookup the current path", "St...
Creates an environment details object with system information @param application The configured application name @param environment The configured application environment @return The EnvironmentDetail object
[ "Creates", "an", "environment", "details", "object", "with", "system", "information" ]
train
https://github.com/stackify/stackify-api-java/blob/d3000b7c87ed53a88b302939b0c88405d63d7b67/src/main/java/com/stackify/api/common/EnvironmentDetails.java#L35-L54
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryLookupService.java
DirectoryLookupService.removeNotificationHandler
public void removeNotificationHandler(String serviceName, NotificationHandler handler) { """ Remove the NotificationHandler from the Service. @param serviceName the service name. @param handler the NotificationHandler for the service. """ if(handler == null || serviceName == null || serviceName.isEmpty()){ throw new IllegalArgumentException(); } synchronized(notificationHandlers){ if(notificationHandlers.containsKey(serviceName)){ List<NotificationHandler> list = notificationHandlers.get(serviceName); if(list.contains(handler)){ list.remove(handler); } if(list.size() == 0){ notificationHandlers.remove(serviceName); } } } }
java
public void removeNotificationHandler(String serviceName, NotificationHandler handler){ if(handler == null || serviceName == null || serviceName.isEmpty()){ throw new IllegalArgumentException(); } synchronized(notificationHandlers){ if(notificationHandlers.containsKey(serviceName)){ List<NotificationHandler> list = notificationHandlers.get(serviceName); if(list.contains(handler)){ list.remove(handler); } if(list.size() == 0){ notificationHandlers.remove(serviceName); } } } }
[ "public", "void", "removeNotificationHandler", "(", "String", "serviceName", ",", "NotificationHandler", "handler", ")", "{", "if", "(", "handler", "==", "null", "||", "serviceName", "==", "null", "||", "serviceName", ".", "isEmpty", "(", ")", ")", "{", "throw...
Remove the NotificationHandler from the Service. @param serviceName the service name. @param handler the NotificationHandler for the service.
[ "Remove", "the", "NotificationHandler", "from", "the", "Service", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryLookupService.java#L243-L259
ThreeTen/threeten-extra
src/main/java/org/threeten/extra/YearWeek.java
YearWeek.withYear
public YearWeek withYear(int weekBasedYear) { """ Returns a copy of this {@code YearWeek} with the week-based-year altered. <p> This returns a year-week with the specified week-based-year. If the week of this instance is 53 and the new year does not have 53 weeks, the week will be adjusted to be 52. <p> This instance is immutable and unaffected by this method call. @param weekBasedYear the week-based-year to set in the returned year-week @return a {@code YearWeek} based on this year-week with the requested year, not null @throws DateTimeException if the week-based-year value is invalid """ if (week == 53 && weekRange(weekBasedYear) < 53) { return YearWeek.of(weekBasedYear, 52); } return with(weekBasedYear, week); }
java
public YearWeek withYear(int weekBasedYear) { if (week == 53 && weekRange(weekBasedYear) < 53) { return YearWeek.of(weekBasedYear, 52); } return with(weekBasedYear, week); }
[ "public", "YearWeek", "withYear", "(", "int", "weekBasedYear", ")", "{", "if", "(", "week", "==", "53", "&&", "weekRange", "(", "weekBasedYear", ")", "<", "53", ")", "{", "return", "YearWeek", ".", "of", "(", "weekBasedYear", ",", "52", ")", ";", "}", ...
Returns a copy of this {@code YearWeek} with the week-based-year altered. <p> This returns a year-week with the specified week-based-year. If the week of this instance is 53 and the new year does not have 53 weeks, the week will be adjusted to be 52. <p> This instance is immutable and unaffected by this method call. @param weekBasedYear the week-based-year to set in the returned year-week @return a {@code YearWeek} based on this year-week with the requested year, not null @throws DateTimeException if the week-based-year value is invalid
[ "Returns", "a", "copy", "of", "this", "{", "@code", "YearWeek", "}", "with", "the", "week", "-", "based", "-", "year", "altered", ".", "<p", ">", "This", "returns", "a", "year", "-", "week", "with", "the", "specified", "week", "-", "based", "-", "yea...
train
https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/YearWeek.java#L498-L503
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/bcc/BccClient.java
BccClient.createVolume
public CreateVolumeResponse createVolume(CreateVolumeRequest request) { """ Create a volume with the specified options. You can use this method to create a new empty volume by specified options or you can create a new volume from customized volume snapshot but not system disk snapshot. By using the cdsSizeInGB parameter you can create a newly empty volume. By using snapshotId parameter to create a volume form specific snapshot. @param request The request containing all options for creating a volume. @return The response with list of id of volumes newly created. """ checkNotNull(request, "request should not be null."); if (Strings.isNullOrEmpty(request.getClientToken())) { request.setClientToken(this.generateClientToken()); } if (null == request.getBilling()) { request.setBilling(generateDefaultBilling()); } InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST, VOLUME_PREFIX); internalRequest.addParameter("clientToken", request.getClientToken()); fillPayload(internalRequest, request); return invokeHttpClient(internalRequest, CreateVolumeResponse.class); }
java
public CreateVolumeResponse createVolume(CreateVolumeRequest request) { checkNotNull(request, "request should not be null."); if (Strings.isNullOrEmpty(request.getClientToken())) { request.setClientToken(this.generateClientToken()); } if (null == request.getBilling()) { request.setBilling(generateDefaultBilling()); } InternalRequest internalRequest = this.createRequest(request, HttpMethodName.POST, VOLUME_PREFIX); internalRequest.addParameter("clientToken", request.getClientToken()); fillPayload(internalRequest, request); return invokeHttpClient(internalRequest, CreateVolumeResponse.class); }
[ "public", "CreateVolumeResponse", "createVolume", "(", "CreateVolumeRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"request should not be null.\"", ")", ";", "if", "(", "Strings", ".", "isNullOrEmpty", "(", "request", ".", "getClientToken", "(",...
Create a volume with the specified options. You can use this method to create a new empty volume by specified options or you can create a new volume from customized volume snapshot but not system disk snapshot. By using the cdsSizeInGB parameter you can create a newly empty volume. By using snapshotId parameter to create a volume form specific snapshot. @param request The request containing all options for creating a volume. @return The response with list of id of volumes newly created.
[ "Create", "a", "volume", "with", "the", "specified", "options", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L882-L894
jfinal/jfinal
src/main/java/com/jfinal/plugin/activerecord/CPI.java
CPI.setColumnsMap
public static void setColumnsMap(Record record, Map<String, Object> columns) { """ Return the columns map of the record @param record the Record object @return the columns map of the record public static final Map<String, Object> getColumns(Record record) { return record.getColumns(); } """ record.setColumnsMap(columns); }
java
public static void setColumnsMap(Record record, Map<String, Object> columns) { record.setColumnsMap(columns); }
[ "public", "static", "void", "setColumnsMap", "(", "Record", "record", ",", "Map", "<", "String", ",", "Object", ">", "columns", ")", "{", "record", ".", "setColumnsMap", "(", "columns", ")", ";", "}" ]
Return the columns map of the record @param record the Record object @return the columns map of the record public static final Map<String, Object> getColumns(Record record) { return record.getColumns(); }
[ "Return", "the", "columns", "map", "of", "the", "record" ]
train
https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/CPI.java#L79-L81
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/io/kml/KMLGeometry.java
KMLGeometry.toKMLGeometry
public static void toKMLGeometry(Geometry geom, StringBuilder sb) throws SQLException { """ Convert JTS geometry to a kml geometry representation. @param geom @param sb @throws SQLException """ toKMLGeometry(geom, ExtrudeMode.NONE, AltitudeMode.NONE, sb); }
java
public static void toKMLGeometry(Geometry geom, StringBuilder sb) throws SQLException { toKMLGeometry(geom, ExtrudeMode.NONE, AltitudeMode.NONE, sb); }
[ "public", "static", "void", "toKMLGeometry", "(", "Geometry", "geom", ",", "StringBuilder", "sb", ")", "throws", "SQLException", "{", "toKMLGeometry", "(", "geom", ",", "ExtrudeMode", ".", "NONE", ",", "AltitudeMode", ".", "NONE", ",", "sb", ")", ";", "}" ]
Convert JTS geometry to a kml geometry representation. @param geom @param sb @throws SQLException
[ "Convert", "JTS", "geometry", "to", "a", "kml", "geometry", "representation", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/kml/KMLGeometry.java#L44-L46
super-csv/super-csv
super-csv/src/main/java/org/supercsv/util/BeanInterfaceProxy.java
BeanInterfaceProxy.invoke
public Object invoke(final Object proxy, final Method method, final Object[] args) { """ {@inheritDoc} <p> If a getter method is encountered then this method returns the stored value from the bean state (or null if the field has not been set). <p> If a setter method is encountered then the bean state is updated with the value of the first argument and the value is returned (to allow for method chaining) @throws IllegalArgumentException if the method is not a valid getter/setter """ final String methodName = method.getName(); if( methodName.startsWith(GET_PREFIX) ) { if( method.getParameterTypes().length > 0 ) { throw new IllegalArgumentException(String.format( "method %s.%s() should have no parameters to be a valid getter", method.getDeclaringClass() .getName(), methodName)); } // simulate getter by retrieving value from bean state return beanState.get(methodName.substring(GET_PREFIX.length())); } else if( methodName.startsWith(SET_PREFIX) ) { if( args == null || args.length != 1 ) { throw new IllegalArgumentException(String.format( "method %s.%s() should have exactly one parameter to be a valid setter", method .getDeclaringClass().getName(), methodName)); } // simulate setter by storing value in bean state beanState.put(methodName.substring(SET_PREFIX.length()), args[0]); return proxy; } else { throw new IllegalArgumentException(String.format("method %s.%s() is not a valid getter/setter", method .getDeclaringClass().getName(), methodName)); } }
java
public Object invoke(final Object proxy, final Method method, final Object[] args) { final String methodName = method.getName(); if( methodName.startsWith(GET_PREFIX) ) { if( method.getParameterTypes().length > 0 ) { throw new IllegalArgumentException(String.format( "method %s.%s() should have no parameters to be a valid getter", method.getDeclaringClass() .getName(), methodName)); } // simulate getter by retrieving value from bean state return beanState.get(methodName.substring(GET_PREFIX.length())); } else if( methodName.startsWith(SET_PREFIX) ) { if( args == null || args.length != 1 ) { throw new IllegalArgumentException(String.format( "method %s.%s() should have exactly one parameter to be a valid setter", method .getDeclaringClass().getName(), methodName)); } // simulate setter by storing value in bean state beanState.put(methodName.substring(SET_PREFIX.length()), args[0]); return proxy; } else { throw new IllegalArgumentException(String.format("method %s.%s() is not a valid getter/setter", method .getDeclaringClass().getName(), methodName)); } }
[ "public", "Object", "invoke", "(", "final", "Object", "proxy", ",", "final", "Method", "method", ",", "final", "Object", "[", "]", "args", ")", "{", "final", "String", "methodName", "=", "method", ".", "getName", "(", ")", ";", "if", "(", "methodName", ...
{@inheritDoc} <p> If a getter method is encountered then this method returns the stored value from the bean state (or null if the field has not been set). <p> If a setter method is encountered then the bean state is updated with the value of the first argument and the value is returned (to allow for method chaining) @throws IllegalArgumentException if the method is not a valid getter/setter
[ "{", "@inheritDoc", "}", "<p", ">", "If", "a", "getter", "method", "is", "encountered", "then", "this", "method", "returns", "the", "stored", "value", "from", "the", "bean", "state", "(", "or", "null", "if", "the", "field", "has", "not", "been", "set", ...
train
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/util/BeanInterfaceProxy.java#L77-L109
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/FindBugs.java
FindBugs.configureFilter
public static BugReporter configureFilter(BugReporter bugReporter, String filterFileName, boolean include) throws IOException, FilterException { """ Configure the (bug instance) Filter for the given DelegatingBugReporter. @param bugReporter a DelegatingBugReporter @param filterFileName filter file name @param include true if the filter is an include filter, false if it's an exclude filter @throws java.io.IOException @throws edu.umd.cs.findbugs.filter.FilterException """ Filter filter = new Filter(filterFileName); return new FilterBugReporter(bugReporter, filter, include); }
java
public static BugReporter configureFilter(BugReporter bugReporter, String filterFileName, boolean include) throws IOException, FilterException { Filter filter = new Filter(filterFileName); return new FilterBugReporter(bugReporter, filter, include); }
[ "public", "static", "BugReporter", "configureFilter", "(", "BugReporter", "bugReporter", ",", "String", "filterFileName", ",", "boolean", "include", ")", "throws", "IOException", ",", "FilterException", "{", "Filter", "filter", "=", "new", "Filter", "(", "filterFile...
Configure the (bug instance) Filter for the given DelegatingBugReporter. @param bugReporter a DelegatingBugReporter @param filterFileName filter file name @param include true if the filter is an include filter, false if it's an exclude filter @throws java.io.IOException @throws edu.umd.cs.findbugs.filter.FilterException
[ "Configure", "the", "(", "bug", "instance", ")", "Filter", "for", "the", "given", "DelegatingBugReporter", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/FindBugs.java#L483-L488
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.readParentFolder
public CmsResource readParentFolder(CmsDbContext dbc, CmsUUID structureId) throws CmsDataAccessException { """ Reads the parent folder to a given structure id.<p> @param dbc the current database context @param structureId the structure id of the child @return the parent folder resource @throws CmsDataAccessException if something goes wrong """ return getVfsDriver(dbc).readParentFolder(dbc, dbc.currentProject().getUuid(), structureId); }
java
public CmsResource readParentFolder(CmsDbContext dbc, CmsUUID structureId) throws CmsDataAccessException { return getVfsDriver(dbc).readParentFolder(dbc, dbc.currentProject().getUuid(), structureId); }
[ "public", "CmsResource", "readParentFolder", "(", "CmsDbContext", "dbc", ",", "CmsUUID", "structureId", ")", "throws", "CmsDataAccessException", "{", "return", "getVfsDriver", "(", "dbc", ")", ".", "readParentFolder", "(", "dbc", ",", "dbc", ".", "currentProject", ...
Reads the parent folder to a given structure id.<p> @param dbc the current database context @param structureId the structure id of the child @return the parent folder resource @throws CmsDataAccessException if something goes wrong
[ "Reads", "the", "parent", "folder", "to", "a", "given", "structure", "id", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L7132-L7135
aws/aws-sdk-java
aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/MethodResponse.java
MethodResponse.withResponseModels
public MethodResponse withResponseModels(java.util.Map<String, String> responseModels) { """ <p> Specifies the <a>Model</a> resources used for the response's content-type. Response models are represented as a key/value map, with a content-type as the key and a <a>Model</a> name as the value. </p> @param responseModels Specifies the <a>Model</a> resources used for the response's content-type. Response models are represented as a key/value map, with a content-type as the key and a <a>Model</a> name as the value. @return Returns a reference to this object so that method calls can be chained together. """ setResponseModels(responseModels); return this; }
java
public MethodResponse withResponseModels(java.util.Map<String, String> responseModels) { setResponseModels(responseModels); return this; }
[ "public", "MethodResponse", "withResponseModels", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "responseModels", ")", "{", "setResponseModels", "(", "responseModels", ")", ";", "return", "this", ";", "}" ]
<p> Specifies the <a>Model</a> resources used for the response's content-type. Response models are represented as a key/value map, with a content-type as the key and a <a>Model</a> name as the value. </p> @param responseModels Specifies the <a>Model</a> resources used for the response's content-type. Response models are represented as a key/value map, with a content-type as the key and a <a>Model</a> name as the value. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Specifies", "the", "<a", ">", "Model<", "/", "a", ">", "resources", "used", "for", "the", "response", "s", "content", "-", "type", ".", "Response", "models", "are", "represented", "as", "a", "key", "/", "value", "map", "with", "a", "content...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/MethodResponse.java#L280-L283
actorapp/actor-platform
actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java
Messenger.changeNotificationsEnabled
@ObjectiveCName("changeNotificationsEnabledWithPeer:withValue:") public void changeNotificationsEnabled(Peer peer, boolean val) { """ Change if notifications enabled for peer @param peer destination peer @param val is notifications enabled """ modules.getSettingsModule().changeNotificationsEnabled(peer, val); }
java
@ObjectiveCName("changeNotificationsEnabledWithPeer:withValue:") public void changeNotificationsEnabled(Peer peer, boolean val) { modules.getSettingsModule().changeNotificationsEnabled(peer, val); }
[ "@", "ObjectiveCName", "(", "\"changeNotificationsEnabledWithPeer:withValue:\"", ")", "public", "void", "changeNotificationsEnabled", "(", "Peer", "peer", ",", "boolean", "val", ")", "{", "modules", ".", "getSettingsModule", "(", ")", ".", "changeNotificationsEnabled", ...
Change if notifications enabled for peer @param peer destination peer @param val is notifications enabled
[ "Change", "if", "notifications", "enabled", "for", "peer" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java#L2264-L2267
overturetool/overture
core/interpreter/src/main/java/org/overture/interpreter/runtime/Interpreter.java
Interpreter.getSourceLine
public String getSourceLine(File file, int line, String sep) { """ Get a line of a source file by its location. @param file @param line @param sep @return """ SourceFile source = sourceFiles.get(file); if (source == null) { try { source = new SourceFile(file); sourceFiles.put(file, source); } catch (IOException e) { return "Cannot open source file: " + file; } } return line + sep + source.getLine(line); }
java
public String getSourceLine(File file, int line, String sep) { SourceFile source = sourceFiles.get(file); if (source == null) { try { source = new SourceFile(file); sourceFiles.put(file, source); } catch (IOException e) { return "Cannot open source file: " + file; } } return line + sep + source.getLine(line); }
[ "public", "String", "getSourceLine", "(", "File", "file", ",", "int", "line", ",", "String", "sep", ")", "{", "SourceFile", "source", "=", "sourceFiles", ".", "get", "(", "file", ")", ";", "if", "(", "source", "==", "null", ")", "{", "try", "{", "sou...
Get a line of a source file by its location. @param file @param line @param sep @return
[ "Get", "a", "line", "of", "a", "source", "file", "by", "its", "location", "." ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/interpreter/src/main/java/org/overture/interpreter/runtime/Interpreter.java#L319-L336
cdk/cdk
tool/sdg/src/main/java/org/openscience/cdk/layout/LayoutRefiner.java
LayoutRefiner.backupCoords
private void backupCoords(Point2d[] dest, IntStack stack) { """ Backup the coordinates of atoms (idxs) in the stack to the provided destination. @param dest destination @param stack atom indexes to backup """ for (int i = 0; i < stack.len; i++) { int v = stack.xs[i]; dest[v].x = atoms[v].getPoint2d().x; dest[v].y = atoms[v].getPoint2d().y; } }
java
private void backupCoords(Point2d[] dest, IntStack stack) { for (int i = 0; i < stack.len; i++) { int v = stack.xs[i]; dest[v].x = atoms[v].getPoint2d().x; dest[v].y = atoms[v].getPoint2d().y; } }
[ "private", "void", "backupCoords", "(", "Point2d", "[", "]", "dest", ",", "IntStack", "stack", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "stack", ".", "len", ";", "i", "++", ")", "{", "int", "v", "=", "stack", ".", "xs", "[", ...
Backup the coordinates of atoms (idxs) in the stack to the provided destination. @param dest destination @param stack atom indexes to backup
[ "Backup", "the", "coordinates", "of", "atoms", "(", "idxs", ")", "in", "the", "stack", "to", "the", "provided", "destination", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/LayoutRefiner.java#L835-L841
lessthanoptimal/ejml
main/ejml-dsparse/src/org/ejml/sparse/csc/misc/ColumnCounts_DSCC.java
ColumnCounts_DSCC.isLeaf
int isLeaf( int i , int j ) { """ <p>Determines if j is a leaf in the ith row subtree of T^t. If it is then it finds the least-common-ancestor of the previously found leaf in T^i (jprev) and node j.</p> <ul> <li>jleaf == 0 then j is not a leaf <li>jleaf == 1 then 1st leaf. returned value = root of ith subtree <li>jleaf == 2 then j is a subsequent leaf. returned value = (jprev,j) </ul> <p>See cs_leaf on page 51</p> @param i Specifies which row subtree in T. @param j node in subtree. @return Depends on jleaf. See above. """ jleaf = 0; // see j is not a leaf if( i <= j || w[first+j] <= w[maxfirst+i] ) return -1; w[maxfirst+i] = w[first+j]; // update the max first[j] seen so far int jprev = w[prevleaf+i]; w[prevleaf+i]=j; if( jprev == -1 ) { // j is the first leaf jleaf = 1; return i; } else { // j is a subsequent leaf jleaf = 2; } // find the common ancestor with jprev int q; for( q = jprev; q != w[ancestor+q]; q = w[ancestor+q]){ } // path compression for( int s = jprev, sparent; s != q; s = sparent ) { sparent = w[ancestor+s]; w[ancestor+s] = q; } return q; }
java
int isLeaf( int i , int j ) { jleaf = 0; // see j is not a leaf if( i <= j || w[first+j] <= w[maxfirst+i] ) return -1; w[maxfirst+i] = w[first+j]; // update the max first[j] seen so far int jprev = w[prevleaf+i]; w[prevleaf+i]=j; if( jprev == -1 ) { // j is the first leaf jleaf = 1; return i; } else { // j is a subsequent leaf jleaf = 2; } // find the common ancestor with jprev int q; for( q = jprev; q != w[ancestor+q]; q = w[ancestor+q]){ } // path compression for( int s = jprev, sparent; s != q; s = sparent ) { sparent = w[ancestor+s]; w[ancestor+s] = q; } return q; }
[ "int", "isLeaf", "(", "int", "i", ",", "int", "j", ")", "{", "jleaf", "=", "0", ";", "// see j is not a leaf", "if", "(", "i", "<=", "j", "||", "w", "[", "first", "+", "j", "]", "<=", "w", "[", "maxfirst", "+", "i", "]", ")", "return", "-", "...
<p>Determines if j is a leaf in the ith row subtree of T^t. If it is then it finds the least-common-ancestor of the previously found leaf in T^i (jprev) and node j.</p> <ul> <li>jleaf == 0 then j is not a leaf <li>jleaf == 1 then 1st leaf. returned value = root of ith subtree <li>jleaf == 2 then j is a subsequent leaf. returned value = (jprev,j) </ul> <p>See cs_leaf on page 51</p> @param i Specifies which row subtree in T. @param j node in subtree. @return Depends on jleaf. See above.
[ "<p", ">", "Determines", "if", "j", "is", "a", "leaf", "in", "the", "ith", "row", "subtree", "of", "T^t", ".", "If", "it", "is", "then", "it", "finds", "the", "least", "-", "common", "-", "ancestor", "of", "the", "previously", "found", "leaf", "in", ...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/misc/ColumnCounts_DSCC.java#L203-L231
GoogleCloudPlatform/appengine-plugins-core
src/main/java/com/google/cloud/tools/managedcloudsdk/install/DownloaderFactory.java
DownloaderFactory.newDownloader
public Downloader newDownloader(URL source, Path destination, ProgressListener progressListener) { """ Returns a new {@link Downloader} implementation. @param source URL of file to download (remote) @param destination Path on local file system to save the file @param progressListener Progress feedback handler @return a {@link Downloader} instance """ return new Downloader(source, destination, userAgentString, progressListener); }
java
public Downloader newDownloader(URL source, Path destination, ProgressListener progressListener) { return new Downloader(source, destination, userAgentString, progressListener); }
[ "public", "Downloader", "newDownloader", "(", "URL", "source", ",", "Path", "destination", ",", "ProgressListener", "progressListener", ")", "{", "return", "new", "Downloader", "(", "source", ",", "destination", ",", "userAgentString", ",", "progressListener", ")", ...
Returns a new {@link Downloader} implementation. @param source URL of file to download (remote) @param destination Path on local file system to save the file @param progressListener Progress feedback handler @return a {@link Downloader} instance
[ "Returns", "a", "new", "{", "@link", "Downloader", "}", "implementation", "." ]
train
https://github.com/GoogleCloudPlatform/appengine-plugins-core/blob/d22e9fa1103522409ab6fdfbf68c4a5a0bc5b97d/src/main/java/com/google/cloud/tools/managedcloudsdk/install/DownloaderFactory.java#L46-L48
pravega/pravega
common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java
BTreeIndex.processModifiedPage
private void processModifiedPage(PageModificationContext context) { """ Processes a BTreePage that has been modified (but not split). @param context Processing context. """ PageWrapper page = context.getPageWrapper(); boolean emptyPage = page.getPage().getCount() == 0; ByteArraySegment pageKey = page.getPageKey(); if (emptyPage && page.getParent() != null) { // This page is empty. Remove it from the PageCollection (so we don't write it back to our data source) // and remember its Page Key so we can delete its pointer from its parent page. context.getPageCollection().remove(page); context.setDeletedPageKey(pageKey); } else { // This page needs to be kept around. if (emptyPage && page.getPage().getConfig().isIndexPage()) { // We have an empty Index Root Page. We must convert this to a Leaf Page before moving on. page.setPage(createEmptyLeafPage()); } // Assign a new offset to the page and record its new Page Pointer. context.pageCollection.complete(page); page.setMinOffset(calculateMinOffset(page)); context.updatePagePointer(new PagePointer(pageKey, page.getOffset(), page.getPage().getLength(), page.getMinOffset())); } }
java
private void processModifiedPage(PageModificationContext context) { PageWrapper page = context.getPageWrapper(); boolean emptyPage = page.getPage().getCount() == 0; ByteArraySegment pageKey = page.getPageKey(); if (emptyPage && page.getParent() != null) { // This page is empty. Remove it from the PageCollection (so we don't write it back to our data source) // and remember its Page Key so we can delete its pointer from its parent page. context.getPageCollection().remove(page); context.setDeletedPageKey(pageKey); } else { // This page needs to be kept around. if (emptyPage && page.getPage().getConfig().isIndexPage()) { // We have an empty Index Root Page. We must convert this to a Leaf Page before moving on. page.setPage(createEmptyLeafPage()); } // Assign a new offset to the page and record its new Page Pointer. context.pageCollection.complete(page); page.setMinOffset(calculateMinOffset(page)); context.updatePagePointer(new PagePointer(pageKey, page.getOffset(), page.getPage().getLength(), page.getMinOffset())); } }
[ "private", "void", "processModifiedPage", "(", "PageModificationContext", "context", ")", "{", "PageWrapper", "page", "=", "context", ".", "getPageWrapper", "(", ")", ";", "boolean", "emptyPage", "=", "page", ".", "getPage", "(", ")", ".", "getCount", "(", ")"...
Processes a BTreePage that has been modified (but not split). @param context Processing context.
[ "Processes", "a", "BTreePage", "that", "has", "been", "modified", "(", "but", "not", "split", ")", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/btree/BTreeIndex.java#L507-L528
jMotif/SAX
src/main/java/net/seninp/jmotif/sax/TSProcessor.java
TSProcessor.readTS
public double[] readTS(String dataFileName, int loadLimit) throws SAXException, IOException { """ Read at least N elements from the one-column file. @param dataFileName the file name. @param loadLimit the load limit. @return the read data or empty array if nothing to load. @throws SAXException if error occurs. @throws IOException if error occurs. """ Path path = Paths.get(dataFileName); if (!(Files.exists(path))) { throw new SAXException("unable to load data - data source not found."); } BufferedReader reader = Files.newBufferedReader(path, DEFAULT_CHARSET); return readTS(reader, 0, loadLimit); }
java
public double[] readTS(String dataFileName, int loadLimit) throws SAXException, IOException { Path path = Paths.get(dataFileName); if (!(Files.exists(path))) { throw new SAXException("unable to load data - data source not found."); } BufferedReader reader = Files.newBufferedReader(path, DEFAULT_CHARSET); return readTS(reader, 0, loadLimit); }
[ "public", "double", "[", "]", "readTS", "(", "String", "dataFileName", ",", "int", "loadLimit", ")", "throws", "SAXException", ",", "IOException", "{", "Path", "path", "=", "Paths", ".", "get", "(", "dataFileName", ")", ";", "if", "(", "!", "(", "Files",...
Read at least N elements from the one-column file. @param dataFileName the file name. @param loadLimit the load limit. @return the read data or empty array if nothing to load. @throws SAXException if error occurs. @throws IOException if error occurs.
[ "Read", "at", "least", "N", "elements", "from", "the", "one", "-", "column", "file", "." ]
train
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/jmotif/sax/TSProcessor.java#L126-L137
ben-manes/caffeine
jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java
EventDispatcher.publishRemovedQuietly
public void publishRemovedQuietly(Cache<K, V> cache, K key, V value) { """ Publishes a remove event for the entry to all of the interested listeners. This method does not register the synchronous listener's future with {@link #awaitSynchronous()}. @param cache the cache where the entry was removed @param key the entry's key @param value the entry's value """ publish(cache, EventType.REMOVED, key, /* oldValue */ null, value, /* quiet */ true); }
java
public void publishRemovedQuietly(Cache<K, V> cache, K key, V value) { publish(cache, EventType.REMOVED, key, /* oldValue */ null, value, /* quiet */ true); }
[ "public", "void", "publishRemovedQuietly", "(", "Cache", "<", "K", ",", "V", ">", "cache", ",", "K", "key", ",", "V", "value", ")", "{", "publish", "(", "cache", ",", "EventType", ".", "REMOVED", ",", "key", ",", "/* oldValue */", "null", ",", "value",...
Publishes a remove event for the entry to all of the interested listeners. This method does not register the synchronous listener's future with {@link #awaitSynchronous()}. @param cache the cache where the entry was removed @param key the entry's key @param value the entry's value
[ "Publishes", "a", "remove", "event", "for", "the", "entry", "to", "all", "of", "the", "interested", "listeners", ".", "This", "method", "does", "not", "register", "the", "synchronous", "listener", "s", "future", "with", "{", "@link", "#awaitSynchronous", "()",...
train
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java#L148-L150
onelogin/onelogin-java-sdk
src/main/java/com/onelogin/sdk/conn/Client.java
Client.getOneLoginAppsBatch
public OneLoginResponse<OneLoginApp> getOneLoginAppsBatch(HashMap<String, String> queryParameters, int batchSize, String afterCursor) throws OAuthSystemException, OAuthProblemException, URISyntaxException { """ Get a batch of OneLoginApps. @param queryParameters Query parameters of the Resource @param batchSize Size of the Batch @param afterCursor Reference to continue collecting items of next page @return OneLoginResponse of OneLoginApp (Batch) @throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection @throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled @throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor @see com.onelogin.sdk.model.OneLoginApp @see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/apps/get-apps">Get Apps documentation</a> """ ExtractionContext context = extractResourceBatch(queryParameters, batchSize, afterCursor, Constants.GET_APPS_URL); List<OneLoginApp> apps = new ArrayList<OneLoginApp>(batchSize); afterCursor = getOneLoginAppsBatch(apps, context.url, context.bearerRequest, context.oAuthResponse); return new OneLoginResponse<OneLoginApp>(apps, afterCursor); }
java
public OneLoginResponse<OneLoginApp> getOneLoginAppsBatch(HashMap<String, String> queryParameters, int batchSize, String afterCursor) throws OAuthSystemException, OAuthProblemException, URISyntaxException { ExtractionContext context = extractResourceBatch(queryParameters, batchSize, afterCursor, Constants.GET_APPS_URL); List<OneLoginApp> apps = new ArrayList<OneLoginApp>(batchSize); afterCursor = getOneLoginAppsBatch(apps, context.url, context.bearerRequest, context.oAuthResponse); return new OneLoginResponse<OneLoginApp>(apps, afterCursor); }
[ "public", "OneLoginResponse", "<", "OneLoginApp", ">", "getOneLoginAppsBatch", "(", "HashMap", "<", "String", ",", "String", ">", "queryParameters", ",", "int", "batchSize", ",", "String", "afterCursor", ")", "throws", "OAuthSystemException", ",", "OAuthProblemExcepti...
Get a batch of OneLoginApps. @param queryParameters Query parameters of the Resource @param batchSize Size of the Batch @param afterCursor Reference to continue collecting items of next page @return OneLoginResponse of OneLoginApp (Batch) @throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection @throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled @throws URISyntaxException - if there is an error when generating the target URL at the URIBuilder constructor @see com.onelogin.sdk.model.OneLoginApp @see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/apps/get-apps">Get Apps documentation</a>
[ "Get", "a", "batch", "of", "OneLoginApps", "." ]
train
https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L1605-L1611
looly/hutool
hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java
SqlConnRunner.del
public int del(Connection conn, Entity where) throws SQLException { """ 删除数据<br> 此方法不会关闭Connection @param conn 数据库连接 @param where 条件 @return 影响行数 @throws SQLException SQL执行异常 """ checkConn(conn); if(CollectionUtil.isEmpty(where)){ //不允许做全表删除 throw new SQLException("Empty entity provided!"); } final Query query = new Query(SqlUtil.buildConditions(where), where.getTableName()); PreparedStatement ps = null; try { ps = dialect.psForDelete(conn, query); return ps.executeUpdate(); } catch (SQLException e) { throw e; } finally { DbUtil.close(ps); } }
java
public int del(Connection conn, Entity where) throws SQLException { checkConn(conn); if(CollectionUtil.isEmpty(where)){ //不允许做全表删除 throw new SQLException("Empty entity provided!"); } final Query query = new Query(SqlUtil.buildConditions(where), where.getTableName()); PreparedStatement ps = null; try { ps = dialect.psForDelete(conn, query); return ps.executeUpdate(); } catch (SQLException e) { throw e; } finally { DbUtil.close(ps); } }
[ "public", "int", "del", "(", "Connection", "conn", ",", "Entity", "where", ")", "throws", "SQLException", "{", "checkConn", "(", "conn", ")", ";", "if", "(", "CollectionUtil", ".", "isEmpty", "(", "where", ")", ")", "{", "//不允许做全表删除\r", "throw", "new", "...
删除数据<br> 此方法不会关闭Connection @param conn 数据库连接 @param where 条件 @return 影响行数 @throws SQLException SQL执行异常
[ "删除数据<br", ">", "此方法不会关闭Connection" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/SqlConnRunner.java#L235-L252
census-instrumentation/opencensus-java
api/src/main/java/io/opencensus/internal/Utils.java
Utils.checkState
public static void checkState(boolean isValid, @javax.annotation.Nullable Object errorMessage) { """ Throws an {@link IllegalStateException} if the argument is false. This method is similar to {@code Preconditions.checkState(boolean, Object)} from Guava. @param isValid whether the state check passed. @param errorMessage the message to use for the exception. Will be converted to a string using {@link String#valueOf(Object)}. """ if (!isValid) { throw new IllegalStateException(String.valueOf(errorMessage)); } }
java
public static void checkState(boolean isValid, @javax.annotation.Nullable Object errorMessage) { if (!isValid) { throw new IllegalStateException(String.valueOf(errorMessage)); } }
[ "public", "static", "void", "checkState", "(", "boolean", "isValid", ",", "@", "javax", ".", "annotation", ".", "Nullable", "Object", "errorMessage", ")", "{", "if", "(", "!", "isValid", ")", "{", "throw", "new", "IllegalStateException", "(", "String", ".", ...
Throws an {@link IllegalStateException} if the argument is false. This method is similar to {@code Preconditions.checkState(boolean, Object)} from Guava. @param isValid whether the state check passed. @param errorMessage the message to use for the exception. Will be converted to a string using {@link String#valueOf(Object)}.
[ "Throws", "an", "{", "@link", "IllegalStateException", "}", "if", "the", "argument", "is", "false", ".", "This", "method", "is", "similar", "to", "{", "@code", "Preconditions", ".", "checkState", "(", "boolean", "Object", ")", "}", "from", "Guava", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/internal/Utils.java#L79-L83
auth0/Lock.Android
lib/src/main/java/com/auth0/android/lock/internal/configuration/Connection.java
Connection.newConnectionFor
static Connection newConnectionFor(@NonNull String strategy, Map<String, Object> values) { """ Creates a new Connection given a Strategy name and the map of values. @param strategy strategy name for this connection @param values additional values associated to this connection @return a new instance of Connection. Can be either DatabaseConnection, PasswordlessConnection or OAuthConnection. """ return new Connection(strategy, values); }
java
static Connection newConnectionFor(@NonNull String strategy, Map<String, Object> values) { return new Connection(strategy, values); }
[ "static", "Connection", "newConnectionFor", "(", "@", "NonNull", "String", "strategy", ",", "Map", "<", "String", ",", "Object", ">", "values", ")", "{", "return", "new", "Connection", "(", "strategy", ",", "values", ")", ";", "}" ]
Creates a new Connection given a Strategy name and the map of values. @param strategy strategy name for this connection @param values additional values associated to this connection @return a new instance of Connection. Can be either DatabaseConnection, PasswordlessConnection or OAuthConnection.
[ "Creates", "a", "new", "Connection", "given", "a", "Strategy", "name", "and", "the", "map", "of", "values", "." ]
train
https://github.com/auth0/Lock.Android/blob/8eb2a979048d2eb6cf0ec631e82e6c3fe6e7d220/lib/src/main/java/com/auth0/android/lock/internal/configuration/Connection.java#L181-L183
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/AccountsApi.java
AccountsApi.deleteCustomField
public void deleteCustomField(String accountId, String customFieldId) throws ApiException { """ Delete an existing account custom field. @param accountId The external account number (int) or account ID Guid. (required) @param customFieldId (required) @return void """ deleteCustomField(accountId, customFieldId, null); }
java
public void deleteCustomField(String accountId, String customFieldId) throws ApiException { deleteCustomField(accountId, customFieldId, null); }
[ "public", "void", "deleteCustomField", "(", "String", "accountId", ",", "String", "customFieldId", ")", "throws", "ApiException", "{", "deleteCustomField", "(", "accountId", ",", "customFieldId", ",", "null", ")", ";", "}" ]
Delete an existing account custom field. @param accountId The external account number (int) or account ID Guid. (required) @param customFieldId (required) @return void
[ "Delete", "an", "existing", "account", "custom", "field", "." ]
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/AccountsApi.java#L591-L593
snowflakedb/snowflake-jdbc
src/main/java/net/snowflake/client/jdbc/cloud/storage/StorageClientFactory.java
StorageClientFactory.createClient
public SnowflakeStorageClient createClient(StageInfo stage, int parallel, RemoteStoreFileEncryptionMaterial encMat) throws SnowflakeSQLException { """ Creates a storage client based on the value of stageLocationType @param stage the stage properties @param parallel the degree of parallelism to be used by the client @param encMat encryption material for the client @return a SnowflakeStorageClient interface to the instance created @throws SnowflakeSQLException if any error occurs """ logger.debug("createClient client type={}", stage.getStageType().name()); switch (stage.getStageType()) { case S3: return createS3Client(stage.getCredentials(), parallel, encMat, stage.getRegion()); case AZURE: return createAzureClient(stage, encMat); default: // We don't create a storage client for FS_LOCAL, // so we should only find ourselves here if an unsupported // remote storage client type is specified throw new IllegalArgumentException("Unsupported storage client specified: " + stage.getStageType().name()); } }
java
public SnowflakeStorageClient createClient(StageInfo stage, int parallel, RemoteStoreFileEncryptionMaterial encMat) throws SnowflakeSQLException { logger.debug("createClient client type={}", stage.getStageType().name()); switch (stage.getStageType()) { case S3: return createS3Client(stage.getCredentials(), parallel, encMat, stage.getRegion()); case AZURE: return createAzureClient(stage, encMat); default: // We don't create a storage client for FS_LOCAL, // so we should only find ourselves here if an unsupported // remote storage client type is specified throw new IllegalArgumentException("Unsupported storage client specified: " + stage.getStageType().name()); } }
[ "public", "SnowflakeStorageClient", "createClient", "(", "StageInfo", "stage", ",", "int", "parallel", ",", "RemoteStoreFileEncryptionMaterial", "encMat", ")", "throws", "SnowflakeSQLException", "{", "logger", ".", "debug", "(", "\"createClient client type={}\"", ",", "st...
Creates a storage client based on the value of stageLocationType @param stage the stage properties @param parallel the degree of parallelism to be used by the client @param encMat encryption material for the client @return a SnowflakeStorageClient interface to the instance created @throws SnowflakeSQLException if any error occurs
[ "Creates", "a", "storage", "client", "based", "on", "the", "value", "of", "stageLocationType" ]
train
https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/jdbc/cloud/storage/StorageClientFactory.java#L57-L79
Jsondb/jsondb-core
src/main/java/io/jsondb/Util.java
Util.deepCopy
protected static Object deepCopy(Object fromBean) { """ A utility method that creates a deep clone of the specified object. There is no other way of doing this reliably. @param fromBean java bean to be cloned. @return a new java bean cloned from fromBean. """ ByteArrayOutputStream bos = new ByteArrayOutputStream(); XMLEncoder out = new XMLEncoder(bos); out.writeObject(fromBean); out.close(); ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); XMLDecoder in = new XMLDecoder(bis, null, null, JsonDBTemplate.class.getClassLoader()); Object toBean = in.readObject(); in.close(); return toBean; }
java
protected static Object deepCopy(Object fromBean) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); XMLEncoder out = new XMLEncoder(bos); out.writeObject(fromBean); out.close(); ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); XMLDecoder in = new XMLDecoder(bis, null, null, JsonDBTemplate.class.getClassLoader()); Object toBean = in.readObject(); in.close(); return toBean; }
[ "protected", "static", "Object", "deepCopy", "(", "Object", "fromBean", ")", "{", "ByteArrayOutputStream", "bos", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "XMLEncoder", "out", "=", "new", "XMLEncoder", "(", "bos", ")", ";", "out", ".", "writeObject"...
A utility method that creates a deep clone of the specified object. There is no other way of doing this reliably. @param fromBean java bean to be cloned. @return a new java bean cloned from fromBean.
[ "A", "utility", "method", "that", "creates", "a", "deep", "clone", "of", "the", "specified", "object", ".", "There", "is", "no", "other", "way", "of", "doing", "this", "reliably", "." ]
train
https://github.com/Jsondb/jsondb-core/blob/c49654d1eee2ace4d5ca5be19730652a966ce7f4/src/main/java/io/jsondb/Util.java#L177-L188
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/Table.java
Table.waitForActive
public TableDescription waitForActive() throws InterruptedException { """ A convenient blocking call that can be used, typically during table creation, to wait for the table to become active. This method uses {@link com.amazonaws.services.dynamodbv2.waiters.AmazonDynamoDBWaiters} to poll the status of the table every 5 seconds. @return the table description when the table has become active @throws IllegalArgumentException if the table is being deleted @throws ResourceNotFoundException if the table doesn't exist """ Waiter waiter = client.waiters().tableExists(); try { waiter.run(new WaiterParameters<DescribeTableRequest>(new DescribeTableRequest(tableName)) .withPollingStrategy(new PollingStrategy(new MaxAttemptsRetryStrategy(25), new FixedDelayStrategy(5)))); return describe(); } catch (Exception exception) { // The additional describe call is to return ResourceNotFoundException if the table doesn't exist. // This is to preserve backwards compatibility. describe(); throw new IllegalArgumentException("Table " + tableName + " did not transition into ACTIVE state.", exception); } }
java
public TableDescription waitForActive() throws InterruptedException { Waiter waiter = client.waiters().tableExists(); try { waiter.run(new WaiterParameters<DescribeTableRequest>(new DescribeTableRequest(tableName)) .withPollingStrategy(new PollingStrategy(new MaxAttemptsRetryStrategy(25), new FixedDelayStrategy(5)))); return describe(); } catch (Exception exception) { // The additional describe call is to return ResourceNotFoundException if the table doesn't exist. // This is to preserve backwards compatibility. describe(); throw new IllegalArgumentException("Table " + tableName + " did not transition into ACTIVE state.", exception); } }
[ "public", "TableDescription", "waitForActive", "(", ")", "throws", "InterruptedException", "{", "Waiter", "waiter", "=", "client", ".", "waiters", "(", ")", ".", "tableExists", "(", ")", ";", "try", "{", "waiter", ".", "run", "(", "new", "WaiterParameters", ...
A convenient blocking call that can be used, typically during table creation, to wait for the table to become active. This method uses {@link com.amazonaws.services.dynamodbv2.waiters.AmazonDynamoDBWaiters} to poll the status of the table every 5 seconds. @return the table description when the table has become active @throws IllegalArgumentException if the table is being deleted @throws ResourceNotFoundException if the table doesn't exist
[ "A", "convenient", "blocking", "call", "that", "can", "be", "used", "typically", "during", "table", "creation", "to", "wait", "for", "the", "table", "to", "become", "active", ".", "This", "method", "uses", "{", "@link", "com", ".", "amazonaws", ".", "servi...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/Table.java#L478-L491
groupon/odo
client/src/main/java/com/groupon/odo/client/Client.java
Client.setCustomResponseForDefaultProfile
public static boolean setCustomResponseForDefaultProfile(String pathName, String customData) { """ set custom response for the default profile's default client @param pathName friendly name of path @param customData custom response/request data @return true if success, false otherwise """ try { return setCustomForDefaultProfile(pathName, true, customData); } catch (Exception e) { e.printStackTrace(); } return false; }
java
public static boolean setCustomResponseForDefaultProfile(String pathName, String customData) { try { return setCustomForDefaultProfile(pathName, true, customData); } catch (Exception e) { e.printStackTrace(); } return false; }
[ "public", "static", "boolean", "setCustomResponseForDefaultProfile", "(", "String", "pathName", ",", "String", "customData", ")", "{", "try", "{", "return", "setCustomForDefaultProfile", "(", "pathName", ",", "true", ",", "customData", ")", ";", "}", "catch", "(",...
set custom response for the default profile's default client @param pathName friendly name of path @param customData custom response/request data @return true if success, false otherwise
[ "set", "custom", "response", "for", "the", "default", "profile", "s", "default", "client" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/client/src/main/java/com/groupon/odo/client/Client.java#L887-L894
evernote/evernote-sdk-android
library/src/main/java/com/evernote/client/android/BootstrapManager.java
BootstrapManager.getBootstrapInfo
BootstrapInfoWrapper getBootstrapInfo() throws Exception { """ Makes a web request to get the latest bootstrap information. This is a requirement during the oauth process @return {@link BootstrapInfoWrapper} @throws Exception """ Log.d(LOGTAG, "getBootstrapInfo()"); BootstrapInfo bsInfo = null; try { if (mBootstrapServerUsed == null) { initializeUserStoreAndCheckVersion(); } bsInfo = mEvernoteSession.getEvernoteClientFactory().getUserStoreClient(getUserStoreUrl(mBootstrapServerUsed), null).getBootstrapInfo(mLocale.toString()); printBootstrapInfo(bsInfo); } catch (TException e) { Log.e(LOGTAG, "error getting bootstrap info", e); } return new BootstrapInfoWrapper(mBootstrapServerUsed, bsInfo); }
java
BootstrapInfoWrapper getBootstrapInfo() throws Exception { Log.d(LOGTAG, "getBootstrapInfo()"); BootstrapInfo bsInfo = null; try { if (mBootstrapServerUsed == null) { initializeUserStoreAndCheckVersion(); } bsInfo = mEvernoteSession.getEvernoteClientFactory().getUserStoreClient(getUserStoreUrl(mBootstrapServerUsed), null).getBootstrapInfo(mLocale.toString()); printBootstrapInfo(bsInfo); } catch (TException e) { Log.e(LOGTAG, "error getting bootstrap info", e); } return new BootstrapInfoWrapper(mBootstrapServerUsed, bsInfo); }
[ "BootstrapInfoWrapper", "getBootstrapInfo", "(", ")", "throws", "Exception", "{", "Log", ".", "d", "(", "LOGTAG", ",", "\"getBootstrapInfo()\"", ")", ";", "BootstrapInfo", "bsInfo", "=", "null", ";", "try", "{", "if", "(", "mBootstrapServerUsed", "==", "null", ...
Makes a web request to get the latest bootstrap information. This is a requirement during the oauth process @return {@link BootstrapInfoWrapper} @throws Exception
[ "Makes", "a", "web", "request", "to", "get", "the", "latest", "bootstrap", "information", ".", "This", "is", "a", "requirement", "during", "the", "oauth", "process" ]
train
https://github.com/evernote/evernote-sdk-android/blob/fc59be643e85c4f59d562d1bfe76563997aa73cf/library/src/main/java/com/evernote/client/android/BootstrapManager.java#L155-L171
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/RedisClient.java
RedisClient.connectSentinelAsync
public <K, V> CompletableFuture<StatefulRedisSentinelConnection<K, V>> connectSentinelAsync(RedisCodec<K, V> codec, RedisURI redisURI) { """ Open asynchronously a connection to a Redis Sentinel using the supplied {@link RedisURI} and use the supplied {@link RedisCodec codec} to encode/decode keys and values. The client {@link RedisURI} must contain one or more sentinels. @param codec the Redis server to connect to, must not be {@literal null} @param redisURI the Redis server to connect to, must not be {@literal null} @param <K> Key type @param <V> Value type @return A new connection @since 5.1 """ assertNotNull(redisURI); return transformAsyncConnectionException(connectSentinelAsync(codec, redisURI, redisURI.getTimeout()), redisURI); }
java
public <K, V> CompletableFuture<StatefulRedisSentinelConnection<K, V>> connectSentinelAsync(RedisCodec<K, V> codec, RedisURI redisURI) { assertNotNull(redisURI); return transformAsyncConnectionException(connectSentinelAsync(codec, redisURI, redisURI.getTimeout()), redisURI); }
[ "public", "<", "K", ",", "V", ">", "CompletableFuture", "<", "StatefulRedisSentinelConnection", "<", "K", ",", "V", ">", ">", "connectSentinelAsync", "(", "RedisCodec", "<", "K", ",", "V", ">", "codec", ",", "RedisURI", "redisURI", ")", "{", "assertNotNull",...
Open asynchronously a connection to a Redis Sentinel using the supplied {@link RedisURI} and use the supplied {@link RedisCodec codec} to encode/decode keys and values. The client {@link RedisURI} must contain one or more sentinels. @param codec the Redis server to connect to, must not be {@literal null} @param redisURI the Redis server to connect to, must not be {@literal null} @param <K> Key type @param <V> Value type @return A new connection @since 5.1
[ "Open", "asynchronously", "a", "connection", "to", "a", "Redis", "Sentinel", "using", "the", "supplied", "{", "@link", "RedisURI", "}", "and", "use", "the", "supplied", "{", "@link", "RedisCodec", "codec", "}", "to", "encode", "/", "decode", "keys", "and", ...
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/RedisClient.java#L512-L518
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/JFAPCommunicator.java
JFAPCommunicator.defaultChecker
public void defaultChecker(CommsByteBuffer buffer, short exceptionCode) throws SIErrorException { """ The default checker. Should always be called last after all the checkers. @param buffer @param exceptionCode @throws SIErrorException if the exception code is <strong>not</strong> the enumerated value for "throw no exception". """ if (exceptionCode != CommsConstants.SI_NO_EXCEPTION) { throw new SIErrorException(buffer.getException(con)); } }
java
public void defaultChecker(CommsByteBuffer buffer, short exceptionCode) throws SIErrorException { if (exceptionCode != CommsConstants.SI_NO_EXCEPTION) { throw new SIErrorException(buffer.getException(con)); } }
[ "public", "void", "defaultChecker", "(", "CommsByteBuffer", "buffer", ",", "short", "exceptionCode", ")", "throws", "SIErrorException", "{", "if", "(", "exceptionCode", "!=", "CommsConstants", ".", "SI_NO_EXCEPTION", ")", "{", "throw", "new", "SIErrorException", "("...
The default checker. Should always be called last after all the checkers. @param buffer @param exceptionCode @throws SIErrorException if the exception code is <strong>not</strong> the enumerated value for "throw no exception".
[ "The", "default", "checker", ".", "Should", "always", "be", "called", "last", "after", "all", "the", "checkers", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/JFAPCommunicator.java#L1415-L1422
TheCoder4eu/BootsFaces-OSP
src/main/java/net/bootsfaces/component/carouselItem/CarouselItemRenderer.java
CarouselItemRenderer.encodeEnd
@Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { """ This methods generates the HTML code of the current b:carouselItem. <code>encodeBegin</code> generates the start of the component. After the, the JSF framework calls <code>encodeChildren()</code> to generate the HTML code between the beginning and the end of the component. For instance, in the case of a panel component the content of the panel is generated by <code>encodeChildren()</code>. After that, <code>encodeEnd()</code> is called to generate the rest of the HTML code. @param context the FacesContext. @param component the current b:carouselItem. @throws IOException thrown if something goes wrong when writing the HTML code. """ if (!component.isRendered()) { return; } CarouselItem carouselItem = (CarouselItem) component; ResponseWriter rw = context.getResponseWriter(); if (carouselItem.getCaption()!=null) { new CarouselCaptionRenderer().encodeDefaultCaption(context, component, carouselItem.getCaption()); } rw.endElement("div"); Tooltip.activateTooltips(context, carouselItem); }
java
@Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { if (!component.isRendered()) { return; } CarouselItem carouselItem = (CarouselItem) component; ResponseWriter rw = context.getResponseWriter(); if (carouselItem.getCaption()!=null) { new CarouselCaptionRenderer().encodeDefaultCaption(context, component, carouselItem.getCaption()); } rw.endElement("div"); Tooltip.activateTooltips(context, carouselItem); }
[ "@", "Override", "public", "void", "encodeEnd", "(", "FacesContext", "context", ",", "UIComponent", "component", ")", "throws", "IOException", "{", "if", "(", "!", "component", ".", "isRendered", "(", ")", ")", "{", "return", ";", "}", "CarouselItem", "carou...
This methods generates the HTML code of the current b:carouselItem. <code>encodeBegin</code> generates the start of the component. After the, the JSF framework calls <code>encodeChildren()</code> to generate the HTML code between the beginning and the end of the component. For instance, in the case of a panel component the content of the panel is generated by <code>encodeChildren()</code>. After that, <code>encodeEnd()</code> is called to generate the rest of the HTML code. @param context the FacesContext. @param component the current b:carouselItem. @throws IOException thrown if something goes wrong when writing the HTML code.
[ "This", "methods", "generates", "the", "HTML", "code", "of", "the", "current", "b", ":", "carouselItem", ".", "<code", ">", "encodeBegin<", "/", "code", ">", "generates", "the", "start", "of", "the", "component", ".", "After", "the", "the", "JSF", "framewo...
train
https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/carouselItem/CarouselItemRenderer.java#L102-L117
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiUser.java
BoxApiUser.getDownloadAvatarRequest
public BoxRequestsFile.DownloadAvatar getDownloadAvatarRequest(File target, String userId) throws IOException { """ Gets a request that downloads an avatar of the target user id. @param target target file to download to, target can be either a directory or a file @param userId id of user to download avatar of @return request to download a thumbnail to a target file @throws IOException throws FileNotFoundException if target file does not exist. """ if (!target.exists()){ throw new FileNotFoundException(); } BoxRequestsFile.DownloadAvatar request = new BoxRequestsFile.DownloadAvatar(userId, target, getAvatarDownloadUrl(userId), mSession) .setAvatarType(BoxRequestsFile.DownloadAvatar.LARGE); return request; }
java
public BoxRequestsFile.DownloadAvatar getDownloadAvatarRequest(File target, String userId) throws IOException{ if (!target.exists()){ throw new FileNotFoundException(); } BoxRequestsFile.DownloadAvatar request = new BoxRequestsFile.DownloadAvatar(userId, target, getAvatarDownloadUrl(userId), mSession) .setAvatarType(BoxRequestsFile.DownloadAvatar.LARGE); return request; }
[ "public", "BoxRequestsFile", ".", "DownloadAvatar", "getDownloadAvatarRequest", "(", "File", "target", ",", "String", "userId", ")", "throws", "IOException", "{", "if", "(", "!", "target", ".", "exists", "(", ")", ")", "{", "throw", "new", "FileNotFoundException...
Gets a request that downloads an avatar of the target user id. @param target target file to download to, target can be either a directory or a file @param userId id of user to download avatar of @return request to download a thumbnail to a target file @throws IOException throws FileNotFoundException if target file does not exist.
[ "Gets", "a", "request", "that", "downloads", "an", "avatar", "of", "the", "target", "user", "id", "." ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiUser.java#L117-L124
elki-project/elki
elki-input/src/main/java/de/lmu/ifi/dbs/elki/datasource/filter/transform/FastMultidimensionalScalingTransform.java
FastMultidimensionalScalingTransform.estimateEigenvalue
protected double estimateEigenvalue(double[][] mat, double[] in) { """ Estimate the (singed!) Eigenvalue for a particular vector. @param mat Matrix. @param in Input vector. @return Estimated eigenvalue """ double de = 0., di = 0.; // Matrix multiplication: for(int d1 = 0; d1 < in.length; d1++) { final double[] row = mat[d1]; double t = 0.; for(int d2 = 0; d2 < in.length; d2++) { t += row[d2] * in[d2]; } final double s = in[d1]; de += t * s; di += s * s; } return de / di; }
java
protected double estimateEigenvalue(double[][] mat, double[] in) { double de = 0., di = 0.; // Matrix multiplication: for(int d1 = 0; d1 < in.length; d1++) { final double[] row = mat[d1]; double t = 0.; for(int d2 = 0; d2 < in.length; d2++) { t += row[d2] * in[d2]; } final double s = in[d1]; de += t * s; di += s * s; } return de / di; }
[ "protected", "double", "estimateEigenvalue", "(", "double", "[", "]", "[", "]", "mat", ",", "double", "[", "]", "in", ")", "{", "double", "de", "=", "0.", ",", "di", "=", "0.", ";", "// Matrix multiplication:", "for", "(", "int", "d1", "=", "0", ";",...
Estimate the (singed!) Eigenvalue for a particular vector. @param mat Matrix. @param in Input vector. @return Estimated eigenvalue
[ "Estimate", "the", "(", "singed!", ")", "Eigenvalue", "for", "a", "particular", "vector", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-input/src/main/java/de/lmu/ifi/dbs/elki/datasource/filter/transform/FastMultidimensionalScalingTransform.java#L281-L295
VoltDB/voltdb
src/frontend/org/voltdb/utils/SystemStatsCollector.java
SystemStatsCollector.asyncSampleSystemNow
public static synchronized void asyncSampleSystemNow(final boolean medium, final boolean large) { """ Fire off a thread to asynchronously collect stats. @param medium Add result to medium set? @param large Add result to large set? """ // slow mode starts an async thread if (mode == GetRSSMode.PS) { if (thread != null) { if (thread.isAlive()) return; else thread = null; } thread = new Thread(new Runnable() { @Override public void run() { sampleSystemNow(medium, large); } }); thread.start(); } // fast mode doesn't spawn a thread else { sampleSystemNow(medium, large); } }
java
public static synchronized void asyncSampleSystemNow(final boolean medium, final boolean large) { // slow mode starts an async thread if (mode == GetRSSMode.PS) { if (thread != null) { if (thread.isAlive()) return; else thread = null; } thread = new Thread(new Runnable() { @Override public void run() { sampleSystemNow(medium, large); } }); thread.start(); } // fast mode doesn't spawn a thread else { sampleSystemNow(medium, large); } }
[ "public", "static", "synchronized", "void", "asyncSampleSystemNow", "(", "final", "boolean", "medium", ",", "final", "boolean", "large", ")", "{", "// slow mode starts an async thread", "if", "(", "mode", "==", "GetRSSMode", ".", "PS", ")", "{", "if", "(", "thre...
Fire off a thread to asynchronously collect stats. @param medium Add result to medium set? @param large Add result to large set?
[ "Fire", "off", "a", "thread", "to", "asynchronously", "collect", "stats", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/utils/SystemStatsCollector.java#L260-L278
line/armeria
core/src/main/java/com/linecorp/armeria/server/streaming/ServerSentEvents.java
ServerSentEvents.fromPublisher
public static <T> HttpResponse fromPublisher(HttpHeaders headers, Publisher<T> contentPublisher, HttpHeaders trailingHeaders, Function<? super T, ? extends ServerSentEvent> converter) { """ Creates a new Server-Sent Events stream from the specified {@link Publisher} and {@code converter}. @param headers the HTTP headers supposed to send @param contentPublisher the {@link Publisher} which publishes the objects supposed to send as contents @param trailingHeaders the trailing HTTP headers supposed to send @param converter the converter which converts published objects into {@link ServerSentEvent}s """ requireNonNull(headers, "headers"); requireNonNull(contentPublisher, "contentPublisher"); requireNonNull(trailingHeaders, "trailingHeaders"); requireNonNull(converter, "converter"); return streamingFrom(contentPublisher, sanitizeHeaders(headers), trailingHeaders, o -> toHttpData(converter, o)); }
java
public static <T> HttpResponse fromPublisher(HttpHeaders headers, Publisher<T> contentPublisher, HttpHeaders trailingHeaders, Function<? super T, ? extends ServerSentEvent> converter) { requireNonNull(headers, "headers"); requireNonNull(contentPublisher, "contentPublisher"); requireNonNull(trailingHeaders, "trailingHeaders"); requireNonNull(converter, "converter"); return streamingFrom(contentPublisher, sanitizeHeaders(headers), trailingHeaders, o -> toHttpData(converter, o)); }
[ "public", "static", "<", "T", ">", "HttpResponse", "fromPublisher", "(", "HttpHeaders", "headers", ",", "Publisher", "<", "T", ">", "contentPublisher", ",", "HttpHeaders", "trailingHeaders", ",", "Function", "<", "?", "super", "T", ",", "?", "extends", "Server...
Creates a new Server-Sent Events stream from the specified {@link Publisher} and {@code converter}. @param headers the HTTP headers supposed to send @param contentPublisher the {@link Publisher} which publishes the objects supposed to send as contents @param trailingHeaders the trailing HTTP headers supposed to send @param converter the converter which converts published objects into {@link ServerSentEvent}s
[ "Creates", "a", "new", "Server", "-", "Sent", "Events", "stream", "from", "the", "specified", "{", "@link", "Publisher", "}", "and", "{", "@code", "converter", "}", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/streaming/ServerSentEvents.java#L151-L161
OpenLiberty/open-liberty
dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLUtils.java
SSLUtils.getBufferTraceInfo
public static StringBuilder getBufferTraceInfo(StringBuilder src, WsByteBuffer buffer) { """ This method is called for tracing in various places. It returns a string that represents the buffer including hashcode, position, limit, and capacity. @param src @param buffer buffer to get debug info on @return StringBuilder """ StringBuilder sb = (null == src) ? new StringBuilder(64) : src; if (null == buffer) { return sb.append("null"); } sb.append("hc=").append(buffer.hashCode()); sb.append(" pos=").append(buffer.position()); sb.append(" lim=").append(buffer.limit()); sb.append(" cap=").append(buffer.capacity()); return sb; }
java
public static StringBuilder getBufferTraceInfo(StringBuilder src, WsByteBuffer buffer) { StringBuilder sb = (null == src) ? new StringBuilder(64) : src; if (null == buffer) { return sb.append("null"); } sb.append("hc=").append(buffer.hashCode()); sb.append(" pos=").append(buffer.position()); sb.append(" lim=").append(buffer.limit()); sb.append(" cap=").append(buffer.capacity()); return sb; }
[ "public", "static", "StringBuilder", "getBufferTraceInfo", "(", "StringBuilder", "src", ",", "WsByteBuffer", "buffer", ")", "{", "StringBuilder", "sb", "=", "(", "null", "==", "src", ")", "?", "new", "StringBuilder", "(", "64", ")", ":", "src", ";", "if", ...
This method is called for tracing in various places. It returns a string that represents the buffer including hashcode, position, limit, and capacity. @param src @param buffer buffer to get debug info on @return StringBuilder
[ "This", "method", "is", "called", "for", "tracing", "in", "various", "places", ".", "It", "returns", "a", "string", "that", "represents", "the", "buffer", "including", "hashcode", "position", "limit", "and", "capacity", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLUtils.java#L470-L480
threerings/nenya
core/src/main/java/com/threerings/media/util/LineSegmentPath.java
LineSegmentPath.addNode
public void addNode (int x, int y, int dir) { """ Add a node to the path with the specified destination point and facing direction. @param x the x-position. @param y the y-position. @param dir the facing direction. """ _nodes.add(new PathNode(x, y, dir)); }
java
public void addNode (int x, int y, int dir) { _nodes.add(new PathNode(x, y, dir)); }
[ "public", "void", "addNode", "(", "int", "x", ",", "int", "y", ",", "int", "dir", ")", "{", "_nodes", ".", "add", "(", "new", "PathNode", "(", "x", ",", "y", ",", "dir", ")", ")", ";", "}" ]
Add a node to the path with the specified destination point and facing direction. @param x the x-position. @param y the y-position. @param dir the facing direction.
[ "Add", "a", "node", "to", "the", "path", "with", "the", "specified", "destination", "point", "and", "facing", "direction", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/util/LineSegmentPath.java#L102-L105
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.createMilestone
public GitlabMilestone createMilestone( Serializable projectId, GitlabMilestone milestone) throws IOException { """ Creates a new project milestone. @param projectId The ID of the project. @param milestone The milestone to create. @return The newly created, de-serialized milestone. @throws IOException on gitlab api call error """ String title = milestone.getTitle(); String description = milestone.getDescription(); Date dateDue = milestone.getDueDate(); Date dateStart = milestone.getStartDate(); return createMilestone(projectId, title, description, dateDue, dateStart); }
java
public GitlabMilestone createMilestone( Serializable projectId, GitlabMilestone milestone) throws IOException { String title = milestone.getTitle(); String description = milestone.getDescription(); Date dateDue = milestone.getDueDate(); Date dateStart = milestone.getStartDate(); return createMilestone(projectId, title, description, dateDue, dateStart); }
[ "public", "GitlabMilestone", "createMilestone", "(", "Serializable", "projectId", ",", "GitlabMilestone", "milestone", ")", "throws", "IOException", "{", "String", "title", "=", "milestone", ".", "getTitle", "(", ")", ";", "String", "description", "=", "milestone", ...
Creates a new project milestone. @param projectId The ID of the project. @param milestone The milestone to create. @return The newly created, de-serialized milestone. @throws IOException on gitlab api call error
[ "Creates", "a", "new", "project", "milestone", "." ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L2924-L2932
ludovicianul/selenium-on-steroids
src/main/java/com/insidecoding/sos/io/FileUtils.java
FileUtils.getPropertyAsString
public String getPropertyAsString(final String bundleName, final String key) { """ Gets the value from the resource bundles corresponding to the supplied key. <br/> @param bundleName the name of the bundle to search in @param key the key to search for @return {@code null} if the property is not found or the corresponding value otherwise """ LOG.info("Getting value for key: " + key + " bundleName:" + bundleName); ResourceBundle bundle = bundles.get(bundleName); String result = null; try { result = bundle.getString(key); } catch (MissingResourceException e) { LOG.info("Resource: " + key + " not found!"); } return result; }
java
public String getPropertyAsString(final String bundleName, final String key) { LOG.info("Getting value for key: " + key + " bundleName:" + bundleName); ResourceBundle bundle = bundles.get(bundleName); String result = null; try { result = bundle.getString(key); } catch (MissingResourceException e) { LOG.info("Resource: " + key + " not found!"); } return result; }
[ "public", "String", "getPropertyAsString", "(", "final", "String", "bundleName", ",", "final", "String", "key", ")", "{", "LOG", ".", "info", "(", "\"Getting value for key: \"", "+", "key", "+", "\" bundleName:\"", "+", "bundleName", ")", ";", "ResourceBundle", ...
Gets the value from the resource bundles corresponding to the supplied key. <br/> @param bundleName the name of the bundle to search in @param key the key to search for @return {@code null} if the property is not found or the corresponding value otherwise
[ "Gets", "the", "value", "from", "the", "resource", "bundles", "corresponding", "to", "the", "supplied", "key", ".", "<br", "/", ">" ]
train
https://github.com/ludovicianul/selenium-on-steroids/blob/f89d91c59f686114f94624bfc55712f278005bfa/src/main/java/com/insidecoding/sos/io/FileUtils.java#L279-L289