repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
erlang/otp | lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java | OtpOutputStream.write_port | public void write_port(final String node, final int id, final int creation) {
"""
Write an Erlang port to the stream.
@param node
the nodename.
@param id
an arbitrary number. Only the low order 28 bits will be used.
@param creation
another arbitrary number. Only the low order 2 bits will
be used.
"""
write1(OtpExternal.portTag);
write_atom(node);
write4BE(id & 0xfffffff); // 28 bits
write1(creation & 0x3); // 2 bits
} | java | public void write_port(final String node, final int id, final int creation) {
write1(OtpExternal.portTag);
write_atom(node);
write4BE(id & 0xfffffff); // 28 bits
write1(creation & 0x3); // 2 bits
} | [
"public",
"void",
"write_port",
"(",
"final",
"String",
"node",
",",
"final",
"int",
"id",
",",
"final",
"int",
"creation",
")",
"{",
"write1",
"(",
"OtpExternal",
".",
"portTag",
")",
";",
"write_atom",
"(",
"node",
")",
";",
"write4BE",
"(",
"id",
"&... | Write an Erlang port to the stream.
@param node
the nodename.
@param id
an arbitrary number. Only the low order 28 bits will be used.
@param creation
another arbitrary number. Only the low order 2 bits will
be used. | [
"Write",
"an",
"Erlang",
"port",
"to",
"the",
"stream",
"."
] | train | https://github.com/erlang/otp/blob/ac6084fd83240355f72e94adbf303e57832d1fab/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java#L760-L765 |
jenetics/jpx | jpx/src/main/java/io/jenetics/jpx/Length.java | Length.of | public static Length of(final double length, final Unit unit) {
"""
Create a new {@code Length} object with the given length.
@param length the length
@param unit the length unit
@return a new {@code Length} object with the given length.
@throws NullPointerException if the given length {@code unit} is
{@code null}
"""
requireNonNull(unit);
return new Length(Unit.METER.convert(length, unit));
} | java | public static Length of(final double length, final Unit unit) {
requireNonNull(unit);
return new Length(Unit.METER.convert(length, unit));
} | [
"public",
"static",
"Length",
"of",
"(",
"final",
"double",
"length",
",",
"final",
"Unit",
"unit",
")",
"{",
"requireNonNull",
"(",
"unit",
")",
";",
"return",
"new",
"Length",
"(",
"Unit",
".",
"METER",
".",
"convert",
"(",
"length",
",",
"unit",
")"... | Create a new {@code Length} object with the given length.
@param length the length
@param unit the length unit
@return a new {@code Length} object with the given length.
@throws NullPointerException if the given length {@code unit} is
{@code null} | [
"Create",
"a",
"new",
"{",
"@code",
"Length",
"}",
"object",
"with",
"the",
"given",
"length",
"."
] | train | https://github.com/jenetics/jpx/blob/58fefc10580602d07f1480d6a5886d13a553ff8f/jpx/src/main/java/io/jenetics/jpx/Length.java#L210-L213 |
linroid/FilterMenu | library/src/main/java/com/linroid/filtermenu/library/FilterMenuLayout.java | FilterMenuLayout.arcAngle | private static double arcAngle(Point center, Point a, Point b, Rect area, int radius) {
"""
calculate arc angle between point a and point b
@param center
@param a
@param b
@param area
@param radius
@return
"""
double angle = threePointsAngle(center, a, b);
Point innerPoint = findMidnormalPoint(center, a, b, area, radius);
Point midInsectPoint = new Point((a.x + b.x) / 2, (a.y + b.y) / 2);
double distance = pointsDistance(midInsectPoint, innerPoint);
if (distance > radius) {
return 360 - angle;
}
return angle;
} | java | private static double arcAngle(Point center, Point a, Point b, Rect area, int radius) {
double angle = threePointsAngle(center, a, b);
Point innerPoint = findMidnormalPoint(center, a, b, area, radius);
Point midInsectPoint = new Point((a.x + b.x) / 2, (a.y + b.y) / 2);
double distance = pointsDistance(midInsectPoint, innerPoint);
if (distance > radius) {
return 360 - angle;
}
return angle;
} | [
"private",
"static",
"double",
"arcAngle",
"(",
"Point",
"center",
",",
"Point",
"a",
",",
"Point",
"b",
",",
"Rect",
"area",
",",
"int",
"radius",
")",
"{",
"double",
"angle",
"=",
"threePointsAngle",
"(",
"center",
",",
"a",
",",
"b",
")",
";",
"Po... | calculate arc angle between point a and point b
@param center
@param a
@param b
@param area
@param radius
@return | [
"calculate",
"arc",
"angle",
"between",
"point",
"a",
"and",
"point",
"b"
] | train | https://github.com/linroid/FilterMenu/blob/5a6e5472631c2304b71a51034683f38271962ef5/library/src/main/java/com/linroid/filtermenu/library/FilterMenuLayout.java#L143-L152 |
belaban/JGroups | src/org/jgroups/util/SeqnoRange.java | SeqnoRange.getBits | public Collection<Range> getBits(boolean value) {
"""
Returns ranges of all bit set to value
@param value If true, returns all bits set to 1, else 0
@return
"""
int index=0;
int start_range=0, end_range=0;
int size=(int)((high - low) + 1);
final Collection<Range> retval=new ArrayList<>(size);
while(index < size) {
start_range=value? bits.nextSetBit(index) : bits.nextClearBit(index);
if(start_range < 0 || start_range >= size)
break;
end_range=value? bits.nextClearBit(start_range) : bits.nextSetBit(start_range);
if(end_range < 0 || end_range >= size) {
retval.add(new Range(start_range + low, size-1+low));
break;
}
retval.add(new Range(start_range + low, end_range-1+low));
index=end_range;
}
return retval;
} | java | public Collection<Range> getBits(boolean value) {
int index=0;
int start_range=0, end_range=0;
int size=(int)((high - low) + 1);
final Collection<Range> retval=new ArrayList<>(size);
while(index < size) {
start_range=value? bits.nextSetBit(index) : bits.nextClearBit(index);
if(start_range < 0 || start_range >= size)
break;
end_range=value? bits.nextClearBit(start_range) : bits.nextSetBit(start_range);
if(end_range < 0 || end_range >= size) {
retval.add(new Range(start_range + low, size-1+low));
break;
}
retval.add(new Range(start_range + low, end_range-1+low));
index=end_range;
}
return retval;
} | [
"public",
"Collection",
"<",
"Range",
">",
"getBits",
"(",
"boolean",
"value",
")",
"{",
"int",
"index",
"=",
"0",
";",
"int",
"start_range",
"=",
"0",
",",
"end_range",
"=",
"0",
";",
"int",
"size",
"=",
"(",
"int",
")",
"(",
"(",
"high",
"-",
"... | Returns ranges of all bit set to value
@param value If true, returns all bits set to 1, else 0
@return | [
"Returns",
"ranges",
"of",
"all",
"bit",
"set",
"to",
"value"
] | train | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/SeqnoRange.java#L115-L135 |
strator-dev/greenpepper | greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/Repository.java | Repository.asDocumentRepository | public DocumentRepository asDocumentRepository(EnvironmentType env, String user, String pwd) throws Exception {
"""
<p>asDocumentRepository.</p>
@param env a {@link com.greenpepper.server.domain.EnvironmentType} object.
@param user a {@link java.lang.String} object.
@param pwd a {@link java.lang.String} object.
@return a {@link com.greenpepper.repository.DocumentRepository} object.
@throws java.lang.Exception if any.
"""
return (DocumentRepository)new FactoryConverter().convert(type.asFactoryArguments(this, env, true, user, pwd));
} | java | public DocumentRepository asDocumentRepository(EnvironmentType env, String user, String pwd) throws Exception
{
return (DocumentRepository)new FactoryConverter().convert(type.asFactoryArguments(this, env, true, user, pwd));
} | [
"public",
"DocumentRepository",
"asDocumentRepository",
"(",
"EnvironmentType",
"env",
",",
"String",
"user",
",",
"String",
"pwd",
")",
"throws",
"Exception",
"{",
"return",
"(",
"DocumentRepository",
")",
"new",
"FactoryConverter",
"(",
")",
".",
"convert",
"(",... | <p>asDocumentRepository.</p>
@param env a {@link com.greenpepper.server.domain.EnvironmentType} object.
@param user a {@link java.lang.String} object.
@param pwd a {@link java.lang.String} object.
@return a {@link com.greenpepper.repository.DocumentRepository} object.
@throws java.lang.Exception if any. | [
"<p",
">",
"asDocumentRepository",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/greenpepper-client/src/main/java/com/greenpepper/server/domain/Repository.java#L467-L470 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/LogManager.java | LogManager.getContext | public static LoggerContext getContext(final ClassLoader loader, final boolean currentContext) {
"""
Returns a LoggerContext.
@param loader The ClassLoader for the context. If null the context will attempt to determine the appropriate
ClassLoader.
@param currentContext if false the LoggerContext appropriate for the caller of this method is returned. For
example, in a web application if the caller is a class in WEB-INF/lib then one LoggerContext may be
returned and if the caller is a class in the container's classpath then a different LoggerContext may
be returned. If true then only a single LoggerContext will be returned.
@return a LoggerContext.
"""
try {
return factory.getContext(FQCN, loader, null, currentContext);
} catch (final IllegalStateException ex) {
LOGGER.warn(ex.getMessage() + " Using SimpleLogger");
return new SimpleLoggerContextFactory().getContext(FQCN, loader, null, currentContext);
}
} | java | public static LoggerContext getContext(final ClassLoader loader, final boolean currentContext) {
try {
return factory.getContext(FQCN, loader, null, currentContext);
} catch (final IllegalStateException ex) {
LOGGER.warn(ex.getMessage() + " Using SimpleLogger");
return new SimpleLoggerContextFactory().getContext(FQCN, loader, null, currentContext);
}
} | [
"public",
"static",
"LoggerContext",
"getContext",
"(",
"final",
"ClassLoader",
"loader",
",",
"final",
"boolean",
"currentContext",
")",
"{",
"try",
"{",
"return",
"factory",
".",
"getContext",
"(",
"FQCN",
",",
"loader",
",",
"null",
",",
"currentContext",
"... | Returns a LoggerContext.
@param loader The ClassLoader for the context. If null the context will attempt to determine the appropriate
ClassLoader.
@param currentContext if false the LoggerContext appropriate for the caller of this method is returned. For
example, in a web application if the caller is a class in WEB-INF/lib then one LoggerContext may be
returned and if the caller is a class in the container's classpath then a different LoggerContext may
be returned. If true then only a single LoggerContext will be returned.
@return a LoggerContext. | [
"Returns",
"a",
"LoggerContext",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/LogManager.java#L134-L141 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java | QrCodeUtil.generate | public static BufferedImage generate(String content, BarcodeFormat format, int width, int height) {
"""
生成二维码或条形码图片
@param content 文本内容
@param format 格式,可选二维码或者条形码
@param width 宽度
@param height 高度
@return 二维码图片(黑白)
"""
return generate(content, format, new QrConfig(width, height));
} | java | public static BufferedImage generate(String content, BarcodeFormat format, int width, int height) {
return generate(content, format, new QrConfig(width, height));
} | [
"public",
"static",
"BufferedImage",
"generate",
"(",
"String",
"content",
",",
"BarcodeFormat",
"format",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"return",
"generate",
"(",
"content",
",",
"format",
",",
"new",
"QrConfig",
"(",
"width",
",",
... | 生成二维码或条形码图片
@param content 文本内容
@param format 格式,可选二维码或者条形码
@param width 宽度
@param height 高度
@return 二维码图片(黑白) | [
"生成二维码或条形码图片"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java#L146-L148 |
Azure/azure-sdk-for-java | authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleDefinitionsInner.java | RoleDefinitionsInner.getAsync | public Observable<RoleDefinitionInner> getAsync(String scope, String roleDefinitionId) {
"""
Get role definition by name (GUID).
@param scope The scope of the role definition.
@param roleDefinitionId The ID of the role definition.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RoleDefinitionInner object
"""
return getWithServiceResponseAsync(scope, roleDefinitionId).map(new Func1<ServiceResponse<RoleDefinitionInner>, RoleDefinitionInner>() {
@Override
public RoleDefinitionInner call(ServiceResponse<RoleDefinitionInner> response) {
return response.body();
}
});
} | java | public Observable<RoleDefinitionInner> getAsync(String scope, String roleDefinitionId) {
return getWithServiceResponseAsync(scope, roleDefinitionId).map(new Func1<ServiceResponse<RoleDefinitionInner>, RoleDefinitionInner>() {
@Override
public RoleDefinitionInner call(ServiceResponse<RoleDefinitionInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RoleDefinitionInner",
">",
"getAsync",
"(",
"String",
"scope",
",",
"String",
"roleDefinitionId",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"scope",
",",
"roleDefinitionId",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"... | Get role definition by name (GUID).
@param scope The scope of the role definition.
@param roleDefinitionId The ID of the role definition.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RoleDefinitionInner object | [
"Get",
"role",
"definition",
"by",
"name",
"(",
"GUID",
")",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleDefinitionsInner.java#L207-L214 |
sarl/sarl | contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.ui/src/io/sarl/pythongenerator/ui/PyGeneratorUiPlugin.java | PyGeneratorUiPlugin.createStatus | @SuppressWarnings("static-method")
public IStatus createStatus(int severity, Throwable cause) {
"""
Create a status.
@param severity the severity level, see {@link IStatus}.
@param cause the cause of the problem.
@return the status.
"""
String message = cause.getLocalizedMessage();
if (Strings.isNullOrEmpty(message)) {
message = cause.getMessage();
}
if (Strings.isNullOrEmpty(message)) {
message = cause.getClass().getSimpleName();
}
return new Status(severity, PLUGIN_ID, message, cause);
} | java | @SuppressWarnings("static-method")
public IStatus createStatus(int severity, Throwable cause) {
String message = cause.getLocalizedMessage();
if (Strings.isNullOrEmpty(message)) {
message = cause.getMessage();
}
if (Strings.isNullOrEmpty(message)) {
message = cause.getClass().getSimpleName();
}
return new Status(severity, PLUGIN_ID, message, cause);
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"public",
"IStatus",
"createStatus",
"(",
"int",
"severity",
",",
"Throwable",
"cause",
")",
"{",
"String",
"message",
"=",
"cause",
".",
"getLocalizedMessage",
"(",
")",
";",
"if",
"(",
"Strings",
".",
... | Create a status.
@param severity the severity level, see {@link IStatus}.
@param cause the cause of the problem.
@return the status. | [
"Create",
"a",
"status",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.ui/src/io/sarl/pythongenerator/ui/PyGeneratorUiPlugin.java#L121-L131 |
m-m-m/util | scanner/src/main/java/net/sf/mmm/util/scanner/base/CharSequenceScanner.java | CharSequenceScanner.getTail | protected String getTail(int maximum) {
"""
This method gets the tail of this scanner limited (truncated) to the given {@code maximum} number of
characters without changing the state.
@param maximum is the maximum number of characters to return from the {@link #getTail() tail}.
@return the tail of this scanner.
"""
String tail = "";
if (this.offset < this.limit) {
int count = this.limit - this.offset + 1;
if (count > maximum) {
count = maximum;
}
tail = new String(this.buffer, this.offset, count);
}
return tail;
} | java | protected String getTail(int maximum) {
String tail = "";
if (this.offset < this.limit) {
int count = this.limit - this.offset + 1;
if (count > maximum) {
count = maximum;
}
tail = new String(this.buffer, this.offset, count);
}
return tail;
} | [
"protected",
"String",
"getTail",
"(",
"int",
"maximum",
")",
"{",
"String",
"tail",
"=",
"\"\"",
";",
"if",
"(",
"this",
".",
"offset",
"<",
"this",
".",
"limit",
")",
"{",
"int",
"count",
"=",
"this",
".",
"limit",
"-",
"this",
".",
"offset",
"+"... | This method gets the tail of this scanner limited (truncated) to the given {@code maximum} number of
characters without changing the state.
@param maximum is the maximum number of characters to return from the {@link #getTail() tail}.
@return the tail of this scanner. | [
"This",
"method",
"gets",
"the",
"tail",
"of",
"this",
"scanner",
"limited",
"(",
"truncated",
")",
"to",
"the",
"given",
"{",
"@code",
"maximum",
"}",
"number",
"of",
"characters",
"without",
"changing",
"the",
"state",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/scanner/src/main/java/net/sf/mmm/util/scanner/base/CharSequenceScanner.java#L351-L362 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/json/JsonObject.java | JsonObject.getLong | public long getLong(String name, long defaultValue) {
"""
Returns the <code>long</code> value of the member with the specified name in this object. If
this object does not contain a member with this name, the given default value is returned. If
this object contains multiple members with the given name, the last one will be picked. If this
member's value does not represent a JSON number or if it cannot be interpreted as Java
<code>long</code>, an exception is thrown.
@param name
the name of the member whose value is to be returned
@param defaultValue
the value to be returned if the requested member is missing
@return the value of the last member with the specified name, or the given default value if
this object does not contain a member with that name
"""
JsonValue value = get(name);
return value != null ? value.asLong() : defaultValue;
} | java | public long getLong(String name, long defaultValue) {
JsonValue value = get(name);
return value != null ? value.asLong() : defaultValue;
} | [
"public",
"long",
"getLong",
"(",
"String",
"name",
",",
"long",
"defaultValue",
")",
"{",
"JsonValue",
"value",
"=",
"get",
"(",
"name",
")",
";",
"return",
"value",
"!=",
"null",
"?",
"value",
".",
"asLong",
"(",
")",
":",
"defaultValue",
";",
"}"
] | Returns the <code>long</code> value of the member with the specified name in this object. If
this object does not contain a member with this name, the given default value is returned. If
this object contains multiple members with the given name, the last one will be picked. If this
member's value does not represent a JSON number or if it cannot be interpreted as Java
<code>long</code>, an exception is thrown.
@param name
the name of the member whose value is to be returned
@param defaultValue
the value to be returned if the requested member is missing
@return the value of the last member with the specified name, or the given default value if
this object does not contain a member with that name | [
"Returns",
"the",
"<code",
">",
"long<",
"/",
"code",
">",
"value",
"of",
"the",
"member",
"with",
"the",
"specified",
"name",
"in",
"this",
"object",
".",
"If",
"this",
"object",
"does",
"not",
"contain",
"a",
"member",
"with",
"this",
"name",
"the",
... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/json/JsonObject.java#L600-L603 |
salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/warden/DefaultWardenService.java | DefaultWardenService._constructWardenAlertForUser | private Alert _constructWardenAlertForUser(PrincipalUser user, PolicyCounter counter) {
"""
Create a warden alert which will annotate the corresponding warden metric with suspension events.
@param user The user for which the notification should be created. Cannot be null.
@param counter The policy counter for which the notification should be created. Cannot be null.
@return The warden alert.
"""
String metricExp = _constructWardenMetricExpression("-1h", user, counter);
Alert alert = new Alert(_adminUser, _adminUser, _constructWardenAlertName(user, counter), metricExp, "*/5 * * * *");
List<Trigger> triggers = new ArrayList<>();
EntityManager em = emf.get();
double limit = PolicyLimit.getLimitByUserAndCounter(em, user, counter);
Trigger trigger = new Trigger(alert, counter.getTriggerType(), "counter-value-" + counter.getTriggerType().toString() + "-policy-limit",
limit, 0.0, 0L);
triggers.add(trigger);
List<Notification> notifications = new ArrayList<>();
Notification notification = new Notification(NOTIFICATION_NAME, alert, _getWardenNotifierClass(counter), new ArrayList<String>(), 3600000);
List<String> metricAnnotationList = new ArrayList<String>();
String wardenMetricAnnotation = MessageFormat.format("{0}:{1}'{'user={2}'}':sum", Counter.WARDEN_TRIGGERS.getScope(),
Counter.WARDEN_TRIGGERS.getMetric(), user.getUserName());
metricAnnotationList.add(wardenMetricAnnotation);
notification.setMetricsToAnnotate(metricAnnotationList);
notification.setTriggers(triggers);
notifications.add(notification);
alert.setTriggers(triggers);
alert.setNotifications(notifications);
return alert;
} | java | private Alert _constructWardenAlertForUser(PrincipalUser user, PolicyCounter counter) {
String metricExp = _constructWardenMetricExpression("-1h", user, counter);
Alert alert = new Alert(_adminUser, _adminUser, _constructWardenAlertName(user, counter), metricExp, "*/5 * * * *");
List<Trigger> triggers = new ArrayList<>();
EntityManager em = emf.get();
double limit = PolicyLimit.getLimitByUserAndCounter(em, user, counter);
Trigger trigger = new Trigger(alert, counter.getTriggerType(), "counter-value-" + counter.getTriggerType().toString() + "-policy-limit",
limit, 0.0, 0L);
triggers.add(trigger);
List<Notification> notifications = new ArrayList<>();
Notification notification = new Notification(NOTIFICATION_NAME, alert, _getWardenNotifierClass(counter), new ArrayList<String>(), 3600000);
List<String> metricAnnotationList = new ArrayList<String>();
String wardenMetricAnnotation = MessageFormat.format("{0}:{1}'{'user={2}'}':sum", Counter.WARDEN_TRIGGERS.getScope(),
Counter.WARDEN_TRIGGERS.getMetric(), user.getUserName());
metricAnnotationList.add(wardenMetricAnnotation);
notification.setMetricsToAnnotate(metricAnnotationList);
notification.setTriggers(triggers);
notifications.add(notification);
alert.setTriggers(triggers);
alert.setNotifications(notifications);
return alert;
} | [
"private",
"Alert",
"_constructWardenAlertForUser",
"(",
"PrincipalUser",
"user",
",",
"PolicyCounter",
"counter",
")",
"{",
"String",
"metricExp",
"=",
"_constructWardenMetricExpression",
"(",
"\"-1h\"",
",",
"user",
",",
"counter",
")",
";",
"Alert",
"alert",
"=",... | Create a warden alert which will annotate the corresponding warden metric with suspension events.
@param user The user for which the notification should be created. Cannot be null.
@param counter The policy counter for which the notification should be created. Cannot be null.
@return The warden alert. | [
"Create",
"a",
"warden",
"alert",
"which",
"will",
"annotate",
"the",
"corresponding",
"warden",
"metric",
"with",
"suspension",
"events",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/warden/DefaultWardenService.java#L441-L466 |
lightblue-platform/lightblue-migrator | facade/src/main/java/com/redhat/lightblue/migrator/facade/TimeoutConfiguration.java | TimeoutConfiguration.getTimeoutMS | public long getTimeoutMS(String methodName, FacadeOperation op) {
"""
See ${link
{@link TimeoutConfiguration#getMS(String, FacadeOperation, Type)}
@param methodName
@param op
@return
"""
return getMS(methodName, op, Type.timeout);
} | java | public long getTimeoutMS(String methodName, FacadeOperation op) {
return getMS(methodName, op, Type.timeout);
} | [
"public",
"long",
"getTimeoutMS",
"(",
"String",
"methodName",
",",
"FacadeOperation",
"op",
")",
"{",
"return",
"getMS",
"(",
"methodName",
",",
"op",
",",
"Type",
".",
"timeout",
")",
";",
"}"
] | See ${link
{@link TimeoutConfiguration#getMS(String, FacadeOperation, Type)}
@param methodName
@param op
@return | [
"See",
"$",
"{",
"link",
"{",
"@link",
"TimeoutConfiguration#getMS",
"(",
"String",
"FacadeOperation",
"Type",
")",
"}"
] | train | https://github.com/lightblue-platform/lightblue-migrator/blob/ec20748557b40d1f7851e1816d1b76dae48d2027/facade/src/main/java/com/redhat/lightblue/migrator/facade/TimeoutConfiguration.java#L169-L171 |
joniles/mpxj | src/main/java/net/sf/mpxj/Task.java | Task.removeRelation | private boolean removeRelation(List<Relation> relationList, Task targetTask, RelationType type, Duration lag) {
"""
Internal method used to locate an remove an item from a list Relations.
@param relationList list of Relation instances
@param targetTask target relationship task
@param type target relationship type
@param lag target relationship lag
@return true if a relationship was removed
"""
boolean matchFound = false;
for (Relation relation : relationList)
{
if (relation.getTargetTask() == targetTask)
{
if (relation.getType() == type && relation.getLag().compareTo(lag) == 0)
{
matchFound = relationList.remove(relation);
break;
}
}
}
return matchFound;
} | java | private boolean removeRelation(List<Relation> relationList, Task targetTask, RelationType type, Duration lag)
{
boolean matchFound = false;
for (Relation relation : relationList)
{
if (relation.getTargetTask() == targetTask)
{
if (relation.getType() == type && relation.getLag().compareTo(lag) == 0)
{
matchFound = relationList.remove(relation);
break;
}
}
}
return matchFound;
} | [
"private",
"boolean",
"removeRelation",
"(",
"List",
"<",
"Relation",
">",
"relationList",
",",
"Task",
"targetTask",
",",
"RelationType",
"type",
",",
"Duration",
"lag",
")",
"{",
"boolean",
"matchFound",
"=",
"false",
";",
"for",
"(",
"Relation",
"relation",... | Internal method used to locate an remove an item from a list Relations.
@param relationList list of Relation instances
@param targetTask target relationship task
@param type target relationship type
@param lag target relationship lag
@return true if a relationship was removed | [
"Internal",
"method",
"used",
"to",
"locate",
"an",
"remove",
"an",
"item",
"from",
"a",
"list",
"Relations",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L4646-L4661 |
rhuss/jolokia | agent/jvm/src/main/java/org/jolokia/jvmagent/client/command/AbstractBaseCommand.java | AbstractBaseCommand.getProcessDescription | protected String getProcessDescription(OptionsAndArgs pOpts, VirtualMachineHandler pHandler) {
"""
Get a description of the process attached, either the numeric id only or, if a pattern is given,
the pattern and the associated PID
@param pOpts options from where to take the PID or pattern
@param pHandler handler for looking up the process in case of a pattern lookup
@return a description of the process
"""
if (pOpts.getPid() != null) {
return "PID " + pOpts.getPid();
} else if (pOpts.getProcessPattern() != null) {
StringBuffer desc = new StringBuffer("process matching \"")
.append(pOpts.getProcessPattern().pattern())
.append("\"");
try {
desc.append(" (PID: ")
.append(pHandler.findProcess(pOpts.getProcessPattern()).getId())
.append(")");
} catch (InvocationTargetException e) {
// ignored
} catch (NoSuchMethodException e) {
// ignored
} catch (IllegalAccessException e) {
// ignored
}
return desc.toString();
} else {
return "(null)";
}
} | java | protected String getProcessDescription(OptionsAndArgs pOpts, VirtualMachineHandler pHandler) {
if (pOpts.getPid() != null) {
return "PID " + pOpts.getPid();
} else if (pOpts.getProcessPattern() != null) {
StringBuffer desc = new StringBuffer("process matching \"")
.append(pOpts.getProcessPattern().pattern())
.append("\"");
try {
desc.append(" (PID: ")
.append(pHandler.findProcess(pOpts.getProcessPattern()).getId())
.append(")");
} catch (InvocationTargetException e) {
// ignored
} catch (NoSuchMethodException e) {
// ignored
} catch (IllegalAccessException e) {
// ignored
}
return desc.toString();
} else {
return "(null)";
}
} | [
"protected",
"String",
"getProcessDescription",
"(",
"OptionsAndArgs",
"pOpts",
",",
"VirtualMachineHandler",
"pHandler",
")",
"{",
"if",
"(",
"pOpts",
".",
"getPid",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"\"PID \"",
"+",
"pOpts",
".",
"getPid",
"(",
"... | Get a description of the process attached, either the numeric id only or, if a pattern is given,
the pattern and the associated PID
@param pOpts options from where to take the PID or pattern
@param pHandler handler for looking up the process in case of a pattern lookup
@return a description of the process | [
"Get",
"a",
"description",
"of",
"the",
"process",
"attached",
"either",
"the",
"numeric",
"id",
"only",
"or",
"if",
"a",
"pattern",
"is",
"given",
"the",
"pattern",
"and",
"the",
"associated",
"PID"
] | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/jvm/src/main/java/org/jolokia/jvmagent/client/command/AbstractBaseCommand.java#L127-L149 |
m-m-m/util | text/src/main/java/net/sf/mmm/util/text/base/UnicodeUtilImpl.java | UnicodeUtilImpl.initIso843 | private static void initIso843(Map<Character, String> map) {
"""
Implementation of <a href="http://en.wikipedia.org/wiki/ISO_843">ISO 843</a> (Greek transliteration).
@param map is where to add the transliteration mapping.
"""
// Greek letters
map.put(GREEK_CAPITAL_LETTER_ALPHA, "A");
map.put(GREEK_CAPITAL_LETTER_BETA, "B");
map.put(GREEK_CAPITAL_LETTER_GAMMA, "G");
map.put(GREEK_CAPITAL_LETTER_DELTA, "D");
map.put(GREEK_CAPITAL_LETTER_EPSILON, "E");
map.put(GREEK_CAPITAL_LETTER_ZETA, "Z");
map.put(GREEK_CAPITAL_LETTER_ETA, Character.toString(LATIN_CAPITAL_LETTER_E_WITH_MACRON));
map.put(GREEK_CAPITAL_LETTER_THETA, "Th");
map.put(GREEK_CAPITAL_LETTER_IOTA, "I");
map.put(GREEK_CAPITAL_LETTER_KAPPA, "K");
map.put(GREEK_CAPITAL_LETTER_LAMDA, "L");
map.put(GREEK_CAPITAL_LETTER_MU, "M");
map.put(GREEK_CAPITAL_LETTER_NU, "N");
map.put(GREEK_CAPITAL_LETTER_XI, "X");
map.put(GREEK_CAPITAL_LETTER_OMICRON, "O");
map.put(GREEK_CAPITAL_LETTER_PI, "P");
map.put(GREEK_CAPITAL_LETTER_RHO, "R");
map.put(GREEK_CAPITAL_LETTER_SIGMA, "S");
map.put(GREEK_CAPITAL_LETTER_TAU, "T");
map.put(GREEK_CAPITAL_LETTER_UPSILON, "Y");
map.put(GREEK_CAPITAL_LETTER_PHI, "F");
map.put(GREEK_CAPITAL_LETTER_CHI, "Ch");
map.put(GREEK_CAPITAL_LETTER_PSI, "Ps");
map.put(GREEK_CAPITAL_LETTER_OMEGA, Character.toString(LATIN_CAPITAL_LETTER_O_WITH_MACRON));
// greek specials
map.put(GREEK_LETTER_DIGAMMA, "F");
map.put(GREEK_CAPITAL_LETTER_HETA, "H");
map.put(GREEK_CAPITAL_LETTER_KAPPA, "Q");
map.put(GREEK_CAPITAL_LETTER_SAN, "S");
map.put(GREEK_LETTER_SAMPI, "Ss");
map.put(GREEK_SMALL_LETTER_ALPHA, "a");
map.put(GREEK_SMALL_LETTER_BETA, "b");
map.put(GREEK_SMALL_LETTER_GAMMA, "g");
map.put(GREEK_SMALL_LETTER_DELTA, "d");
map.put(GREEK_SMALL_LETTER_EPSILON, "e");
map.put(GREEK_SMALL_LETTER_ZETA, "z");
map.put(GREEK_SMALL_LETTER_ETA, Character.toString(LATIN_SMALL_LETTER_E_WITH_MACRON));
map.put(GREEK_SMALL_LETTER_ETA_WITH_TONOS, Character.toString(LATIN_SMALL_LETTER_E_WITH_MACRON_AND_ACUTE));
map.put(GREEK_SMALL_LETTER_THETA, "th");
map.put(GREEK_SMALL_LETTER_IOTA, "i");
map.put(GREEK_SMALL_LETTER_IOTA_WITH_TONOS, Character.toString(LATIN_SMALL_LETTER_I_WITH_ACUTE));
map.put(GREEK_SMALL_LETTER_KAPPA, "k");
map.put(GREEK_SMALL_LETTER_LAMDA, "l");
map.put(GREEK_SMALL_LETTER_MU, "m");
map.put(GREEK_SMALL_LETTER_NU, "n");
map.put(GREEK_SMALL_LETTER_XI, "x");
map.put(GREEK_SMALL_LETTER_OMICRON, "o");
map.put(GREEK_SMALL_LETTER_PI, "p");
map.put(GREEK_SMALL_LETTER_RHO, "r");
map.put(GREEK_SMALL_LETTER_SIGMA, "s");
map.put(GREEK_SMALL_LETTER_TAU, "t");
map.put(GREEK_SMALL_LETTER_UPSILON, "y");
map.put(GREEK_SMALL_LETTER_PHI, "f");
map.put(GREEK_SMALL_LETTER_CHI, "ch");
map.put(GREEK_SMALL_LETTER_PSI, "ps");
map.put(GREEK_SMALL_LETTER_OMEGA, Character.toString(LATIN_SMALL_LETTER_O_WITH_MACRON));
// greek specials
map.put(GREEK_SMALL_LETTER_DIGAMMA, "f");
map.put(GREEK_SMALL_LETTER_HETA, "h");
map.put(GREEK_SMALL_LETTER_KOPPA, "q");
map.put(GREEK_SMALL_LETTER_SAN, "s");
map.put(GREEK_SMALL_LETTER_SAMPI, "ss");
} | java | private static void initIso843(Map<Character, String> map) {
// Greek letters
map.put(GREEK_CAPITAL_LETTER_ALPHA, "A");
map.put(GREEK_CAPITAL_LETTER_BETA, "B");
map.put(GREEK_CAPITAL_LETTER_GAMMA, "G");
map.put(GREEK_CAPITAL_LETTER_DELTA, "D");
map.put(GREEK_CAPITAL_LETTER_EPSILON, "E");
map.put(GREEK_CAPITAL_LETTER_ZETA, "Z");
map.put(GREEK_CAPITAL_LETTER_ETA, Character.toString(LATIN_CAPITAL_LETTER_E_WITH_MACRON));
map.put(GREEK_CAPITAL_LETTER_THETA, "Th");
map.put(GREEK_CAPITAL_LETTER_IOTA, "I");
map.put(GREEK_CAPITAL_LETTER_KAPPA, "K");
map.put(GREEK_CAPITAL_LETTER_LAMDA, "L");
map.put(GREEK_CAPITAL_LETTER_MU, "M");
map.put(GREEK_CAPITAL_LETTER_NU, "N");
map.put(GREEK_CAPITAL_LETTER_XI, "X");
map.put(GREEK_CAPITAL_LETTER_OMICRON, "O");
map.put(GREEK_CAPITAL_LETTER_PI, "P");
map.put(GREEK_CAPITAL_LETTER_RHO, "R");
map.put(GREEK_CAPITAL_LETTER_SIGMA, "S");
map.put(GREEK_CAPITAL_LETTER_TAU, "T");
map.put(GREEK_CAPITAL_LETTER_UPSILON, "Y");
map.put(GREEK_CAPITAL_LETTER_PHI, "F");
map.put(GREEK_CAPITAL_LETTER_CHI, "Ch");
map.put(GREEK_CAPITAL_LETTER_PSI, "Ps");
map.put(GREEK_CAPITAL_LETTER_OMEGA, Character.toString(LATIN_CAPITAL_LETTER_O_WITH_MACRON));
// greek specials
map.put(GREEK_LETTER_DIGAMMA, "F");
map.put(GREEK_CAPITAL_LETTER_HETA, "H");
map.put(GREEK_CAPITAL_LETTER_KAPPA, "Q");
map.put(GREEK_CAPITAL_LETTER_SAN, "S");
map.put(GREEK_LETTER_SAMPI, "Ss");
map.put(GREEK_SMALL_LETTER_ALPHA, "a");
map.put(GREEK_SMALL_LETTER_BETA, "b");
map.put(GREEK_SMALL_LETTER_GAMMA, "g");
map.put(GREEK_SMALL_LETTER_DELTA, "d");
map.put(GREEK_SMALL_LETTER_EPSILON, "e");
map.put(GREEK_SMALL_LETTER_ZETA, "z");
map.put(GREEK_SMALL_LETTER_ETA, Character.toString(LATIN_SMALL_LETTER_E_WITH_MACRON));
map.put(GREEK_SMALL_LETTER_ETA_WITH_TONOS, Character.toString(LATIN_SMALL_LETTER_E_WITH_MACRON_AND_ACUTE));
map.put(GREEK_SMALL_LETTER_THETA, "th");
map.put(GREEK_SMALL_LETTER_IOTA, "i");
map.put(GREEK_SMALL_LETTER_IOTA_WITH_TONOS, Character.toString(LATIN_SMALL_LETTER_I_WITH_ACUTE));
map.put(GREEK_SMALL_LETTER_KAPPA, "k");
map.put(GREEK_SMALL_LETTER_LAMDA, "l");
map.put(GREEK_SMALL_LETTER_MU, "m");
map.put(GREEK_SMALL_LETTER_NU, "n");
map.put(GREEK_SMALL_LETTER_XI, "x");
map.put(GREEK_SMALL_LETTER_OMICRON, "o");
map.put(GREEK_SMALL_LETTER_PI, "p");
map.put(GREEK_SMALL_LETTER_RHO, "r");
map.put(GREEK_SMALL_LETTER_SIGMA, "s");
map.put(GREEK_SMALL_LETTER_TAU, "t");
map.put(GREEK_SMALL_LETTER_UPSILON, "y");
map.put(GREEK_SMALL_LETTER_PHI, "f");
map.put(GREEK_SMALL_LETTER_CHI, "ch");
map.put(GREEK_SMALL_LETTER_PSI, "ps");
map.put(GREEK_SMALL_LETTER_OMEGA, Character.toString(LATIN_SMALL_LETTER_O_WITH_MACRON));
// greek specials
map.put(GREEK_SMALL_LETTER_DIGAMMA, "f");
map.put(GREEK_SMALL_LETTER_HETA, "h");
map.put(GREEK_SMALL_LETTER_KOPPA, "q");
map.put(GREEK_SMALL_LETTER_SAN, "s");
map.put(GREEK_SMALL_LETTER_SAMPI, "ss");
} | [
"private",
"static",
"void",
"initIso843",
"(",
"Map",
"<",
"Character",
",",
"String",
">",
"map",
")",
"{",
"// Greek letters",
"map",
".",
"put",
"(",
"GREEK_CAPITAL_LETTER_ALPHA",
",",
"\"A\"",
")",
";",
"map",
".",
"put",
"(",
"GREEK_CAPITAL_LETTER_BETA",... | Implementation of <a href="http://en.wikipedia.org/wiki/ISO_843">ISO 843</a> (Greek transliteration).
@param map is where to add the transliteration mapping. | [
"Implementation",
"of",
"<a",
"href",
"=",
"http",
":",
"//",
"en",
".",
"wikipedia",
".",
"org",
"/",
"wiki",
"/",
"ISO_843",
">",
"ISO",
"843<",
"/",
"a",
">",
"(",
"Greek",
"transliteration",
")",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/text/src/main/java/net/sf/mmm/util/text/base/UnicodeUtilImpl.java#L304-L370 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_easyHunting_serviceName_screenListConditions_conditions_conditionId_GET | public OvhEasyHuntingScreenListsConditions billingAccount_easyHunting_serviceName_screenListConditions_conditions_conditionId_GET(String billingAccount, String serviceName, Long conditionId) throws IOException {
"""
Get this object properties
REST: GET /telephony/{billingAccount}/easyHunting/{serviceName}/screenListConditions/conditions/{conditionId}
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param conditionId [required]
"""
String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/screenListConditions/conditions/{conditionId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, conditionId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhEasyHuntingScreenListsConditions.class);
} | java | public OvhEasyHuntingScreenListsConditions billingAccount_easyHunting_serviceName_screenListConditions_conditions_conditionId_GET(String billingAccount, String serviceName, Long conditionId) throws IOException {
String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/screenListConditions/conditions/{conditionId}";
StringBuilder sb = path(qPath, billingAccount, serviceName, conditionId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhEasyHuntingScreenListsConditions.class);
} | [
"public",
"OvhEasyHuntingScreenListsConditions",
"billingAccount_easyHunting_serviceName_screenListConditions_conditions_conditionId_GET",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Long",
"conditionId",
")",
"throws",
"IOException",
"{",
"String",
"qPath"... | Get this object properties
REST: GET /telephony/{billingAccount}/easyHunting/{serviceName}/screenListConditions/conditions/{conditionId}
@param billingAccount [required] The name of your billingAccount
@param serviceName [required]
@param conditionId [required] | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L3253-L3258 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/factory/feature/detect/line/FactoryDetectLineAlgs.java | FactoryDetectLineAlgs.lineRansac | public static <I extends ImageGray<I>, D extends ImageGray<D>>
DetectLineSegmentsGridRansac<I,D> lineRansac(int regionSize ,
double thresholdEdge ,
double thresholdAngle ,
boolean connectLines,
Class<I> imageType ,
Class<D> derivType ) {
"""
Detects line segments inside an image using the {@link DetectLineSegmentsGridRansac} algorithm.
@see DetectLineSegmentsGridRansac
@param regionSize Size of the region considered. Try 40 and tune.
@param thresholdEdge Threshold for determining which pixels belong to an edge or not. Try 30 and tune.
@param thresholdAngle Tolerance in angle for allowing two edgels to be paired up, in radians. Try 2.36
@param connectLines Should lines be connected and optimized.
@param imageType Type of single band input image.
@param derivType Image derivative type.
@return Line segment detector
"""
ImageGradient<I,D> gradient = FactoryDerivative.sobel(imageType,derivType);
ModelManagerLinePolar2D_F32 manager = new ModelManagerLinePolar2D_F32();
GridLineModelDistance distance = new GridLineModelDistance((float)thresholdAngle);
GridLineModelFitter fitter = new GridLineModelFitter((float)thresholdAngle);
ModelMatcher<LinePolar2D_F32, Edgel> matcher =
new Ransac<>(123123, manager, fitter, distance, 25, 1);
GridRansacLineDetector<D> alg;
if( derivType == GrayF32.class ) {
alg = (GridRansacLineDetector)new ImplGridRansacLineDetector_F32(regionSize,10,matcher);
} else if( derivType == GrayS16.class ) {
alg = (GridRansacLineDetector)new ImplGridRansacLineDetector_S16(regionSize,10,matcher);
} else {
throw new IllegalArgumentException("Unsupported derivative type");
}
ConnectLinesGrid connect = null;
if( connectLines )
connect = new ConnectLinesGrid(Math.PI*0.01,1,8);
return new DetectLineSegmentsGridRansac<>(alg, connect, gradient, thresholdEdge, imageType, derivType);
} | java | public static <I extends ImageGray<I>, D extends ImageGray<D>>
DetectLineSegmentsGridRansac<I,D> lineRansac(int regionSize ,
double thresholdEdge ,
double thresholdAngle ,
boolean connectLines,
Class<I> imageType ,
Class<D> derivType ) {
ImageGradient<I,D> gradient = FactoryDerivative.sobel(imageType,derivType);
ModelManagerLinePolar2D_F32 manager = new ModelManagerLinePolar2D_F32();
GridLineModelDistance distance = new GridLineModelDistance((float)thresholdAngle);
GridLineModelFitter fitter = new GridLineModelFitter((float)thresholdAngle);
ModelMatcher<LinePolar2D_F32, Edgel> matcher =
new Ransac<>(123123, manager, fitter, distance, 25, 1);
GridRansacLineDetector<D> alg;
if( derivType == GrayF32.class ) {
alg = (GridRansacLineDetector)new ImplGridRansacLineDetector_F32(regionSize,10,matcher);
} else if( derivType == GrayS16.class ) {
alg = (GridRansacLineDetector)new ImplGridRansacLineDetector_S16(regionSize,10,matcher);
} else {
throw new IllegalArgumentException("Unsupported derivative type");
}
ConnectLinesGrid connect = null;
if( connectLines )
connect = new ConnectLinesGrid(Math.PI*0.01,1,8);
return new DetectLineSegmentsGridRansac<>(alg, connect, gradient, thresholdEdge, imageType, derivType);
} | [
"public",
"static",
"<",
"I",
"extends",
"ImageGray",
"<",
"I",
">",
",",
"D",
"extends",
"ImageGray",
"<",
"D",
">",
">",
"DetectLineSegmentsGridRansac",
"<",
"I",
",",
"D",
">",
"lineRansac",
"(",
"int",
"regionSize",
",",
"double",
"thresholdEdge",
",",... | Detects line segments inside an image using the {@link DetectLineSegmentsGridRansac} algorithm.
@see DetectLineSegmentsGridRansac
@param regionSize Size of the region considered. Try 40 and tune.
@param thresholdEdge Threshold for determining which pixels belong to an edge or not. Try 30 and tune.
@param thresholdAngle Tolerance in angle for allowing two edgels to be paired up, in radians. Try 2.36
@param connectLines Should lines be connected and optimized.
@param imageType Type of single band input image.
@param derivType Image derivative type.
@return Line segment detector | [
"Detects",
"line",
"segments",
"inside",
"an",
"image",
"using",
"the",
"{",
"@link",
"DetectLineSegmentsGridRansac",
"}",
"algorithm",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/factory/feature/detect/line/FactoryDetectLineAlgs.java#L61-L92 |
Hygieia/Hygieia | collectors/feature/versionone/src/main/java/com/capitalone/dashboard/util/DateUtil.java | DateUtil.getChangeDateMinutePrior | public static String getChangeDateMinutePrior(String changeDateISO, int priorMinutes) {
"""
Generates and retrieves the change date that occurs a minute prior to the
specified change date in ISO format.
@param changeDateISO
A given change date in ISO format
@return The ISO-formatted date/time stamp for a minute prior to the given
change date
"""
return DateUtil.toISODateRealTimeFormat(DateUtil.getDatePriorToMinutes(
DateUtil.fromISODateTimeFormat(changeDateISO), priorMinutes));
} | java | public static String getChangeDateMinutePrior(String changeDateISO, int priorMinutes) {
return DateUtil.toISODateRealTimeFormat(DateUtil.getDatePriorToMinutes(
DateUtil.fromISODateTimeFormat(changeDateISO), priorMinutes));
} | [
"public",
"static",
"String",
"getChangeDateMinutePrior",
"(",
"String",
"changeDateISO",
",",
"int",
"priorMinutes",
")",
"{",
"return",
"DateUtil",
".",
"toISODateRealTimeFormat",
"(",
"DateUtil",
".",
"getDatePriorToMinutes",
"(",
"DateUtil",
".",
"fromISODateTimeFor... | Generates and retrieves the change date that occurs a minute prior to the
specified change date in ISO format.
@param changeDateISO
A given change date in ISO format
@return The ISO-formatted date/time stamp for a minute prior to the given
change date | [
"Generates",
"and",
"retrieves",
"the",
"change",
"date",
"that",
"occurs",
"a",
"minute",
"prior",
"to",
"the",
"specified",
"change",
"date",
"in",
"ISO",
"format",
"."
] | train | https://github.com/Hygieia/Hygieia/blob/d8b67a590da2744acf59bcd99d9b34ef1bb84890/collectors/feature/versionone/src/main/java/com/capitalone/dashboard/util/DateUtil.java#L55-L58 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATMainConsumer.java | CATMainConsumer.setBifurcatedSession | public void setBifurcatedSession(BifurcatedConsumerSession sess) {
"""
This method will put the main consumer into bifurcated mode.
@param sess The bifurcated session.
"""
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setBifurcatedSession", sess);
subConsumer = new CATBifurcatedConsumer(this, sess);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setBifurcatedSession");
} | java | public void setBifurcatedSession(BifurcatedConsumerSession sess)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "setBifurcatedSession", sess);
subConsumer = new CATBifurcatedConsumer(this, sess);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "setBifurcatedSession");
} | [
"public",
"void",
"setBifurcatedSession",
"(",
"BifurcatedConsumerSession",
"sess",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",
... | This method will put the main consumer into bifurcated mode.
@param sess The bifurcated session. | [
"This",
"method",
"will",
"put",
"the",
"main",
"consumer",
"into",
"bifurcated",
"mode",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CATMainConsumer.java#L1124-L1131 |
JodaOrg/joda-time | src/main/java/org/joda/time/field/BaseDateTimeField.java | BaseDateTimeField.convertText | protected int convertText(String text, Locale locale) {
"""
Convert the specified text and locale into a value.
@param text the text to convert
@param locale the locale to convert using
@return the value extracted from the text
@throws IllegalArgumentException if the text is invalid
"""
try {
return Integer.parseInt(text);
} catch (NumberFormatException ex) {
throw new IllegalFieldValueException(getType(), text);
}
} | java | protected int convertText(String text, Locale locale) {
try {
return Integer.parseInt(text);
} catch (NumberFormatException ex) {
throw new IllegalFieldValueException(getType(), text);
}
} | [
"protected",
"int",
"convertText",
"(",
"String",
"text",
",",
"Locale",
"locale",
")",
"{",
"try",
"{",
"return",
"Integer",
".",
"parseInt",
"(",
"text",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"ex",
")",
"{",
"throw",
"new",
"IllegalFieldV... | Convert the specified text and locale into a value.
@param text the text to convert
@param locale the locale to convert using
@return the value extracted from the text
@throws IllegalArgumentException if the text is invalid | [
"Convert",
"the",
"specified",
"text",
"and",
"locale",
"into",
"a",
"value",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/field/BaseDateTimeField.java#L666-L672 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java | ApiOvhDedicatedserver.serviceName_statistics_process_GET | public ArrayList<OvhRtmCommandSize> serviceName_statistics_process_GET(String serviceName) throws IOException {
"""
Get server process
REST: GET /dedicated/server/{serviceName}/statistics/process
@param serviceName [required] The internal name of your dedicated server
"""
String qPath = "/dedicated/server/{serviceName}/statistics/process";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t10);
} | java | public ArrayList<OvhRtmCommandSize> serviceName_statistics_process_GET(String serviceName) throws IOException {
String qPath = "/dedicated/server/{serviceName}/statistics/process";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t10);
} | [
"public",
"ArrayList",
"<",
"OvhRtmCommandSize",
">",
"serviceName_statistics_process_GET",
"(",
"String",
"serviceName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicated/server/{serviceName}/statistics/process\"",
";",
"StringBuilder",
"sb",
"=",
"p... | Get server process
REST: GET /dedicated/server/{serviceName}/statistics/process
@param serviceName [required] The internal name of your dedicated server | [
"Get",
"server",
"process"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L1318-L1323 |
cdk/cdk | legacy/src/main/java/org/openscience/cdk/smiles/FixBondOrdersTool.java | FixBondOrdersTool.setAllRingBondsSingleOrder | private Boolean setAllRingBondsSingleOrder(List<Integer> ringGroup, IRingSet ringSet) {
"""
Sets all bonds in an {@link IRingSet} to single order.
@param ringGroup
@param ringSet
@return True for success
"""
for (Integer i : ringGroup) {
for (IBond bond : ringSet.getAtomContainer(i).bonds()) {
bond.setOrder(IBond.Order.SINGLE);
}
}
return true;
} | java | private Boolean setAllRingBondsSingleOrder(List<Integer> ringGroup, IRingSet ringSet) {
for (Integer i : ringGroup) {
for (IBond bond : ringSet.getAtomContainer(i).bonds()) {
bond.setOrder(IBond.Order.SINGLE);
}
}
return true;
} | [
"private",
"Boolean",
"setAllRingBondsSingleOrder",
"(",
"List",
"<",
"Integer",
">",
"ringGroup",
",",
"IRingSet",
"ringSet",
")",
"{",
"for",
"(",
"Integer",
"i",
":",
"ringGroup",
")",
"{",
"for",
"(",
"IBond",
"bond",
":",
"ringSet",
".",
"getAtomContain... | Sets all bonds in an {@link IRingSet} to single order.
@param ringGroup
@param ringSet
@return True for success | [
"Sets",
"all",
"bonds",
"in",
"an",
"{"
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/smiles/FixBondOrdersTool.java#L361-L368 |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/MemcachedNodesManager.java | MemcachedNodesManager.changeSessionIdForTomcatFailover | public String changeSessionIdForTomcatFailover( @Nonnull final String sessionId, final String jvmRoute ) {
"""
Changes the sessionId by setting the given jvmRoute and replacing the memcachedNodeId if it's currently
set to a failoverNodeId.
@param sessionId the current session id
@param jvmRoute the new jvmRoute to set.
@return the session id with maybe new jvmRoute and/or new memcachedId.
"""
final String newSessionId = jvmRoute != null && !jvmRoute.trim().isEmpty()
? _sessionIdFormat.changeJvmRoute( sessionId, jvmRoute )
: _sessionIdFormat.stripJvmRoute(sessionId);
if ( isEncodeNodeIdInSessionId() ) {
final String nodeId = _sessionIdFormat.extractMemcachedId( newSessionId );
if(_failoverNodeIds != null && _failoverNodeIds.contains(nodeId)) {
final String newNodeId = _nodeIdService.getAvailableNodeId( nodeId );
if ( newNodeId != null ) {
return _sessionIdFormat.createNewSessionId( newSessionId, newNodeId);
}
}
}
return newSessionId;
} | java | public String changeSessionIdForTomcatFailover( @Nonnull final String sessionId, final String jvmRoute ) {
final String newSessionId = jvmRoute != null && !jvmRoute.trim().isEmpty()
? _sessionIdFormat.changeJvmRoute( sessionId, jvmRoute )
: _sessionIdFormat.stripJvmRoute(sessionId);
if ( isEncodeNodeIdInSessionId() ) {
final String nodeId = _sessionIdFormat.extractMemcachedId( newSessionId );
if(_failoverNodeIds != null && _failoverNodeIds.contains(nodeId)) {
final String newNodeId = _nodeIdService.getAvailableNodeId( nodeId );
if ( newNodeId != null ) {
return _sessionIdFormat.createNewSessionId( newSessionId, newNodeId);
}
}
}
return newSessionId;
} | [
"public",
"String",
"changeSessionIdForTomcatFailover",
"(",
"@",
"Nonnull",
"final",
"String",
"sessionId",
",",
"final",
"String",
"jvmRoute",
")",
"{",
"final",
"String",
"newSessionId",
"=",
"jvmRoute",
"!=",
"null",
"&&",
"!",
"jvmRoute",
".",
"trim",
"(",
... | Changes the sessionId by setting the given jvmRoute and replacing the memcachedNodeId if it's currently
set to a failoverNodeId.
@param sessionId the current session id
@param jvmRoute the new jvmRoute to set.
@return the session id with maybe new jvmRoute and/or new memcachedId. | [
"Changes",
"the",
"sessionId",
"by",
"setting",
"the",
"given",
"jvmRoute",
"and",
"replacing",
"the",
"memcachedNodeId",
"if",
"it",
"s",
"currently",
"set",
"to",
"a",
"failoverNodeId",
"."
] | train | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/MemcachedNodesManager.java#L520-L534 |
alkacon/opencms-core | src/org/opencms/workplace/editors/CmsXmlContentEditor.java | CmsXmlContentEditor.buildElementChoices | public JSONArray buildElementChoices(String elementName, boolean choiceType, boolean checkChoice) {
"""
Returns the JSON array with information about the choices of a given element.<p>
The returned array is only filled if the given element has choice options, otherwise an empty array is returned.<br/>
Note: the first array element is an object containing information if the element itself is a choice type,
the following elements are the choice option items.<p>
@param elementName the element name to check (complete xpath)
@param choiceType flag indicating if the given element name represents a choice type or not
@param checkChoice flag indicating if the element name should be checked if it is a choice option and choice type
@return the JSON array with information about the choices of a given element
"""
JSONArray choiceElements = new JSONArray();
String choiceName = elementName;
I_CmsXmlSchemaType elemType = m_content.getContentDefinition().getSchemaType(elementName);
if (checkChoice && elemType.isChoiceOption() && elemType.isChoiceType()) {
// the element itself is a choice option and again a choice type, remove the last element to get correct choices
choiceName = CmsXmlUtils.removeLastXpathElement(elementName);
}
// use xpath to get choice information
if (m_content.hasChoiceOptions(choiceName, getElementLocale())) {
// we have choice options, first add information about type to create
JSONObject info = new JSONObject();
try {
// put information if element is a choice type
info.put("choicetype", choiceType);
choiceElements.put(info);
// get the available choice options for the choice element
List<I_CmsXmlSchemaType> options = m_content.getChoiceOptions(choiceName, getElementLocale());
for (Iterator<I_CmsXmlSchemaType> i = options.iterator(); i.hasNext();) {
// add the available element options
I_CmsXmlSchemaType type = i.next();
JSONObject option = new JSONObject();
String key = A_CmsWidget.LABEL_PREFIX
+ type.getContentDefinition().getInnerName()
+ "."
+ type.getName();
// add element name, label and help info
option.put("name", type.getName());
option.put("label", keyDefault(key, type.getName()));
option.put("help", keyDefault(key + A_CmsWidget.HELP_POSTFIX, ""));
// add info if the choice itself is a (sub) choice type
option.put("subchoice", type.isChoiceType());
choiceElements.put(option);
}
} catch (JSONException e) {
// ignore, should not happen
}
}
return choiceElements;
} | java | public JSONArray buildElementChoices(String elementName, boolean choiceType, boolean checkChoice) {
JSONArray choiceElements = new JSONArray();
String choiceName = elementName;
I_CmsXmlSchemaType elemType = m_content.getContentDefinition().getSchemaType(elementName);
if (checkChoice && elemType.isChoiceOption() && elemType.isChoiceType()) {
// the element itself is a choice option and again a choice type, remove the last element to get correct choices
choiceName = CmsXmlUtils.removeLastXpathElement(elementName);
}
// use xpath to get choice information
if (m_content.hasChoiceOptions(choiceName, getElementLocale())) {
// we have choice options, first add information about type to create
JSONObject info = new JSONObject();
try {
// put information if element is a choice type
info.put("choicetype", choiceType);
choiceElements.put(info);
// get the available choice options for the choice element
List<I_CmsXmlSchemaType> options = m_content.getChoiceOptions(choiceName, getElementLocale());
for (Iterator<I_CmsXmlSchemaType> i = options.iterator(); i.hasNext();) {
// add the available element options
I_CmsXmlSchemaType type = i.next();
JSONObject option = new JSONObject();
String key = A_CmsWidget.LABEL_PREFIX
+ type.getContentDefinition().getInnerName()
+ "."
+ type.getName();
// add element name, label and help info
option.put("name", type.getName());
option.put("label", keyDefault(key, type.getName()));
option.put("help", keyDefault(key + A_CmsWidget.HELP_POSTFIX, ""));
// add info if the choice itself is a (sub) choice type
option.put("subchoice", type.isChoiceType());
choiceElements.put(option);
}
} catch (JSONException e) {
// ignore, should not happen
}
}
return choiceElements;
} | [
"public",
"JSONArray",
"buildElementChoices",
"(",
"String",
"elementName",
",",
"boolean",
"choiceType",
",",
"boolean",
"checkChoice",
")",
"{",
"JSONArray",
"choiceElements",
"=",
"new",
"JSONArray",
"(",
")",
";",
"String",
"choiceName",
"=",
"elementName",
";... | Returns the JSON array with information about the choices of a given element.<p>
The returned array is only filled if the given element has choice options, otherwise an empty array is returned.<br/>
Note: the first array element is an object containing information if the element itself is a choice type,
the following elements are the choice option items.<p>
@param elementName the element name to check (complete xpath)
@param choiceType flag indicating if the given element name represents a choice type or not
@param checkChoice flag indicating if the element name should be checked if it is a choice option and choice type
@return the JSON array with information about the choices of a given element | [
"Returns",
"the",
"JSON",
"array",
"with",
"information",
"about",
"the",
"choices",
"of",
"a",
"given",
"element",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/editors/CmsXmlContentEditor.java#L730-L770 |
vakinge/jeesuite-libs | jeesuite-common/src/main/java/com/jeesuite/common/crypt/DES.java | DES.decrypt | public static String decrypt(String key,String data) {
"""
DES算法,解密
@param data 待解密字符串
@param key 解密私钥,长度不能够小于8位
@return 解密后的字节数组
@throws Exception 异常
"""
if(data == null)
return null;
try {
DESKeySpec dks = new DESKeySpec(key.getBytes());
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
//key的长度不能够小于8位字节
Key secretKey = keyFactory.generateSecret(dks);
Cipher cipher = Cipher.getInstance(ALGORITHM_DES);
AlgorithmParameterSpec paramSpec = new IvParameterSpec(IV_PARAMS_BYTES);
cipher.init(Cipher.DECRYPT_MODE, secretKey, paramSpec);
return new String(cipher.doFinal(hex2byte(data.getBytes())));
} catch (Exception e){
e.printStackTrace();
return data;
}
} | java | public static String decrypt(String key,String data) {
if(data == null)
return null;
try {
DESKeySpec dks = new DESKeySpec(key.getBytes());
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
//key的长度不能够小于8位字节
Key secretKey = keyFactory.generateSecret(dks);
Cipher cipher = Cipher.getInstance(ALGORITHM_DES);
AlgorithmParameterSpec paramSpec = new IvParameterSpec(IV_PARAMS_BYTES);
cipher.init(Cipher.DECRYPT_MODE, secretKey, paramSpec);
return new String(cipher.doFinal(hex2byte(data.getBytes())));
} catch (Exception e){
e.printStackTrace();
return data;
}
} | [
"public",
"static",
"String",
"decrypt",
"(",
"String",
"key",
",",
"String",
"data",
")",
"{",
"if",
"(",
"data",
"==",
"null",
")",
"return",
"null",
";",
"try",
"{",
"DESKeySpec",
"dks",
"=",
"new",
"DESKeySpec",
"(",
"key",
".",
"getBytes",
"(",
... | DES算法,解密
@param data 待解密字符串
@param key 解密私钥,长度不能够小于8位
@return 解密后的字节数组
@throws Exception 异常 | [
"DES算法,解密"
] | train | https://github.com/vakinge/jeesuite-libs/blob/c48fe2c7fbd294892cf4030dbec96e744dd3e386/jeesuite-common/src/main/java/com/jeesuite/common/crypt/DES.java#L55-L71 |
salesforce/Argus | ArgusCore/src/main/java/com/salesforce/dva/argus/service/mq/kafka/Consumer.java | Consumer.initializeTopic | public void initializeTopic(String topic) {
"""
This method creates Kafka streams for a topic so that messages can be streamed to the local buffer. If the streams for the given topic have
already been initialized the returns. Information about a particular topic is stored in a HashMap. This method uses double-checked locking to
make sure only one client thread can initialize streams for a topic. Moreover, it also helps subsequent calls, to check if the topic has been
initialized, be not synchronized and hence return faster.
@param topic The topic to initialize.
"""
if (_topics.get(topic) == null) {
synchronized (this) {
if (_topics.get(topic) == null) {
_logger.info("Initializing streams for topic: {}", topic);
Properties props = new Properties();
props.setProperty("zookeeper.connect",
_configuration.getValue(Property.ZOOKEEPER_CONNECT.getName(), Property.ZOOKEEPER_CONNECT.getDefaultValue()));
props.setProperty("group.id",
_configuration.getValue(Property.KAFKA_CONSUMER_GROUPID.getName(), Property.KAFKA_CONSUMER_GROUPID.getDefaultValue()));
props.setProperty("auto.offset.reset", _configuration.getValue(Property.KAFKA_CONSUMER_OFFSET_RESET.getName(), Property.KAFKA_CONSUMER_OFFSET_RESET.getDefaultValue()));
props.setProperty("auto.commit.interval.ms", "60000");
props.setProperty("fetch.message.max.bytes", "2000000");
ConsumerConnector consumer = kafka.consumer.Consumer.createJavaConsumerConnector(new ConsumerConfig(props));
List<KafkaStream<byte[], byte[]>> streams = _createStreams(consumer, topic);
Topic t = new Topic(topic, consumer, streams.size());
_topics.put(topic, t);
_startStreamingMessages(topic, streams);
}
}
}
} | java | public void initializeTopic(String topic) {
if (_topics.get(topic) == null) {
synchronized (this) {
if (_topics.get(topic) == null) {
_logger.info("Initializing streams for topic: {}", topic);
Properties props = new Properties();
props.setProperty("zookeeper.connect",
_configuration.getValue(Property.ZOOKEEPER_CONNECT.getName(), Property.ZOOKEEPER_CONNECT.getDefaultValue()));
props.setProperty("group.id",
_configuration.getValue(Property.KAFKA_CONSUMER_GROUPID.getName(), Property.KAFKA_CONSUMER_GROUPID.getDefaultValue()));
props.setProperty("auto.offset.reset", _configuration.getValue(Property.KAFKA_CONSUMER_OFFSET_RESET.getName(), Property.KAFKA_CONSUMER_OFFSET_RESET.getDefaultValue()));
props.setProperty("auto.commit.interval.ms", "60000");
props.setProperty("fetch.message.max.bytes", "2000000");
ConsumerConnector consumer = kafka.consumer.Consumer.createJavaConsumerConnector(new ConsumerConfig(props));
List<KafkaStream<byte[], byte[]>> streams = _createStreams(consumer, topic);
Topic t = new Topic(topic, consumer, streams.size());
_topics.put(topic, t);
_startStreamingMessages(topic, streams);
}
}
}
} | [
"public",
"void",
"initializeTopic",
"(",
"String",
"topic",
")",
"{",
"if",
"(",
"_topics",
".",
"get",
"(",
"topic",
")",
"==",
"null",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"_topics",
".",
"get",
"(",
"topic",
")",
"==",
"n... | This method creates Kafka streams for a topic so that messages can be streamed to the local buffer. If the streams for the given topic have
already been initialized the returns. Information about a particular topic is stored in a HashMap. This method uses double-checked locking to
make sure only one client thread can initialize streams for a topic. Moreover, it also helps subsequent calls, to check if the topic has been
initialized, be not synchronized and hence return faster.
@param topic The topic to initialize. | [
"This",
"method",
"creates",
"Kafka",
"streams",
"for",
"a",
"topic",
"so",
"that",
"messages",
"can",
"be",
"streamed",
"to",
"the",
"local",
"buffer",
".",
"If",
"the",
"streams",
"for",
"the",
"given",
"topic",
"have",
"already",
"been",
"initialized",
... | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/mq/kafka/Consumer.java#L103-L128 |
citiususc/hipster | hipster-core/src/main/java/es/usc/citius/hipster/model/function/impl/ADStarNodeExpander.java | ADStarNodeExpander.updateInconsistent | private boolean updateInconsistent(N node, Map<Transition<A, S>, N> predecessorMap) {
"""
Updates a node in inconsistent state (V <= G), evaluating all the predecessors of the current node
and updating the parent to the node which combination of cost and transition is minimal.
@param node inconsistent {@link es.usc.citius.hipster.algorithm.ADStarForward} node to update
@param predecessorMap map containing the the predecessor nodes and
@return true if the node has changed its {@link es.usc.citius.hipster.model.impl.ADStarNodeImpl.Key}
"""
C minValue = add.getIdentityElem();
N minParent = null;
Transition<A, S> minTransition = null;
for (Map.Entry<Transition<A, S>, N> current : predecessorMap
.entrySet()) {
C value = add.apply(current.getValue().getV(), costFunction.evaluate(current.getKey()));
//T value = current.getValue().v.add(this.costFunction.evaluate(current.getKey()));
if (value.compareTo(minValue) < 0) {
minValue = value;
minParent = current.getValue();
minTransition = current.getKey();
}
}
node.setPreviousNode(minParent);
// node.previousNode = minParent;
node.setG(minValue);
node.setState(minTransition.getState());
node.setAction(minTransition.getAction());
// node.state = minTransition;
node.getKey().update(node.getG(), node.getV(), heuristicFunction.estimate(minTransition.getState()), epsilon, add, scale);
return true;
} | java | private boolean updateInconsistent(N node, Map<Transition<A, S>, N> predecessorMap) {
C minValue = add.getIdentityElem();
N minParent = null;
Transition<A, S> minTransition = null;
for (Map.Entry<Transition<A, S>, N> current : predecessorMap
.entrySet()) {
C value = add.apply(current.getValue().getV(), costFunction.evaluate(current.getKey()));
//T value = current.getValue().v.add(this.costFunction.evaluate(current.getKey()));
if (value.compareTo(minValue) < 0) {
minValue = value;
minParent = current.getValue();
minTransition = current.getKey();
}
}
node.setPreviousNode(minParent);
// node.previousNode = minParent;
node.setG(minValue);
node.setState(minTransition.getState());
node.setAction(minTransition.getAction());
// node.state = minTransition;
node.getKey().update(node.getG(), node.getV(), heuristicFunction.estimate(minTransition.getState()), epsilon, add, scale);
return true;
} | [
"private",
"boolean",
"updateInconsistent",
"(",
"N",
"node",
",",
"Map",
"<",
"Transition",
"<",
"A",
",",
"S",
">",
",",
"N",
">",
"predecessorMap",
")",
"{",
"C",
"minValue",
"=",
"add",
".",
"getIdentityElem",
"(",
")",
";",
"N",
"minParent",
"=",
... | Updates a node in inconsistent state (V <= G), evaluating all the predecessors of the current node
and updating the parent to the node which combination of cost and transition is minimal.
@param node inconsistent {@link es.usc.citius.hipster.algorithm.ADStarForward} node to update
@param predecessorMap map containing the the predecessor nodes and
@return true if the node has changed its {@link es.usc.citius.hipster.model.impl.ADStarNodeImpl.Key} | [
"Updates",
"a",
"node",
"in",
"inconsistent",
"state",
"(",
"V",
"<",
"=",
"G",
")",
"evaluating",
"all",
"the",
"predecessors",
"of",
"the",
"current",
"node",
"and",
"updating",
"the",
"parent",
"to",
"the",
"node",
"which",
"combination",
"of",
"cost",
... | train | https://github.com/citiususc/hipster/blob/9ab1236abb833a27641ae73ba9ca890d5c17598e/hipster-core/src/main/java/es/usc/citius/hipster/model/function/impl/ADStarNodeExpander.java#L190-L212 |
pac4j/pac4j | pac4j-core/src/main/java/org/pac4j/core/engine/DefaultSecurityLogic.java | DefaultSecurityLogic.saveRequestedUrl | protected void saveRequestedUrl(final C context, final List<Client> currentClients, AjaxRequestResolver ajaxRequestResolver) {
"""
Save the requested url.
@param context the web context
@param currentClients the current clients
"""
if (ajaxRequestResolver == null || !ajaxRequestResolver.isAjax(context)) {
savedRequestHandler.save(context);
}
} | java | protected void saveRequestedUrl(final C context, final List<Client> currentClients, AjaxRequestResolver ajaxRequestResolver) {
if (ajaxRequestResolver == null || !ajaxRequestResolver.isAjax(context)) {
savedRequestHandler.save(context);
}
} | [
"protected",
"void",
"saveRequestedUrl",
"(",
"final",
"C",
"context",
",",
"final",
"List",
"<",
"Client",
">",
"currentClients",
",",
"AjaxRequestResolver",
"ajaxRequestResolver",
")",
"{",
"if",
"(",
"ajaxRequestResolver",
"==",
"null",
"||",
"!",
"ajaxRequestR... | Save the requested url.
@param context the web context
@param currentClients the current clients | [
"Save",
"the",
"requested",
"url",
"."
] | train | https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-core/src/main/java/org/pac4j/core/engine/DefaultSecurityLogic.java#L204-L208 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/maplayer/MapLayer.java | MapLayer.contains | @Pure
public boolean contains(Point2D<?, ?> point, double delta) {
"""
Replies if the specified point (<var>x</var>,<var>y</var>)
was inside the figure of this MapElement.
<p>If this MapElement has no associated figure, this method
always returns <code>false</code>.
@param point is a geo-referenced coordinate
@param delta is the geo-referenced distance that corresponds to a approximation
distance in the screen coordinate system
@return <code>true</code> if this MapElement had an associated figure and
the specified point was inside this bounds of this figure, otherwhise
<code>false</code>
"""
final Rectangle2d bounds = getBoundingBox();
if (bounds == null) {
return false;
}
double dlt = delta;
if (dlt < 0) {
dlt = -dlt;
}
if (dlt == 0) {
return bounds.contains(point);
}
return Circle2afp.intersectsCircleRectangle(
point.getX(), point.getY(), dlt,
bounds.getMinX(), bounds.getMinY(), bounds.getMaxX(), bounds.getMaxY());
} | java | @Pure
public boolean contains(Point2D<?, ?> point, double delta) {
final Rectangle2d bounds = getBoundingBox();
if (bounds == null) {
return false;
}
double dlt = delta;
if (dlt < 0) {
dlt = -dlt;
}
if (dlt == 0) {
return bounds.contains(point);
}
return Circle2afp.intersectsCircleRectangle(
point.getX(), point.getY(), dlt,
bounds.getMinX(), bounds.getMinY(), bounds.getMaxX(), bounds.getMaxY());
} | [
"@",
"Pure",
"public",
"boolean",
"contains",
"(",
"Point2D",
"<",
"?",
",",
"?",
">",
"point",
",",
"double",
"delta",
")",
"{",
"final",
"Rectangle2d",
"bounds",
"=",
"getBoundingBox",
"(",
")",
";",
"if",
"(",
"bounds",
"==",
"null",
")",
"{",
"re... | Replies if the specified point (<var>x</var>,<var>y</var>)
was inside the figure of this MapElement.
<p>If this MapElement has no associated figure, this method
always returns <code>false</code>.
@param point is a geo-referenced coordinate
@param delta is the geo-referenced distance that corresponds to a approximation
distance in the screen coordinate system
@return <code>true</code> if this MapElement had an associated figure and
the specified point was inside this bounds of this figure, otherwhise
<code>false</code> | [
"Replies",
"if",
"the",
"specified",
"point",
"(",
"<var",
">",
"x<",
"/",
"var",
">",
"<var",
">",
"y<",
"/",
"var",
">",
")",
"was",
"inside",
"the",
"figure",
"of",
"this",
"MapElement",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/maplayer/MapLayer.java#L439-L455 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.getCustomEntityRoleAsync | public Observable<EntityRole> getCustomEntityRoleAsync(UUID appId, String versionId, UUID entityId, UUID roleId) {
"""
Get one entity role for a given entity.
@param appId The application ID.
@param versionId The version ID.
@param entityId entity ID.
@param roleId entity role ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the EntityRole object
"""
return getCustomEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).map(new Func1<ServiceResponse<EntityRole>, EntityRole>() {
@Override
public EntityRole call(ServiceResponse<EntityRole> response) {
return response.body();
}
});
} | java | public Observable<EntityRole> getCustomEntityRoleAsync(UUID appId, String versionId, UUID entityId, UUID roleId) {
return getCustomEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).map(new Func1<ServiceResponse<EntityRole>, EntityRole>() {
@Override
public EntityRole call(ServiceResponse<EntityRole> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"EntityRole",
">",
"getCustomEntityRoleAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
",",
"UUID",
"roleId",
")",
"{",
"return",
"getCustomEntityRoleWithServiceResponseAsync",
"(",
"appId",
",",
"versi... | Get one entity role for a given entity.
@param appId The application ID.
@param versionId The version ID.
@param entityId entity ID.
@param roleId entity role ID.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the EntityRole object | [
"Get",
"one",
"entity",
"role",
"for",
"a",
"given",
"entity",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L13592-L13599 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSetDTM.java | NodeSetDTM.addNodes | public void addNodes(DTMIterator iterator) {
"""
Copy NodeList members into this nodelist, adding in
document order. Null references are not added.
@param iterator DTMIterator which yields the nodes to be added.
@throws RuntimeException thrown if this NodeSetDTM is not of
a mutable type.
"""
if (!m_mutable)
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!");
if (null != iterator) // defensive to fix a bug that Sanjiva reported.
{
int obj;
while (DTM.NULL != (obj = iterator.nextNode()))
{
addElement(obj);
}
}
// checkDups();
} | java | public void addNodes(DTMIterator iterator)
{
if (!m_mutable)
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!");
if (null != iterator) // defensive to fix a bug that Sanjiva reported.
{
int obj;
while (DTM.NULL != (obj = iterator.nextNode()))
{
addElement(obj);
}
}
// checkDups();
} | [
"public",
"void",
"addNodes",
"(",
"DTMIterator",
"iterator",
")",
"{",
"if",
"(",
"!",
"m_mutable",
")",
"throw",
"new",
"RuntimeException",
"(",
"XSLMessages",
".",
"createXPATHMessage",
"(",
"XPATHErrorResources",
".",
"ER_NODESETDTM_NOT_MUTABLE",
",",
"null",
... | Copy NodeList members into this nodelist, adding in
document order. Null references are not added.
@param iterator DTMIterator which yields the nodes to be added.
@throws RuntimeException thrown if this NodeSetDTM is not of
a mutable type. | [
"Copy",
"NodeList",
"members",
"into",
"this",
"nodelist",
"adding",
"in",
"document",
"order",
".",
"Null",
"references",
"are",
"not",
"added",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSetDTM.java#L646-L663 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java | ApiOvhIpLoadbalancing.serviceName_vrack_network_GET | public ArrayList<Long> serviceName_vrack_network_GET(String serviceName, String subnet, Long vlan) throws IOException {
"""
Descriptions of private networks in the vRack attached to this Load Balancer
REST: GET /ipLoadbalancing/{serviceName}/vrack/network
@param vlan [required] Filter the value of vlan property (=)
@param subnet [required] Filter the value of subnet property (=)
@param serviceName [required] The internal name of your IP load balancing
API beta
"""
String qPath = "/ipLoadbalancing/{serviceName}/vrack/network";
StringBuilder sb = path(qPath, serviceName);
query(sb, "subnet", subnet);
query(sb, "vlan", vlan);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | java | public ArrayList<Long> serviceName_vrack_network_GET(String serviceName, String subnet, Long vlan) throws IOException {
String qPath = "/ipLoadbalancing/{serviceName}/vrack/network";
StringBuilder sb = path(qPath, serviceName);
query(sb, "subnet", subnet);
query(sb, "vlan", vlan);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t2);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"serviceName_vrack_network_GET",
"(",
"String",
"serviceName",
",",
"String",
"subnet",
",",
"Long",
"vlan",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ipLoadbalancing/{serviceName}/vrack/network\"",
";",
"S... | Descriptions of private networks in the vRack attached to this Load Balancer
REST: GET /ipLoadbalancing/{serviceName}/vrack/network
@param vlan [required] Filter the value of vlan property (=)
@param subnet [required] Filter the value of subnet property (=)
@param serviceName [required] The internal name of your IP load balancing
API beta | [
"Descriptions",
"of",
"private",
"networks",
"in",
"the",
"vRack",
"attached",
"to",
"this",
"Load",
"Balancer"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L1157-L1164 |
plaid/plaid-java | src/main/java/com/plaid/client/internal/Util.java | Util.isBetween | public static void isBetween(Integer value, int min, int max, String name) {
"""
Checks that i is not null and is in the range min <= i <= max.
@param value The integer value to check.
@param min The minimum bound, inclusive.
@param max The maximum bound, inclusive.
@param name The name of the variable being checked, included when an error is raised.
@throws IllegalArgumentException If i is null or outside the range.
"""
notNull(value, name);
if (value < min || value > max) {
throw new IllegalArgumentException(name + "(" + value + ") out of range: " + min + " <= " + name + " <= " + max);
}
} | java | public static void isBetween(Integer value, int min, int max, String name) {
notNull(value, name);
if (value < min || value > max) {
throw new IllegalArgumentException(name + "(" + value + ") out of range: " + min + " <= " + name + " <= " + max);
}
} | [
"public",
"static",
"void",
"isBetween",
"(",
"Integer",
"value",
",",
"int",
"min",
",",
"int",
"max",
",",
"String",
"name",
")",
"{",
"notNull",
"(",
"value",
",",
"name",
")",
";",
"if",
"(",
"value",
"<",
"min",
"||",
"value",
">",
"max",
")",... | Checks that i is not null and is in the range min <= i <= max.
@param value The integer value to check.
@param min The minimum bound, inclusive.
@param max The maximum bound, inclusive.
@param name The name of the variable being checked, included when an error is raised.
@throws IllegalArgumentException If i is null or outside the range. | [
"Checks",
"that",
"i",
"is",
"not",
"null",
"and",
"is",
"in",
"the",
"range",
"min",
"<",
";",
"=",
"i",
"<",
";",
"=",
"max",
"."
] | train | https://github.com/plaid/plaid-java/blob/360f1f8a5178fa0c3c2c2e07a58f8ccec5f33117/src/main/java/com/plaid/client/internal/Util.java#L77-L83 |
dbflute-session/tomcat-boot | src/main/java/org/dbflute/tomcat/util/BotmReflectionUtil.java | BotmReflectionUtil.getAccessibleMethod | public static Method getAccessibleMethod(Class<?> clazz, String methodName, Class<?>[] argTypes) {
"""
Get the accessible method that means as follows:
<pre>
o target class's methods = all
o superclass's methods = public or protected
</pre>
@param clazz The type of class that defines the method. (NotNull)
@param methodName The name of method. (NotNull)
@param argTypes The type of argument. (NotNull)
@return The instance of method. (NullAllowed: if null, not found)
"""
assertObjectNotNull("clazz", clazz);
assertStringNotNullAndNotTrimmedEmpty("methodName", methodName);
return findMethod(clazz, methodName, argTypes, VisibilityType.ACCESSIBLE, false);
} | java | public static Method getAccessibleMethod(Class<?> clazz, String methodName, Class<?>[] argTypes) {
assertObjectNotNull("clazz", clazz);
assertStringNotNullAndNotTrimmedEmpty("methodName", methodName);
return findMethod(clazz, methodName, argTypes, VisibilityType.ACCESSIBLE, false);
} | [
"public",
"static",
"Method",
"getAccessibleMethod",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"argTypes",
")",
"{",
"assertObjectNotNull",
"(",
"\"clazz\"",
",",
"clazz",
")",
";",
"assertStr... | Get the accessible method that means as follows:
<pre>
o target class's methods = all
o superclass's methods = public or protected
</pre>
@param clazz The type of class that defines the method. (NotNull)
@param methodName The name of method. (NotNull)
@param argTypes The type of argument. (NotNull)
@return The instance of method. (NullAllowed: if null, not found) | [
"Get",
"the",
"accessible",
"method",
"that",
"means",
"as",
"follows",
":",
"<pre",
">",
"o",
"target",
"class",
"s",
"methods",
"=",
"all",
"o",
"superclass",
"s",
"methods",
"=",
"public",
"or",
"protected",
"<",
"/",
"pre",
">"
] | train | https://github.com/dbflute-session/tomcat-boot/blob/fe941f88b6be083781873126f5b12d4c16bb9073/src/main/java/org/dbflute/tomcat/util/BotmReflectionUtil.java#L336-L340 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java | Query.convertReference | private Object convertReference(Object fieldValue) {
"""
Validates that a value used with FieldValue.documentId() is either a string or a
DocumentReference that is part of the query`s result set. Throws a validation error or returns
a DocumentReference that can directly be used in the Query.
"""
DocumentReference reference;
if (fieldValue instanceof String) {
reference = new DocumentReference(firestore, path.append((String) fieldValue));
} else if (fieldValue instanceof DocumentReference) {
reference = (DocumentReference) fieldValue;
} else {
throw new IllegalArgumentException(
"The corresponding value for FieldPath.documentId() must be a String or a "
+ "DocumentReference.");
}
if (!this.path.isPrefixOf(reference.getResourcePath())) {
throw new IllegalArgumentException(
String.format(
"'%s' is not part of the query result set and cannot be used as a query boundary.",
reference.getPath()));
}
if (!reference.getParent().getResourcePath().equals(this.path)) {
throw new IllegalArgumentException(
String.format(
"Only a direct child can be used as a query boundary. Found: '%s'",
reference.getPath()));
}
return reference;
} | java | private Object convertReference(Object fieldValue) {
DocumentReference reference;
if (fieldValue instanceof String) {
reference = new DocumentReference(firestore, path.append((String) fieldValue));
} else if (fieldValue instanceof DocumentReference) {
reference = (DocumentReference) fieldValue;
} else {
throw new IllegalArgumentException(
"The corresponding value for FieldPath.documentId() must be a String or a "
+ "DocumentReference.");
}
if (!this.path.isPrefixOf(reference.getResourcePath())) {
throw new IllegalArgumentException(
String.format(
"'%s' is not part of the query result set and cannot be used as a query boundary.",
reference.getPath()));
}
if (!reference.getParent().getResourcePath().equals(this.path)) {
throw new IllegalArgumentException(
String.format(
"Only a direct child can be used as a query boundary. Found: '%s'",
reference.getPath()));
}
return reference;
} | [
"private",
"Object",
"convertReference",
"(",
"Object",
"fieldValue",
")",
"{",
"DocumentReference",
"reference",
";",
"if",
"(",
"fieldValue",
"instanceof",
"String",
")",
"{",
"reference",
"=",
"new",
"DocumentReference",
"(",
"firestore",
",",
"path",
".",
"a... | Validates that a value used with FieldValue.documentId() is either a string or a
DocumentReference that is part of the query`s result set. Throws a validation error or returns
a DocumentReference that can directly be used in the Query. | [
"Validates",
"that",
"a",
"value",
"used",
"with",
"FieldValue",
".",
"documentId",
"()",
"is",
"either",
"a",
"string",
"or",
"a",
"DocumentReference",
"that",
"is",
"part",
"of",
"the",
"query",
"s",
"result",
"set",
".",
"Throws",
"a",
"validation",
"er... | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java#L380-L406 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/SegmentKeyCache.java | SegmentKeyCache.evictBefore | synchronized EvictionResult evictBefore(int oldestGeneration) {
"""
Collects and unregisters all Cache Entries with a generation smaller than the given one. This method does not
actually execute the eviction since it is invoked while a lock is held in {@link ContainerKeyCache}. The caller
({@link ContainerKeyCache}) needs to execute the actual cache eviction.
@param oldestGeneration The oldest permissible generation.
@return An {@link EvictionResult} instance containing the number of bytes evicted and the {@link Cache.Key} for
each Cache Entry that needs eviction.
"""
// Remove those entries that have a generation below the oldest permissible one.
long sizeRemoved = 0;
ArrayList<Short> removedGroups = new ArrayList<>();
for (val e : this.cacheEntries.entrySet()) {
CacheEntry entry = e.getValue();
if (entry.getGeneration() < oldestGeneration
&& entry.getHighestOffset() < this.lastIndexedOffset) {
removedGroups.add(e.getKey());
sizeRemoved += entry.getSize();
}
}
// Clear the expired cache entries.
removedGroups.forEach(this.cacheEntries::remove);
// Remove from the Cache. It's ok to do this outside of the lock as the cache is thread safe.
return new EvictionResult(sizeRemoved, removedGroups.stream().map(CacheKey::new).collect(Collectors.toList()));
} | java | synchronized EvictionResult evictBefore(int oldestGeneration) {
// Remove those entries that have a generation below the oldest permissible one.
long sizeRemoved = 0;
ArrayList<Short> removedGroups = new ArrayList<>();
for (val e : this.cacheEntries.entrySet()) {
CacheEntry entry = e.getValue();
if (entry.getGeneration() < oldestGeneration
&& entry.getHighestOffset() < this.lastIndexedOffset) {
removedGroups.add(e.getKey());
sizeRemoved += entry.getSize();
}
}
// Clear the expired cache entries.
removedGroups.forEach(this.cacheEntries::remove);
// Remove from the Cache. It's ok to do this outside of the lock as the cache is thread safe.
return new EvictionResult(sizeRemoved, removedGroups.stream().map(CacheKey::new).collect(Collectors.toList()));
} | [
"synchronized",
"EvictionResult",
"evictBefore",
"(",
"int",
"oldestGeneration",
")",
"{",
"// Remove those entries that have a generation below the oldest permissible one.",
"long",
"sizeRemoved",
"=",
"0",
";",
"ArrayList",
"<",
"Short",
">",
"removedGroups",
"=",
"new",
... | Collects and unregisters all Cache Entries with a generation smaller than the given one. This method does not
actually execute the eviction since it is invoked while a lock is held in {@link ContainerKeyCache}. The caller
({@link ContainerKeyCache}) needs to execute the actual cache eviction.
@param oldestGeneration The oldest permissible generation.
@return An {@link EvictionResult} instance containing the number of bytes evicted and the {@link Cache.Key} for
each Cache Entry that needs eviction. | [
"Collects",
"and",
"unregisters",
"all",
"Cache",
"Entries",
"with",
"a",
"generation",
"smaller",
"than",
"the",
"given",
"one",
".",
"This",
"method",
"does",
"not",
"actually",
"execute",
"the",
"eviction",
"since",
"it",
"is",
"invoked",
"while",
"a",
"l... | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/SegmentKeyCache.java#L102-L120 |
JodaOrg/joda-time | src/main/java/org/joda/time/format/PeriodFormatter.java | PeriodFormatter.withLocale | public PeriodFormatter withLocale(Locale locale) {
"""
Returns a new formatter with a different locale that will be used
for printing and parsing.
<p>
A PeriodFormatter is immutable, so a new instance is returned,
and the original is unaltered and still usable.
<p>
A null locale indicates that no specific locale override is in use.
@param locale the locale to use
@return the new formatter
"""
if (locale == getLocale() || (locale != null && locale.equals(getLocale()))) {
return this;
}
return new PeriodFormatter(iPrinter, iParser, locale, iParseType);
} | java | public PeriodFormatter withLocale(Locale locale) {
if (locale == getLocale() || (locale != null && locale.equals(getLocale()))) {
return this;
}
return new PeriodFormatter(iPrinter, iParser, locale, iParseType);
} | [
"public",
"PeriodFormatter",
"withLocale",
"(",
"Locale",
"locale",
")",
"{",
"if",
"(",
"locale",
"==",
"getLocale",
"(",
")",
"||",
"(",
"locale",
"!=",
"null",
"&&",
"locale",
".",
"equals",
"(",
"getLocale",
"(",
")",
")",
")",
")",
"{",
"return",
... | Returns a new formatter with a different locale that will be used
for printing and parsing.
<p>
A PeriodFormatter is immutable, so a new instance is returned,
and the original is unaltered and still usable.
<p>
A null locale indicates that no specific locale override is in use.
@param locale the locale to use
@return the new formatter | [
"Returns",
"a",
"new",
"formatter",
"with",
"a",
"different",
"locale",
"that",
"will",
"be",
"used",
"for",
"printing",
"and",
"parsing",
".",
"<p",
">",
"A",
"PeriodFormatter",
"is",
"immutable",
"so",
"a",
"new",
"instance",
"is",
"returned",
"and",
"th... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/PeriodFormatter.java#L162-L167 |
aws/aws-sdk-java | aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/StorageDescriptor.java | StorageDescriptor.withParameters | public StorageDescriptor withParameters(java.util.Map<String, String> parameters) {
"""
<p>
User-supplied properties in key-value form.
</p>
@param parameters
User-supplied properties in key-value form.
@return Returns a reference to this object so that method calls can be chained together.
"""
setParameters(parameters);
return this;
} | java | public StorageDescriptor withParameters(java.util.Map<String, String> parameters) {
setParameters(parameters);
return this;
} | [
"public",
"StorageDescriptor",
"withParameters",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
")",
"{",
"setParameters",
"(",
"parameters",
")",
";",
"return",
"this",
";",
"}"
] | <p>
User-supplied properties in key-value form.
</p>
@param parameters
User-supplied properties in key-value form.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"User",
"-",
"supplied",
"properties",
"in",
"key",
"-",
"value",
"form",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/StorageDescriptor.java#L622-L625 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/StandardResponsesApi.java | StandardResponsesApi.addStandardResponseFavorite | public ApiSuccessResponse addStandardResponseFavorite(String id, AddFavoritesData addFavoritesData) throws ApiException {
"""
Add a Standard Response to Favorites
@param id id of the Standard Response to add to Favorites (required)
@param addFavoritesData Request parameters. (optional)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
"""
ApiResponse<ApiSuccessResponse> resp = addStandardResponseFavoriteWithHttpInfo(id, addFavoritesData);
return resp.getData();
} | java | public ApiSuccessResponse addStandardResponseFavorite(String id, AddFavoritesData addFavoritesData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = addStandardResponseFavoriteWithHttpInfo(id, addFavoritesData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"addStandardResponseFavorite",
"(",
"String",
"id",
",",
"AddFavoritesData",
"addFavoritesData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"addStandardResponseFavoriteWithHttpInfo",
"(",
"... | Add a Standard Response to Favorites
@param id id of the Standard Response to add to Favorites (required)
@param addFavoritesData Request parameters. (optional)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Add",
"a",
"Standard",
"Response",
"to",
"Favorites"
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/StandardResponsesApi.java#L141-L144 |
magro/memcached-session-manager | core/src/main/java/de/javakaffee/web/msm/JavaSerializationTranscoder.java | JavaSerializationTranscoder.deserializeAttributes | @Override
public ConcurrentMap<String, Object> deserializeAttributes(final byte[] in ) {
"""
Get the object represented by the given serialized bytes.
@param in
the bytes to deserialize
@return the resulting object
"""
ByteArrayInputStream bis = null;
ObjectInputStream ois = null;
try {
bis = new ByteArrayInputStream( in );
ois = createObjectInputStream( bis );
final ConcurrentMap<String, Object> attributes = new ConcurrentHashMap<String, Object>();
final int n = ( (Integer) ois.readObject() ).intValue();
for ( int i = 0; i < n; i++ ) {
final String name = (String) ois.readObject();
final Object value = ois.readObject();
if ( ( value instanceof String ) && ( value.equals( NOT_SERIALIZED ) ) ) {
continue;
}
if ( LOG.isDebugEnabled() ) {
LOG.debug( " loading attribute '" + name + "' with value '" + value + "'" );
}
attributes.put( name, value );
}
return attributes;
} catch ( final ClassNotFoundException e ) {
LOG.warn( "Caught CNFE decoding "+ in.length +" bytes of data", e );
throw new TranscoderDeserializationException( "Caught CNFE decoding data", e );
} catch ( final IOException e ) {
LOG.warn( "Caught IOException decoding "+ in.length +" bytes of data", e );
throw new TranscoderDeserializationException( "Caught IOException decoding data", e );
} finally {
closeSilently( bis );
closeSilently( ois );
}
} | java | @Override
public ConcurrentMap<String, Object> deserializeAttributes(final byte[] in ) {
ByteArrayInputStream bis = null;
ObjectInputStream ois = null;
try {
bis = new ByteArrayInputStream( in );
ois = createObjectInputStream( bis );
final ConcurrentMap<String, Object> attributes = new ConcurrentHashMap<String, Object>();
final int n = ( (Integer) ois.readObject() ).intValue();
for ( int i = 0; i < n; i++ ) {
final String name = (String) ois.readObject();
final Object value = ois.readObject();
if ( ( value instanceof String ) && ( value.equals( NOT_SERIALIZED ) ) ) {
continue;
}
if ( LOG.isDebugEnabled() ) {
LOG.debug( " loading attribute '" + name + "' with value '" + value + "'" );
}
attributes.put( name, value );
}
return attributes;
} catch ( final ClassNotFoundException e ) {
LOG.warn( "Caught CNFE decoding "+ in.length +" bytes of data", e );
throw new TranscoderDeserializationException( "Caught CNFE decoding data", e );
} catch ( final IOException e ) {
LOG.warn( "Caught IOException decoding "+ in.length +" bytes of data", e );
throw new TranscoderDeserializationException( "Caught IOException decoding data", e );
} finally {
closeSilently( bis );
closeSilently( ois );
}
} | [
"@",
"Override",
"public",
"ConcurrentMap",
"<",
"String",
",",
"Object",
">",
"deserializeAttributes",
"(",
"final",
"byte",
"[",
"]",
"in",
")",
"{",
"ByteArrayInputStream",
"bis",
"=",
"null",
";",
"ObjectInputStream",
"ois",
"=",
"null",
";",
"try",
"{",... | Get the object represented by the given serialized bytes.
@param in
the bytes to deserialize
@return the resulting object | [
"Get",
"the",
"object",
"represented",
"by",
"the",
"given",
"serialized",
"bytes",
"."
] | train | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/core/src/main/java/de/javakaffee/web/msm/JavaSerializationTranscoder.java#L161-L194 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/GosuStringUtil.java | GosuStringUtil.indexOfAny | public static int indexOfAny(String str, char[] searchChars) {
"""
<p>Search a String to find the first index of any
character in the given set of characters.</p>
<p>A <code>null</code> String will return <code>-1</code>.
A <code>null</code> or zero length search array will return <code>-1</code>.</p>
<pre>
GosuStringUtil.indexOfAny(null, *) = -1
GosuStringUtil.indexOfAny("", *) = -1
GosuStringUtil.indexOfAny(*, null) = -1
GosuStringUtil.indexOfAny(*, []) = -1
GosuStringUtil.indexOfAny("zzabyycdxx",['z','a']) = 0
GosuStringUtil.indexOfAny("zzabyycdxx",['b','y']) = 3
GosuStringUtil.indexOfAny("aba", ['z']) = -1
</pre>
@param str the String to check, may be null
@param searchChars the chars to search for, may be null
@return the index of any of the chars, -1 if no match or null input
@since 2.0
"""
if (isEmpty(str) || searchChars == null) {
return -1;
}
for (int i = 0; i < str.length(); i++) {
char ch = str.charAt(i);
for (int j = 0; j < searchChars.length; j++) {
if (searchChars[j] == ch) {
return i;
}
}
}
return -1;
} | java | public static int indexOfAny(String str, char[] searchChars) {
if (isEmpty(str) || searchChars == null) {
return -1;
}
for (int i = 0; i < str.length(); i++) {
char ch = str.charAt(i);
for (int j = 0; j < searchChars.length; j++) {
if (searchChars[j] == ch) {
return i;
}
}
}
return -1;
} | [
"public",
"static",
"int",
"indexOfAny",
"(",
"String",
"str",
",",
"char",
"[",
"]",
"searchChars",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"str",
")",
"||",
"searchChars",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"for",
"(",
"int",
"i",... | <p>Search a String to find the first index of any
character in the given set of characters.</p>
<p>A <code>null</code> String will return <code>-1</code>.
A <code>null</code> or zero length search array will return <code>-1</code>.</p>
<pre>
GosuStringUtil.indexOfAny(null, *) = -1
GosuStringUtil.indexOfAny("", *) = -1
GosuStringUtil.indexOfAny(*, null) = -1
GosuStringUtil.indexOfAny(*, []) = -1
GosuStringUtil.indexOfAny("zzabyycdxx",['z','a']) = 0
GosuStringUtil.indexOfAny("zzabyycdxx",['b','y']) = 3
GosuStringUtil.indexOfAny("aba", ['z']) = -1
</pre>
@param str the String to check, may be null
@param searchChars the chars to search for, may be null
@return the index of any of the chars, -1 if no match or null input
@since 2.0 | [
"<p",
">",
"Search",
"a",
"String",
"to",
"find",
"the",
"first",
"index",
"of",
"any",
"character",
"in",
"the",
"given",
"set",
"of",
"characters",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuStringUtil.java#L1067-L1080 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java | ComputerVisionImpl.recognizePrintedTextInStreamAsync | public Observable<OcrResult> recognizePrintedTextInStreamAsync(boolean detectOrientation, byte[] image, RecognizePrintedTextInStreamOptionalParameter recognizePrintedTextInStreamOptionalParameter) {
"""
Optical Character Recognition (OCR) detects printed text in an image and extracts the recognized characters into a machine-usable character stream. Upon success, the OCR results will be returned. Upon failure, the error code together with an error message will be returned. The error code can be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, NotSupportedLanguage, or InternalServerError.
@param detectOrientation Whether detect the text orientation in the image. With detectOrientation=true the OCR service tries to detect the image orientation and correct it before further processing (e.g. if it's upside-down).
@param image An image stream.
@param recognizePrintedTextInStreamOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OcrResult object
"""
return recognizePrintedTextInStreamWithServiceResponseAsync(detectOrientation, image, recognizePrintedTextInStreamOptionalParameter).map(new Func1<ServiceResponse<OcrResult>, OcrResult>() {
@Override
public OcrResult call(ServiceResponse<OcrResult> response) {
return response.body();
}
});
} | java | public Observable<OcrResult> recognizePrintedTextInStreamAsync(boolean detectOrientation, byte[] image, RecognizePrintedTextInStreamOptionalParameter recognizePrintedTextInStreamOptionalParameter) {
return recognizePrintedTextInStreamWithServiceResponseAsync(detectOrientation, image, recognizePrintedTextInStreamOptionalParameter).map(new Func1<ServiceResponse<OcrResult>, OcrResult>() {
@Override
public OcrResult call(ServiceResponse<OcrResult> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OcrResult",
">",
"recognizePrintedTextInStreamAsync",
"(",
"boolean",
"detectOrientation",
",",
"byte",
"[",
"]",
"image",
",",
"RecognizePrintedTextInStreamOptionalParameter",
"recognizePrintedTextInStreamOptionalParameter",
")",
"{",
"return",
... | Optical Character Recognition (OCR) detects printed text in an image and extracts the recognized characters into a machine-usable character stream. Upon success, the OCR results will be returned. Upon failure, the error code together with an error message will be returned. The error code can be one of InvalidImageUrl, InvalidImageFormat, InvalidImageSize, NotSupportedImage, NotSupportedLanguage, or InternalServerError.
@param detectOrientation Whether detect the text orientation in the image. With detectOrientation=true the OCR service tries to detect the image orientation and correct it before further processing (e.g. if it's upside-down).
@param image An image stream.
@param recognizePrintedTextInStreamOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OcrResult object | [
"Optical",
"Character",
"Recognition",
"(",
"OCR",
")",
"detects",
"printed",
"text",
"in",
"an",
"image",
"and",
"extracts",
"the",
"recognized",
"characters",
"into",
"a",
"machine",
"-",
"usable",
"character",
"stream",
".",
"Upon",
"success",
"the",
"OCR",... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L767-L774 |
astrapi69/mystic-crypt | crypt-data/src/main/java/de/alpharogroup/crypto/key/writer/KeyWriter.java | KeyWriter.writeInPemFormat | public static void writeInPemFormat(final Key key, final @NonNull File file) throws IOException {
"""
Write the given {@link Key} into the given {@link File}.
@param key
the security key
@param file
the file to write in
@throws IOException
Signals that an I/O exception has occurred.
"""
StringWriter stringWriter = new StringWriter();
JcaPEMWriter pemWriter = new JcaPEMWriter(stringWriter);
pemWriter.writeObject(key);
pemWriter.close();
String pemFormat = stringWriter.toString();
pemFormat = pemFormat.replaceAll("\\r\\n", "\\\n");
WriteFileExtensions.string2File(file, pemFormat);
} | java | public static void writeInPemFormat(final Key key, final @NonNull File file) throws IOException
{
StringWriter stringWriter = new StringWriter();
JcaPEMWriter pemWriter = new JcaPEMWriter(stringWriter);
pemWriter.writeObject(key);
pemWriter.close();
String pemFormat = stringWriter.toString();
pemFormat = pemFormat.replaceAll("\\r\\n", "\\\n");
WriteFileExtensions.string2File(file, pemFormat);
} | [
"public",
"static",
"void",
"writeInPemFormat",
"(",
"final",
"Key",
"key",
",",
"final",
"@",
"NonNull",
"File",
"file",
")",
"throws",
"IOException",
"{",
"StringWriter",
"stringWriter",
"=",
"new",
"StringWriter",
"(",
")",
";",
"JcaPEMWriter",
"pemWriter",
... | Write the given {@link Key} into the given {@link File}.
@param key
the security key
@param file
the file to write in
@throws IOException
Signals that an I/O exception has occurred. | [
"Write",
"the",
"given",
"{",
"@link",
"Key",
"}",
"into",
"the",
"given",
"{",
"@link",
"File",
"}",
"."
] | train | https://github.com/astrapi69/mystic-crypt/blob/7f51ef5e4457e24de7ff391f10bfc5609e6f1a34/crypt-data/src/main/java/de/alpharogroup/crypto/key/writer/KeyWriter.java#L55-L64 |
alkacon/opencms-core | src/org/opencms/search/CmsSearchSimilarity.java | CmsSearchSimilarity.lengthNorm | private float lengthNorm(FieldInvertState state, int numTerms) {
"""
Special implementation for "compute norm" to reduce the significance of this factor
for the <code>{@link org.opencms.search.fields.CmsLuceneField#FIELD_CONTENT}</code> field, while
keeping the Lucene default for all other fields.<p>
@param state field invert state
@param numTerms number of terms
@return the norm as specifically created for OpenCms.
"""
if (state.getName().equals(CmsSearchField.FIELD_CONTENT)) {
numTerms = state.getLength() - state.getNumOverlap();
// special length norm for content
return (float)(3.0 / (Math.log(1000 + numTerms) / LOG10));
}
// all other fields use the default Lucene implementation
return (float)(1 / Math.sqrt(numTerms));
} | java | private float lengthNorm(FieldInvertState state, int numTerms) {
if (state.getName().equals(CmsSearchField.FIELD_CONTENT)) {
numTerms = state.getLength() - state.getNumOverlap();
// special length norm for content
return (float)(3.0 / (Math.log(1000 + numTerms) / LOG10));
}
// all other fields use the default Lucene implementation
return (float)(1 / Math.sqrt(numTerms));
} | [
"private",
"float",
"lengthNorm",
"(",
"FieldInvertState",
"state",
",",
"int",
"numTerms",
")",
"{",
"if",
"(",
"state",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"CmsSearchField",
".",
"FIELD_CONTENT",
")",
")",
"{",
"numTerms",
"=",
"state",
".",
... | Special implementation for "compute norm" to reduce the significance of this factor
for the <code>{@link org.opencms.search.fields.CmsLuceneField#FIELD_CONTENT}</code> field, while
keeping the Lucene default for all other fields.<p>
@param state field invert state
@param numTerms number of terms
@return the norm as specifically created for OpenCms. | [
"Special",
"implementation",
"for",
"compute",
"norm",
"to",
"reduce",
"the",
"significance",
"of",
"this",
"factor",
"for",
"the",
"<code",
">",
"{",
"@link",
"org",
".",
"opencms",
".",
"search",
".",
"fields",
".",
"CmsLuceneField#FIELD_CONTENT",
"}",
"<",
... | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearchSimilarity.java#L131-L140 |
validator/validator | src/nu/validator/datatype/AbstractDatatype.java | AbstractDatatype.newDatatypeException | protected DatatypeException newDatatypeException(String message, boolean warning) {
"""
/* for datatype exceptions that are handled as warnings, the following are
alternative forms of all the above, with an additional "warning" parameter
"""
return new Html5DatatypeException(this.getClass(), this.getName(), message, warning);
} | java | protected DatatypeException newDatatypeException(String message, boolean warning) {
return new Html5DatatypeException(this.getClass(), this.getName(), message, warning);
} | [
"protected",
"DatatypeException",
"newDatatypeException",
"(",
"String",
"message",
",",
"boolean",
"warning",
")",
"{",
"return",
"new",
"Html5DatatypeException",
"(",
"this",
".",
"getClass",
"(",
")",
",",
"this",
".",
"getName",
"(",
")",
",",
"message",
"... | /* for datatype exceptions that are handled as warnings, the following are
alternative forms of all the above, with an additional "warning" parameter | [
"/",
"*",
"for",
"datatype",
"exceptions",
"that",
"are",
"handled",
"as",
"warnings",
"the",
"following",
"are",
"alternative",
"forms",
"of",
"all",
"the",
"above",
"with",
"an",
"additional",
"warning",
"parameter"
] | train | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/datatype/AbstractDatatype.java#L241-L243 |
hawtio/hawtio | hawtio-util/src/main/java/io/hawt/util/introspect/support/ClassScanner.java | ClassScanner.setClassLoaderProvider | public void setClassLoaderProvider(String id, ClassLoaderProvider classLoaderProvider) {
"""
Registers a named class loader provider or removes it if the classLoaderProvider is null
"""
if (classLoaderProvider != null) {
classLoaderProviderMap.put(id, classLoaderProvider);
} else {
classLoaderProviderMap.remove(id);
}
} | java | public void setClassLoaderProvider(String id, ClassLoaderProvider classLoaderProvider) {
if (classLoaderProvider != null) {
classLoaderProviderMap.put(id, classLoaderProvider);
} else {
classLoaderProviderMap.remove(id);
}
} | [
"public",
"void",
"setClassLoaderProvider",
"(",
"String",
"id",
",",
"ClassLoaderProvider",
"classLoaderProvider",
")",
"{",
"if",
"(",
"classLoaderProvider",
"!=",
"null",
")",
"{",
"classLoaderProviderMap",
".",
"put",
"(",
"id",
",",
"classLoaderProvider",
")",
... | Registers a named class loader provider or removes it if the classLoaderProvider is null | [
"Registers",
"a",
"named",
"class",
"loader",
"provider",
"or",
"removes",
"it",
"if",
"the",
"classLoaderProvider",
"is",
"null"
] | train | https://github.com/hawtio/hawtio/blob/d8b1c8f246307c0313ba297a494106d0859f3ffd/hawtio-util/src/main/java/io/hawt/util/introspect/support/ClassScanner.java#L82-L88 |
amaembo/streamex | src/main/java/one/util/streamex/IntStreamEx.java | IntStreamEx.pairMap | public IntStreamEx pairMap(IntBinaryOperator mapper) {
"""
Returns a stream consisting of the results of applying the given function
to the every adjacent pair of elements of this stream.
<p>
This is a <a href="package-summary.html#StreamOps">quasi-intermediate
operation</a>.
<p>
The output stream will contain one element less than this stream. If this
stream contains zero or one element the output stream will be empty.
@param mapper a non-interfering, stateless function to apply to each
adjacent pair of this stream elements.
@return the new stream
@since 0.2.1
"""
return delegate(new PairSpliterator.PSOfInt(mapper, null, spliterator(), PairSpliterator.MODE_PAIRS));
} | java | public IntStreamEx pairMap(IntBinaryOperator mapper) {
return delegate(new PairSpliterator.PSOfInt(mapper, null, spliterator(), PairSpliterator.MODE_PAIRS));
} | [
"public",
"IntStreamEx",
"pairMap",
"(",
"IntBinaryOperator",
"mapper",
")",
"{",
"return",
"delegate",
"(",
"new",
"PairSpliterator",
".",
"PSOfInt",
"(",
"mapper",
",",
"null",
",",
"spliterator",
"(",
")",
",",
"PairSpliterator",
".",
"MODE_PAIRS",
")",
")"... | Returns a stream consisting of the results of applying the given function
to the every adjacent pair of elements of this stream.
<p>
This is a <a href="package-summary.html#StreamOps">quasi-intermediate
operation</a>.
<p>
The output stream will contain one element less than this stream. If this
stream contains zero or one element the output stream will be empty.
@param mapper a non-interfering, stateless function to apply to each
adjacent pair of this stream elements.
@return the new stream
@since 0.2.1 | [
"Returns",
"a",
"stream",
"consisting",
"of",
"the",
"results",
"of",
"applying",
"the",
"given",
"function",
"to",
"the",
"every",
"adjacent",
"pair",
"of",
"elements",
"of",
"this",
"stream",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/IntStreamEx.java#L1571-L1573 |
datasift/datasift-java | src/main/java/com/datasift/client/managedsource/DataSiftManagedSource.java | DataSiftManagedSource.removeResource | public FutureData<ManagedSource> removeResource(String id, String... resources) {
"""
/*
Remove a set of resources from a managed source
@param id the ID of the managed source
@param resources the resources to remove
@return the managed source
"""
if (id == null || resources == null || resources.length == 0) {
throw new IllegalArgumentException("ID and oen or more resources are required");
}
FutureData<ManagedSource> future = new FutureData<>();
URI uri = newParams().forURL(config.newAPIEndpointURI(REMOVE_RESOURCE));
POST request = null;
try {
request = config.http().POST(uri, new PageReader(newRequestCallback(future, new ManagedSource(), config)))
.form("id", id)
.form("resource_ids", DataSiftClient.MAPPER.writeValueAsString(resources));
} catch (JsonProcessingException e) {
future.interuptCause(e);
future.doNotify();
}
performRequest(future, request);
return future;
} | java | public FutureData<ManagedSource> removeResource(String id, String... resources) {
if (id == null || resources == null || resources.length == 0) {
throw new IllegalArgumentException("ID and oen or more resources are required");
}
FutureData<ManagedSource> future = new FutureData<>();
URI uri = newParams().forURL(config.newAPIEndpointURI(REMOVE_RESOURCE));
POST request = null;
try {
request = config.http().POST(uri, new PageReader(newRequestCallback(future, new ManagedSource(), config)))
.form("id", id)
.form("resource_ids", DataSiftClient.MAPPER.writeValueAsString(resources));
} catch (JsonProcessingException e) {
future.interuptCause(e);
future.doNotify();
}
performRequest(future, request);
return future;
} | [
"public",
"FutureData",
"<",
"ManagedSource",
">",
"removeResource",
"(",
"String",
"id",
",",
"String",
"...",
"resources",
")",
"{",
"if",
"(",
"id",
"==",
"null",
"||",
"resources",
"==",
"null",
"||",
"resources",
".",
"length",
"==",
"0",
")",
"{",
... | /*
Remove a set of resources from a managed source
@param id the ID of the managed source
@param resources the resources to remove
@return the managed source | [
"/",
"*",
"Remove",
"a",
"set",
"of",
"resources",
"from",
"a",
"managed",
"source"
] | train | https://github.com/datasift/datasift-java/blob/09de124f2a1a507ff6181e59875c6f325290850e/src/main/java/com/datasift/client/managedsource/DataSiftManagedSource.java#L143-L160 |
alkacon/opencms-core | src/org/opencms/configuration/CmsParameterConfiguration.java | CmsParameterConfiguration.addInternal | private void addInternal(String key, String value) {
"""
Adds a parameter, parsing the value if required.<p>
@param key the parameter to add
@param value the value of the parameter
"""
Object currentObj = m_configurationObjects.get(key);
String currentStr = get(key);
if (currentObj instanceof String) {
// one object already in map - convert it to a list
ArrayList<String> values = new ArrayList<String>(2);
values.add(currentStr);
values.add(value);
m_configurationObjects.put(key, values);
m_configurationStrings.put(key, currentStr + ParameterTokenizer.COMMA + value);
} else if (currentObj instanceof List) {
// already a list - just add the new token
@SuppressWarnings("unchecked")
List<String> list = (List<String>)currentObj;
list.add(value);
m_configurationStrings.put(key, currentStr + ParameterTokenizer.COMMA + value);
} else {
m_configurationObjects.put(key, value);
m_configurationStrings.put(key, value);
}
} | java | private void addInternal(String key, String value) {
Object currentObj = m_configurationObjects.get(key);
String currentStr = get(key);
if (currentObj instanceof String) {
// one object already in map - convert it to a list
ArrayList<String> values = new ArrayList<String>(2);
values.add(currentStr);
values.add(value);
m_configurationObjects.put(key, values);
m_configurationStrings.put(key, currentStr + ParameterTokenizer.COMMA + value);
} else if (currentObj instanceof List) {
// already a list - just add the new token
@SuppressWarnings("unchecked")
List<String> list = (List<String>)currentObj;
list.add(value);
m_configurationStrings.put(key, currentStr + ParameterTokenizer.COMMA + value);
} else {
m_configurationObjects.put(key, value);
m_configurationStrings.put(key, value);
}
} | [
"private",
"void",
"addInternal",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"Object",
"currentObj",
"=",
"m_configurationObjects",
".",
"get",
"(",
"key",
")",
";",
"String",
"currentStr",
"=",
"get",
"(",
"key",
")",
";",
"if",
"(",
"curre... | Adds a parameter, parsing the value if required.<p>
@param key the parameter to add
@param value the value of the parameter | [
"Adds",
"a",
"parameter",
"parsing",
"the",
"value",
"if",
"required",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/CmsParameterConfiguration.java#L858-L880 |
stratosphere/stratosphere | stratosphere-addons/spargel/src/main/java/eu/stratosphere/spargel/java/VertexCentricIteration.java | VertexCentricIteration.registerAggregator | public void registerAggregator(String name, Class<? extends Aggregator<?>> aggregator) {
"""
Registers a new aggregator. Aggregators registered here are available during the execution of the vertex updates
via {@link VertexUpdateFunction#getIterationAggregator(String)} and
{@link VertexUpdateFunction#getPreviousIterationAggregate(String)}.
@param name The name of the aggregator, used to retrieve it and its aggregates during execution.
@param aggregator The aggregator.
"""
this.aggregators.put(name, aggregator);
} | java | public void registerAggregator(String name, Class<? extends Aggregator<?>> aggregator) {
this.aggregators.put(name, aggregator);
} | [
"public",
"void",
"registerAggregator",
"(",
"String",
"name",
",",
"Class",
"<",
"?",
"extends",
"Aggregator",
"<",
"?",
">",
">",
"aggregator",
")",
"{",
"this",
".",
"aggregators",
".",
"put",
"(",
"name",
",",
"aggregator",
")",
";",
"}"
] | Registers a new aggregator. Aggregators registered here are available during the execution of the vertex updates
via {@link VertexUpdateFunction#getIterationAggregator(String)} and
{@link VertexUpdateFunction#getPreviousIterationAggregate(String)}.
@param name The name of the aggregator, used to retrieve it and its aggregates during execution.
@param aggregator The aggregator. | [
"Registers",
"a",
"new",
"aggregator",
".",
"Aggregators",
"registered",
"here",
"are",
"available",
"during",
"the",
"execution",
"of",
"the",
"vertex",
"updates",
"via",
"{",
"@link",
"VertexUpdateFunction#getIterationAggregator",
"(",
"String",
")",
"}",
"and",
... | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-addons/spargel/src/main/java/eu/stratosphere/spargel/java/VertexCentricIteration.java#L170-L172 |
VoltDB/voltdb | src/frontend/org/voltdb/utils/VoltTrace.java | VoltTrace.closeAllAndShutdown | public static String closeAllAndShutdown(String logDir, long timeOutMillis) throws IOException {
"""
Close all open files and wait for shutdown.
@param logDir The directory to write the trace events to, null to skip writing to file.
@param timeOutMillis Timeout in milliseconds. Negative to not wait
@return The path to the trace file if written, or null if a write is already in progress.
"""
String path = null;
final VoltTrace tracer = s_tracer;
if (tracer != null) {
if (logDir != null) {
path = dump(logDir);
}
s_tracer = null;
if (timeOutMillis >= 0) {
try {
tracer.m_writerThread.shutdownNow();
tracer.m_writerThread.awaitTermination(timeOutMillis, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
}
}
tracer.shutdown();
}
return path;
} | java | public static String closeAllAndShutdown(String logDir, long timeOutMillis) throws IOException {
String path = null;
final VoltTrace tracer = s_tracer;
if (tracer != null) {
if (logDir != null) {
path = dump(logDir);
}
s_tracer = null;
if (timeOutMillis >= 0) {
try {
tracer.m_writerThread.shutdownNow();
tracer.m_writerThread.awaitTermination(timeOutMillis, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
}
}
tracer.shutdown();
}
return path;
} | [
"public",
"static",
"String",
"closeAllAndShutdown",
"(",
"String",
"logDir",
",",
"long",
"timeOutMillis",
")",
"throws",
"IOException",
"{",
"String",
"path",
"=",
"null",
";",
"final",
"VoltTrace",
"tracer",
"=",
"s_tracer",
";",
"if",
"(",
"tracer",
"!=",
... | Close all open files and wait for shutdown.
@param logDir The directory to write the trace events to, null to skip writing to file.
@param timeOutMillis Timeout in milliseconds. Negative to not wait
@return The path to the trace file if written, or null if a write is already in progress. | [
"Close",
"all",
"open",
"files",
"and",
"wait",
"for",
"shutdown",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/utils/VoltTrace.java#L515-L538 |
openbaton/openbaton-client | sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java | NetworkServiceRecordAgent.executeScript | @Help(
help =
"Executes a script at runtime for a VNFR of a defined VNFD in a running NSR with specific id"
)
public void executeScript(final String idNsr, final String idVnfr, String script)
throws SDKException {
"""
Executes a script at runtime for a VNFR of a defined VNFD in a running NSR.
@param idNsr the ID of the NetworkServiceRecord
@param idVnfr the ID of the VNFR to be upgraded
@param script the script to execute
@throws SDKException if the request fails
"""
String url = idNsr + "/vnfrecords" + "/" + idVnfr + "/execute-script";
requestPost(url, script);
} | java | @Help(
help =
"Executes a script at runtime for a VNFR of a defined VNFD in a running NSR with specific id"
)
public void executeScript(final String idNsr, final String idVnfr, String script)
throws SDKException {
String url = idNsr + "/vnfrecords" + "/" + idVnfr + "/execute-script";
requestPost(url, script);
} | [
"@",
"Help",
"(",
"help",
"=",
"\"Executes a script at runtime for a VNFR of a defined VNFD in a running NSR with specific id\"",
")",
"public",
"void",
"executeScript",
"(",
"final",
"String",
"idNsr",
",",
"final",
"String",
"idVnfr",
",",
"String",
"script",
")",
"thro... | Executes a script at runtime for a VNFR of a defined VNFD in a running NSR.
@param idNsr the ID of the NetworkServiceRecord
@param idVnfr the ID of the VNFR to be upgraded
@param script the script to execute
@throws SDKException if the request fails | [
"Executes",
"a",
"script",
"at",
"runtime",
"for",
"a",
"VNFR",
"of",
"a",
"defined",
"VNFD",
"in",
"a",
"running",
"NSR",
"."
] | train | https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/rest/NetworkServiceRecordAgent.java#L721-L729 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.cart_cartId_item_GET | public ArrayList<Long> cart_cartId_item_GET(String cartId) throws IOException {
"""
List all the items of a cart
REST: GET /order/cart/{cartId}/item
@param cartId [required] Cart identifier
"""
String qPath = "/order/cart/{cartId}/item";
StringBuilder sb = path(qPath, cartId);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, t5);
} | java | public ArrayList<Long> cart_cartId_item_GET(String cartId) throws IOException {
String qPath = "/order/cart/{cartId}/item";
StringBuilder sb = path(qPath, cartId);
String resp = execN(qPath, "GET", sb.toString(), null);
return convertTo(resp, t5);
} | [
"public",
"ArrayList",
"<",
"Long",
">",
"cart_cartId_item_GET",
"(",
"String",
"cartId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/cart/{cartId}/item\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"cartId",
")",
";",
... | List all the items of a cart
REST: GET /order/cart/{cartId}/item
@param cartId [required] Cart identifier | [
"List",
"all",
"the",
"items",
"of",
"a",
"cart"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L8130-L8135 |
JOML-CI/JOML | src/org/joml/AABBd.java | AABBd.setMax | public AABBd setMax(double maxX, double maxY, double maxZ) {
"""
Set the maximum corner coordinates.
@param maxX
the x coordinate of the maximum corner
@param maxY
the y coordinate of the maximum corner
@param maxZ
the z coordinate of the maximum corner
@return this
"""
this.maxX = maxX;
this.maxY = maxY;
this.maxZ = maxZ;
return this;
} | java | public AABBd setMax(double maxX, double maxY, double maxZ) {
this.maxX = maxX;
this.maxY = maxY;
this.maxZ = maxZ;
return this;
} | [
"public",
"AABBd",
"setMax",
"(",
"double",
"maxX",
",",
"double",
"maxY",
",",
"double",
"maxZ",
")",
"{",
"this",
".",
"maxX",
"=",
"maxX",
";",
"this",
".",
"maxY",
"=",
"maxY",
";",
"this",
".",
"maxZ",
"=",
"maxZ",
";",
"return",
"this",
";",
... | Set the maximum corner coordinates.
@param maxX
the x coordinate of the maximum corner
@param maxY
the y coordinate of the maximum corner
@param maxZ
the z coordinate of the maximum corner
@return this | [
"Set",
"the",
"maximum",
"corner",
"coordinates",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/AABBd.java#L135-L140 |
grails/grails-core | grails-encoder/src/main/groovy/org/grails/charsequences/CharSequences.java | CharSequences.canUseOriginalForSubSequence | public static boolean canUseOriginalForSubSequence(CharSequence str, int start, int count) {
"""
Checks if start == 0 and count == length of CharSequence
It does this check only for String, StringBuilder and StringBuffer classes which have a fast way to check length
Calculating length on GStringImpl requires building the result which is costly.
This helper method is to avoid calling length on other that String, StringBuilder and StringBuffer classes
when checking if the input CharSequence instance is already the same as the requested sub sequence
@param str CharSequence input
@param start start index
@param count length on sub sequence
@return true if input is String, StringBuilder or StringBuffer class, start is 0 and count is length of input sequence
"""
if (start != 0) return false;
final Class<?> csqClass = str.getClass();
return (csqClass == String.class || csqClass == StringBuilder.class || csqClass == StringBuffer.class) && count == str.length();
} | java | public static boolean canUseOriginalForSubSequence(CharSequence str, int start, int count) {
if (start != 0) return false;
final Class<?> csqClass = str.getClass();
return (csqClass == String.class || csqClass == StringBuilder.class || csqClass == StringBuffer.class) && count == str.length();
} | [
"public",
"static",
"boolean",
"canUseOriginalForSubSequence",
"(",
"CharSequence",
"str",
",",
"int",
"start",
",",
"int",
"count",
")",
"{",
"if",
"(",
"start",
"!=",
"0",
")",
"return",
"false",
";",
"final",
"Class",
"<",
"?",
">",
"csqClass",
"=",
"... | Checks if start == 0 and count == length of CharSequence
It does this check only for String, StringBuilder and StringBuffer classes which have a fast way to check length
Calculating length on GStringImpl requires building the result which is costly.
This helper method is to avoid calling length on other that String, StringBuilder and StringBuffer classes
when checking if the input CharSequence instance is already the same as the requested sub sequence
@param str CharSequence input
@param start start index
@param count length on sub sequence
@return true if input is String, StringBuilder or StringBuffer class, start is 0 and count is length of input sequence | [
"Checks",
"if",
"start",
"==",
"0",
"and",
"count",
"==",
"length",
"of",
"CharSequence",
"It",
"does",
"this",
"check",
"only",
"for",
"String",
"StringBuilder",
"and",
"StringBuffer",
"classes",
"which",
"have",
"a",
"fast",
"way",
"to",
"check",
"length"
... | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-encoder/src/main/groovy/org/grails/charsequences/CharSequences.java#L62-L66 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java | IOGroovyMethods.withWriter | public static <T> T withWriter(Writer writer, @ClosureParams(FirstParam.class) Closure<T> closure) throws IOException {
"""
Allows this writer to be used within the closure, ensuring that it
is flushed and closed before this method returns.
@param writer the writer which is used and then closed
@param closure the closure that the writer is passed into
@return the value returned by the closure
@throws IOException if an IOException occurs.
@since 1.5.2
"""
try {
T result = closure.call(writer);
try {
writer.flush();
} catch (IOException e) {
// try to continue even in case of error
}
Writer temp = writer;
writer = null;
temp.close();
return result;
} finally {
closeWithWarning(writer);
}
} | java | public static <T> T withWriter(Writer writer, @ClosureParams(FirstParam.class) Closure<T> closure) throws IOException {
try {
T result = closure.call(writer);
try {
writer.flush();
} catch (IOException e) {
// try to continue even in case of error
}
Writer temp = writer;
writer = null;
temp.close();
return result;
} finally {
closeWithWarning(writer);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"withWriter",
"(",
"Writer",
"writer",
",",
"@",
"ClosureParams",
"(",
"FirstParam",
".",
"class",
")",
"Closure",
"<",
"T",
">",
"closure",
")",
"throws",
"IOException",
"{",
"try",
"{",
"T",
"result",
"=",
"clo... | Allows this writer to be used within the closure, ensuring that it
is flushed and closed before this method returns.
@param writer the writer which is used and then closed
@param closure the closure that the writer is passed into
@return the value returned by the closure
@throws IOException if an IOException occurs.
@since 1.5.2 | [
"Allows",
"this",
"writer",
"to",
"be",
"used",
"within",
"the",
"closure",
"ensuring",
"that",
"it",
"is",
"flushed",
"and",
"closed",
"before",
"this",
"method",
"returns",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L1131-L1147 |
javamelody/javamelody | javamelody-swing/src/main/java/net/bull/javamelody/swing/print/MCsvWriter.java | MCsvWriter.writeCsv | protected void writeCsv(final MBasicTable table, final OutputStream outputStream)
throws IOException {
"""
Exporte une JTable dans un fichier au format csv pour double-clique. (séparateur ',', formats nombres et dates US).
@param table
MBasicTable
@param outputStream
OutputStream
@throws IOException
Erreur disque
"""
writeCsv(table, outputStream, DateFormat.getDateInstance(DateFormat.SHORT, Locale.US));
} | java | protected void writeCsv(final MBasicTable table, final OutputStream outputStream)
throws IOException {
writeCsv(table, outputStream, DateFormat.getDateInstance(DateFormat.SHORT, Locale.US));
} | [
"protected",
"void",
"writeCsv",
"(",
"final",
"MBasicTable",
"table",
",",
"final",
"OutputStream",
"outputStream",
")",
"throws",
"IOException",
"{",
"writeCsv",
"(",
"table",
",",
"outputStream",
",",
"DateFormat",
".",
"getDateInstance",
"(",
"DateFormat",
"."... | Exporte une JTable dans un fichier au format csv pour double-clique. (séparateur ',', formats nombres et dates US).
@param table
MBasicTable
@param outputStream
OutputStream
@throws IOException
Erreur disque | [
"Exporte",
"une",
"JTable",
"dans",
"un",
"fichier",
"au",
"format",
"csv",
"pour",
"double",
"-",
"clique",
".",
"(",
"séparateur",
"formats",
"nombres",
"et",
"dates",
"US",
")",
"."
] | train | https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-swing/src/main/java/net/bull/javamelody/swing/print/MCsvWriter.java#L114-L117 |
fnklabs/draenei | src/main/java/com/fnklabs/draenei/analytics/AnalyticsUtils.java | AnalyticsUtils.scanStorage | @NotNull
public static <Entity extends Serializable> Integer scanStorage(@NotNull AnalyticsContext analyticsContext, @NotNull RangeScanTask<Entity> rangeScanTask) {
"""
Scan storage
<p>
Will generate token range and execute tasks to load data from cassandra by token range
@param analyticsContext Analytics context instance for retrieving distributed executor service and cassandra factory
@param <Entity> Entity class type
@return Total processed entities
"""
Timer timer = MetricsFactory.getMetrics().getTimer("analytics.scan_storage");
ClusterGroup clusterGroup = analyticsContext.getIgnite()
.cluster()
.forServers();
Integer loadedDocuments = analyticsContext.getIgnite()
.compute(clusterGroup)
.execute(rangeScanTask, null);
timer.stop();
LOGGER.warn("Complete to scan storage data in {}. Processed items: {} ", timer, loadedDocuments);
return loadedDocuments;
} | java | @NotNull
public static <Entity extends Serializable> Integer scanStorage(@NotNull AnalyticsContext analyticsContext, @NotNull RangeScanTask<Entity> rangeScanTask) {
Timer timer = MetricsFactory.getMetrics().getTimer("analytics.scan_storage");
ClusterGroup clusterGroup = analyticsContext.getIgnite()
.cluster()
.forServers();
Integer loadedDocuments = analyticsContext.getIgnite()
.compute(clusterGroup)
.execute(rangeScanTask, null);
timer.stop();
LOGGER.warn("Complete to scan storage data in {}. Processed items: {} ", timer, loadedDocuments);
return loadedDocuments;
} | [
"@",
"NotNull",
"public",
"static",
"<",
"Entity",
"extends",
"Serializable",
">",
"Integer",
"scanStorage",
"(",
"@",
"NotNull",
"AnalyticsContext",
"analyticsContext",
",",
"@",
"NotNull",
"RangeScanTask",
"<",
"Entity",
">",
"rangeScanTask",
")",
"{",
"Timer",
... | Scan storage
<p>
Will generate token range and execute tasks to load data from cassandra by token range
@param analyticsContext Analytics context instance for retrieving distributed executor service and cassandra factory
@param <Entity> Entity class type
@return Total processed entities | [
"Scan",
"storage",
"<p",
">",
"Will",
"generate",
"token",
"range",
"and",
"execute",
"tasks",
"to",
"load",
"data",
"from",
"cassandra",
"by",
"token",
"range"
] | train | https://github.com/fnklabs/draenei/blob/0a8cac54f1f635be3e2950375a23291d38453ae8/src/main/java/com/fnklabs/draenei/analytics/AnalyticsUtils.java#L36-L54 |
xvik/generics-resolver | src/main/java/ru/vyarus/java/generics/resolver/util/walk/TypesWalker.java | TypesWalker.isLowerBoundsCompatible | private static boolean isLowerBoundsCompatible(final WildcardType one, final WildcardType two) {
"""
When both wildcards are lower bounded (? super) then bounds must be compatible.
For example, ? super Integer and ? super BigInteger are not compatible (Integer, BigInteger)
and ? super Comparable and ? super Number are compatible (Number assignable to Comparable).
<p>
Of course, even incompatible lower bounds share some commons (at least object) but these types
could not be casted to one another and so no compatibility.
@param one first wildcard type
@param two second wildcard type
@return true if onw of wildcards is not lower bounded or lower bounds are compatible, false when
lower bounds are incompatible
"""
boolean res = true;
final Type[] oneLower = one.getLowerBounds();
final Type[] twoLower = two.getLowerBounds();
if (oneLower.length > 0 && twoLower.length > 0) {
res = isCompatible(GenericsUtils.resolveClassIgnoringVariables(oneLower[0]),
GenericsUtils.resolveClassIgnoringVariables(twoLower[0]));
}
return res;
} | java | private static boolean isLowerBoundsCompatible(final WildcardType one, final WildcardType two) {
boolean res = true;
final Type[] oneLower = one.getLowerBounds();
final Type[] twoLower = two.getLowerBounds();
if (oneLower.length > 0 && twoLower.length > 0) {
res = isCompatible(GenericsUtils.resolveClassIgnoringVariables(oneLower[0]),
GenericsUtils.resolveClassIgnoringVariables(twoLower[0]));
}
return res;
} | [
"private",
"static",
"boolean",
"isLowerBoundsCompatible",
"(",
"final",
"WildcardType",
"one",
",",
"final",
"WildcardType",
"two",
")",
"{",
"boolean",
"res",
"=",
"true",
";",
"final",
"Type",
"[",
"]",
"oneLower",
"=",
"one",
".",
"getLowerBounds",
"(",
... | When both wildcards are lower bounded (? super) then bounds must be compatible.
For example, ? super Integer and ? super BigInteger are not compatible (Integer, BigInteger)
and ? super Comparable and ? super Number are compatible (Number assignable to Comparable).
<p>
Of course, even incompatible lower bounds share some commons (at least object) but these types
could not be casted to one another and so no compatibility.
@param one first wildcard type
@param two second wildcard type
@return true if onw of wildcards is not lower bounded or lower bounds are compatible, false when
lower bounds are incompatible | [
"When",
"both",
"wildcards",
"are",
"lower",
"bounded",
"(",
"?",
"super",
")",
"then",
"bounds",
"must",
"be",
"compatible",
".",
"For",
"example",
"?",
"super",
"Integer",
"and",
"?",
"super",
"BigInteger",
"are",
"not",
"compatible",
"(",
"Integer",
"Bi... | train | https://github.com/xvik/generics-resolver/blob/d7d9d2783265df1178230e8f0b7cb6d853b67a7b/src/main/java/ru/vyarus/java/generics/resolver/util/walk/TypesWalker.java#L223-L232 |
skyscreamer/JSONassert | src/main/java/org/skyscreamer/jsonassert/JSONCompare.java | JSONCompare.compareJSON | public static JSONCompareResult compareJSON(String expectedStr, String actualStr, JSONComparator comparator)
throws JSONException {
"""
Compares JSON string provided to the expected JSON string using provided comparator, and returns the results of
the comparison.
@param expectedStr Expected JSON string
@param actualStr JSON string to compare
@param comparator Comparator to use
@return result of the comparison
@throws JSONException JSON parsing error
@throws IllegalArgumentException when type of expectedStr doesn't match the type of actualStr
"""
Object expected = JSONParser.parseJSON(expectedStr);
Object actual = JSONParser.parseJSON(actualStr);
if ((expected instanceof JSONObject) && (actual instanceof JSONObject)) {
return compareJSON((JSONObject) expected, (JSONObject) actual, comparator);
}
else if ((expected instanceof JSONArray) && (actual instanceof JSONArray)) {
return compareJSON((JSONArray)expected, (JSONArray)actual, comparator);
}
else if (expected instanceof JSONString && actual instanceof JSONString) {
return compareJson((JSONString) expected, (JSONString) actual);
}
else if (expected instanceof JSONObject) {
return new JSONCompareResult().fail("", expected, actual);
}
else {
return new JSONCompareResult().fail("", expected, actual);
}
} | java | public static JSONCompareResult compareJSON(String expectedStr, String actualStr, JSONComparator comparator)
throws JSONException {
Object expected = JSONParser.parseJSON(expectedStr);
Object actual = JSONParser.parseJSON(actualStr);
if ((expected instanceof JSONObject) && (actual instanceof JSONObject)) {
return compareJSON((JSONObject) expected, (JSONObject) actual, comparator);
}
else if ((expected instanceof JSONArray) && (actual instanceof JSONArray)) {
return compareJSON((JSONArray)expected, (JSONArray)actual, comparator);
}
else if (expected instanceof JSONString && actual instanceof JSONString) {
return compareJson((JSONString) expected, (JSONString) actual);
}
else if (expected instanceof JSONObject) {
return new JSONCompareResult().fail("", expected, actual);
}
else {
return new JSONCompareResult().fail("", expected, actual);
}
} | [
"public",
"static",
"JSONCompareResult",
"compareJSON",
"(",
"String",
"expectedStr",
",",
"String",
"actualStr",
",",
"JSONComparator",
"comparator",
")",
"throws",
"JSONException",
"{",
"Object",
"expected",
"=",
"JSONParser",
".",
"parseJSON",
"(",
"expectedStr",
... | Compares JSON string provided to the expected JSON string using provided comparator, and returns the results of
the comparison.
@param expectedStr Expected JSON string
@param actualStr JSON string to compare
@param comparator Comparator to use
@return result of the comparison
@throws JSONException JSON parsing error
@throws IllegalArgumentException when type of expectedStr doesn't match the type of actualStr | [
"Compares",
"JSON",
"string",
"provided",
"to",
"the",
"expected",
"JSON",
"string",
"using",
"provided",
"comparator",
"and",
"returns",
"the",
"results",
"of",
"the",
"comparison",
"."
] | train | https://github.com/skyscreamer/JSONassert/blob/830efcf546d07f955d8a213cc5c8a1db34d78f04/src/main/java/org/skyscreamer/jsonassert/JSONCompare.java#L47-L66 |
orhanobut/dialogplus | dialogplus/src/main/java/com/orhanobut/dialogplus/Utils.java | Utils.getAnimationResource | static int getAnimationResource(int gravity, boolean isInAnimation) {
"""
Get default animation resource when not defined by the user
@param gravity the gravity of the dialog
@param isInAnimation determine if is in or out animation. true when is is
@return the id of the animation resource
"""
if ((gravity & Gravity.TOP) == Gravity.TOP) {
return isInAnimation ? R.anim.slide_in_top : R.anim.slide_out_top;
}
if ((gravity & Gravity.BOTTOM) == Gravity.BOTTOM) {
return isInAnimation ? R.anim.slide_in_bottom : R.anim.slide_out_bottom;
}
if ((gravity & Gravity.CENTER) == Gravity.CENTER) {
return isInAnimation ? R.anim.fade_in_center : R.anim.fade_out_center;
}
return INVALID;
} | java | static int getAnimationResource(int gravity, boolean isInAnimation) {
if ((gravity & Gravity.TOP) == Gravity.TOP) {
return isInAnimation ? R.anim.slide_in_top : R.anim.slide_out_top;
}
if ((gravity & Gravity.BOTTOM) == Gravity.BOTTOM) {
return isInAnimation ? R.anim.slide_in_bottom : R.anim.slide_out_bottom;
}
if ((gravity & Gravity.CENTER) == Gravity.CENTER) {
return isInAnimation ? R.anim.fade_in_center : R.anim.fade_out_center;
}
return INVALID;
} | [
"static",
"int",
"getAnimationResource",
"(",
"int",
"gravity",
",",
"boolean",
"isInAnimation",
")",
"{",
"if",
"(",
"(",
"gravity",
"&",
"Gravity",
".",
"TOP",
")",
"==",
"Gravity",
".",
"TOP",
")",
"{",
"return",
"isInAnimation",
"?",
"R",
".",
"anim"... | Get default animation resource when not defined by the user
@param gravity the gravity of the dialog
@param isInAnimation determine if is in or out animation. true when is is
@return the id of the animation resource | [
"Get",
"default",
"animation",
"resource",
"when",
"not",
"defined",
"by",
"the",
"user"
] | train | https://github.com/orhanobut/dialogplus/blob/291bf4daaa3c81bf5537125f547913beb8ee2c17/dialogplus/src/main/java/com/orhanobut/dialogplus/Utils.java#L63-L74 |
bazaarvoice/emodb | common/client/src/main/java/com/bazaarvoice/emodb/client/uri/EmoUriComponent.java | EmoUriComponent.decodePercentEncodedOctets | private static ByteBuffer decodePercentEncodedOctets(String s, int i, ByteBuffer bb) {
"""
Decode a continuous sequence of percent encoded octets.
<p>
Assumes the index, i, starts that the first hex digit of the first
percent-encoded octet.
"""
if (bb == null) {
bb = ByteBuffer.allocate(1);
} else {
bb.clear();
}
while (true) {
// Decode the hex digits
bb.put((byte) (decodeHex(s, i++) << 4 | decodeHex(s, i++)));
// Finish if at the end of the string
if (i == s.length()) {
break;
}
// Finish if no more percent-encoded octets follow
if (s.charAt(i++) != '%') {
break;
}
// Check if the byte buffer needs to be increased in size
if (bb.position() == bb.capacity()) {
bb.flip();
// Create a new byte buffer with the maximum number of possible
// octets, hence resize should only occur once
ByteBuffer bb_new = ByteBuffer.allocate(s.length() / 3);
bb_new.put(bb);
bb = bb_new;
}
}
bb.flip();
return bb;
} | java | private static ByteBuffer decodePercentEncodedOctets(String s, int i, ByteBuffer bb) {
if (bb == null) {
bb = ByteBuffer.allocate(1);
} else {
bb.clear();
}
while (true) {
// Decode the hex digits
bb.put((byte) (decodeHex(s, i++) << 4 | decodeHex(s, i++)));
// Finish if at the end of the string
if (i == s.length()) {
break;
}
// Finish if no more percent-encoded octets follow
if (s.charAt(i++) != '%') {
break;
}
// Check if the byte buffer needs to be increased in size
if (bb.position() == bb.capacity()) {
bb.flip();
// Create a new byte buffer with the maximum number of possible
// octets, hence resize should only occur once
ByteBuffer bb_new = ByteBuffer.allocate(s.length() / 3);
bb_new.put(bb);
bb = bb_new;
}
}
bb.flip();
return bb;
} | [
"private",
"static",
"ByteBuffer",
"decodePercentEncodedOctets",
"(",
"String",
"s",
",",
"int",
"i",
",",
"ByteBuffer",
"bb",
")",
"{",
"if",
"(",
"bb",
"==",
"null",
")",
"{",
"bb",
"=",
"ByteBuffer",
".",
"allocate",
"(",
"1",
")",
";",
"}",
"else",... | Decode a continuous sequence of percent encoded octets.
<p>
Assumes the index, i, starts that the first hex digit of the first
percent-encoded octet. | [
"Decode",
"a",
"continuous",
"sequence",
"of",
"percent",
"encoded",
"octets",
".",
"<p",
">",
"Assumes",
"the",
"index",
"i",
"starts",
"that",
"the",
"first",
"hex",
"digit",
"of",
"the",
"first",
"percent",
"-",
"encoded",
"octet",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/common/client/src/main/java/com/bazaarvoice/emodb/client/uri/EmoUriComponent.java#L780-L814 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM2.java | SAX2DTM2.processingInstruction | public void processingInstruction(String target, String data)
throws SAXException {
"""
Override the processingInstruction() interface in SAX2DTM2.
<p>
%OPT% This one is different from SAX2DTM.processingInstruction()
in that we do not use extended types for PI nodes. The name of
the PI is saved in the DTMStringPool.
Receive notification of a processing instruction.
@param target The processing instruction target.
@param data The processing instruction data, or null if
none is supplied.
@throws SAXException Any SAX exception, possibly
wrapping another exception.
@see org.xml.sax.ContentHandler#processingInstruction
"""
charactersFlush();
int dataIndex = m_data.size();
m_previous = addNode(DTM.PROCESSING_INSTRUCTION_NODE,
DTM.PROCESSING_INSTRUCTION_NODE,
m_parents.peek(), m_previous,
-dataIndex, false);
m_data.addElement(m_valuesOrPrefixes.stringToIndex(target));
m_values.addElement(data);
m_data.addElement(m_valueIndex++);
} | java | public void processingInstruction(String target, String data)
throws SAXException
{
charactersFlush();
int dataIndex = m_data.size();
m_previous = addNode(DTM.PROCESSING_INSTRUCTION_NODE,
DTM.PROCESSING_INSTRUCTION_NODE,
m_parents.peek(), m_previous,
-dataIndex, false);
m_data.addElement(m_valuesOrPrefixes.stringToIndex(target));
m_values.addElement(data);
m_data.addElement(m_valueIndex++);
} | [
"public",
"void",
"processingInstruction",
"(",
"String",
"target",
",",
"String",
"data",
")",
"throws",
"SAXException",
"{",
"charactersFlush",
"(",
")",
";",
"int",
"dataIndex",
"=",
"m_data",
".",
"size",
"(",
")",
";",
"m_previous",
"=",
"addNode",
"(",... | Override the processingInstruction() interface in SAX2DTM2.
<p>
%OPT% This one is different from SAX2DTM.processingInstruction()
in that we do not use extended types for PI nodes. The name of
the PI is saved in the DTMStringPool.
Receive notification of a processing instruction.
@param target The processing instruction target.
@param data The processing instruction data, or null if
none is supplied.
@throws SAXException Any SAX exception, possibly
wrapping another exception.
@see org.xml.sax.ContentHandler#processingInstruction | [
"Override",
"the",
"processingInstruction",
"()",
"interface",
"in",
"SAX2DTM2",
".",
"<p",
">",
"%OPT%",
"This",
"one",
"is",
"different",
"from",
"SAX2DTM",
".",
"processingInstruction",
"()",
"in",
"that",
"we",
"do",
"not",
"use",
"extended",
"types",
"for... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM2.java#L2455-L2471 |
samskivert/pythagoras | src/main/java/pythagoras/d/Matrix3.java | Matrix3.setToRotation | public Matrix3 setToRotation (double angle, IVector3 axis) {
"""
Sets this to a rotation matrix.
@return a reference to this matrix, for chaining.
"""
return setToRotation(angle, axis.x(), axis.y(), axis.z());
} | java | public Matrix3 setToRotation (double angle, IVector3 axis) {
return setToRotation(angle, axis.x(), axis.y(), axis.z());
} | [
"public",
"Matrix3",
"setToRotation",
"(",
"double",
"angle",
",",
"IVector3",
"axis",
")",
"{",
"return",
"setToRotation",
"(",
"angle",
",",
"axis",
".",
"x",
"(",
")",
",",
"axis",
".",
"y",
"(",
")",
",",
"axis",
".",
"z",
"(",
")",
")",
";",
... | Sets this to a rotation matrix.
@return a reference to this matrix, for chaining. | [
"Sets",
"this",
"to",
"a",
"rotation",
"matrix",
"."
] | train | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Matrix3.java#L166-L168 |
alkacon/opencms-core | src/org/opencms/ade/sitemap/shared/CmsClientSitemapEntry.java | CmsClientSitemapEntry.addSubEntry | public void addSubEntry(CmsClientSitemapEntry entry, I_CmsSitemapController controller) {
"""
Adds the given entry to the children.<p>
@param entry the entry to add
@param controller a sitemap controller instance
"""
entry.setPosition(m_subEntries.size());
entry.updateSitePath(CmsStringUtil.joinPaths(m_sitePath, entry.getName()), controller);
entry.setFolderDefaultPage(entry.isLeafType() && getVfsPath().equals(entry.getVfsPath()));
m_subEntries.add(entry);
} | java | public void addSubEntry(CmsClientSitemapEntry entry, I_CmsSitemapController controller) {
entry.setPosition(m_subEntries.size());
entry.updateSitePath(CmsStringUtil.joinPaths(m_sitePath, entry.getName()), controller);
entry.setFolderDefaultPage(entry.isLeafType() && getVfsPath().equals(entry.getVfsPath()));
m_subEntries.add(entry);
} | [
"public",
"void",
"addSubEntry",
"(",
"CmsClientSitemapEntry",
"entry",
",",
"I_CmsSitemapController",
"controller",
")",
"{",
"entry",
".",
"setPosition",
"(",
"m_subEntries",
".",
"size",
"(",
")",
")",
";",
"entry",
".",
"updateSitePath",
"(",
"CmsStringUtil",
... | Adds the given entry to the children.<p>
@param entry the entry to add
@param controller a sitemap controller instance | [
"Adds",
"the",
"given",
"entry",
"to",
"the",
"children",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/sitemap/shared/CmsClientSitemapEntry.java#L209-L215 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/dispatcher/DataContextUtils.java | DataContextUtils.replaceDataReferences | public static Map<String, Object> replaceDataReferences(
final Map<String, Object> input,
final Map<String, Map<String, String>> data
) {
"""
Recursively replace data references in the values in a map which contains either string, collection or Map
values.
@param input input map
@param data context data
@return Map with all string values having references replaced
"""
return replaceDataReferences(input, data, null, false, false);
} | java | public static Map<String, Object> replaceDataReferences(
final Map<String, Object> input,
final Map<String, Map<String, String>> data
)
{
return replaceDataReferences(input, data, null, false, false);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"replaceDataReferences",
"(",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"input",
",",
"final",
"Map",
"<",
"String",
",",
"Map",
"<",
"String",
",",
"String",
">",
">",
"data",
")",... | Recursively replace data references in the values in a map which contains either string, collection or Map
values.
@param input input map
@param data context data
@return Map with all string values having references replaced | [
"Recursively",
"replace",
"data",
"references",
"in",
"the",
"values",
"in",
"a",
"map",
"which",
"contains",
"either",
"string",
"collection",
"or",
"Map",
"values",
"."
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/dispatcher/DataContextUtils.java#L183-L189 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/datahandler/CassandraDataHandlerBase.java | CassandraDataHandlerBase.getTTLForColumn | private int getTTLForColumn(Object columnTTLs, Attribute attribute) {
"""
Determined TTL for a given column.
@param columnTTLs
the column tt ls
@param attribute
the attribute
@return the TTL for column
"""
Integer ttl = null;
if (columnTTLs != null)
{
if (columnTTLs instanceof Map)
{
ttl = (Integer) (columnTTLs == null ? 0 : ((Map) columnTTLs).get(((AbstractAttribute) attribute)
.getJPAColumnName()));
}
else if (columnTTLs instanceof Integer)
{
ttl = (Integer) columnTTLs;
}
}
return ttl == null ? 0 : ttl;
} | java | private int getTTLForColumn(Object columnTTLs, Attribute attribute)
{
Integer ttl = null;
if (columnTTLs != null)
{
if (columnTTLs instanceof Map)
{
ttl = (Integer) (columnTTLs == null ? 0 : ((Map) columnTTLs).get(((AbstractAttribute) attribute)
.getJPAColumnName()));
}
else if (columnTTLs instanceof Integer)
{
ttl = (Integer) columnTTLs;
}
}
return ttl == null ? 0 : ttl;
} | [
"private",
"int",
"getTTLForColumn",
"(",
"Object",
"columnTTLs",
",",
"Attribute",
"attribute",
")",
"{",
"Integer",
"ttl",
"=",
"null",
";",
"if",
"(",
"columnTTLs",
"!=",
"null",
")",
"{",
"if",
"(",
"columnTTLs",
"instanceof",
"Map",
")",
"{",
"ttl",
... | Determined TTL for a given column.
@param columnTTLs
the column tt ls
@param attribute
the attribute
@return the TTL for column | [
"Determined",
"TTL",
"for",
"a",
"given",
"column",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/datahandler/CassandraDataHandlerBase.java#L1972-L1988 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-core/src/main/java/org/deeplearning4j/evaluation/EvaluationTools.java | EvaluationTools.exportRocChartsToHtmlFile | public static void exportRocChartsToHtmlFile(ROC roc, File file) throws IOException {
"""
Given a {@link ROC} chart, export the ROC chart and precision vs. recall charts to a stand-alone HTML file
@param roc ROC to export
@param file File to export to
"""
String rocAsHtml = rocChartToHtml(roc);
FileUtils.writeStringToFile(file, rocAsHtml);
} | java | public static void exportRocChartsToHtmlFile(ROC roc, File file) throws IOException {
String rocAsHtml = rocChartToHtml(roc);
FileUtils.writeStringToFile(file, rocAsHtml);
} | [
"public",
"static",
"void",
"exportRocChartsToHtmlFile",
"(",
"ROC",
"roc",
",",
"File",
"file",
")",
"throws",
"IOException",
"{",
"String",
"rocAsHtml",
"=",
"rocChartToHtml",
"(",
"roc",
")",
";",
"FileUtils",
".",
"writeStringToFile",
"(",
"file",
",",
"ro... | Given a {@link ROC} chart, export the ROC chart and precision vs. recall charts to a stand-alone HTML file
@param roc ROC to export
@param file File to export to | [
"Given",
"a",
"{"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-core/src/main/java/org/deeplearning4j/evaluation/EvaluationTools.java#L123-L126 |
comapi/comapi-chat-sdk-android | COMAPI/chat/src/main/java/com/comapi/chat/ChatController.java | ChatController.handleConversationUpdated | Observable<ChatResult> handleConversationUpdated(ConversationUpdate request, ComapiResult<ConversationDetails> result) {
"""
Handles conversation update service response.
@param request Service API request object.
@param result Service call response.
@return Observable emitting result of operations.
"""
if (result.isSuccessful()) {
return persistenceController.upsertConversation(ChatConversation.builder().populate(result.getResult(), result.getETag()).build()).map(success -> adapter.adaptResult(result, success));
}
if (result.getCode() == ETAG_NOT_VALID) {
return checkState().flatMap(client -> client.service().messaging().getConversation(request.getId())
.flatMap(newResult -> {
if (newResult.isSuccessful()) {
return persistenceController.upsertConversation(ChatConversation.builder().populate(newResult.getResult(), newResult.getETag()).build())
.flatMap(success -> Observable.fromCallable(() -> new ChatResult(false, success ? new ChatResult.Error(ETAG_NOT_VALID, "Conversation updated, try delete again.", "Conversation "+request.getId()+" updated in response to wrong eTag error when updating."): new ChatResult.Error(1500, "Error updating custom store.", null))));
} else {
return Observable.fromCallable(() -> adapter.adaptResult(newResult));
}
}));
} else {
return Observable.fromCallable(() -> adapter.adaptResult(result));
}
} | java | Observable<ChatResult> handleConversationUpdated(ConversationUpdate request, ComapiResult<ConversationDetails> result) {
if (result.isSuccessful()) {
return persistenceController.upsertConversation(ChatConversation.builder().populate(result.getResult(), result.getETag()).build()).map(success -> adapter.adaptResult(result, success));
}
if (result.getCode() == ETAG_NOT_VALID) {
return checkState().flatMap(client -> client.service().messaging().getConversation(request.getId())
.flatMap(newResult -> {
if (newResult.isSuccessful()) {
return persistenceController.upsertConversation(ChatConversation.builder().populate(newResult.getResult(), newResult.getETag()).build())
.flatMap(success -> Observable.fromCallable(() -> new ChatResult(false, success ? new ChatResult.Error(ETAG_NOT_VALID, "Conversation updated, try delete again.", "Conversation "+request.getId()+" updated in response to wrong eTag error when updating."): new ChatResult.Error(1500, "Error updating custom store.", null))));
} else {
return Observable.fromCallable(() -> adapter.adaptResult(newResult));
}
}));
} else {
return Observable.fromCallable(() -> adapter.adaptResult(result));
}
} | [
"Observable",
"<",
"ChatResult",
">",
"handleConversationUpdated",
"(",
"ConversationUpdate",
"request",
",",
"ComapiResult",
"<",
"ConversationDetails",
">",
"result",
")",
"{",
"if",
"(",
"result",
".",
"isSuccessful",
"(",
")",
")",
"{",
"return",
"persistenceC... | Handles conversation update service response.
@param request Service API request object.
@param result Service call response.
@return Observable emitting result of operations. | [
"Handles",
"conversation",
"update",
"service",
"response",
"."
] | train | https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/ChatController.java#L394-L416 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bcc/BccClient.java | BccClient.createSnapshot | public CreateSnapshotResponse createSnapshot(String volumeId, String snapshotName, String desc) {
"""
Creating snapshot from specified volume.
You can create snapshot from system volume and CDS volume.
While creating snapshot from system volume,the instance must be Running or Stopped,
otherwise,it's will get <code>409</code> errorCode.
While creating snapshot from CDS volume,,the volume must be InUs or Available,
otherwise,it's will get <code>409</code> errorCode.
This is an asynchronous interface,
you can get the latest status by invoke {@link #getSnapshot(GetSnapshotRequest)}
@param volumeId The id of volume which will be used to create snapshot.
@param snapshotName The name of snapshot will be created.
@param desc The optional parameter to describe the newly created snapshot.
@return The response with the id of snapshot created.
"""
return this.createSnapshot(new CreateSnapshotRequest()
.withVolumeId(volumeId).withSnapshotName(snapshotName).withDesc(desc));
} | java | public CreateSnapshotResponse createSnapshot(String volumeId, String snapshotName, String desc) {
return this.createSnapshot(new CreateSnapshotRequest()
.withVolumeId(volumeId).withSnapshotName(snapshotName).withDesc(desc));
} | [
"public",
"CreateSnapshotResponse",
"createSnapshot",
"(",
"String",
"volumeId",
",",
"String",
"snapshotName",
",",
"String",
"desc",
")",
"{",
"return",
"this",
".",
"createSnapshot",
"(",
"new",
"CreateSnapshotRequest",
"(",
")",
".",
"withVolumeId",
"(",
"volu... | Creating snapshot from specified volume.
You can create snapshot from system volume and CDS volume.
While creating snapshot from system volume,the instance must be Running or Stopped,
otherwise,it's will get <code>409</code> errorCode.
While creating snapshot from CDS volume,,the volume must be InUs or Available,
otherwise,it's will get <code>409</code> errorCode.
This is an asynchronous interface,
you can get the latest status by invoke {@link #getSnapshot(GetSnapshotRequest)}
@param volumeId The id of volume which will be used to create snapshot.
@param snapshotName The name of snapshot will be created.
@param desc The optional parameter to describe the newly created snapshot.
@return The response with the id of snapshot created. | [
"Creating",
"snapshot",
"from",
"specified",
"volume",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bcc/BccClient.java#L1386-L1389 |
timols/java-gitlab-api | src/main/java/org/gitlab/api/GitlabAPI.java | GitlabAPI.updateGroup | public GitlabGroup updateGroup(GitlabGroup group, GitlabUser sudoUser) throws IOException {
"""
Updates a Group
@param group the group object
@param sudoUser The user to create the group on behalf of
@return The GitLab Group
@throws IOException on gitlab api call error
"""
Query query = new Query()
.appendIf("name", group.getName())
.appendIf("path", group.getPath())
.appendIf("description", group.getDescription())
.appendIf("membership_lock", group.getMembershipLock())
.appendIf("share_with_group_lock", group.getShareWithGroupLock())
.appendIf("visibility", group.getVisibility().toString())
.appendIf("lfs_enabled", group.isLfsEnabled())
.appendIf("request_access_enabled", group.isRequestAccessEnabled())
.appendIf("shared_runners_minutes_limit", group.getSharedRunnersMinutesLimit())
.appendIf("ldap_cn", group.getLdapCn())
.appendIf("ldap_access", group.getLdapAccess())
.appendIf(PARAM_SUDO, sudoUser != null ? sudoUser.getId() : null);
String tailUrl = GitlabGroup.URL + "/" + group.getId() + query.toString();
return retrieve().method(PUT).to(tailUrl, GitlabGroup.class);
} | java | public GitlabGroup updateGroup(GitlabGroup group, GitlabUser sudoUser) throws IOException {
Query query = new Query()
.appendIf("name", group.getName())
.appendIf("path", group.getPath())
.appendIf("description", group.getDescription())
.appendIf("membership_lock", group.getMembershipLock())
.appendIf("share_with_group_lock", group.getShareWithGroupLock())
.appendIf("visibility", group.getVisibility().toString())
.appendIf("lfs_enabled", group.isLfsEnabled())
.appendIf("request_access_enabled", group.isRequestAccessEnabled())
.appendIf("shared_runners_minutes_limit", group.getSharedRunnersMinutesLimit())
.appendIf("ldap_cn", group.getLdapCn())
.appendIf("ldap_access", group.getLdapAccess())
.appendIf(PARAM_SUDO, sudoUser != null ? sudoUser.getId() : null);
String tailUrl = GitlabGroup.URL + "/" + group.getId() + query.toString();
return retrieve().method(PUT).to(tailUrl, GitlabGroup.class);
} | [
"public",
"GitlabGroup",
"updateGroup",
"(",
"GitlabGroup",
"group",
",",
"GitlabUser",
"sudoUser",
")",
"throws",
"IOException",
"{",
"Query",
"query",
"=",
"new",
"Query",
"(",
")",
".",
"appendIf",
"(",
"\"name\"",
",",
"group",
".",
"getName",
"(",
")",
... | Updates a Group
@param group the group object
@param sudoUser The user to create the group on behalf of
@return The GitLab Group
@throws IOException on gitlab api call error | [
"Updates",
"a",
"Group"
] | train | https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L689-L708 |
rzwitserloot/lombok | src/core/lombok/javac/apt/LombokProcessor.java | LombokProcessor.getJavacFiler | public JavacFiler getJavacFiler(Object filer) {
"""
This class returns the given filer as a JavacFiler. In case the filer is no
JavacFiler (e.g. the Gradle IncrementalFiler), its "delegate" field is used to get the JavacFiler
(directly or through a delegate field again)
"""
if (filer instanceof JavacFiler) return (JavacFiler) filer;
// try to find a "delegate" field in the object, and use this to check for a JavacFiler
for (Class<?> filerClass = filer.getClass(); filerClass != null; filerClass = filerClass.getSuperclass()) {
try {
return getJavacFiler(tryGetDelegateField(filerClass, filer));
} catch (final Exception e) {
// delegate field was not found, try on superclass
}
}
processingEnv.getMessager().printMessage(Kind.WARNING,
"Can't get a JavacFiler from " + filer.getClass().getName() + ". Lombok won't work.");
return null;
} | java | public JavacFiler getJavacFiler(Object filer) {
if (filer instanceof JavacFiler) return (JavacFiler) filer;
// try to find a "delegate" field in the object, and use this to check for a JavacFiler
for (Class<?> filerClass = filer.getClass(); filerClass != null; filerClass = filerClass.getSuperclass()) {
try {
return getJavacFiler(tryGetDelegateField(filerClass, filer));
} catch (final Exception e) {
// delegate field was not found, try on superclass
}
}
processingEnv.getMessager().printMessage(Kind.WARNING,
"Can't get a JavacFiler from " + filer.getClass().getName() + ". Lombok won't work.");
return null;
} | [
"public",
"JavacFiler",
"getJavacFiler",
"(",
"Object",
"filer",
")",
"{",
"if",
"(",
"filer",
"instanceof",
"JavacFiler",
")",
"return",
"(",
"JavacFiler",
")",
"filer",
";",
"// try to find a \"delegate\" field in the object, and use this to check for a JavacFiler",
"for"... | This class returns the given filer as a JavacFiler. In case the filer is no
JavacFiler (e.g. the Gradle IncrementalFiler), its "delegate" field is used to get the JavacFiler
(directly or through a delegate field again) | [
"This",
"class",
"returns",
"the",
"given",
"filer",
"as",
"a",
"JavacFiler",
".",
"In",
"case",
"the",
"filer",
"is",
"no",
"JavacFiler",
"(",
"e",
".",
"g",
".",
"the",
"Gradle",
"IncrementalFiler",
")",
"its",
"delegate",
"field",
"is",
"used",
"to",
... | train | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/apt/LombokProcessor.java#L431-L446 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/ExecutorsUtils.java | ExecutorsUtils.newThreadFactory | public static ThreadFactory newThreadFactory(Optional<Logger> logger) {
"""
Get a new {@link java.util.concurrent.ThreadFactory} that uses a {@link LoggingUncaughtExceptionHandler}
to handle uncaught exceptions.
@param logger an {@link com.google.common.base.Optional} wrapping the {@link org.slf4j.Logger} that the
{@link LoggingUncaughtExceptionHandler} uses to log uncaught exceptions thrown in threads
@return a new {@link java.util.concurrent.ThreadFactory}
"""
return newThreadFactory(logger, Optional.<String>absent());
} | java | public static ThreadFactory newThreadFactory(Optional<Logger> logger) {
return newThreadFactory(logger, Optional.<String>absent());
} | [
"public",
"static",
"ThreadFactory",
"newThreadFactory",
"(",
"Optional",
"<",
"Logger",
">",
"logger",
")",
"{",
"return",
"newThreadFactory",
"(",
"logger",
",",
"Optional",
".",
"<",
"String",
">",
"absent",
"(",
")",
")",
";",
"}"
] | Get a new {@link java.util.concurrent.ThreadFactory} that uses a {@link LoggingUncaughtExceptionHandler}
to handle uncaught exceptions.
@param logger an {@link com.google.common.base.Optional} wrapping the {@link org.slf4j.Logger} that the
{@link LoggingUncaughtExceptionHandler} uses to log uncaught exceptions thrown in threads
@return a new {@link java.util.concurrent.ThreadFactory} | [
"Get",
"a",
"new",
"{",
"@link",
"java",
".",
"util",
".",
"concurrent",
".",
"ThreadFactory",
"}",
"that",
"uses",
"a",
"{",
"@link",
"LoggingUncaughtExceptionHandler",
"}",
"to",
"handle",
"uncaught",
"exceptions",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/ExecutorsUtils.java#L76-L78 |
Wadpam/guja | guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDFactoryDaoImpl.java | GeneratedDFactoryDaoImpl.queryByUpdatedDate | public Iterable<DFactory> queryByUpdatedDate(java.util.Date updatedDate) {
"""
query-by method for field updatedDate
@param updatedDate the specified attribute
@return an Iterable of DFactorys for the specified updatedDate
"""
return queryByField(null, DFactoryMapper.Field.UPDATEDDATE.getFieldName(), updatedDate);
} | java | public Iterable<DFactory> queryByUpdatedDate(java.util.Date updatedDate) {
return queryByField(null, DFactoryMapper.Field.UPDATEDDATE.getFieldName(), updatedDate);
} | [
"public",
"Iterable",
"<",
"DFactory",
">",
"queryByUpdatedDate",
"(",
"java",
".",
"util",
".",
"Date",
"updatedDate",
")",
"{",
"return",
"queryByField",
"(",
"null",
",",
"DFactoryMapper",
".",
"Field",
".",
"UPDATEDDATE",
".",
"getFieldName",
"(",
")",
"... | query-by method for field updatedDate
@param updatedDate the specified attribute
@return an Iterable of DFactorys for the specified updatedDate | [
"query",
"-",
"by",
"method",
"for",
"field",
"updatedDate"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDFactoryDaoImpl.java#L124-L126 |
nemerosa/ontrack | ontrack-ui/src/main/java/net/nemerosa/ontrack/boot/ui/PropertyController.java | PropertyController.editProperty | @RequestMapping(value = " {
"""
Edits the value of a property.
@param entityType Type of the entity to edit
@param id ID of the entity to edit
@param propertyTypeName Fully qualified name of the property to edit
@param data Raw JSON data for the property value
"""entityType}/{id}/{propertyTypeName}/edit", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.ACCEPTED)
public Ack editProperty(@PathVariable ProjectEntityType entityType, @PathVariable ID id, @PathVariable String propertyTypeName, @RequestBody JsonNode data) {
return propertyService.editProperty(
getEntity(entityType, id),
propertyTypeName,
data
);
} | java | @RequestMapping(value = "{entityType}/{id}/{propertyTypeName}/edit", method = RequestMethod.PUT)
@ResponseStatus(HttpStatus.ACCEPTED)
public Ack editProperty(@PathVariable ProjectEntityType entityType, @PathVariable ID id, @PathVariable String propertyTypeName, @RequestBody JsonNode data) {
return propertyService.editProperty(
getEntity(entityType, id),
propertyTypeName,
data
);
} | [
"@",
"RequestMapping",
"(",
"value",
"=",
"\"{entityType}/{id}/{propertyTypeName}/edit\"",
",",
"method",
"=",
"RequestMethod",
".",
"PUT",
")",
"@",
"ResponseStatus",
"(",
"HttpStatus",
".",
"ACCEPTED",
")",
"public",
"Ack",
"editProperty",
"(",
"@",
"PathVariable"... | Edits the value of a property.
@param entityType Type of the entity to edit
@param id ID of the entity to edit
@param propertyTypeName Fully qualified name of the property to edit
@param data Raw JSON data for the property value | [
"Edits",
"the",
"value",
"of",
"a",
"property",
"."
] | train | https://github.com/nemerosa/ontrack/blob/37b0874cbf387b58aba95cd3c1bc3b15e11bc913/ontrack-ui/src/main/java/net/nemerosa/ontrack/boot/ui/PropertyController.java#L110-L118 |
jcuda/jnvgraph | JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java | JNvgraph.nvgraphSssp | public static int nvgraphSssp(
nvgraphHandle handle,
nvgraphGraphDescr descrG,
long weight_index,
Pointer source_vert,
long sssp_index) {
"""
nvGRAPH Single Source Shortest Path (SSSP)
Calculate the shortest path distance from a single vertex in the graph to all other vertices.
"""
return checkResult(nvgraphSsspNative(handle, descrG, weight_index, source_vert, sssp_index));
} | java | public static int nvgraphSssp(
nvgraphHandle handle,
nvgraphGraphDescr descrG,
long weight_index,
Pointer source_vert,
long sssp_index)
{
return checkResult(nvgraphSsspNative(handle, descrG, weight_index, source_vert, sssp_index));
} | [
"public",
"static",
"int",
"nvgraphSssp",
"(",
"nvgraphHandle",
"handle",
",",
"nvgraphGraphDescr",
"descrG",
",",
"long",
"weight_index",
",",
"Pointer",
"source_vert",
",",
"long",
"sssp_index",
")",
"{",
"return",
"checkResult",
"(",
"nvgraphSsspNative",
"(",
"... | nvGRAPH Single Source Shortest Path (SSSP)
Calculate the shortest path distance from a single vertex in the graph to all other vertices. | [
"nvGRAPH",
"Single",
"Source",
"Shortest",
"Path",
"(",
"SSSP",
")",
"Calculate",
"the",
"shortest",
"path",
"distance",
"from",
"a",
"single",
"vertex",
"in",
"the",
"graph",
"to",
"all",
"other",
"vertices",
"."
] | train | https://github.com/jcuda/jnvgraph/blob/2c6bd7c58edac181753bacf30af2cceeb1989a78/JNvgraphJava/src/main/java/jcuda/jnvgraph/JNvgraph.java#L605-L613 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java | Calc.getCenterVector | public static final Atom getCenterVector(Atom[] atomSet) {
"""
Returns the Vector that needs to be applied to shift a set of atoms to
the Centroid.
@param atomSet
array of Atoms
@return the vector needed to shift the set of atoms to its geometric
center
"""
Atom centroid = getCentroid(atomSet);
return getCenterVector(atomSet,centroid);
} | java | public static final Atom getCenterVector(Atom[] atomSet){
Atom centroid = getCentroid(atomSet);
return getCenterVector(atomSet,centroid);
} | [
"public",
"static",
"final",
"Atom",
"getCenterVector",
"(",
"Atom",
"[",
"]",
"atomSet",
")",
"{",
"Atom",
"centroid",
"=",
"getCentroid",
"(",
"atomSet",
")",
";",
"return",
"getCenterVector",
"(",
"atomSet",
",",
"centroid",
")",
";",
"}"
] | Returns the Vector that needs to be applied to shift a set of atoms to
the Centroid.
@param atomSet
array of Atoms
@return the vector needed to shift the set of atoms to its geometric
center | [
"Returns",
"the",
"Vector",
"that",
"needs",
"to",
"be",
"applied",
"to",
"shift",
"a",
"set",
"of",
"atoms",
"to",
"the",
"Centroid",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L901-L906 |
sockeqwe/mosby | sample-mail/src/main/java/com/hannesdorfmann/mosby3/sample/mail/utils/DimensUtils.java | DimensUtils.dpToPx | public static int dpToPx(Context context, float dp) {
"""
Converts a dp value to a px value
@param context The context
@param dp the dp value
@return value in pixels
"""
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
return (int) ((dp * displayMetrics.density) + 0.5);
} | java | public static int dpToPx(Context context, float dp) {
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
return (int) ((dp * displayMetrics.density) + 0.5);
} | [
"public",
"static",
"int",
"dpToPx",
"(",
"Context",
"context",
",",
"float",
"dp",
")",
"{",
"DisplayMetrics",
"displayMetrics",
"=",
"context",
".",
"getResources",
"(",
")",
".",
"getDisplayMetrics",
"(",
")",
";",
"return",
"(",
"int",
")",
"(",
"(",
... | Converts a dp value to a px value
@param context The context
@param dp the dp value
@return value in pixels | [
"Converts",
"a",
"dp",
"value",
"to",
"a",
"px",
"value"
] | train | https://github.com/sockeqwe/mosby/blob/7f22118c950b5e6fbba0ec42d8e97586dfb08940/sample-mail/src/main/java/com/hannesdorfmann/mosby3/sample/mail/utils/DimensUtils.java#L21-L24 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getFromLastExcl | @Nullable
public static String getFromLastExcl (@Nullable final String sStr, final char cSearch) {
"""
Get everything from the string from and excluding the first passed char.
@param sStr
The source string. May be <code>null</code>.
@param cSearch
The character to search.
@return <code>null</code> if the passed string does not contain the search
character.
"""
return _getFromLast (sStr, cSearch, false);
} | java | @Nullable
public static String getFromLastExcl (@Nullable final String sStr, final char cSearch)
{
return _getFromLast (sStr, cSearch, false);
} | [
"@",
"Nullable",
"public",
"static",
"String",
"getFromLastExcl",
"(",
"@",
"Nullable",
"final",
"String",
"sStr",
",",
"final",
"char",
"cSearch",
")",
"{",
"return",
"_getFromLast",
"(",
"sStr",
",",
"cSearch",
",",
"false",
")",
";",
"}"
] | Get everything from the string from and excluding the first passed char.
@param sStr
The source string. May be <code>null</code>.
@param cSearch
The character to search.
@return <code>null</code> if the passed string does not contain the search
character. | [
"Get",
"everything",
"from",
"the",
"string",
"from",
"and",
"excluding",
"the",
"first",
"passed",
"char",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L5041-L5045 |
Azure/azure-sdk-for-java | datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java | ServicesInner.checkNameAvailability | public NameAvailabilityResponseInner checkNameAvailability(String location, NameAvailabilityRequest parameters) {
"""
Check name validity and availability.
This method checks whether a proposed top-level resource name is valid and available.
@param location The Azure region of the operation
@param parameters Requested name to validate
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ApiErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the NameAvailabilityResponseInner object if successful.
"""
return checkNameAvailabilityWithServiceResponseAsync(location, parameters).toBlocking().single().body();
} | java | public NameAvailabilityResponseInner checkNameAvailability(String location, NameAvailabilityRequest parameters) {
return checkNameAvailabilityWithServiceResponseAsync(location, parameters).toBlocking().single().body();
} | [
"public",
"NameAvailabilityResponseInner",
"checkNameAvailability",
"(",
"String",
"location",
",",
"NameAvailabilityRequest",
"parameters",
")",
"{",
"return",
"checkNameAvailabilityWithServiceResponseAsync",
"(",
"location",
",",
"parameters",
")",
".",
"toBlocking",
"(",
... | Check name validity and availability.
This method checks whether a proposed top-level resource name is valid and available.
@param location The Azure region of the operation
@param parameters Requested name to validate
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ApiErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the NameAvailabilityResponseInner object if successful. | [
"Check",
"name",
"validity",
"and",
"availability",
".",
"This",
"method",
"checks",
"whether",
"a",
"proposed",
"top",
"-",
"level",
"resource",
"name",
"is",
"valid",
"and",
"available",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java#L1812-L1814 |
RoaringBitmap/RoaringBitmap | roaringbitmap/src/main/java/org/roaringbitmap/buffer/MutableRoaringArray.java | MutableRoaringArray.appendCopy | protected void appendCopy(PointableRoaringArray highLowContainer, int startingIndex, int end) {
"""
Append copies of the values from another array
@param highLowContainer other array
@param startingIndex starting index in the other array
@param end last index array in the other array
"""
extendArray(end - startingIndex);
for (int i = startingIndex; i < end; ++i) {
this.keys[this.size] = highLowContainer.getKeyAtIndex(i);
this.values[this.size] = highLowContainer.getContainerAtIndex(i).clone();
this.size++;
}
} | java | protected void appendCopy(PointableRoaringArray highLowContainer, int startingIndex, int end) {
extendArray(end - startingIndex);
for (int i = startingIndex; i < end; ++i) {
this.keys[this.size] = highLowContainer.getKeyAtIndex(i);
this.values[this.size] = highLowContainer.getContainerAtIndex(i).clone();
this.size++;
}
} | [
"protected",
"void",
"appendCopy",
"(",
"PointableRoaringArray",
"highLowContainer",
",",
"int",
"startingIndex",
",",
"int",
"end",
")",
"{",
"extendArray",
"(",
"end",
"-",
"startingIndex",
")",
";",
"for",
"(",
"int",
"i",
"=",
"startingIndex",
";",
"i",
... | Append copies of the values from another array
@param highLowContainer other array
@param startingIndex starting index in the other array
@param end last index array in the other array | [
"Append",
"copies",
"of",
"the",
"values",
"from",
"another",
"array"
] | train | https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/buffer/MutableRoaringArray.java#L188-L195 |
JadiraOrg/jadira | bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java | BasicBinder.registerBinding | public final <S, T> void registerBinding(Class<S> source, Class<T> target, Binding<S, T> converter) {
"""
Register a Binding with the given source and target class.
A binding unifies a marshaller and an unmarshaller and both must be available to resolve a binding.
The source class is considered the owning class of the binding. The source can be marshalled
into the target class. Similarly, the target can be unmarshalled to produce an instance of the source type.
@param source The source (owning) class
@param target The target (foreign) class
@param converter The binding to be registered
"""
Class<? extends Annotation> scope = matchImplementationToScope(converter.getClass());
registerBinding(new ConverterKey<S,T>(source, target, scope == null ? DefaultBinding.class : scope), converter);
} | java | public final <S, T> void registerBinding(Class<S> source, Class<T> target, Binding<S, T> converter) {
Class<? extends Annotation> scope = matchImplementationToScope(converter.getClass());
registerBinding(new ConverterKey<S,T>(source, target, scope == null ? DefaultBinding.class : scope), converter);
} | [
"public",
"final",
"<",
"S",
",",
"T",
">",
"void",
"registerBinding",
"(",
"Class",
"<",
"S",
">",
"source",
",",
"Class",
"<",
"T",
">",
"target",
",",
"Binding",
"<",
"S",
",",
"T",
">",
"converter",
")",
"{",
"Class",
"<",
"?",
"extends",
"An... | Register a Binding with the given source and target class.
A binding unifies a marshaller and an unmarshaller and both must be available to resolve a binding.
The source class is considered the owning class of the binding. The source can be marshalled
into the target class. Similarly, the target can be unmarshalled to produce an instance of the source type.
@param source The source (owning) class
@param target The target (foreign) class
@param converter The binding to be registered | [
"Register",
"a",
"Binding",
"with",
"the",
"given",
"source",
"and",
"target",
"class",
".",
"A",
"binding",
"unifies",
"a",
"marshaller",
"and",
"an",
"unmarshaller",
"and",
"both",
"must",
"be",
"available",
"to",
"resolve",
"a",
"binding",
"."
] | train | https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java#L544-L547 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java | ClassWriterImpl.getClassLinks | private Content getClassLinks(LinkInfoImpl.Kind context, Collection<?> list) {
"""
Get links to the given classes.
@param context the id of the context where the link will be printed
@param list the list of classes
@return a content tree for the class list
"""
Content dd = new HtmlTree(HtmlTag.DD);
boolean isFirst = true;
for (Object type : list) {
if (!isFirst) {
Content separator = new StringContent(", ");
dd.addContent(separator);
} else {
isFirst = false;
}
// TODO: should we simply split this method up to avoid instanceof ?
if (type instanceof TypeElement) {
Content link = getLink(
new LinkInfoImpl(configuration, context, (TypeElement)(type)));
dd.addContent(HtmlTree.CODE(link));
} else {
Content link = getLink(
new LinkInfoImpl(configuration, context, ((TypeMirror)type)));
dd.addContent(HtmlTree.CODE(link));
}
}
return dd;
} | java | private Content getClassLinks(LinkInfoImpl.Kind context, Collection<?> list) {
Content dd = new HtmlTree(HtmlTag.DD);
boolean isFirst = true;
for (Object type : list) {
if (!isFirst) {
Content separator = new StringContent(", ");
dd.addContent(separator);
} else {
isFirst = false;
}
// TODO: should we simply split this method up to avoid instanceof ?
if (type instanceof TypeElement) {
Content link = getLink(
new LinkInfoImpl(configuration, context, (TypeElement)(type)));
dd.addContent(HtmlTree.CODE(link));
} else {
Content link = getLink(
new LinkInfoImpl(configuration, context, ((TypeMirror)type)));
dd.addContent(HtmlTree.CODE(link));
}
}
return dd;
} | [
"private",
"Content",
"getClassLinks",
"(",
"LinkInfoImpl",
".",
"Kind",
"context",
",",
"Collection",
"<",
"?",
">",
"list",
")",
"{",
"Content",
"dd",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"DD",
")",
";",
"boolean",
"isFirst",
"=",
"true",
";",
... | Get links to the given classes.
@param context the id of the context where the link will be printed
@param list the list of classes
@return a content tree for the class list | [
"Get",
"links",
"to",
"the",
"given",
"classes",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriterImpl.java#L635-L657 |
intive-FDV/DynamicJasper | src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java | DynamicReportBuilder.addAutoText | public DynamicReportBuilder addAutoText(byte type, byte position, byte alignment, int width, int width2) {
"""
Adds an autotext to the Report, this are common texts such us "Page X/Y",
"Created on 07/25/2007", etc.
<br>
The parameters are all constants from the
<code>ar.com.fdvs.dj.domain.AutoText</code> class
@param type One of these constants: <br>AUTOTEXT_PAGE_X_OF_Y <br>
AUTOTEXT_PAGE_X_SLASH_Y
<br> AUTOTEXT_PAGE_X, AUTOTEXT_CREATED_ON <br> AUTOTEXT_CUSTOM_MESSAGE
@param position POSITION_HEADER or POSITION_FOOTER
@param alignment <br>ALIGMENT_LEFT <br> ALIGMENT_CENTER <br>
ALIGMENT_RIGHT
@return
"""
HorizontalBandAlignment alignment_ = HorizontalBandAlignment.buildAligment(alignment);
AutoText text = new AutoText(type, position, alignment_);
text.setWidth(width);
text.setWidth2(width2);
addAutoText(text);
return this;
} | java | public DynamicReportBuilder addAutoText(byte type, byte position, byte alignment, int width, int width2) {
HorizontalBandAlignment alignment_ = HorizontalBandAlignment.buildAligment(alignment);
AutoText text = new AutoText(type, position, alignment_);
text.setWidth(width);
text.setWidth2(width2);
addAutoText(text);
return this;
} | [
"public",
"DynamicReportBuilder",
"addAutoText",
"(",
"byte",
"type",
",",
"byte",
"position",
",",
"byte",
"alignment",
",",
"int",
"width",
",",
"int",
"width2",
")",
"{",
"HorizontalBandAlignment",
"alignment_",
"=",
"HorizontalBandAlignment",
".",
"buildAligment... | Adds an autotext to the Report, this are common texts such us "Page X/Y",
"Created on 07/25/2007", etc.
<br>
The parameters are all constants from the
<code>ar.com.fdvs.dj.domain.AutoText</code> class
@param type One of these constants: <br>AUTOTEXT_PAGE_X_OF_Y <br>
AUTOTEXT_PAGE_X_SLASH_Y
<br> AUTOTEXT_PAGE_X, AUTOTEXT_CREATED_ON <br> AUTOTEXT_CUSTOM_MESSAGE
@param position POSITION_HEADER or POSITION_FOOTER
@param alignment <br>ALIGMENT_LEFT <br> ALIGMENT_CENTER <br>
ALIGMENT_RIGHT
@return | [
"Adds",
"an",
"autotext",
"to",
"the",
"Report",
"this",
"are",
"common",
"texts",
"such",
"us",
"Page",
"X",
"/",
"Y",
"Created",
"on",
"07",
"/",
"25",
"/",
"2007",
"etc",
".",
"<br",
">",
"The",
"parameters",
"are",
"all",
"constants",
"from",
"th... | train | https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/domain/builders/DynamicReportBuilder.java#L253-L260 |
infinispan/infinispan | commons/src/main/java/org/infinispan/commons/io/ExposedByteArrayOutputStream.java | ExposedByteArrayOutputStream.getNewBufferSize | public final int getNewBufferSize(int curSize, int minNewSize) {
"""
Gets the number of bytes to which the internal buffer should be resized.
@param curSize the current number of bytes
@param minNewSize the minimum number of bytes required
@return the size to which the internal buffer should be resized
"""
if (curSize <= maxDoublingSize)
return Math.max(curSize << 1, minNewSize);
else
return Math.max(curSize + (curSize >> 2), minNewSize);
} | java | public final int getNewBufferSize(int curSize, int minNewSize) {
if (curSize <= maxDoublingSize)
return Math.max(curSize << 1, minNewSize);
else
return Math.max(curSize + (curSize >> 2), minNewSize);
} | [
"public",
"final",
"int",
"getNewBufferSize",
"(",
"int",
"curSize",
",",
"int",
"minNewSize",
")",
"{",
"if",
"(",
"curSize",
"<=",
"maxDoublingSize",
")",
"return",
"Math",
".",
"max",
"(",
"curSize",
"<<",
"1",
",",
"minNewSize",
")",
";",
"else",
"re... | Gets the number of bytes to which the internal buffer should be resized.
@param curSize the current number of bytes
@param minNewSize the minimum number of bytes required
@return the size to which the internal buffer should be resized | [
"Gets",
"the",
"number",
"of",
"bytes",
"to",
"which",
"the",
"internal",
"buffer",
"should",
"be",
"resized",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/io/ExposedByteArrayOutputStream.java#L107-L112 |
twitter/cloudhopper-commons | ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/DataCoding.java | DataCoding.createReservedGroup | static public DataCoding createReservedGroup(byte dcs) {
"""
Creates a "Reserved" group data coding scheme. NOTE: this method does
not actually check if the byte value is reserved, its assumed the caller
just wants to store the byte value.
@param dcs The data coding scheme byte value
@return A new immutable DataCoding instance representing this data coding scheme
"""
return new DataCoding(dcs, Group.RESERVED, CHAR_ENC_DEFAULT, MESSAGE_CLASS_0, false);
} | java | static public DataCoding createReservedGroup(byte dcs) {
return new DataCoding(dcs, Group.RESERVED, CHAR_ENC_DEFAULT, MESSAGE_CLASS_0, false);
} | [
"static",
"public",
"DataCoding",
"createReservedGroup",
"(",
"byte",
"dcs",
")",
"{",
"return",
"new",
"DataCoding",
"(",
"dcs",
",",
"Group",
".",
"RESERVED",
",",
"CHAR_ENC_DEFAULT",
",",
"MESSAGE_CLASS_0",
",",
"false",
")",
";",
"}"
] | Creates a "Reserved" group data coding scheme. NOTE: this method does
not actually check if the byte value is reserved, its assumed the caller
just wants to store the byte value.
@param dcs The data coding scheme byte value
@return A new immutable DataCoding instance representing this data coding scheme | [
"Creates",
"a",
"Reserved",
"group",
"data",
"coding",
"scheme",
".",
"NOTE",
":",
"this",
"method",
"does",
"not",
"actually",
"check",
"if",
"the",
"byte",
"value",
"is",
"reserved",
"its",
"assumed",
"the",
"caller",
"just",
"wants",
"to",
"store",
"the... | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-gsm/src/main/java/com/cloudhopper/commons/gsm/DataCoding.java#L332-L334 |
alexcojocaru/elasticsearch-maven-plugin | src/main/java/com/github/alexcojocaru/mojo/elasticsearch/v2/util/ProcessUtil.java | ProcessUtil.isWindowsProcessAlive | public static boolean isWindowsProcessAlive(InstanceConfiguration config, String pid) {
"""
Check if the process with the given PID is running or not.
This method only handles processes running on Windows.
@param config - the instance config
@param pid the process ID
@return true if the process is running, false otherwise
"""
CommandLine command = new CommandLine("tasklist")
.addArgument("/FI")
.addArgument("PID eq " + pid, true);
List<String> output = executeScript(config, command, true);
String keyword = String.format(" %s ", pid);
boolean isRunning = output.stream().anyMatch(s -> s.contains(keyword));
return isRunning;
} | java | public static boolean isWindowsProcessAlive(InstanceConfiguration config, String pid)
{
CommandLine command = new CommandLine("tasklist")
.addArgument("/FI")
.addArgument("PID eq " + pid, true);
List<String> output = executeScript(config, command, true);
String keyword = String.format(" %s ", pid);
boolean isRunning = output.stream().anyMatch(s -> s.contains(keyword));
return isRunning;
} | [
"public",
"static",
"boolean",
"isWindowsProcessAlive",
"(",
"InstanceConfiguration",
"config",
",",
"String",
"pid",
")",
"{",
"CommandLine",
"command",
"=",
"new",
"CommandLine",
"(",
"\"tasklist\"",
")",
".",
"addArgument",
"(",
"\"/FI\"",
")",
".",
"addArgumen... | Check if the process with the given PID is running or not.
This method only handles processes running on Windows.
@param config - the instance config
@param pid the process ID
@return true if the process is running, false otherwise | [
"Check",
"if",
"the",
"process",
"with",
"the",
"given",
"PID",
"is",
"running",
"or",
"not",
".",
"This",
"method",
"only",
"handles",
"processes",
"running",
"on",
"Windows",
"."
] | train | https://github.com/alexcojocaru/elasticsearch-maven-plugin/blob/c283053cf99dc6b6d411b58629364b6aae62b7f8/src/main/java/com/github/alexcojocaru/mojo/elasticsearch/v2/util/ProcessUtil.java#L121-L132 |
azkaban/azkaban | azkaban-common/src/main/java/azkaban/jobExecutor/utils/process/AzkabanProcess.java | AzkabanProcess.softKill | public boolean softKill(final long time, final TimeUnit unit)
throws InterruptedException {
"""
Attempt to kill the process, waiting up to the given time for it to die
@param time The amount of time to wait
@param unit The time unit
@return true iff this soft kill kills the process in the given wait time.
"""
checkStarted();
if (this.processId != 0 && isStarted()) {
try {
if (this.isExecuteAsUser) {
final String cmd =
String.format("%s %s %s %d", this.executeAsUserBinary,
this.effectiveUser, KILL_COMMAND, this.processId);
Runtime.getRuntime().exec(cmd);
} else {
final String cmd = String.format("%s %d", KILL_COMMAND, this.processId);
Runtime.getRuntime().exec(cmd);
}
return this.completeLatch.await(time, unit);
} catch (final IOException e) {
this.logger.error("Kill attempt failed.", e);
}
return false;
}
return false;
} | java | public boolean softKill(final long time, final TimeUnit unit)
throws InterruptedException {
checkStarted();
if (this.processId != 0 && isStarted()) {
try {
if (this.isExecuteAsUser) {
final String cmd =
String.format("%s %s %s %d", this.executeAsUserBinary,
this.effectiveUser, KILL_COMMAND, this.processId);
Runtime.getRuntime().exec(cmd);
} else {
final String cmd = String.format("%s %d", KILL_COMMAND, this.processId);
Runtime.getRuntime().exec(cmd);
}
return this.completeLatch.await(time, unit);
} catch (final IOException e) {
this.logger.error("Kill attempt failed.", e);
}
return false;
}
return false;
} | [
"public",
"boolean",
"softKill",
"(",
"final",
"long",
"time",
",",
"final",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
"{",
"checkStarted",
"(",
")",
";",
"if",
"(",
"this",
".",
"processId",
"!=",
"0",
"&&",
"isStarted",
"(",
")",
")",
... | Attempt to kill the process, waiting up to the given time for it to die
@param time The amount of time to wait
@param unit The time unit
@return true iff this soft kill kills the process in the given wait time. | [
"Attempt",
"to",
"kill",
"the",
"process",
"waiting",
"up",
"to",
"the",
"given",
"time",
"for",
"it",
"to",
"die"
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-common/src/main/java/azkaban/jobExecutor/utils/process/AzkabanProcess.java#L172-L193 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/RSAUtils.java | RSAUtils.signMessageWithPrivateKey | public static byte[] signMessageWithPrivateKey(byte[] keyData, byte[] message)
throws InvalidKeyException, NoSuchAlgorithmException, InvalidKeySpecException,
SignatureException {
"""
Sign a message with RSA private key, using {@link #DEFAULT_SIGNATURE_ALGORITHM}.
@param keyData
RSA private key data (value of {@link RSAPrivateKey#getEncoded()})
@param message
@return
@throws InvalidKeyException
@throws NoSuchAlgorithmException
@throws InvalidKeySpecException
@throws SignatureException
"""
return signMessageWithPrivateKey(keyData, message, DEFAULT_SIGNATURE_ALGORITHM);
} | java | public static byte[] signMessageWithPrivateKey(byte[] keyData, byte[] message)
throws InvalidKeyException, NoSuchAlgorithmException, InvalidKeySpecException,
SignatureException {
return signMessageWithPrivateKey(keyData, message, DEFAULT_SIGNATURE_ALGORITHM);
} | [
"public",
"static",
"byte",
"[",
"]",
"signMessageWithPrivateKey",
"(",
"byte",
"[",
"]",
"keyData",
",",
"byte",
"[",
"]",
"message",
")",
"throws",
"InvalidKeyException",
",",
"NoSuchAlgorithmException",
",",
"InvalidKeySpecException",
",",
"SignatureException",
"... | Sign a message with RSA private key, using {@link #DEFAULT_SIGNATURE_ALGORITHM}.
@param keyData
RSA private key data (value of {@link RSAPrivateKey#getEncoded()})
@param message
@return
@throws InvalidKeyException
@throws NoSuchAlgorithmException
@throws InvalidKeySpecException
@throws SignatureException | [
"Sign",
"a",
"message",
"with",
"RSA",
"private",
"key",
"using",
"{",
"@link",
"#DEFAULT_SIGNATURE_ALGORITHM",
"}",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/RSAUtils.java#L222-L226 |
amlinv/amq-monitor | amq-monitor-web-impl/src/main/java/com/amlinv/activemq/stats/QueueStatisticsCollection.java | QueueStatisticsCollection.updateRates | protected void updateRates (QueueStatMeasurements rateMeasurements, long dequeueCountDelta, long enqueueCountDelta) {
"""
Update message rates given the change in dequeue and enqueue counts for one broker queue.
@param rateMeasurements measurements for one broker queue.
@param dequeueCountDelta change in the dequeue count since the last measurement for the same broker queue.
@param enqueueCountDelta change in the enqueue count since the last measurement for the same broker queue.
"""
double oldDequeueRateOneMinute = rateMeasurements.messageRates.getOneMinuteAverageDequeueRate();
double oldDequeueRateOneHour = rateMeasurements.messageRates.getOneHourAverageDequeueRate();
double oldDequeueRateOneDay = rateMeasurements.messageRates.getOneDayAverageDequeueRate();
double oldEnqueueRateOneMinute = rateMeasurements.messageRates.getOneMinuteAverageEnqueueRate();
double oldEnqueueRateOneHour = rateMeasurements.messageRates.getOneHourAverageEnqueueRate();
double oldEnqueueRateOneDay = rateMeasurements.messageRates.getOneDayAverageEnqueueRate();
//
// Protect against negative changes in Enqueue and Dequeue counts - these metrics are designed to only ever
// increase, but can reset in cases such as restarting a broker and manually resetting the statistics through
// JMX controls.
//
if ( dequeueCountDelta < 0 ) {
this.log.debug("detected negative change in dequeue count; ignoring: queue={}; delta={}", this.queueName,
dequeueCountDelta);
dequeueCountDelta = 0;
}
if ( enqueueCountDelta < 0 ) {
this.log.debug("detected negative change in enqueue count; ignoring: queue={}; delta={}", this.queueName,
enqueueCountDelta);
enqueueCountDelta = 0;
}
//
// Update the rates and add in the changes.
//
rateMeasurements.messageRates.onTimestampSample(statsClock.getStatsStopWatchTime(), dequeueCountDelta, enqueueCountDelta);
aggregateDequeueRateOneMinute -= oldDequeueRateOneMinute;
aggregateDequeueRateOneMinute += rateMeasurements.messageRates.getOneMinuteAverageDequeueRate();
aggregateDequeueRateOneHour -= oldDequeueRateOneHour;
aggregateDequeueRateOneHour += rateMeasurements.messageRates.getOneHourAverageDequeueRate();
aggregateDequeueRateOneDay -= oldDequeueRateOneDay;
aggregateDequeueRateOneDay += rateMeasurements.messageRates.getOneDayAverageDequeueRate();
aggregateEnqueueRateOneMinute -= oldEnqueueRateOneMinute;
aggregateEnqueueRateOneMinute += rateMeasurements.messageRates.getOneMinuteAverageEnqueueRate();
aggregateEnqueueRateOneHour -= oldEnqueueRateOneHour;
aggregateEnqueueRateOneHour += rateMeasurements.messageRates.getOneHourAverageEnqueueRate();
aggregateEnqueueRateOneDay -= oldEnqueueRateOneDay;
aggregateEnqueueRateOneDay += rateMeasurements.messageRates.getOneDayAverageEnqueueRate();
} | java | protected void updateRates (QueueStatMeasurements rateMeasurements, long dequeueCountDelta, long enqueueCountDelta) {
double oldDequeueRateOneMinute = rateMeasurements.messageRates.getOneMinuteAverageDequeueRate();
double oldDequeueRateOneHour = rateMeasurements.messageRates.getOneHourAverageDequeueRate();
double oldDequeueRateOneDay = rateMeasurements.messageRates.getOneDayAverageDequeueRate();
double oldEnqueueRateOneMinute = rateMeasurements.messageRates.getOneMinuteAverageEnqueueRate();
double oldEnqueueRateOneHour = rateMeasurements.messageRates.getOneHourAverageEnqueueRate();
double oldEnqueueRateOneDay = rateMeasurements.messageRates.getOneDayAverageEnqueueRate();
//
// Protect against negative changes in Enqueue and Dequeue counts - these metrics are designed to only ever
// increase, but can reset in cases such as restarting a broker and manually resetting the statistics through
// JMX controls.
//
if ( dequeueCountDelta < 0 ) {
this.log.debug("detected negative change in dequeue count; ignoring: queue={}; delta={}", this.queueName,
dequeueCountDelta);
dequeueCountDelta = 0;
}
if ( enqueueCountDelta < 0 ) {
this.log.debug("detected negative change in enqueue count; ignoring: queue={}; delta={}", this.queueName,
enqueueCountDelta);
enqueueCountDelta = 0;
}
//
// Update the rates and add in the changes.
//
rateMeasurements.messageRates.onTimestampSample(statsClock.getStatsStopWatchTime(), dequeueCountDelta, enqueueCountDelta);
aggregateDequeueRateOneMinute -= oldDequeueRateOneMinute;
aggregateDequeueRateOneMinute += rateMeasurements.messageRates.getOneMinuteAverageDequeueRate();
aggregateDequeueRateOneHour -= oldDequeueRateOneHour;
aggregateDequeueRateOneHour += rateMeasurements.messageRates.getOneHourAverageDequeueRate();
aggregateDequeueRateOneDay -= oldDequeueRateOneDay;
aggregateDequeueRateOneDay += rateMeasurements.messageRates.getOneDayAverageDequeueRate();
aggregateEnqueueRateOneMinute -= oldEnqueueRateOneMinute;
aggregateEnqueueRateOneMinute += rateMeasurements.messageRates.getOneMinuteAverageEnqueueRate();
aggregateEnqueueRateOneHour -= oldEnqueueRateOneHour;
aggregateEnqueueRateOneHour += rateMeasurements.messageRates.getOneHourAverageEnqueueRate();
aggregateEnqueueRateOneDay -= oldEnqueueRateOneDay;
aggregateEnqueueRateOneDay += rateMeasurements.messageRates.getOneDayAverageEnqueueRate();
} | [
"protected",
"void",
"updateRates",
"(",
"QueueStatMeasurements",
"rateMeasurements",
",",
"long",
"dequeueCountDelta",
",",
"long",
"enqueueCountDelta",
")",
"{",
"double",
"oldDequeueRateOneMinute",
"=",
"rateMeasurements",
".",
"messageRates",
".",
"getOneMinuteAverageDe... | Update message rates given the change in dequeue and enqueue counts for one broker queue.
@param rateMeasurements measurements for one broker queue.
@param dequeueCountDelta change in the dequeue count since the last measurement for the same broker queue.
@param enqueueCountDelta change in the enqueue count since the last measurement for the same broker queue. | [
"Update",
"message",
"rates",
"given",
"the",
"change",
"in",
"dequeue",
"and",
"enqueue",
"counts",
"for",
"one",
"broker",
"queue",
"."
] | train | https://github.com/amlinv/amq-monitor/blob/0ae0156f56d7d3edf98bca9c30b153b770fe5bfa/amq-monitor-web-impl/src/main/java/com/amlinv/activemq/stats/QueueStatisticsCollection.java#L158-L208 |
actframework/actframework | src/main/java/act/event/EventBus.java | EventBus.emitAsync | public EventBus emitAsync(String event, Object... args) {
"""
Emit a string event with parameters and force all listeners to be called asynchronously.
@param event
the target event
@param args
the arguments passed in
@see #emit(String, Object...)
"""
return _emitWithOnceBus(eventContextAsync(event, args));
} | java | public EventBus emitAsync(String event, Object... args) {
return _emitWithOnceBus(eventContextAsync(event, args));
} | [
"public",
"EventBus",
"emitAsync",
"(",
"String",
"event",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"_emitWithOnceBus",
"(",
"eventContextAsync",
"(",
"event",
",",
"args",
")",
")",
";",
"}"
] | Emit a string event with parameters and force all listeners to be called asynchronously.
@param event
the target event
@param args
the arguments passed in
@see #emit(String, Object...) | [
"Emit",
"a",
"string",
"event",
"with",
"parameters",
"and",
"force",
"all",
"listeners",
"to",
"be",
"called",
"asynchronously",
"."
] | train | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/event/EventBus.java#L1022-L1024 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/blas/impl/BaseLevel2.java | BaseLevel2.ger | @Override
public void ger(char order, double alpha, INDArray X, INDArray Y, INDArray A) {
"""
performs a rank-1 update of a general m-by-n matrix a:
a := alpha*x*y' + a.
@param order
@param alpha
@param X
@param Y
@param A
"""
if (Nd4j.getExecutioner().getProfilingMode() == OpExecutioner.ProfilingMode.ALL)
OpProfiler.getInstance().processBlasCall(false, A, X, Y);
// FIXME: int cast
if (X.data().dataType() == DataType.DOUBLE) {
DefaultOpExecutioner.validateDataType(DataType.DOUBLE, A, X, Y);
dger(order, (int) A.rows(), (int) A.columns(), alpha, X, X.stride(-1), Y, Y.stride(-1), A, (int) A.size(0));
} else {
DefaultOpExecutioner.validateDataType(DataType.FLOAT, A, X, Y);
sger(order, (int) A.rows(), (int) A.columns(), (float) alpha, X, X.stride(-1), Y, Y.stride(-1), A, (int) A.size(0));
}
OpExecutionerUtil.checkForAny(A);
} | java | @Override
public void ger(char order, double alpha, INDArray X, INDArray Y, INDArray A) {
if (Nd4j.getExecutioner().getProfilingMode() == OpExecutioner.ProfilingMode.ALL)
OpProfiler.getInstance().processBlasCall(false, A, X, Y);
// FIXME: int cast
if (X.data().dataType() == DataType.DOUBLE) {
DefaultOpExecutioner.validateDataType(DataType.DOUBLE, A, X, Y);
dger(order, (int) A.rows(), (int) A.columns(), alpha, X, X.stride(-1), Y, Y.stride(-1), A, (int) A.size(0));
} else {
DefaultOpExecutioner.validateDataType(DataType.FLOAT, A, X, Y);
sger(order, (int) A.rows(), (int) A.columns(), (float) alpha, X, X.stride(-1), Y, Y.stride(-1), A, (int) A.size(0));
}
OpExecutionerUtil.checkForAny(A);
} | [
"@",
"Override",
"public",
"void",
"ger",
"(",
"char",
"order",
",",
"double",
"alpha",
",",
"INDArray",
"X",
",",
"INDArray",
"Y",
",",
"INDArray",
"A",
")",
"{",
"if",
"(",
"Nd4j",
".",
"getExecutioner",
"(",
")",
".",
"getProfilingMode",
"(",
")",
... | performs a rank-1 update of a general m-by-n matrix a:
a := alpha*x*y' + a.
@param order
@param alpha
@param X
@param Y
@param A | [
"performs",
"a",
"rank",
"-",
"1",
"update",
"of",
"a",
"general",
"m",
"-",
"by",
"-",
"n",
"matrix",
"a",
":",
"a",
":",
"=",
"alpha",
"*",
"x",
"*",
"y",
"+",
"a",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/api/blas/impl/BaseLevel2.java#L145-L161 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.project_serviceName_storage_containerId_PUT | public void project_serviceName_storage_containerId_PUT(String serviceName, String containerId, OvhTypeEnum containerType) throws IOException {
"""
Update your storage container
REST: PUT /cloud/project/{serviceName}/storage/{containerId}
@param containerId [required] Container id
@param containerType [required] Container type
@param serviceName [required] Service name
"""
String qPath = "/cloud/project/{serviceName}/storage/{containerId}";
StringBuilder sb = path(qPath, serviceName, containerId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "containerType", containerType);
exec(qPath, "PUT", sb.toString(), o);
} | java | public void project_serviceName_storage_containerId_PUT(String serviceName, String containerId, OvhTypeEnum containerType) throws IOException {
String qPath = "/cloud/project/{serviceName}/storage/{containerId}";
StringBuilder sb = path(qPath, serviceName, containerId);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "containerType", containerType);
exec(qPath, "PUT", sb.toString(), o);
} | [
"public",
"void",
"project_serviceName_storage_containerId_PUT",
"(",
"String",
"serviceName",
",",
"String",
"containerId",
",",
"OvhTypeEnum",
"containerType",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/project/{serviceName}/storage/{containerId}\"",... | Update your storage container
REST: PUT /cloud/project/{serviceName}/storage/{containerId}
@param containerId [required] Container id
@param containerType [required] Container type
@param serviceName [required] Service name | [
"Update",
"your",
"storage",
"container"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L634-L640 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyPairGenerator.java | KeyPairGenerator.getInstance | public static KeyPairGenerator getInstance(String algorithm)
throws NoSuchAlgorithmException {
"""
Returns a KeyPairGenerator object that generates public/private
key pairs for the specified algorithm.
<p> This method traverses the list of registered security Providers,
starting with the most preferred Provider.
A new KeyPairGenerator object encapsulating the
KeyPairGeneratorSpi implementation from the first
Provider that supports the specified algorithm is returned.
<p> Note that the list of registered providers may be retrieved via
the {@link Security#getProviders() Security.getProviders()} method.
@param algorithm the standard string name of the algorithm.
See the KeyPairGenerator section in the <a href=
"{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#KeyPairGenerator">
Java Cryptography Architecture Standard Algorithm Name Documentation</a>
for information about standard algorithm names.
@return the new KeyPairGenerator object.
@exception NoSuchAlgorithmException if no Provider supports a
KeyPairGeneratorSpi implementation for the
specified algorithm.
@see Provider
"""
List<Service> list =
GetInstance.getServices("KeyPairGenerator", algorithm);
Iterator<Service> t = list.iterator();
if (t.hasNext() == false) {
throw new NoSuchAlgorithmException
(algorithm + " KeyPairGenerator not available");
}
// find a working Spi or KeyPairGenerator subclass
NoSuchAlgorithmException failure = null;
do {
Service s = t.next();
try {
Instance instance =
GetInstance.getInstance(s, KeyPairGeneratorSpi.class);
if (instance.impl instanceof KeyPairGenerator) {
return getInstance(instance, algorithm);
} else {
return new Delegate(instance, t, algorithm);
}
} catch (NoSuchAlgorithmException e) {
if (failure == null) {
failure = e;
}
}
} while (t.hasNext());
throw failure;
} | java | public static KeyPairGenerator getInstance(String algorithm)
throws NoSuchAlgorithmException {
List<Service> list =
GetInstance.getServices("KeyPairGenerator", algorithm);
Iterator<Service> t = list.iterator();
if (t.hasNext() == false) {
throw new NoSuchAlgorithmException
(algorithm + " KeyPairGenerator not available");
}
// find a working Spi or KeyPairGenerator subclass
NoSuchAlgorithmException failure = null;
do {
Service s = t.next();
try {
Instance instance =
GetInstance.getInstance(s, KeyPairGeneratorSpi.class);
if (instance.impl instanceof KeyPairGenerator) {
return getInstance(instance, algorithm);
} else {
return new Delegate(instance, t, algorithm);
}
} catch (NoSuchAlgorithmException e) {
if (failure == null) {
failure = e;
}
}
} while (t.hasNext());
throw failure;
} | [
"public",
"static",
"KeyPairGenerator",
"getInstance",
"(",
"String",
"algorithm",
")",
"throws",
"NoSuchAlgorithmException",
"{",
"List",
"<",
"Service",
">",
"list",
"=",
"GetInstance",
".",
"getServices",
"(",
"\"KeyPairGenerator\"",
",",
"algorithm",
")",
";",
... | Returns a KeyPairGenerator object that generates public/private
key pairs for the specified algorithm.
<p> This method traverses the list of registered security Providers,
starting with the most preferred Provider.
A new KeyPairGenerator object encapsulating the
KeyPairGeneratorSpi implementation from the first
Provider that supports the specified algorithm is returned.
<p> Note that the list of registered providers may be retrieved via
the {@link Security#getProviders() Security.getProviders()} method.
@param algorithm the standard string name of the algorithm.
See the KeyPairGenerator section in the <a href=
"{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#KeyPairGenerator">
Java Cryptography Architecture Standard Algorithm Name Documentation</a>
for information about standard algorithm names.
@return the new KeyPairGenerator object.
@exception NoSuchAlgorithmException if no Provider supports a
KeyPairGeneratorSpi implementation for the
specified algorithm.
@see Provider | [
"Returns",
"a",
"KeyPairGenerator",
"object",
"that",
"generates",
"public",
"/",
"private",
"key",
"pairs",
"for",
"the",
"specified",
"algorithm",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyPairGenerator.java#L240-L268 |
jMetal/jMetal | jmetal-core/src/main/java/org/uma/jmetal/util/SolutionUtils.java | SolutionUtils.getBestSolution | public static <S extends Solution<?>> S getBestSolution(S solution1, S solution2, Comparator<S> comparator) {
"""
Return the best solution between those passed as arguments. If they are equal or incomparable
one of them is chosen randomly.
@return The best solution
"""
return getBestSolution(solution1, solution2, comparator, () -> JMetalRandom.getInstance().nextDouble());
} | java | public static <S extends Solution<?>> S getBestSolution(S solution1, S solution2, Comparator<S> comparator) {
return getBestSolution(solution1, solution2, comparator, () -> JMetalRandom.getInstance().nextDouble());
} | [
"public",
"static",
"<",
"S",
"extends",
"Solution",
"<",
"?",
">",
">",
"S",
"getBestSolution",
"(",
"S",
"solution1",
",",
"S",
"solution2",
",",
"Comparator",
"<",
"S",
">",
"comparator",
")",
"{",
"return",
"getBestSolution",
"(",
"solution1",
",",
"... | Return the best solution between those passed as arguments. If they are equal or incomparable
one of them is chosen randomly.
@return The best solution | [
"Return",
"the",
"best",
"solution",
"between",
"those",
"passed",
"as",
"arguments",
".",
"If",
"they",
"are",
"equal",
"or",
"incomparable",
"one",
"of",
"them",
"is",
"chosen",
"randomly",
"."
] | train | https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-core/src/main/java/org/uma/jmetal/util/SolutionUtils.java#L23-L25 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/GPXRead.java | GPXRead.readGPX | public static void readGPX(Connection connection, String fileName, String tableReference) throws IOException, SQLException {
"""
Copy data from GPX File into a new table in specified connection.
@param connection Active connection
@param tableReference [[catalog.]schema.]table reference
@param fileName File path of the SHP file
@throws java.io.IOException
@throws java.sql.SQLException
"""
readGPX(connection, fileName, tableReference, false);
} | java | public static void readGPX(Connection connection, String fileName, String tableReference) throws IOException, SQLException {
readGPX(connection, fileName, tableReference, false);
} | [
"public",
"static",
"void",
"readGPX",
"(",
"Connection",
"connection",
",",
"String",
"fileName",
",",
"String",
"tableReference",
")",
"throws",
"IOException",
",",
"SQLException",
"{",
"readGPX",
"(",
"connection",
",",
"fileName",
",",
"tableReference",
",",
... | Copy data from GPX File into a new table in specified connection.
@param connection Active connection
@param tableReference [[catalog.]schema.]table reference
@param fileName File path of the SHP file
@throws java.io.IOException
@throws java.sql.SQLException | [
"Copy",
"data",
"from",
"GPX",
"File",
"into",
"a",
"new",
"table",
"in",
"specified",
"connection",
"."
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/gpx/GPXRead.java#L81-L83 |
sebastiangraf/jSCSI | bundles/initiator/src/main/java/org/jscsi/initiator/connection/Session.java | Session.addNewConnection | protected final short addNewConnection () throws Exception {
"""
Adds a new connection to this session with the next free connection ID (if the maximum number is not reached).
@return The connection ID of the newly created connection.
@throws Exception if any error occurs.
"""
if (connections.size() < maxConnections) {
final Connection connection = factory.getConnection(this, configuration, inetSocketAddress, nextFreeConnectionID);
connection.nextState(new LoginRequestState(connection, LoginStage.FULL_FEATURE_PHASE));
// login phase successful, so we can add a new connection
connections.add(connection);
// only needed on the leading login connection
if (connections.size() == 1) {
phase.getCapacity(this, capacityInformations);
if (connection.getSettingAsInt(OperationalTextKey.MAX_CONNECTIONS) > 1) {
phase.login(this);
}
}
return nextFreeConnectionID++;
} else {
LOGGER.warn("Unused new connection -> ignored!");
return nextFreeConnectionID;
}
} | java | protected final short addNewConnection () throws Exception {
if (connections.size() < maxConnections) {
final Connection connection = factory.getConnection(this, configuration, inetSocketAddress, nextFreeConnectionID);
connection.nextState(new LoginRequestState(connection, LoginStage.FULL_FEATURE_PHASE));
// login phase successful, so we can add a new connection
connections.add(connection);
// only needed on the leading login connection
if (connections.size() == 1) {
phase.getCapacity(this, capacityInformations);
if (connection.getSettingAsInt(OperationalTextKey.MAX_CONNECTIONS) > 1) {
phase.login(this);
}
}
return nextFreeConnectionID++;
} else {
LOGGER.warn("Unused new connection -> ignored!");
return nextFreeConnectionID;
}
} | [
"protected",
"final",
"short",
"addNewConnection",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"connections",
".",
"size",
"(",
")",
"<",
"maxConnections",
")",
"{",
"final",
"Connection",
"connection",
"=",
"factory",
".",
"getConnection",
"(",
"this",
... | Adds a new connection to this session with the next free connection ID (if the maximum number is not reached).
@return The connection ID of the newly created connection.
@throws Exception if any error occurs. | [
"Adds",
"a",
"new",
"connection",
"to",
"this",
"session",
"with",
"the",
"next",
"free",
"connection",
"ID",
"(",
"if",
"the",
"maximum",
"number",
"is",
"not",
"reached",
")",
"."
] | train | https://github.com/sebastiangraf/jSCSI/blob/6169bfe73f0b15de7d6485453555389e782ae888/bundles/initiator/src/main/java/org/jscsi/initiator/connection/Session.java#L307-L331 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java | AbstractPacketOutputStream.writeBytes | public void writeBytes(byte value, int len) throws IOException {
"""
Write byte value, len times into buffer. flush buffer if too small.
@param value byte value
@param len number of time to write value.
@throws IOException if socket error occur.
"""
if (len > buf.length - pos) {
//not enough space remaining
byte[] arr = new byte[len];
Arrays.fill(arr, value);
write(arr, 0, len);
return;
}
for (int i = pos; i < pos + len; i++) {
buf[i] = value;
}
pos += len;
} | java | public void writeBytes(byte value, int len) throws IOException {
if (len > buf.length - pos) {
//not enough space remaining
byte[] arr = new byte[len];
Arrays.fill(arr, value);
write(arr, 0, len);
return;
}
for (int i = pos; i < pos + len; i++) {
buf[i] = value;
}
pos += len;
} | [
"public",
"void",
"writeBytes",
"(",
"byte",
"value",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"if",
"(",
"len",
">",
"buf",
".",
"length",
"-",
"pos",
")",
"{",
"//not enough space remaining",
"byte",
"[",
"]",
"arr",
"=",
"new",
"byte",
... | Write byte value, len times into buffer. flush buffer if too small.
@param value byte value
@param len number of time to write value.
@throws IOException if socket error occur. | [
"Write",
"byte",
"value",
"len",
"times",
"into",
"buffer",
".",
"flush",
"buffer",
"if",
"too",
"small",
"."
] | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/io/output/AbstractPacketOutputStream.java#L313-L326 |
contentful/contentful.java | src/main/java/com/contentful/java/cda/FetchQuery.java | FetchQuery.one | @SuppressWarnings("unchecked")
public <C extends CDACallback<T>> C one(String id, C callback) {
"""
Async fetch resource matching the given {@code id}.
@param id resource id.
@param callback callback.
@param <C> callback type.
@return the given {@code callback} instance.
"""
return (C) Callbacks.subscribeAsync(baseQuery().one(id), callback, client);
} | java | @SuppressWarnings("unchecked")
public <C extends CDACallback<T>> C one(String id, C callback) {
return (C) Callbacks.subscribeAsync(baseQuery().one(id), callback, client);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"C",
"extends",
"CDACallback",
"<",
"T",
">",
">",
"C",
"one",
"(",
"String",
"id",
",",
"C",
"callback",
")",
"{",
"return",
"(",
"C",
")",
"Callbacks",
".",
"subscribeAsync",
"(",
"ba... | Async fetch resource matching the given {@code id}.
@param id resource id.
@param callback callback.
@param <C> callback type.
@return the given {@code callback} instance. | [
"Async",
"fetch",
"resource",
"matching",
"the",
"given",
"{",
"@code",
"id",
"}",
"."
] | train | https://github.com/contentful/contentful.java/blob/6ecc2ace454c674b218b99489dc50697b1dbffcb/src/main/java/com/contentful/java/cda/FetchQuery.java#L40-L43 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.