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 |
|---|---|---|---|---|---|---|---|---|---|---|
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/PropertyChangeSupport.java | PropertyChangeSupport.getPropertyChangeListeners | public PropertyChangeListener[] getPropertyChangeListeners() {
"""
Returns an array of all the listeners that were added to the
SwingPropertyChangeSupport object with addPropertyChangeListener().
<p>
If some listeners have been added with a named property, then the
returned array will be a mixture of PropertyC... | java | public PropertyChangeListener[] getPropertyChangeListeners() {
List returnList = new ArrayList();
// Add all the PropertyChangeListeners
if (listeners != null) {
returnList.addAll(Arrays.asList(listeners.getListeners(PropertyChangeListener.class)));
}
// Add all the PropertyChangeListenerProxys
if (chi... | [
"public",
"PropertyChangeListener",
"[",
"]",
"getPropertyChangeListeners",
"(",
")",
"{",
"List",
"returnList",
"=",
"new",
"ArrayList",
"(",
")",
";",
"// Add all the PropertyChangeListeners",
"if",
"(",
"listeners",
"!=",
"null",
")",
"{",
"returnList",
".",
"a... | Returns an array of all the listeners that were added to the
SwingPropertyChangeSupport object with addPropertyChangeListener().
<p>
If some listeners have been added with a named property, then the
returned array will be a mixture of PropertyChangeListeners and
<code>PropertyChangeListenerProxy</code>s. If the calling... | [
"Returns",
"an",
"array",
"of",
"all",
"the",
"listeners",
"that",
"were",
"added",
"to",
"the",
"SwingPropertyChangeSupport",
"object",
"with",
"addPropertyChangeListener",
"()",
".",
"<p",
">",
"If",
"some",
"listeners",
"have",
"been",
"added",
"with",
"a",
... | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/PropertyChangeSupport.java#L129-L150 |
timtiemens/secretshare | src/main/java/com/tiemens/secretshare/engine/SecretShare.java | SecretShare.performParanoidCombines | public ParanoidOutput performParanoidCombines(List<ShareInfo> shares,
ParanoidInput paranoidInput) {
"""
This version just collects all of the reconstructed secrets.
@param shares to use
@param paranoidInput - control over process
if greater than 0 use ... | java | public ParanoidOutput performParanoidCombines(List<ShareInfo> shares,
ParanoidInput paranoidInput)
{
if (paranoidInput == null)
{
return ParanoidOutput.createEmpty();
}
else
{
return performParanoidComb... | [
"public",
"ParanoidOutput",
"performParanoidCombines",
"(",
"List",
"<",
"ShareInfo",
">",
"shares",
",",
"ParanoidInput",
"paranoidInput",
")",
"{",
"if",
"(",
"paranoidInput",
"==",
"null",
")",
"{",
"return",
"ParanoidOutput",
".",
"createEmpty",
"(",
")",
";... | This version just collects all of the reconstructed secrets.
@param shares to use
@param paranoidInput - control over process
if greater than 0 use that number
if less than 0 OR null no limit
@return ParanoidOutput | [
"This",
"version",
"just",
"collects",
"all",
"of",
"the",
"reconstructed",
"secrets",
"."
] | train | https://github.com/timtiemens/secretshare/blob/f5f88929af99ae0ed0df02dc802e40cdb25fceac/src/main/java/com/tiemens/secretshare/engine/SecretShare.java#L1167-L1178 |
killbilling/recurly-java-library | src/main/java/com/ning/billing/recurly/RecurlyClient.java | RecurlyClient.redeemGiftCard | public GiftCard redeemGiftCard(final String redemptionCode, final String accountCode) {
"""
Redeem a Gift Card
<p>
@param redemptionCode The redemption code the {@link GiftCard}
@param accountCode The account code for the {@link Account}
@return The updated {@link GiftCard} object as identified by the passed... | java | public GiftCard redeemGiftCard(final String redemptionCode, final String accountCode) {
final GiftCard.Redemption redemptionData = GiftCard.createRedemption(accountCode);
final String url = GiftCards.GIFT_CARDS_RESOURCE + "/" + redemptionCode + "/redeem";
return doPOST(url, redemptionData, Gift... | [
"public",
"GiftCard",
"redeemGiftCard",
"(",
"final",
"String",
"redemptionCode",
",",
"final",
"String",
"accountCode",
")",
"{",
"final",
"GiftCard",
".",
"Redemption",
"redemptionData",
"=",
"GiftCard",
".",
"createRedemption",
"(",
"accountCode",
")",
";",
"fi... | Redeem a Gift Card
<p>
@param redemptionCode The redemption code the {@link GiftCard}
@param accountCode The account code for the {@link Account}
@return The updated {@link GiftCard} object as identified by the passed in id | [
"Redeem",
"a",
"Gift",
"Card",
"<p",
">"
] | train | https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1843-L1848 |
PinaeOS/nala | src/main/java/org/pinae/nala/xb/util/ResourceWriter.java | ResourceWriter.writeToFile | public void writeToFile(StringBuffer content, String filename, String encoding) throws NoSuchPathException, IOException {
"""
将XML内容写入文件
@param content XML内容
@param filename 需要写入的文件
@param encoding 文件编码
@throws NoSuchPathException 写入文件时, 无法发现路径引发的异常
@throws IOException 文件写入异常
"""
try {
OutputStr... | java | public void writeToFile(StringBuffer content, String filename, String encoding) throws NoSuchPathException, IOException{
try {
OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(filename), encoding);
writer.write(content.toString(), 0, content.length());
writer.flush();
writer.close()... | [
"public",
"void",
"writeToFile",
"(",
"StringBuffer",
"content",
",",
"String",
"filename",
",",
"String",
"encoding",
")",
"throws",
"NoSuchPathException",
",",
"IOException",
"{",
"try",
"{",
"OutputStreamWriter",
"writer",
"=",
"new",
"OutputStreamWriter",
"(",
... | 将XML内容写入文件
@param content XML内容
@param filename 需要写入的文件
@param encoding 文件编码
@throws NoSuchPathException 写入文件时, 无法发现路径引发的异常
@throws IOException 文件写入异常 | [
"将XML内容写入文件"
] | train | https://github.com/PinaeOS/nala/blob/2047ade4af197cec938278d300d111ea94af6fbf/src/main/java/org/pinae/nala/xb/util/ResourceWriter.java#L50-L59 |
cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/IndexUpdater.java | IndexUpdater.updateIndex | public static void updateIndex(String indexName,
List<FieldSort> fieldNames,
Database database,
SQLDatabaseQueue queue) throws QueryException {
"""
Update a single index.
This index is assumed to al... | java | public static void updateIndex(String indexName,
List<FieldSort> fieldNames,
Database database,
SQLDatabaseQueue queue) throws QueryException {
IndexUpdater updater = new IndexUpdater(database, queu... | [
"public",
"static",
"void",
"updateIndex",
"(",
"String",
"indexName",
",",
"List",
"<",
"FieldSort",
">",
"fieldNames",
",",
"Database",
"database",
",",
"SQLDatabaseQueue",
"queue",
")",
"throws",
"QueryException",
"{",
"IndexUpdater",
"updater",
"=",
"new",
"... | Update a single index.
This index is assumed to already exist.
@param indexName Name of index to update
@param fieldNames List of field names in the sort format
@param database The local {@link Database}
@param queue The executor service queue
@return index update success status (true/false) | [
"Update",
"a",
"single",
"index",
"."
] | train | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/IndexUpdater.java#L86-L93 |
zaproxy/zaproxy | src/org/zaproxy/zap/utils/FontUtils.java | FontUtils.getFont | public static Font getFont (int style, Size size) {
"""
Gets the default font with the specified style and size, correctly scaled
@param style
@param size
@return
"""
return getFont(getDefaultFont(), size).deriveFont(style);
} | java | public static Font getFont (int style, Size size) {
return getFont(getDefaultFont(), size).deriveFont(style);
} | [
"public",
"static",
"Font",
"getFont",
"(",
"int",
"style",
",",
"Size",
"size",
")",
"{",
"return",
"getFont",
"(",
"getDefaultFont",
"(",
")",
",",
"size",
")",
".",
"deriveFont",
"(",
"style",
")",
";",
"}"
] | Gets the default font with the specified style and size, correctly scaled
@param style
@param size
@return | [
"Gets",
"the",
"default",
"font",
"with",
"the",
"specified",
"style",
"and",
"size",
"correctly",
"scaled"
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/utils/FontUtils.java#L179-L181 |
fernandospr/java-wns | src/main/java/ar/com/fernandospr/wns/WnsService.java | WnsService.pushBadge | public WnsNotificationResponse pushBadge(String channelUri, WnsBadge badge) throws WnsException {
"""
Pushes a badge to channelUri
@param channelUri
@param badge which should be built with {@link ar.com.fernandospr.wns.model.builders.WnsBadgeBuilder}
@return WnsNotificationResponse please see response headers f... | java | public WnsNotificationResponse pushBadge(String channelUri, WnsBadge badge) throws WnsException {
return this.pushBadge(channelUri, null, badge);
} | [
"public",
"WnsNotificationResponse",
"pushBadge",
"(",
"String",
"channelUri",
",",
"WnsBadge",
"badge",
")",
"throws",
"WnsException",
"{",
"return",
"this",
".",
"pushBadge",
"(",
"channelUri",
",",
"null",
",",
"badge",
")",
";",
"}"
] | Pushes a badge to channelUri
@param channelUri
@param badge which should be built with {@link ar.com.fernandospr.wns.model.builders.WnsBadgeBuilder}
@return WnsNotificationResponse please see response headers from <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx#send_notification_response">ht... | [
"Pushes",
"a",
"badge",
"to",
"channelUri"
] | train | https://github.com/fernandospr/java-wns/blob/cd621b9c17d1e706f6284e0913531d834904a90d/src/main/java/ar/com/fernandospr/wns/WnsService.java#L168-L170 |
alkacon/opencms-core | src/org/opencms/jsp/decorator/CmsDecorationDefintion.java | CmsDecorationDefintion.getDecorationDefinitionNames | public static List<String> getDecorationDefinitionNames(CmsObject cms) throws CmsException {
"""
Returns all different decoration configuration names (like "abbr" or "acronym") that
are in the config file pointed to by module parameter "configfile".<p>
@param cms needed to access the decoration definition XML ... | java | public static List<String> getDecorationDefinitionNames(CmsObject cms) throws CmsException {
List<String> result = new ArrayList<String>();
CmsModule module = OpenCms.getModuleManager().getModule("com.alkacon.opencms.extendeddecorator");
String configFile = module.getParameter("configfile");
... | [
"public",
"static",
"List",
"<",
"String",
">",
"getDecorationDefinitionNames",
"(",
"CmsObject",
"cms",
")",
"throws",
"CmsException",
"{",
"List",
"<",
"String",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"CmsModule",
"modul... | Returns all different decoration configuration names (like "abbr" or "acronym") that
are in the config file pointed to by module parameter "configfile".<p>
@param cms needed to access the decoration definition XML content
@return all different decoration configuration names (like "abbr" or "acronym") that
are in the... | [
"Returns",
"all",
"different",
"decoration",
"configuration",
"names",
"(",
"like",
"abbr",
"or",
"acronym",
")",
"that",
"are",
"in",
"the",
"config",
"file",
"pointed",
"to",
"by",
"module",
"parameter",
"configfile",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/decorator/CmsDecorationDefintion.java#L135-L155 |
eobermuhlner/big-math | ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigRational.java | BigRational.multiply | private BigRational multiply(BigDecimal value) {
"""
private, because we want to hide that we use BigDecimal internally
"""
BigDecimal n = numerator.multiply(value);
BigDecimal d = denominator;
return of(n, d);
} | java | private BigRational multiply(BigDecimal value) {
BigDecimal n = numerator.multiply(value);
BigDecimal d = denominator;
return of(n, d);
} | [
"private",
"BigRational",
"multiply",
"(",
"BigDecimal",
"value",
")",
"{",
"BigDecimal",
"n",
"=",
"numerator",
".",
"multiply",
"(",
"value",
")",
";",
"BigDecimal",
"d",
"=",
"denominator",
";",
"return",
"of",
"(",
"n",
",",
"d",
")",
";",
"}"
] | private, because we want to hide that we use BigDecimal internally | [
"private",
"because",
"we",
"want",
"to",
"hide",
"that",
"we",
"use",
"BigDecimal",
"internally"
] | train | https://github.com/eobermuhlner/big-math/blob/52c4fc334d0d722b295de740c1018ee400e3e8f2/ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigRational.java#L412-L416 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/dateTimePicker/DateTimePickerRenderer.java | DateTimePickerRenderer.encodeBegin | @Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
"""
This methods generates the HTML code of the current b:dateTimePicker.
@param context the FacesContext.
@param component the current b:dateTimePicker.
@throws IOException thrown if something goes wrong when w... | java | @Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
DateTimePicker dtp = (DateTimePicker) component;
ResponseWriter rw = context.getResponseWriter();
String dateTimePickerId = encodeHTML(context, rw, dtp);
encodeJS... | [
"@",
"Override",
"public",
"void",
"encodeBegin",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"component",
".",
"isRendered",
"(",
")",
")",
"{",
"return",
";",
"}",
"DateTimePicker",
"d... | This methods generates the HTML code of the current b:dateTimePicker.
@param context the FacesContext.
@param component the current b:dateTimePicker.
@throws IOException thrown if something goes wrong when writing the HTML code. | [
"This",
"methods",
"generates",
"the",
"HTML",
"code",
"of",
"the",
"current",
"b",
":",
"dateTimePicker",
"."
] | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/dateTimePicker/DateTimePickerRenderer.java#L143-L153 |
alibaba/otter | shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/ZkClientx.java | ZkClientx.createEphemeralSequential | public String createEphemeralSequential(final String path, final Object data) throws ZkInterruptedException,
IllegalArgumentException, ZkException,
RuntimeExc... | java | public String createEphemeralSequential(final String path, final Object data) throws ZkInterruptedException,
IllegalArgumentException, ZkException,
RuntimeExc... | [
"public",
"String",
"createEphemeralSequential",
"(",
"final",
"String",
"path",
",",
"final",
"Object",
"data",
")",
"throws",
"ZkInterruptedException",
",",
"IllegalArgumentException",
",",
"ZkException",
",",
"RuntimeException",
"{",
"return",
"create",
"(",
"path"... | Create an ephemeral, sequential node.
@param path
@param data
@return created path
@throws ZkInterruptedException if operation was interrupted, or a required reconnection got interrupted
@throws IllegalArgumentException if called from anything except the ZooKeeper event thread
@throws ZkException if any ZooKeeper exce... | [
"Create",
"an",
"ephemeral",
"sequential",
"node",
"."
] | train | https://github.com/alibaba/otter/blob/c7b5f94a0dd162e01ddffaf3a63cade7d23fca55/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/ZkClientx.java#L440-L444 |
twotoasters/JazzyListView | library/src/main/java/com/twotoasters/jazzylistview/JazzyHelper.java | JazzyHelper.setVelocity | private void setVelocity(int firstVisibleItem, int totalItemCount) {
"""
Should be called in onScroll to keep take of current Velocity.
@param firstVisibleItem
The index of the first visible item in the ListView.
"""
if (mMaxVelocity > MAX_VELOCITY_OFF && mPreviousFirstVisibleItem != firstVisibleIt... | java | private void setVelocity(int firstVisibleItem, int totalItemCount) {
if (mMaxVelocity > MAX_VELOCITY_OFF && mPreviousFirstVisibleItem != firstVisibleItem) {
long currTime = System.currentTimeMillis();
long timeToScrollOneItem = currTime - mPreviousEventTime;
if (timeToScrollO... | [
"private",
"void",
"setVelocity",
"(",
"int",
"firstVisibleItem",
",",
"int",
"totalItemCount",
")",
"{",
"if",
"(",
"mMaxVelocity",
">",
"MAX_VELOCITY_OFF",
"&&",
"mPreviousFirstVisibleItem",
"!=",
"firstVisibleItem",
")",
"{",
"long",
"currTime",
"=",
"System",
... | Should be called in onScroll to keep take of current Velocity.
@param firstVisibleItem
The index of the first visible item in the ListView. | [
"Should",
"be",
"called",
"in",
"onScroll",
"to",
"keep",
"take",
"of",
"current",
"Velocity",
"."
] | train | https://github.com/twotoasters/JazzyListView/blob/4a69239f90374a71e7d4073448ca049bd074f7fe/library/src/main/java/com/twotoasters/jazzylistview/JazzyHelper.java#L156-L178 |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java | HttpHeaders.getDateHeader | @Deprecated
public static Date getDateHeader(HttpMessage message, CharSequence name, Date defaultValue) {
"""
@deprecated Use {@link #getTimeMillis(CharSequence, long)} instead.
Returns the date header value with the specified header name. If
there are more than one header value for the specified header n... | java | @Deprecated
public static Date getDateHeader(HttpMessage message, CharSequence name, Date defaultValue) {
final String value = getHeader(message, name);
Date date = DateFormatter.parseHttpDate(value);
return date != null ? date : defaultValue;
} | [
"@",
"Deprecated",
"public",
"static",
"Date",
"getDateHeader",
"(",
"HttpMessage",
"message",
",",
"CharSequence",
"name",
",",
"Date",
"defaultValue",
")",
"{",
"final",
"String",
"value",
"=",
"getHeader",
"(",
"message",
",",
"name",
")",
";",
"Date",
"d... | @deprecated Use {@link #getTimeMillis(CharSequence, long)} instead.
Returns the date header value with the specified header name. If
there are more than one header value for the specified header name, the
first value is returned.
@return the header value or the {@code defaultValue} if there is no such
header or the ... | [
"@deprecated",
"Use",
"{",
"@link",
"#getTimeMillis",
"(",
"CharSequence",
"long",
")",
"}",
"instead",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L875-L880 |
classgraph/classgraph | src/main/java/nonapi/io/github/classgraph/concurrency/WorkQueue.java | WorkQueue.runWorkLoop | private void runWorkLoop() throws InterruptedException, ExecutionException {
"""
Start a worker. Called by startWorkers(), but should also be called by the main thread to do some of the work
on that thread, to prevent deadlock in the case that the ExecutorService doesn't have as many threads
available as numPara... | java | private void runWorkLoop() throws InterruptedException, ExecutionException {
// Get next work unit from queue
for (;;) {
// Check for interruption
interruptionChecker.check();
// Get next work unit
final WorkUnitWrapper<T> workUnitWrapper = workUnits.take... | [
"private",
"void",
"runWorkLoop",
"(",
")",
"throws",
"InterruptedException",
",",
"ExecutionException",
"{",
"// Get next work unit from queue",
"for",
"(",
";",
";",
")",
"{",
"// Check for interruption",
"interruptionChecker",
".",
"check",
"(",
")",
";",
"// Get n... | Start a worker. Called by startWorkers(), but should also be called by the main thread to do some of the work
on that thread, to prevent deadlock in the case that the ExecutorService doesn't have as many threads
available as numParallelTasks. When this method returns, either all the work has been completed, or this or
... | [
"Start",
"a",
"worker",
".",
"Called",
"by",
"startWorkers",
"()",
"but",
"should",
"also",
"be",
"called",
"by",
"the",
"main",
"thread",
"to",
"do",
"some",
"of",
"the",
"work",
"on",
"that",
"thread",
"to",
"prevent",
"deadlock",
"in",
"the",
"case",
... | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/nonapi/io/github/classgraph/concurrency/WorkQueue.java#L228-L266 |
RestComm/jain-slee.sip | examples/sip-wake-up/sbb/src/main/java/org/mobicents/slee/examples/wakeup/WakeUpSbb.java | WakeUpSbb.onTimerEvent | public void onTimerEvent(TimerEvent event, ActivityContextInterface aci) {
"""
Event handler from the timer event, which signals that a message must be
sent back to the UA
@param event
@param aci
"""
// detaching so the null AC is claimed after the event handling
aci.detach(sbbContext.getSbbLocalObjec... | java | public void onTimerEvent(TimerEvent event, ActivityContextInterface aci) {
// detaching so the null AC is claimed after the event handling
aci.detach(sbbContext.getSbbLocalObject());
try {
DataSourceChildSbbLocalInterface child = (DataSourceChildSbbLocalInterface) getLocationChildRelation().create();
child.... | [
"public",
"void",
"onTimerEvent",
"(",
"TimerEvent",
"event",
",",
"ActivityContextInterface",
"aci",
")",
"{",
"// detaching so the null AC is claimed after the event handling",
"aci",
".",
"detach",
"(",
"sbbContext",
".",
"getSbbLocalObject",
"(",
")",
")",
";",
"try... | Event handler from the timer event, which signals that a message must be
sent back to the UA
@param event
@param aci | [
"Event",
"handler",
"from",
"the",
"timer",
"event",
"which",
"signals",
"that",
"a",
"message",
"must",
"be",
"sent",
"back",
"to",
"the",
"UA"
] | train | https://github.com/RestComm/jain-slee.sip/blob/2c173af0a760cb0ea13fe0ffa58c0f82b14731f9/examples/sip-wake-up/sbb/src/main/java/org/mobicents/slee/examples/wakeup/WakeUpSbb.java#L310-L320 |
jenkinsci/jenkins | core/src/main/java/hudson/model/LargeText.java | LargeText.doProgressText | public void doProgressText(StaplerRequest req, StaplerResponse rsp) throws IOException {
"""
Implements the progressive text handling.
This method is used as a "web method" with progressiveText.jelly.
"""
rsp.setContentType("text/plain");
rsp.setStatus(HttpServletResponse.SC_OK);
if(!... | java | public void doProgressText(StaplerRequest req, StaplerResponse rsp) throws IOException {
rsp.setContentType("text/plain");
rsp.setStatus(HttpServletResponse.SC_OK);
if(!source.exists()) {
// file doesn't exist yet
rsp.addHeader("X-Text-Size","0");
rsp.addHead... | [
"public",
"void",
"doProgressText",
"(",
"StaplerRequest",
"req",
",",
"StaplerResponse",
"rsp",
")",
"throws",
"IOException",
"{",
"rsp",
".",
"setContentType",
"(",
"\"text/plain\"",
")",
";",
"rsp",
".",
"setStatus",
"(",
"HttpServletResponse",
".",
"SC_OK",
... | Implements the progressive text handling.
This method is used as a "web method" with progressiveText.jelly. | [
"Implements",
"the",
"progressive",
"text",
"handling",
".",
"This",
"method",
"is",
"used",
"as",
"a",
"web",
"method",
"with",
"progressiveText",
".",
"jelly",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/LargeText.java#L178-L213 |
google/error-prone-javac | src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java | ConstantsSummaryBuilder.buildConstantSummary | public void buildConstantSummary(XMLNode node, Content contentTree) throws Exception {
"""
Build the constant summary.
@param node the XML element that specifies which components to document
@param contentTree the content tree to which the documentation will be added
"""
contentTree = writer.getHea... | java | public void buildConstantSummary(XMLNode node, Content contentTree) throws Exception {
contentTree = writer.getHeader();
buildChildren(node, contentTree);
writer.addFooter(contentTree);
writer.printDocument(contentTree);
writer.close();
} | [
"public",
"void",
"buildConstantSummary",
"(",
"XMLNode",
"node",
",",
"Content",
"contentTree",
")",
"throws",
"Exception",
"{",
"contentTree",
"=",
"writer",
".",
"getHeader",
"(",
")",
";",
"buildChildren",
"(",
"node",
",",
"contentTree",
")",
";",
"writer... | Build the constant summary.
@param node the XML element that specifies which components to document
@param contentTree the content tree to which the documentation will be added | [
"Build",
"the",
"constant",
"summary",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java#L144-L150 |
xuender/unidecode | src/main/java/me/xuender/unidecode/Unidecode.java | Unidecode.decode | public static String decode(final String str, final String charsetName) throws UnsupportedEncodingException {
"""
Transliterate an Unicode object into an ASCII string.
@param str Unicode String to transliterate.
@param charsetName charset Name
@return ASCII string.
@throws UnsupportedEncodingExceptio... | java | public static String decode(final String str, final String charsetName) throws UnsupportedEncodingException {
return decode(new String(str.getBytes(charsetName), "UTF-8"));
} | [
"public",
"static",
"String",
"decode",
"(",
"final",
"String",
"str",
",",
"final",
"String",
"charsetName",
")",
"throws",
"UnsupportedEncodingException",
"{",
"return",
"decode",
"(",
"new",
"String",
"(",
"str",
".",
"getBytes",
"(",
"charsetName",
")",
",... | Transliterate an Unicode object into an ASCII string.
@param str Unicode String to transliterate.
@param charsetName charset Name
@return ASCII string.
@throws UnsupportedEncodingException | [
"Transliterate",
"an",
"Unicode",
"object",
"into",
"an",
"ASCII",
"string",
"."
] | train | https://github.com/xuender/unidecode/blob/88a1f81e995beb1b64bc68241a7ab9894dc7d2fe/src/main/java/me/xuender/unidecode/Unidecode.java#L66-L68 |
lucee/Lucee | core/src/main/java/lucee/runtime/op/Caster.java | Caster.toList | public static List toList(Object o, boolean duplicate, List defaultValue) {
"""
cast a Object to a Array Object
@param o Object to cast
@param duplicate
@param defaultValue
@return casted Array
"""
try {
return toList(o, duplicate);
}
catch (PageException e) {
return defaultValue;
}
} | java | public static List toList(Object o, boolean duplicate, List defaultValue) {
try {
return toList(o, duplicate);
}
catch (PageException e) {
return defaultValue;
}
} | [
"public",
"static",
"List",
"toList",
"(",
"Object",
"o",
",",
"boolean",
"duplicate",
",",
"List",
"defaultValue",
")",
"{",
"try",
"{",
"return",
"toList",
"(",
"o",
",",
"duplicate",
")",
";",
"}",
"catch",
"(",
"PageException",
"e",
")",
"{",
"retu... | cast a Object to a Array Object
@param o Object to cast
@param duplicate
@param defaultValue
@return casted Array | [
"cast",
"a",
"Object",
"to",
"a",
"Array",
"Object"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L2207-L2214 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.writeToStream | public static File writeToStream(File file, OutputStream out) throws IORuntimeException {
"""
将文件写入流中
@param file 文件
@param out 流
@return 目标文件
@throws IORuntimeException IO异常
"""
return FileReader.create(file).writeToStream(out);
} | java | public static File writeToStream(File file, OutputStream out) throws IORuntimeException {
return FileReader.create(file).writeToStream(out);
} | [
"public",
"static",
"File",
"writeToStream",
"(",
"File",
"file",
",",
"OutputStream",
"out",
")",
"throws",
"IORuntimeException",
"{",
"return",
"FileReader",
".",
"create",
"(",
"file",
")",
".",
"writeToStream",
"(",
"out",
")",
";",
"}"
] | 将文件写入流中
@param file 文件
@param out 流
@return 目标文件
@throws IORuntimeException IO异常 | [
"将文件写入流中"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L3177-L3179 |
groovyfx-project/groovyfx | src/main/groovy/groovyx/javafx/beans/FXBindableASTTransformation.java | FXBindableASTTransformation.generateSyntaxErrorMessage | private void generateSyntaxErrorMessage(SourceUnit sourceUnit, AnnotationNode node, String msg) {
"""
Generates a SyntaxErrorMessage based on the current SourceUnit, AnnotationNode, and a specified
error message.
@param sourceUnit The SourceUnit
@param node The node that was annotated
@param msg ... | java | private void generateSyntaxErrorMessage(SourceUnit sourceUnit, AnnotationNode node, String msg) {
SyntaxException error = new SyntaxException(msg, node.getLineNumber(), node.getColumnNumber());
sourceUnit.getErrorCollector().addErrorAndContinue(new SyntaxErrorMessage(error, sourceUnit));
} | [
"private",
"void",
"generateSyntaxErrorMessage",
"(",
"SourceUnit",
"sourceUnit",
",",
"AnnotationNode",
"node",
",",
"String",
"msg",
")",
"{",
"SyntaxException",
"error",
"=",
"new",
"SyntaxException",
"(",
"msg",
",",
"node",
".",
"getLineNumber",
"(",
")",
"... | Generates a SyntaxErrorMessage based on the current SourceUnit, AnnotationNode, and a specified
error message.
@param sourceUnit The SourceUnit
@param node The node that was annotated
@param msg The error message to display | [
"Generates",
"a",
"SyntaxErrorMessage",
"based",
"on",
"the",
"current",
"SourceUnit",
"AnnotationNode",
"and",
"a",
"specified",
"error",
"message",
"."
] | train | https://github.com/groovyfx-project/groovyfx/blob/7067d76793601ce4de9c642d4c0c0e11db7907cb/src/main/groovy/groovyx/javafx/beans/FXBindableASTTransformation.java#L645-L648 |
moparisthebest/beehive | beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlImplementation.java | AptControlImplementation.initContexts | private ArrayList<AptContextField> initContexts() {
"""
Initializes the list of ContextField declared directly by this ControlImpl
"""
ArrayList<AptContextField> contexts = new ArrayList<AptContextField>();
if ( _implDecl == null || _implDecl.getFields() == null )
return co... | java | private ArrayList<AptContextField> initContexts()
{
ArrayList<AptContextField> contexts = new ArrayList<AptContextField>();
if ( _implDecl == null || _implDecl.getFields() == null )
return contexts;
Collection<FieldDeclaration> declaredFields = _implDecl.getFields();
... | [
"private",
"ArrayList",
"<",
"AptContextField",
">",
"initContexts",
"(",
")",
"{",
"ArrayList",
"<",
"AptContextField",
">",
"contexts",
"=",
"new",
"ArrayList",
"<",
"AptContextField",
">",
"(",
")",
";",
"if",
"(",
"_implDecl",
"==",
"null",
"||",
"_implD... | Initializes the list of ContextField declared directly by this ControlImpl | [
"Initializes",
"the",
"list",
"of",
"ContextField",
"declared",
"directly",
"by",
"this",
"ControlImpl"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-controls/src/main/java/org/apache/beehive/controls/runtime/generator/AptControlImplementation.java#L135-L149 |
apiman/apiman | manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java | EsMarshalling.unmarshallAuditEntry | public static AuditEntryBean unmarshallAuditEntry(Map<String, Object> source) {
"""
Unmarshals the given map source into a bean.
@param source the source
@return the audit entry
"""
if (source == null) {
return null;
}
AuditEntryBean bean = new AuditEntryBean();
be... | java | public static AuditEntryBean unmarshallAuditEntry(Map<String, Object> source) {
if (source == null) {
return null;
}
AuditEntryBean bean = new AuditEntryBean();
bean.setId(asLong(source.get("id")));
bean.setOrganizationId(asString(source.get("organizationId")));
... | [
"public",
"static",
"AuditEntryBean",
"unmarshallAuditEntry",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"source",
")",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"AuditEntryBean",
"bean",
"=",
"new",
"AuditEntryBean",
... | Unmarshals the given map source into a bean.
@param source the source
@return the audit entry | [
"Unmarshals",
"the",
"given",
"map",
"source",
"into",
"a",
"bean",
"."
] | train | https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/es/src/main/java/io/apiman/manager/api/es/EsMarshalling.java#L1209-L1225 |
MTDdk/jawn | jawn-server/src/main/java/net/javapla/jawn/server/SessionFacadeImpl.java | SessionFacadeImpl.put | public Object put(String name, Serializable value) {
"""
Add object to a session.
@param name name of object
@param value object reference.
@return the previous bound value for the name
"""
// Object val = session/*request.getSession(true)*/.getAttribute(name);
// request.getSession(false).set... | java | public Object put(String name, Serializable value){
// Object val = session/*request.getSession(true)*/.getAttribute(name);
// request.getSession(false).setAttribute(name, value);
Object val = session.getAttribute(name);
session.setAttribute(name, value);
return val;
} | [
"public",
"Object",
"put",
"(",
"String",
"name",
",",
"Serializable",
"value",
")",
"{",
"// Object val = session/*request.getSession(true)*/.getAttribute(name);",
"// request.getSession(false).setAttribute(name, value);",
"Object",
"val",
"=",
"session",
".",
"get... | Add object to a session.
@param name name of object
@param value object reference.
@return the previous bound value for the name | [
"Add",
"object",
"to",
"a",
"session",
"."
] | train | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-server/src/main/java/net/javapla/jawn/server/SessionFacadeImpl.java#L75-L81 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/DeepSubtypeAnalysis.java | DeepSubtypeAnalysis.deepInstanceOf | public static double deepInstanceOf(@DottedClassName String x, @DottedClassName String y) throws ClassNotFoundException {
"""
Given two JavaClasses, try to estimate the probability that an reference
of type x is also an instance of type y. Will return 0 only if it is
impossible and 1 only if it is guaranteed.
... | java | public static double deepInstanceOf(@DottedClassName String x, @DottedClassName String y) throws ClassNotFoundException {
return Analyze.deepInstanceOf(x, y);
} | [
"public",
"static",
"double",
"deepInstanceOf",
"(",
"@",
"DottedClassName",
"String",
"x",
",",
"@",
"DottedClassName",
"String",
"y",
")",
"throws",
"ClassNotFoundException",
"{",
"return",
"Analyze",
".",
"deepInstanceOf",
"(",
"x",
",",
"y",
")",
";",
"}"
... | Given two JavaClasses, try to estimate the probability that an reference
of type x is also an instance of type y. Will return 0 only if it is
impossible and 1 only if it is guaranteed.
@param x
Known type of object
@param y
Type queried about
@return 0 - 1 value indicating probability | [
"Given",
"two",
"JavaClasses",
"try",
"to",
"estimate",
"the",
"probability",
"that",
"an",
"reference",
"of",
"type",
"x",
"is",
"also",
"an",
"instance",
"of",
"type",
"y",
".",
"Will",
"return",
"0",
"only",
"if",
"it",
"is",
"impossible",
"and",
"1",... | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/DeepSubtypeAnalysis.java#L290-L292 |
perwendel/spark | src/main/java/spark/staticfiles/StaticFilesConfiguration.java | StaticFilesConfiguration.configureExternal | public synchronized void configureExternal(String folder) {
"""
Configures location for static resources
@param folder the location
"""
Assert.notNull(folder, "'folder' must not be null");
if (!externalStaticResourcesSet) {
try {
ExternalResource resource = new E... | java | public synchronized void configureExternal(String folder) {
Assert.notNull(folder, "'folder' must not be null");
if (!externalStaticResourcesSet) {
try {
ExternalResource resource = new ExternalResource(folder);
if (!resource.getFile().isDirectory()) {
... | [
"public",
"synchronized",
"void",
"configureExternal",
"(",
"String",
"folder",
")",
"{",
"Assert",
".",
"notNull",
"(",
"folder",
",",
"\"'folder' must not be null\"",
")",
";",
"if",
"(",
"!",
"externalStaticResourcesSet",
")",
"{",
"try",
"{",
"ExternalResource... | Configures location for static resources
@param folder the location | [
"Configures",
"location",
"for",
"static",
"resources"
] | train | https://github.com/perwendel/spark/blob/080fb1f9d6e580f6742e9589044c7420d3157b8b/src/main/java/spark/staticfiles/StaticFilesConfiguration.java#L160-L182 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/tuple/ArrayOfDoublesQuickSelectSketch.java | ArrayOfDoublesQuickSelectSketch.merge | void merge(final long key, final double[] values) {
"""
not sufficient by itself without keeping track of theta of another sketch
"""
setNotEmpty();
if (key < theta_) {
final int index = findOrInsertKey(key);
if (index < 0) {
incrementCount();
setValues(~index, values);
... | java | void merge(final long key, final double[] values) {
setNotEmpty();
if (key < theta_) {
final int index = findOrInsertKey(key);
if (index < 0) {
incrementCount();
setValues(~index, values);
} else {
updateValues(index, values);
}
rebuildIfNeeded();
}
} | [
"void",
"merge",
"(",
"final",
"long",
"key",
",",
"final",
"double",
"[",
"]",
"values",
")",
"{",
"setNotEmpty",
"(",
")",
";",
"if",
"(",
"key",
"<",
"theta_",
")",
"{",
"final",
"int",
"index",
"=",
"findOrInsertKey",
"(",
"key",
")",
";",
"if"... | not sufficient by itself without keeping track of theta of another sketch | [
"not",
"sufficient",
"by",
"itself",
"without",
"keeping",
"track",
"of",
"theta",
"of",
"another",
"sketch"
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/tuple/ArrayOfDoublesQuickSelectSketch.java#L100-L112 |
wuman/orientdb-android | commons/src/main/java/com/orientechnologies/common/collection/OMVRBTree.java | OMVRBTree.colorOf | private static <K, V> boolean colorOf(final OMVRBTreeEntry<K, V> p) {
"""
Balancing operations.
Implementations of rebalancings during insertion and deletion are slightly different than the CLR version. Rather than using
dummy nilnodes, we use a set of accessors that deal properly with null. They are used to a... | java | private static <K, V> boolean colorOf(final OMVRBTreeEntry<K, V> p) {
return (p == null ? BLACK : p.getColor());
} | [
"private",
"static",
"<",
"K",
",",
"V",
">",
"boolean",
"colorOf",
"(",
"final",
"OMVRBTreeEntry",
"<",
"K",
",",
"V",
">",
"p",
")",
"{",
"return",
"(",
"p",
"==",
"null",
"?",
"BLACK",
":",
"p",
".",
"getColor",
"(",
")",
")",
";",
"}"
] | Balancing operations.
Implementations of rebalancings during insertion and deletion are slightly different than the CLR version. Rather than using
dummy nilnodes, we use a set of accessors that deal properly with null. They are used to avoid messiness surrounding nullness
checks in the main algorithms. | [
"Balancing",
"operations",
"."
] | train | https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/commons/src/main/java/com/orientechnologies/common/collection/OMVRBTree.java#L2328-L2330 |
dkmfbk/knowledgestore | ks-server-virtuoso/src/main/java/eu/fbk/knowledgestore/triplestore/virtuoso/VirtuosoTripleTransaction.java | VirtuosoTripleTransaction.removeBulk | public void removeBulk(final Iterable<? extends Statement> statements,
final boolean transaction) throws DataCorruptedException, IOException {
"""
Removes the specified RDF statements from the triple store. Implementations are designed to
perform high throughput insertion.
@param statements
the RD... | java | public void removeBulk(final Iterable<? extends Statement> statements,
final boolean transaction) throws DataCorruptedException, IOException {
Preconditions.checkNotNull(statements);
checkWritable();
try {
if (!transaction && !this.store.existsTransactionMarker()) {
... | [
"public",
"void",
"removeBulk",
"(",
"final",
"Iterable",
"<",
"?",
"extends",
"Statement",
">",
"statements",
",",
"final",
"boolean",
"transaction",
")",
"throws",
"DataCorruptedException",
",",
"IOException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"sta... | Removes the specified RDF statements from the triple store. Implementations are designed to
perform high throughput insertion.
@param statements
the RDF statements to add
@throws DataCorruptedException
in case a non-recoverable data corruption situation is detected
@throws IOException
in case another IO error occurs n... | [
"Removes",
"the",
"specified",
"RDF",
"statements",
"from",
"the",
"triple",
"store",
".",
"Implementations",
"are",
"designed",
"to",
"perform",
"high",
"throughput",
"insertion",
"."
] | train | https://github.com/dkmfbk/knowledgestore/blob/a548101b1dd67fcf72a1ec6f838ea7539bdbbe7a/ks-server-virtuoso/src/main/java/eu/fbk/knowledgestore/triplestore/virtuoso/VirtuosoTripleTransaction.java#L362-L383 |
Talend/tesb-rt-se | examples/cxf/jaxrs-attachments/client/src/main/java/client/RESTClient.java | RESTClient.verifyXopResponse | private void verifyXopResponse(XopBean xopOriginal, XopBean xopResponse) {
"""
Verifies that the received image is identical to the original one.
@param xopOriginal
@param xopResponse
"""
if (!Arrays.equals(xopResponse.getBytes(), xopOriginal.getBytes())) {
throw new RuntimeException("Rec... | java | private void verifyXopResponse(XopBean xopOriginal, XopBean xopResponse) {
if (!Arrays.equals(xopResponse.getBytes(), xopOriginal.getBytes())) {
throw new RuntimeException("Received XOP attachment is corrupted");
}
System.out.println();
System.out.println("XOP attachment has ... | [
"private",
"void",
"verifyXopResponse",
"(",
"XopBean",
"xopOriginal",
",",
"XopBean",
"xopResponse",
")",
"{",
"if",
"(",
"!",
"Arrays",
".",
"equals",
"(",
"xopResponse",
".",
"getBytes",
"(",
")",
",",
"xopOriginal",
".",
"getBytes",
"(",
")",
")",
")",... | Verifies that the received image is identical to the original one.
@param xopOriginal
@param xopResponse | [
"Verifies",
"that",
"the",
"received",
"image",
"is",
"identical",
"to",
"the",
"original",
"one",
"."
] | train | https://github.com/Talend/tesb-rt-se/blob/0a151a6d91ffff65ac4b5ee0c5b2c882ac28d886/examples/cxf/jaxrs-attachments/client/src/main/java/client/RESTClient.java#L219-L225 |
salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/ChartResources.java | ChartResources.getChartByID | @GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/ {
"""
Find a chart, given its id.
@param req The HttpServlet request object. Cannot be null.
@param chartId The chart Id. Cannot be null and must be a positive non-zero number.
@param fields The fields (unused parameter)
@return The chart o... | java | @GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/{chartId}")
@Description("Finds a chart, given its id.")
public ChartDto getChartByID(@Context HttpServletRequest req, @PathParam("chartId") BigInteger chartId,
@QueryParam("fields") List<String> fields) {
if (chartId == null || chartId.compareTo(BigInteger... | [
"@",
"GET",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"Path",
"(",
"\"/{chartId}\"",
")",
"@",
"Description",
"(",
"\"Finds a chart, given its id.\"",
")",
"public",
"ChartDto",
"getChartByID",
"(",
"@",
"Context",
"HttpServletRequest",
... | Find a chart, given its id.
@param req The HttpServlet request object. Cannot be null.
@param chartId The chart Id. Cannot be null and must be a positive non-zero number.
@param fields The fields (unused parameter)
@return The chart object.
@throws WebApplicationException An exception with 404 NOT_FO... | [
"Find",
"a",
"chart",
"given",
"its",
"id",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/ChartResources.java#L221-L249 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getImplodedNonEmpty | @Nonnull
public static String getImplodedNonEmpty (@Nullable final Iterable <String> aElements) {
"""
Get a concatenated String from all non-<code>null</code> and non empty
elements of the passed container without a separator string. This the very
generic version of {@link #getConcatenatedOnDemand(String, Stri... | java | @Nonnull
public static String getImplodedNonEmpty (@Nullable final Iterable <String> aElements)
{
return getImplodedMappedNonEmpty (aElements, Function.identity ());
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"getImplodedNonEmpty",
"(",
"@",
"Nullable",
"final",
"Iterable",
"<",
"String",
">",
"aElements",
")",
"{",
"return",
"getImplodedMappedNonEmpty",
"(",
"aElements",
",",
"Function",
".",
"identity",
"(",
")",
")",
... | Get a concatenated String from all non-<code>null</code> and non empty
elements of the passed container without a separator string. This the very
generic version of {@link #getConcatenatedOnDemand(String, String)} for an
arbitrary number of elements.
@param aElements
The container to convert. May be <code>null</code> ... | [
"Get",
"a",
"concatenated",
"String",
"from",
"all",
"non",
"-",
"<code",
">",
"null<",
"/",
"code",
">",
"and",
"non",
"empty",
"elements",
"of",
"the",
"passed",
"container",
"without",
"a",
"separator",
"string",
".",
"This",
"the",
"very",
"generic",
... | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L1483-L1487 |
Ellzord/JALSE | src/main/java/jalse/entities/Entities.java | Entities.asType | public static <T extends Entity> T asType(final Entity entity, final Class<T> type) {
"""
Wraps an Entity as the supplied Entity type. This is a convenience method for
{@link EntityProxyFactory#proxyOfEntity(Entity, Class)}.
@param entity
Entity to wrap.
@param type
Entity type to wrap to.
@return The wrap... | java | public static <T extends Entity> T asType(final Entity entity, final Class<T> type) {
return getProxyFactory().proxyOfEntity(entity, type);
} | [
"public",
"static",
"<",
"T",
"extends",
"Entity",
">",
"T",
"asType",
"(",
"final",
"Entity",
"entity",
",",
"final",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"getProxyFactory",
"(",
")",
".",
"proxyOfEntity",
"(",
"entity",
",",
"type",
")... | Wraps an Entity as the supplied Entity type. This is a convenience method for
{@link EntityProxyFactory#proxyOfEntity(Entity, Class)}.
@param entity
Entity to wrap.
@param type
Entity type to wrap to.
@return The wrapped Entity.
@see #getProxyFactory() | [
"Wraps",
"an",
"Entity",
"as",
"the",
"supplied",
"Entity",
"type",
".",
"This",
"is",
"a",
"convenience",
"method",
"for",
"{",
"@link",
"EntityProxyFactory#proxyOfEntity",
"(",
"Entity",
"Class",
")",
"}",
"."
] | train | https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/entities/Entities.java#L110-L112 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/context/configure/AbstractConfiguration.java | AbstractConfiguration.getPropertyValue | public String getPropertyValue(final String propertyName, final String defaultPropertyValue) {
"""
Gets the value of the configuration property identified by name. The defaultPropertyValue parameter effectively
overrides the required attribute indicating that the property is not required to be declared or define... | java | public String getPropertyValue(final String propertyName, final String defaultPropertyValue) {
return defaultIfUnset(getPropertyValue(propertyName, NOT_REQUIRED), defaultPropertyValue);
} | [
"public",
"String",
"getPropertyValue",
"(",
"final",
"String",
"propertyName",
",",
"final",
"String",
"defaultPropertyValue",
")",
"{",
"return",
"defaultIfUnset",
"(",
"getPropertyValue",
"(",
"propertyName",
",",
"NOT_REQUIRED",
")",
",",
"defaultPropertyValue",
"... | Gets the value of the configuration property identified by name. The defaultPropertyValue parameter effectively
overrides the required attribute indicating that the property is not required to be declared or defined.
@param propertyName a String value indicating the name of the configuration property.
@param defaultP... | [
"Gets",
"the",
"value",
"of",
"the",
"configuration",
"property",
"identified",
"by",
"name",
".",
"The",
"defaultPropertyValue",
"parameter",
"effectively",
"overrides",
"the",
"required",
"attribute",
"indicating",
"that",
"the",
"property",
"is",
"not",
"required... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/context/configure/AbstractConfiguration.java#L218-L220 |
fernandospr/javapns-jdk16 | src/main/java/javapns/devices/implementations/basic/BasicDeviceFactory.java | BasicDeviceFactory.addDevice | public Device addDevice(String id, String token) throws DuplicateDeviceException, NullIdException, NullDeviceTokenException, Exception {
"""
Add a device to the map
@param id The device id
@param token The device token
@throws DuplicateDeviceException
@throws NullIdException
@throws NullDeviceTokenException
... | java | public Device addDevice(String id, String token) throws DuplicateDeviceException, NullIdException, NullDeviceTokenException, Exception {
if ((id == null) || (id.trim().equals(""))) {
throw new NullIdException();
} else if ((token == null) || (token.trim().equals(""))) {
throw new NullDeviceTokenException(... | [
"public",
"Device",
"addDevice",
"(",
"String",
"id",
",",
"String",
"token",
")",
"throws",
"DuplicateDeviceException",
",",
"NullIdException",
",",
"NullDeviceTokenException",
",",
"Exception",
"{",
"if",
"(",
"(",
"id",
"==",
"null",
")",
"||",
"(",
"id",
... | Add a device to the map
@param id The device id
@param token The device token
@throws DuplicateDeviceException
@throws NullIdException
@throws NullDeviceTokenException | [
"Add",
"a",
"device",
"to",
"the",
"map"
] | train | https://github.com/fernandospr/javapns-jdk16/blob/84de6d9328ab01af92f77cc60c4554de02420909/src/main/java/javapns/devices/implementations/basic/BasicDeviceFactory.java#L47-L62 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/logging/internal/LoggerOnThread.java | LoggerOnThread.renameFile | private void renameFile(File source, File target) {
"""
Rename the source file into the target file, deleting the target if
necessary.
@param source
@param target
"""
if (!source.exists()) {
// don't do anything if the source file doesn't exist
return;
}
if ... | java | private void renameFile(File source, File target) {
if (!source.exists()) {
// don't do anything if the source file doesn't exist
return;
}
if (target.exists()) {
target.delete();
}
boolean rc = source.renameTo(target);
if (!rc) {
... | [
"private",
"void",
"renameFile",
"(",
"File",
"source",
",",
"File",
"target",
")",
"{",
"if",
"(",
"!",
"source",
".",
"exists",
"(",
")",
")",
"{",
"// don't do anything if the source file doesn't exist",
"return",
";",
"}",
"if",
"(",
"target",
".",
"exis... | Rename the source file into the target file, deleting the target if
necessary.
@param source
@param target | [
"Rename",
"the",
"source",
"file",
"into",
"the",
"target",
"file",
"deleting",
"the",
"target",
"if",
"necessary",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/logging/internal/LoggerOnThread.java#L347-L361 |
app55/app55-java | src/support/java/com/googlecode/openbeans/DefaultPersistenceDelegate.java | DefaultPersistenceDelegate.instantiate | @Override
protected Expression instantiate(Object oldInstance, Encoder enc) {
"""
Returns an expression that represents a call to the bean's constructor. The constructor may take zero or more parameters, as specified when this
<code>DefaultPersistenceDelegate</code> is constructed.
@param oldInstance
the old... | java | @Override
protected Expression instantiate(Object oldInstance, Encoder enc)
{
Object[] args = null;
// Set the constructor arguments if any property names exist
if (this.propertyNames.length > 0)
{
// Prepare the property descriptors for finding getter method later
BeanInfo info = null;
HashMap<Stri... | [
"@",
"Override",
"protected",
"Expression",
"instantiate",
"(",
"Object",
"oldInstance",
",",
"Encoder",
"enc",
")",
"{",
"Object",
"[",
"]",
"args",
"=",
"null",
";",
"// Set the constructor arguments if any property names exist",
"if",
"(",
"this",
".",
"propertyN... | Returns an expression that represents a call to the bean's constructor. The constructor may take zero or more parameters, as specified when this
<code>DefaultPersistenceDelegate</code> is constructed.
@param oldInstance
the old instance
@param enc
the encoder that wants to record the old instance
@return an expression... | [
"Returns",
"an",
"expression",
"that",
"represents",
"a",
"call",
"to",
"the",
"bean",
"s",
"constructor",
".",
"The",
"constructor",
"may",
"take",
"zero",
"or",
"more",
"parameters",
"as",
"specified",
"when",
"this",
"<code",
">",
"DefaultPersistenceDelegate<... | train | https://github.com/app55/app55-java/blob/73e51d0f3141a859dfbd37ca9becef98477e553e/src/support/java/com/googlecode/openbeans/DefaultPersistenceDelegate.java#L213-L258 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/cache/CacheUtil.java | CacheUtil.getPrefixedCacheName | public static String getPrefixedCacheName(String name, URI uri, ClassLoader classLoader) {
"""
Gets the cache name with prefix but without Hazelcast's {@link javax.cache.CacheManager}
specific prefix {@link com.hazelcast.cache.HazelcastCacheManager#CACHE_MANAGER_PREFIX}.
@param name the simple name of t... | java | public static String getPrefixedCacheName(String name, URI uri, ClassLoader classLoader) {
String cacheNamePrefix = getPrefix(uri, classLoader);
if (cacheNamePrefix != null) {
return cacheNamePrefix + name;
} else {
return name;
}
} | [
"public",
"static",
"String",
"getPrefixedCacheName",
"(",
"String",
"name",
",",
"URI",
"uri",
",",
"ClassLoader",
"classLoader",
")",
"{",
"String",
"cacheNamePrefix",
"=",
"getPrefix",
"(",
"uri",
",",
"classLoader",
")",
";",
"if",
"(",
"cacheNamePrefix",
... | Gets the cache name with prefix but without Hazelcast's {@link javax.cache.CacheManager}
specific prefix {@link com.hazelcast.cache.HazelcastCacheManager#CACHE_MANAGER_PREFIX}.
@param name the simple name of the cache without any prefix
@param uri an implementation specific URI for the
Hazelcast's {@lin... | [
"Gets",
"the",
"cache",
"name",
"with",
"prefix",
"but",
"without",
"Hazelcast",
"s",
"{",
"@link",
"javax",
".",
"cache",
".",
"CacheManager",
"}",
"specific",
"prefix",
"{",
"@link",
"com",
".",
"hazelcast",
".",
"cache",
".",
"HazelcastCacheManager#CACHE_MA... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cache/CacheUtil.java#L73-L80 |
radkovo/CSSBox | src/main/java/org/fit/cssbox/layout/VisualContext.java | VisualContext.ptLength | public double ptLength(TermLengthOrPercent spec, double whole) {
"""
Converts a length from a CSS length or percentage to 'pt'.
@param spec the CSS length specification
@param whole the value that corresponds to 100%. It is used only when spec is a percentage.
@return the length in 'pt'
"""
float nv... | java | public double ptLength(TermLengthOrPercent spec, double whole)
{
float nval = spec.getValue();
if (spec.isPercentage())
{
return (whole * nval) / 100;
}
else if (spec instanceof TermCalc)
{
final CalcArgs args = ((TermCalc) spec).getArgs();
... | [
"public",
"double",
"ptLength",
"(",
"TermLengthOrPercent",
"spec",
",",
"double",
"whole",
")",
"{",
"float",
"nval",
"=",
"spec",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"spec",
".",
"isPercentage",
"(",
")",
")",
"{",
"return",
"(",
"whole",
"*",... | Converts a length from a CSS length or percentage to 'pt'.
@param spec the CSS length specification
@param whole the value that corresponds to 100%. It is used only when spec is a percentage.
@return the length in 'pt' | [
"Converts",
"a",
"length",
"from",
"a",
"CSS",
"length",
"or",
"percentage",
"to",
"pt",
"."
] | train | https://github.com/radkovo/CSSBox/blob/38aaf8f22d233d7b4dbc12a56cdbc72b447bc559/src/main/java/org/fit/cssbox/layout/VisualContext.java#L434-L487 |
btrplace/scheduler | choco/src/main/java/org/btrplace/scheduler/choco/constraint/mttr/RandomVMPlacement.java | RandomVMPlacement.canStay | public int canStay(ReconfigurationProblem rp, VM vm) {
"""
Check if a VM can stay on its current node.
@param rp the reconfiguration problem.
@param vm the VM
@return {@code true} iff the VM can stay
"""
Mapping m = rp.getSourceModel().getMapping();
if (m.isRunning(vm)) {
Node ... | java | public int canStay(ReconfigurationProblem rp, VM vm) {
Mapping m = rp.getSourceModel().getMapping();
if (m.isRunning(vm)) {
Node n = m.getVMLocation(vm);
int curPos = nodeMap[n.id()];
if (actionMap[vm.id()].getDSlice().getHoster().contains(curPos)) {
r... | [
"public",
"int",
"canStay",
"(",
"ReconfigurationProblem",
"rp",
",",
"VM",
"vm",
")",
"{",
"Mapping",
"m",
"=",
"rp",
".",
"getSourceModel",
"(",
")",
".",
"getMapping",
"(",
")",
";",
"if",
"(",
"m",
".",
"isRunning",
"(",
"vm",
")",
")",
"{",
"N... | Check if a VM can stay on its current node.
@param rp the reconfiguration problem.
@param vm the VM
@return {@code true} iff the VM can stay | [
"Check",
"if",
"a",
"VM",
"can",
"stay",
"on",
"its",
"current",
"node",
"."
] | train | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/constraint/mttr/RandomVMPlacement.java#L178-L188 |
Azure/azure-sdk-for-java | servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java | ClientFactory.createMessageReceiverFromConnectionStringBuilder | public static IMessageReceiver createMessageReceiverFromConnectionStringBuilder(ConnectionStringBuilder amqpConnectionStringBuilder, ReceiveMode receiveMode) throws InterruptedException, ServiceBusException {
"""
Create {@link IMessageReceiver} from ConnectionStringBuilder
<pre>
IMessageReceiver messageReceiver ... | java | public static IMessageReceiver createMessageReceiverFromConnectionStringBuilder(ConnectionStringBuilder amqpConnectionStringBuilder, ReceiveMode receiveMode) throws InterruptedException, ServiceBusException {
return Utils.completeFuture(createMessageReceiverFromConnectionStringBuilderAsync(amqpConnectionStringB... | [
"public",
"static",
"IMessageReceiver",
"createMessageReceiverFromConnectionStringBuilder",
"(",
"ConnectionStringBuilder",
"amqpConnectionStringBuilder",
",",
"ReceiveMode",
"receiveMode",
")",
"throws",
"InterruptedException",
",",
"ServiceBusException",
"{",
"return",
"Utils",
... | Create {@link IMessageReceiver} from ConnectionStringBuilder
<pre>
IMessageReceiver messageReceiver = ClientFactory.createMessageReceiverFromConnectionStringBuilder(new ConnectionStringBuilder(connectionString, queueName), ReceiveMode.PEEKLOCK);
</pre>
@param amqpConnectionStringBuilder {@link ConnectionStringBuilder}... | [
"Create",
"{",
"@link",
"IMessageReceiver",
"}",
"from",
"ConnectionStringBuilder",
"<pre",
">",
"IMessageReceiver",
"messageReceiver",
"=",
"ClientFactory",
".",
"createMessageReceiverFromConnectionStringBuilder",
"(",
"new",
"ConnectionStringBuilder",
"(",
"connectionString",... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java#L268-L270 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/Request.java | Request.executeMeRequestAsync | @Deprecated
public static RequestAsyncTask executeMeRequestAsync(Session session, GraphUserCallback callback) {
"""
Starts a new Request configured to retrieve a user's own profile.
<p/>
This should only be called from the UI thread.
This method is deprecated. Prefer to call Request.newMeRequest(...).exec... | java | @Deprecated
public static RequestAsyncTask executeMeRequestAsync(Session session, GraphUserCallback callback) {
return newMeRequest(session, callback).executeAsync();
} | [
"@",
"Deprecated",
"public",
"static",
"RequestAsyncTask",
"executeMeRequestAsync",
"(",
"Session",
"session",
",",
"GraphUserCallback",
"callback",
")",
"{",
"return",
"newMeRequest",
"(",
"session",
",",
"callback",
")",
".",
"executeAsync",
"(",
")",
";",
"}"
] | Starts a new Request configured to retrieve a user's own profile.
<p/>
This should only be called from the UI thread.
This method is deprecated. Prefer to call Request.newMeRequest(...).executeAsync();
@param session
the Session to use, or null; if non-null, the session must be in an opened state
@param callback
a ca... | [
"Starts",
"a",
"new",
"Request",
"configured",
"to",
"retrieve",
"a",
"user",
"s",
"own",
"profile",
".",
"<p",
"/",
">",
"This",
"should",
"only",
"be",
"called",
"from",
"the",
"UI",
"thread",
"."
] | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/Request.java#L1115-L1118 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPersistenceImpl.java | CommerceOrderPersistenceImpl.countByG_U_O | @Override
public int countByG_U_O(long groupId, long userId, int orderStatus) {
"""
Returns the number of commerce orders where groupId = ? and userId = ? and orderStatus = ?.
@param groupId the group ID
@param userId the user ID
@param orderStatus the order status
@return the number of matching... | java | @Override
public int countByG_U_O(long groupId, long userId, int orderStatus) {
FinderPath finderPath = FINDER_PATH_COUNT_BY_G_U_O;
Object[] finderArgs = new Object[] { groupId, userId, orderStatus };
Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundl... | [
"@",
"Override",
"public",
"int",
"countByG_U_O",
"(",
"long",
"groupId",
",",
"long",
"userId",
",",
"int",
"orderStatus",
")",
"{",
"FinderPath",
"finderPath",
"=",
"FINDER_PATH_COUNT_BY_G_U_O",
";",
"Object",
"[",
"]",
"finderArgs",
"=",
"new",
"Object",
"[... | Returns the number of commerce orders where groupId = ? and userId = ? and orderStatus = ?.
@param groupId the group ID
@param userId the user ID
@param orderStatus the order status
@return the number of matching commerce orders | [
"Returns",
"the",
"number",
"of",
"commerce",
"orders",
"where",
"groupId",
"=",
"?",
";",
"and",
"userId",
"=",
"?",
";",
"and",
"orderStatus",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderPersistenceImpl.java#L4599-L4650 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/SingularOps_DDRM.java | SingularOps_DDRM.nullspaceSVD | public static DMatrixRMaj nullspaceSVD( DMatrixRMaj A , int totalSingular ) {
"""
Computes the null space using SVD. Slowest bust most stable way to find the solution
@param A (Input) Matrix
@param totalSingular Number of singular values
@return Null space
"""
SolveNullSpace<DMatrixRMaj> solver = ... | java | public static DMatrixRMaj nullspaceSVD( DMatrixRMaj A , int totalSingular ) {
SolveNullSpace<DMatrixRMaj> solver = new SolveNullSpaceSvd_DDRM();
DMatrixRMaj nullspace = new DMatrixRMaj(1,1);
if( !solver.process(A,totalSingular,nullspace))
throw new RuntimeException("Solver failed. ... | [
"public",
"static",
"DMatrixRMaj",
"nullspaceSVD",
"(",
"DMatrixRMaj",
"A",
",",
"int",
"totalSingular",
")",
"{",
"SolveNullSpace",
"<",
"DMatrixRMaj",
">",
"solver",
"=",
"new",
"SolveNullSpaceSvd_DDRM",
"(",
")",
";",
"DMatrixRMaj",
"nullspace",
"=",
"new",
"... | Computes the null space using SVD. Slowest bust most stable way to find the solution
@param A (Input) Matrix
@param totalSingular Number of singular values
@return Null space | [
"Computes",
"the",
"null",
"space",
"using",
"SVD",
".",
"Slowest",
"bust",
"most",
"stable",
"way",
"to",
"find",
"the",
"solution"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/SingularOps_DDRM.java#L470-L479 |
SUSE/salt-netapi-client | src/main/java/com/suse/salt/netapi/calls/LocalCall.java | LocalCall.callAsync | public CompletionStage<Optional<LocalAsyncResult<R>>> callAsync(final SaltClient client, Target<?> target,
AuthMethod auth) {
"""
Calls a execution module function on the given target asynchronously and
returns information about the scheduled job... | java | public CompletionStage<Optional<LocalAsyncResult<R>>> callAsync(final SaltClient client, Target<?> target,
AuthMethod auth) {
return callAsync(client, target, auth, Optional.empty());
} | [
"public",
"CompletionStage",
"<",
"Optional",
"<",
"LocalAsyncResult",
"<",
"R",
">",
">",
">",
"callAsync",
"(",
"final",
"SaltClient",
"client",
",",
"Target",
"<",
"?",
">",
"target",
",",
"AuthMethod",
"auth",
")",
"{",
"return",
"callAsync",
"(",
"cli... | Calls a execution module function on the given target asynchronously and
returns information about the scheduled job that can be used to query the result.
Authentication is done with the token therefore you have to login prior
to using this function.
@param client SaltClient instance
@param target the target for the f... | [
"Calls",
"a",
"execution",
"module",
"function",
"on",
"the",
"given",
"target",
"asynchronously",
"and",
"returns",
"information",
"about",
"the",
"scheduled",
"job",
"that",
"can",
"be",
"used",
"to",
"query",
"the",
"result",
".",
"Authentication",
"is",
"d... | train | https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/LocalCall.java#L176-L179 |
Netflix/spectator | spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/impl/Evaluator.java | Evaluator.addGroupSubscriptions | public Evaluator addGroupSubscriptions(String group, List<Subscription> subs) {
"""
Add subscriptions for a given group.
@param group
Name of the group. At Netflix this is typically the cluster that includes
the instance reporting data.
@param subs
Set of subscriptions for the group.
@return
This instance... | java | public Evaluator addGroupSubscriptions(String group, List<Subscription> subs) {
List<Subscription> oldSubs = subscriptions.put(group, subs);
if (oldSubs == null) {
LOGGER.debug("added group {} with {} subscriptions", group, subs.size());
} else {
LOGGER.debug("updated group {}, {} subscriptions ... | [
"public",
"Evaluator",
"addGroupSubscriptions",
"(",
"String",
"group",
",",
"List",
"<",
"Subscription",
">",
"subs",
")",
"{",
"List",
"<",
"Subscription",
">",
"oldSubs",
"=",
"subscriptions",
".",
"put",
"(",
"group",
",",
"subs",
")",
";",
"if",
"(",
... | Add subscriptions for a given group.
@param group
Name of the group. At Netflix this is typically the cluster that includes
the instance reporting data.
@param subs
Set of subscriptions for the group.
@return
This instance for chaining of update operations. | [
"Add",
"subscriptions",
"for",
"a",
"given",
"group",
"."
] | train | https://github.com/Netflix/spectator/blob/259318252770de3bad581b85adff187d8f2c6537/spectator-reg-atlas/src/main/java/com/netflix/spectator/atlas/impl/Evaluator.java#L69-L78 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/util/CalendarUtil.java | CalendarUtil.addDays | public XMLGregorianCalendar addDays(final XMLGregorianCalendar cal, final int amount) {
"""
Add Days to a Gregorian Calendar.
@param cal The XMLGregorianCalendar source
@param amount The amount of days. Can be a negative Integer to substract.
@return A XMLGregorianCalendar with the new Date
"""
XM... | java | public XMLGregorianCalendar addDays(final XMLGregorianCalendar cal, final int amount) {
XMLGregorianCalendar to = buildXMLGregorianCalendarDate(cal);
// Add amount of months
to.add(addDays(amount));
return to;
} | [
"public",
"XMLGregorianCalendar",
"addDays",
"(",
"final",
"XMLGregorianCalendar",
"cal",
",",
"final",
"int",
"amount",
")",
"{",
"XMLGregorianCalendar",
"to",
"=",
"buildXMLGregorianCalendarDate",
"(",
"cal",
")",
";",
"// Add amount of months",
"to",
".",
"add",
... | Add Days to a Gregorian Calendar.
@param cal The XMLGregorianCalendar source
@param amount The amount of days. Can be a negative Integer to substract.
@return A XMLGregorianCalendar with the new Date | [
"Add",
"Days",
"to",
"a",
"Gregorian",
"Calendar",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/CalendarUtil.java#L33-L38 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/hash/MurmurHash3Adaptor.java | MurmurHash3Adaptor.hashToBytes | public static byte[] hashToBytes(final String datum, final long seed) {
"""
Hash a String and long seed.
@param datum the input String
@param seed A long valued seed.
@return The 128-bit hash as a byte[16] in Big Endian order from 2 64-bit longs.
"""
if ((datum == null) || datum.isEmpty()) {
ret... | java | public static byte[] hashToBytes(final String datum, final long seed) {
if ((datum == null) || datum.isEmpty()) {
return null;
}
final byte[] data = datum.getBytes(UTF_8);
return toByteArray(hash(data, seed));
} | [
"public",
"static",
"byte",
"[",
"]",
"hashToBytes",
"(",
"final",
"String",
"datum",
",",
"final",
"long",
"seed",
")",
"{",
"if",
"(",
"(",
"datum",
"==",
"null",
")",
"||",
"datum",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",... | Hash a String and long seed.
@param datum the input String
@param seed A long valued seed.
@return The 128-bit hash as a byte[16] in Big Endian order from 2 64-bit longs. | [
"Hash",
"a",
"String",
"and",
"long",
"seed",
"."
] | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hash/MurmurHash3Adaptor.java#L125-L131 |
javamonkey/beetl2.0 | beetl-core/src/main/java/org/beetl/core/om/ObjectUtil.java | ObjectUtil.getGetMethod | public static Method getGetMethod(Class c, String methodName, Class... paras) {
"""
获取对象的某个方法,如果无此方法,则仅仅返回null
@param c 对象
@param methodName 方法名
@param paras 参数列表
@return
"""
//需要优化
try
{
Method m = c.getMethod(methodName, paras);
m.setAccessible(true);
return m;
}
catch (Sec... | java | public static Method getGetMethod(Class c, String methodName, Class... paras)
{
//需要优化
try
{
Method m = c.getMethod(methodName, paras);
m.setAccessible(true);
return m;
}
catch (SecurityException e)
{
return null;
}
catch (NoSuchMethodException e)
{
return null;
}... | [
"public",
"static",
"Method",
"getGetMethod",
"(",
"Class",
"c",
",",
"String",
"methodName",
",",
"Class",
"...",
"paras",
")",
"{",
"//需要优化\r",
"try",
"{",
"Method",
"m",
"=",
"c",
".",
"getMethod",
"(",
"methodName",
",",
"paras",
")",
";",
"m",
"."... | 获取对象的某个方法,如果无此方法,则仅仅返回null
@param c 对象
@param methodName 方法名
@param paras 参数列表
@return | [
"获取对象的某个方法,如果无此方法,则仅仅返回null"
] | train | https://github.com/javamonkey/beetl2.0/blob/f32f729ad238079df5aca6e38a3c3ba0a55c78d6/beetl-core/src/main/java/org/beetl/core/om/ObjectUtil.java#L253-L272 |
Lucas3oo/jicunit | src/jicunit-framework/src/main/java/org/jicunit/framework/internal/JicUnitServletClient.java | JicUnitServletClient.runAtServer | public Document runAtServer(String containerUrl, String testClassName, String testDisplayName) {
"""
Execute the test at the server
@param containerUrl
@param testClassName
@param testDisplayName
@return
"""
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder bu... | java | public Document runAtServer(String containerUrl, String testClassName, String testDisplayName) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder;
try {
String url = containerUrl
+ String.format("?%s=%s&%s=%s", TEST_CLASS_NAME_PARAM, testClassNam... | [
"public",
"Document",
"runAtServer",
"(",
"String",
"containerUrl",
",",
"String",
"testClassName",
",",
"String",
"testDisplayName",
")",
"{",
"DocumentBuilderFactory",
"factory",
"=",
"DocumentBuilderFactory",
".",
"newInstance",
"(",
")",
";",
"DocumentBuilder",
"b... | Execute the test at the server
@param containerUrl
@param testClassName
@param testDisplayName
@return | [
"Execute",
"the",
"test",
"at",
"the",
"server"
] | train | https://github.com/Lucas3oo/jicunit/blob/1ed41891ccf8e5c6068c6b544d214280bb93945b/src/jicunit-framework/src/main/java/org/jicunit/framework/internal/JicUnitServletClient.java#L44-L61 |
weld/core | modules/jsf/src/main/java/org/jboss/weld/module/jsf/ConversationAwareViewHandler.java | ConversationAwareViewHandler.getActionURL | @Override
public String getActionURL(FacesContext facesContext, String viewId) {
"""
Allow the delegate to produce the action URL. If the conversation is
long-running, append the conversation id request parameter to the query
string part of the URL, but only if the request parameter is not already
present.
... | java | @Override
public String getActionURL(FacesContext facesContext, String viewId) {
if (contextId == null) {
if (facesContext.getAttributes().containsKey(Container.CONTEXT_ID_KEY)) {
contextId = (String) facesContext.getAttributes().get(Container.CONTEXT_ID_KEY);
} else ... | [
"@",
"Override",
"public",
"String",
"getActionURL",
"(",
"FacesContext",
"facesContext",
",",
"String",
"viewId",
")",
"{",
"if",
"(",
"contextId",
"==",
"null",
")",
"{",
"if",
"(",
"facesContext",
".",
"getAttributes",
"(",
")",
".",
"containsKey",
"(",
... | Allow the delegate to produce the action URL. If the conversation is
long-running, append the conversation id request parameter to the query
string part of the URL, but only if the request parameter is not already
present.
<p/>
This covers form actions Ajax calls, and redirect URLs (which we want) and
link hrefs (which... | [
"Allow",
"the",
"delegate",
"to",
"produce",
"the",
"action",
"URL",
".",
"If",
"the",
"conversation",
"is",
"long",
"-",
"running",
"append",
"the",
"conversation",
"id",
"request",
"parameter",
"to",
"the",
"query",
"string",
"part",
"of",
"the",
"URL",
... | train | https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/modules/jsf/src/main/java/org/jboss/weld/module/jsf/ConversationAwareViewHandler.java#L103-L121 |
linkedin/dexmaker | dexmaker/src/main/java/com/android/dx/Code.java | Code.iget | public <D, V> void iget(FieldId<D, ? extends V> fieldId, Local<V> target, Local<D> instance) {
"""
Copies the value in instance field {@code fieldId} of {@code instance} to
{@code target}.
"""
addInstruction(new ThrowingCstInsn(Rops.opGetField(target.type.ropType), sourcePosition,
Regi... | java | public <D, V> void iget(FieldId<D, ? extends V> fieldId, Local<V> target, Local<D> instance) {
addInstruction(new ThrowingCstInsn(Rops.opGetField(target.type.ropType), sourcePosition,
RegisterSpecList.make(instance.spec()), catches, fieldId.constant));
moveResult(target, true);
} | [
"public",
"<",
"D",
",",
"V",
">",
"void",
"iget",
"(",
"FieldId",
"<",
"D",
",",
"?",
"extends",
"V",
">",
"fieldId",
",",
"Local",
"<",
"V",
">",
"target",
",",
"Local",
"<",
"D",
">",
"instance",
")",
"{",
"addInstruction",
"(",
"new",
"Throwi... | Copies the value in instance field {@code fieldId} of {@code instance} to
{@code target}. | [
"Copies",
"the",
"value",
"in",
"instance",
"field",
"{"
] | train | https://github.com/linkedin/dexmaker/blob/c58ffebcbb2564c7d1fa6fb58b48f351c330296d/dexmaker/src/main/java/com/android/dx/Code.java#L590-L594 |
JOML-CI/JOML | src/org/joml/Matrix4f.java | Matrix4f.rotateAffineYXZ | public Matrix4f rotateAffineYXZ(float angleY, float angleX, float angleZ) {
"""
Apply rotation of <code>angleY</code> radians about the Y axis, followed by a rotation of <code>angleX</code> radians about the X axis and
followed by a rotation of <code>angleZ</code> radians about the Z axis.
<p>
When used with a ... | java | public Matrix4f rotateAffineYXZ(float angleY, float angleX, float angleZ) {
return rotateAffineYXZ(angleY, angleX, angleZ, thisOrNew());
} | [
"public",
"Matrix4f",
"rotateAffineYXZ",
"(",
"float",
"angleY",
",",
"float",
"angleX",
",",
"float",
"angleZ",
")",
"{",
"return",
"rotateAffineYXZ",
"(",
"angleY",
",",
"angleX",
",",
"angleZ",
",",
"thisOrNew",
"(",
")",
")",
";",
"}"
] | Apply rotation of <code>angleY</code> radians about the Y axis, followed by a rotation of <code>angleX</code> radians about the X axis and
followed by a rotation of <code>angleZ</code> radians about the Z axis.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clock... | [
"Apply",
"rotation",
"of",
"<code",
">",
"angleY<",
"/",
"code",
">",
"radians",
"about",
"the",
"Y",
"axis",
"followed",
"by",
"a",
"rotation",
"of",
"<code",
">",
"angleX<",
"/",
"code",
">",
"radians",
"about",
"the",
"X",
"axis",
"and",
"followed",
... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L5759-L5761 |
ggrandes/packer | src/main/java/org/javastack/packer/Packer.java | Packer.loadStringHex | public Packer loadStringHex(final String in) throws InvalidInputDataException {
"""
Load string in hex format
@return
@throws InvalidInputDataException
@throws ParseException
@see #outputStringHex()
"""
try {
return loadBytes(fromHex(in));
} catch (ParseException e) {
throw new IllegalArgumentE... | java | public Packer loadStringHex(final String in) throws InvalidInputDataException {
try {
return loadBytes(fromHex(in));
} catch (ParseException e) {
throw new IllegalArgumentException("Invalid input string", e);
}
} | [
"public",
"Packer",
"loadStringHex",
"(",
"final",
"String",
"in",
")",
"throws",
"InvalidInputDataException",
"{",
"try",
"{",
"return",
"loadBytes",
"(",
"fromHex",
"(",
"in",
")",
")",
";",
"}",
"catch",
"(",
"ParseException",
"e",
")",
"{",
"throw",
"n... | Load string in hex format
@return
@throws InvalidInputDataException
@throws ParseException
@see #outputStringHex() | [
"Load",
"string",
"in",
"hex",
"format"
] | train | https://github.com/ggrandes/packer/blob/0b37b286a3d0555050eb2e65419dd74f8d8d3e78/src/main/java/org/javastack/packer/Packer.java#L1266-L1272 |
google/closure-templates | java/src/com/google/template/soy/SoyFileSet.java | SoyFileSet.compileTemplates | public SoySauce compileTemplates(Map<String, Supplier<Object>> pluginInstances) {
"""
Compiles this Soy file set into a set of java classes implementing the {@link SoySauce}
interface.
<p>This is useful for implementing 'edit refresh' workflows. Most production usecases should
use the command line interface t... | java | public SoySauce compileTemplates(Map<String, Supplier<Object>> pluginInstances) {
resetErrorReporter();
disallowExternalCalls();
ServerCompilationPrimitives primitives = compileForServerRendering();
throwIfErrorsPresent();
SoySauce sauce = doCompileSoySauce(primitives, pluginInstances);
reportW... | [
"public",
"SoySauce",
"compileTemplates",
"(",
"Map",
"<",
"String",
",",
"Supplier",
"<",
"Object",
">",
">",
"pluginInstances",
")",
"{",
"resetErrorReporter",
"(",
")",
";",
"disallowExternalCalls",
"(",
")",
";",
"ServerCompilationPrimitives",
"primitives",
"=... | Compiles this Soy file set into a set of java classes implementing the {@link SoySauce}
interface.
<p>This is useful for implementing 'edit refresh' workflows. Most production usecases should
use the command line interface to 'ahead of time' compile templates to jar files and then use
{@code PrecompiledSoyModule} or {... | [
"Compiles",
"this",
"Soy",
"file",
"set",
"into",
"a",
"set",
"of",
"java",
"classes",
"implementing",
"the",
"{",
"@link",
"SoySauce",
"}",
"interface",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/SoyFileSet.java#L789-L798 |
ldapchai/ldapchai | src/main/java/com/novell/ldapchai/util/SearchHelper.java | SearchHelper.setFilterExists | public void setFilterExists( final Set<String> attributeNames ) {
"""
Set up an exists filter for attribute name. Consider the following example.
<table border="1"><caption>Example Values</caption>
<tr><td><b>Value</b></td></tr>
<tr><td>givenName</td></tr>
<tr><td>sn</td></tr>
</table>
<p><i>Result</i></p... | java | public void setFilterExists( final Set<String> attributeNames )
{
final StringBuilder sb = new StringBuilder();
sb.append( "(&" );
for ( final String name : attributeNames )
{
sb.append( "(" );
sb.append( new FilterSequence( name, "*", FilterSequence.Matching... | [
"public",
"void",
"setFilterExists",
"(",
"final",
"Set",
"<",
"String",
">",
"attributeNames",
")",
"{",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"(&\"",
")",
";",
"for",
"(",
"final",
"Stri... | Set up an exists filter for attribute name. Consider the following example.
<table border="1"><caption>Example Values</caption>
<tr><td><b>Value</b></td></tr>
<tr><td>givenName</td></tr>
<tr><td>sn</td></tr>
</table>
<p><i>Result</i></p>
<code>(&(givenName=*)(sn=*))</code>
@param attributeNames A valid set of at... | [
"Set",
"up",
"an",
"exists",
"filter",
"for",
"attribute",
"name",
".",
"Consider",
"the",
"following",
"example",
"."
] | train | https://github.com/ldapchai/ldapchai/blob/a6d4b5dbfa4e270db0ce70892512cbe39e64b874/src/main/java/com/novell/ldapchai/util/SearchHelper.java#L545-L560 |
PunchThrough/bean-sdk-android | sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java | OADProfile.onNotificationBlock | private void onNotificationBlock(BluetoothGattCharacteristic characteristic) {
"""
Received a notification on Block characteristic
A notification to this characteristic means the Bean has accepted the most recent
firmware file we have offered, which is stored as `this.currentImage`. It is now
time to start se... | java | private void onNotificationBlock(BluetoothGattCharacteristic characteristic) {
int requestedBlock = Convert.twoBytesToInt(characteristic.getValue(), Constants.CC2540_BYTE_ORDER);
// Check for First block
if (requestedBlock == 0) {
Log.i(TAG, String.format("Image accepted (Name: %s)... | [
"private",
"void",
"onNotificationBlock",
"(",
"BluetoothGattCharacteristic",
"characteristic",
")",
"{",
"int",
"requestedBlock",
"=",
"Convert",
".",
"twoBytesToInt",
"(",
"characteristic",
".",
"getValue",
"(",
")",
",",
"Constants",
".",
"CC2540_BYTE_ORDER",
")",
... | Received a notification on Block characteristic
A notification to this characteristic means the Bean has accepted the most recent
firmware file we have offered, which is stored as `this.currentImage`. It is now
time to start sending blocks of FW to the device.
@param characteristic BLE characteristic with a value equ... | [
"Received",
"a",
"notification",
"on",
"Block",
"characteristic"
] | train | https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/internal/upload/firmware/OADProfile.java#L191-L230 |
aol/cyclops | cyclops/src/main/java/com/oath/cyclops/util/box/MutableFloat.java | MutableFloat.fromExternal | public static MutableFloat fromExternal(final Supplier<Float> s, final Consumer<Float> c) {
"""
Construct a MutableFloat that gets and sets an external value using the provided Supplier and Consumer
e.g.
<pre>
{@code
MutableFloat mutable = MutableFloat.fromExternal(()->!this.value,val->!this.value);
}
</pr... | java | public static MutableFloat fromExternal(final Supplier<Float> s, final Consumer<Float> c) {
return new MutableFloat() {
@Override
public float getAsFloat() {
return s.get();
}
@Override
public Float get() {
return getAs... | [
"public",
"static",
"MutableFloat",
"fromExternal",
"(",
"final",
"Supplier",
"<",
"Float",
">",
"s",
",",
"final",
"Consumer",
"<",
"Float",
">",
"c",
")",
"{",
"return",
"new",
"MutableFloat",
"(",
")",
"{",
"@",
"Override",
"public",
"float",
"getAsFloa... | Construct a MutableFloat that gets and sets an external value using the provided Supplier and Consumer
e.g.
<pre>
{@code
MutableFloat mutable = MutableFloat.fromExternal(()->!this.value,val->!this.value);
}
</pre>
@param s Supplier of an external value
@param c Consumer that sets an external value
@return MutableFlo... | [
"Construct",
"a",
"MutableFloat",
"that",
"gets",
"and",
"sets",
"an",
"external",
"value",
"using",
"the",
"provided",
"Supplier",
"and",
"Consumer"
] | train | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/com/oath/cyclops/util/box/MutableFloat.java#L80-L98 |
hal/elemento | core/src/main/java/org/jboss/gwt/elemento/core/Elements.java | Elements.onDetach | public static void onDetach(HTMLElement element, ObserverCallback callback) {
"""
Registers a callback when an element is removed from the document body. Note that the callback will be called
only once, if the element is removed and re-appended a new callback should be registered.
@param element the HTML elem... | java | public static void onDetach(HTMLElement element, ObserverCallback callback) {
if (element != null) {
BodyObserver.addDetachObserver(element, callback);
}
} | [
"public",
"static",
"void",
"onDetach",
"(",
"HTMLElement",
"element",
",",
"ObserverCallback",
"callback",
")",
"{",
"if",
"(",
"element",
"!=",
"null",
")",
"{",
"BodyObserver",
".",
"addDetachObserver",
"(",
"element",
",",
"callback",
")",
";",
"}",
"}"
... | Registers a callback when an element is removed from the document body. Note that the callback will be called
only once, if the element is removed and re-appended a new callback should be registered.
@param element the HTML element which is going to be removed from the body
@param callback {@link ObserverCallback} | [
"Registers",
"a",
"callback",
"when",
"an",
"element",
"is",
"removed",
"from",
"the",
"document",
"body",
".",
"Note",
"that",
"the",
"callback",
"will",
"be",
"called",
"only",
"once",
"if",
"the",
"element",
"is",
"removed",
"and",
"re",
"-",
"appended"... | train | https://github.com/hal/elemento/blob/26da2d5a1fe2ec55b779737dbaeda25a942eee61/core/src/main/java/org/jboss/gwt/elemento/core/Elements.java#L755-L759 |
czyzby/gdx-lml | websocket/src/main/java/com/github/czyzby/websocket/impl/AbstractWebSocket.java | AbstractWebSocket.postCloseEvent | protected void postCloseEvent(final WebSocketCloseCode closeCode, final String reason) {
"""
Listeners will be notified about socket closing.
@param closeCode closing code.
@param reason optional closing reason.
"""
for (final WebSocketListener listener : listeners) {
if (listener.onClo... | java | protected void postCloseEvent(final WebSocketCloseCode closeCode, final String reason) {
for (final WebSocketListener listener : listeners) {
if (listener.onClose(this, closeCode, reason)) {
break;
}
}
} | [
"protected",
"void",
"postCloseEvent",
"(",
"final",
"WebSocketCloseCode",
"closeCode",
",",
"final",
"String",
"reason",
")",
"{",
"for",
"(",
"final",
"WebSocketListener",
"listener",
":",
"listeners",
")",
"{",
"if",
"(",
"listener",
".",
"onClose",
"(",
"t... | Listeners will be notified about socket closing.
@param closeCode closing code.
@param reason optional closing reason. | [
"Listeners",
"will",
"be",
"notified",
"about",
"socket",
"closing",
"."
] | train | https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/websocket/src/main/java/com/github/czyzby/websocket/impl/AbstractWebSocket.java#L74-L80 |
VoltDB/voltdb | src/frontend/org/voltdb/expressions/ComparisonExpression.java | ComparisonExpression.getLtFilterFromPrefixLike | public ComparisonExpression getLtFilterFromPrefixLike() {
"""
/ Construct the upper bound comparison filter implied by a prefix LIKE comparison.
"""
ExpressionType rangeComparator = ExpressionType.COMPARE_LESSTHAN;
String comparand = extractAndIncrementLikePatternPrefix();
return rangeF... | java | public ComparisonExpression getLtFilterFromPrefixLike() {
ExpressionType rangeComparator = ExpressionType.COMPARE_LESSTHAN;
String comparand = extractAndIncrementLikePatternPrefix();
return rangeFilterFromPrefixLike(m_left, rangeComparator, comparand);
} | [
"public",
"ComparisonExpression",
"getLtFilterFromPrefixLike",
"(",
")",
"{",
"ExpressionType",
"rangeComparator",
"=",
"ExpressionType",
".",
"COMPARE_LESSTHAN",
";",
"String",
"comparand",
"=",
"extractAndIncrementLikePatternPrefix",
"(",
")",
";",
"return",
"rangeFilterF... | / Construct the upper bound comparison filter implied by a prefix LIKE comparison. | [
"/",
"Construct",
"the",
"upper",
"bound",
"comparison",
"filter",
"implied",
"by",
"a",
"prefix",
"LIKE",
"comparison",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/expressions/ComparisonExpression.java#L196-L200 |
strator-dev/greenpepper | samples-application/src/main/java/com/greenpepper/samples/application/system/AccountManager.java | AccountManager.insertGroup | public boolean insertGroup(String name) {
"""
<p>insertGroup.</p>
@param name a {@link java.lang.String} object.
@return a boolean.
"""
if (isGroupExist(name))
{
throw new SystemException(String.format("Group '%s' already exist.", name));
}
return allGroups.add(name);
} | java | public boolean insertGroup(String name)
{
if (isGroupExist(name))
{
throw new SystemException(String.format("Group '%s' already exist.", name));
}
return allGroups.add(name);
} | [
"public",
"boolean",
"insertGroup",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"isGroupExist",
"(",
"name",
")",
")",
"{",
"throw",
"new",
"SystemException",
"(",
"String",
".",
"format",
"(",
"\"Group '%s' already exist.\"",
",",
"name",
")",
")",
";",
"... | <p>insertGroup.</p>
@param name a {@link java.lang.String} object.
@return a boolean. | [
"<p",
">",
"insertGroup",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/samples-application/src/main/java/com/greenpepper/samples/application/system/AccountManager.java#L63-L71 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuDeviceCanAccessPeer | public static int cuDeviceCanAccessPeer(int canAccessPeer[], CUdevice dev, CUdevice peerDev) {
"""
Queries if a device may directly access a peer device's memory.
<pre>
CUresult cuDeviceCanAccessPeer (
int* canAccessPeer,
CUdevice dev,
CUdevice peerDev )
</pre>
<div>
<p>Queries if a device may directly a... | java | public static int cuDeviceCanAccessPeer(int canAccessPeer[], CUdevice dev, CUdevice peerDev)
{
return checkResult(cuDeviceCanAccessPeerNative(canAccessPeer, dev, peerDev));
} | [
"public",
"static",
"int",
"cuDeviceCanAccessPeer",
"(",
"int",
"canAccessPeer",
"[",
"]",
",",
"CUdevice",
"dev",
",",
"CUdevice",
"peerDev",
")",
"{",
"return",
"checkResult",
"(",
"cuDeviceCanAccessPeerNative",
"(",
"canAccessPeer",
",",
"dev",
",",
"peerDev",
... | Queries if a device may directly access a peer device's memory.
<pre>
CUresult cuDeviceCanAccessPeer (
int* canAccessPeer,
CUdevice dev,
CUdevice peerDev )
</pre>
<div>
<p>Queries if a device may directly access
a peer device's memory. Returns in <tt>*canAccessPeer</tt> a value
of 1 if contexts on <tt>dev</tt> are ca... | [
"Queries",
"if",
"a",
"device",
"may",
"directly",
"access",
"a",
"peer",
"device",
"s",
"memory",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L11538-L11541 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java | PDBFileParser.isKnownChain | private static Chain isKnownChain(String chainID, List<Chain> chains) {
"""
Finds in the given list of chains the first one that has as name the given chainID.
If no such Chain can be found it returns null.
"""
for (int i = 0; i< chains.size();i++){
Chain testchain = chains.get(i);
if (chainID.equal... | java | private static Chain isKnownChain(String chainID, List<Chain> chains){
for (int i = 0; i< chains.size();i++){
Chain testchain = chains.get(i);
if (chainID.equals(testchain.getName())) {
return testchain;
}
}
return null;
} | [
"private",
"static",
"Chain",
"isKnownChain",
"(",
"String",
"chainID",
",",
"List",
"<",
"Chain",
">",
"chains",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"chains",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"Chain",
"test... | Finds in the given list of chains the first one that has as name the given chainID.
If no such Chain can be found it returns null. | [
"Finds",
"in",
"the",
"given",
"list",
"of",
"chains",
"the",
"first",
"one",
"that",
"has",
"as",
"name",
"the",
"given",
"chainID",
".",
"If",
"no",
"such",
"Chain",
"can",
"be",
"found",
"it",
"returns",
"null",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java#L2514-L2524 |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/Sphere3d.java | Sphere3d.setCenterProperties | public void setCenterProperties(DoubleProperty x, DoubleProperty y, DoubleProperty z) {
"""
Set the center properties with the properties in parameter.
@param x
@param y
@param z
"""
this.cxProperty = x;
this.cyProperty = y;
this.czProperty = z;
} | java | public void setCenterProperties(DoubleProperty x, DoubleProperty y, DoubleProperty z) {
this.cxProperty = x;
this.cyProperty = y;
this.czProperty = z;
} | [
"public",
"void",
"setCenterProperties",
"(",
"DoubleProperty",
"x",
",",
"DoubleProperty",
"y",
",",
"DoubleProperty",
"z",
")",
"{",
"this",
".",
"cxProperty",
"=",
"x",
";",
"this",
".",
"cyProperty",
"=",
"y",
";",
"this",
".",
"czProperty",
"=",
"z",
... | Set the center properties with the properties in parameter.
@param x
@param y
@param z | [
"Set",
"the",
"center",
"properties",
"with",
"the",
"properties",
"in",
"parameter",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Sphere3d.java#L238-L242 |
deephacks/confit | core/src/main/java/org/deephacks/confit/internal/core/property/typesafe/impl/AbstractConfigObject.java | AbstractConfigObject.peekPath | AbstractConfigValue peekPath(Path path) {
"""
Looks up the path. Doesn't do any resolution, will throw if any is
needed.
"""
try {
return peekPath(this, path, null);
} catch (NotPossibleToResolve e) {
throw new BugOrBroken(
"NotPossibleToResolve happ... | java | AbstractConfigValue peekPath(Path path) {
try {
return peekPath(this, path, null);
} catch (NotPossibleToResolve e) {
throw new BugOrBroken(
"NotPossibleToResolve happened though we had no ResolveContext in peekPath");
}
} | [
"AbstractConfigValue",
"peekPath",
"(",
"Path",
"path",
")",
"{",
"try",
"{",
"return",
"peekPath",
"(",
"this",
",",
"path",
",",
"null",
")",
";",
"}",
"catch",
"(",
"NotPossibleToResolve",
"e",
")",
"{",
"throw",
"new",
"BugOrBroken",
"(",
"\"NotPossibl... | Looks up the path. Doesn't do any resolution, will throw if any is
needed. | [
"Looks",
"up",
"the",
"path",
".",
"Doesn",
"t",
"do",
"any",
"resolution",
"will",
"throw",
"if",
"any",
"is",
"needed",
"."
] | train | https://github.com/deephacks/confit/blob/4e6d4ee5fed32cbc5104433e61de1bcf1b360832/core/src/main/java/org/deephacks/confit/internal/core/property/typesafe/impl/AbstractConfigObject.java#L103-L110 |
mfornos/humanize | humanize-slim/src/main/java/humanize/Humanize.java | Humanize.pluralizeFormat | public static MessageFormat pluralizeFormat(final String pattern, final String... choices) {
"""
<p>
Constructs a message with pluralization logic by the means of
ChoiceFormat.
</p>
@param pattern
Base pattern
@param choices
Values that match the pattern
@return Message instance prepared to generate plur... | java | public static MessageFormat pluralizeFormat(final String pattern, final String... choices)
{
double[] indexes = new double[choices.length];
for (int i = 0; i < choices.length; i++)
{
indexes[i] = i;
}
ChoiceFormat choiceForm = new ChoiceFormat(indexes, choices);... | [
"public",
"static",
"MessageFormat",
"pluralizeFormat",
"(",
"final",
"String",
"pattern",
",",
"final",
"String",
"...",
"choices",
")",
"{",
"double",
"[",
"]",
"indexes",
"=",
"new",
"double",
"[",
"choices",
".",
"length",
"]",
";",
"for",
"(",
"int",
... | <p>
Constructs a message with pluralization logic by the means of
ChoiceFormat.
</p>
@param pattern
Base pattern
@param choices
Values that match the pattern
@return Message instance prepared to generate pluralized strings | [
"<p",
">",
"Constructs",
"a",
"message",
"with",
"pluralization",
"logic",
"by",
"the",
"means",
"of",
"ChoiceFormat",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-slim/src/main/java/humanize/Humanize.java#L2430-L2444 |
WiQuery/wiquery | wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/tabs/Tabs.java | Tabs.setAjaxBeforeLoadEvent | public Tabs setAjaxBeforeLoadEvent(ITabsAjaxEvent beforeLoadEvent) {
"""
Sets the call-back for the AJAX beforeLoad event.
@param beforeLoadEvent
The ITabsAjaxEvent.
"""
this.ajaxEvents.put(TabEvent.beforeLoad, beforeLoadEvent);
setBeforeLoadEvent(new TabsAjaxJsScopeUiEvent(this, TabEvent.beforeLoad));... | java | public Tabs setAjaxBeforeLoadEvent(ITabsAjaxEvent beforeLoadEvent)
{
this.ajaxEvents.put(TabEvent.beforeLoad, beforeLoadEvent);
setBeforeLoadEvent(new TabsAjaxJsScopeUiEvent(this, TabEvent.beforeLoad));
return this;
} | [
"public",
"Tabs",
"setAjaxBeforeLoadEvent",
"(",
"ITabsAjaxEvent",
"beforeLoadEvent",
")",
"{",
"this",
".",
"ajaxEvents",
".",
"put",
"(",
"TabEvent",
".",
"beforeLoad",
",",
"beforeLoadEvent",
")",
";",
"setBeforeLoadEvent",
"(",
"new",
"TabsAjaxJsScopeUiEvent",
"... | Sets the call-back for the AJAX beforeLoad event.
@param beforeLoadEvent
The ITabsAjaxEvent. | [
"Sets",
"the",
"call",
"-",
"back",
"for",
"the",
"AJAX",
"beforeLoad",
"event",
"."
] | train | https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/tabs/Tabs.java#L564-L569 |
infinispan/infinispan | server/integration/commons/src/main/java/org/infinispan/server/commons/features/Feature.java | Feature.isAvailableOrThrowException | public static void isAvailableOrThrowException(Features features, String feature) {
"""
If the specified feature is not available throw a {@link org.infinispan.commons.CacheConfigurationException}.
@param features existing instance.
@param feature the feature string to check.
@throws NullPointerException if eit... | java | public static void isAvailableOrThrowException(Features features, String feature) {
Objects.requireNonNull(features, feature);
if (!features.isAvailable(feature)) {
throw LogFactory.getLog(MethodHandles.lookup().lookupClass()).featureDisabled(feature);
}
} | [
"public",
"static",
"void",
"isAvailableOrThrowException",
"(",
"Features",
"features",
",",
"String",
"feature",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"features",
",",
"feature",
")",
";",
"if",
"(",
"!",
"features",
".",
"isAvailable",
"(",
"featu... | If the specified feature is not available throw a {@link org.infinispan.commons.CacheConfigurationException}.
@param features existing instance.
@param feature the feature string to check.
@throws NullPointerException if either parameter is null.
@throws org.infinispan.commons.CacheConfigurationException thrown if the ... | [
"If",
"the",
"specified",
"feature",
"is",
"not",
"available",
"throw",
"a",
"{"
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/integration/commons/src/main/java/org/infinispan/server/commons/features/Feature.java#L35-L40 |
igniterealtime/Smack | smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/util/OpenPgpPubSubUtil.java | OpenPgpPubSubUtil.publishPublicKey | public static void publishPublicKey(PepManager pepManager, PubkeyElement pubkeyElement, OpenPgpV4Fingerprint fingerprint)
throws InterruptedException, PubSubException.NotALeafNodeException,
XMPPException.XMPPErrorException, SmackException.NotConnectedException, SmackException.NoResponseException... | java | public static void publishPublicKey(PepManager pepManager, PubkeyElement pubkeyElement, OpenPgpV4Fingerprint fingerprint)
throws InterruptedException, PubSubException.NotALeafNodeException,
XMPPException.XMPPErrorException, SmackException.NotConnectedException, SmackException.NoResponseException... | [
"public",
"static",
"void",
"publishPublicKey",
"(",
"PepManager",
"pepManager",
",",
"PubkeyElement",
"pubkeyElement",
",",
"OpenPgpV4Fingerprint",
"fingerprint",
")",
"throws",
"InterruptedException",
",",
"PubSubException",
".",
"NotALeafNodeException",
",",
"XMPPExcepti... | Publish the users OpenPGP public key to the public key node if necessary.
Also announce the key to other users by updating the metadata node.
@see <a href="https://xmpp.org/extensions/xep-0373.html#annoucning-pubkey">XEP-0373 §4.1</a>
@param pepManager The PEP manager.
@param pubkeyElement {@link PubkeyElement} conta... | [
"Publish",
"the",
"users",
"OpenPGP",
"public",
"key",
"to",
"the",
"public",
"key",
"node",
"if",
"necessary",
".",
"Also",
"announce",
"the",
"key",
"to",
"other",
"users",
"by",
"updating",
"the",
"metadata",
"node",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/util/OpenPgpPubSubUtil.java#L126-L162 |
mbrade/prefixedproperties | pp-spring/src/main/java/net/sf/prefixedproperties/spring/PrefixedPropertiesPersister.java | PrefixedPropertiesPersister.loadFromYAML | public void loadFromYAML(final Properties props, final Reader rd) throws IOException {
"""
Load from json.
@param props
the props
@param rd
the rd
@throws IOException
Signals that an I/O exception has occurred.
"""
try {
((PrefixedProperties) props).loadFromYAML(rd);
} catch (final NoSuchMethodE... | java | public void loadFromYAML(final Properties props, final Reader rd) throws IOException {
try {
((PrefixedProperties) props).loadFromYAML(rd);
} catch (final NoSuchMethodError err) {
throw new IOException(
"Cannot load properties JSON file - not using PrefixedProperties: " + err.getMessage());
}
} | [
"public",
"void",
"loadFromYAML",
"(",
"final",
"Properties",
"props",
",",
"final",
"Reader",
"rd",
")",
"throws",
"IOException",
"{",
"try",
"{",
"(",
"(",
"PrefixedProperties",
")",
"props",
")",
".",
"loadFromYAML",
"(",
"rd",
")",
";",
"}",
"catch",
... | Load from json.
@param props
the props
@param rd
the rd
@throws IOException
Signals that an I/O exception has occurred. | [
"Load",
"from",
"json",
"."
] | train | https://github.com/mbrade/prefixedproperties/blob/ac430409ea37e244158002b3cf1504417835a0b2/pp-spring/src/main/java/net/sf/prefixedproperties/spring/PrefixedPropertiesPersister.java#L109-L116 |
klarna/HiveRunner | src/main/java/com/klarna/hiverunner/StandaloneHiveRunner.java | StandaloneHiveRunner.createHiveServerContainer | private HiveShellContainer createHiveServerContainer(final List<? extends Script> scripts, final Object testCase, TemporaryFolder baseDir)
throws IOException {
"""
Traverses the test case annotations. Will inject a HiveShell in the test case that envelopes the HiveServer.
"""
HiveServerContex... | java | private HiveShellContainer createHiveServerContainer(final List<? extends Script> scripts, final Object testCase, TemporaryFolder baseDir)
throws IOException {
HiveServerContext context = new StandaloneHiveServerContext(baseDir, config);
final HiveServerContainer hiveTestHarness = new HiveSer... | [
"private",
"HiveShellContainer",
"createHiveServerContainer",
"(",
"final",
"List",
"<",
"?",
"extends",
"Script",
">",
"scripts",
",",
"final",
"Object",
"testCase",
",",
"TemporaryFolder",
"baseDir",
")",
"throws",
"IOException",
"{",
"HiveServerContext",
"context",... | Traverses the test case annotations. Will inject a HiveShell in the test case that envelopes the HiveServer. | [
"Traverses",
"the",
"test",
"case",
"annotations",
".",
"Will",
"inject",
"a",
"HiveShell",
"in",
"the",
"test",
"case",
"that",
"envelopes",
"the",
"HiveServer",
"."
] | train | https://github.com/klarna/HiveRunner/blob/c8899237db6122127f16e3d8a740c1f8657c2ae3/src/main/java/com/klarna/hiverunner/StandaloneHiveRunner.java#L187-L221 |
BlueBrain/bluima | modules/bluima_utils/src/main/java/ch/epfl/bbp/uima/annotationviewer/BlueAnnotationViewGenerator.java | BlueAnnotationViewGenerator.autoGenerateStyleMapFile | public void autoGenerateStyleMapFile(AnalysisEngine aAE, File aStyleMapFile)
throws IOException {
"""
Automatically generates a style map file for the given analysis engine.
The style map will be written to the file <code>aStyleMapFile</code>.
@param aAE
the Analysis Engine whose outputs will be viewed u... | java | public void autoGenerateStyleMapFile(AnalysisEngine aAE, File aStyleMapFile)
throws IOException {
this.autoGenerateStyleMapFile(aAE.getAnalysisEngineMetaData(),
aStyleMapFile);
} | [
"public",
"void",
"autoGenerateStyleMapFile",
"(",
"AnalysisEngine",
"aAE",
",",
"File",
"aStyleMapFile",
")",
"throws",
"IOException",
"{",
"this",
".",
"autoGenerateStyleMapFile",
"(",
"aAE",
".",
"getAnalysisEngineMetaData",
"(",
")",
",",
"aStyleMapFile",
")",
"... | Automatically generates a style map file for the given analysis engine.
The style map will be written to the file <code>aStyleMapFile</code>.
@param aAE
the Analysis Engine whose outputs will be viewed using the
generated style map.
@param aStyleMapFile
file to which autogenerated style map will be written | [
"Automatically",
"generates",
"a",
"style",
"map",
"file",
"for",
"the",
"given",
"analysis",
"engine",
".",
"The",
"style",
"map",
"will",
"be",
"written",
"to",
"the",
"file",
"<code",
">",
"aStyleMapFile<",
"/",
"code",
">",
"."
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_utils/src/main/java/ch/epfl/bbp/uima/annotationviewer/BlueAnnotationViewGenerator.java#L383-L387 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/monitor/UicStatsAsHtml.java | UicStatsAsHtml.writeProfileForTree | private static void writeProfileForTree(final PrintWriter writer,
final Map<WComponent, UicStats.Stat> treeStats) {
"""
Writes the stats for a single component.
@param writer the writer to write the stats to.
@param treeStats the stats for the component.
"""
// Copy all the stats into a list so we can... | java | private static void writeProfileForTree(final PrintWriter writer,
final Map<WComponent, UicStats.Stat> treeStats) {
// Copy all the stats into a list so we can sort and cull.
List<UicStats.Stat> statList = new ArrayList<>(treeStats.values());
Comparator<UicStats.Stat> comparator = new Comparator<UicStats.Stat... | [
"private",
"static",
"void",
"writeProfileForTree",
"(",
"final",
"PrintWriter",
"writer",
",",
"final",
"Map",
"<",
"WComponent",
",",
"UicStats",
".",
"Stat",
">",
"treeStats",
")",
"{",
"// Copy all the stats into a list so we can sort and cull.",
"List",
"<",
"Uic... | Writes the stats for a single component.
@param writer the writer to write the stats to.
@param treeStats the stats for the component. | [
"Writes",
"the",
"stats",
"for",
"a",
"single",
"component",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/monitor/UicStatsAsHtml.java#L65-L95 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java | URLUtil.encodeQuery | public static String encodeQuery(String url, Charset charset) {
"""
编码字符为URL中查询语句<br>
将需要转换的内容(ASCII码形式之外的内容),用十六进制表示法转换出来,并在之前加上%开头。<br>
此方法用于POST请求中的请求体自动编码,转义大部分特殊字符
@param url 被编码内容
@param charset 编码
@return 编码后的字符
@since 4.4.1
"""
if (StrUtil.isEmpty(url)) {
return url;
}
if (null == ... | java | public static String encodeQuery(String url, Charset charset) {
if (StrUtil.isEmpty(url)) {
return url;
}
if (null == charset) {
charset = CharsetUtil.defaultCharset();
}
return URLEncoder.QUERY.encode(url, charset);
} | [
"public",
"static",
"String",
"encodeQuery",
"(",
"String",
"url",
",",
"Charset",
"charset",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isEmpty",
"(",
"url",
")",
")",
"{",
"return",
"url",
";",
"}",
"if",
"(",
"null",
"==",
"charset",
")",
"{",
"charset... | 编码字符为URL中查询语句<br>
将需要转换的内容(ASCII码形式之外的内容),用十六进制表示法转换出来,并在之前加上%开头。<br>
此方法用于POST请求中的请求体自动编码,转义大部分特殊字符
@param url 被编码内容
@param charset 编码
@return 编码后的字符
@since 4.4.1 | [
"编码字符为URL中查询语句<br",
">",
"将需要转换的内容(ASCII码形式之外的内容),用十六进制表示法转换出来,并在之前加上%开头。<br",
">",
"此方法用于POST请求中的请求体自动编码,转义大部分特殊字符"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/URLUtil.java#L295-L303 |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/util/Util.java | Util.toByteArray | public static byte[] toByteArray(String value) {
"""
Encodes the given string in UTF-8.
@param value
the string to encode.
@return A newly allocated array containing the encoding result.
"""
if (value == null) {
return null;
}
try {
CharsetEncoder encoder ... | java | public static byte[] toByteArray(String value) {
if (value == null) {
return null;
}
try {
CharsetEncoder encoder = Charset.forName("UTF-8").newEncoder().onMalformedInput(CodingErrorAction.REPORT)
.onUnmappableCharacter(CodingErrorAction.REPORT);
... | [
"public",
"static",
"byte",
"[",
"]",
"toByteArray",
"(",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"CharsetEncoder",
"encoder",
"=",
"Charset",
".",
"forName",
"(",
"\"UTF-8\"",
")... | Encodes the given string in UTF-8.
@param value
the string to encode.
@return A newly allocated array containing the encoding result. | [
"Encodes",
"the",
"given",
"string",
"in",
"UTF",
"-",
"8",
"."
] | train | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/Util.java#L164-L180 |
jamesagnew/hapi-fhir | hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/cache/NpmPackage.java | NpmPackage.load | public InputStream load(String folder, String file) throws IOException {
"""
get a stream that contains the contents of one of the files in a folder
@param folder
@param file
@return
@throws IOException
"""
if (content.containsKey(folder+"/"+file))
return new ByteArrayInputStream(content.... | java | public InputStream load(String folder, String file) throws IOException {
if (content.containsKey(folder+"/"+file))
return new ByteArrayInputStream(content.get(folder+"/"+file));
else {
File f = new File(Utilities.path(path, folder, file));
if (f.exists())
return new F... | [
"public",
"InputStream",
"load",
"(",
"String",
"folder",
",",
"String",
"file",
")",
"throws",
"IOException",
"{",
"if",
"(",
"content",
".",
"containsKey",
"(",
"folder",
"+",
"\"/\"",
"+",
"file",
")",
")",
"return",
"new",
"ByteArrayInputStream",
"(",
... | get a stream that contains the contents of one of the files in a folder
@param folder
@param file
@return
@throws IOException | [
"get",
"a",
"stream",
"that",
"contains",
"the",
"contents",
"of",
"one",
"of",
"the",
"files",
"in",
"a",
"folder"
] | train | https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-utilities/src/main/java/org/hl7/fhir/utilities/cache/NpmPackage.java#L173-L182 |
atomix/catalyst | serializer/src/main/java/io/atomix/catalyst/serializer/Serializer.java | Serializer.registerClassLoader | public Serializer registerClassLoader(String className, ClassLoader classLoader) {
"""
Registers a ClassLoader for a class.
@param className The class name.
@param classLoader The class loader.
@return The serializer instance.
"""
classLoaders.put(className, classLoader);
return this;
} | java | public Serializer registerClassLoader(String className, ClassLoader classLoader) {
classLoaders.put(className, classLoader);
return this;
} | [
"public",
"Serializer",
"registerClassLoader",
"(",
"String",
"className",
",",
"ClassLoader",
"classLoader",
")",
"{",
"classLoaders",
".",
"put",
"(",
"className",
",",
"classLoader",
")",
";",
"return",
"this",
";",
"}"
] | Registers a ClassLoader for a class.
@param className The class name.
@param classLoader The class loader.
@return The serializer instance. | [
"Registers",
"a",
"ClassLoader",
"for",
"a",
"class",
"."
] | train | https://github.com/atomix/catalyst/blob/140e762cb975cd8ee1fd85119043c5b8bf917c5c/serializer/src/main/java/io/atomix/catalyst/serializer/Serializer.java#L355-L358 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberFormat.java | NumberFormat.parseCurrency | public CurrencyAmount parseCurrency(CharSequence text, ParsePosition pos) {
"""
Parses text from the given string as a CurrencyAmount. Unlike
the parse() method, this method will attempt to parse a generic
currency name, searching for a match of this object's locale's
currency display names, or for a 3-letter ... | java | public CurrencyAmount parseCurrency(CharSequence text, ParsePosition pos) {
///CLOVER:OFF
// Default implementation only -- subclasses should override
Number n = parse(text.toString(), pos);
return n == null ? null : new CurrencyAmount(n, getEffectiveCurrency());
///CLOVER:ON
... | [
"public",
"CurrencyAmount",
"parseCurrency",
"(",
"CharSequence",
"text",
",",
"ParsePosition",
"pos",
")",
"{",
"///CLOVER:OFF",
"// Default implementation only -- subclasses should override",
"Number",
"n",
"=",
"parse",
"(",
"text",
".",
"toString",
"(",
")",
",",
... | Parses text from the given string as a CurrencyAmount. Unlike
the parse() method, this method will attempt to parse a generic
currency name, searching for a match of this object's locale's
currency display names, or for a 3-letter ISO currency code.
This method will fail if this format is not a currency format,
that i... | [
"Parses",
"text",
"from",
"the",
"given",
"string",
"as",
"a",
"CurrencyAmount",
".",
"Unlike",
"the",
"parse",
"()",
"method",
"this",
"method",
"will",
"attempt",
"to",
"parse",
"a",
"generic",
"currency",
"name",
"searching",
"for",
"a",
"match",
"of",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberFormat.java#L438-L444 |
jbundle/jbundle | thin/base/db/base/src/main/java/org/jbundle/thin/base/db/buff/BaseBuffer.java | BaseBuffer.fieldsToBuffer | public void fieldsToBuffer(FieldList record, int iFieldsTypes) {
"""
Move all the fields to the output buffer.
This is the same as the fieldsToBuffer method, specifying the fieldTypes to move.
@param record The target record.
@param iFieldTypes The field types to move.
"""
m_iFieldsTypes = iFieldsTy... | java | public void fieldsToBuffer(FieldList record, int iFieldsTypes)
{
m_iFieldsTypes = iFieldsTypes;
if (this.getHeaderCount() == 0)
this.clearBuffer(); // Being careful. (Remember to call this at the start anyway)
int fieldCount = record.getFieldCount(); // Number of fields to w... | [
"public",
"void",
"fieldsToBuffer",
"(",
"FieldList",
"record",
",",
"int",
"iFieldsTypes",
")",
"{",
"m_iFieldsTypes",
"=",
"iFieldsTypes",
";",
"if",
"(",
"this",
".",
"getHeaderCount",
"(",
")",
"==",
"0",
")",
"this",
".",
"clearBuffer",
"(",
")",
";",... | Move all the fields to the output buffer.
This is the same as the fieldsToBuffer method, specifying the fieldTypes to move.
@param record The target record.
@param iFieldTypes The field types to move. | [
"Move",
"all",
"the",
"fields",
"to",
"the",
"output",
"buffer",
".",
"This",
"is",
"the",
"same",
"as",
"the",
"fieldsToBuffer",
"method",
"specifying",
"the",
"fieldTypes",
"to",
"move",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/buff/BaseBuffer.java#L225-L238 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java | JvmTypesBuilder.newTypeRef | @Deprecated
public JvmTypeReference newTypeRef(EObject ctx, String typeName, JvmTypeReference... typeArgs) {
"""
Creates a new {@link JvmTypeReference} pointing to the given class and containing the given type arguments.
@param ctx
an EMF context, which is used to look up the {@link org.eclipse.xtext.common.t... | java | @Deprecated
public JvmTypeReference newTypeRef(EObject ctx, String typeName, JvmTypeReference... typeArgs) {
return references.getTypeForName(typeName, ctx, typeArgs);
} | [
"@",
"Deprecated",
"public",
"JvmTypeReference",
"newTypeRef",
"(",
"EObject",
"ctx",
",",
"String",
"typeName",
",",
"JvmTypeReference",
"...",
"typeArgs",
")",
"{",
"return",
"references",
".",
"getTypeForName",
"(",
"typeName",
",",
"ctx",
",",
"typeArgs",
")... | Creates a new {@link JvmTypeReference} pointing to the given class and containing the given type arguments.
@param ctx
an EMF context, which is used to look up the {@link org.eclipse.xtext.common.types.JvmType} for the
given clazz.
@param typeName
the name of the type the reference shall point to.
@param typeArgs
type... | [
"Creates",
"a",
"new",
"{",
"@link",
"JvmTypeReference",
"}",
"pointing",
"to",
"the",
"given",
"class",
"and",
"containing",
"the",
"given",
"type",
"arguments",
"."
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java#L1317-L1320 |
samskivert/samskivert | src/main/java/com/samskivert/servlet/SiteResourceLoader.java | SiteResourceLoader.getResourceAsStream | public InputStream getResourceAsStream (int siteId, String path)
throws IOException {
"""
Loads the specific resource, from the site-specific jar file if one
exists and contains the specified resource. If no resource exists
with that path, null will be returned.
@param siteId the unique identifer for ... | java | public InputStream getResourceAsStream (int siteId, String path)
throws IOException
{
// Log.info("Loading site resource [siteId=" + siteId +
// ", path=" + path + "].");
// synchronize on the lock to ensure that only one thread per site
// is concurrently executi... | [
"public",
"InputStream",
"getResourceAsStream",
"(",
"int",
"siteId",
",",
"String",
"path",
")",
"throws",
"IOException",
"{",
"// Log.info(\"Loading site resource [siteId=\" + siteId +",
"// \", path=\" + path + \"].\");",
"// synchronize on the lock to ens... | Loads the specific resource, from the site-specific jar file if one
exists and contains the specified resource. If no resource exists
with that path, null will be returned.
@param siteId the unique identifer for the site for which we are
loading the resource.
@param path the path to the desired resource.
@return an i... | [
"Loads",
"the",
"specific",
"resource",
"from",
"the",
"site",
"-",
"specific",
"jar",
"file",
"if",
"one",
"exists",
"and",
"contains",
"the",
"specified",
"resource",
".",
"If",
"no",
"resource",
"exists",
"with",
"that",
"path",
"null",
"will",
"be",
"r... | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/servlet/SiteResourceLoader.java#L96-L115 |
mikepenz/MaterialDrawer | library/src/main/java/com/mikepenz/materialdrawer/DrawerUtils.java | DrawerUtils.getDrawerItem | public static IDrawerItem getDrawerItem(List<IDrawerItem> drawerItems, Object tag) {
"""
gets the drawerItem by a defined tag from a drawerItem list
@param drawerItems
@param tag
@return
"""
if (tag != null) {
for (IDrawerItem drawerItem : drawerItems) {
if (tag.equals(... | java | public static IDrawerItem getDrawerItem(List<IDrawerItem> drawerItems, Object tag) {
if (tag != null) {
for (IDrawerItem drawerItem : drawerItems) {
if (tag.equals(drawerItem.getTag())) {
return drawerItem;
}
}
}
return ... | [
"public",
"static",
"IDrawerItem",
"getDrawerItem",
"(",
"List",
"<",
"IDrawerItem",
">",
"drawerItems",
",",
"Object",
"tag",
")",
"{",
"if",
"(",
"tag",
"!=",
"null",
")",
"{",
"for",
"(",
"IDrawerItem",
"drawerItem",
":",
"drawerItems",
")",
"{",
"if",
... | gets the drawerItem by a defined tag from a drawerItem list
@param drawerItems
@param tag
@return | [
"gets",
"the",
"drawerItem",
"by",
"a",
"defined",
"tag",
"from",
"a",
"drawerItem",
"list"
] | train | https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/DrawerUtils.java#L143-L152 |
haraldk/TwelveMonkeys | imageio/imageio-clippath/src/main/java/com/twelvemonkeys/imageio/path/Paths.java | Paths.applyClippingPath | public static BufferedImage applyClippingPath(final Shape clip, final BufferedImage image) {
"""
Applies the clipping path to the given image.
All pixels outside the path will be transparent.
@param clip the clipping path, not {@code null}
@param image the image to clip, not {@code null}
@return the clipped ... | java | public static BufferedImage applyClippingPath(final Shape clip, final BufferedImage image) {
return applyClippingPath(clip, notNull(image, "image"), new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_ARGB));
} | [
"public",
"static",
"BufferedImage",
"applyClippingPath",
"(",
"final",
"Shape",
"clip",
",",
"final",
"BufferedImage",
"image",
")",
"{",
"return",
"applyClippingPath",
"(",
"clip",
",",
"notNull",
"(",
"image",
",",
"\"image\"",
")",
",",
"new",
"BufferedImage... | Applies the clipping path to the given image.
All pixels outside the path will be transparent.
@param clip the clipping path, not {@code null}
@param image the image to clip, not {@code null}
@return the clipped image.
@throws java.lang.IllegalArgumentException if {@code clip} or {@code image} is {@code null}. | [
"Applies",
"the",
"clipping",
"path",
"to",
"the",
"given",
"image",
".",
"All",
"pixels",
"outside",
"the",
"path",
"will",
"be",
"transparent",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-clippath/src/main/java/com/twelvemonkeys/imageio/path/Paths.java#L185-L187 |
Hygieia/Hygieia | api/src/main/java/com/capitalone/dashboard/service/DashboardRemoteServiceImpl.java | DashboardRemoteServiceImpl.requestToDashboard | private Dashboard requestToDashboard(DashboardRemoteRequest request) throws HygieiaException {
"""
Creates a Dashboard object from the request.
@param request
@return Dashboard
@throws HygieiaException
"""
DashboardRemoteRequest.DashboardMetaData metaData = request.getMetaData();
Application... | java | private Dashboard requestToDashboard(DashboardRemoteRequest request) throws HygieiaException {
DashboardRemoteRequest.DashboardMetaData metaData = request.getMetaData();
Application application = new Application(metaData.getApplicationName(), new Component(metaData.getComponentName()));
String a... | [
"private",
"Dashboard",
"requestToDashboard",
"(",
"DashboardRemoteRequest",
"request",
")",
"throws",
"HygieiaException",
"{",
"DashboardRemoteRequest",
".",
"DashboardMetaData",
"metaData",
"=",
"request",
".",
"getMetaData",
"(",
")",
";",
"Application",
"application",... | Creates a Dashboard object from the request.
@param request
@return Dashboard
@throws HygieiaException | [
"Creates",
"a",
"Dashboard",
"object",
"from",
"the",
"request",
"."
] | train | https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/api/src/main/java/com/capitalone/dashboard/service/DashboardRemoteServiceImpl.java#L257-L274 |
apache/incubator-heron | heron/api/src/java/org/apache/heron/api/windowing/WindowManager.java | WindowManager.restoreState | @SuppressWarnings("unchecked")
public void restoreState(Map<String, Serializable> state) {
"""
Restore state associated with the window manager
@param state
"""
LOG.info("Restoring window manager state");
//restore eviction policy state
if (state.get(EVICTION_STATE_KEY) != null) {
((Evict... | java | @SuppressWarnings("unchecked")
public void restoreState(Map<String, Serializable> state) {
LOG.info("Restoring window manager state");
//restore eviction policy state
if (state.get(EVICTION_STATE_KEY) != null) {
((EvictionPolicy) evictionPolicy).restoreState(state.get(EVICTION_STATE_KEY));
}
... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"void",
"restoreState",
"(",
"Map",
"<",
"String",
",",
"Serializable",
">",
"state",
")",
"{",
"LOG",
".",
"info",
"(",
"\"Restoring window manager state\"",
")",
";",
"//restore eviction policy state",
... | Restore state associated with the window manager
@param state | [
"Restore",
"state",
"associated",
"with",
"the",
"window",
"manager"
] | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/api/src/java/org/apache/heron/api/windowing/WindowManager.java#L315-L340 |
apereo/cas | support/cas-server-support-surrogate-api/src/main/java/org/apereo/cas/services/SurrogateRegisteredServiceAccessStrategy.java | SurrogateRegisteredServiceAccessStrategy.doPrincipalAttributesAllowSurrogateServiceAccess | protected boolean doPrincipalAttributesAllowSurrogateServiceAccess(final Map<String, Object> principalAttributes) {
"""
Do principal attributes allow surrogate service access?.
@param principalAttributes the principal attributes
@return the boolean
"""
if (!enoughRequiredAttributesAvailableToProces... | java | protected boolean doPrincipalAttributesAllowSurrogateServiceAccess(final Map<String, Object> principalAttributes) {
if (!enoughRequiredAttributesAvailableToProcess(principalAttributes, this.surrogateRequiredAttributes)) {
LOGGER.debug("Surrogate access is denied. There are not enough attributes avai... | [
"protected",
"boolean",
"doPrincipalAttributesAllowSurrogateServiceAccess",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"principalAttributes",
")",
"{",
"if",
"(",
"!",
"enoughRequiredAttributesAvailableToProcess",
"(",
"principalAttributes",
",",
"this",
".",... | Do principal attributes allow surrogate service access?.
@param principalAttributes the principal attributes
@return the boolean | [
"Do",
"principal",
"attributes",
"allow",
"surrogate",
"service",
"access?",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-surrogate-api/src/main/java/org/apereo/cas/services/SurrogateRegisteredServiceAccessStrategy.java#L47-L59 |
btrplace/scheduler | json/src/main/java/org/btrplace/json/model/AttributesConverter.java | AttributesConverter.fromJSON | public static Attributes fromJSON(Model mo, JSONObject o) throws JSONConverterException {
"""
Decode attributes
@param mo the model to rely on
@param o the encoded attributes
@return the resulting attributes
@throws JSONConverterException if the conversion failed
"""
Attributes attrs = new Defau... | java | public static Attributes fromJSON(Model mo, JSONObject o) throws JSONConverterException {
Attributes attrs = new DefaultAttributes();
try {
JSONObject vms = (JSONObject) o.get("vms");
if (vms != null) {
for (Map.Entry<String, Object> e : vms.entrySet()) {
... | [
"public",
"static",
"Attributes",
"fromJSON",
"(",
"Model",
"mo",
",",
"JSONObject",
"o",
")",
"throws",
"JSONConverterException",
"{",
"Attributes",
"attrs",
"=",
"new",
"DefaultAttributes",
"(",
")",
";",
"try",
"{",
"JSONObject",
"vms",
"=",
"(",
"JSONObjec... | Decode attributes
@param mo the model to rely on
@param o the encoded attributes
@return the resulting attributes
@throws JSONConverterException if the conversion failed | [
"Decode",
"attributes"
] | train | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/json/src/main/java/org/btrplace/json/model/AttributesConverter.java#L70-L97 |
3redronin/mu-server | src/main/java/io/muserver/rest/RestHandlerBuilder.java | RestHandlerBuilder.addExceptionMapper | public <T extends Throwable> RestHandlerBuilder addExceptionMapper(Class<T> exceptionClass, ExceptionMapper<T> exceptionMapper) {
"""
<p>Adds a mapper that converts an exception to a response.</p>
<p>For example, you may create a custom exception such as a ValidationException that you throw from your
jax-rs meth... | java | public <T extends Throwable> RestHandlerBuilder addExceptionMapper(Class<T> exceptionClass, ExceptionMapper<T> exceptionMapper) {
this.exceptionMappers.put(exceptionClass, exceptionMapper);
return this;
} | [
"public",
"<",
"T",
"extends",
"Throwable",
">",
"RestHandlerBuilder",
"addExceptionMapper",
"(",
"Class",
"<",
"T",
">",
"exceptionClass",
",",
"ExceptionMapper",
"<",
"T",
">",
"exceptionMapper",
")",
"{",
"this",
".",
"exceptionMappers",
".",
"put",
"(",
"e... | <p>Adds a mapper that converts an exception to a response.</p>
<p>For example, you may create a custom exception such as a ValidationException that you throw from your
jax-rs methods. A mapper for this exception type could return a Response with a 400 code and a custom
validation error message.</p>
@param <T> ... | [
"<p",
">",
"Adds",
"a",
"mapper",
"that",
"converts",
"an",
"exception",
"to",
"a",
"response",
".",
"<",
"/",
"p",
">",
"<p",
">",
"For",
"example",
"you",
"may",
"create",
"a",
"custom",
"exception",
"such",
"as",
"a",
"ValidationException",
"that",
... | train | https://github.com/3redronin/mu-server/blob/51598606a3082a121fbd785348ee9770b40308e6/src/main/java/io/muserver/rest/RestHandlerBuilder.java#L212-L215 |
nostra13/Android-Universal-Image-Loader | library/src/main/java/com/nostra13/universalimageloader/utils/DiskCacheUtils.java | DiskCacheUtils.removeFromCache | public static boolean removeFromCache(String imageUri, DiskCache diskCache) {
"""
Removed cached image file from disk cache (if image was cached in disk cache before)
@return <b>true</b> - if cached image file existed and was deleted; <b>false</b> - otherwise.
"""
File image = diskCache.get(imageUri);
r... | java | public static boolean removeFromCache(String imageUri, DiskCache diskCache) {
File image = diskCache.get(imageUri);
return image != null && image.exists() && image.delete();
} | [
"public",
"static",
"boolean",
"removeFromCache",
"(",
"String",
"imageUri",
",",
"DiskCache",
"diskCache",
")",
"{",
"File",
"image",
"=",
"diskCache",
".",
"get",
"(",
"imageUri",
")",
";",
"return",
"image",
"!=",
"null",
"&&",
"image",
".",
"exists",
"... | Removed cached image file from disk cache (if image was cached in disk cache before)
@return <b>true</b> - if cached image file existed and was deleted; <b>false</b> - otherwise. | [
"Removed",
"cached",
"image",
"file",
"from",
"disk",
"cache",
"(",
"if",
"image",
"was",
"cached",
"in",
"disk",
"cache",
"before",
")"
] | train | https://github.com/nostra13/Android-Universal-Image-Loader/blob/fc3c5f6779bb4f702e233653b61bd9d559e345cc/library/src/main/java/com/nostra13/universalimageloader/utils/DiskCacheUtils.java#L45-L48 |
btaz/data-util | src/main/java/com/btaz/util/tf/Strings.java | Strings.asTokenSeparatedValues | public static String asTokenSeparatedValues(String token, Collection<String> strings) {
"""
This method converts a collection of strings to a token separated list of strings
@param strings Collection of strings
@return {@code String} new token separated string
"""
StringBuilder newString = new String... | java | public static String asTokenSeparatedValues(String token, Collection<String> strings) {
StringBuilder newString = new StringBuilder();
boolean first = true;
for(String str : strings) {
if(! first) {
newString.append(token);
}
first = false;
... | [
"public",
"static",
"String",
"asTokenSeparatedValues",
"(",
"String",
"token",
",",
"Collection",
"<",
"String",
">",
"strings",
")",
"{",
"StringBuilder",
"newString",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"boolean",
"first",
"=",
"true",
";",
"for",
... | This method converts a collection of strings to a token separated list of strings
@param strings Collection of strings
@return {@code String} new token separated string | [
"This",
"method",
"converts",
"a",
"collection",
"of",
"strings",
"to",
"a",
"token",
"separated",
"list",
"of",
"strings"
] | train | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/tf/Strings.java#L79-L90 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java | ICUResourceBundle.createBundle | public static ICUResourceBundle createBundle(String baseName, String localeID, ClassLoader root) {
"""
Create a bundle using a reader.
@param baseName The name for the bundle.
@param localeID The locale identification.
@param root The ClassLoader object root.
@return the new bundle
"""
ICUResourceB... | java | public static ICUResourceBundle createBundle(String baseName, String localeID, ClassLoader root) {
ICUResourceBundleReader reader = ICUResourceBundleReader.getReader(baseName, localeID, root);
if (reader == null) {
// could not open the .res file
return null;
}
re... | [
"public",
"static",
"ICUResourceBundle",
"createBundle",
"(",
"String",
"baseName",
",",
"String",
"localeID",
",",
"ClassLoader",
"root",
")",
"{",
"ICUResourceBundleReader",
"reader",
"=",
"ICUResourceBundleReader",
".",
"getReader",
"(",
"baseName",
",",
"localeID"... | Create a bundle using a reader.
@param baseName The name for the bundle.
@param localeID The locale identification.
@param root The ClassLoader object root.
@return the new bundle | [
"Create",
"a",
"bundle",
"using",
"a",
"reader",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java#L1283-L1290 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/training/CenterLossOutputLayer.java | CenterLossOutputLayer.computeScore | @Override
public double computeScore(double fullNetRegTerm, boolean training, LayerWorkspaceMgr workspaceMgr) {
"""
Compute score after labels and input have been set.
@param fullNetRegTerm Regularization score term for the entire network
@param training whether score should be calculated at train or test ti... | java | @Override
public double computeScore(double fullNetRegTerm, boolean training, LayerWorkspaceMgr workspaceMgr) {
if (input == null || labels == null)
throw new IllegalStateException("Cannot calculate score without input and labels " + layerId());
this.fullNetRegTerm = fullNetRegTerm;
... | [
"@",
"Override",
"public",
"double",
"computeScore",
"(",
"double",
"fullNetRegTerm",
",",
"boolean",
"training",
",",
"LayerWorkspaceMgr",
"workspaceMgr",
")",
"{",
"if",
"(",
"input",
"==",
"null",
"||",
"labels",
"==",
"null",
")",
"throw",
"new",
"IllegalS... | Compute score after labels and input have been set.
@param fullNetRegTerm Regularization score term for the entire network
@param training whether score should be calculated at train or test time (this affects things like application of
dropout, etc)
@return score (loss function) | [
"Compute",
"score",
"after",
"labels",
"and",
"input",
"have",
"been",
"set",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/training/CenterLossOutputLayer.java#L59-L96 |
igniterealtime/Smack | smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java | LeafNode.getItems | public <T extends Item> List<T> getItems(Collection<String> ids) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
"""
Get the items specified from the node. This would typically be
used when the server does not return the payload due to size
constraints. The user wo... | java | public <T extends Item> List<T> getItems(Collection<String> ids) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
List<Item> itemList = new ArrayList<>(ids.size());
for (String id : ids) {
itemList.add(new Item(id));
}
PubSub requ... | [
"public",
"<",
"T",
"extends",
"Item",
">",
"List",
"<",
"T",
">",
"getItems",
"(",
"Collection",
"<",
"String",
">",
"ids",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"List",
... | Get the items specified from the node. This would typically be
used when the server does not return the payload due to size
constraints. The user would be required to retrieve the payload
after the items have been retrieved via {@link #getItems()} or an
event, that did not include the payload.
@param ids Item ids of... | [
"Get",
"the",
"items",
"specified",
"from",
"the",
"node",
".",
"This",
"would",
"typically",
"be",
"used",
"when",
"the",
"server",
"does",
"not",
"return",
"the",
"payload",
"due",
"to",
"size",
"constraints",
".",
"The",
"user",
"would",
"be",
"required... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java#L112-L120 |
igniterealtime/Smack | smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java | AgentSession.sendRoomInvitation | public void sendRoomInvitation(RoomInvitation.Type type, Jid invitee, String sessionID, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
"""
Invites a user or agent to an existing session support. The provided invitee's JID can be of
a user, an agent, a ... | java | public void sendRoomInvitation(RoomInvitation.Type type, Jid invitee, String sessionID, String reason) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
final RoomInvitation invitation = new RoomInvitation(type, invitee, sessionID, reason);
IQ iq = new RoomInv... | [
"public",
"void",
"sendRoomInvitation",
"(",
"RoomInvitation",
".",
"Type",
"type",
",",
"Jid",
"invitee",
",",
"String",
"sessionID",
",",
"String",
"reason",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"Inter... | Invites a user or agent to an existing session support. The provided invitee's JID can be of
a user, an agent, a queue or a workgroup. In the case of a queue or a workgroup the workgroup service
will decide the best agent to receive the invitation.<p>
This method will return either when the service returned an ACK of ... | [
"Invites",
"a",
"user",
"or",
"agent",
"to",
"an",
"existing",
"session",
"support",
".",
"The",
"provided",
"invitee",
"s",
"JID",
"can",
"be",
"of",
"a",
"user",
"an",
"agent",
"a",
"queue",
"or",
"a",
"workgroup",
".",
"In",
"the",
"case",
"of",
"... | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java#L1020-L1028 |
wso2/transport-http | components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/Util.java | Util.createHttpRequestFromHttp2Headers | public static HttpRequest createHttpRequestFromHttp2Headers(Http2Headers http2Headers, int streamId)
throws Http2Exception {
"""
Creates a {@link HttpRequest} using a {@link Http2Headers} received over a particular HTTP/2 stream.
@param http2Headers the Http2Headers received over a HTTP/2 stream
@p... | java | public static HttpRequest createHttpRequestFromHttp2Headers(Http2Headers http2Headers, int streamId)
throws Http2Exception {
String method = Constants.HTTP_GET_METHOD;
if (http2Headers.method() != null) {
method = http2Headers.getAndRemove(Constants.HTTP2_METHOD).toString();
... | [
"public",
"static",
"HttpRequest",
"createHttpRequestFromHttp2Headers",
"(",
"Http2Headers",
"http2Headers",
",",
"int",
"streamId",
")",
"throws",
"Http2Exception",
"{",
"String",
"method",
"=",
"Constants",
".",
"HTTP_GET_METHOD",
";",
"if",
"(",
"http2Headers",
"."... | Creates a {@link HttpRequest} using a {@link Http2Headers} received over a particular HTTP/2 stream.
@param http2Headers the Http2Headers received over a HTTP/2 stream
@param streamId the stream id
@return the HttpRequest formed using the HttpHeaders
@throws Http2Exception if an error occurs while converting heade... | [
"Creates",
"a",
"{",
"@link",
"HttpRequest",
"}",
"using",
"a",
"{",
"@link",
"Http2Headers",
"}",
"received",
"over",
"a",
"particular",
"HTTP",
"/",
"2",
"stream",
"."
] | train | https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/Util.java#L244-L265 |
roboconf/roboconf-platform | core/roboconf-target-docker/src/main/java/net/roboconf/target/docker/internal/DockerUtils.java | DockerUtils.createDockerClient | public static DockerClient createDockerClient( Map<String,String> targetProperties ) throws TargetException {
"""
Creates a Docker client from target properties.
@param targetProperties a non-null map
@return a Docker client
@throws TargetException if something went wrong
"""
// Validate what needs to be... | java | public static DockerClient createDockerClient( Map<String,String> targetProperties ) throws TargetException {
// Validate what needs to be validated.
Logger logger = Logger.getLogger( DockerHandler.class.getName());
logger.fine( "Setting the target properties." );
String edpt = targetProperties.get( DockerHan... | [
"public",
"static",
"DockerClient",
"createDockerClient",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"targetProperties",
")",
"throws",
"TargetException",
"{",
"// Validate what needs to be validated.",
"Logger",
"logger",
"=",
"Logger",
".",
"getLogger",
"(",
"Do... | Creates a Docker client from target properties.
@param targetProperties a non-null map
@return a Docker client
@throws TargetException if something went wrong | [
"Creates",
"a",
"Docker",
"client",
"from",
"target",
"properties",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-docker/src/main/java/net/roboconf/target/docker/internal/DockerUtils.java#L71-L94 |
sebastiangraf/perfidix | src/main/java/org/perfidix/Perfidix.java | Perfidix.runBenchs | public static BenchmarkResult runBenchs(final String[] benchs) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
"""
Running one Benchmark.
@param benchs to be inserted
@return one {@link BenchmarkResult} object with the results
@throws ClassNotFoundException if class cannot be f... | java | public static BenchmarkResult runBenchs(final String[] benchs) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
final AbstractConfig conf = getConfiguration(benchs);
final Benchmark bench = new Benchmark(conf);
return setUpBenchmark(benchs, bench).run();
} | [
"public",
"static",
"BenchmarkResult",
"runBenchs",
"(",
"final",
"String",
"[",
"]",
"benchs",
")",
"throws",
"ClassNotFoundException",
",",
"InstantiationException",
",",
"IllegalAccessException",
"{",
"final",
"AbstractConfig",
"conf",
"=",
"getConfiguration",
"(",
... | Running one Benchmark.
@param benchs to be inserted
@return one {@link BenchmarkResult} object with the results
@throws ClassNotFoundException if class cannot be found
@throws IllegalAccessException if conf cannot be instantiated
@throws InstantiationException if conf cannot be instantiated | [
"Running",
"one",
"Benchmark",
"."
] | train | https://github.com/sebastiangraf/perfidix/blob/f13aa793b6a3055215ed4edbb946c1bb5d564886/src/main/java/org/perfidix/Perfidix.java#L71-L76 |
wildfly/wildfly-core | embedded/src/main/java/org/wildfly/core/embedded/EmbeddedServerFactory.java | EmbeddedServerFactory.createHostController | @SuppressWarnings("deprecation")
public static EmbeddedServerReference createHostController(ModuleLoader moduleLoader, File jbossHomeDir, String[] cmdargs) {
"""
Create an embedded host controller with an already established module loader.
@param moduleLoader the module loader. Cannot be {@code null}
@para... | java | @SuppressWarnings("deprecation")
public static EmbeddedServerReference createHostController(ModuleLoader moduleLoader, File jbossHomeDir, String[] cmdargs) {
EmbeddedManagedProcess emp = EmbeddedProcessFactory.createHostController(moduleLoader, jbossHomeDir, cmdargs);
return new EmbeddedServerRefere... | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"static",
"EmbeddedServerReference",
"createHostController",
"(",
"ModuleLoader",
"moduleLoader",
",",
"File",
"jbossHomeDir",
",",
"String",
"[",
"]",
"cmdargs",
")",
"{",
"EmbeddedManagedProcess",
"emp",
... | Create an embedded host controller with an already established module loader.
@param moduleLoader the module loader. Cannot be {@code null}
@param jbossHomeDir the location of the root of server installation. Cannot be {@code null} or empty.
@param cmdargs any additional arguments to pass to the embedded server (... | [
"Create",
"an",
"embedded",
"host",
"controller",
"with",
"an",
"already",
"established",
"module",
"loader",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/embedded/src/main/java/org/wildfly/core/embedded/EmbeddedServerFactory.java#L129-L133 |
Jasig/uPortal | uPortal-security/uPortal-security-permissions/src/main/java/org/apereo/portal/security/provider/AuthorizationImpl.java | AuthorizationImpl.canPrincipalSubscribe | @Override
@RequestCache
public boolean canPrincipalSubscribe(
IAuthorizationPrincipal principal, String portletDefinitionId) {
"""
Answers if the principal has permission to SUBSCRIBE to this Channel.
@return boolean
@param principal IAuthorizationPrincipal
@param portletDefinitionId
@exc... | java | @Override
@RequestCache
public boolean canPrincipalSubscribe(
IAuthorizationPrincipal principal, String portletDefinitionId) {
String owner = IPermission.PORTAL_SUBSCRIBE;
// retrieve the indicated channel from the channel registry store and
// determine its current lifecycl... | [
"@",
"Override",
"@",
"RequestCache",
"public",
"boolean",
"canPrincipalSubscribe",
"(",
"IAuthorizationPrincipal",
"principal",
",",
"String",
"portletDefinitionId",
")",
"{",
"String",
"owner",
"=",
"IPermission",
".",
"PORTAL_SUBSCRIBE",
";",
"// retrieve the indicated... | Answers if the principal has permission to SUBSCRIBE to this Channel.
@return boolean
@param principal IAuthorizationPrincipal
@param portletDefinitionId
@exception AuthorizationException indicates authorization information could not be retrieved. | [
"Answers",
"if",
"the",
"principal",
"has",
"permission",
"to",
"SUBSCRIBE",
"to",
"this",
"Channel",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-security/uPortal-security-permissions/src/main/java/org/apereo/portal/security/provider/AuthorizationImpl.java#L473-L514 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.