repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
amaembo/streamex | src/main/java/one/util/streamex/IntStreamEx.java | IntStreamEx.ofIndices | public static IntStreamEx ofIndices(int[] array, IntPredicate predicate) {
return seq(IntStream.range(0, array.length).filter(i -> predicate.test(array[i])));
} | java | public static IntStreamEx ofIndices(int[] array, IntPredicate predicate) {
return seq(IntStream.range(0, array.length).filter(i -> predicate.test(array[i])));
} | [
"public",
"static",
"IntStreamEx",
"ofIndices",
"(",
"int",
"[",
"]",
"array",
",",
"IntPredicate",
"predicate",
")",
"{",
"return",
"seq",
"(",
"IntStream",
".",
"range",
"(",
"0",
",",
"array",
".",
"length",
")",
".",
"filter",
"(",
"i",
"->",
"pred... | Returns a sequential ordered {@code IntStreamEx} containing all the
indices of the supplied array elements which match given predicate.
@param array array to get the stream of its indices
@param predicate a predicate to test array elements
@return a sequential {@code IntStreamEx} of the matched array indices
@since 0.1.1 | [
"Returns",
"a",
"sequential",
"ordered",
"{",
"@code",
"IntStreamEx",
"}",
"containing",
"all",
"the",
"indices",
"of",
"the",
"supplied",
"array",
"elements",
"which",
"match",
"given",
"predicate",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/IntStreamEx.java#L2083-L2085 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/ProjectApi.java | ProjectApi.getMember | public Member getMember(Object projectIdOrPath, Integer userId) throws GitLabApiException {
Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "members", userId);
return (response.readEntity(Member.class));
} | java | public Member getMember(Object projectIdOrPath, Integer userId) throws GitLabApiException {
Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "members", userId);
return (response.readEntity(Member.class));
} | [
"public",
"Member",
"getMember",
"(",
"Object",
"projectIdOrPath",
",",
"Integer",
"userId",
")",
"throws",
"GitLabApiException",
"{",
"Response",
"response",
"=",
"get",
"(",
"Response",
".",
"Status",
".",
"OK",
",",
"null",
",",
"\"projects\"",
",",
"getPro... | Gets a project team member.
<pre><code>GET /projects/:id/members/:user_id</code></pre>
@param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param userId the user ID of the member
@return the member specified by the project ID/user ID pair
@throws GitLabApiException if any exception occurs | [
"Gets",
"a",
"project",
"team",
"member",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ProjectApi.java#L1226-L1229 |
bmwcarit/joynr | java/javaapi/src/main/java/io/joynr/provider/AbstractSubscriptionPublisher.java | AbstractSubscriptionPublisher.unregisterBroadcastListener | @Override
public void unregisterBroadcastListener(String broadcastName, BroadcastListener broadcastListener) {
List<BroadcastListener> listeners = broadcastListeners.get(broadcastName);
if (listeners == null) {
LOG.error("trying to unregister a listener for broadcast \"" + broadcastName
+ "\" that was never registered");
return;
}
synchronized (listeners) {
boolean success = listeners.remove(broadcastListener);
if (!success) {
LOG.error("trying to unregister a listener for broadcast \"" + broadcastName
+ "\" that was never registered");
return;
}
}
} | java | @Override
public void unregisterBroadcastListener(String broadcastName, BroadcastListener broadcastListener) {
List<BroadcastListener> listeners = broadcastListeners.get(broadcastName);
if (listeners == null) {
LOG.error("trying to unregister a listener for broadcast \"" + broadcastName
+ "\" that was never registered");
return;
}
synchronized (listeners) {
boolean success = listeners.remove(broadcastListener);
if (!success) {
LOG.error("trying to unregister a listener for broadcast \"" + broadcastName
+ "\" that was never registered");
return;
}
}
} | [
"@",
"Override",
"public",
"void",
"unregisterBroadcastListener",
"(",
"String",
"broadcastName",
",",
"BroadcastListener",
"broadcastListener",
")",
"{",
"List",
"<",
"BroadcastListener",
">",
"listeners",
"=",
"broadcastListeners",
".",
"get",
"(",
"broadcastName",
... | Unregisters a broadcast listener.
@param broadcastName the broadcast name as defined in the Franca model
to unsubscribe from.
@param broadcastListener the listener to remove. | [
"Unregisters",
"a",
"broadcast",
"listener",
"."
] | train | https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/javaapi/src/main/java/io/joynr/provider/AbstractSubscriptionPublisher.java#L185-L201 |
alamkanak/Android-Week-View | library/src/main/java/com/alamkanak/weekview/WeekView.java | WeekView.sortEvents | private void sortEvents(List<? extends WeekViewEvent> events) {
Collections.sort(events, new Comparator<WeekViewEvent>() {
@Override
public int compare(WeekViewEvent event1, WeekViewEvent event2) {
long start1 = event1.getStartTime().getTimeInMillis();
long start2 = event2.getStartTime().getTimeInMillis();
int comparator = start1 > start2 ? 1 : (start1 < start2 ? -1 : 0);
if (comparator == 0) {
long end1 = event1.getEndTime().getTimeInMillis();
long end2 = event2.getEndTime().getTimeInMillis();
comparator = end1 > end2 ? 1 : (end1 < end2 ? -1 : 0);
}
return comparator;
}
});
} | java | private void sortEvents(List<? extends WeekViewEvent> events) {
Collections.sort(events, new Comparator<WeekViewEvent>() {
@Override
public int compare(WeekViewEvent event1, WeekViewEvent event2) {
long start1 = event1.getStartTime().getTimeInMillis();
long start2 = event2.getStartTime().getTimeInMillis();
int comparator = start1 > start2 ? 1 : (start1 < start2 ? -1 : 0);
if (comparator == 0) {
long end1 = event1.getEndTime().getTimeInMillis();
long end2 = event2.getEndTime().getTimeInMillis();
comparator = end1 > end2 ? 1 : (end1 < end2 ? -1 : 0);
}
return comparator;
}
});
} | [
"private",
"void",
"sortEvents",
"(",
"List",
"<",
"?",
"extends",
"WeekViewEvent",
">",
"events",
")",
"{",
"Collections",
".",
"sort",
"(",
"events",
",",
"new",
"Comparator",
"<",
"WeekViewEvent",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
... | Sorts the events in ascending order.
@param events The events to be sorted. | [
"Sorts",
"the",
"events",
"in",
"ascending",
"order",
"."
] | train | https://github.com/alamkanak/Android-Week-View/blob/dc3f97d65d44785d1a761b52b58527c86c4eee1b/library/src/main/java/com/alamkanak/weekview/WeekView.java#L1077-L1092 |
dita-ot/dita-ot | src/main/plugins/org.dita.eclipsehelp/src/main/java/org/dita/dost/writer/EclipseIndexWriter.java | EclipseIndexWriter.outputIndexTermEndElement | private void outputIndexTermEndElement(final IndexTerm term, final XMLStreamWriter serializer, final boolean indexsee) throws XMLStreamException {
if (indexsee){
if (term.getTermPrefix() != null) {
serializer.writeEndElement(); // see
inIndexsee = false;
} else if (inIndexsee) {
// NOOP
} else {
serializer.writeEndElement(); // entry
}
} else {
serializer.writeEndElement(); // entry
}
} | java | private void outputIndexTermEndElement(final IndexTerm term, final XMLStreamWriter serializer, final boolean indexsee) throws XMLStreamException {
if (indexsee){
if (term.getTermPrefix() != null) {
serializer.writeEndElement(); // see
inIndexsee = false;
} else if (inIndexsee) {
// NOOP
} else {
serializer.writeEndElement(); // entry
}
} else {
serializer.writeEndElement(); // entry
}
} | [
"private",
"void",
"outputIndexTermEndElement",
"(",
"final",
"IndexTerm",
"term",
",",
"final",
"XMLStreamWriter",
"serializer",
",",
"final",
"boolean",
"indexsee",
")",
"throws",
"XMLStreamException",
"{",
"if",
"(",
"indexsee",
")",
"{",
"if",
"(",
"term",
"... | /*
Logic for adding various end index entry elements for Eclipse help.
@param term The indexterm to be processed.
@param printWriter The Writer used for writing content to disk.
@param indexsee Boolean value for using the new markup for see references. | [
"/",
"*",
"Logic",
"for",
"adding",
"various",
"end",
"index",
"entry",
"elements",
"for",
"Eclipse",
"help",
"."
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/plugins/org.dita.eclipsehelp/src/main/java/org/dita/dost/writer/EclipseIndexWriter.java#L346-L359 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java | SARLOperationHelper._hasSideEffects | protected Boolean _hasSideEffects(XReturnExpression expression, ISideEffectContext context) {
return hasSideEffects(expression.getExpression(), context);
} | java | protected Boolean _hasSideEffects(XReturnExpression expression, ISideEffectContext context) {
return hasSideEffects(expression.getExpression(), context);
} | [
"protected",
"Boolean",
"_hasSideEffects",
"(",
"XReturnExpression",
"expression",
",",
"ISideEffectContext",
"context",
")",
"{",
"return",
"hasSideEffects",
"(",
"expression",
".",
"getExpression",
"(",
")",
",",
"context",
")",
";",
"}"
] | Test if the given expression has side effects.
@param expression the expression.
@param context the list of context expressions.
@return {@code true} if the expression has side effects. | [
"Test",
"if",
"the",
"given",
"expression",
"has",
"side",
"effects",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java#L339-L341 |
mgormley/prim | src/main/java/edu/jhu/prim/arrays/DoubleArrays.java | DoubleArrays.indexOf | public static int indexOf(double[] array, double val) {
for (int i=0; i<array.length; i++) {
if (array[i] == val) {
return i;
}
}
return -1;
} | java | public static int indexOf(double[] array, double val) {
for (int i=0; i<array.length; i++) {
if (array[i] == val) {
return i;
}
}
return -1;
} | [
"public",
"static",
"int",
"indexOf",
"(",
"double",
"[",
"]",
"array",
",",
"double",
"val",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"array",
"[",
"i",
"]",
"=="... | Gets the first index of a given value in an array or -1 if not present. | [
"Gets",
"the",
"first",
"index",
"of",
"a",
"given",
"value",
"in",
"an",
"array",
"or",
"-",
"1",
"if",
"not",
"present",
"."
] | train | https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/arrays/DoubleArrays.java#L514-L521 |
JDBDT/jdbdt | src/main/java/org/jdbdt/DBAssert.java | DBAssert.dataSetAssertion | static void dataSetAssertion(CallInfo callInfo, DataSet expected, DataSet actual) {
validateDataSetAssertion(expected, actual);
DataSource source = expected.getSource();
Delta delta = new Delta(expected, actual);
DataSetAssertion assertion = new DataSetAssertion(expected, delta);
source.getDB().log(callInfo, assertion);
if (! assertion.passed()) {
throw new DBAssertionError(callInfo.getMessage());
}
} | java | static void dataSetAssertion(CallInfo callInfo, DataSet expected, DataSet actual) {
validateDataSetAssertion(expected, actual);
DataSource source = expected.getSource();
Delta delta = new Delta(expected, actual);
DataSetAssertion assertion = new DataSetAssertion(expected, delta);
source.getDB().log(callInfo, assertion);
if (! assertion.passed()) {
throw new DBAssertionError(callInfo.getMessage());
}
} | [
"static",
"void",
"dataSetAssertion",
"(",
"CallInfo",
"callInfo",
",",
"DataSet",
"expected",
",",
"DataSet",
"actual",
")",
"{",
"validateDataSetAssertion",
"(",
"expected",
",",
"actual",
")",
";",
"DataSource",
"source",
"=",
"expected",
".",
"getSource",
"(... | Perform a data set assertion.
@param callInfo Call info.
@param expected Expected data.
@param actual Actual data.
@throws DBAssertionError If the assertion fails.
@throws InvalidOperationException If the arguments are invalid. | [
"Perform",
"a",
"data",
"set",
"assertion",
"."
] | train | https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/DBAssert.java#L113-L123 |
respoke/respoke-sdk-android | respokeSDK/src/main/java/com/digium/respokesdk/RespokeGroup.java | RespokeGroup.postGetGroupMembersError | private void postGetGroupMembersError(final GetGroupMembersCompletionListener completionListener, final String errorMessage) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
if (null != completionListener) {
completionListener.onError(errorMessage);
}
}
});
} | java | private void postGetGroupMembersError(final GetGroupMembersCompletionListener completionListener, final String errorMessage) {
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
if (null != completionListener) {
completionListener.onError(errorMessage);
}
}
});
} | [
"private",
"void",
"postGetGroupMembersError",
"(",
"final",
"GetGroupMembersCompletionListener",
"completionListener",
",",
"final",
"String",
"errorMessage",
")",
"{",
"new",
"Handler",
"(",
"Looper",
".",
"getMainLooper",
"(",
")",
")",
".",
"post",
"(",
"new",
... | A convenience method for posting errors to a GetGroupMembersCompletionListener
@param completionListener The listener to notify
@param errorMessage The human-readable error message that occurred | [
"A",
"convenience",
"method",
"for",
"posting",
"errors",
"to",
"a",
"GetGroupMembersCompletionListener"
] | train | https://github.com/respoke/respoke-sdk-android/blob/34a15f0558d29b1f1bc8481bbc5c505e855e05ef/respokeSDK/src/main/java/com/digium/respokesdk/RespokeGroup.java#L434-L443 |
jferard/fastods | fastods/src/main/java/com/github/jferard/fastods/odselement/OdsElements.java | OdsElements.addChildCellStyle | public void addChildCellStyle(final TableCellStyle style, final TableCell.Type type) {
this.contentElement.addChildCellStyle(style, type);
} | java | public void addChildCellStyle(final TableCellStyle style, final TableCell.Type type) {
this.contentElement.addChildCellStyle(style, type);
} | [
"public",
"void",
"addChildCellStyle",
"(",
"final",
"TableCellStyle",
"style",
",",
"final",
"TableCell",
".",
"Type",
"type",
")",
"{",
"this",
".",
"contentElement",
".",
"addChildCellStyle",
"(",
"style",
",",
"type",
")",
";",
"}"
] | Create an automatic style for this TableCellStyle and this type of cell.
Do not produce any effect if the type is Type.STRING or Type.VOID
@param style the style of the cell (color, data style, etc.)
@param type the type of the cell | [
"Create",
"an",
"automatic",
"style",
"for",
"this",
"TableCellStyle",
"and",
"this",
"type",
"of",
"cell",
".",
"Do",
"not",
"produce",
"any",
"effect",
"if",
"the",
"type",
"is",
"Type",
".",
"STRING",
"or",
"Type",
".",
"VOID"
] | train | https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/odselement/OdsElements.java#L127-L129 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaCommonEndpointActivation.java | SibRaCommonEndpointActivation.sessionError | @Override
void sessionError(SibRaMessagingEngineConnection connection, ConsumerSession session, Throwable throwable)
{
final String methodName = "sessionError";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
{
SibTr.entry(this, TRACE, methodName, new Object[] { connection, session });
}
final SIDestinationAddress destination = session.getDestinationAddress();
SibTr.warning(TRACE, "CONSUMER_FAILED_CWSIV0770", new Object[] {
destination.getDestinationName(),
_endpointConfiguration.getBusName(), this, throwable });
dropConnection(connection, true, true, false);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
{
SibTr.exit(this, TRACE, methodName);
}
} | java | @Override
void sessionError(SibRaMessagingEngineConnection connection, ConsumerSession session, Throwable throwable)
{
final String methodName = "sessionError";
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
{
SibTr.entry(this, TRACE, methodName, new Object[] { connection, session });
}
final SIDestinationAddress destination = session.getDestinationAddress();
SibTr.warning(TRACE, "CONSUMER_FAILED_CWSIV0770", new Object[] {
destination.getDestinationName(),
_endpointConfiguration.getBusName(), this, throwable });
dropConnection(connection, true, true, false);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
{
SibTr.exit(this, TRACE, methodName);
}
} | [
"@",
"Override",
"void",
"sessionError",
"(",
"SibRaMessagingEngineConnection",
"connection",
",",
"ConsumerSession",
"session",
",",
"Throwable",
"throwable",
")",
"{",
"final",
"String",
"methodName",
"=",
"\"sessionError\"",
";",
"if",
"(",
"TraceComponent",
".",
... | A session error has occured on the connection, drop the connection and, if necessary,
try to create a new connection | [
"A",
"session",
"error",
"has",
"occured",
"on",
"the",
"connection",
"drop",
"the",
"connection",
"and",
"if",
"necessary",
"try",
"to",
"create",
"a",
"new",
"connection"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaCommonEndpointActivation.java#L1190-L1210 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java | ApiOvhDedicatedserver.serviceName_statistics_raid_unit_volume_volume_port_port_GET | public OvhRtmRaidVolumePort serviceName_statistics_raid_unit_volume_volume_port_port_GET(String serviceName, String unit, String volume, String port) throws IOException {
String qPath = "/dedicated/server/{serviceName}/statistics/raid/{unit}/volume/{volume}/port/{port}";
StringBuilder sb = path(qPath, serviceName, unit, volume, port);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRtmRaidVolumePort.class);
} | java | public OvhRtmRaidVolumePort serviceName_statistics_raid_unit_volume_volume_port_port_GET(String serviceName, String unit, String volume, String port) throws IOException {
String qPath = "/dedicated/server/{serviceName}/statistics/raid/{unit}/volume/{volume}/port/{port}";
StringBuilder sb = path(qPath, serviceName, unit, volume, port);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRtmRaidVolumePort.class);
} | [
"public",
"OvhRtmRaidVolumePort",
"serviceName_statistics_raid_unit_volume_volume_port_port_GET",
"(",
"String",
"serviceName",
",",
"String",
"unit",
",",
"String",
"volume",
",",
"String",
"port",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicated/... | Get this object properties
REST: GET /dedicated/server/{serviceName}/statistics/raid/{unit}/volume/{volume}/port/{port}
@param serviceName [required] The internal name of your dedicated server
@param unit [required] Raid unit
@param volume [required] Raid volume name
@param port [required] Raid volume port | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L1417-L1422 |
threerings/narya | core/src/main/java/com/threerings/presents/server/RebootManager.java | RebootManager.getRebootMessage | protected String getRebootMessage (String key, int minutes)
{
String msg = getCustomRebootMessage();
if (StringUtil.isBlank(msg)) {
msg = "m.reboot_msg_standard";
}
return MessageBundle.compose(key, MessageBundle.taint("" + minutes), msg);
} | java | protected String getRebootMessage (String key, int minutes)
{
String msg = getCustomRebootMessage();
if (StringUtil.isBlank(msg)) {
msg = "m.reboot_msg_standard";
}
return MessageBundle.compose(key, MessageBundle.taint("" + minutes), msg);
} | [
"protected",
"String",
"getRebootMessage",
"(",
"String",
"key",
",",
"int",
"minutes",
")",
"{",
"String",
"msg",
"=",
"getCustomRebootMessage",
"(",
")",
";",
"if",
"(",
"StringUtil",
".",
"isBlank",
"(",
"msg",
")",
")",
"{",
"msg",
"=",
"\"m.reboot_msg... | Composes the given reboot message with the minutes and either the custom or standard details
about the pending reboot. | [
"Composes",
"the",
"given",
"reboot",
"message",
"with",
"the",
"minutes",
"and",
"either",
"the",
"custom",
"or",
"standard",
"details",
"about",
"the",
"pending",
"reboot",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/RebootManager.java#L256-L264 |
BorderTech/wcomponents | wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/SimpleTabs.java | SimpleTabs.addTab | public void addTab(final WComponent card, final String name) {
WContainer titledCard = new WContainer();
WText title = new WText("<b>[" + name + "]:</b><br/>");
title.setEncodeText(false);
titledCard.add(title);
titledCard.add(card);
deck.add(titledCard);
final TabButton button = new TabButton(name, titledCard);
button.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
deck.makeVisible(button.getAssociatedCard());
}
});
btnPanel.add(button);
} | java | public void addTab(final WComponent card, final String name) {
WContainer titledCard = new WContainer();
WText title = new WText("<b>[" + name + "]:</b><br/>");
title.setEncodeText(false);
titledCard.add(title);
titledCard.add(card);
deck.add(titledCard);
final TabButton button = new TabButton(name, titledCard);
button.setAction(new Action() {
@Override
public void execute(final ActionEvent event) {
deck.makeVisible(button.getAssociatedCard());
}
});
btnPanel.add(button);
} | [
"public",
"void",
"addTab",
"(",
"final",
"WComponent",
"card",
",",
"final",
"String",
"name",
")",
"{",
"WContainer",
"titledCard",
"=",
"new",
"WContainer",
"(",
")",
";",
"WText",
"title",
"=",
"new",
"WText",
"(",
"\"<b>[\"",
"+",
"name",
"+",
"\"]:... | Adds a tab.
@param card the tab content.
@param name the tab name. | [
"Adds",
"a",
"tab",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/SimpleTabs.java#L46-L65 |
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/XlsLoader.java | XlsLoader.loadMultiple | @SuppressWarnings("unchecked")
public <P> P[] loadMultiple(final InputStream xlsIn, final Class<P> clazz) throws XlsMapperException, IOException {
return loadMultipleDetail(xlsIn, clazz).getAll().stream()
.map(s -> s.getTarget())
.toArray(n -> (P[])Array.newInstance(clazz, n));
} | java | @SuppressWarnings("unchecked")
public <P> P[] loadMultiple(final InputStream xlsIn, final Class<P> clazz) throws XlsMapperException, IOException {
return loadMultipleDetail(xlsIn, clazz).getAll().stream()
.map(s -> s.getTarget())
.toArray(n -> (P[])Array.newInstance(clazz, n));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"P",
">",
"P",
"[",
"]",
"loadMultiple",
"(",
"final",
"InputStream",
"xlsIn",
",",
"final",
"Class",
"<",
"P",
">",
"clazz",
")",
"throws",
"XlsMapperException",
",",
"IOException",
"{",
"... | Excelファイルの複数シートを読み込み、任意のクラスにマップする。
<p>{@link XlsSheet#regex()}により、複数のシートが同じ形式で、同じクラスにマッピングすする際に使用します。</p>
@param <P> シートをマッピングするクラスタイプ
@param xlsIn 読み込み元のExcelファイルのストリーム。
@param clazz マッピング先のクラスタイプ。
@return マッピングした複数のシート。
{@link Configuration#isIgnoreSheetNotFound()}の値がtrueで、シートが見つからない場合、マッピング結果には含まれません。
@throws IllegalArgumentException {@literal xlsIn == null or clazz == null}
@throws XlsMapperException マッピングに失敗した場合
@throws IOException ファイルの読み込みに失敗した場合 | [
"Excelファイルの複数シートを読み込み、任意のクラスにマップする。",
"<p",
">",
"{",
"@link",
"XlsSheet#regex",
"()",
"}",
"により、複数のシートが同じ形式で、同じクラスにマッピングすする際に使用します。<",
"/",
"p",
">"
] | train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/XlsLoader.java#L154-L160 |
protostuff/protostuff | protostuff-xml/src/main/java/io/protostuff/XmlIOUtil.java | XmlIOUtil.writeTo | public static <T> void writeTo(Writer w, T message, Schema<T> schema)
throws IOException
{
writeTo(w, message, schema, DEFAULT_OUTPUT_FACTORY);
} | java | public static <T> void writeTo(Writer w, T message, Schema<T> schema)
throws IOException
{
writeTo(w, message, schema, DEFAULT_OUTPUT_FACTORY);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"writeTo",
"(",
"Writer",
"w",
",",
"T",
"message",
",",
"Schema",
"<",
"T",
">",
"schema",
")",
"throws",
"IOException",
"{",
"writeTo",
"(",
"w",
",",
"message",
",",
"schema",
",",
"DEFAULT_OUTPUT_FACTORY",
... | Serializes the {@code message} into a {@link Writer} using the given {@code schema}. | [
"Serializes",
"the",
"{"
] | train | https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-xml/src/main/java/io/protostuff/XmlIOUtil.java#L399-L403 |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/AbstractDb.java | AbstractDb.update | public int update(Entity record, Entity where) throws SQLException {
Connection conn = null;
try {
conn = this.getConnection();
return runner.update(conn, record, where);
} catch (SQLException e) {
throw e;
} finally {
this.closeConnection(conn);
}
} | java | public int update(Entity record, Entity where) throws SQLException {
Connection conn = null;
try {
conn = this.getConnection();
return runner.update(conn, record, where);
} catch (SQLException e) {
throw e;
} finally {
this.closeConnection(conn);
}
} | [
"public",
"int",
"update",
"(",
"Entity",
"record",
",",
"Entity",
"where",
")",
"throws",
"SQLException",
"{",
"Connection",
"conn",
"=",
"null",
";",
"try",
"{",
"conn",
"=",
"this",
".",
"getConnection",
"(",
")",
";",
"return",
"runner",
".",
"update... | 更新数据<br>
更新条件为多个key value对表示,默认key = value,如果使用其它条件可以使用:where.put("key", " > 1"),value也可以传Condition对象,key被忽略
@param record 记录
@param where 条件
@return 影响行数
@throws SQLException SQL执行异常 | [
"更新数据<br",
">",
"更新条件为多个key",
"value对表示,默认key",
"=",
"value,如果使用其它条件可以使用:where",
".",
"put",
"(",
"key",
">",
";",
"1",
")",
",value也可以传Condition对象,key被忽略"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java#L380-L390 |
ow2-chameleon/fuchsia | bases/knx/calimero/src/main/java/tuwien/auto/calimero/dptxlator/DPTXlatorDateTime.java | DPTXlatorDateTime.setDate | public final void setDate(int year, int month, int day)
{
set(data, 0, YEAR, year);
set(data, 0, MONTH, month);
set(data, 0, DAY, day);
} | java | public final void setDate(int year, int month, int day)
{
set(data, 0, YEAR, year);
set(data, 0, MONTH, month);
set(data, 0, DAY, day);
} | [
"public",
"final",
"void",
"setDate",
"(",
"int",
"year",
",",
"int",
"month",
",",
"int",
"day",
")",
"{",
"set",
"(",
"data",
",",
"0",
",",
"YEAR",
",",
"year",
")",
";",
"set",
"(",
"data",
",",
"0",
",",
"MONTH",
",",
"month",
")",
";",
... | Sets year, month and day of month information of the first date/time item.
<p>
This method does not reset other item data or discard other translation items.
@param year year value, 1900 <= year <= 2155
@param month month value, 1 <= month <= 12
@param day day value, 1 <= day <= 31 | [
"Sets",
"year",
"month",
"and",
"day",
"of",
"month",
"information",
"of",
"the",
"first",
"date",
"/",
"time",
"item",
".",
"<p",
">",
"This",
"method",
"does",
"not",
"reset",
"other",
"item",
"data",
"or",
"discard",
"other",
"translation",
"items",
"... | train | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/dptxlator/DPTXlatorDateTime.java#L300-L305 |
spotify/ssh-agent-proxy | src/main/java/com/spotify/sshagentproxy/AgentOutput.java | AgentOutput.signRequest | void signRequest(final RSAPublicKey rsaPublicKey, final byte[] data) throws IOException {
// TODO (dxia) Support more than just Rsa keys
final String keyType = Rsa.RSA_LABEL;
final byte[] publicExponent = rsaPublicKey.getPublicExponent().toByteArray();
final byte[] modulus = rsaPublicKey.getModulus().toByteArray();
// Four bytes indicating length of string denoting key type
// Four bytes indicating length of public exponent
// Four bytes indicating length of modulus
final int publicKeyLength = 4 + keyType.length()
+ 4 + publicExponent.length
+ 4 + modulus.length;
// The message is made of:
// Four bytes indicating length in bytes of rest of message
// One byte indicating SSH2_AGENTC_SIGN_REQUEST
// Four bytes denoting length of public key
// Bytes representing the public key
// Four bytes for length of data
// Bytes representing data to be signed
// Four bytes of flags
final ByteBuffer buff = ByteBuffer.allocate(
INT_BYTES + 1 + INT_BYTES + publicKeyLength + INT_BYTES + data.length + 4);
// 13 =
// One byte indicating SSH2_AGENTC_SIGN_REQUEST
// Four bytes denoting length of public key
// Four bytes for length of data
// Four bytes of flags
buff.putInt(publicKeyLength + data.length + 13);
buff.put((byte) SSH2_AGENTC_SIGN_REQUEST);
// Add the public key
buff.putInt(publicKeyLength);
buff.putInt(keyType.length());
for (final byte b : keyType.getBytes()) {
buff.put(b);
}
buff.putInt(publicExponent.length);
buff.put(publicExponent);
buff.putInt(modulus.length);
buff.put(modulus);
// Add the data to be signed
buff.putInt(data.length);
buff.put(data);
// Add empty flags
buff.put(new byte[] {0, 0, 0, 0});
out.write(buff.array());
out.flush();
log.debug("Sent SSH2_AGENTC_SIGN_REQUEST message to ssh-agent.");
} | java | void signRequest(final RSAPublicKey rsaPublicKey, final byte[] data) throws IOException {
// TODO (dxia) Support more than just Rsa keys
final String keyType = Rsa.RSA_LABEL;
final byte[] publicExponent = rsaPublicKey.getPublicExponent().toByteArray();
final byte[] modulus = rsaPublicKey.getModulus().toByteArray();
// Four bytes indicating length of string denoting key type
// Four bytes indicating length of public exponent
// Four bytes indicating length of modulus
final int publicKeyLength = 4 + keyType.length()
+ 4 + publicExponent.length
+ 4 + modulus.length;
// The message is made of:
// Four bytes indicating length in bytes of rest of message
// One byte indicating SSH2_AGENTC_SIGN_REQUEST
// Four bytes denoting length of public key
// Bytes representing the public key
// Four bytes for length of data
// Bytes representing data to be signed
// Four bytes of flags
final ByteBuffer buff = ByteBuffer.allocate(
INT_BYTES + 1 + INT_BYTES + publicKeyLength + INT_BYTES + data.length + 4);
// 13 =
// One byte indicating SSH2_AGENTC_SIGN_REQUEST
// Four bytes denoting length of public key
// Four bytes for length of data
// Four bytes of flags
buff.putInt(publicKeyLength + data.length + 13);
buff.put((byte) SSH2_AGENTC_SIGN_REQUEST);
// Add the public key
buff.putInt(publicKeyLength);
buff.putInt(keyType.length());
for (final byte b : keyType.getBytes()) {
buff.put(b);
}
buff.putInt(publicExponent.length);
buff.put(publicExponent);
buff.putInt(modulus.length);
buff.put(modulus);
// Add the data to be signed
buff.putInt(data.length);
buff.put(data);
// Add empty flags
buff.put(new byte[] {0, 0, 0, 0});
out.write(buff.array());
out.flush();
log.debug("Sent SSH2_AGENTC_SIGN_REQUEST message to ssh-agent.");
} | [
"void",
"signRequest",
"(",
"final",
"RSAPublicKey",
"rsaPublicKey",
",",
"final",
"byte",
"[",
"]",
"data",
")",
"throws",
"IOException",
"{",
"// TODO (dxia) Support more than just Rsa keys",
"final",
"String",
"keyType",
"=",
"Rsa",
".",
"RSA_LABEL",
";",
"final"... | Send a SSH2_AGENTC_SIGN_REQUEST message to ssh-agent.
@param rsaPublicKey The {@link RSAPublicKey} that tells ssh-agent which private key to use to
sign the data.
@param data The data in bytes to be signed. | [
"Send",
"a",
"SSH2_AGENTC_SIGN_REQUEST",
"message",
"to",
"ssh",
"-",
"agent",
"."
] | train | https://github.com/spotify/ssh-agent-proxy/blob/b678792750c0157bd5ed3fb6a18895ff95effbc4/src/main/java/com/spotify/sshagentproxy/AgentOutput.java#L113-L167 |
alibaba/jstorm | jstorm-core/src/main/java/backtype/storm/topology/TopologyBuilder.java | TopologyBuilder.setBolt | public BoltDeclarer setBolt(String id, IBasicBolt bolt, Number parallelism_hint) throws IllegalArgumentException {
return setBolt(id, new BasicBoltExecutor(bolt), parallelism_hint);
} | java | public BoltDeclarer setBolt(String id, IBasicBolt bolt, Number parallelism_hint) throws IllegalArgumentException {
return setBolt(id, new BasicBoltExecutor(bolt), parallelism_hint);
} | [
"public",
"BoltDeclarer",
"setBolt",
"(",
"String",
"id",
",",
"IBasicBolt",
"bolt",
",",
"Number",
"parallelism_hint",
")",
"throws",
"IllegalArgumentException",
"{",
"return",
"setBolt",
"(",
"id",
",",
"new",
"BasicBoltExecutor",
"(",
"bolt",
")",
",",
"paral... | Define a new bolt in this topology. This defines a basic bolt, which is a
simpler to use but more restricted kind of bolt. Basic bolts are intended
for non-aggregation processing and automate the anchoring/acking process to
achieve proper reliability in the topology.
@param id the id of this component. This id is referenced by other components that want to consume this bolt's outputs.
@param bolt the basic bolt
@param parallelism_hint the number of tasks that should be assigned to execute this bolt. Each task will run on a thread in a process somewhere around the cluster.
@return use the returned object to declare the inputs to this component
@throws IllegalArgumentException if {@code parallelism_hint} is not positive | [
"Define",
"a",
"new",
"bolt",
"in",
"this",
"topology",
".",
"This",
"defines",
"a",
"basic",
"bolt",
"which",
"is",
"a",
"simpler",
"to",
"use",
"but",
"more",
"restricted",
"kind",
"of",
"bolt",
".",
"Basic",
"bolts",
"are",
"intended",
"for",
"non",
... | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/backtype/storm/topology/TopologyBuilder.java#L220-L222 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/ResourceHealthMetadatasInner.java | ResourceHealthMetadatasInner.listBySiteSlotWithServiceResponseAsync | public Observable<ServiceResponse<Page<ResourceHealthMetadataInner>>> listBySiteSlotWithServiceResponseAsync(final String resourceGroupName, final String name, final String slot) {
return listBySiteSlotSinglePageAsync(resourceGroupName, name, slot)
.concatMap(new Func1<ServiceResponse<Page<ResourceHealthMetadataInner>>, Observable<ServiceResponse<Page<ResourceHealthMetadataInner>>>>() {
@Override
public Observable<ServiceResponse<Page<ResourceHealthMetadataInner>>> call(ServiceResponse<Page<ResourceHealthMetadataInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listBySiteSlotNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<ResourceHealthMetadataInner>>> listBySiteSlotWithServiceResponseAsync(final String resourceGroupName, final String name, final String slot) {
return listBySiteSlotSinglePageAsync(resourceGroupName, name, slot)
.concatMap(new Func1<ServiceResponse<Page<ResourceHealthMetadataInner>>, Observable<ServiceResponse<Page<ResourceHealthMetadataInner>>>>() {
@Override
public Observable<ServiceResponse<Page<ResourceHealthMetadataInner>>> call(ServiceResponse<Page<ResourceHealthMetadataInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listBySiteSlotNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"ResourceHealthMetadataInner",
">",
">",
">",
"listBySiteSlotWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"name",
",",
"final",
"String",
"slot",
")",
... | Gets the category of ResourceHealthMetadata to use for the given site as a collection.
Gets the category of ResourceHealthMetadata to use for the given site as a collection.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of web app.
@param slot Name of web app slot. If not specified then will default to production slot.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<ResourceHealthMetadataInner> object | [
"Gets",
"the",
"category",
"of",
"ResourceHealthMetadata",
"to",
"use",
"for",
"the",
"given",
"site",
"as",
"a",
"collection",
".",
"Gets",
"the",
"category",
"of",
"ResourceHealthMetadata",
"to",
"use",
"for",
"the",
"given",
"site",
"as",
"a",
"collection",... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/appservice/v2016_03_01/implementation/ResourceHealthMetadatasInner.java#L628-L640 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobgraph/JobGraph.java | JobGraph.collectVertices | private void collectVertices(final AbstractJobVertex jv, final List<AbstractJobVertex> collector) {
if (jv == null) {
final Iterator<AbstractJobInputVertex> iter = getInputVertices();
while (iter.hasNext()) {
collectVertices(iter.next(), collector);
}
} else {
if (!collector.contains(jv)) {
collector.add(jv);
} else {
return;
}
for (int i = 0; i < jv.getNumberOfForwardConnections(); i++) {
collectVertices(jv.getForwardConnection(i).getConnectedVertex(), collector);
}
}
} | java | private void collectVertices(final AbstractJobVertex jv, final List<AbstractJobVertex> collector) {
if (jv == null) {
final Iterator<AbstractJobInputVertex> iter = getInputVertices();
while (iter.hasNext()) {
collectVertices(iter.next(), collector);
}
} else {
if (!collector.contains(jv)) {
collector.add(jv);
} else {
return;
}
for (int i = 0; i < jv.getNumberOfForwardConnections(); i++) {
collectVertices(jv.getForwardConnection(i).getConnectedVertex(), collector);
}
}
} | [
"private",
"void",
"collectVertices",
"(",
"final",
"AbstractJobVertex",
"jv",
",",
"final",
"List",
"<",
"AbstractJobVertex",
">",
"collector",
")",
"{",
"if",
"(",
"jv",
"==",
"null",
")",
"{",
"final",
"Iterator",
"<",
"AbstractJobInputVertex",
">",
"iter",... | Auxiliary method to collect all vertices which are reachable from the input vertices.
@param jv
the currently considered job vertex
@param collector
a temporary list to store the vertices that have already been visisted | [
"Auxiliary",
"method",
"to",
"collect",
"all",
"vertices",
"which",
"are",
"reachable",
"from",
"the",
"input",
"vertices",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobgraph/JobGraph.java#L304-L323 |
voldemort/voldemort | src/java/voldemort/client/rebalance/RebalancePlan.java | RebalancePlan.storageOverhead | private String storageOverhead(Map<Integer, Integer> finalNodeToOverhead) {
double maxOverhead = Double.MIN_VALUE;
PartitionBalance pb = new PartitionBalance(currentCluster, currentStoreDefs);
StringBuilder sb = new StringBuilder();
sb.append("Per-node store-overhead:").append(Utils.NEWLINE);
DecimalFormat doubleDf = new DecimalFormat("####.##");
for(int nodeId: finalCluster.getNodeIds()) {
Node node = finalCluster.getNodeById(nodeId);
String nodeTag = "Node " + String.format("%4d", nodeId) + " (" + node.getHost() + ")";
int initialLoad = 0;
if(currentCluster.getNodeIds().contains(nodeId)) {
initialLoad = pb.getNaryPartitionCount(nodeId);
}
int toLoad = 0;
if(finalNodeToOverhead.containsKey(nodeId)) {
toLoad = finalNodeToOverhead.get(nodeId);
}
double overhead = (initialLoad + toLoad) / (double) initialLoad;
if(initialLoad > 0 && maxOverhead < overhead) {
maxOverhead = overhead;
}
String loadTag = String.format("%6d", initialLoad) + " + "
+ String.format("%6d", toLoad) + " -> "
+ String.format("%6d", initialLoad + toLoad) + " ("
+ doubleDf.format(overhead) + " X)";
sb.append(nodeTag + " : " + loadTag).append(Utils.NEWLINE);
}
sb.append(Utils.NEWLINE)
.append("**** Max per-node storage overhead: " + doubleDf.format(maxOverhead) + " X.")
.append(Utils.NEWLINE);
return (sb.toString());
} | java | private String storageOverhead(Map<Integer, Integer> finalNodeToOverhead) {
double maxOverhead = Double.MIN_VALUE;
PartitionBalance pb = new PartitionBalance(currentCluster, currentStoreDefs);
StringBuilder sb = new StringBuilder();
sb.append("Per-node store-overhead:").append(Utils.NEWLINE);
DecimalFormat doubleDf = new DecimalFormat("####.##");
for(int nodeId: finalCluster.getNodeIds()) {
Node node = finalCluster.getNodeById(nodeId);
String nodeTag = "Node " + String.format("%4d", nodeId) + " (" + node.getHost() + ")";
int initialLoad = 0;
if(currentCluster.getNodeIds().contains(nodeId)) {
initialLoad = pb.getNaryPartitionCount(nodeId);
}
int toLoad = 0;
if(finalNodeToOverhead.containsKey(nodeId)) {
toLoad = finalNodeToOverhead.get(nodeId);
}
double overhead = (initialLoad + toLoad) / (double) initialLoad;
if(initialLoad > 0 && maxOverhead < overhead) {
maxOverhead = overhead;
}
String loadTag = String.format("%6d", initialLoad) + " + "
+ String.format("%6d", toLoad) + " -> "
+ String.format("%6d", initialLoad + toLoad) + " ("
+ doubleDf.format(overhead) + " X)";
sb.append(nodeTag + " : " + loadTag).append(Utils.NEWLINE);
}
sb.append(Utils.NEWLINE)
.append("**** Max per-node storage overhead: " + doubleDf.format(maxOverhead) + " X.")
.append(Utils.NEWLINE);
return (sb.toString());
} | [
"private",
"String",
"storageOverhead",
"(",
"Map",
"<",
"Integer",
",",
"Integer",
">",
"finalNodeToOverhead",
")",
"{",
"double",
"maxOverhead",
"=",
"Double",
".",
"MIN_VALUE",
";",
"PartitionBalance",
"pb",
"=",
"new",
"PartitionBalance",
"(",
"currentCluster"... | Determines storage overhead and returns pretty printed summary.
@param finalNodeToOverhead Map of node IDs from final cluster to number
of partition-stores to be moved to the node.
@return pretty printed string summary of storage overhead. | [
"Determines",
"storage",
"overhead",
"and",
"returns",
"pretty",
"printed",
"summary",
"."
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/rebalance/RebalancePlan.java#L235-L267 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/MergeRequestApi.java | MergeRequestApi.acceptMergeRequest | public MergeRequest acceptMergeRequest(Object projectIdOrPath, Integer mergeRequestIid) throws GitLabApiException {
return (acceptMergeRequest(projectIdOrPath, mergeRequestIid, null, null, null, null));
} | java | public MergeRequest acceptMergeRequest(Object projectIdOrPath, Integer mergeRequestIid) throws GitLabApiException {
return (acceptMergeRequest(projectIdOrPath, mergeRequestIid, null, null, null, null));
} | [
"public",
"MergeRequest",
"acceptMergeRequest",
"(",
"Object",
"projectIdOrPath",
",",
"Integer",
"mergeRequestIid",
")",
"throws",
"GitLabApiException",
"{",
"return",
"(",
"acceptMergeRequest",
"(",
"projectIdOrPath",
",",
"mergeRequestIid",
",",
"null",
",",
"null",
... | Merge changes to the merge request. If the MR has any conflicts and can not be merged,
you'll get a 405 and the error message 'Branch cannot be merged'. If merge request is
already merged or closed, you'll get a 406 and the error message 'Method Not Allowed'.
If the sha parameter is passed and does not match the HEAD of the source, you'll get
a 409 and the error message 'SHA does not match HEAD of source branch'. If you don't
have permissions to accept this merge request, you'll get a 401.
<p>NOTE: GitLab API V4 uses IID (internal ID), V3 uses ID to identify the merge request.</p>
<pre><code>GitLab Endpoint: PUT /projects/:id/merge_requests/:merge_request_iid/merge</code></pre>
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance
@param mergeRequestIid the internal ID of the merge request
@return the merged merge request
@throws GitLabApiException if any exception occurs | [
"Merge",
"changes",
"to",
"the",
"merge",
"request",
".",
"If",
"the",
"MR",
"has",
"any",
"conflicts",
"and",
"can",
"not",
"be",
"merged",
"you",
"ll",
"get",
"a",
"405",
"and",
"the",
"error",
"message",
"Branch",
"cannot",
"be",
"merged",
".",
"If"... | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/MergeRequestApi.java#L585-L587 |
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor | MapCore/src/main/java/org/wwarn/mapcore/client/components/customwidgets/map/MapBuilder.java | MapBuilder.configureMapDimension | public MapBuilder configureMapDimension(Integer width, Integer height) {
this.mapHeight = height;
this.mapWidth = width;
return this;
} | java | public MapBuilder configureMapDimension(Integer width, Integer height) {
this.mapHeight = height;
this.mapWidth = width;
return this;
} | [
"public",
"MapBuilder",
"configureMapDimension",
"(",
"Integer",
"width",
",",
"Integer",
"height",
")",
"{",
"this",
".",
"mapHeight",
"=",
"height",
";",
"this",
".",
"mapWidth",
"=",
"width",
";",
"return",
"this",
";",
"}"
] | Setup map display properties
@param width value in px
@param height value in px | [
"Setup",
"map",
"display",
"properties"
] | train | https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/MapCore/src/main/java/org/wwarn/mapcore/client/components/customwidgets/map/MapBuilder.java#L100-L104 |
apereo/cas | core/cas-server-core-tickets-api/src/main/java/org/apereo/cas/util/CoreTicketUtils.java | CoreTicketUtils.newTicketRegistryCipherExecutor | public static CipherExecutor newTicketRegistryCipherExecutor(final EncryptionRandomizedSigningJwtCryptographyProperties registry,
final String registryName) {
return newTicketRegistryCipherExecutor(registry, false, registryName);
} | java | public static CipherExecutor newTicketRegistryCipherExecutor(final EncryptionRandomizedSigningJwtCryptographyProperties registry,
final String registryName) {
return newTicketRegistryCipherExecutor(registry, false, registryName);
} | [
"public",
"static",
"CipherExecutor",
"newTicketRegistryCipherExecutor",
"(",
"final",
"EncryptionRandomizedSigningJwtCryptographyProperties",
"registry",
",",
"final",
"String",
"registryName",
")",
"{",
"return",
"newTicketRegistryCipherExecutor",
"(",
"registry",
",",
"false... | New ticket registry cipher executor cipher executor.
@param registry the registry
@param registryName the registry name
@return the cipher executor | [
"New",
"ticket",
"registry",
"cipher",
"executor",
"cipher",
"executor",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-tickets-api/src/main/java/org/apereo/cas/util/CoreTicketUtils.java#L29-L32 |
ehcache/ehcache3 | impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java | CacheConfigurationBuilder.withValueCopier | public CacheConfigurationBuilder<K, V> withValueCopier(Class<? extends Copier<V>> valueCopierClass) {
return withCopier(new DefaultCopierConfiguration<>(requireNonNull(valueCopierClass, "Null value copier class"), DefaultCopierConfiguration.Type.VALUE));
} | java | public CacheConfigurationBuilder<K, V> withValueCopier(Class<? extends Copier<V>> valueCopierClass) {
return withCopier(new DefaultCopierConfiguration<>(requireNonNull(valueCopierClass, "Null value copier class"), DefaultCopierConfiguration.Type.VALUE));
} | [
"public",
"CacheConfigurationBuilder",
"<",
"K",
",",
"V",
">",
"withValueCopier",
"(",
"Class",
"<",
"?",
"extends",
"Copier",
"<",
"V",
">",
">",
"valueCopierClass",
")",
"{",
"return",
"withCopier",
"(",
"new",
"DefaultCopierConfiguration",
"<>",
"(",
"requ... | Adds by-value semantic using the provided {@link Copier} class for the value on heap.
<p>
{@link Copier}s are what enable control of by-reference / by-value semantics for on-heap tier.
@param valueCopierClass the value copier class to use
@return a new builder with the added value copier | [
"Adds",
"by",
"-",
"value",
"semantic",
"using",
"the",
"provided",
"{",
"@link",
"Copier",
"}",
"class",
"for",
"the",
"value",
"on",
"heap",
".",
"<p",
">",
"{",
"@link",
"Copier",
"}",
"s",
"are",
"what",
"enable",
"control",
"of",
"by",
"-",
"ref... | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java#L444-L446 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/event/ProgressInputStream.java | ProgressInputStream.inputStreamForResponse | public static InputStream inputStreamForResponse(InputStream is, AmazonWebServiceRequest req) {
return req == null
? is
: new ResponseProgressInputStream(is, req.getGeneralProgressListener());
} | java | public static InputStream inputStreamForResponse(InputStream is, AmazonWebServiceRequest req) {
return req == null
? is
: new ResponseProgressInputStream(is, req.getGeneralProgressListener());
} | [
"public",
"static",
"InputStream",
"inputStreamForResponse",
"(",
"InputStream",
"is",
",",
"AmazonWebServiceRequest",
"req",
")",
"{",
"return",
"req",
"==",
"null",
"?",
"is",
":",
"new",
"ResponseProgressInputStream",
"(",
"is",
",",
"req",
".",
"getGeneralProg... | Returns an input stream for response progress tracking purposes. If
request/response progress tracking is not enabled, this method simply
return the given input stream as is.
@param is the response content input stream | [
"Returns",
"an",
"input",
"stream",
"for",
"response",
"progress",
"tracking",
"purposes",
".",
"If",
"request",
"/",
"response",
"progress",
"tracking",
"is",
"not",
"enabled",
"this",
"method",
"simply",
"return",
"the",
"given",
"input",
"stream",
"as",
"is... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/event/ProgressInputStream.java#L66-L70 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Trie2Writable.java | Trie2Writable.getDataBlock | private int getDataBlock(int c, boolean forLSCP) {
int i2, oldBlock, newBlock;
i2=getIndex2Block(c, forLSCP);
i2+=(c>>UTRIE2_SHIFT_2)&UTRIE2_INDEX_2_MASK;
oldBlock=index2[i2];
if(isWritableBlock(oldBlock)) {
return oldBlock;
}
/* allocate a new data block */
newBlock=allocDataBlock(oldBlock);
setIndex2Entry(i2, newBlock);
return newBlock;
} | java | private int getDataBlock(int c, boolean forLSCP) {
int i2, oldBlock, newBlock;
i2=getIndex2Block(c, forLSCP);
i2+=(c>>UTRIE2_SHIFT_2)&UTRIE2_INDEX_2_MASK;
oldBlock=index2[i2];
if(isWritableBlock(oldBlock)) {
return oldBlock;
}
/* allocate a new data block */
newBlock=allocDataBlock(oldBlock);
setIndex2Entry(i2, newBlock);
return newBlock;
} | [
"private",
"int",
"getDataBlock",
"(",
"int",
"c",
",",
"boolean",
"forLSCP",
")",
"{",
"int",
"i2",
",",
"oldBlock",
",",
"newBlock",
";",
"i2",
"=",
"getIndex2Block",
"(",
"c",
",",
"forLSCP",
")",
";",
"i2",
"+=",
"(",
"c",
">>",
"UTRIE2_SHIFT_2",
... | No error checking for illegal arguments.
@hide draft / provisional / internal are hidden on Android | [
"No",
"error",
"checking",
"for",
"illegal",
"arguments",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Trie2Writable.java#L273-L288 |
lessthanoptimal/ejml | main/ejml-zdense/src/org/ejml/dense/row/MatrixFeatures_ZDRM.java | MatrixFeatures_ZDRM.isLowerTriangle | public static boolean isLowerTriangle(ZMatrixRMaj A , int hessenberg , double tol ) {
tol *= tol;
for( int i = 0; i < A.numRows-hessenberg-1; i++ ) {
for( int j = i+hessenberg+1; j < A.numCols; j++ ) {
int index = (i*A.numCols+j)*2;
double real = A.data[index];
double imag = A.data[index+1];
double mag = real*real + imag*imag;
if( !(mag <= tol) ) {
return false;
}
}
}
return true;
} | java | public static boolean isLowerTriangle(ZMatrixRMaj A , int hessenberg , double tol ) {
tol *= tol;
for( int i = 0; i < A.numRows-hessenberg-1; i++ ) {
for( int j = i+hessenberg+1; j < A.numCols; j++ ) {
int index = (i*A.numCols+j)*2;
double real = A.data[index];
double imag = A.data[index+1];
double mag = real*real + imag*imag;
if( !(mag <= tol) ) {
return false;
}
}
}
return true;
} | [
"public",
"static",
"boolean",
"isLowerTriangle",
"(",
"ZMatrixRMaj",
"A",
",",
"int",
"hessenberg",
",",
"double",
"tol",
")",
"{",
"tol",
"*=",
"tol",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"A",
".",
"numRows",
"-",
"hessenberg",
"-"... | <p>
Checks to see if a matrix is lower triangular or Hessenberg. A Hessenberg matrix of degree N
has the following property:<br>
<br>
a<sub>ij</sub> ≤ 0 for all i < j+N<br>
<br>
A triangular matrix is a Hessenberg matrix of degree 0.
</p>
@param A Matrix being tested. Not modified.
@param hessenberg The degree of being hessenberg.
@param tol How close to zero the lower left elements need to be.
@return If it is an upper triangular/hessenberg matrix or not. | [
"<p",
">",
"Checks",
"to",
"see",
"if",
"a",
"matrix",
"is",
"lower",
"triangular",
"or",
"Hessenberg",
".",
"A",
"Hessenberg",
"matrix",
"of",
"degree",
"N",
"has",
"the",
"following",
"property",
":",
"<br",
">",
"<br",
">",
"a<sub",
">",
"ij<",
"/",... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/MatrixFeatures_ZDRM.java#L399-L415 |
buschmais/jqa-maven-plugin | src/main/java/com/buschmais/jqassistant/scm/maven/AbstractProjectMojo.java | AbstractProjectMojo.isLastModuleInProject | private boolean isLastModuleInProject(Set<MavenProject> executedModules, List<MavenProject> projectModules) {
Set<MavenProject> remainingModules = new HashSet<>();
if (execution.getPlugin().getExecutions().isEmpty()) {
getLog().debug("No configured executions found, assuming CLI invocation.");
remainingModules.addAll(projectModules);
} else {
for (MavenProject projectModule : projectModules) {
if (ProjectResolver.containsBuildPlugin(projectModule, execution.getPlugin())) {
remainingModules.add(projectModule);
}
}
}
remainingModules.removeAll(executedModules);
remainingModules.remove(currentProject);
if (remainingModules.isEmpty()) {
getLog().debug(
"Did not find any subsequent module with a plugin configuration."
+ " Will consider this module as the last one."
);
return true;
} else {
getLog().debug(
"Found " + remainingModules.size()
+ " subsequent modules possibly executing this plugin."
+ " Will NOT consider this module as the last one."
);
return false;
}
} | java | private boolean isLastModuleInProject(Set<MavenProject> executedModules, List<MavenProject> projectModules) {
Set<MavenProject> remainingModules = new HashSet<>();
if (execution.getPlugin().getExecutions().isEmpty()) {
getLog().debug("No configured executions found, assuming CLI invocation.");
remainingModules.addAll(projectModules);
} else {
for (MavenProject projectModule : projectModules) {
if (ProjectResolver.containsBuildPlugin(projectModule, execution.getPlugin())) {
remainingModules.add(projectModule);
}
}
}
remainingModules.removeAll(executedModules);
remainingModules.remove(currentProject);
if (remainingModules.isEmpty()) {
getLog().debug(
"Did not find any subsequent module with a plugin configuration."
+ " Will consider this module as the last one."
);
return true;
} else {
getLog().debug(
"Found " + remainingModules.size()
+ " subsequent modules possibly executing this plugin."
+ " Will NOT consider this module as the last one."
);
return false;
}
} | [
"private",
"boolean",
"isLastModuleInProject",
"(",
"Set",
"<",
"MavenProject",
">",
"executedModules",
",",
"List",
"<",
"MavenProject",
">",
"projectModules",
")",
"{",
"Set",
"<",
"MavenProject",
">",
"remainingModules",
"=",
"new",
"HashSet",
"<>",
"(",
")",... | Determines if the last module for a project is currently executed.
@param projectModules The modules of the project.
@return <code>true</code> if the current module is the last of the project. | [
"Determines",
"if",
"the",
"last",
"module",
"for",
"a",
"project",
"is",
"currently",
"executed",
"."
] | train | https://github.com/buschmais/jqa-maven-plugin/blob/5c21a8058fc1b013333081907fbf00d3525e11c3/src/main/java/com/buschmais/jqassistant/scm/maven/AbstractProjectMojo.java#L45-L73 |
VoltDB/voltdb | src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java | JDBC4DatabaseMetaData.getSuperTables | @Override
public ResultSet getSuperTables(String catalog, String schemaPattern, String tableNamePattern) throws SQLException
{
checkClosed();
throw SQLError.noSupport();
} | java | @Override
public ResultSet getSuperTables(String catalog, String schemaPattern, String tableNamePattern) throws SQLException
{
checkClosed();
throw SQLError.noSupport();
} | [
"@",
"Override",
"public",
"ResultSet",
"getSuperTables",
"(",
"String",
"catalog",
",",
"String",
"schemaPattern",
",",
"String",
"tableNamePattern",
")",
"throws",
"SQLException",
"{",
"checkClosed",
"(",
")",
";",
"throw",
"SQLError",
".",
"noSupport",
"(",
"... | Retrieves a description of the table hierarchies defined in a particular schema in this database. | [
"Retrieves",
"a",
"description",
"of",
"the",
"table",
"hierarchies",
"defined",
"in",
"a",
"particular",
"schema",
"in",
"this",
"database",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4DatabaseMetaData.java#L764-L769 |
lestard/advanced-bindings | src/main/java/eu/lestard/advanced_bindings/api/MathBindings.java | MathBindings.floorMod | public static IntegerBinding floorMod(final ObservableIntegerValue x, final ObservableIntegerValue y) {
return createIntegerBinding(() -> Math.floorMod(x.get(), y.get()), x, y);
} | java | public static IntegerBinding floorMod(final ObservableIntegerValue x, final ObservableIntegerValue y) {
return createIntegerBinding(() -> Math.floorMod(x.get(), y.get()), x, y);
} | [
"public",
"static",
"IntegerBinding",
"floorMod",
"(",
"final",
"ObservableIntegerValue",
"x",
",",
"final",
"ObservableIntegerValue",
"y",
")",
"{",
"return",
"createIntegerBinding",
"(",
"(",
")",
"->",
"Math",
".",
"floorMod",
"(",
"x",
".",
"get",
"(",
")"... | Binding for {@link java.lang.Math#floorMod(int, int)}
@param x the dividend
@param y the divisor
@return the floor modulus {@code x - (floorDiv(x, y) * y)}
@throws ArithmeticException if the divisor {@code y} is zero | [
"Binding",
"for",
"{",
"@link",
"java",
".",
"lang",
".",
"Math#floorMod",
"(",
"int",
"int",
")",
"}"
] | train | https://github.com/lestard/advanced-bindings/blob/054a5dde261c29f862b971765fa3da3704a13ab4/src/main/java/eu/lestard/advanced_bindings/api/MathBindings.java#L493-L495 |
duracloud/duracloud | snapshotstorageprovider/src/main/java/org/duracloud/snapshottask/snapshot/RequestRestoreSnapshotTaskRunner.java | RequestRestoreSnapshotTaskRunner.buildBridgeBody | protected String buildBridgeBody(String snapshotId,
String userEmail) {
RequestRestoreBridgeParameters bridgeParams =
new RequestRestoreBridgeParameters(dcHost, dcPort, dcStoreId, snapshotId, userEmail);
return bridgeParams.serialize();
} | java | protected String buildBridgeBody(String snapshotId,
String userEmail) {
RequestRestoreBridgeParameters bridgeParams =
new RequestRestoreBridgeParameters(dcHost, dcPort, dcStoreId, snapshotId, userEmail);
return bridgeParams.serialize();
} | [
"protected",
"String",
"buildBridgeBody",
"(",
"String",
"snapshotId",
",",
"String",
"userEmail",
")",
"{",
"RequestRestoreBridgeParameters",
"bridgeParams",
"=",
"new",
"RequestRestoreBridgeParameters",
"(",
"dcHost",
",",
"dcPort",
",",
"dcStoreId",
",",
"snapshotId"... | /*
Creates the body of the request that will be sent to the bridge app | [
"/",
"*",
"Creates",
"the",
"body",
"of",
"the",
"request",
"that",
"will",
"be",
"sent",
"to",
"the",
"bridge",
"app"
] | train | https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/snapshotstorageprovider/src/main/java/org/duracloud/snapshottask/snapshot/RequestRestoreSnapshotTaskRunner.java#L112-L117 |
virgo47/javasimon | jdbc41/src/main/java/org/javasimon/jdbc4/SimonConnectionConfiguration.java | SimonConnectionConfiguration.getProperty | private static String getProperty(String driverId, String propertyName) {
String propertyValue = PROPERTIES.getProperty(DEFAULT_PREFIX + "." + driverId + "." + propertyName);
if (propertyValue != null) {
propertyValue = propertyValue.trim();
if (propertyValue.isEmpty()) {
propertyValue = null;
}
}
return propertyValue;
} | java | private static String getProperty(String driverId, String propertyName) {
String propertyValue = PROPERTIES.getProperty(DEFAULT_PREFIX + "." + driverId + "." + propertyName);
if (propertyValue != null) {
propertyValue = propertyValue.trim();
if (propertyValue.isEmpty()) {
propertyValue = null;
}
}
return propertyValue;
} | [
"private",
"static",
"String",
"getProperty",
"(",
"String",
"driverId",
",",
"String",
"propertyName",
")",
"{",
"String",
"propertyValue",
"=",
"PROPERTIES",
".",
"getProperty",
"(",
"DEFAULT_PREFIX",
"+",
"\".\"",
"+",
"driverId",
"+",
"\".\"",
"+",
"property... | Gets value of the specified property.
@param driverId Driver Id
@param propertyName Property name
@return property value or {@code null} | [
"Gets",
"value",
"of",
"the",
"specified",
"property",
"."
] | train | https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/jdbc41/src/main/java/org/javasimon/jdbc4/SimonConnectionConfiguration.java#L156-L165 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java | JBBPTextWriter.Double | public JBBPTextWriter Double(final double[] values, int off, int len) throws IOException {
while (len-- > 0) {
this.Double(values[off++]);
}
return this;
} | java | public JBBPTextWriter Double(final double[] values, int off, int len) throws IOException {
while (len-- > 0) {
this.Double(values[off++]);
}
return this;
} | [
"public",
"JBBPTextWriter",
"Double",
"(",
"final",
"double",
"[",
"]",
"values",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"while",
"(",
"len",
"--",
">",
"0",
")",
"{",
"this",
".",
"Double",
"(",
"values",
"[",
"off"... | Print values from double array
@param values double value array, must not be null
@param off offset to the first element
@param len number of elements to print
@return the context
@throws IOException it will be thrown for transport error
@since 1.4.0 | [
"Print",
"values",
"from",
"double",
"array"
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPTextWriter.java#L991-L996 |
ManfredTremmel/gwt-bean-validators | mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/EmptyIfOtherHasValueValidator.java | EmptyIfOtherHasValueValidator.isValid | @Override
public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
if (pvalue == null) {
return true;
}
try {
final String fieldCheckValue =
BeanPropertyReaderUtil.getNullSaveStringProperty(pvalue, fieldCheckName);
final String fieldCompareValue =
BeanPropertyReaderUtil.getNullSaveStringProperty(pvalue, fieldCompareName);
if (StringUtils.isNotEmpty(fieldCheckValue)
&& StringUtils.equals(valueCompare, fieldCompareValue)) {
switchContext(pcontext);
return false;
}
return true;
} catch (final Exception ignore) {
switchContext(pcontext);
return false;
}
} | java | @Override
public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
if (pvalue == null) {
return true;
}
try {
final String fieldCheckValue =
BeanPropertyReaderUtil.getNullSaveStringProperty(pvalue, fieldCheckName);
final String fieldCompareValue =
BeanPropertyReaderUtil.getNullSaveStringProperty(pvalue, fieldCompareName);
if (StringUtils.isNotEmpty(fieldCheckValue)
&& StringUtils.equals(valueCompare, fieldCompareValue)) {
switchContext(pcontext);
return false;
}
return true;
} catch (final Exception ignore) {
switchContext(pcontext);
return false;
}
} | [
"@",
"Override",
"public",
"final",
"boolean",
"isValid",
"(",
"final",
"Object",
"pvalue",
",",
"final",
"ConstraintValidatorContext",
"pcontext",
")",
"{",
"if",
"(",
"pvalue",
"==",
"null",
")",
"{",
"return",
"true",
";",
"}",
"try",
"{",
"final",
"Str... | {@inheritDoc} check if given object is valid.
@see javax.validation.ConstraintValidator#isValid(Object,
javax.validation.ConstraintValidatorContext) | [
"{",
"@inheritDoc",
"}",
"check",
"if",
"given",
"object",
"is",
"valid",
"."
] | train | https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/EmptyIfOtherHasValueValidator.java#L72-L92 |
ogaclejapan/SmartTabLayout | utils-v4/src/main/java/com/ogaclejapan/smarttablayout/utils/v4/Bundler.java | Bundler.putCharSequenceArray | @TargetApi(8)
public Bundler putCharSequenceArray(String key, CharSequence[] value) {
bundle.putCharSequenceArray(key, value);
return this;
} | java | @TargetApi(8)
public Bundler putCharSequenceArray(String key, CharSequence[] value) {
bundle.putCharSequenceArray(key, value);
return this;
} | [
"@",
"TargetApi",
"(",
"8",
")",
"public",
"Bundler",
"putCharSequenceArray",
"(",
"String",
"key",
",",
"CharSequence",
"[",
"]",
"value",
")",
"{",
"bundle",
".",
"putCharSequenceArray",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Inserts a CharSequence array value into the mapping of this Bundle, replacing
any existing value for the given key. Either key or value may be null.
@param key a String, or null
@param value a CharSequence array object, or null
@return this | [
"Inserts",
"a",
"CharSequence",
"array",
"value",
"into",
"the",
"mapping",
"of",
"this",
"Bundle",
"replacing",
"any",
"existing",
"value",
"for",
"the",
"given",
"key",
".",
"Either",
"key",
"or",
"value",
"may",
"be",
"null",
"."
] | train | https://github.com/ogaclejapan/SmartTabLayout/blob/712e81a92f1e12a3c33dcbda03d813e0162e8589/utils-v4/src/main/java/com/ogaclejapan/smarttablayout/utils/v4/Bundler.java#L330-L334 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/jdk8/Jdk8Methods.java | Jdk8Methods.safeAdd | public static int safeAdd(int a, int b) {
int sum = a + b;
// check for a change of sign in the result when the inputs have the same sign
if ((a ^ sum) < 0 && (a ^ b) >= 0) {
throw new ArithmeticException("Addition overflows an int: " + a + " + " + b);
}
return sum;
} | java | public static int safeAdd(int a, int b) {
int sum = a + b;
// check for a change of sign in the result when the inputs have the same sign
if ((a ^ sum) < 0 && (a ^ b) >= 0) {
throw new ArithmeticException("Addition overflows an int: " + a + " + " + b);
}
return sum;
} | [
"public",
"static",
"int",
"safeAdd",
"(",
"int",
"a",
",",
"int",
"b",
")",
"{",
"int",
"sum",
"=",
"a",
"+",
"b",
";",
"// check for a change of sign in the result when the inputs have the same sign",
"if",
"(",
"(",
"a",
"^",
"sum",
")",
"<",
"0",
"&&",
... | Safely adds two int values.
@param a the first value
@param b the second value
@return the result
@throws ArithmeticException if the result overflows an int | [
"Safely",
"adds",
"two",
"int",
"values",
"."
] | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/jdk8/Jdk8Methods.java#L145-L152 |
tango-controls/JTango | client/src/main/java/fr/soleil/tango/clientapi/TangoCommand.java | TangoCommand.executeExtractList | public <T> List<T> executeExtractList(final Class<T> clazz, final Object... value) throws DevFailed {
final Object result = command.executeExtract(value);
return extractList(TypeConversionUtil.castToArray(clazz, result));
} | java | public <T> List<T> executeExtractList(final Class<T> clazz, final Object... value) throws DevFailed {
final Object result = command.executeExtract(value);
return extractList(TypeConversionUtil.castToArray(clazz, result));
} | [
"public",
"<",
"T",
">",
"List",
"<",
"T",
">",
"executeExtractList",
"(",
"final",
"Class",
"<",
"T",
">",
"clazz",
",",
"final",
"Object",
"...",
"value",
")",
"throws",
"DevFailed",
"{",
"final",
"Object",
"result",
"=",
"command",
".",
"executeExtrac... | Execute a command with argin which is an array
@param <T>
@param clazz
@param value
@return
@throws DevFailed | [
"Execute",
"a",
"command",
"with",
"argin",
"which",
"is",
"an",
"array"
] | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/clientapi/TangoCommand.java#L204-L207 |
Azure/azure-sdk-for-java | mixedreality/resource-manager/v2019_02_28_preview/src/main/java/com/microsoft/azure/management/mixedreality/v2019_02_28_preview/implementation/SpatialAnchorsAccountsInner.java | SpatialAnchorsAccountsInner.update | public SpatialAnchorsAccountInner update(String resourceGroupName, String spatialAnchorsAccountName, SpatialAnchorsAccountInner spatialAnchorsAccount) {
return updateWithServiceResponseAsync(resourceGroupName, spatialAnchorsAccountName, spatialAnchorsAccount).toBlocking().single().body();
} | java | public SpatialAnchorsAccountInner update(String resourceGroupName, String spatialAnchorsAccountName, SpatialAnchorsAccountInner spatialAnchorsAccount) {
return updateWithServiceResponseAsync(resourceGroupName, spatialAnchorsAccountName, spatialAnchorsAccount).toBlocking().single().body();
} | [
"public",
"SpatialAnchorsAccountInner",
"update",
"(",
"String",
"resourceGroupName",
",",
"String",
"spatialAnchorsAccountName",
",",
"SpatialAnchorsAccountInner",
"spatialAnchorsAccount",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"sp... | Updating a Spatial Anchors Account.
@param resourceGroupName Name of an Azure resource group.
@param spatialAnchorsAccountName Name of an Mixed Reality Spatial Anchors Account.
@param spatialAnchorsAccount Spatial Anchors Account parameter.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the SpatialAnchorsAccountInner object if successful. | [
"Updating",
"a",
"Spatial",
"Anchors",
"Account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mixedreality/resource-manager/v2019_02_28_preview/src/main/java/com/microsoft/azure/management/mixedreality/v2019_02_28_preview/implementation/SpatialAnchorsAccountsInner.java#L517-L519 |
apache/incubator-gobblin | gobblin-service/src/main/java/org/apache/gobblin/service/modules/template/StaticFlowTemplate.java | StaticFlowTemplate.isResolvable | @Override
public boolean isResolvable(Config userConfig, DatasetDescriptor inputDescriptor, DatasetDescriptor outputDescriptor)
throws SpecNotFoundException, JobTemplate.TemplateException {
Config inputDescriptorConfig = inputDescriptor.getRawConfig().atPath(DatasetDescriptorConfigKeys.FLOW_EDGE_INPUT_DATASET_DESCRIPTOR_PREFIX);
Config outputDescriptorConfig = outputDescriptor.getRawConfig().atPath(DatasetDescriptorConfigKeys.FLOW_EDGE_OUTPUT_DATASET_DESCRIPTOR_PREFIX);
userConfig = userConfig.withFallback(inputDescriptorConfig).withFallback(outputDescriptorConfig);
ConfigResolveOptions resolveOptions = ConfigResolveOptions.defaults().setAllowUnresolved(true);
for (JobTemplate template: this.jobTemplates) {
Config templateConfig = template.getResolvedConfig(userConfig).resolve(resolveOptions);
if (!template.getResolvedConfig(userConfig).resolve(resolveOptions).isResolved()) {
return false;
}
}
return true;
} | java | @Override
public boolean isResolvable(Config userConfig, DatasetDescriptor inputDescriptor, DatasetDescriptor outputDescriptor)
throws SpecNotFoundException, JobTemplate.TemplateException {
Config inputDescriptorConfig = inputDescriptor.getRawConfig().atPath(DatasetDescriptorConfigKeys.FLOW_EDGE_INPUT_DATASET_DESCRIPTOR_PREFIX);
Config outputDescriptorConfig = outputDescriptor.getRawConfig().atPath(DatasetDescriptorConfigKeys.FLOW_EDGE_OUTPUT_DATASET_DESCRIPTOR_PREFIX);
userConfig = userConfig.withFallback(inputDescriptorConfig).withFallback(outputDescriptorConfig);
ConfigResolveOptions resolveOptions = ConfigResolveOptions.defaults().setAllowUnresolved(true);
for (JobTemplate template: this.jobTemplates) {
Config templateConfig = template.getResolvedConfig(userConfig).resolve(resolveOptions);
if (!template.getResolvedConfig(userConfig).resolve(resolveOptions).isResolved()) {
return false;
}
}
return true;
} | [
"@",
"Override",
"public",
"boolean",
"isResolvable",
"(",
"Config",
"userConfig",
",",
"DatasetDescriptor",
"inputDescriptor",
",",
"DatasetDescriptor",
"outputDescriptor",
")",
"throws",
"SpecNotFoundException",
",",
"JobTemplate",
".",
"TemplateException",
"{",
"Config... | Checks if the {@link FlowTemplate} is resolvable using the provided {@link Config} object. A {@link FlowTemplate}
is resolvable only if each of the {@link JobTemplate}s in the flow is resolvable
@param userConfig User supplied Config
@return true if the {@link FlowTemplate} is resolvable | [
"Checks",
"if",
"the",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-service/src/main/java/org/apache/gobblin/service/modules/template/StaticFlowTemplate.java#L155-L171 |
andrehertwig/admintool | admin-tools-log4j2/src/main/java/de/chandre/admintool/log4j2/AdminToolLog4j2Util.java | AdminToolLog4j2Util.changeLogger | public void changeLogger(final String name, final String levelStr, boolean parent) throws IllegalArgumentException
{
Level level = getLevel(levelStr);
changeLogger(name, level, parent);
} | java | public void changeLogger(final String name, final String levelStr, boolean parent) throws IllegalArgumentException
{
Level level = getLevel(levelStr);
changeLogger(name, level, parent);
} | [
"public",
"void",
"changeLogger",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"levelStr",
",",
"boolean",
"parent",
")",
"throws",
"IllegalArgumentException",
"{",
"Level",
"level",
"=",
"getLevel",
"(",
"levelStr",
")",
";",
"changeLogger",
"(",
"... | changes the level of an logger
@param name logger name
@param levelStr level as string
@param parent if the logger is a parent logger
@throws IllegalArgumentException | [
"changes",
"the",
"level",
"of",
"an",
"logger"
] | train | https://github.com/andrehertwig/admintool/blob/6d391e2d26969b70e3ccabfc34202abe8d915080/admin-tools-log4j2/src/main/java/de/chandre/admintool/log4j2/AdminToolLog4j2Util.java#L215-L219 |
calimero-project/calimero-core | src/tuwien/auto/calimero/mgmt/TransportLayerImpl.java | TransportLayerImpl.createDestination | @Override
public Destination createDestination(final IndividualAddress remote,
final boolean connectionOriented, final boolean keepAlive, final boolean verifyMode)
{
if (detached)
throw new IllegalStateException("TL detached");
synchronized (proxies) {
if (proxies.containsKey(remote))
throw new KNXIllegalArgumentException("destination already created: " + remote);
final AggregatorProxy p = new AggregatorProxy(this);
final Destination d = new Destination(p, remote, connectionOriented, keepAlive, verifyMode);
proxies.put(remote, p);
logger.trace("created {} destination for {}", (connectionOriented ? "co" : "cl"), remote);
return d;
}
} | java | @Override
public Destination createDestination(final IndividualAddress remote,
final boolean connectionOriented, final boolean keepAlive, final boolean verifyMode)
{
if (detached)
throw new IllegalStateException("TL detached");
synchronized (proxies) {
if (proxies.containsKey(remote))
throw new KNXIllegalArgumentException("destination already created: " + remote);
final AggregatorProxy p = new AggregatorProxy(this);
final Destination d = new Destination(p, remote, connectionOriented, keepAlive, verifyMode);
proxies.put(remote, p);
logger.trace("created {} destination for {}", (connectionOriented ? "co" : "cl"), remote);
return d;
}
} | [
"@",
"Override",
"public",
"Destination",
"createDestination",
"(",
"final",
"IndividualAddress",
"remote",
",",
"final",
"boolean",
"connectionOriented",
",",
"final",
"boolean",
"keepAlive",
",",
"final",
"boolean",
"verifyMode",
")",
"{",
"if",
"(",
"detached",
... | {@inheritDoc} Only one destination can be created per remote address. If a
destination with the supplied remote address already exists for this transport
layer, a {@link KNXIllegalArgumentException} is thrown.<br>
A transport layer can only handle one connection per destination, because it can't
distinguish incoming messages between more than one connection. | [
"{"
] | train | https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/mgmt/TransportLayerImpl.java#L233-L248 |
rapidpro/expressions | java/src/main/java/io/rapidpro/expressions/functions/ExcelFunctions.java | ExcelFunctions.datedif | public static int datedif(EvaluationContext ctx, Object startDate, Object endDate, Object unit) {
LocalDate _startDate = Conversions.toDate(startDate, ctx);
LocalDate _endDate = Conversions.toDate(endDate, ctx);
String _unit = Conversions.toString(unit, ctx).toLowerCase();
if (_startDate.isAfter(_endDate)) {
throw new RuntimeException("Start date cannot be after end date");
}
switch (_unit) {
case "y":
return (int) ChronoUnit.YEARS.between(_startDate, _endDate);
case "m":
return (int) ChronoUnit.MONTHS.between(_startDate, _endDate);
case "d":
return (int) ChronoUnit.DAYS.between(_startDate, _endDate);
case "md":
return Period.between(_startDate, _endDate).getDays();
case "ym":
return Period.between(_startDate, _endDate).getMonths();
case "yd":
return (int) ChronoUnit.DAYS.between(_startDate.withYear(_endDate.getYear()), _endDate);
}
throw new RuntimeException("Invalid unit value: " + _unit);
} | java | public static int datedif(EvaluationContext ctx, Object startDate, Object endDate, Object unit) {
LocalDate _startDate = Conversions.toDate(startDate, ctx);
LocalDate _endDate = Conversions.toDate(endDate, ctx);
String _unit = Conversions.toString(unit, ctx).toLowerCase();
if (_startDate.isAfter(_endDate)) {
throw new RuntimeException("Start date cannot be after end date");
}
switch (_unit) {
case "y":
return (int) ChronoUnit.YEARS.between(_startDate, _endDate);
case "m":
return (int) ChronoUnit.MONTHS.between(_startDate, _endDate);
case "d":
return (int) ChronoUnit.DAYS.between(_startDate, _endDate);
case "md":
return Period.between(_startDate, _endDate).getDays();
case "ym":
return Period.between(_startDate, _endDate).getMonths();
case "yd":
return (int) ChronoUnit.DAYS.between(_startDate.withYear(_endDate.getYear()), _endDate);
}
throw new RuntimeException("Invalid unit value: " + _unit);
} | [
"public",
"static",
"int",
"datedif",
"(",
"EvaluationContext",
"ctx",
",",
"Object",
"startDate",
",",
"Object",
"endDate",
",",
"Object",
"unit",
")",
"{",
"LocalDate",
"_startDate",
"=",
"Conversions",
".",
"toDate",
"(",
"startDate",
",",
"ctx",
")",
";"... | Calculates the number of days, months, or years between two dates. | [
"Calculates",
"the",
"number",
"of",
"days",
"months",
"or",
"years",
"between",
"two",
"dates",
"."
] | train | https://github.com/rapidpro/expressions/blob/b03d91ec58fc328960bce90ecb5fa49dcf467627/java/src/main/java/io/rapidpro/expressions/functions/ExcelFunctions.java#L214-L239 |
JOML-CI/JOML | src/org/joml/Matrix4x3f.java | Matrix4x3f.setTranslation | public Matrix4x3f setTranslation(float x, float y, float z) {
m30 = x;
m31 = y;
m32 = z;
properties &= ~(PROPERTY_IDENTITY);
return this;
} | java | public Matrix4x3f setTranslation(float x, float y, float z) {
m30 = x;
m31 = y;
m32 = z;
properties &= ~(PROPERTY_IDENTITY);
return this;
} | [
"public",
"Matrix4x3f",
"setTranslation",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
")",
"{",
"m30",
"=",
"x",
";",
"m31",
"=",
"y",
";",
"m32",
"=",
"z",
";",
"properties",
"&=",
"~",
"(",
"PROPERTY_IDENTITY",
")",
";",
"return",
"t... | Set only the translation components <code>(m30, m31, m32)</code> of this matrix to the given values <code>(x, y, z)</code>.
<p>
To build a translation matrix instead, use {@link #translation(float, float, float)}.
To apply a translation, use {@link #translate(float, float, float)}.
@see #translation(float, float, float)
@see #translate(float, float, float)
@param x
the offset to translate in x
@param y
the offset to translate in y
@param z
the offset to translate in z
@return this | [
"Set",
"only",
"the",
"translation",
"components",
"<code",
">",
"(",
"m30",
"m31",
"m32",
")",
"<",
"/",
"code",
">",
"of",
"this",
"matrix",
"to",
"the",
"given",
"values",
"<code",
">",
"(",
"x",
"y",
"z",
")",
"<",
"/",
"code",
">",
".",
"<p"... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L1610-L1616 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/mail/MailUtil.java | MailUtil.send | public static void send(Collection<String> tos, String subject, String content, boolean isHtml, File... files) {
send(GlobalMailAccount.INSTANCE.getAccount(), tos, subject, content, isHtml, files);
} | java | public static void send(Collection<String> tos, String subject, String content, boolean isHtml, File... files) {
send(GlobalMailAccount.INSTANCE.getAccount(), tos, subject, content, isHtml, files);
} | [
"public",
"static",
"void",
"send",
"(",
"Collection",
"<",
"String",
">",
"tos",
",",
"String",
"subject",
",",
"String",
"content",
",",
"boolean",
"isHtml",
",",
"File",
"...",
"files",
")",
"{",
"send",
"(",
"GlobalMailAccount",
".",
"INSTANCE",
".",
... | 使用配置文件中设置的账户发送邮件,发送给多人
@param tos 收件人列表
@param subject 标题
@param content 正文
@param isHtml 是否为HTML
@param files 附件列表 | [
"使用配置文件中设置的账户发送邮件,发送给多人"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/mail/MailUtil.java#L111-L113 |
aws/aws-sdk-java | aws-java-sdk-kinesisvideo/src/main/java/com/amazonaws/services/kinesisvideo/model/transform/AckEventUnmarshaller.java | AckEventUnmarshaller.getTextField | private String getTextField(JsonNode json, String fieldName) {
if (!json.has(fieldName)) {
return null;
}
return json.get(fieldName).asText();
} | java | private String getTextField(JsonNode json, String fieldName) {
if (!json.has(fieldName)) {
return null;
}
return json.get(fieldName).asText();
} | [
"private",
"String",
"getTextField",
"(",
"JsonNode",
"json",
",",
"String",
"fieldName",
")",
"{",
"if",
"(",
"!",
"json",
".",
"has",
"(",
"fieldName",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"json",
".",
"get",
"(",
"fieldName",
")",
... | Get a String field from the JSON.
@param json JSON document.
@param fieldName Field name to get.
@return String value of field or null if not present. | [
"Get",
"a",
"String",
"field",
"from",
"the",
"JSON",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-kinesisvideo/src/main/java/com/amazonaws/services/kinesisvideo/model/transform/AckEventUnmarshaller.java#L57-L62 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.purgeDeletedCertificateAsync | public ServiceFuture<Void> purgeDeletedCertificateAsync(String vaultBaseUrl, String certificateName, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(purgeDeletedCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName), serviceCallback);
} | java | public ServiceFuture<Void> purgeDeletedCertificateAsync(String vaultBaseUrl, String certificateName, final ServiceCallback<Void> serviceCallback) {
return ServiceFuture.fromResponse(purgeDeletedCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"Void",
">",
"purgeDeletedCertificateAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"certificateName",
",",
"final",
"ServiceCallback",
"<",
"Void",
">",
"serviceCallback",
")",
"{",
"return",
"ServiceFuture",
".",
"fromResponse"... | Permanently deletes the specified deleted certificate.
The PurgeDeletedCertificate operation performs an irreversible deletion of the specified certificate, without possibility for recovery. The operation is not available if the recovery level does not specify 'Purgeable'. This operation requires the certificate/purge permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param certificateName The name of the certificate
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Permanently",
"deletes",
"the",
"specified",
"deleted",
"certificate",
".",
"The",
"PurgeDeletedCertificate",
"operation",
"performs",
"an",
"irreversible",
"deletion",
"of",
"the",
"specified",
"certificate",
"without",
"possibility",
"for",
"recovery",
".",
"The",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L8635-L8637 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/ReferrerURLCookieHandler.java | ReferrerURLCookieHandler.setReferrerURLCookie | public void setReferrerURLCookie(HttpServletRequest req, AuthenticationResult authResult, String url) {
//PM81345: If the URL contains favicon, then we will not update the value of the ReffererURL. The only way
//we will do it, is if the value of the cookie is null. This will solve the Error 500.
if (url.contains("/favicon.ico") && CookieHelper.getCookieValue(req.getCookies(), REFERRER_URL_COOKIENAME) != null) {
if (tc.isDebugEnabled())
Tr.debug(tc, "Will not update the WASReqURL cookie");
} else {
if (!webAppSecConfig.getPreserveFullyQualifiedReferrerUrl()) {
url = removeHostNameFromURL(url);
}
url = encodeURL(url);
authResult.setCookie(createReferrerUrlCookie(req, url));
if (tc.isDebugEnabled()) {
Tr.debug(tc, "set " + REFERRER_URL_COOKIENAME + " cookie into AuthenticationResult.");
Tr.debug(tc, "setReferrerURLCookie", "Referrer URL cookie set " + url);
}
}
} | java | public void setReferrerURLCookie(HttpServletRequest req, AuthenticationResult authResult, String url) {
//PM81345: If the URL contains favicon, then we will not update the value of the ReffererURL. The only way
//we will do it, is if the value of the cookie is null. This will solve the Error 500.
if (url.contains("/favicon.ico") && CookieHelper.getCookieValue(req.getCookies(), REFERRER_URL_COOKIENAME) != null) {
if (tc.isDebugEnabled())
Tr.debug(tc, "Will not update the WASReqURL cookie");
} else {
if (!webAppSecConfig.getPreserveFullyQualifiedReferrerUrl()) {
url = removeHostNameFromURL(url);
}
url = encodeURL(url);
authResult.setCookie(createReferrerUrlCookie(req, url));
if (tc.isDebugEnabled()) {
Tr.debug(tc, "set " + REFERRER_URL_COOKIENAME + " cookie into AuthenticationResult.");
Tr.debug(tc, "setReferrerURLCookie", "Referrer URL cookie set " + url);
}
}
} | [
"public",
"void",
"setReferrerURLCookie",
"(",
"HttpServletRequest",
"req",
",",
"AuthenticationResult",
"authResult",
",",
"String",
"url",
")",
"{",
"//PM81345: If the URL contains favicon, then we will not update the value of the ReffererURL. The only way",
"//we will do it, is if t... | Sets the referrer URL cookie into the AuthenticationResult. If
PRESERVE_FULLY_QUALIFIED_REFERRER_URL is not set, or set to false,
then the host name of the referrer URL is removed.
@param authResult AuthenticationResult instance
@param url non-null URL String
@param securityConfig SecurityConfig instance | [
"Sets",
"the",
"referrer",
"URL",
"cookie",
"into",
"the",
"AuthenticationResult",
".",
"If",
"PRESERVE_FULLY_QUALIFIED_REFERRER_URL",
"is",
"not",
"set",
"or",
"set",
"to",
"false",
"then",
"the",
"host",
"name",
"of",
"the",
"referrer",
"URL",
"is",
"removed",... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/ReferrerURLCookieHandler.java#L221-L238 |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/remote/BaseAugmenter.java | BaseAugmenter.augment | public WebDriver augment(WebDriver driver) {
RemoteWebDriver remoteDriver = extractRemoteWebDriver(driver);
if (remoteDriver == null) {
return driver;
}
return create(remoteDriver, driverAugmentors, driver);
} | java | public WebDriver augment(WebDriver driver) {
RemoteWebDriver remoteDriver = extractRemoteWebDriver(driver);
if (remoteDriver == null) {
return driver;
}
return create(remoteDriver, driverAugmentors, driver);
} | [
"public",
"WebDriver",
"augment",
"(",
"WebDriver",
"driver",
")",
"{",
"RemoteWebDriver",
"remoteDriver",
"=",
"extractRemoteWebDriver",
"(",
"driver",
")",
";",
"if",
"(",
"remoteDriver",
"==",
"null",
")",
"{",
"return",
"driver",
";",
"}",
"return",
"creat... | Enhance the interfaces implemented by this instance of WebDriver iff that instance is a
{@link org.openqa.selenium.remote.RemoteWebDriver}.
The WebDriver that is returned may well be a dynamic proxy. You cannot rely on the concrete
implementing class to remain constant.
@param driver The driver to enhance
@return A class implementing the described interfaces. | [
"Enhance",
"the",
"interfaces",
"implemented",
"by",
"this",
"instance",
"of",
"WebDriver",
"iff",
"that",
"instance",
"is",
"a",
"{",
"@link",
"org",
".",
"openqa",
".",
"selenium",
".",
"remote",
".",
"RemoteWebDriver",
"}",
"."
] | train | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/remote/BaseAugmenter.java#L92-L98 |
wildfly/wildfly-core | controller/src/main/java/org/jboss/as/controller/transform/description/AbstractTransformationDescriptionBuilder.java | AbstractTransformationDescriptionBuilder.buildDefault | protected TransformationDescription buildDefault(final DiscardPolicy discardPolicy, boolean inherited, final AttributeTransformationDescriptionBuilderImpl.AttributeTransformationDescriptionBuilderRegistry registry, List<String> discardedOperations) {
// Build attribute rules
final Map<String, AttributeTransformationDescription> attributes = registry.buildAttributes();
// Create operation transformers
final Map<String, OperationTransformer> operations = buildOperationTransformers(registry);
// Process children
final List<TransformationDescription> children = buildChildren();
if (discardPolicy == DiscardPolicy.NEVER) {
// TODO override more global operations?
if(! operations.containsKey(ModelDescriptionConstants.WRITE_ATTRIBUTE_OPERATION)) {
operations.put(ModelDescriptionConstants.WRITE_ATTRIBUTE_OPERATION, OperationTransformationRules.createWriteOperation(attributes));
}
if(! operations.containsKey(ModelDescriptionConstants.UNDEFINE_ATTRIBUTE_OPERATION)) {
operations.put(ModelDescriptionConstants.UNDEFINE_ATTRIBUTE_OPERATION, OperationTransformationRules.createUndefinedOperation(attributes));
}
}
// Create the description
Set<String> discarded = new HashSet<>();
discarded.addAll(discardedOperations);
return new TransformingDescription(pathElement, pathAddressTransformer, discardPolicy, inherited,
resourceTransformer, attributes, operations, children, discarded, dynamicDiscardPolicy);
} | java | protected TransformationDescription buildDefault(final DiscardPolicy discardPolicy, boolean inherited, final AttributeTransformationDescriptionBuilderImpl.AttributeTransformationDescriptionBuilderRegistry registry, List<String> discardedOperations) {
// Build attribute rules
final Map<String, AttributeTransformationDescription> attributes = registry.buildAttributes();
// Create operation transformers
final Map<String, OperationTransformer> operations = buildOperationTransformers(registry);
// Process children
final List<TransformationDescription> children = buildChildren();
if (discardPolicy == DiscardPolicy.NEVER) {
// TODO override more global operations?
if(! operations.containsKey(ModelDescriptionConstants.WRITE_ATTRIBUTE_OPERATION)) {
operations.put(ModelDescriptionConstants.WRITE_ATTRIBUTE_OPERATION, OperationTransformationRules.createWriteOperation(attributes));
}
if(! operations.containsKey(ModelDescriptionConstants.UNDEFINE_ATTRIBUTE_OPERATION)) {
operations.put(ModelDescriptionConstants.UNDEFINE_ATTRIBUTE_OPERATION, OperationTransformationRules.createUndefinedOperation(attributes));
}
}
// Create the description
Set<String> discarded = new HashSet<>();
discarded.addAll(discardedOperations);
return new TransformingDescription(pathElement, pathAddressTransformer, discardPolicy, inherited,
resourceTransformer, attributes, operations, children, discarded, dynamicDiscardPolicy);
} | [
"protected",
"TransformationDescription",
"buildDefault",
"(",
"final",
"DiscardPolicy",
"discardPolicy",
",",
"boolean",
"inherited",
",",
"final",
"AttributeTransformationDescriptionBuilderImpl",
".",
"AttributeTransformationDescriptionBuilderRegistry",
"registry",
",",
"List",
... | Build the default transformation description.
@param discardPolicy the discard policy to use
@param inherited whether the definition is inherited
@param registry the attribute transformation rules for the resource
@param discardedOperations the discarded operations
@return the transformation description | [
"Build",
"the",
"default",
"transformation",
"description",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/transform/description/AbstractTransformationDescriptionBuilder.java#L87-L109 |
grpc/grpc-java | examples/android/clientcache/app/src/main/java/io/grpc/clientcacheexample/SafeMethodCachingInterceptor.java | SafeMethodCachingInterceptor.newLruCache | public static Cache newLruCache(final int cacheSizeInBytes) {
return new Cache() {
private final LruCache<Key, Value> lruCache =
new LruCache<Key, Value>(cacheSizeInBytes) {
protected int sizeOf(Key key, Value value) {
return value.response.getSerializedSize();
}
};
@Override
public void put(Key key, Value value) {
lruCache.put(key, value);
}
@Override
public Value get(Key key) {
return lruCache.get(key);
}
@Override
public void remove(Key key) {
lruCache.remove(key);
}
@Override
public void clear() {
lruCache.evictAll();
}
};
} | java | public static Cache newLruCache(final int cacheSizeInBytes) {
return new Cache() {
private final LruCache<Key, Value> lruCache =
new LruCache<Key, Value>(cacheSizeInBytes) {
protected int sizeOf(Key key, Value value) {
return value.response.getSerializedSize();
}
};
@Override
public void put(Key key, Value value) {
lruCache.put(key, value);
}
@Override
public Value get(Key key) {
return lruCache.get(key);
}
@Override
public void remove(Key key) {
lruCache.remove(key);
}
@Override
public void clear() {
lruCache.evictAll();
}
};
} | [
"public",
"static",
"Cache",
"newLruCache",
"(",
"final",
"int",
"cacheSizeInBytes",
")",
"{",
"return",
"new",
"Cache",
"(",
")",
"{",
"private",
"final",
"LruCache",
"<",
"Key",
",",
"Value",
">",
"lruCache",
"=",
"new",
"LruCache",
"<",
"Key",
",",
"V... | Obtain a new cache with a least-recently used eviction policy and the specified size limit. The
backing caching implementation is provided by {@link LruCache}. It is safe for a single cache
to be shared across multiple {@link SafeMethodCachingInterceptor}s without synchronization. | [
"Obtain",
"a",
"new",
"cache",
"with",
"a",
"least",
"-",
"recently",
"used",
"eviction",
"policy",
"and",
"the",
"specified",
"size",
"limit",
".",
"The",
"backing",
"caching",
"implementation",
"is",
"provided",
"by",
"{"
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/examples/android/clientcache/app/src/main/java/io/grpc/clientcacheexample/SafeMethodCachingInterceptor.java#L107-L136 |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/Counters.java | Counters.findCounter | public synchronized Counter findCounter(String group, String name) {
return getGroup(group).getCounterForName(name);
} | java | public synchronized Counter findCounter(String group, String name) {
return getGroup(group).getCounterForName(name);
} | [
"public",
"synchronized",
"Counter",
"findCounter",
"(",
"String",
"group",
",",
"String",
"name",
")",
"{",
"return",
"getGroup",
"(",
"group",
")",
".",
"getCounterForName",
"(",
"name",
")",
";",
"}"
] | Find a counter given the group and the name.
@param group the name of the group
@param name the internal name of the counter
@return the counter for that name | [
"Find",
"a",
"counter",
"given",
"the",
"group",
"and",
"the",
"name",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/Counters.java#L390-L392 |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/CloudStorageApi.java | CloudStorageApi.getProvider | public CloudStorageProviders getProvider(String accountId, String userId, String serviceId) throws ApiException {
return getProvider(accountId, userId, serviceId, null);
} | java | public CloudStorageProviders getProvider(String accountId, String userId, String serviceId) throws ApiException {
return getProvider(accountId, userId, serviceId, null);
} | [
"public",
"CloudStorageProviders",
"getProvider",
"(",
"String",
"accountId",
",",
"String",
"userId",
",",
"String",
"serviceId",
")",
"throws",
"ApiException",
"{",
"return",
"getProvider",
"(",
"accountId",
",",
"userId",
",",
"serviceId",
",",
"null",
")",
"... | Gets the specified Cloud Storage Provider configuration for the User.
Retrieves the list of cloud storage providers enabled for the account and the configuration information for the user.
@param accountId The external account number (int) or account ID Guid. (required)
@param userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing. (required)
@param serviceId The ID of the service to access. Valid values are the service name (\"Box\") or the numerical serviceId (\"4136\"). (required)
@return CloudStorageProviders | [
"Gets",
"the",
"specified",
"Cloud",
"Storage",
"Provider",
"configuration",
"for",
"the",
"User",
".",
"Retrieves",
"the",
"list",
"of",
"cloud",
"storage",
"providers",
"enabled",
"for",
"the",
"account",
"and",
"the",
"configuration",
"information",
"for",
"t... | train | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/CloudStorageApi.java#L221-L223 |
BotMill/fb-botmill | src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/PassengerSegmentInfoBuilder.java | PassengerSegmentInfoBuilder.addProductInfo | public PassengerSegmentInfoBuilder addProductInfo(String title, String value) {
ProductInfo productInfo = new ProductInfo(title, value);
segmentInfo.addProductInfo(productInfo);
return this;
} | java | public PassengerSegmentInfoBuilder addProductInfo(String title, String value) {
ProductInfo productInfo = new ProductInfo(title, value);
segmentInfo.addProductInfo(productInfo);
return this;
} | [
"public",
"PassengerSegmentInfoBuilder",
"addProductInfo",
"(",
"String",
"title",
",",
"String",
"value",
")",
"{",
"ProductInfo",
"productInfo",
"=",
"new",
"ProductInfo",
"(",
"title",
",",
"value",
")",
";",
"segmentInfo",
".",
"addProductInfo",
"(",
"productI... | Adds a {@link ProductInfo} object to the list of products the passenger
purchased in the current {@link PassengerSegmentInfo}. This field is
mandatory and there must be at least one element.
@param title
the product title. It can't be empty.
@param value
the product description. It can't be empty.
@return this builder. | [
"Adds",
"a",
"{",
"@link",
"ProductInfo",
"}",
"object",
"to",
"the",
"list",
"of",
"products",
"the",
"passenger",
"purchased",
"in",
"the",
"current",
"{",
"@link",
"PassengerSegmentInfo",
"}",
".",
"This",
"field",
"is",
"mandatory",
"and",
"there",
"must... | train | https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/PassengerSegmentInfoBuilder.java#L86-L90 |
wildfly/wildfly-core | server/src/main/java/org/jboss/as/server/deploymentoverlay/AffectedDeploymentOverlay.java | AffectedDeploymentOverlay.listDeployments | public static Set<String> listDeployments(Resource deploymentRootResource, Set<String> runtimeNames) {
Set<Pattern> set = new HashSet<>();
for (String wildcardExpr : runtimeNames) {
Pattern pattern = DeploymentOverlayIndex.getPattern(wildcardExpr);
set.add(pattern);
}
return listDeploymentNames(deploymentRootResource, set);
} | java | public static Set<String> listDeployments(Resource deploymentRootResource, Set<String> runtimeNames) {
Set<Pattern> set = new HashSet<>();
for (String wildcardExpr : runtimeNames) {
Pattern pattern = DeploymentOverlayIndex.getPattern(wildcardExpr);
set.add(pattern);
}
return listDeploymentNames(deploymentRootResource, set);
} | [
"public",
"static",
"Set",
"<",
"String",
">",
"listDeployments",
"(",
"Resource",
"deploymentRootResource",
",",
"Set",
"<",
"String",
">",
"runtimeNames",
")",
"{",
"Set",
"<",
"Pattern",
">",
"set",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"for",
"... | Returns the deployment names with the specified runtime names at the specified deploymentRootAddress.
@param deploymentRootResource
@param runtimeNames
@return the deployment names with the specified runtime names at the specified deploymentRootAddress. | [
"Returns",
"the",
"deployment",
"names",
"with",
"the",
"specified",
"runtime",
"names",
"at",
"the",
"specified",
"deploymentRootAddress",
"."
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/deploymentoverlay/AffectedDeploymentOverlay.java#L225-L232 |
synchronoss/cpo-api | cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java | JdbcCpoAdapter.getReadConnection | protected Connection getReadConnection() throws CpoException {
Connection connection;
try {
if (!(invalidReadConnection_)) {
connection = getReadDataSource().getConnection();
} else {
connection = getWriteDataSource().getConnection();
}
connection.setAutoCommit(false);
} catch (Exception e) {
invalidReadConnection_ = true;
String msg = "getReadConnection(): failed";
logger.error(msg, e);
try {
connection = getWriteDataSource().getConnection();
connection.setAutoCommit(false);
} catch (SQLException e2) {
msg = "getWriteConnection(): failed";
logger.error(msg, e2);
throw new CpoException(msg, e2);
}
}
return connection;
} | java | protected Connection getReadConnection() throws CpoException {
Connection connection;
try {
if (!(invalidReadConnection_)) {
connection = getReadDataSource().getConnection();
} else {
connection = getWriteDataSource().getConnection();
}
connection.setAutoCommit(false);
} catch (Exception e) {
invalidReadConnection_ = true;
String msg = "getReadConnection(): failed";
logger.error(msg, e);
try {
connection = getWriteDataSource().getConnection();
connection.setAutoCommit(false);
} catch (SQLException e2) {
msg = "getWriteConnection(): failed";
logger.error(msg, e2);
throw new CpoException(msg, e2);
}
}
return connection;
} | [
"protected",
"Connection",
"getReadConnection",
"(",
")",
"throws",
"CpoException",
"{",
"Connection",
"connection",
";",
"try",
"{",
"if",
"(",
"!",
"(",
"invalidReadConnection_",
")",
")",
"{",
"connection",
"=",
"getReadDataSource",
"(",
")",
".",
"getConnect... | DOCUMENT ME!
@return DOCUMENT ME!
@throws CpoException DOCUMENT ME! | [
"DOCUMENT",
"ME!"
] | train | https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-jdbc/src/main/java/org/synchronoss/cpo/jdbc/JdbcCpoAdapter.java#L2044-L2071 |
ben-manes/caffeine | simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/product/CollisionPolicy.java | CollisionPolicy.policies | public static Set<Policy> policies(Config config) {
CollisionSettings settings = new CollisionSettings(config);
return settings.density()
.map(density -> new CollisionPolicy(settings, density))
.collect(toSet());
} | java | public static Set<Policy> policies(Config config) {
CollisionSettings settings = new CollisionSettings(config);
return settings.density()
.map(density -> new CollisionPolicy(settings, density))
.collect(toSet());
} | [
"public",
"static",
"Set",
"<",
"Policy",
">",
"policies",
"(",
"Config",
"config",
")",
"{",
"CollisionSettings",
"settings",
"=",
"new",
"CollisionSettings",
"(",
"config",
")",
";",
"return",
"settings",
".",
"density",
"(",
")",
".",
"map",
"(",
"densi... | Returns all variations of this policy based on the configuration parameters. | [
"Returns",
"all",
"variations",
"of",
"this",
"policy",
"based",
"on",
"the",
"configuration",
"parameters",
"."
] | train | https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/product/CollisionPolicy.java#L67-L72 |
goldmansachs/gs-collections | collections/src/main/java/com/gs/collections/impl/utility/Iterate.java | Iterate.sortThisBy | public static <T, V extends Comparable<? super V>, L extends List<T>> L sortThisBy(L list, Function<? super T, ? extends V> function)
{
return Iterate.sortThis(list, Comparators.byFunction(function));
} | java | public static <T, V extends Comparable<? super V>, L extends List<T>> L sortThisBy(L list, Function<? super T, ? extends V> function)
{
return Iterate.sortThis(list, Comparators.byFunction(function));
} | [
"public",
"static",
"<",
"T",
",",
"V",
"extends",
"Comparable",
"<",
"?",
"super",
"V",
">",
",",
"L",
"extends",
"List",
"<",
"T",
">",
">",
"L",
"sortThisBy",
"(",
"L",
"list",
",",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
"extends",
"V",... | Sort the list by comparing an attribute defined by the function.
SortThisBy is a mutating method. The List passed in is also returned. | [
"Sort",
"the",
"list",
"by",
"comparing",
"an",
"attribute",
"defined",
"by",
"the",
"function",
".",
"SortThisBy",
"is",
"a",
"mutating",
"method",
".",
"The",
"List",
"passed",
"in",
"is",
"also",
"returned",
"."
] | train | https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/Iterate.java#L919-L922 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPlot.java | SVGPlot.saveAsPDF | public void saveAsPDF(File file) throws IOException, TranscoderException, ClassNotFoundException {
try {
Object t = Class.forName("org.apache.fop.svg.PDFTranscoder").newInstance();
transcode(file, (Transcoder) t);
}
catch(InstantiationException | IllegalAccessException e) {
throw new ClassNotFoundException("Could not instantiate PDF transcoder - is Apache FOP installed?", e);
}
} | java | public void saveAsPDF(File file) throws IOException, TranscoderException, ClassNotFoundException {
try {
Object t = Class.forName("org.apache.fop.svg.PDFTranscoder").newInstance();
transcode(file, (Transcoder) t);
}
catch(InstantiationException | IllegalAccessException e) {
throw new ClassNotFoundException("Could not instantiate PDF transcoder - is Apache FOP installed?", e);
}
} | [
"public",
"void",
"saveAsPDF",
"(",
"File",
"file",
")",
"throws",
"IOException",
",",
"TranscoderException",
",",
"ClassNotFoundException",
"{",
"try",
"{",
"Object",
"t",
"=",
"Class",
".",
"forName",
"(",
"\"org.apache.fop.svg.PDFTranscoder\"",
")",
".",
"newIn... | Transcode file to PDF.
@param file Output filename
@throws IOException On write errors
@throws TranscoderException On input/parsing errors.
@throws ClassNotFoundException PDF transcoder not installed | [
"Transcode",
"file",
"to",
"PDF",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/svg/SVGPlot.java#L461-L469 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/subsystem/FeatureRepository.java | FeatureRepository.updateBadManifestCache | private void updateBadManifestCache(String line) {
String[] parts = FeatureDefinitionUtils.splitPattern.split(line);
if (parts.length == 3) {
File f = new File(parts[0]);
long lastModified = FeatureDefinitionUtils.getLongValue(parts[1], -1);
long length = FeatureDefinitionUtils.getLongValue(parts[2], -1);
// If the file still exists, add it to our list. We'll check if anything
// changed in readFeatureManifests
if (f.isFile())
knownBadFeatures.put(f, new BadFeature(lastModified, length));
}
} | java | private void updateBadManifestCache(String line) {
String[] parts = FeatureDefinitionUtils.splitPattern.split(line);
if (parts.length == 3) {
File f = new File(parts[0]);
long lastModified = FeatureDefinitionUtils.getLongValue(parts[1], -1);
long length = FeatureDefinitionUtils.getLongValue(parts[2], -1);
// If the file still exists, add it to our list. We'll check if anything
// changed in readFeatureManifests
if (f.isFile())
knownBadFeatures.put(f, new BadFeature(lastModified, length));
}
} | [
"private",
"void",
"updateBadManifestCache",
"(",
"String",
"line",
")",
"{",
"String",
"[",
"]",
"parts",
"=",
"FeatureDefinitionUtils",
".",
"splitPattern",
".",
"split",
"(",
"line",
")",
";",
"if",
"(",
"parts",
".",
"length",
"==",
"3",
")",
"{",
"F... | Read the data from the cache: if the file still exists, add it to the list
of known bad features. It will be checked for updates alongside the other
checks for current-ness in {@link #readFeatureManifests()}
@param line line read from the cache file | [
"Read",
"the",
"data",
"from",
"the",
"cache",
":",
"if",
"the",
"file",
"still",
"exists",
"add",
"it",
"to",
"the",
"list",
"of",
"known",
"bad",
"features",
".",
"It",
"will",
"be",
"checked",
"for",
"updates",
"alongside",
"the",
"other",
"checks",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.feature.core/src/com/ibm/ws/kernel/feature/internal/subsystem/FeatureRepository.java#L316-L328 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.eachObject | public static void eachObject(ObjectInputStream ois, Closure closure) throws IOException, ClassNotFoundException {
try {
while (true) {
try {
Object obj = ois.readObject();
// we allow null objects in the object stream
closure.call(obj);
} catch (EOFException e) {
break;
}
}
InputStream temp = ois;
ois = null;
temp.close();
} finally {
closeWithWarning(ois);
}
} | java | public static void eachObject(ObjectInputStream ois, Closure closure) throws IOException, ClassNotFoundException {
try {
while (true) {
try {
Object obj = ois.readObject();
// we allow null objects in the object stream
closure.call(obj);
} catch (EOFException e) {
break;
}
}
InputStream temp = ois;
ois = null;
temp.close();
} finally {
closeWithWarning(ois);
}
} | [
"public",
"static",
"void",
"eachObject",
"(",
"ObjectInputStream",
"ois",
",",
"Closure",
"closure",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"try",
"{",
"while",
"(",
"true",
")",
"{",
"try",
"{",
"Object",
"obj",
"=",
"ois",
".",
... | Iterates through the given object stream object by object. The
ObjectInputStream is closed afterwards.
@param ois an ObjectInputStream, closed after the operation
@param closure a closure
@throws IOException if an IOException occurs.
@throws ClassNotFoundException if the class is not found.
@since 1.0 | [
"Iterates",
"through",
"the",
"given",
"object",
"stream",
"object",
"by",
"object",
".",
"The",
"ObjectInputStream",
"is",
"closed",
"afterwards",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L299-L316 |
mapsforge/mapsforge | sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java | SQLiteDatabase.rawQuery | public Cursor rawQuery(String sql, String[] selectionArgs) {
return rawQueryWithFactory(null, sql, selectionArgs, null, null);
} | java | public Cursor rawQuery(String sql, String[] selectionArgs) {
return rawQueryWithFactory(null, sql, selectionArgs, null, null);
} | [
"public",
"Cursor",
"rawQuery",
"(",
"String",
"sql",
",",
"String",
"[",
"]",
"selectionArgs",
")",
"{",
"return",
"rawQueryWithFactory",
"(",
"null",
",",
"sql",
",",
"selectionArgs",
",",
"null",
",",
"null",
")",
";",
"}"
] | Runs the provided SQL and returns a {@link Cursor} over the result set.
@param sql the SQL query. The SQL string must not be ; terminated
@param selectionArgs You may include ?s in where clause in the query,
which will be replaced by the values from selectionArgs. The
values will be bound as Strings.
@return A {@link Cursor} object, which is positioned before the first entry. Note that
{@link Cursor}s are not synchronized, see the documentation for more details. | [
"Runs",
"the",
"provided",
"SQL",
"and",
"returns",
"a",
"{",
"@link",
"Cursor",
"}",
"over",
"the",
"result",
"set",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteDatabase.java#L1258-L1260 |
facebookarchive/swift | swift-service/src/main/java/com/facebook/swift/service/ThriftServerConfig.java | ThriftServerConfig.getOrBuildWorkerExecutor | public ExecutorService getOrBuildWorkerExecutor(Map<String, ExecutorService> boundWorkerExecutors)
{
if (workerExecutorKey.isPresent()) {
checkState(!workerExecutor.isPresent(),
"Worker executor key should not be set along with a specific worker executor instance");
checkState(!workerThreads.isPresent(),
"Worker executor key should not be set along with a number of worker threads");
checkState(!maxQueuedRequests.isPresent(),
"When using a custom executor, handling maximum queued requests must be done manually");
String key = workerExecutorKey.get();
checkArgument(boundWorkerExecutors.containsKey(key),
"No ExecutorService was bound to key '" + key + "'");
ExecutorService executor = boundWorkerExecutors.get(key);
checkNotNull(executor, "WorkerExecutorKey maps to null");
return executor;
}
else if (workerExecutor.isPresent()) {
checkState(!workerThreads.isPresent(),
"Worker executor should not be set along with number of worker threads");
checkState(!maxQueuedRequests.isPresent(),
"When using a custom executor, handling maximum queued requests must be done manually");
return workerExecutor.get();
}
else {
return makeDefaultWorkerExecutor();
}
} | java | public ExecutorService getOrBuildWorkerExecutor(Map<String, ExecutorService> boundWorkerExecutors)
{
if (workerExecutorKey.isPresent()) {
checkState(!workerExecutor.isPresent(),
"Worker executor key should not be set along with a specific worker executor instance");
checkState(!workerThreads.isPresent(),
"Worker executor key should not be set along with a number of worker threads");
checkState(!maxQueuedRequests.isPresent(),
"When using a custom executor, handling maximum queued requests must be done manually");
String key = workerExecutorKey.get();
checkArgument(boundWorkerExecutors.containsKey(key),
"No ExecutorService was bound to key '" + key + "'");
ExecutorService executor = boundWorkerExecutors.get(key);
checkNotNull(executor, "WorkerExecutorKey maps to null");
return executor;
}
else if (workerExecutor.isPresent()) {
checkState(!workerThreads.isPresent(),
"Worker executor should not be set along with number of worker threads");
checkState(!maxQueuedRequests.isPresent(),
"When using a custom executor, handling maximum queued requests must be done manually");
return workerExecutor.get();
}
else {
return makeDefaultWorkerExecutor();
}
} | [
"public",
"ExecutorService",
"getOrBuildWorkerExecutor",
"(",
"Map",
"<",
"String",
",",
"ExecutorService",
">",
"boundWorkerExecutors",
")",
"{",
"if",
"(",
"workerExecutorKey",
".",
"isPresent",
"(",
")",
")",
"{",
"checkState",
"(",
"!",
"workerExecutor",
".",
... | <p>Builds the {@link java.util.concurrent.ExecutorService} used for running Thrift server methods.</p>
<p>The details of the {@link java.util.concurrent.ExecutorService} that gets built can be tweaked
by calling any of the following (though only <b>one</b> of these should actually be called):</p>
<ul>
<li>{@link com.facebook.swift.service.ThriftServerConfig#setWorkerThreads}</li>
<li>{@link com.facebook.swift.service.ThriftServerConfig#setWorkerExecutor}</li>
<li>{@link com.facebook.swift.service.ThriftServerConfig#setWorkerExecutorKey}</li>
</ul>
<p>The default behavior if none of the above were called is to synthesize a fixed-size
{@link java.util.concurrent.ThreadPoolExecutor} using
{@link com.facebook.swift.service.ThriftServerConfig#DEFAULT_WORKER_THREAD_COUNT}
threads.</p> | [
"<p",
">",
"Builds",
"the",
"{",
"@link",
"java",
".",
"util",
".",
"concurrent",
".",
"ExecutorService",
"}",
"used",
"for",
"running",
"Thrift",
"server",
"methods",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/facebookarchive/swift/blob/3f1f098a50d6106f50cd6fe1c361dd373ede0197/swift-service/src/main/java/com/facebook/swift/service/ThriftServerConfig.java#L374-L402 |
lucee/Lucee | core/src/main/java/lucee/runtime/op/date/DateCaster.java | DateCaster.toDateSimple | public static DateTime toDateSimple(String str, short convertingType, boolean alsoMonthString, TimeZone timeZone) throws PageException {
DateTime dt = toDateSimple(str, convertingType, alsoMonthString, timeZone, null);
if (dt == null) throw new ExpressionException("can't cast value to a Date Object");
return dt;
} | java | public static DateTime toDateSimple(String str, short convertingType, boolean alsoMonthString, TimeZone timeZone) throws PageException {
DateTime dt = toDateSimple(str, convertingType, alsoMonthString, timeZone, null);
if (dt == null) throw new ExpressionException("can't cast value to a Date Object");
return dt;
} | [
"public",
"static",
"DateTime",
"toDateSimple",
"(",
"String",
"str",
",",
"short",
"convertingType",
",",
"boolean",
"alsoMonthString",
",",
"TimeZone",
"timeZone",
")",
"throws",
"PageException",
"{",
"DateTime",
"dt",
"=",
"toDateSimple",
"(",
"str",
",",
"co... | converts a Object to a DateTime Object, returns null if invalid string
@param str Stringt to Convert
@param convertingType one of the following values: - CONVERTING_TYPE_NONE: number are not
converted at all - CONVERTING_TYPE_YEAR: integers are handled as years -
CONVERTING_TYPE_OFFSET: numbers are handled as offset from 1899-12-30 00:00:00 UTC
@param timeZone
@return coverted Date Time Object
@throws PageException | [
"converts",
"a",
"Object",
"to",
"a",
"DateTime",
"Object",
"returns",
"null",
"if",
"invalid",
"string"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/date/DateCaster.java#L501-L505 |
infinispan/infinispan | core/src/main/java/org/infinispan/configuration/global/ExecutorFactoryConfigurationBuilder.java | ExecutorFactoryConfigurationBuilder.addProperty | public ExecutorFactoryConfigurationBuilder addProperty(String key, String value) {
attributes.attribute(PROPERTIES).get().put(key, value);
return this;
} | java | public ExecutorFactoryConfigurationBuilder addProperty(String key, String value) {
attributes.attribute(PROPERTIES).get().put(key, value);
return this;
} | [
"public",
"ExecutorFactoryConfigurationBuilder",
"addProperty",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"attributes",
".",
"attribute",
"(",
"PROPERTIES",
")",
".",
"get",
"(",
")",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"return",
... | Add key/value property pair to this executor factory configuration
@param key property key
@param value property value
@return this ExecutorFactoryConfig | [
"Add",
"key",
"/",
"value",
"property",
"pair",
"to",
"this",
"executor",
"factory",
"configuration"
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/global/ExecutorFactoryConfigurationBuilder.java#L45-L48 |
joniles/mpxj | src/main/java/net/sf/mpxj/Resource.java | Resource.setEnterpriseCustomField | public void setEnterpriseCustomField(int index, String value)
{
set(selectField(ResourceFieldLists.ENTERPRISE_CUSTOM_FIELD, index), value);
} | java | public void setEnterpriseCustomField(int index, String value)
{
set(selectField(ResourceFieldLists.ENTERPRISE_CUSTOM_FIELD, index), value);
} | [
"public",
"void",
"setEnterpriseCustomField",
"(",
"int",
"index",
",",
"String",
"value",
")",
"{",
"set",
"(",
"selectField",
"(",
"ResourceFieldLists",
".",
"ENTERPRISE_CUSTOM_FIELD",
",",
"index",
")",
",",
"value",
")",
";",
"}"
] | Set an enterprise custom field value.
@param index field index
@param value field value | [
"Set",
"an",
"enterprise",
"custom",
"field",
"value",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Resource.java#L2183-L2186 |
UrielCh/ovh-java-sdk | ovh-java-sdk-horizonView/src/main/java/net/minidev/ovh/api/ApiOvhHorizonView.java | ApiOvhHorizonView.serviceName_domainTrust_POST | public ArrayList<OvhTask> serviceName_domainTrust_POST(String serviceName, String activeDirectoryIP, String dns1, String dns2, String domain) throws IOException {
String qPath = "/horizonView/{serviceName}/domainTrust";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "activeDirectoryIP", activeDirectoryIP);
addBody(o, "dns1", dns1);
addBody(o, "dns2", dns2);
addBody(o, "domain", domain);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, t2);
} | java | public ArrayList<OvhTask> serviceName_domainTrust_POST(String serviceName, String activeDirectoryIP, String dns1, String dns2, String domain) throws IOException {
String qPath = "/horizonView/{serviceName}/domainTrust";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "activeDirectoryIP", activeDirectoryIP);
addBody(o, "dns1", dns1);
addBody(o, "dns2", dns2);
addBody(o, "domain", domain);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, t2);
} | [
"public",
"ArrayList",
"<",
"OvhTask",
">",
"serviceName_domainTrust_POST",
"(",
"String",
"serviceName",
",",
"String",
"activeDirectoryIP",
",",
"String",
"dns1",
",",
"String",
"dns2",
",",
"String",
"domain",
")",
"throws",
"IOException",
"{",
"String",
"qPath... | Link your Active Directory to your CDI Active Directory
REST: POST /horizonView/{serviceName}/domainTrust
@param activeDirectoryIP [required] IP of your Active Directory
@param domain [required] Domain of your active directory (for example domain.local)
@param dns2 [required] IP of your second DNS
@param dns1 [required] IP of your first DNS
@param serviceName [required] Domain of the service | [
"Link",
"your",
"Active",
"Directory",
"to",
"your",
"CDI",
"Active",
"Directory"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-horizonView/src/main/java/net/minidev/ovh/api/ApiOvhHorizonView.java#L381-L391 |
fuinorg/objects4j | src/main/java/org/fuin/objects4j/vo/HourRange.java | HourRange.normalize | public final List<HourRange> normalize() {
final List<HourRange> ranges = new ArrayList<>();
if (this.from.toMinutes() > this.to.toMinutes()) {
ranges.add(new HourRange(this.from, new Hour(24, 00)));
ranges.add(new HourRange(new Hour(0, 0), this.to));
} else {
ranges.add(this);
}
return ranges;
} | java | public final List<HourRange> normalize() {
final List<HourRange> ranges = new ArrayList<>();
if (this.from.toMinutes() > this.to.toMinutes()) {
ranges.add(new HourRange(this.from, new Hour(24, 00)));
ranges.add(new HourRange(new Hour(0, 0), this.to));
} else {
ranges.add(this);
}
return ranges;
} | [
"public",
"final",
"List",
"<",
"HourRange",
">",
"normalize",
"(",
")",
"{",
"final",
"List",
"<",
"HourRange",
">",
"ranges",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"this",
".",
"from",
".",
"toMinutes",
"(",
")",
">",
"this",
"... | If the hour range represents two different days, this method returns two hour ranges, one for each day. Example: '18:00-03:00' will
be splitted into '18:00-24:00' and '00:00-03:00'.
@return This range or range for today and tomorrow. | [
"If",
"the",
"hour",
"range",
"represents",
"two",
"different",
"days",
"this",
"method",
"returns",
"two",
"hour",
"ranges",
"one",
"for",
"each",
"day",
".",
"Example",
":",
"18",
":",
"00",
"-",
"03",
":",
"00",
"will",
"be",
"splitted",
"into",
"18... | train | https://github.com/fuinorg/objects4j/blob/e7f278b5bae073ebb6a76053650571c718f36246/src/main/java/org/fuin/objects4j/vo/HourRange.java#L193-L202 |
samskivert/samskivert | src/main/java/com/samskivert/servlet/MessageManager.java | MessageManager.getMessage | public String getMessage (HttpServletRequest req, String path, Object[] args)
{
String msg = getMessage(req, path, true);
// we may cache message formatters later, but for now just use the static convenience
// function
return MessageFormat.format(MessageUtil.escape(msg), args);
} | java | public String getMessage (HttpServletRequest req, String path, Object[] args)
{
String msg = getMessage(req, path, true);
// we may cache message formatters later, but for now just use the static convenience
// function
return MessageFormat.format(MessageUtil.escape(msg), args);
} | [
"public",
"String",
"getMessage",
"(",
"HttpServletRequest",
"req",
",",
"String",
"path",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"String",
"msg",
"=",
"getMessage",
"(",
"req",
",",
"path",
",",
"true",
")",
";",
"// we may cache message formatters later,... | Looks up the message with the specified path in the resource bundle most appropriate for the
locales described as preferred by the request, then substitutes the supplied arguments into
that message using a <code>MessageFormat</code> object.
@see java.text.MessageFormat | [
"Looks",
"up",
"the",
"message",
"with",
"the",
"specified",
"path",
"in",
"the",
"resource",
"bundle",
"most",
"appropriate",
"for",
"the",
"locales",
"described",
"as",
"preferred",
"by",
"the",
"request",
"then",
"substitutes",
"the",
"supplied",
"arguments",... | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/servlet/MessageManager.java#L84-L90 |
OpenLiberty/open-liberty | dev/com.ibm.ws.injection/src/com/ibm/ws/injectionengine/osgi/internal/IndirectJndiLookupObjectFactory.java | IndirectJndiLookupObjectFactory.createDefaultResource | private Object createDefaultResource(String className, ResourceInfo resourceRefInfo) throws Exception {
if (className != null) {
String javaCompDefaultFilter = "(" + com.ibm.ws.resource.ResourceFactory.JAVA_COMP_DEFAULT_NAME + "=*)";
String createsFilter = FilterUtils.createPropertyFilter(ResourceFactory.CREATES_OBJECT_CLASS, className);
String filter = "(&" + javaCompDefaultFilter + createsFilter + ")";
return createResourceWithFilter(filter, resourceRefInfo);
}
return null;
} | java | private Object createDefaultResource(String className, ResourceInfo resourceRefInfo) throws Exception {
if (className != null) {
String javaCompDefaultFilter = "(" + com.ibm.ws.resource.ResourceFactory.JAVA_COMP_DEFAULT_NAME + "=*)";
String createsFilter = FilterUtils.createPropertyFilter(ResourceFactory.CREATES_OBJECT_CLASS, className);
String filter = "(&" + javaCompDefaultFilter + createsFilter + ")";
return createResourceWithFilter(filter, resourceRefInfo);
}
return null;
} | [
"private",
"Object",
"createDefaultResource",
"(",
"String",
"className",
",",
"ResourceInfo",
"resourceRefInfo",
")",
"throws",
"Exception",
"{",
"if",
"(",
"className",
"!=",
"null",
")",
"{",
"String",
"javaCompDefaultFilter",
"=",
"\"(\"",
"+",
"com",
".",
"... | Try to obtain an object instance by creating a resource using a
ResourceFactory for a default resource. | [
"Try",
"to",
"obtain",
"an",
"object",
"instance",
"by",
"creating",
"a",
"resource",
"using",
"a",
"ResourceFactory",
"for",
"a",
"default",
"resource",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection/src/com/ibm/ws/injectionengine/osgi/internal/IndirectJndiLookupObjectFactory.java#L345-L353 |
RestComm/sipunit | src/main/java/org/cafesip/sipunit/SipSession.java | SipSession.sendReply | public SipTransaction sendReply(RequestEvent request, Response response) {
initErrorInfo();
if (request == null) {
setReturnCode(INVALID_ARGUMENT);
setErrorMessage("A response cannot be sent because the request event is null.");
return null;
}
// The ServerTransaction needed will be in the
// RequestEvent if the dialog already existed. Otherwise, create it
// here.
Request req = request.getRequest();
if (req == null) {
setReturnCode(INVALID_ARGUMENT);
setErrorMessage("A response cannot be sent because the request is null.");
return null;
}
ServerTransaction trans = request.getServerTransaction();
if (trans == null) {
try {
trans = parent.getSipProvider().getNewServerTransaction(req);
} catch (TransactionAlreadyExistsException ex) {
/*
* TransactionAlreadyExistsException - this can happen if a transaction already exists that
* is already handling this Request. This may happen if the application gets retransmits of
* the same request before the initial transaction is allocated.
*/
setErrorMessage(
"Error: Can't get transaction object. If you've already called sendReply(RequestEvent, ...) with this RequestEvent, use the SipTransaction it returned to call sendReply(SipTransaction, ...) for subsequent replies to that request.");
setReturnCode(INTERNAL_ERROR);
return null;
} catch (Exception ex) {
setException(ex);
setErrorMessage("Exception: " + ex.getClass().getName() + ": " + ex.getMessage());
setReturnCode(EXCEPTION_ENCOUNTERED);
return null;
}
}
// create the SipTransaction, put the ServerTransaction in it
SipTransaction transaction = new SipTransaction();
transaction.setServerTransaction(trans);
return sendReply(transaction, response);
} | java | public SipTransaction sendReply(RequestEvent request, Response response) {
initErrorInfo();
if (request == null) {
setReturnCode(INVALID_ARGUMENT);
setErrorMessage("A response cannot be sent because the request event is null.");
return null;
}
// The ServerTransaction needed will be in the
// RequestEvent if the dialog already existed. Otherwise, create it
// here.
Request req = request.getRequest();
if (req == null) {
setReturnCode(INVALID_ARGUMENT);
setErrorMessage("A response cannot be sent because the request is null.");
return null;
}
ServerTransaction trans = request.getServerTransaction();
if (trans == null) {
try {
trans = parent.getSipProvider().getNewServerTransaction(req);
} catch (TransactionAlreadyExistsException ex) {
/*
* TransactionAlreadyExistsException - this can happen if a transaction already exists that
* is already handling this Request. This may happen if the application gets retransmits of
* the same request before the initial transaction is allocated.
*/
setErrorMessage(
"Error: Can't get transaction object. If you've already called sendReply(RequestEvent, ...) with this RequestEvent, use the SipTransaction it returned to call sendReply(SipTransaction, ...) for subsequent replies to that request.");
setReturnCode(INTERNAL_ERROR);
return null;
} catch (Exception ex) {
setException(ex);
setErrorMessage("Exception: " + ex.getClass().getName() + ": " + ex.getMessage());
setReturnCode(EXCEPTION_ENCOUNTERED);
return null;
}
}
// create the SipTransaction, put the ServerTransaction in it
SipTransaction transaction = new SipTransaction();
transaction.setServerTransaction(trans);
return sendReply(transaction, response);
} | [
"public",
"SipTransaction",
"sendReply",
"(",
"RequestEvent",
"request",
",",
"Response",
"response",
")",
"{",
"initErrorInfo",
"(",
")",
";",
"if",
"(",
"request",
"==",
"null",
")",
"{",
"setReturnCode",
"(",
"INVALID_ARGUMENT",
")",
";",
"setErrorMessage",
... | This method sends a stateful response to a previously received request. Call this method after
calling waitRequest(). The returned SipTransaction object must be used in any subsequent calls
to sendReply() for the same received request, if there are any.
@param request The RequestEvent object that was returned by a previous call to waitRequest().
@param response The response to send, as is.
@return A SipTransaction object that must be passed in to any subsequent call to sendReply()
for the same received request, or null if an error was encountered while sending the
response. The calling program doesn't need to do anything with the returned
SipTransaction other than pass it in to a subsequent call to sendReply() for the same
received request. | [
"This",
"method",
"sends",
"a",
"stateful",
"response",
"to",
"a",
"previously",
"received",
"request",
".",
"Call",
"this",
"method",
"after",
"calling",
"waitRequest",
"()",
".",
"The",
"returned",
"SipTransaction",
"object",
"must",
"be",
"used",
"in",
"any... | train | https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipSession.java#L1382-L1430 |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/FileOutputFormat.java | FileOutputFormat.getTaskOutputPath | public static Path getTaskOutputPath(JobConf conf, String name)
throws IOException {
// ${mapred.out.dir}
Path outputPath = getOutputPath(conf);
if (outputPath == null) {
throw new IOException("Undefined job output-path");
}
OutputCommitter committer = conf.getOutputCommitter();
Path workPath = outputPath;
TaskAttemptContext context = new TaskAttemptContext(conf,
TaskAttemptID.forName(conf.get("mapred.task.id")));
if (committer instanceof FileOutputCommitter) {
workPath = ((FileOutputCommitter)committer).getWorkPath(context,
outputPath);
}
// ${mapred.out.dir}/_temporary/_${taskid}/${name}
return new Path(workPath, name);
} | java | public static Path getTaskOutputPath(JobConf conf, String name)
throws IOException {
// ${mapred.out.dir}
Path outputPath = getOutputPath(conf);
if (outputPath == null) {
throw new IOException("Undefined job output-path");
}
OutputCommitter committer = conf.getOutputCommitter();
Path workPath = outputPath;
TaskAttemptContext context = new TaskAttemptContext(conf,
TaskAttemptID.forName(conf.get("mapred.task.id")));
if (committer instanceof FileOutputCommitter) {
workPath = ((FileOutputCommitter)committer).getWorkPath(context,
outputPath);
}
// ${mapred.out.dir}/_temporary/_${taskid}/${name}
return new Path(workPath, name);
} | [
"public",
"static",
"Path",
"getTaskOutputPath",
"(",
"JobConf",
"conf",
",",
"String",
"name",
")",
"throws",
"IOException",
"{",
"// ${mapred.out.dir}",
"Path",
"outputPath",
"=",
"getOutputPath",
"(",
"conf",
")",
";",
"if",
"(",
"outputPath",
"==",
"null",
... | Helper function to create the task's temporary output directory and
return the path to the task's output file.
@param conf job-configuration
@param name temporary task-output filename
@return path to the task's temporary output file
@throws IOException | [
"Helper",
"function",
"to",
"create",
"the",
"task",
"s",
"temporary",
"output",
"directory",
"and",
"return",
"the",
"path",
"to",
"the",
"task",
"s",
"output",
"file",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/FileOutputFormat.java#L231-L250 |
apache/flink | flink-runtime/src/main/java/org/apache/flink/runtime/operators/BatchTask.java | BatchTask.cancelChainedTasks | public static void cancelChainedTasks(List<ChainedDriver<?, ?>> tasks) {
for (int i = 0; i < tasks.size(); i++) {
try {
tasks.get(i).cancelTask();
} catch (Throwable t) {
// do nothing
}
}
} | java | public static void cancelChainedTasks(List<ChainedDriver<?, ?>> tasks) {
for (int i = 0; i < tasks.size(); i++) {
try {
tasks.get(i).cancelTask();
} catch (Throwable t) {
// do nothing
}
}
} | [
"public",
"static",
"void",
"cancelChainedTasks",
"(",
"List",
"<",
"ChainedDriver",
"<",
"?",
",",
"?",
">",
">",
"tasks",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"tasks",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"tr... | Cancels all tasks via their {@link ChainedDriver#cancelTask()} method. Any occurring exception
and error is suppressed, such that the canceling method of every task is invoked in all cases.
@param tasks The tasks to be canceled. | [
"Cancels",
"all",
"tasks",
"via",
"their",
"{",
"@link",
"ChainedDriver#cancelTask",
"()",
"}",
"method",
".",
"Any",
"occurring",
"exception",
"and",
"error",
"is",
"suppressed",
"such",
"that",
"the",
"canceling",
"method",
"of",
"every",
"task",
"is",
"invo... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/operators/BatchTask.java#L1420-L1428 |
umeding/fuzzer | src/main/java/com/uwemeding/fuzzer/Program.java | Program.addItem | private <T extends NameBearer> void addItem(T item, Map<String, T> items, String typeName) {
String itemName = item.getName();
if (items.containsKey(itemName)) {
throw new FuzzerException(name + ": '" + itemName + "' already present in " + typeName);
}
items.put(itemName, item);
} | java | private <T extends NameBearer> void addItem(T item, Map<String, T> items, String typeName) {
String itemName = item.getName();
if (items.containsKey(itemName)) {
throw new FuzzerException(name + ": '" + itemName + "' already present in " + typeName);
}
items.put(itemName, item);
} | [
"private",
"<",
"T",
"extends",
"NameBearer",
">",
"void",
"addItem",
"(",
"T",
"item",
",",
"Map",
"<",
"String",
",",
"T",
">",
"items",
",",
"String",
"typeName",
")",
"{",
"String",
"itemName",
"=",
"item",
".",
"getName",
"(",
")",
";",
"if",
... | Add an item to a map.
<p>
@param <T> the item type
@param item the item
@param items the item map
@param typeName the item type name string | [
"Add",
"an",
"item",
"to",
"a",
"map",
".",
"<p",
">"
] | train | https://github.com/umeding/fuzzer/blob/e8aa46313bb1d1328865f26f99455124aede828c/src/main/java/com/uwemeding/fuzzer/Program.java#L385-L391 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java | HttpChannelConfig.parseIncomingHdrBufferSize | private void parseIncomingHdrBufferSize(Map<Object, Object> props) {
Object value = props.get(HttpConfigConstants.PROPNAME_INCOMING_HDR_BUFFSIZE);
if (null != value) {
try {
this.incomingHdrBuffSize = rangeLimit(convertInteger(value), HttpConfigConstants.MIN_BUFFER_SIZE, HttpConfigConstants.MAX_BUFFER_SIZE);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Config: Incoming hdr buffer size is " + getIncomingHdrBufferSize());
}
} catch (NumberFormatException nfe) {
FFDCFilter.processException(nfe, getClass().getName() + ".parseIncomingHdrBufferSize", "1");
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Config: Invalid incoming hdr buffer size of " + value);
}
}
}
} | java | private void parseIncomingHdrBufferSize(Map<Object, Object> props) {
Object value = props.get(HttpConfigConstants.PROPNAME_INCOMING_HDR_BUFFSIZE);
if (null != value) {
try {
this.incomingHdrBuffSize = rangeLimit(convertInteger(value), HttpConfigConstants.MIN_BUFFER_SIZE, HttpConfigConstants.MAX_BUFFER_SIZE);
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Config: Incoming hdr buffer size is " + getIncomingHdrBufferSize());
}
} catch (NumberFormatException nfe) {
FFDCFilter.processException(nfe, getClass().getName() + ".parseIncomingHdrBufferSize", "1");
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Config: Invalid incoming hdr buffer size of " + value);
}
}
}
} | [
"private",
"void",
"parseIncomingHdrBufferSize",
"(",
"Map",
"<",
"Object",
",",
"Object",
">",
"props",
")",
"{",
"Object",
"value",
"=",
"props",
".",
"get",
"(",
"HttpConfigConstants",
".",
"PROPNAME_INCOMING_HDR_BUFFSIZE",
")",
";",
"if",
"(",
"null",
"!="... | Check the input configuration for the buffer size to use when parsing
the incoming headers.
@param props | [
"Check",
"the",
"input",
"configuration",
"for",
"the",
"buffer",
"size",
"to",
"use",
"when",
"parsing",
"the",
"incoming",
"headers",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java#L589-L604 |
alkacon/opencms-core | src/org/opencms/staticexport/CmsStaticExportManager.java | CmsStaticExportManager.getRfsPath | public static String getRfsPath(String filename, String extension, String parameters) {
boolean appendSlash = false;
if (filename.endsWith("/")) {
appendSlash = true;
filename = filename.substring(0, filename.length() - 1);
}
StringBuffer buf = new StringBuffer(128);
buf.append(filename);
buf.append('_');
int h = parameters.hashCode();
// ensure we do have a positive id value
buf.append(h > 0 ? h : -h);
buf.append(extension);
if (appendSlash) {
buf.append("/");
}
return buf.toString();
} | java | public static String getRfsPath(String filename, String extension, String parameters) {
boolean appendSlash = false;
if (filename.endsWith("/")) {
appendSlash = true;
filename = filename.substring(0, filename.length() - 1);
}
StringBuffer buf = new StringBuffer(128);
buf.append(filename);
buf.append('_');
int h = parameters.hashCode();
// ensure we do have a positive id value
buf.append(h > 0 ? h : -h);
buf.append(extension);
if (appendSlash) {
buf.append("/");
}
return buf.toString();
} | [
"public",
"static",
"String",
"getRfsPath",
"(",
"String",
"filename",
",",
"String",
"extension",
",",
"String",
"parameters",
")",
"{",
"boolean",
"appendSlash",
"=",
"false",
";",
"if",
"(",
"filename",
".",
"endsWith",
"(",
"\"/\"",
")",
")",
"{",
"app... | Creates unique, valid RFS name for the given filename that contains
a coded version of the given parameters, with the given file extension appended.<p>
Adapted from CmsFileUtil.getRfsPath().
@param filename the base file name
@param extension the extension to use
@param parameters the parameters to code in the result file name
@return a unique, valid RFS name for the given parameters
@see org.opencms.staticexport.CmsStaticExportManager | [
"Creates",
"unique",
"valid",
"RFS",
"name",
"for",
"the",
"given",
"filename",
"that",
"contains",
"a",
"coded",
"version",
"of",
"the",
"given",
"parameters",
"with",
"the",
"given",
"file",
"extension",
"appended",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsStaticExportManager.java#L317-L335 |
HanSolo/SteelSeries-Swing | src/main/java/eu/hansolo/steelseries/tools/GradientWrapper.java | GradientWrapper.copyArrays | private void copyArrays(final float[] FRACTIONS, final Color[] colors) {
fractions = new float[FRACTIONS.length];
System.arraycopy(FRACTIONS, 0, fractions, 0, FRACTIONS.length);
this.colors = colors.clone();
} | java | private void copyArrays(final float[] FRACTIONS, final Color[] colors) {
fractions = new float[FRACTIONS.length];
System.arraycopy(FRACTIONS, 0, fractions, 0, FRACTIONS.length);
this.colors = colors.clone();
} | [
"private",
"void",
"copyArrays",
"(",
"final",
"float",
"[",
"]",
"FRACTIONS",
",",
"final",
"Color",
"[",
"]",
"colors",
")",
"{",
"fractions",
"=",
"new",
"float",
"[",
"FRACTIONS",
".",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"FRACTIONS",... | Just create a local copy of the fractions and colors array
@param FRACTIONS
@param colors | [
"Just",
"create",
"a",
"local",
"copy",
"of",
"the",
"fractions",
"and",
"colors",
"array"
] | train | https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/tools/GradientWrapper.java#L161-L165 |
derari/cthul | xml/src/main/java/org/cthul/resolve/ResolvingException.java | ResolvingException.againAs | public <T1 extends Throwable>
RuntimeException againAs(Class<T1> t1)
throws T1 {
return againAs(t1, NULL_EX, NULL_EX, NULL_EX);
} | java | public <T1 extends Throwable>
RuntimeException againAs(Class<T1> t1)
throws T1 {
return againAs(t1, NULL_EX, NULL_EX, NULL_EX);
} | [
"public",
"<",
"T1",
"extends",
"Throwable",
">",
"RuntimeException",
"againAs",
"(",
"Class",
"<",
"T1",
">",
"t1",
")",
"throws",
"T1",
"{",
"return",
"againAs",
"(",
"t1",
",",
"NULL_EX",
",",
"NULL_EX",
",",
"NULL_EX",
")",
";",
"}"
] | Throws the {@linkplain #getResolvingCause() cause} if it is the
specified type, otherwise returns a
{@linkplain #asRuntimeException() runtime exception}.
<p>
Intended to be written as {@code throw e.againAs(IOException.class)}.
@param <T1>
@param t1
@return
@throws T1 | [
"Throws",
"the",
"{"
] | train | https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/xml/src/main/java/org/cthul/resolve/ResolvingException.java#L143-L147 |
zhangguangyong/codes | codes-persistent-hibernate/src/main/java/com/codes/persistence/hibernate/dao/QueryParameterWrap.java | QueryParameterWrap.addParameters | public QueryParameterWrap addParameters(String name, Object first, Object second,
Object... rest) {
List<Object> parameters = new ArrayList<Object>();
parameters.add(first);
parameters.add(second);
if (notEmpty(rest)) {
parameters.addAll(Arrays.asList(rest));
}
return addParameters(name, parameters);
} | java | public QueryParameterWrap addParameters(String name, Object first, Object second,
Object... rest) {
List<Object> parameters = new ArrayList<Object>();
parameters.add(first);
parameters.add(second);
if (notEmpty(rest)) {
parameters.addAll(Arrays.asList(rest));
}
return addParameters(name, parameters);
} | [
"public",
"QueryParameterWrap",
"addParameters",
"(",
"String",
"name",
",",
"Object",
"first",
",",
"Object",
"second",
",",
"Object",
"...",
"rest",
")",
"{",
"List",
"<",
"Object",
">",
"parameters",
"=",
"new",
"ArrayList",
"<",
"Object",
">",
"(",
")"... | 添加命名的参数 :propertyName ->命名的参数
@param name
@param first
第一个,不能为空
@param second
第二个,不能为空
@param rest
后面的,可为空
@return | [
"添加命名的参数",
":",
"propertyName",
"-",
">",
"命名的参数"
] | train | https://github.com/zhangguangyong/codes/blob/5585c17ea46af665582734f399c05dfbba18c30d/codes-persistent-hibernate/src/main/java/com/codes/persistence/hibernate/dao/QueryParameterWrap.java#L128-L137 |
apache/flink | flink-scala-shell/src/main/java/org/apache/flink/api/java/JarHelper.java | JarHelper.jarDir | public void jarDir(File dirOrFile2Jar, File destJar)
throws IOException {
if (dirOrFile2Jar == null || destJar == null) {
throw new IllegalArgumentException();
}
mDestJarName = destJar.getCanonicalPath();
FileOutputStream fout = new FileOutputStream(destJar);
JarOutputStream jout = new JarOutputStream(fout);
//jout.setLevel(0);
try {
jarDir(dirOrFile2Jar, jout, null);
} catch (IOException ioe) {
throw ioe;
} finally {
jout.close();
fout.close();
}
} | java | public void jarDir(File dirOrFile2Jar, File destJar)
throws IOException {
if (dirOrFile2Jar == null || destJar == null) {
throw new IllegalArgumentException();
}
mDestJarName = destJar.getCanonicalPath();
FileOutputStream fout = new FileOutputStream(destJar);
JarOutputStream jout = new JarOutputStream(fout);
//jout.setLevel(0);
try {
jarDir(dirOrFile2Jar, jout, null);
} catch (IOException ioe) {
throw ioe;
} finally {
jout.close();
fout.close();
}
} | [
"public",
"void",
"jarDir",
"(",
"File",
"dirOrFile2Jar",
",",
"File",
"destJar",
")",
"throws",
"IOException",
"{",
"if",
"(",
"dirOrFile2Jar",
"==",
"null",
"||",
"destJar",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",... | Jars a given directory or single file into a JarOutputStream. | [
"Jars",
"a",
"given",
"directory",
"or",
"single",
"file",
"into",
"a",
"JarOutputStream",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-scala-shell/src/main/java/org/apache/flink/api/java/JarHelper.java#L71-L90 |
ops4j/org.ops4j.pax.swissbox | pax-swissbox-core/src/main/java/org/ops4j/pax/swissbox/core/BundleUtils.java | BundleUtils.getBundle | public static Bundle getBundle( BundleContext bc, String symbolicName )
{
return getBundle( bc, symbolicName, null );
} | java | public static Bundle getBundle( BundleContext bc, String symbolicName )
{
return getBundle( bc, symbolicName, null );
} | [
"public",
"static",
"Bundle",
"getBundle",
"(",
"BundleContext",
"bc",
",",
"String",
"symbolicName",
")",
"{",
"return",
"getBundle",
"(",
"bc",
",",
"symbolicName",
",",
"null",
")",
";",
"}"
] | Returns any bundle with the given symbolic name, or null if no such bundle exists. If there
are multiple bundles with the same symbolic name and different version, this method returns
the first bundle found.
@param bc bundle context
@param symbolicName bundle symbolic name
@return matching bundle, or null | [
"Returns",
"any",
"bundle",
"with",
"the",
"given",
"symbolic",
"name",
"or",
"null",
"if",
"no",
"such",
"bundle",
"exists",
".",
"If",
"there",
"are",
"multiple",
"bundles",
"with",
"the",
"same",
"symbolic",
"name",
"and",
"different",
"version",
"this",
... | train | https://github.com/ops4j/org.ops4j.pax.swissbox/blob/00b0ee16cdbe8017984a4d7ba808b10d985c5b5c/pax-swissbox-core/src/main/java/org/ops4j/pax/swissbox/core/BundleUtils.java#L94-L97 |
apache/incubator-gobblin | gobblin-compaction/src/main/java/org/apache/gobblin/compaction/event/CompactionSlaEventHelper.java | CompactionSlaEventHelper.getEventSubmitterBuilder | public static SlaEventSubmitterBuilder getEventSubmitterBuilder(Dataset dataset, Optional<Job> job, FileSystem fs) {
SlaEventSubmitterBuilder builder =
SlaEventSubmitter.builder().datasetUrn(dataset.getUrn())
.partition(dataset.jobProps().getProp(MRCompactor.COMPACTION_JOB_DEST_PARTITION, ""))
.dedupeStatus(getOutputDedupeStatus(dataset.jobProps()));
long previousPublishTime = getPreviousPublishTime(dataset, fs);
long upstreamTime = dataset.jobProps().getPropAsLong(SlaEventKeys.UPSTREAM_TS_IN_MILLI_SECS_KEY, -1l);
long recordCount = getRecordCount(job);
// Previous publish only exists when this is a recompact job
if (previousPublishTime != -1l) {
builder.previousPublishTimestamp(Long.toString(previousPublishTime));
}
// Upstream time is the logical time represented by the compaction input directory
if (upstreamTime != -1l) {
builder.upstreamTimestamp(Long.toString(upstreamTime));
}
if (recordCount != -1l) {
builder.recordCount(Long.toString(recordCount));
}
return builder;
} | java | public static SlaEventSubmitterBuilder getEventSubmitterBuilder(Dataset dataset, Optional<Job> job, FileSystem fs) {
SlaEventSubmitterBuilder builder =
SlaEventSubmitter.builder().datasetUrn(dataset.getUrn())
.partition(dataset.jobProps().getProp(MRCompactor.COMPACTION_JOB_DEST_PARTITION, ""))
.dedupeStatus(getOutputDedupeStatus(dataset.jobProps()));
long previousPublishTime = getPreviousPublishTime(dataset, fs);
long upstreamTime = dataset.jobProps().getPropAsLong(SlaEventKeys.UPSTREAM_TS_IN_MILLI_SECS_KEY, -1l);
long recordCount = getRecordCount(job);
// Previous publish only exists when this is a recompact job
if (previousPublishTime != -1l) {
builder.previousPublishTimestamp(Long.toString(previousPublishTime));
}
// Upstream time is the logical time represented by the compaction input directory
if (upstreamTime != -1l) {
builder.upstreamTimestamp(Long.toString(upstreamTime));
}
if (recordCount != -1l) {
builder.recordCount(Long.toString(recordCount));
}
return builder;
} | [
"public",
"static",
"SlaEventSubmitterBuilder",
"getEventSubmitterBuilder",
"(",
"Dataset",
"dataset",
",",
"Optional",
"<",
"Job",
">",
"job",
",",
"FileSystem",
"fs",
")",
"{",
"SlaEventSubmitterBuilder",
"builder",
"=",
"SlaEventSubmitter",
".",
"builder",
"(",
"... | Get an {@link SlaEventSubmitterBuilder} that has dataset urn, partition, record count, previous publish timestamp
and dedupe status set.
The caller MUST set eventSubmitter, eventname before submitting. | [
"Get",
"an",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-compaction/src/main/java/org/apache/gobblin/compaction/event/CompactionSlaEventHelper.java#L71-L93 |
code4everything/util | src/main/java/com/zhazhapan/util/FileExecutor.java | FileExecutor.saveFile | public static synchronized void saveFile(File file, String content, boolean append) throws IOException {
if (Checker.isNotNull(file)) {
if (!file.exists()) {
file.createNewFile();
}
try (BufferedWriter out = new BufferedWriter(new FileWriter(file, append))) {
out.write(content);
}
logger.info("save file '" + file.getAbsolutePath() + "' success");
}
} | java | public static synchronized void saveFile(File file, String content, boolean append) throws IOException {
if (Checker.isNotNull(file)) {
if (!file.exists()) {
file.createNewFile();
}
try (BufferedWriter out = new BufferedWriter(new FileWriter(file, append))) {
out.write(content);
}
logger.info("save file '" + file.getAbsolutePath() + "' success");
}
} | [
"public",
"static",
"synchronized",
"void",
"saveFile",
"(",
"File",
"file",
",",
"String",
"content",
",",
"boolean",
"append",
")",
"throws",
"IOException",
"{",
"if",
"(",
"Checker",
".",
"isNotNull",
"(",
"file",
")",
")",
"{",
"if",
"(",
"!",
"file"... | 保存文件
@param file 文件
@param content 内容
@param append 保存方式
@throws IOException 异常 | [
"保存文件"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/FileExecutor.java#L980-L990 |
pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/ReaderGroupStateManager.java | ReaderGroupStateManager.readerShutdown | static void readerShutdown(String readerId, Position lastPosition, StateSynchronizer<ReaderGroupState> sync) {
sync.updateState((state, updates) -> {
Set<Segment> segments = state.getSegments(readerId);
if (segments == null) {
return;
}
log.debug("Removing reader {} from reader grop. CurrentState is: {}", readerId, state);
updates.add(new RemoveReader(readerId, lastPosition == null ? Collections.emptyMap()
: lastPosition.asImpl().getOwnedSegmentsWithOffsets()));
});
} | java | static void readerShutdown(String readerId, Position lastPosition, StateSynchronizer<ReaderGroupState> sync) {
sync.updateState((state, updates) -> {
Set<Segment> segments = state.getSegments(readerId);
if (segments == null) {
return;
}
log.debug("Removing reader {} from reader grop. CurrentState is: {}", readerId, state);
updates.add(new RemoveReader(readerId, lastPosition == null ? Collections.emptyMap()
: lastPosition.asImpl().getOwnedSegmentsWithOffsets()));
});
} | [
"static",
"void",
"readerShutdown",
"(",
"String",
"readerId",
",",
"Position",
"lastPosition",
",",
"StateSynchronizer",
"<",
"ReaderGroupState",
">",
"sync",
")",
"{",
"sync",
".",
"updateState",
"(",
"(",
"state",
",",
"updates",
")",
"->",
"{",
"Set",
"<... | Shuts down a reader, releasing all of its segments. The reader should cease all operations.
@param lastPosition The last position the reader successfully read from. | [
"Shuts",
"down",
"a",
"reader",
"releasing",
"all",
"of",
"its",
"segments",
".",
"The",
"reader",
"should",
"cease",
"all",
"operations",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/ReaderGroupStateManager.java#L133-L143 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/DataFormatHelper.java | DataFormatHelper.printFieldStackTrace | private static final boolean printFieldStackTrace(PrintWriter p, Throwable t, String className, String fieldName) {
for (Class<?> c = t.getClass(); c != Object.class; c = c.getSuperclass()) {
if (c.getName().equals(className)) {
try {
Object value = c.getField(fieldName).get(t);
if (value instanceof Throwable && value != t.getCause()) {
p.append(fieldName).append(": ");
printStackTrace(p, (Throwable) value);
}
return true;
} catch (NoSuchFieldException e) {
} catch (IllegalAccessException e) {
}
}
}
return false;
} | java | private static final boolean printFieldStackTrace(PrintWriter p, Throwable t, String className, String fieldName) {
for (Class<?> c = t.getClass(); c != Object.class; c = c.getSuperclass()) {
if (c.getName().equals(className)) {
try {
Object value = c.getField(fieldName).get(t);
if (value instanceof Throwable && value != t.getCause()) {
p.append(fieldName).append(": ");
printStackTrace(p, (Throwable) value);
}
return true;
} catch (NoSuchFieldException e) {
} catch (IllegalAccessException e) {
}
}
}
return false;
} | [
"private",
"static",
"final",
"boolean",
"printFieldStackTrace",
"(",
"PrintWriter",
"p",
",",
"Throwable",
"t",
",",
"String",
"className",
",",
"String",
"fieldName",
")",
"{",
"for",
"(",
"Class",
"<",
"?",
">",
"c",
"=",
"t",
".",
"getClass",
"(",
")... | Find a field value in the class hierarchy of an exception, and if the
field contains another Throwable, then print its stack trace.
@param p the writer to print to
@param t the outer throwable
@param className the name of the class to look for
@param fieldName the field in the class to look for
@return true if the field was found | [
"Find",
"a",
"field",
"value",
"in",
"the",
"class",
"hierarchy",
"of",
"an",
"exception",
"and",
"if",
"the",
"field",
"contains",
"another",
"Throwable",
"then",
"print",
"its",
"stack",
"trace",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/DataFormatHelper.java#L260-L277 |
OpenLiberty/open-liberty | dev/com.ibm.ws.install.map/src/com/ibm/ws/install/map/InstallMap.java | InstallMap.sortFile | public static void sortFile(List<File> jarsList, final String fName) {
Collections.sort(jarsList, new Comparator<File>() {
@Override
public int compare(File f1, File f2) {
String f1Name = f1.getName();
f1Name = f1Name.substring(fName.length() + 1, f1Name.length() - 4);
String f2Name = f2.getName();
f2Name = f2Name.substring(fName.length() + 1, f2Name.length() - 4);
Version v1 = Version.createVersion(f1Name);
Version v2 = Version.createVersion(f2Name);
if (v1 != null && v2 != null)
return v1.compareTo(v2);
return f1Name.compareTo(f2Name);
}
});
} | java | public static void sortFile(List<File> jarsList, final String fName) {
Collections.sort(jarsList, new Comparator<File>() {
@Override
public int compare(File f1, File f2) {
String f1Name = f1.getName();
f1Name = f1Name.substring(fName.length() + 1, f1Name.length() - 4);
String f2Name = f2.getName();
f2Name = f2Name.substring(fName.length() + 1, f2Name.length() - 4);
Version v1 = Version.createVersion(f1Name);
Version v2 = Version.createVersion(f2Name);
if (v1 != null && v2 != null)
return v1.compareTo(v2);
return f1Name.compareTo(f2Name);
}
});
} | [
"public",
"static",
"void",
"sortFile",
"(",
"List",
"<",
"File",
">",
"jarsList",
",",
"final",
"String",
"fName",
")",
"{",
"Collections",
".",
"sort",
"(",
"jarsList",
",",
"new",
"Comparator",
"<",
"File",
">",
"(",
")",
"{",
"@",
"Override",
"publ... | Compare files in jarsList based on file name's length
Sort the files depending on the comparison
@param jarsList -abstract representation of file/directory names
@param fName - name of file | [
"Compare",
"files",
"in",
"jarsList",
"based",
"on",
"file",
"name",
"s",
"length",
"Sort",
"the",
"files",
"depending",
"on",
"the",
"comparison"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install.map/src/com/ibm/ws/install/map/InstallMap.java#L323-L338 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java | HashtableOnDisk.getInstance | static public HashtableOnDisk getInstance(FileManager filemgr,
boolean auto_rehash,
long instanceid,
boolean hasCacheValue,
HTODDynacache htoddc)
throws FileManagerException,
ClassNotFoundException,
IOException,
HashtableOnDiskException {
return getStaticInstance(filemgr, auto_rehash, instanceid, null, hasCacheValue, htoddc);
} | java | static public HashtableOnDisk getInstance(FileManager filemgr,
boolean auto_rehash,
long instanceid,
boolean hasCacheValue,
HTODDynacache htoddc)
throws FileManagerException,
ClassNotFoundException,
IOException,
HashtableOnDiskException {
return getStaticInstance(filemgr, auto_rehash, instanceid, null, hasCacheValue, htoddc);
} | [
"static",
"public",
"HashtableOnDisk",
"getInstance",
"(",
"FileManager",
"filemgr",
",",
"boolean",
"auto_rehash",
",",
"long",
"instanceid",
",",
"boolean",
"hasCacheValue",
",",
"HTODDynacache",
"htoddc",
")",
"throws",
"FileManagerException",
",",
"ClassNotFoundExce... | ***********************************************************************
getInstance. Initializes a HashtableOnDisk instance over the specified
FileManager, from the specified instanceid. The instanceid was
used to originally create the instance in the createInstance method.
@param filemgr The FileManager for the HTOD.
@param auto_rehash If "true", the HTOD will automatically double in
capacity when its occupancy exceeds its threshold. If "false"
the HTOD will increase only if the startRehash() method is
invoked.
@param instanceid The instance of the HTOD in the FileManager.
@return A HashtableOnDisk pointer
*********************************************************************** | [
"***********************************************************************",
"getInstance",
".",
"Initializes",
"a",
"HashtableOnDisk",
"instance",
"over",
"the",
"specified",
"FileManager",
"from",
"the",
"specified",
"instanceid",
".",
"The",
"instanceid",
"was",
"used",
"to"... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/htod/HashtableOnDisk.java#L353-L363 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java | JBBPDslBuilder.UShort | public JBBPDslBuilder UShort(final String name) {
final Item item = new Item(BinType.USHORT, name, this.byteOrder);
this.addItem(item);
return this;
} | java | public JBBPDslBuilder UShort(final String name) {
final Item item = new Item(BinType.USHORT, name, this.byteOrder);
this.addItem(item);
return this;
} | [
"public",
"JBBPDslBuilder",
"UShort",
"(",
"final",
"String",
"name",
")",
"{",
"final",
"Item",
"item",
"=",
"new",
"Item",
"(",
"BinType",
".",
"USHORT",
",",
"name",
",",
"this",
".",
"byteOrder",
")",
";",
"this",
".",
"addItem",
"(",
"item",
")",
... | Add named unsigned short field.
@param name name of the field, can be null for anonymous
@return the builder instance, must not be null | [
"Add",
"named",
"unsigned",
"short",
"field",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/utils/JBBPDslBuilder.java#L1025-L1029 |
drinkjava2/jDialects | core/src/main/java/com/github/drinkjava2/jdialects/GuessDialectUtils.java | GuessDialectUtils.guessDialect | public static Dialect guessDialect(Connection jdbcConnection) {
String databaseName;
String driverName;
int majorVersion;
int minorVersion;
try {
DatabaseMetaData meta = jdbcConnection.getMetaData();
driverName = meta.getDriverName();
databaseName = meta.getDatabaseProductName();
majorVersion = meta.getDatabaseMajorVersion();
minorVersion = meta.getDatabaseMinorVersion();
} catch (SQLException e) {
return (Dialect) DialectException.throwEX(e);
}
return guessDialect(driverName, databaseName, majorVersion, minorVersion);
} | java | public static Dialect guessDialect(Connection jdbcConnection) {
String databaseName;
String driverName;
int majorVersion;
int minorVersion;
try {
DatabaseMetaData meta = jdbcConnection.getMetaData();
driverName = meta.getDriverName();
databaseName = meta.getDatabaseProductName();
majorVersion = meta.getDatabaseMajorVersion();
minorVersion = meta.getDatabaseMinorVersion();
} catch (SQLException e) {
return (Dialect) DialectException.throwEX(e);
}
return guessDialect(driverName, databaseName, majorVersion, minorVersion);
} | [
"public",
"static",
"Dialect",
"guessDialect",
"(",
"Connection",
"jdbcConnection",
")",
"{",
"String",
"databaseName",
";",
"String",
"driverName",
";",
"int",
"majorVersion",
";",
"int",
"minorVersion",
";",
"try",
"{",
"DatabaseMetaData",
"meta",
"=",
"jdbcConn... | Guess dialect based on given JDBC connection instance, Note: this method does
not close connection
@param jdbcConnection
The connection
@return dialect or null if can not guess out which dialect | [
"Guess",
"dialect",
"based",
"on",
"given",
"JDBC",
"connection",
"instance",
"Note",
":",
"this",
"method",
"does",
"not",
"close",
"connection"
] | train | https://github.com/drinkjava2/jDialects/blob/1c165f09c6042a599b681c279024abcc1b848b88/core/src/main/java/com/github/drinkjava2/jdialects/GuessDialectUtils.java#L40-L55 |
facebook/fresco | imagepipeline-base/src/main/java/com/facebook/imagepipeline/bitmaps/PlatformBitmapFactory.java | PlatformBitmapFactory.createBitmap | public CloseableReference<Bitmap> createBitmap(
int width,
int height,
Bitmap.Config bitmapConfig,
@Nullable Object callerContext) {
return createBitmapInternal(width, height, bitmapConfig);
} | java | public CloseableReference<Bitmap> createBitmap(
int width,
int height,
Bitmap.Config bitmapConfig,
@Nullable Object callerContext) {
return createBitmapInternal(width, height, bitmapConfig);
} | [
"public",
"CloseableReference",
"<",
"Bitmap",
">",
"createBitmap",
"(",
"int",
"width",
",",
"int",
"height",
",",
"Bitmap",
".",
"Config",
"bitmapConfig",
",",
"@",
"Nullable",
"Object",
"callerContext",
")",
"{",
"return",
"createBitmapInternal",
"(",
"width"... | Creates a bitmap of the specified width and height.
@param width the width of the bitmap
@param height the height of the bitmap
@param bitmapConfig the Bitmap.Config used to create the Bitmap
@param callerContext the Tag to track who create the Bitmap
@return a reference to the bitmap
@throws TooManyBitmapsException if the pool is full
@throws java.lang.OutOfMemoryError if the Bitmap cannot be allocated | [
"Creates",
"a",
"bitmap",
"of",
"the",
"specified",
"width",
"and",
"height",
"."
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imagepipeline/bitmaps/PlatformBitmapFactory.java#L69-L75 |
grails/grails-core | grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java | GrailsASTUtils.addCompileStaticAnnotation | public static AnnotatedNode addCompileStaticAnnotation(AnnotatedNode annotatedNode, boolean skip) {
if(annotatedNode != null) {
AnnotationNode an = new AnnotationNode(COMPILESTATIC_CLASS_NODE);
if(skip) {
an.addMember("value", new PropertyExpression(new ClassExpression(TYPECHECKINGMODE_CLASS_NODE), "SKIP"));
}
annotatedNode.addAnnotation(an);
if(!skip) {
annotatedNode.getDeclaringClass().addTransform(StaticCompileTransformation.class, an);
}
}
return annotatedNode;
} | java | public static AnnotatedNode addCompileStaticAnnotation(AnnotatedNode annotatedNode, boolean skip) {
if(annotatedNode != null) {
AnnotationNode an = new AnnotationNode(COMPILESTATIC_CLASS_NODE);
if(skip) {
an.addMember("value", new PropertyExpression(new ClassExpression(TYPECHECKINGMODE_CLASS_NODE), "SKIP"));
}
annotatedNode.addAnnotation(an);
if(!skip) {
annotatedNode.getDeclaringClass().addTransform(StaticCompileTransformation.class, an);
}
}
return annotatedNode;
} | [
"public",
"static",
"AnnotatedNode",
"addCompileStaticAnnotation",
"(",
"AnnotatedNode",
"annotatedNode",
",",
"boolean",
"skip",
")",
"{",
"if",
"(",
"annotatedNode",
"!=",
"null",
")",
"{",
"AnnotationNode",
"an",
"=",
"new",
"AnnotationNode",
"(",
"COMPILESTATIC_... | Adds @CompileStatic annotation to method
@param annotatedNode
@param skip
@return The annotated method | [
"Adds",
"@CompileStatic",
"annotation",
"to",
"method"
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java#L1178-L1190 |
OpenLiberty/open-liberty | dev/com.ibm.ws.channelfw/src/com/ibm/websphere/channelfw/ChannelUtils.java | ChannelUtils.printThreadStackTrace | public static void printThreadStackTrace(TraceComponent logger, Thread thread) {
if (logger.isDebugEnabled()) {
chTrace.traceThreadStack(logger, thread);
}
} | java | public static void printThreadStackTrace(TraceComponent logger, Thread thread) {
if (logger.isDebugEnabled()) {
chTrace.traceThreadStack(logger, thread);
}
} | [
"public",
"static",
"void",
"printThreadStackTrace",
"(",
"TraceComponent",
"logger",
",",
"Thread",
"thread",
")",
"{",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"chTrace",
".",
"traceThreadStack",
"(",
"logger",
",",
"thread",
")",
";... | Print debug stacktrace using given trace component.
@param logger
@param thread | [
"Print",
"debug",
"stacktrace",
"using",
"given",
"trace",
"component",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/websphere/channelfw/ChannelUtils.java#L94-L98 |
rythmengine/rythmengine | src/main/java/org/rythmengine/internal/ExtensionManager.java | ExtensionManager.registerUserDefinedParsers | public ExtensionManager registerUserDefinedParsers(String dialect, IParserFactory... parsers) {
engine.dialectManager().registerExternalParsers(dialect, parsers);
return this;
} | java | public ExtensionManager registerUserDefinedParsers(String dialect, IParserFactory... parsers) {
engine.dialectManager().registerExternalParsers(dialect, parsers);
return this;
} | [
"public",
"ExtensionManager",
"registerUserDefinedParsers",
"(",
"String",
"dialect",
",",
"IParserFactory",
"...",
"parsers",
")",
"{",
"engine",
".",
"dialectManager",
"(",
")",
".",
"registerExternalParsers",
"(",
"dialect",
",",
"parsers",
")",
";",
"return",
... | Register a special case parser to a dialect
<p/>
<p>for example, the play-rythm plugin might want to register a special case parser to
process something like @{Controller.actionMethod()} or &{'MSG_ID'} etc to "japid"
and "play-groovy" dialects
@param dialect
@param parsers | [
"Register",
"a",
"special",
"case",
"parser",
"to",
"a",
"dialect",
"<p",
"/",
">",
"<p",
">",
"for",
"example",
"the",
"play",
"-",
"rythm",
"plugin",
"might",
"want",
"to",
"register",
"a",
"special",
"case",
"parser",
"to",
"process",
"something",
"li... | train | https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/internal/ExtensionManager.java#L69-L72 |
deephacks/confit | api-model/src/main/java/org/deephacks/confit/model/Bean.java | Bean.addReference | public void addReference(final String propertyName, final Collection<BeanId> refs) {
Preconditions.checkNotNull(refs);
Preconditions.checkNotNull(propertyName);
checkCircularReference(refs.toArray(new BeanId[refs.size()]));
List<BeanId> list = references.get(propertyName);
if (list == null) {
list = new ArrayList<>();
list.addAll(refs);
references.put(propertyName, list);
} else {
list.addAll(refs);
}
} | java | public void addReference(final String propertyName, final Collection<BeanId> refs) {
Preconditions.checkNotNull(refs);
Preconditions.checkNotNull(propertyName);
checkCircularReference(refs.toArray(new BeanId[refs.size()]));
List<BeanId> list = references.get(propertyName);
if (list == null) {
list = new ArrayList<>();
list.addAll(refs);
references.put(propertyName, list);
} else {
list.addAll(refs);
}
} | [
"public",
"void",
"addReference",
"(",
"final",
"String",
"propertyName",
",",
"final",
"Collection",
"<",
"BeanId",
">",
"refs",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"refs",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"propertyName",
... | Add a list of references to a property on this bean.
A reference identify other beans based on schema and instance id.
@param propertyName name of the property as defined by the bean's schema.
@param refs the reference as defined by the bean's schema. | [
"Add",
"a",
"list",
"of",
"references",
"to",
"a",
"property",
"on",
"this",
"bean",
"."
] | train | https://github.com/deephacks/confit/blob/4e6d4ee5fed32cbc5104433e61de1bcf1b360832/api-model/src/main/java/org/deephacks/confit/model/Bean.java#L286-L298 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLStream.java | ToXMLStream.pushNamespace | protected boolean pushNamespace(String prefix, String uri)
{
try
{
if (m_prefixMap.pushNamespace(
prefix, uri, m_elemContext.m_currentElemDepth))
{
startPrefixMapping(prefix, uri);
return true;
}
}
catch (SAXException e)
{
// falls through
}
return false;
} | java | protected boolean pushNamespace(String prefix, String uri)
{
try
{
if (m_prefixMap.pushNamespace(
prefix, uri, m_elemContext.m_currentElemDepth))
{
startPrefixMapping(prefix, uri);
return true;
}
}
catch (SAXException e)
{
// falls through
}
return false;
} | [
"protected",
"boolean",
"pushNamespace",
"(",
"String",
"prefix",
",",
"String",
"uri",
")",
"{",
"try",
"{",
"if",
"(",
"m_prefixMap",
".",
"pushNamespace",
"(",
"prefix",
",",
"uri",
",",
"m_elemContext",
".",
"m_currentElemDepth",
")",
")",
"{",
"startPre... | From XSLTC
Declare a prefix to point to a namespace URI. Inform SAX handler
if this is a new prefix mapping. | [
"From",
"XSLTC",
"Declare",
"a",
"prefix",
"to",
"point",
"to",
"a",
"namespace",
"URI",
".",
"Inform",
"SAX",
"handler",
"if",
"this",
"is",
"a",
"new",
"prefix",
"mapping",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLStream.java#L557-L573 |
netceteragroup/valdr-bean-validation | valdr-bean-validation/src/main/java/com/github/valdr/thirdparty/spring/AnnotationUtils.java | AnnotationUtils.isAnnotationInherited | public static boolean isAnnotationInherited(Class<? extends Annotation> annotationType, Class<?> clazz) {
return (clazz.isAnnotationPresent(annotationType) && !isAnnotationDeclaredLocally(annotationType, clazz));
} | java | public static boolean isAnnotationInherited(Class<? extends Annotation> annotationType, Class<?> clazz) {
return (clazz.isAnnotationPresent(annotationType) && !isAnnotationDeclaredLocally(annotationType, clazz));
} | [
"public",
"static",
"boolean",
"isAnnotationInherited",
"(",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotationType",
",",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"return",
"(",
"clazz",
".",
"isAnnotationPresent",
"(",
"annotationType",
")",
"&&"... | Determine whether an annotation for the specified {@code annotationType} is present
on the supplied {@code clazz} and is {@linkplain java.lang.annotation.Inherited inherited}
(i.e., not declared locally for the class).
<p>If the supplied {@code clazz} is an interface, only the interface itself will be checked.
In accordance with standard meta-annotation semantics, the inheritance hierarchy for interfaces
will not be traversed. See the {@linkplain java.lang.annotation.Inherited Javadoc} for the
{@code @Inherited} meta-annotation for further details regarding annotation inheritance.
@param annotationType the Class object corresponding to the annotation type
@param clazz the Class object corresponding to the class on which to check for the annotation
@return {@code true} if an annotation for the specified {@code annotationType} is present
on the supplied {@code clazz} and is <em>inherited</em>
@see Class#isAnnotationPresent(Class)
@see #isAnnotationDeclaredLocally(Class, Class) | [
"Determine",
"whether",
"an",
"annotation",
"for",
"the",
"specified",
"{"
] | train | https://github.com/netceteragroup/valdr-bean-validation/blob/3f49f1357c575a11331be2de867cf47809a83823/valdr-bean-validation/src/main/java/com/github/valdr/thirdparty/spring/AnnotationUtils.java#L303-L305 |
xcesco/kripton | kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLChecker.java | JQLChecker.extractPlaceHoldersAsSet | public Set<JQLPlaceHolder> extractPlaceHoldersAsSet(final JQLContext jqlContext, String jql) {
return extractPlaceHolders(jqlContext, jql, new LinkedHashSet<JQLPlaceHolder>());
} | java | public Set<JQLPlaceHolder> extractPlaceHoldersAsSet(final JQLContext jqlContext, String jql) {
return extractPlaceHolders(jqlContext, jql, new LinkedHashSet<JQLPlaceHolder>());
} | [
"public",
"Set",
"<",
"JQLPlaceHolder",
">",
"extractPlaceHoldersAsSet",
"(",
"final",
"JQLContext",
"jqlContext",
",",
"String",
"jql",
")",
"{",
"return",
"extractPlaceHolders",
"(",
"jqlContext",
",",
"jql",
",",
"new",
"LinkedHashSet",
"<",
"JQLPlaceHolder",
"... | Extract all bind parameters and dynamic part used in query.
@param jqlContext
the jql context
@param jql
the jql
@return the sets the | [
"Extract",
"all",
"bind",
"parameters",
"and",
"dynamic",
"part",
"used",
"in",
"query",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/grammars/jql/JQLChecker.java#L833-L835 |
opencb/biodata | biodata-tools/src/main/java/org/opencb/biodata/tools/feature/WigUtils.java | WigUtils.getHeaderInfo | private static String getHeaderInfo(String name, String headerLine) {
String[] fields = headerLine.split("[\t ]");
for (String field : fields) {
if (field.startsWith(name + "=")) {
String[] subfields = field.split("=");
return subfields[1];
}
}
return null;
} | java | private static String getHeaderInfo(String name, String headerLine) {
String[] fields = headerLine.split("[\t ]");
for (String field : fields) {
if (field.startsWith(name + "=")) {
String[] subfields = field.split("=");
return subfields[1];
}
}
return null;
} | [
"private",
"static",
"String",
"getHeaderInfo",
"(",
"String",
"name",
",",
"String",
"headerLine",
")",
"{",
"String",
"[",
"]",
"fields",
"=",
"headerLine",
".",
"split",
"(",
"\"[\\t ]\"",
")",
";",
"for",
"(",
"String",
"field",
":",
"fields",
")",
"... | Get information from a Wig header line.
@param name Name of the information, e.g.: span, chrom, step,...
@param headerLine Header line where to search that information
@return Value of the information | [
"Get",
"information",
"from",
"a",
"Wig",
"header",
"line",
"."
] | train | https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/feature/WigUtils.java#L240-L249 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.