repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
aws/aws-sdk-java | aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/InventoryItem.java | InventoryItem.setContent | public void setContent(java.util.Collection<java.util.Map<String, String>> content) {
if (content == null) {
this.content = null;
return;
}
this.content = new com.amazonaws.internal.SdkInternalList<java.util.Map<String, String>>(content);
} | java | public void setContent(java.util.Collection<java.util.Map<String, String>> content) {
if (content == null) {
this.content = null;
return;
}
this.content = new com.amazonaws.internal.SdkInternalList<java.util.Map<String, String>>(content);
} | [
"public",
"void",
"setContent",
"(",
"java",
".",
"util",
".",
"Collection",
"<",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
">",
"content",
")",
"{",
"if",
"(",
"content",
"==",
"null",
")",
"{",
"this",
".",
"content",
"=... | <p>
The inventory data of the inventory type.
</p>
@param content
The inventory data of the inventory type. | [
"<p",
">",
"The",
"inventory",
"data",
"of",
"the",
"inventory",
"type",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ssm/src/main/java/com/amazonaws/services/simplesystemsmanagement/model/InventoryItem.java#L282-L289 |
apache/flink | flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java | MemorySegment.putShortBigEndian | public final void putShortBigEndian(int index, short value) {
if (LITTLE_ENDIAN) {
putShort(index, Short.reverseBytes(value));
} else {
putShort(index, value);
}
} | java | public final void putShortBigEndian(int index, short value) {
if (LITTLE_ENDIAN) {
putShort(index, Short.reverseBytes(value));
} else {
putShort(index, value);
}
} | [
"public",
"final",
"void",
"putShortBigEndian",
"(",
"int",
"index",
",",
"short",
"value",
")",
"{",
"if",
"(",
"LITTLE_ENDIAN",
")",
"{",
"putShort",
"(",
"index",
",",
"Short",
".",
"reverseBytes",
"(",
"value",
")",
")",
";",
"}",
"else",
"{",
"put... | Writes the given short integer value (16 bit, 2 bytes) to the given position in big-endian
byte order. This method's speed depends on the system's native byte order, and it
is possibly slower than {@link #putShort(int, short)}. For most cases (such as
transient storage in memory or serialization for I/O and network),
it suffices to know that the byte order in which the value is written is the same as the
one in which it is read, and {@link #putShort(int, short)} is the preferable choice.
@param index The position at which the value will be written.
@param value The short value to be written.
@throws IndexOutOfBoundsException Thrown, if the index is negative, or larger than the segment size minus 2. | [
"Writes",
"the",
"given",
"short",
"integer",
"value",
"(",
"16",
"bit",
"2",
"bytes",
")",
"to",
"the",
"given",
"position",
"in",
"big",
"-",
"endian",
"byte",
"order",
".",
"This",
"method",
"s",
"speed",
"depends",
"on",
"the",
"system",
"s",
"nati... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/core/memory/MemorySegment.java#L668-L674 |
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.updateExplicitListItem | public OperationStatus updateExplicitListItem(UUID appId, String versionId, UUID entityId, long itemId, UpdateExplicitListItemOptionalParameter updateExplicitListItemOptionalParameter) {
return updateExplicitListItemWithServiceResponseAsync(appId, versionId, entityId, itemId, updateExplicitListItemOptionalParameter).toBlocking().single().body();
} | java | public OperationStatus updateExplicitListItem(UUID appId, String versionId, UUID entityId, long itemId, UpdateExplicitListItemOptionalParameter updateExplicitListItemOptionalParameter) {
return updateExplicitListItemWithServiceResponseAsync(appId, versionId, entityId, itemId, updateExplicitListItemOptionalParameter).toBlocking().single().body();
} | [
"public",
"OperationStatus",
"updateExplicitListItem",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
",",
"long",
"itemId",
",",
"UpdateExplicitListItemOptionalParameter",
"updateExplicitListItemOptionalParameter",
")",
"{",
"return",
"updateExp... | Updates an explicit list item for a Pattern.Any entity.
@param appId The application ID.
@param versionId The version ID.
@param entityId The Pattern.Any entity extractor ID.
@param itemId The explicit list item ID.
@param updateExplicitListItemOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the OperationStatus object if successful. | [
"Updates",
"an",
"explicit",
"list",
"item",
"for",
"a",
"Pattern",
".",
"Any",
"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#L14063-L14065 |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java | SqlExecutor.callQuery | public static ResultSet callQuery(Connection conn, String sql, Object... params) throws SQLException {
CallableStatement proc = null;
try {
proc = StatementUtil.prepareCall(conn, sql, params);
return proc.executeQuery();
} finally {
DbUtil.close(proc);
}
} | java | public static ResultSet callQuery(Connection conn, String sql, Object... params) throws SQLException {
CallableStatement proc = null;
try {
proc = StatementUtil.prepareCall(conn, sql, params);
return proc.executeQuery();
} finally {
DbUtil.close(proc);
}
} | [
"public",
"static",
"ResultSet",
"callQuery",
"(",
"Connection",
"conn",
",",
"String",
"sql",
",",
"Object",
"...",
"params",
")",
"throws",
"SQLException",
"{",
"CallableStatement",
"proc",
"=",
"null",
";",
"try",
"{",
"proc",
"=",
"StatementUtil",
".",
"... | 执行调用存储过程<br>
此方法不会关闭Connection
@param conn 数据库连接对象
@param sql SQL
@param params 参数
@return ResultSet
@throws SQLException SQL执行异常
@since 4.1.4 | [
"执行调用存储过程<br",
">",
"此方法不会关闭Connection"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java#L94-L102 |
diirt/util | src/main/java/org/epics/util/array/ListNumbers.java | ListNumbers.linearListFromRange | public static ListNumber linearListFromRange(final double minValue, final double maxValue, final int size) {
if (size <= 0) {
throw new IllegalArgumentException("Size must be positive (was " + size + " )");
}
return new LinearListDoubleFromRange(size, minValue, maxValue);
} | java | public static ListNumber linearListFromRange(final double minValue, final double maxValue, final int size) {
if (size <= 0) {
throw new IllegalArgumentException("Size must be positive (was " + size + " )");
}
return new LinearListDoubleFromRange(size, minValue, maxValue);
} | [
"public",
"static",
"ListNumber",
"linearListFromRange",
"(",
"final",
"double",
"minValue",
",",
"final",
"double",
"maxValue",
",",
"final",
"int",
"size",
")",
"{",
"if",
"(",
"size",
"<=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"... | Creates a list of equally spaced values given the range and the number of
elements.
<p>
Note that, due to rounding errors in double precision, the difference
between the elements may not be exactly the same.
@param minValue the first value in the list
@param maxValue the last value in the list
@param size the size of the list
@return a new list | [
"Creates",
"a",
"list",
"of",
"equally",
"spaced",
"values",
"given",
"the",
"range",
"and",
"the",
"number",
"of",
"elements",
".",
"<p",
">",
"Note",
"that",
"due",
"to",
"rounding",
"errors",
"in",
"double",
"precision",
"the",
"difference",
"between",
... | train | https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/array/ListNumbers.java#L151-L156 |
JOML-CI/JOML | src/org/joml/Matrix4x3f.java | Matrix4x3f.rotateXYZ | public Matrix4x3f rotateXYZ(Vector3f angles) {
return rotateXYZ(angles.x, angles.y, angles.z);
} | java | public Matrix4x3f rotateXYZ(Vector3f angles) {
return rotateXYZ(angles.x, angles.y, angles.z);
} | [
"public",
"Matrix4x3f",
"rotateXYZ",
"(",
"Vector3f",
"angles",
")",
"{",
"return",
"rotateXYZ",
"(",
"angles",
".",
"x",
",",
"angles",
".",
"y",
",",
"angles",
".",
"z",
")",
";",
"}"
] | Apply rotation of <code>angles.x</code> radians about the X axis, followed by a rotation of <code>angles.y</code> radians about the Y axis and
followed by a rotation of <code>angles.z</code> radians about the Z axis.
<p>
When used with a right-handed coordinate system, the produced rotation will rotate a vector
counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin.
When used with a left-handed coordinate system, the rotation is clockwise.
<p>
If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix,
then the new matrix will be <code>M * R</code>. So when transforming a
vector <code>v</code> with the new matrix by using <code>M * R * v</code>, the
rotation will be applied first!
<p>
This method is equivalent to calling: <code>rotateX(angles.x).rotateY(angles.y).rotateZ(angles.z)</code>
@param angles
the Euler angles
@return this | [
"Apply",
"rotation",
"of",
"<code",
">",
"angles",
".",
"x<",
"/",
"code",
">",
"radians",
"about",
"the",
"X",
"axis",
"followed",
"by",
"a",
"rotation",
"of",
"<code",
">",
"angles",
".",
"y<",
"/",
"code",
">",
"radians",
"about",
"the",
"Y",
"axi... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L3521-L3523 |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/GeometryIndexService.java | GeometryIndexService.getGeometryType | public String getGeometryType(Geometry geometry, GeometryIndex index) throws GeometryIndexNotFoundException {
if (index != null && index.getType() == GeometryIndexType.TYPE_GEOMETRY) {
if (geometry.getGeometries() != null && geometry.getGeometries().length > index.getValue()) {
return getGeometryType(geometry.getGeometries()[index.getValue()], index.getChild());
} else {
throw new GeometryIndexNotFoundException("Can't find the geometry referred to in the given index.");
}
}
return geometry.getGeometryType();
} | java | public String getGeometryType(Geometry geometry, GeometryIndex index) throws GeometryIndexNotFoundException {
if (index != null && index.getType() == GeometryIndexType.TYPE_GEOMETRY) {
if (geometry.getGeometries() != null && geometry.getGeometries().length > index.getValue()) {
return getGeometryType(geometry.getGeometries()[index.getValue()], index.getChild());
} else {
throw new GeometryIndexNotFoundException("Can't find the geometry referred to in the given index.");
}
}
return geometry.getGeometryType();
} | [
"public",
"String",
"getGeometryType",
"(",
"Geometry",
"geometry",
",",
"GeometryIndex",
"index",
")",
"throws",
"GeometryIndexNotFoundException",
"{",
"if",
"(",
"index",
"!=",
"null",
"&&",
"index",
".",
"getType",
"(",
")",
"==",
"GeometryIndexType",
".",
"T... | What is the geometry type of the sub-geometry pointed to by the given index? If the index points to a vertex or
edge, the geometry type at the parent level is returned.
@param geometry
The geometry wherein to search.
@param index
The index pointing to a vertex/edge/sub-geometry. In the case of a vertex/edge, the parent geometry
type is returned. If index is null, the type of the given geometry is returned.
@return The geometry type as defined in the {@link Geometry} class.
@throws GeometryIndexNotFoundException
Thrown in case the index points to a non-existing sub-geometry. | [
"What",
"is",
"the",
"geometry",
"type",
"of",
"the",
"sub",
"-",
"geometry",
"pointed",
"to",
"by",
"the",
"given",
"index?",
"If",
"the",
"index",
"points",
"to",
"a",
"vertex",
"or",
"edge",
"the",
"geometry",
"type",
"at",
"the",
"parent",
"level",
... | train | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/GeometryIndexService.java#L317-L326 |
czyzby/gdx-lml | kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/GdxUtilities.java | GdxUtilities.clearScreen | public static void clearScreen(final float r, final float g, final float b) {
Gdx.gl.glClearColor(r, g, b, 1f);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
} | java | public static void clearScreen(final float r, final float g, final float b) {
Gdx.gl.glClearColor(r, g, b, 1f);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
} | [
"public",
"static",
"void",
"clearScreen",
"(",
"final",
"float",
"r",
",",
"final",
"float",
"g",
",",
"final",
"float",
"b",
")",
"{",
"Gdx",
".",
"gl",
".",
"glClearColor",
"(",
"r",
",",
"g",
",",
"b",
",",
"1f",
")",
";",
"Gdx",
".",
"gl",
... | Clears the screen with the selected color.
@param r red color value.
@param g green color value.
@param b blue color value. | [
"Clears",
"the",
"screen",
"with",
"the",
"selected",
"color",
"."
] | train | https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/GdxUtilities.java#L32-L35 |
hibernate/hibernate-ogm | core/src/main/java/org/hibernate/ogm/datastore/document/impl/DotPatternMapHelpers.java | DotPatternMapHelpers.flatten | public static String flatten(String left, String right) {
return left == null || left.isEmpty() ? right : left + "." + right;
} | java | public static String flatten(String left, String right) {
return left == null || left.isEmpty() ? right : left + "." + right;
} | [
"public",
"static",
"String",
"flatten",
"(",
"String",
"left",
",",
"String",
"right",
")",
"{",
"return",
"left",
"==",
"null",
"||",
"left",
".",
"isEmpty",
"(",
")",
"?",
"right",
":",
"left",
"+",
"\".\"",
"+",
"right",
";",
"}"
] | Links the two field names into a single left.right field name.
If the left field is empty, right is returned
@param left one field name
@param right the other field name
@return left.right or right if left is an empty string | [
"Links",
"the",
"two",
"field",
"names",
"into",
"a",
"single",
"left",
".",
"right",
"field",
"name",
".",
"If",
"the",
"left",
"field",
"is",
"empty",
"right",
"is",
"returned"
] | train | https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/core/src/main/java/org/hibernate/ogm/datastore/document/impl/DotPatternMapHelpers.java#L100-L102 |
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryBySecondaryCustomIndex | public Iterable<DContact> queryBySecondaryCustomIndex(Object parent, java.lang.String secondaryCustomIndex) {
return queryByField(parent, DContactMapper.Field.SECONDARYCUSTOMINDEX.getFieldName(), secondaryCustomIndex);
} | java | public Iterable<DContact> queryBySecondaryCustomIndex(Object parent, java.lang.String secondaryCustomIndex) {
return queryByField(parent, DContactMapper.Field.SECONDARYCUSTOMINDEX.getFieldName(), secondaryCustomIndex);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryBySecondaryCustomIndex",
"(",
"Object",
"parent",
",",
"java",
".",
"lang",
".",
"String",
"secondaryCustomIndex",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"SEC... | query-by method for field secondaryCustomIndex
@param secondaryCustomIndex the specified attribute
@return an Iterable of DContacts for the specified secondaryCustomIndex | [
"query",
"-",
"by",
"method",
"for",
"field",
"secondaryCustomIndex"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L259-L261 |
cycorp/api-suite | core-api/src/main/java/com/cyc/query/exception/QueryRuntimeException.java | QueryRuntimeException.fromThrowable | public static QueryRuntimeException fromThrowable(String message, Throwable t) {
return (t instanceof QueryRuntimeException && Objects.equals(message, t.getMessage()))
? (QueryRuntimeException) t
: new QueryRuntimeException(message, t);
} | java | public static QueryRuntimeException fromThrowable(String message, Throwable t) {
return (t instanceof QueryRuntimeException && Objects.equals(message, t.getMessage()))
? (QueryRuntimeException) t
: new QueryRuntimeException(message, t);
} | [
"public",
"static",
"QueryRuntimeException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"t",
")",
"{",
"return",
"(",
"t",
"instanceof",
"QueryRuntimeException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"t",
".",
"getMessage",
"(",
... | Converts a Throwable to a QueryRuntimeException with the specified detail message. If the
Throwable is a QueryRuntimeException and if the Throwable's message is identical to the one
supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in a
new QueryRuntimeException with the detail message.
@param t the Throwable to convert
@param message the specified detail message
@return a QueryRuntimeException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"QueryRuntimeException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"QueryRuntimeException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
"to",
"the",... | train | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/query/exception/QueryRuntimeException.java#L60-L64 |
bingoohuang/excel2javabeans | src/main/java/com/github/bingoohuang/excel2beans/PoiUtil.java | PoiUtil.matchCell | public static Cell matchCell(Row row, int colIndex, String searchKey) {
val cell = row.getCell(colIndex);
if (cell == null) return null;
val value = getCellStringValue(cell);
if (StringUtils.contains(value, searchKey)) return cell;
return null;
} | java | public static Cell matchCell(Row row, int colIndex, String searchKey) {
val cell = row.getCell(colIndex);
if (cell == null) return null;
val value = getCellStringValue(cell);
if (StringUtils.contains(value, searchKey)) return cell;
return null;
} | [
"public",
"static",
"Cell",
"matchCell",
"(",
"Row",
"row",
",",
"int",
"colIndex",
",",
"String",
"searchKey",
")",
"{",
"val",
"cell",
"=",
"row",
".",
"getCell",
"(",
"colIndex",
")",
";",
"if",
"(",
"cell",
"==",
"null",
")",
"return",
"null",
";... | 匹配单元格
@param row 行
@param colIndex 列索引
@param searchKey 单元格中包含的关键字
@return 单元格,没有找到时返回null | [
"匹配单元格"
] | train | https://github.com/bingoohuang/excel2javabeans/blob/db136d460b93b649814366c0d84a982698b96dc3/src/main/java/com/github/bingoohuang/excel2beans/PoiUtil.java#L397-L405 |
kaazing/gateway | mina.netty/src/main/java/org/kaazing/mina/core/future/DefaultWriteFutureEx.java | DefaultWriteFutureEx.newNotWrittenFuture | public static WriteFutureEx newNotWrittenFuture(IoSession session, Throwable cause) {
DefaultWriteFutureEx unwrittenFuture = new DefaultWriteFutureEx(session);
unwrittenFuture.setException(cause);
return unwrittenFuture;
} | java | public static WriteFutureEx newNotWrittenFuture(IoSession session, Throwable cause) {
DefaultWriteFutureEx unwrittenFuture = new DefaultWriteFutureEx(session);
unwrittenFuture.setException(cause);
return unwrittenFuture;
} | [
"public",
"static",
"WriteFutureEx",
"newNotWrittenFuture",
"(",
"IoSession",
"session",
",",
"Throwable",
"cause",
")",
"{",
"DefaultWriteFutureEx",
"unwrittenFuture",
"=",
"new",
"DefaultWriteFutureEx",
"(",
"session",
")",
";",
"unwrittenFuture",
".",
"setException",... | Returns a new {@link DefaultWriteFuture} which is already marked as 'not written'. | [
"Returns",
"a",
"new",
"{"
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.netty/src/main/java/org/kaazing/mina/core/future/DefaultWriteFutureEx.java#L38-L42 |
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.createCompositeEntityRole | public UUID createCompositeEntityRole(UUID appId, String versionId, UUID cEntityId, CreateCompositeEntityRoleOptionalParameter createCompositeEntityRoleOptionalParameter) {
return createCompositeEntityRoleWithServiceResponseAsync(appId, versionId, cEntityId, createCompositeEntityRoleOptionalParameter).toBlocking().single().body();
} | java | public UUID createCompositeEntityRole(UUID appId, String versionId, UUID cEntityId, CreateCompositeEntityRoleOptionalParameter createCompositeEntityRoleOptionalParameter) {
return createCompositeEntityRoleWithServiceResponseAsync(appId, versionId, cEntityId, createCompositeEntityRoleOptionalParameter).toBlocking().single().body();
} | [
"public",
"UUID",
"createCompositeEntityRole",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"cEntityId",
",",
"CreateCompositeEntityRoleOptionalParameter",
"createCompositeEntityRoleOptionalParameter",
")",
"{",
"return",
"createCompositeEntityRoleWithServiceRes... | Create an entity role for an entity in the application.
@param appId The application ID.
@param versionId The version ID.
@param cEntityId The composite entity extractor ID.
@param createCompositeEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the UUID object if successful. | [
"Create",
"an",
"entity",
"role",
"for",
"an",
"entity",
"in",
"the",
"application",
"."
] | 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#L8872-L8874 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/olap/OLAPService.java | OLAPService.getExpirationDate | public Date getExpirationDate(ApplicationDefinition appDef, String shard) {
checkServiceState();
return m_olap.getExpirationDate(appDef, shard);
} | java | public Date getExpirationDate(ApplicationDefinition appDef, String shard) {
checkServiceState();
return m_olap.getExpirationDate(appDef, shard);
} | [
"public",
"Date",
"getExpirationDate",
"(",
"ApplicationDefinition",
"appDef",
",",
"String",
"shard",
")",
"{",
"checkServiceState",
"(",
")",
";",
"return",
"m_olap",
".",
"getExpirationDate",
"(",
"appDef",
",",
"shard",
")",
";",
"}"
] | Get the expire-date for the given shard name and OLAP application. Null is returned
if the shard does not exist or has no expire-date.
@param appDef OLAP application definition.
@param shard Shard name.
@return Shard's expire-date or null if it doesn't exist or has no
expire-date. | [
"Get",
"the",
"expire",
"-",
"date",
"for",
"the",
"given",
"shard",
"name",
"and",
"OLAP",
"application",
".",
"Null",
"is",
"returned",
"if",
"the",
"shard",
"does",
"not",
"exist",
"or",
"has",
"no",
"expire",
"-",
"date",
"."
] | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/olap/OLAPService.java#L360-L363 |
eirbjo/jetty-console | jetty-console-creator/src/main/java/org/simplericity/jettyconsole/creator/DefaultCreator.java | DefaultCreator.writePathDescriptor | private void writePathDescriptor(File consoleDir, Set<String> paths) {
try (PrintWriter writer = new PrintWriter(new FileOutputStream(new File(consoleDir, "jettyconsolepaths.txt")))){
for (String path : paths) {
writer.println(path);
}
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
}
} | java | private void writePathDescriptor(File consoleDir, Set<String> paths) {
try (PrintWriter writer = new PrintWriter(new FileOutputStream(new File(consoleDir, "jettyconsolepaths.txt")))){
for (String path : paths) {
writer.println(path);
}
} catch (FileNotFoundException e) {
throw new RuntimeException(e);
}
} | [
"private",
"void",
"writePathDescriptor",
"(",
"File",
"consoleDir",
",",
"Set",
"<",
"String",
">",
"paths",
")",
"{",
"try",
"(",
"PrintWriter",
"writer",
"=",
"new",
"PrintWriter",
"(",
"new",
"FileOutputStream",
"(",
"new",
"File",
"(",
"consoleDir",
","... | Write a txt file with one line for each unpacked class or resource
from dependencies. | [
"Write",
"a",
"txt",
"file",
"with",
"one",
"line",
"for",
"each",
"unpacked",
"class",
"or",
"resource",
"from",
"dependencies",
"."
] | train | https://github.com/eirbjo/jetty-console/blob/5bd32ecab12837394dd45fd15c51c3934afcd76b/jetty-console-creator/src/main/java/org/simplericity/jettyconsole/creator/DefaultCreator.java#L104-L113 |
jblas-project/jblas | src/main/java/org/jblas/util/Permutations.java | Permutations.permutationDoubleMatrixFromPivotIndices | public static DoubleMatrix permutationDoubleMatrixFromPivotIndices(int size, int[] ipiv) {
int n = ipiv.length;
//System.out.printf("size = %d n = %d\n", size, n);
int indices[] = new int[size];
for (int i = 0; i < size; i++)
indices[i] = i;
//for (int i = 0; i < n; i++)
// System.out.printf("ipiv[%d] = %d\n", i, ipiv[i]);
for (int i = 0; i < n; i++) {
int j = ipiv[i] - 1;
int t = indices[i];
indices[i] = indices[j];
indices[j] = t;
}
DoubleMatrix result = new DoubleMatrix(size, size);
for (int i = 0; i < size; i++)
result.put(indices[i], i, 1.0);
return result;
} | java | public static DoubleMatrix permutationDoubleMatrixFromPivotIndices(int size, int[] ipiv) {
int n = ipiv.length;
//System.out.printf("size = %d n = %d\n", size, n);
int indices[] = new int[size];
for (int i = 0; i < size; i++)
indices[i] = i;
//for (int i = 0; i < n; i++)
// System.out.printf("ipiv[%d] = %d\n", i, ipiv[i]);
for (int i = 0; i < n; i++) {
int j = ipiv[i] - 1;
int t = indices[i];
indices[i] = indices[j];
indices[j] = t;
}
DoubleMatrix result = new DoubleMatrix(size, size);
for (int i = 0; i < size; i++)
result.put(indices[i], i, 1.0);
return result;
} | [
"public",
"static",
"DoubleMatrix",
"permutationDoubleMatrixFromPivotIndices",
"(",
"int",
"size",
",",
"int",
"[",
"]",
"ipiv",
")",
"{",
"int",
"n",
"=",
"ipiv",
".",
"length",
";",
"//System.out.printf(\"size = %d n = %d\\n\", size, n);",
"int",
"indices",
"[",
"... | Create a permutation matrix from a LAPACK-style 'ipiv' vector.
@param ipiv row i was interchanged with row ipiv[i] | [
"Create",
"a",
"permutation",
"matrix",
"from",
"a",
"LAPACK",
"-",
"style",
"ipiv",
"vector",
"."
] | train | https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/util/Permutations.java#L99-L119 |
lazy-koala/java-toolkit | fast-toolkit/src/main/java/com/thankjava/toolkit/core/reflect/ReflectUtil.java | ReflectUtil.invokeMethod | public static Object invokeMethod(Object obj, Method method, Object... parameter) {
try {
method.setAccessible(true);
return method.invoke(obj, parameter);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
return null;
} | java | public static Object invokeMethod(Object obj, Method method, Object... parameter) {
try {
method.setAccessible(true);
return method.invoke(obj, parameter);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
return null;
} | [
"public",
"static",
"Object",
"invokeMethod",
"(",
"Object",
"obj",
",",
"Method",
"method",
",",
"Object",
"...",
"parameter",
")",
"{",
"try",
"{",
"method",
".",
"setAccessible",
"(",
"true",
")",
";",
"return",
"method",
".",
"invoke",
"(",
"obj",
",... | 执行指定方法
<p>Function: invokeMethod</p>
<p>Description: </p>
@param obj
@param method
@param parameter
@author acexy@thankjava.com
@date 2014-12-18 下午1:50:06
@version 1.0 | [
"执行指定方法",
"<p",
">",
"Function",
":",
"invokeMethod<",
"/",
"p",
">",
"<p",
">",
"Description",
":",
"<",
"/",
"p",
">"
] | train | https://github.com/lazy-koala/java-toolkit/blob/f46055fae0cc73049597a3708e515f5c6582d27a/fast-toolkit/src/main/java/com/thankjava/toolkit/core/reflect/ReflectUtil.java#L286-L298 |
zaproxy/zaproxy | src/org/zaproxy/zap/extension/api/API.java | API.convertViewActionApiResponse | private static String convertViewActionApiResponse(Format format, String name, ApiResponse res) throws ApiException {
switch (format) {
case JSON:
return res.toJSON().toString();
case JSONP:
return getJsonpWrapper(res.toJSON().toString());
case XML:
return responseToXml(name, res);
case HTML:
return responseToHtml(res);
default:
// Should not happen, format validation should prevent this case...
logger.error("Unhandled format: " + format);
throw new ApiException(ApiException.Type.INTERNAL_ERROR);
}
} | java | private static String convertViewActionApiResponse(Format format, String name, ApiResponse res) throws ApiException {
switch (format) {
case JSON:
return res.toJSON().toString();
case JSONP:
return getJsonpWrapper(res.toJSON().toString());
case XML:
return responseToXml(name, res);
case HTML:
return responseToHtml(res);
default:
// Should not happen, format validation should prevent this case...
logger.error("Unhandled format: " + format);
throw new ApiException(ApiException.Type.INTERNAL_ERROR);
}
} | [
"private",
"static",
"String",
"convertViewActionApiResponse",
"(",
"Format",
"format",
",",
"String",
"name",
",",
"ApiResponse",
"res",
")",
"throws",
"ApiException",
"{",
"switch",
"(",
"format",
")",
"{",
"case",
"JSON",
":",
"return",
"res",
".",
"toJSON"... | Converts the given {@code ApiResponse} to {@code String} representation.
<p>
This is expected to be used just for views and actions.
@param format the format to convert to.
@param name the name of the view or action.
@param res the {@code ApiResponse} to convert.
@return the string representation of the {@code ApiResponse}.
@throws ApiException if an error occurred while converting the response or if the format was not handled.
@see #validateFormatForViewAction(Format) | [
"Converts",
"the",
"given",
"{",
"@code",
"ApiResponse",
"}",
"to",
"{",
"@code",
"String",
"}",
"representation",
".",
"<p",
">",
"This",
"is",
"expected",
"to",
"be",
"used",
"just",
"for",
"views",
"and",
"actions",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/api/API.java#L585-L600 |
lukas-krecan/JsonUnit | json-unit-spring/src/main/java/net/javacrumbs/jsonunit/spring/JsonUnitResultMatchers.java | JsonUnitResultMatchers.isObject | public ResultMatcher isObject() {
return new AbstractResultMatcher(path, configuration) {
public void doMatch(Object actual) {
isPresent(actual);
Node node = getNode(actual);
if (node.getNodeType() != OBJECT) {
failOnType(node, "an object");
}
}
};
} | java | public ResultMatcher isObject() {
return new AbstractResultMatcher(path, configuration) {
public void doMatch(Object actual) {
isPresent(actual);
Node node = getNode(actual);
if (node.getNodeType() != OBJECT) {
failOnType(node, "an object");
}
}
};
} | [
"public",
"ResultMatcher",
"isObject",
"(",
")",
"{",
"return",
"new",
"AbstractResultMatcher",
"(",
"path",
",",
"configuration",
")",
"{",
"public",
"void",
"doMatch",
"(",
"Object",
"actual",
")",
"{",
"isPresent",
"(",
"actual",
")",
";",
"Node",
"node",... | Fails if the selected JSON is not an Object or is not present. | [
"Fails",
"if",
"the",
"selected",
"JSON",
"is",
"not",
"an",
"Object",
"or",
"is",
"not",
"present",
"."
] | train | https://github.com/lukas-krecan/JsonUnit/blob/2b12ed792e8dd787bddd6f3b8eb2325737435791/json-unit-spring/src/main/java/net/javacrumbs/jsonunit/spring/JsonUnitResultMatchers.java#L183-L193 |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/DefaultErrorHandler.java | DefaultErrorHandler.renderDirectly | protected void renderDirectly(int statusCode, RouteContext routeContext) {
if (application.getPippoSettings().isProd()) {
routeContext.getResponse().commit();
} else {
if (statusCode == HttpConstants.StatusCode.NOT_FOUND) {
StringBuilder content = new StringBuilder();
content.append("<html><body>");
content.append("<pre>");
content.append("Cannot find a route for '");
content.append(routeContext.getRequestMethod()).append(' ').append(routeContext.getRequestUri());
content.append('\'');
content.append('\n');
content.append("Available routes:");
content.append('\n');
List<Route> routes = application.getRouter().getRoutes();
for (Route route : routes) {
content.append('\t').append(route.getRequestMethod()).append(' ').append(route.getUriPattern());
content.append('\n');
}
content.append("</pre>");
content.append("</body></html>");
routeContext.send(content);
} else if (statusCode == HttpConstants.StatusCode.INTERNAL_ERROR) {
StringBuilder content = new StringBuilder();
content.append("<html><body>");
content.append("<pre>");
Error error = prepareError(statusCode, routeContext);
content.append(error.toString());
content.append("</pre>");
content.append("</body></html>");
routeContext.send(content);
}
}
} | java | protected void renderDirectly(int statusCode, RouteContext routeContext) {
if (application.getPippoSettings().isProd()) {
routeContext.getResponse().commit();
} else {
if (statusCode == HttpConstants.StatusCode.NOT_FOUND) {
StringBuilder content = new StringBuilder();
content.append("<html><body>");
content.append("<pre>");
content.append("Cannot find a route for '");
content.append(routeContext.getRequestMethod()).append(' ').append(routeContext.getRequestUri());
content.append('\'');
content.append('\n');
content.append("Available routes:");
content.append('\n');
List<Route> routes = application.getRouter().getRoutes();
for (Route route : routes) {
content.append('\t').append(route.getRequestMethod()).append(' ').append(route.getUriPattern());
content.append('\n');
}
content.append("</pre>");
content.append("</body></html>");
routeContext.send(content);
} else if (statusCode == HttpConstants.StatusCode.INTERNAL_ERROR) {
StringBuilder content = new StringBuilder();
content.append("<html><body>");
content.append("<pre>");
Error error = prepareError(statusCode, routeContext);
content.append(error.toString());
content.append("</pre>");
content.append("</body></html>");
routeContext.send(content);
}
}
} | [
"protected",
"void",
"renderDirectly",
"(",
"int",
"statusCode",
",",
"RouteContext",
"routeContext",
")",
"{",
"if",
"(",
"application",
".",
"getPippoSettings",
"(",
")",
".",
"isProd",
"(",
")",
")",
"{",
"routeContext",
".",
"getResponse",
"(",
")",
".",... | Render the result directly (without template).
@param routeContext | [
"Render",
"the",
"result",
"directly",
"(",
"without",
"template",
")",
"."
] | train | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/DefaultErrorHandler.java#L215-L256 |
terrestris/shogun-core | src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java | HttpUtil.forwardPost | public static Response forwardPost(URI uri, HttpServletRequest request, boolean forwardHeaders) throws URISyntaxException, HttpException {
Header[] headersToForward = null;
if (request != null && forwardHeaders) {
headersToForward = HttpUtil.getHeadersFromRequest(request);
}
String ctString = request.getContentType();
ContentType ct = ContentType.parse(ctString);
String body = getRequestBody(request);
return HttpUtil.postBody(new HttpPost(uri), body, ct, null, headersToForward);
} | java | public static Response forwardPost(URI uri, HttpServletRequest request, boolean forwardHeaders) throws URISyntaxException, HttpException {
Header[] headersToForward = null;
if (request != null && forwardHeaders) {
headersToForward = HttpUtil.getHeadersFromRequest(request);
}
String ctString = request.getContentType();
ContentType ct = ContentType.parse(ctString);
String body = getRequestBody(request);
return HttpUtil.postBody(new HttpPost(uri), body, ct, null, headersToForward);
} | [
"public",
"static",
"Response",
"forwardPost",
"(",
"URI",
"uri",
",",
"HttpServletRequest",
"request",
",",
"boolean",
"forwardHeaders",
")",
"throws",
"URISyntaxException",
",",
"HttpException",
"{",
"Header",
"[",
"]",
"headersToForward",
"=",
"null",
";",
"if"... | Forward POST to uri based on given request
@param uri uri The URI to forward to.
@param request The original {@link HttpServletRequest}
@param forwardHeaders Should headers of request should be forwarded
@return
@throws URISyntaxException
@throws HttpException | [
"Forward",
"POST",
"to",
"uri",
"based",
"on",
"given",
"request"
] | train | https://github.com/terrestris/shogun-core/blob/3dbabda35ae63235265913c865dba389b050b6e6/src/shogun-core-main/src/main/java/de/terrestris/shoguncore/util/http/HttpUtil.java#L1214-L1225 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-cache/xwiki-commons-cache-infinispan/src/main/java/org/xwiki/cache/infinispan/internal/InfinispanConfigurationLoader.java | InfinispanConfigurationLoader.customizeEviction | private void customizeEviction(ConfigurationBuilder builder)
{
EntryEvictionConfiguration eec =
(EntryEvictionConfiguration) getCacheConfiguration().get(EntryEvictionConfiguration.CONFIGURATIONID);
if (eec != null && eec.getAlgorithm() == EntryEvictionConfiguration.Algorithm.LRU) {
////////////////////
// Eviction
// Max entries
customizeEvictionMaxEntries(builder, eec);
////////////////////
// Expiration
// Wakeup interval
customizeExpirationWakeUpInterval(builder, eec);
// Max idle
customizeExpirationMaxIdle(builder, eec);
// Lifespan
customizeExpirationLifespan(builder, eec);
}
} | java | private void customizeEviction(ConfigurationBuilder builder)
{
EntryEvictionConfiguration eec =
(EntryEvictionConfiguration) getCacheConfiguration().get(EntryEvictionConfiguration.CONFIGURATIONID);
if (eec != null && eec.getAlgorithm() == EntryEvictionConfiguration.Algorithm.LRU) {
////////////////////
// Eviction
// Max entries
customizeEvictionMaxEntries(builder, eec);
////////////////////
// Expiration
// Wakeup interval
customizeExpirationWakeUpInterval(builder, eec);
// Max idle
customizeExpirationMaxIdle(builder, eec);
// Lifespan
customizeExpirationLifespan(builder, eec);
}
} | [
"private",
"void",
"customizeEviction",
"(",
"ConfigurationBuilder",
"builder",
")",
"{",
"EntryEvictionConfiguration",
"eec",
"=",
"(",
"EntryEvictionConfiguration",
")",
"getCacheConfiguration",
"(",
")",
".",
"get",
"(",
"EntryEvictionConfiguration",
".",
"CONFIGURATIO... | Customize the eviction configuration.
@param buil the configuration builder
@param configuration the configuration
@return the configuration builder | [
"Customize",
"the",
"eviction",
"configuration",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-cache/xwiki-commons-cache-infinispan/src/main/java/org/xwiki/cache/infinispan/internal/InfinispanConfigurationLoader.java#L74-L96 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.toSpreadMap | public static SpreadMap toSpreadMap(Iterable self) {
if (self == null)
throw new GroovyRuntimeException("Fail to convert Iterable to SpreadMap, because it is null.");
else
return toSpreadMap(asList(self));
} | java | public static SpreadMap toSpreadMap(Iterable self) {
if (self == null)
throw new GroovyRuntimeException("Fail to convert Iterable to SpreadMap, because it is null.");
else
return toSpreadMap(asList(self));
} | [
"public",
"static",
"SpreadMap",
"toSpreadMap",
"(",
"Iterable",
"self",
")",
"{",
"if",
"(",
"self",
"==",
"null",
")",
"throw",
"new",
"GroovyRuntimeException",
"(",
"\"Fail to convert Iterable to SpreadMap, because it is null.\"",
")",
";",
"else",
"return",
"toSpr... | Creates a spreadable map from this iterable.
<p>
@param self an iterable
@return a newly created SpreadMap
@see groovy.lang.SpreadMap#SpreadMap(java.util.List)
@see #toSpreadMap(java.util.Map)
@since 2.4.0 | [
"Creates",
"a",
"spreadable",
"map",
"from",
"this",
"iterable",
".",
"<p",
">"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L8577-L8582 |
roskenet/springboot-javafx-support | src/main/java/de/felixroske/jfxsupport/AbstractFxmlView.java | AbstractFxmlView.loadSynchronously | private FXMLLoader loadSynchronously(final URL resource, final Optional<ResourceBundle> bundle) throws IllegalStateException {
final FXMLLoader loader = new FXMLLoader(resource, bundle.orElse(null));
loader.setControllerFactory(this::createControllerForType);
try {
loader.load();
} catch (final IOException | IllegalStateException e) {
throw new IllegalStateException("Cannot load " + getConventionalName(), e);
}
return loader;
} | java | private FXMLLoader loadSynchronously(final URL resource, final Optional<ResourceBundle> bundle) throws IllegalStateException {
final FXMLLoader loader = new FXMLLoader(resource, bundle.orElse(null));
loader.setControllerFactory(this::createControllerForType);
try {
loader.load();
} catch (final IOException | IllegalStateException e) {
throw new IllegalStateException("Cannot load " + getConventionalName(), e);
}
return loader;
} | [
"private",
"FXMLLoader",
"loadSynchronously",
"(",
"final",
"URL",
"resource",
",",
"final",
"Optional",
"<",
"ResourceBundle",
">",
"bundle",
")",
"throws",
"IllegalStateException",
"{",
"final",
"FXMLLoader",
"loader",
"=",
"new",
"FXMLLoader",
"(",
"resource",
... | Load synchronously.
@param resource
the resource
@param bundle
the bundle
@return the FXML loader
@throws IllegalStateException
the illegal state exception | [
"Load",
"synchronously",
"."
] | train | https://github.com/roskenet/springboot-javafx-support/blob/aed1da178ecb204eb00508b3ce1e2a11d4fa9619/src/main/java/de/felixroske/jfxsupport/AbstractFxmlView.java#L153-L165 |
zaproxy/zaproxy | src/org/zaproxy/zap/utils/FontUtils.java | FontUtils.getFont | public static Font getFont (Font font, int style, Size size) {
return getFont(font, size).deriveFont(style);
} | java | public static Font getFont (Font font, int style, Size size) {
return getFont(font, size).deriveFont(style);
} | [
"public",
"static",
"Font",
"getFont",
"(",
"Font",
"font",
",",
"int",
"style",
",",
"Size",
"size",
")",
"{",
"return",
"getFont",
"(",
"font",
",",
"size",
")",
".",
"deriveFont",
"(",
"style",
")",
";",
"}"
] | Gets the specified font with the specified style and size, correctly scaled
@param style
@param size
@since 2.7.0
@return | [
"Gets",
"the",
"specified",
"font",
"with",
"the",
"specified",
"style",
"and",
"size",
"correctly",
"scaled"
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/utils/FontUtils.java#L190-L192 |
Netflix/governator | governator-core/src/main/java/com/netflix/governator/InjectorBuilder.java | InjectorBuilder.traceEachElement | @Deprecated
public InjectorBuilder traceEachElement(ElementVisitor<String> visitor) {
return forEachElement(visitor, message -> LOG.debug(message));
} | java | @Deprecated
public InjectorBuilder traceEachElement(ElementVisitor<String> visitor) {
return forEachElement(visitor, message -> LOG.debug(message));
} | [
"@",
"Deprecated",
"public",
"InjectorBuilder",
"traceEachElement",
"(",
"ElementVisitor",
"<",
"String",
">",
"visitor",
")",
"{",
"return",
"forEachElement",
"(",
"visitor",
",",
"message",
"->",
"LOG",
".",
"debug",
"(",
"message",
")",
")",
";",
"}"
] | Iterator through all elements of the current module and write the output of the
ElementVisitor to the logger at debug level. 'null' responses are ignored
@param visitor
@deprecated Use forEachElement(visitor, message -> LOG.debug(message)); instead | [
"Iterator",
"through",
"all",
"elements",
"of",
"the",
"current",
"module",
"and",
"write",
"the",
"output",
"of",
"the",
"ElementVisitor",
"to",
"the",
"logger",
"at",
"debug",
"level",
".",
"null",
"responses",
"are",
"ignored",
"@param",
"visitor"
] | train | https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-core/src/main/java/com/netflix/governator/InjectorBuilder.java#L111-L114 |
jbundle/jbundle | thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/ParamDispatcher.java | ParamDispatcher.firePropertyChange | public void firePropertyChange(String propertyName, Object oldValue, Object newValue)
{
if (propertyChange != null)
propertyChange.firePropertyChange(propertyName, oldValue, newValue);
} | java | public void firePropertyChange(String propertyName, Object oldValue, Object newValue)
{
if (propertyChange != null)
propertyChange.firePropertyChange(propertyName, oldValue, newValue);
} | [
"public",
"void",
"firePropertyChange",
"(",
"String",
"propertyName",
",",
"Object",
"oldValue",
",",
"Object",
"newValue",
")",
"{",
"if",
"(",
"propertyChange",
"!=",
"null",
")",
"propertyChange",
".",
"firePropertyChange",
"(",
"propertyName",
",",
"oldValue"... | The firePropertyChange method was generated to support the propertyChange field.
@param propertyName The property name.
@param oldValue The old value.
@param newValue The new value. | [
"The",
"firePropertyChange",
"method",
"was",
"generated",
"to",
"support",
"the",
"propertyChange",
"field",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/ParamDispatcher.java#L149-L153 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/util/GosuCollectionUtil.java | GosuCollectionUtil.startsWith | public static boolean startsWith( List<?> list, List<?> prefix )
{
if( list.size() < prefix.size() )
{
return false;
}
Iterator<?> listIter = list.iterator();
for( Object prefixElement : prefix )
{
boolean b = listIter.hasNext();
assert b :
"list claims to have at least as many elements as prefix, but its iterator is exhausted first";
if( !GosuObjectUtil.equals( prefixElement, listIter.next() ) )
{
return false;
}
}
return true;
} | java | public static boolean startsWith( List<?> list, List<?> prefix )
{
if( list.size() < prefix.size() )
{
return false;
}
Iterator<?> listIter = list.iterator();
for( Object prefixElement : prefix )
{
boolean b = listIter.hasNext();
assert b :
"list claims to have at least as many elements as prefix, but its iterator is exhausted first";
if( !GosuObjectUtil.equals( prefixElement, listIter.next() ) )
{
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"startsWith",
"(",
"List",
"<",
"?",
">",
"list",
",",
"List",
"<",
"?",
">",
"prefix",
")",
"{",
"if",
"(",
"list",
".",
"size",
"(",
")",
"<",
"prefix",
".",
"size",
"(",
")",
")",
"{",
"return",
"false",
";",
"... | {@link String#startsWith(String)} for Lists.
@return true iff list is at least as big as prefix, and if the first prefix.size() elements
are element-wise equal to the elements of prefix. | [
"{",
"@link",
"String#startsWith",
"(",
"String",
")",
"}",
"for",
"Lists",
"."
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuCollectionUtil.java#L70-L88 |
lucee/Lucee | core/src/main/java/lucee/runtime/type/util/QueryUtil.java | QueryUtil.getValue | @Deprecated
public static Object getValue(QueryColumn column, int row) {// print.ds();
if (NullSupportHelper.full()) return column.get(row, null);
Object v = column.get(row, "");
return v == null ? "" : v;
} | java | @Deprecated
public static Object getValue(QueryColumn column, int row) {// print.ds();
if (NullSupportHelper.full()) return column.get(row, null);
Object v = column.get(row, "");
return v == null ? "" : v;
} | [
"@",
"Deprecated",
"public",
"static",
"Object",
"getValue",
"(",
"QueryColumn",
"column",
",",
"int",
"row",
")",
"{",
"// print.ds();",
"if",
"(",
"NullSupportHelper",
".",
"full",
"(",
")",
")",
"return",
"column",
".",
"get",
"(",
"row",
",",
"null",
... | return the value at the given position (row), returns the default empty value ("" or null) for
wrong row or null values. this method only exist for backward compatibility and should not be
used for new functinality
@param column
@param row
@return
@deprecated use instead QueryColumn.get(int,Object) | [
"return",
"the",
"value",
"at",
"the",
"given",
"position",
"(",
"row",
")",
"returns",
"the",
"default",
"empty",
"value",
"(",
"or",
"null",
")",
"for",
"wrong",
"row",
"or",
"null",
"values",
".",
"this",
"method",
"only",
"exist",
"for",
"backward",
... | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/QueryUtil.java#L354-L359 |
dita-ot/dita-ot | src/main/java/org/dita/dost/module/ModuleFactory.java | ModuleFactory.createModule | public AbstractPipelineModule createModule(final Class<? extends AbstractPipelineModule> moduleClass)
throws DITAOTException {
try {
return moduleClass.newInstance();
} catch (final Exception e) {
final MessageBean msgBean = MessageUtils.getMessage("DOTJ005F", moduleClass.getName());
final String msg = msgBean.toString();
throw new DITAOTException(msgBean, e,msg);
}
} | java | public AbstractPipelineModule createModule(final Class<? extends AbstractPipelineModule> moduleClass)
throws DITAOTException {
try {
return moduleClass.newInstance();
} catch (final Exception e) {
final MessageBean msgBean = MessageUtils.getMessage("DOTJ005F", moduleClass.getName());
final String msg = msgBean.toString();
throw new DITAOTException(msgBean, e,msg);
}
} | [
"public",
"AbstractPipelineModule",
"createModule",
"(",
"final",
"Class",
"<",
"?",
"extends",
"AbstractPipelineModule",
">",
"moduleClass",
")",
"throws",
"DITAOTException",
"{",
"try",
"{",
"return",
"moduleClass",
".",
"newInstance",
"(",
")",
";",
"}",
"catch... | Create the ModuleElem class instance according to moduleName.
@param moduleClass module class
@return AbstractPipelineModule
@throws DITAOTException DITAOTException
@since 1.6 | [
"Create",
"the",
"ModuleElem",
"class",
"instance",
"according",
"to",
"moduleName",
"."
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/ModuleFactory.java#L52-L62 |
elki-project/elki | elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/timeseries/DTWDistanceFunction.java | DTWDistanceFunction.firstRow | protected void firstRow(double[] buf, int band, NumberVector v1, NumberVector v2, int dim2) {
// First cell:
final double val1 = v1.doubleValue(0);
buf[0] = delta(val1, v2.doubleValue(0));
// Width of valid area:
final int w = (band >= dim2) ? dim2 - 1 : band;
// Fill remaining part of buffer:
for(int j = 1; j <= w; j++) {
buf[j] = buf[j - 1] + delta(val1, v2.doubleValue(j));
}
} | java | protected void firstRow(double[] buf, int band, NumberVector v1, NumberVector v2, int dim2) {
// First cell:
final double val1 = v1.doubleValue(0);
buf[0] = delta(val1, v2.doubleValue(0));
// Width of valid area:
final int w = (band >= dim2) ? dim2 - 1 : band;
// Fill remaining part of buffer:
for(int j = 1; j <= w; j++) {
buf[j] = buf[j - 1] + delta(val1, v2.doubleValue(j));
}
} | [
"protected",
"void",
"firstRow",
"(",
"double",
"[",
"]",
"buf",
",",
"int",
"band",
",",
"NumberVector",
"v1",
",",
"NumberVector",
"v2",
",",
"int",
"dim2",
")",
"{",
"// First cell:",
"final",
"double",
"val1",
"=",
"v1",
".",
"doubleValue",
"(",
"0",... | Fill the first row.
@param buf Buffer
@param band Bandwidth
@param v1 First vector
@param v2 Second vector
@param dim2 Dimensionality of second | [
"Fill",
"the",
"first",
"row",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-distance/src/main/java/de/lmu/ifi/dbs/elki/distance/distancefunction/timeseries/DTWDistanceFunction.java#L137-L148 |
deeplearning4j/deeplearning4j | datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/transform/RandomCropTransform.java | RandomCropTransform.doTransform | @Override
protected ImageWritable doTransform(ImageWritable image, Random random) {
if (image == null) {
return null;
}
// ensure that transform is valid
if (image.getFrame().imageHeight < outputHeight || image.getFrame().imageWidth < outputWidth)
throw new UnsupportedOperationException(
"Output height/width cannot be more than the input image. Requested: " + outputHeight + "+x"
+ outputWidth + ", got " + image.getFrame().imageHeight + "+x"
+ image.getFrame().imageWidth);
// determine boundary to place random offset
int cropTop = image.getFrame().imageHeight - outputHeight;
int cropLeft = image.getFrame().imageWidth - outputWidth;
Mat mat = converter.convert(image.getFrame());
int top = rng.nextInt(cropTop + 1);
int left = rng.nextInt(cropLeft + 1);
y = Math.min(top, mat.rows() - 1);
x = Math.min(left, mat.cols() - 1);
Mat result = mat.apply(new Rect(x, y, outputWidth, outputHeight));
return new ImageWritable(converter.convert(result));
} | java | @Override
protected ImageWritable doTransform(ImageWritable image, Random random) {
if (image == null) {
return null;
}
// ensure that transform is valid
if (image.getFrame().imageHeight < outputHeight || image.getFrame().imageWidth < outputWidth)
throw new UnsupportedOperationException(
"Output height/width cannot be more than the input image. Requested: " + outputHeight + "+x"
+ outputWidth + ", got " + image.getFrame().imageHeight + "+x"
+ image.getFrame().imageWidth);
// determine boundary to place random offset
int cropTop = image.getFrame().imageHeight - outputHeight;
int cropLeft = image.getFrame().imageWidth - outputWidth;
Mat mat = converter.convert(image.getFrame());
int top = rng.nextInt(cropTop + 1);
int left = rng.nextInt(cropLeft + 1);
y = Math.min(top, mat.rows() - 1);
x = Math.min(left, mat.cols() - 1);
Mat result = mat.apply(new Rect(x, y, outputWidth, outputHeight));
return new ImageWritable(converter.convert(result));
} | [
"@",
"Override",
"protected",
"ImageWritable",
"doTransform",
"(",
"ImageWritable",
"image",
",",
"Random",
"random",
")",
"{",
"if",
"(",
"image",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"// ensure that transform is valid",
"if",
"(",
"image",
"."... | Takes an image and returns a randomly cropped image.
@param image to transform, null == end of stream
@param random object to use (or null for deterministic)
@return transformed image | [
"Takes",
"an",
"image",
"and",
"returns",
"a",
"randomly",
"cropped",
"image",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/transform/RandomCropTransform.java#L74-L100 |
aws/aws-sdk-java | aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/ConnectionInput.java | ConnectionInput.withConnectionProperties | public ConnectionInput withConnectionProperties(java.util.Map<String, String> connectionProperties) {
setConnectionProperties(connectionProperties);
return this;
} | java | public ConnectionInput withConnectionProperties(java.util.Map<String, String> connectionProperties) {
setConnectionProperties(connectionProperties);
return this;
} | [
"public",
"ConnectionInput",
"withConnectionProperties",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"connectionProperties",
")",
"{",
"setConnectionProperties",
"(",
"connectionProperties",
")",
";",
"return",
"this",
";",
"}"
] | <p>
These key-value pairs define parameters for the connection.
</p>
@param connectionProperties
These key-value pairs define parameters for the connection.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"These",
"key",
"-",
"value",
"pairs",
"define",
"parameters",
"for",
"the",
"connection",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/ConnectionInput.java#L313-L316 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAuthenticatorProxy.java | WebAuthenticatorProxy.getAuthenticatorForFailOver | private WebAuthenticator getAuthenticatorForFailOver(String authType, WebRequest webRequest) {
WebAuthenticator authenticator = null;
if (LoginConfiguration.FORM.equals(authType)) {
authenticator = createFormLoginAuthenticator(webRequest);
} else if (LoginConfiguration.BASIC.equals(authType)) {
authenticator = getBasicAuthAuthenticator();
}
return authenticator;
} | java | private WebAuthenticator getAuthenticatorForFailOver(String authType, WebRequest webRequest) {
WebAuthenticator authenticator = null;
if (LoginConfiguration.FORM.equals(authType)) {
authenticator = createFormLoginAuthenticator(webRequest);
} else if (LoginConfiguration.BASIC.equals(authType)) {
authenticator = getBasicAuthAuthenticator();
}
return authenticator;
} | [
"private",
"WebAuthenticator",
"getAuthenticatorForFailOver",
"(",
"String",
"authType",
",",
"WebRequest",
"webRequest",
")",
"{",
"WebAuthenticator",
"authenticator",
"=",
"null",
";",
"if",
"(",
"LoginConfiguration",
".",
"FORM",
".",
"equals",
"(",
"authType",
"... | Get the appropriate Authenticator based on the authType
@param authType the auth type, either FORM or BASIC
@param the WebRequest
@return The WebAuthenticator or {@code null} if the authType is unknown | [
"Get",
"the",
"appropriate",
"Authenticator",
"based",
"on",
"the",
"authType"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/WebAuthenticatorProxy.java#L115-L123 |
BellaDati/belladati-sdk-api | src/main/java/com/belladati/sdk/intervals/Interval.java | Interval.readInt | static int readInt(JsonNode node, String field) throws NumberFormatException {
String stringValue = node.get(field).asText();
return (int) Float.parseFloat(stringValue);
} | java | static int readInt(JsonNode node, String field) throws NumberFormatException {
String stringValue = node.get(field).asText();
return (int) Float.parseFloat(stringValue);
} | [
"static",
"int",
"readInt",
"(",
"JsonNode",
"node",
",",
"String",
"field",
")",
"throws",
"NumberFormatException",
"{",
"String",
"stringValue",
"=",
"node",
".",
"get",
"(",
"field",
")",
".",
"asText",
"(",
")",
";",
"return",
"(",
"int",
")",
"Float... | Reads a whole number from the given field of the node. Accepts numbers,
numerical strings and fractions.
@param node node from which to read
@param field name of the field to read
@return the field's int value
@throws NumberFormatException if the content cannot be parsed to a number | [
"Reads",
"a",
"whole",
"number",
"from",
"the",
"given",
"field",
"of",
"the",
"node",
".",
"Accepts",
"numbers",
"numerical",
"strings",
"and",
"fractions",
"."
] | train | https://github.com/BellaDati/belladati-sdk-api/blob/ec45a42048d8255838ad0200aa6784a8e8a121c1/src/main/java/com/belladati/sdk/intervals/Interval.java#L91-L94 |
ehcache/ehcache3 | impl/src/main/java/org/ehcache/impl/internal/resilience/RobustLoaderWriterResilienceStrategy.java | RobustLoaderWriterResilienceStrategy.containsKeyFailure | @Override
public boolean containsKeyFailure(K key, StoreAccessException e) {
cleanup(key, e);
return false;
} | java | @Override
public boolean containsKeyFailure(K key, StoreAccessException e) {
cleanup(key, e);
return false;
} | [
"@",
"Override",
"public",
"boolean",
"containsKeyFailure",
"(",
"K",
"key",
",",
"StoreAccessException",
"e",
")",
"{",
"cleanup",
"(",
"key",
",",
"e",
")",
";",
"return",
"false",
";",
"}"
] | Return false. It doesn't matter if the key is present in the backend, we consider it's not in the cache.
@param key the key being queried
@param e the triggered failure
@return false | [
"Return",
"false",
".",
"It",
"doesn",
"t",
"matter",
"if",
"the",
"key",
"is",
"present",
"in",
"the",
"backend",
"we",
"consider",
"it",
"s",
"not",
"in",
"the",
"cache",
"."
] | train | https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/internal/resilience/RobustLoaderWriterResilienceStrategy.java#L73-L77 |
sarl/sarl | contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java | PyGenerator.generatePythonField | protected void generatePythonField(SarlField field, PyAppendable it, IExtraLanguageGeneratorContext context) {
generateBlockComment(getTypeBuilder().getDocumentation(field), it);
if (!field.isStatic()) {
it.append("self."); //$NON-NLS-1$
}
final String fieldName = it.declareUniqueNameVariable(field, field.getName());
it.append(fieldName);
it.append(" = "); //$NON-NLS-1$
if (field.getInitialValue() != null) {
generate(field.getInitialValue(), null, it, context);
} else {
it.append(PyExpressionGenerator.toDefaultValue(field.getType()));
}
it.newLine();
} | java | protected void generatePythonField(SarlField field, PyAppendable it, IExtraLanguageGeneratorContext context) {
generateBlockComment(getTypeBuilder().getDocumentation(field), it);
if (!field.isStatic()) {
it.append("self."); //$NON-NLS-1$
}
final String fieldName = it.declareUniqueNameVariable(field, field.getName());
it.append(fieldName);
it.append(" = "); //$NON-NLS-1$
if (field.getInitialValue() != null) {
generate(field.getInitialValue(), null, it, context);
} else {
it.append(PyExpressionGenerator.toDefaultValue(field.getType()));
}
it.newLine();
} | [
"protected",
"void",
"generatePythonField",
"(",
"SarlField",
"field",
",",
"PyAppendable",
"it",
",",
"IExtraLanguageGeneratorContext",
"context",
")",
"{",
"generateBlockComment",
"(",
"getTypeBuilder",
"(",
")",
".",
"getDocumentation",
"(",
"field",
")",
",",
"i... | Create a field declaration.
@param field the field to generate.
@param it the output
@param context the generation context. | [
"Create",
"a",
"field",
"declaration",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L478-L492 |
alibaba/jstorm | jstorm-core/src/main/java/com/alibaba/jstorm/window/EventTimeTrigger.java | EventTimeTrigger.onElement | @Override
public TriggerResult onElement(Object element, long timestamp, TimeWindow window, TriggerContext ctx) {
ctx.registerEventTimeTimer(window.getEnd() + ctx.getMaxLagMs(), window);
return TriggerResult.CONTINUE;
} | java | @Override
public TriggerResult onElement(Object element, long timestamp, TimeWindow window, TriggerContext ctx) {
ctx.registerEventTimeTimer(window.getEnd() + ctx.getMaxLagMs(), window);
return TriggerResult.CONTINUE;
} | [
"@",
"Override",
"public",
"TriggerResult",
"onElement",
"(",
"Object",
"element",
",",
"long",
"timestamp",
",",
"TimeWindow",
"window",
",",
"TriggerContext",
"ctx",
")",
"{",
"ctx",
".",
"registerEventTimeTimer",
"(",
"window",
".",
"getEnd",
"(",
")",
"+",... | If a watermark arrives, we need to check all pending windows.
If any of the pending window suffices, we should fire immediately by registering a timer without delay.
Otherwise we register a timer whose time is the window end plus max lag time | [
"If",
"a",
"watermark",
"arrives",
"we",
"need",
"to",
"check",
"all",
"pending",
"windows",
".",
"If",
"any",
"of",
"the",
"pending",
"window",
"suffices",
"we",
"should",
"fire",
"immediately",
"by",
"registering",
"a",
"timer",
"without",
"delay",
".",
... | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/com/alibaba/jstorm/window/EventTimeTrigger.java#L32-L36 |
teatrove/teatrove | tea/src/main/java/org/teatrove/tea/util/FileCompilationProvider.java | FileCompilationProvider.getSourceFile | protected File getSourceFile(String name) {
String fileName = name.replace('.', File.separatorChar) + ".tea";
File file = new File(mRootSourceDir, fileName);
return file;
} | java | protected File getSourceFile(String name) {
String fileName = name.replace('.', File.separatorChar) + ".tea";
File file = new File(mRootSourceDir, fileName);
return file;
} | [
"protected",
"File",
"getSourceFile",
"(",
"String",
"name",
")",
"{",
"String",
"fileName",
"=",
"name",
".",
"replace",
"(",
"'",
"'",
",",
"File",
".",
"separatorChar",
")",
"+",
"\".tea\"",
";",
"File",
"file",
"=",
"new",
"File",
"(",
"mRootSourceDi... | Get the source file relative to the root source directory for the given
template.
@param name The fully-qualified name of the template
@return The file reference to the source file | [
"Get",
"the",
"source",
"file",
"relative",
"to",
"the",
"root",
"source",
"directory",
"for",
"the",
"given",
"template",
"."
] | train | https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/tea/src/main/java/org/teatrove/tea/util/FileCompilationProvider.java#L246-L251 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java | BootstrapConfig.setSystemProperties | public void setSystemProperties() {
// copy all other initial properties to system properties
for (Map.Entry<String, String> entry : initProps.entrySet()) {
if (!entry.getKey().equals("websphere.java.security")) {
final String key = entry.getKey();
final String value = entry.getValue();
try {
AccessController.doPrivileged(new java.security.PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws Exception {
System.setProperty(key, value);
return null;
}
});
} catch (Exception ex) {
}
}
}
} | java | public void setSystemProperties() {
// copy all other initial properties to system properties
for (Map.Entry<String, String> entry : initProps.entrySet()) {
if (!entry.getKey().equals("websphere.java.security")) {
final String key = entry.getKey();
final String value = entry.getValue();
try {
AccessController.doPrivileged(new java.security.PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws Exception {
System.setProperty(key, value);
return null;
}
});
} catch (Exception ex) {
}
}
}
} | [
"public",
"void",
"setSystemProperties",
"(",
")",
"{",
"// copy all other initial properties to system properties",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"initProps",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
... | Set configured attributes from bootstrap.properties as system properties.
<p>
This is a separate step from config to ensure it is called once (by the launcher),
rather than every/any time configure is called (could be more than once, some future
nested environment.. who knows?). | [
"Set",
"configured",
"attributes",
"from",
"bootstrap",
".",
"properties",
"as",
"system",
"properties",
".",
"<p",
">",
"This",
"is",
"a",
"separate",
"step",
"from",
"config",
"to",
"ensure",
"it",
"is",
"called",
"once",
"(",
"by",
"the",
"launcher",
")... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java#L415-L434 |
ThreeTen/threeten-extra | src/main/java/org/threeten/extra/scale/SystemUtcRules.java | SystemUtcRules.loadLeapSeconds | private static Data loadLeapSeconds(URL url) throws ClassNotFoundException, IOException {
List<String> lines;
try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(), StandardCharsets.UTF_8))) {
lines = reader.lines().collect(Collectors.toList());
}
List<Long> dates = new ArrayList<>();
List<Integer> offsets = new ArrayList<>();
for (String line : lines) {
line = line.trim();
if (line.isEmpty() || line.startsWith("#")) {
continue;
}
Matcher matcher = LEAP_FILE_FORMAT.matcher(line);
if (matcher.matches() == false) {
throw new StreamCorruptedException("Invalid leap second file");
}
dates.add(LocalDate.parse(matcher.group(1)).getLong(JulianFields.MODIFIED_JULIAN_DAY));
offsets.add(Integer.valueOf(matcher.group(2)));
}
long[] datesData = new long[dates.size()];
int[] offsetsData = new int[dates.size()];
long[] taiData = new long[dates.size()];
for (int i = 0; i < datesData.length; i++) {
datesData[i] = dates.get(i);
offsetsData[i] = offsets.get(i);
taiData[i] = tai(datesData[i], offsetsData[i]);
}
return new Data(datesData, offsetsData, taiData);
} | java | private static Data loadLeapSeconds(URL url) throws ClassNotFoundException, IOException {
List<String> lines;
try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(), StandardCharsets.UTF_8))) {
lines = reader.lines().collect(Collectors.toList());
}
List<Long> dates = new ArrayList<>();
List<Integer> offsets = new ArrayList<>();
for (String line : lines) {
line = line.trim();
if (line.isEmpty() || line.startsWith("#")) {
continue;
}
Matcher matcher = LEAP_FILE_FORMAT.matcher(line);
if (matcher.matches() == false) {
throw new StreamCorruptedException("Invalid leap second file");
}
dates.add(LocalDate.parse(matcher.group(1)).getLong(JulianFields.MODIFIED_JULIAN_DAY));
offsets.add(Integer.valueOf(matcher.group(2)));
}
long[] datesData = new long[dates.size()];
int[] offsetsData = new int[dates.size()];
long[] taiData = new long[dates.size()];
for (int i = 0; i < datesData.length; i++) {
datesData[i] = dates.get(i);
offsetsData[i] = offsets.get(i);
taiData[i] = tai(datesData[i], offsetsData[i]);
}
return new Data(datesData, offsetsData, taiData);
} | [
"private",
"static",
"Data",
"loadLeapSeconds",
"(",
"URL",
"url",
")",
"throws",
"ClassNotFoundException",
",",
"IOException",
"{",
"List",
"<",
"String",
">",
"lines",
";",
"try",
"(",
"BufferedReader",
"reader",
"=",
"new",
"BufferedReader",
"(",
"new",
"In... | Loads the leap second rules from a URL, often in a jar file.
@param url the jar file to load, not null
@throws Exception if an error occurs | [
"Loads",
"the",
"leap",
"second",
"rules",
"from",
"a",
"URL",
"often",
"in",
"a",
"jar",
"file",
"."
] | train | https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/scale/SystemUtcRules.java#L263-L291 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/svg/inkscape/Util.java | Util.getTransform | static Transform getTransform(Element element, String attribute) {
String str = element.getAttribute(attribute);
if (str == null) {
return new Transform();
}
if (str.equals("")) {
return new Transform();
} else if (str.startsWith("translate")) {
str = str.substring(0, str.length()-1);
str = str.substring("translate(".length());
StringTokenizer tokens = new StringTokenizer(str, ", ");
float x = Float.parseFloat(tokens.nextToken());
float y = Float.parseFloat(tokens.nextToken());
return Transform.createTranslateTransform(x,y);
} else if (str.startsWith("matrix")) {
float[] pose = new float[6];
str = str.substring(0, str.length()-1);
str = str.substring("matrix(".length());
StringTokenizer tokens = new StringTokenizer(str, ", ");
float[] tr = new float[6];
for (int j=0;j<tr.length;j++) {
tr[j] = Float.parseFloat(tokens.nextToken());
}
pose[0] = tr[0];
pose[1] = tr[2];
pose[2] = tr[4];
pose[3] = tr[1];
pose[4] = tr[3];
pose[5] = tr[5];
return new Transform(pose);
}
return new Transform();
} | java | static Transform getTransform(Element element, String attribute) {
String str = element.getAttribute(attribute);
if (str == null) {
return new Transform();
}
if (str.equals("")) {
return new Transform();
} else if (str.startsWith("translate")) {
str = str.substring(0, str.length()-1);
str = str.substring("translate(".length());
StringTokenizer tokens = new StringTokenizer(str, ", ");
float x = Float.parseFloat(tokens.nextToken());
float y = Float.parseFloat(tokens.nextToken());
return Transform.createTranslateTransform(x,y);
} else if (str.startsWith("matrix")) {
float[] pose = new float[6];
str = str.substring(0, str.length()-1);
str = str.substring("matrix(".length());
StringTokenizer tokens = new StringTokenizer(str, ", ");
float[] tr = new float[6];
for (int j=0;j<tr.length;j++) {
tr[j] = Float.parseFloat(tokens.nextToken());
}
pose[0] = tr[0];
pose[1] = tr[2];
pose[2] = tr[4];
pose[3] = tr[1];
pose[4] = tr[3];
pose[5] = tr[5];
return new Transform(pose);
}
return new Transform();
} | [
"static",
"Transform",
"getTransform",
"(",
"Element",
"element",
",",
"String",
"attribute",
")",
"{",
"String",
"str",
"=",
"element",
".",
"getAttribute",
"(",
"attribute",
")",
";",
"if",
"(",
"str",
"==",
"null",
")",
"{",
"return",
"new",
"Transform"... | Get a transform defined in the XML
@param element The element from which the transform should be read
@param attribute The name of the attribute holding the transform
@return The transform to be applied | [
"Get",
"a",
"transform",
"defined",
"in",
"the",
"XML"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/svg/inkscape/Util.java#L122-L159 |
netty/netty | transport/src/main/java/io/netty/channel/AbstractCoalescingBufferQueue.java | AbstractCoalescingBufferQueue.composeIntoComposite | protected final ByteBuf composeIntoComposite(ByteBufAllocator alloc, ByteBuf cumulation, ByteBuf next) {
// Create a composite buffer to accumulate this pair and potentially all the buffers
// in the queue. Using +2 as we have already dequeued current and next.
CompositeByteBuf composite = alloc.compositeBuffer(size() + 2);
try {
composite.addComponent(true, cumulation);
composite.addComponent(true, next);
} catch (Throwable cause) {
composite.release();
safeRelease(next);
throwException(cause);
}
return composite;
} | java | protected final ByteBuf composeIntoComposite(ByteBufAllocator alloc, ByteBuf cumulation, ByteBuf next) {
// Create a composite buffer to accumulate this pair and potentially all the buffers
// in the queue. Using +2 as we have already dequeued current and next.
CompositeByteBuf composite = alloc.compositeBuffer(size() + 2);
try {
composite.addComponent(true, cumulation);
composite.addComponent(true, next);
} catch (Throwable cause) {
composite.release();
safeRelease(next);
throwException(cause);
}
return composite;
} | [
"protected",
"final",
"ByteBuf",
"composeIntoComposite",
"(",
"ByteBufAllocator",
"alloc",
",",
"ByteBuf",
"cumulation",
",",
"ByteBuf",
"next",
")",
"{",
"// Create a composite buffer to accumulate this pair and potentially all the buffers",
"// in the queue. Using +2 as we have alr... | Compose {@code cumulation} and {@code next} into a new {@link CompositeByteBuf}. | [
"Compose",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/AbstractCoalescingBufferQueue.java#L270-L283 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsInner.java | ElasticPoolsInner.createOrUpdateAsync | public Observable<ElasticPoolInner> createOrUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1<ServiceResponse<ElasticPoolInner>, ElasticPoolInner>() {
@Override
public ElasticPoolInner call(ServiceResponse<ElasticPoolInner> response) {
return response.body();
}
});
} | java | public Observable<ElasticPoolInner> createOrUpdateAsync(String resourceGroupName, String serverName, String elasticPoolName, ElasticPoolInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName, parameters).map(new Func1<ServiceResponse<ElasticPoolInner>, ElasticPoolInner>() {
@Override
public ElasticPoolInner call(ServiceResponse<ElasticPoolInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ElasticPoolInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"elasticPoolName",
",",
"ElasticPoolInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync... | Creates a new elastic pool or updates an existing elastic pool.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param elasticPoolName The name of the elastic pool to be operated on (updated or created).
@param parameters The required parameters for creating or updating an elastic pool.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"a",
"new",
"elastic",
"pool",
"or",
"updates",
"an",
"existing",
"elastic",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsInner.java#L140-L147 |
aws/aws-sdk-java | aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateRouteResult.java | CreateRouteResult.withRequestModels | public CreateRouteResult withRequestModels(java.util.Map<String, String> requestModels) {
setRequestModels(requestModels);
return this;
} | java | public CreateRouteResult withRequestModels(java.util.Map<String, String> requestModels) {
setRequestModels(requestModels);
return this;
} | [
"public",
"CreateRouteResult",
"withRequestModels",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"requestModels",
")",
"{",
"setRequestModels",
"(",
"requestModels",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The request models for the route.
</p>
@param requestModels
The request models for the route.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"request",
"models",
"for",
"the",
"route",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-apigatewayv2/src/main/java/com/amazonaws/services/apigatewayv2/model/CreateRouteResult.java#L486-L489 |
apache/flink | flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/AbstractStreamOperator.java | AbstractStreamOperator.getPartitionedState | protected <S extends State> S getPartitionedState(StateDescriptor<S, ?> stateDescriptor) throws Exception {
return getPartitionedState(VoidNamespace.INSTANCE, VoidNamespaceSerializer.INSTANCE, stateDescriptor);
} | java | protected <S extends State> S getPartitionedState(StateDescriptor<S, ?> stateDescriptor) throws Exception {
return getPartitionedState(VoidNamespace.INSTANCE, VoidNamespaceSerializer.INSTANCE, stateDescriptor);
} | [
"protected",
"<",
"S",
"extends",
"State",
">",
"S",
"getPartitionedState",
"(",
"StateDescriptor",
"<",
"S",
",",
"?",
">",
"stateDescriptor",
")",
"throws",
"Exception",
"{",
"return",
"getPartitionedState",
"(",
"VoidNamespace",
".",
"INSTANCE",
",",
"VoidNam... | Creates a partitioned state handle, using the state backend configured for this task.
@throws IllegalStateException Thrown, if the key/value state was already initialized.
@throws Exception Thrown, if the state backend cannot create the key/value state. | [
"Creates",
"a",
"partitioned",
"state",
"handle",
"using",
"the",
"state",
"backend",
"configured",
"for",
"this",
"task",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/operators/AbstractStreamOperator.java#L559-L561 |
jenkinsci/artifactory-plugin | src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerUtils.java | DockerUtils.pullImage | public static void pullImage(String imageTag, String username, String password, String host) throws IOException {
final AuthConfig authConfig = new AuthConfig();
authConfig.withUsername(username);
authConfig.withPassword(password);
DockerClient dockerClient = null;
try {
dockerClient = getDockerClient(host);
dockerClient.pullImageCmd(imageTag).withAuthConfig(authConfig).exec(new PullImageResultCallback()).awaitSuccess();
} finally {
closeQuietly(dockerClient);
}
} | java | public static void pullImage(String imageTag, String username, String password, String host) throws IOException {
final AuthConfig authConfig = new AuthConfig();
authConfig.withUsername(username);
authConfig.withPassword(password);
DockerClient dockerClient = null;
try {
dockerClient = getDockerClient(host);
dockerClient.pullImageCmd(imageTag).withAuthConfig(authConfig).exec(new PullImageResultCallback()).awaitSuccess();
} finally {
closeQuietly(dockerClient);
}
} | [
"public",
"static",
"void",
"pullImage",
"(",
"String",
"imageTag",
",",
"String",
"username",
",",
"String",
"password",
",",
"String",
"host",
")",
"throws",
"IOException",
"{",
"final",
"AuthConfig",
"authConfig",
"=",
"new",
"AuthConfig",
"(",
")",
";",
... | Pull docker image using the docker java client.
@param imageTag
@param username
@param password
@param host | [
"Pull",
"docker",
"image",
"using",
"the",
"docker",
"java",
"client",
"."
] | train | https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/pipeline/common/docker/utils/DockerUtils.java#L74-L86 |
alkacon/opencms-core | src/org/opencms/workplace/CmsWorkplaceSettings.java | CmsWorkplaceSettings.setTreeSite | public void setTreeSite(String type, String value) {
if (value == null) {
return;
}
m_treeSite.put(type, value);
} | java | public void setTreeSite(String type, String value) {
if (value == null) {
return;
}
m_treeSite.put(type, value);
} | [
"public",
"void",
"setTreeSite",
"(",
"String",
"type",
",",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
";",
"}",
"m_treeSite",
".",
"put",
"(",
"type",
",",
"value",
")",
";",
"}"
] | Sets the tree resource uri for the specified tree type.<p>
@param type the type of the tree
@param value the resource uri to set for the type | [
"Sets",
"the",
"tree",
"resource",
"uri",
"for",
"the",
"specified",
"tree",
"type",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplaceSettings.java#L769-L775 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/action/toolbar/ToolbarRegistry.java | ToolbarRegistry.getToolbarAction | public static ToolbarBaseAction getToolbarAction(String key, MapWidget mapWidget) {
ToolCreator toolCreator = REGISTRY.get(key);
if (null == toolCreator) {
return null;
}
return toolCreator.createTool(mapWidget);
} | java | public static ToolbarBaseAction getToolbarAction(String key, MapWidget mapWidget) {
ToolCreator toolCreator = REGISTRY.get(key);
if (null == toolCreator) {
return null;
}
return toolCreator.createTool(mapWidget);
} | [
"public",
"static",
"ToolbarBaseAction",
"getToolbarAction",
"(",
"String",
"key",
",",
"MapWidget",
"mapWidget",
")",
"{",
"ToolCreator",
"toolCreator",
"=",
"REGISTRY",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"null",
"==",
"toolCreator",
")",
"{",
"re... | Get the toolbar action which matches the given key.
@param key
key for toolbar action
@param mapWidget
map which will contain this tool
@return toolbar action or null when key not found | [
"Get",
"the",
"toolbar",
"action",
"which",
"matches",
"the",
"given",
"key",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/action/toolbar/ToolbarRegistry.java#L179-L185 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/raw/KeyDecoder.java | KeyDecoder.decodeSingleDesc | public static byte[] decodeSingleDesc(byte[] src, int prefixPadding, int suffixPadding)
throws CorruptEncodingException
{
try {
int length = src.length - suffixPadding - prefixPadding;
if (length == 0) {
return EMPTY_BYTE_ARRAY;
}
byte[] dst = new byte[length];
while (--length >= 0) {
dst[length] = (byte) (~src[prefixPadding + length]);
}
return dst;
} catch (IndexOutOfBoundsException e) {
throw new CorruptEncodingException(null, e);
}
} | java | public static byte[] decodeSingleDesc(byte[] src, int prefixPadding, int suffixPadding)
throws CorruptEncodingException
{
try {
int length = src.length - suffixPadding - prefixPadding;
if (length == 0) {
return EMPTY_BYTE_ARRAY;
}
byte[] dst = new byte[length];
while (--length >= 0) {
dst[length] = (byte) (~src[prefixPadding + length]);
}
return dst;
} catch (IndexOutOfBoundsException e) {
throw new CorruptEncodingException(null, e);
}
} | [
"public",
"static",
"byte",
"[",
"]",
"decodeSingleDesc",
"(",
"byte",
"[",
"]",
"src",
",",
"int",
"prefixPadding",
",",
"int",
"suffixPadding",
")",
"throws",
"CorruptEncodingException",
"{",
"try",
"{",
"int",
"length",
"=",
"src",
".",
"length",
"-",
"... | Decodes the given byte array which was encoded by {@link
KeyEncoder#encodeSingleDesc}. Always returns a new byte array instance.
@param prefixPadding amount of extra bytes to skip from start of encoded byte array
@param suffixPadding amount of extra bytes to skip at end of encoded byte array | [
"Decodes",
"the",
"given",
"byte",
"array",
"which",
"was",
"encoded",
"by",
"{",
"@link",
"KeyEncoder#encodeSingleDesc",
"}",
".",
"Always",
"returns",
"a",
"new",
"byte",
"array",
"instance",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/KeyDecoder.java#L846-L862 |
killbill/killbill | invoice/src/main/java/org/killbill/billing/invoice/tree/ItemsNodeInterval.java | ItemsNodeInterval.addAdjustment | public Item addAdjustment(final InvoiceItem item, final UUID targetInvoiceId) {
final UUID targetId = item.getLinkedItemId();
final NodeInterval node = findNode(new SearchCallback() {
@Override
public boolean isMatch(final NodeInterval curNode) {
return ((ItemsNodeInterval) curNode).getItemsInterval().findItem(targetId) != null;
}
});
Preconditions.checkNotNull(node, "Unable to find item interval for id='%s', tree=%s", targetId, this);
final ItemsInterval targetItemsInterval = ((ItemsNodeInterval) node).getItemsInterval();
final Item targetItem = targetItemsInterval.findItem(targetId);
Preconditions.checkNotNull(targetItem, "Unable to find item with id='%s', itemsInterval=%s", targetId, targetItemsInterval);
final BigDecimal adjustmentAmount = item.getAmount().negate();
if (targetItem.getAmount().compareTo(adjustmentAmount) == 0) {
// Full item adjustment - treat it like a repair
addExistingItem(new ItemsNodeInterval(this, new Item(item, targetItem.getStartDate(), targetItem.getEndDate(), targetInvoiceId, ItemAction.CANCEL)));
return targetItem;
} else {
targetItem.incrementAdjustedAmount(adjustmentAmount);
return null;
}
} | java | public Item addAdjustment(final InvoiceItem item, final UUID targetInvoiceId) {
final UUID targetId = item.getLinkedItemId();
final NodeInterval node = findNode(new SearchCallback() {
@Override
public boolean isMatch(final NodeInterval curNode) {
return ((ItemsNodeInterval) curNode).getItemsInterval().findItem(targetId) != null;
}
});
Preconditions.checkNotNull(node, "Unable to find item interval for id='%s', tree=%s", targetId, this);
final ItemsInterval targetItemsInterval = ((ItemsNodeInterval) node).getItemsInterval();
final Item targetItem = targetItemsInterval.findItem(targetId);
Preconditions.checkNotNull(targetItem, "Unable to find item with id='%s', itemsInterval=%s", targetId, targetItemsInterval);
final BigDecimal adjustmentAmount = item.getAmount().negate();
if (targetItem.getAmount().compareTo(adjustmentAmount) == 0) {
// Full item adjustment - treat it like a repair
addExistingItem(new ItemsNodeInterval(this, new Item(item, targetItem.getStartDate(), targetItem.getEndDate(), targetInvoiceId, ItemAction.CANCEL)));
return targetItem;
} else {
targetItem.incrementAdjustedAmount(adjustmentAmount);
return null;
}
} | [
"public",
"Item",
"addAdjustment",
"(",
"final",
"InvoiceItem",
"item",
",",
"final",
"UUID",
"targetInvoiceId",
")",
"{",
"final",
"UUID",
"targetId",
"=",
"item",
".",
"getLinkedItemId",
"(",
")",
";",
"final",
"NodeInterval",
"node",
"=",
"findNode",
"(",
... | Add the adjustment amount on the item specified by the targetId.
@return linked item if fully adjusted, null otherwise | [
"Add",
"the",
"adjustment",
"amount",
"on",
"the",
"item",
"specified",
"by",
"the",
"targetId",
"."
] | train | https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/invoice/src/main/java/org/killbill/billing/invoice/tree/ItemsNodeInterval.java#L203-L227 |
apache/groovy | src/main/java/org/codehaus/groovy/vmplugin/v7/TypeTransformers.java | TypeTransformers.addTransformer | protected static MethodHandle addTransformer(MethodHandle handle, int pos, Object arg, Class parameter) {
MethodHandle transformer=null;
if (arg instanceof GString) {
transformer = TO_STRING;
} else if (arg instanceof Closure) {
transformer = createSAMTransform(arg, parameter);
} else if (Number.class.isAssignableFrom(parameter)) {
transformer = selectNumberTransformer(parameter, arg);
} else if (parameter.isArray()) {
transformer = MethodHandles.insertArguments(AS_ARRAY, 1, parameter);
}
if (transformer==null) throw new GroovyBugError("Unknown transformation for argument "+arg+" at position "+pos+" with "+arg.getClass()+" for parameter of type "+parameter);
return applyUnsharpFilter(handle, pos, transformer);
} | java | protected static MethodHandle addTransformer(MethodHandle handle, int pos, Object arg, Class parameter) {
MethodHandle transformer=null;
if (arg instanceof GString) {
transformer = TO_STRING;
} else if (arg instanceof Closure) {
transformer = createSAMTransform(arg, parameter);
} else if (Number.class.isAssignableFrom(parameter)) {
transformer = selectNumberTransformer(parameter, arg);
} else if (parameter.isArray()) {
transformer = MethodHandles.insertArguments(AS_ARRAY, 1, parameter);
}
if (transformer==null) throw new GroovyBugError("Unknown transformation for argument "+arg+" at position "+pos+" with "+arg.getClass()+" for parameter of type "+parameter);
return applyUnsharpFilter(handle, pos, transformer);
} | [
"protected",
"static",
"MethodHandle",
"addTransformer",
"(",
"MethodHandle",
"handle",
",",
"int",
"pos",
",",
"Object",
"arg",
",",
"Class",
"parameter",
")",
"{",
"MethodHandle",
"transformer",
"=",
"null",
";",
"if",
"(",
"arg",
"instanceof",
"GString",
")... | Adds a type transformer applied at runtime.
This method handles transformations to String from GString,
array transformations and number based transformations | [
"Adds",
"a",
"type",
"transformer",
"applied",
"at",
"runtime",
".",
"This",
"method",
"handles",
"transformations",
"to",
"String",
"from",
"GString",
"array",
"transformations",
"and",
"number",
"based",
"transformations"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/vmplugin/v7/TypeTransformers.java#L126-L139 |
patrickfav/Dali | dali/src/main/java/at/favre/lib/dali/util/BuilderUtil.java | BuilderUtil.getIBlurAlgorithm | public static IBlur getIBlurAlgorithm(EBlurAlgorithm algorithm, ContextWrapper contextWrapper) {
RenderScript rs = contextWrapper.getRenderScript();
Context ctx = contextWrapper.getContext();
switch (algorithm) {
case RS_GAUSS_FAST:
return new RenderScriptGaussianBlur(rs);
case RS_BOX_5x5:
return new RenderScriptBox5x5Blur(rs);
case RS_GAUSS_5x5:
return new RenderScriptGaussian5x5Blur(rs);
case RS_STACKBLUR:
return new RenderScriptStackBlur(rs, ctx);
case STACKBLUR:
return new StackBlur();
case GAUSS_FAST:
return new GaussianFastBlur();
case BOX_BLUR:
return new BoxBlur();
default:
return new IgnoreBlur();
}
} | java | public static IBlur getIBlurAlgorithm(EBlurAlgorithm algorithm, ContextWrapper contextWrapper) {
RenderScript rs = contextWrapper.getRenderScript();
Context ctx = contextWrapper.getContext();
switch (algorithm) {
case RS_GAUSS_FAST:
return new RenderScriptGaussianBlur(rs);
case RS_BOX_5x5:
return new RenderScriptBox5x5Blur(rs);
case RS_GAUSS_5x5:
return new RenderScriptGaussian5x5Blur(rs);
case RS_STACKBLUR:
return new RenderScriptStackBlur(rs, ctx);
case STACKBLUR:
return new StackBlur();
case GAUSS_FAST:
return new GaussianFastBlur();
case BOX_BLUR:
return new BoxBlur();
default:
return new IgnoreBlur();
}
} | [
"public",
"static",
"IBlur",
"getIBlurAlgorithm",
"(",
"EBlurAlgorithm",
"algorithm",
",",
"ContextWrapper",
"contextWrapper",
")",
"{",
"RenderScript",
"rs",
"=",
"contextWrapper",
".",
"getRenderScript",
"(",
")",
";",
"Context",
"ctx",
"=",
"contextWrapper",
".",... | Creates an IBlur instance for the given algorithm enum
@param algorithm
@param contextWrapper
@return | [
"Creates",
"an",
"IBlur",
"instance",
"for",
"the",
"given",
"algorithm",
"enum"
] | train | https://github.com/patrickfav/Dali/blob/4c90a8c174517873844638d4b8349d890453cc17/dali/src/main/java/at/favre/lib/dali/util/BuilderUtil.java#L40-L62 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java | DocTreeMaker.newDocCommentTree | @Override @DefinedBy(Api.COMPILER_TREE)
public DCDocComment newDocCommentTree(List<? extends DocTree> fullBody, List<? extends DocTree> tags) {
ListBuffer<DCTree> lb = new ListBuffer<>();
lb.addAll(cast(fullBody));
List<DCTree> fBody = lb.toList();
// A dummy comment to keep the diagnostics logic happy.
Comment c = new Comment() {
@Override
public String getText() {
return null;
}
@Override
public int getSourcePos(int index) {
return Position.NOPOS;
}
@Override
public CommentStyle getStyle() {
return CommentStyle.JAVADOC;
}
@Override
public boolean isDeprecated() {
return false;
}
};
Pair<List<DCTree>, List<DCTree>> pair = splitBody(fullBody);
DCDocComment tree = new DCDocComment(c, fBody, pair.fst, pair.snd, cast(tags));
return tree;
} | java | @Override @DefinedBy(Api.COMPILER_TREE)
public DCDocComment newDocCommentTree(List<? extends DocTree> fullBody, List<? extends DocTree> tags) {
ListBuffer<DCTree> lb = new ListBuffer<>();
lb.addAll(cast(fullBody));
List<DCTree> fBody = lb.toList();
// A dummy comment to keep the diagnostics logic happy.
Comment c = new Comment() {
@Override
public String getText() {
return null;
}
@Override
public int getSourcePos(int index) {
return Position.NOPOS;
}
@Override
public CommentStyle getStyle() {
return CommentStyle.JAVADOC;
}
@Override
public boolean isDeprecated() {
return false;
}
};
Pair<List<DCTree>, List<DCTree>> pair = splitBody(fullBody);
DCDocComment tree = new DCDocComment(c, fBody, pair.fst, pair.snd, cast(tags));
return tree;
} | [
"@",
"Override",
"@",
"DefinedBy",
"(",
"Api",
".",
"COMPILER_TREE",
")",
"public",
"DCDocComment",
"newDocCommentTree",
"(",
"List",
"<",
"?",
"extends",
"DocTree",
">",
"fullBody",
",",
"List",
"<",
"?",
"extends",
"DocTree",
">",
"tags",
")",
"{",
"List... | /*
Primarily to produce a DocCommenTree when given a
first sentence and a body, this is useful, in cases
where the trees are being synthesized by a tool. | [
"/",
"*",
"Primarily",
"to",
"produce",
"a",
"DocCommenTree",
"when",
"given",
"a",
"first",
"sentence",
"and",
"a",
"body",
"this",
"is",
"useful",
"in",
"cases",
"where",
"the",
"trees",
"are",
"being",
"synthesized",
"by",
"a",
"tool",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/DocTreeMaker.java#L209-L240 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/bos/BosClient.java | BosClient.putObject | public PutObjectResponse putObject(String bucketName, String key, byte[] value) {
return this.putObject(bucketName, key, value, new ObjectMetadata());
} | java | public PutObjectResponse putObject(String bucketName, String key, byte[] value) {
return this.putObject(bucketName, key, value, new ObjectMetadata());
} | [
"public",
"PutObjectResponse",
"putObject",
"(",
"String",
"bucketName",
",",
"String",
"key",
",",
"byte",
"[",
"]",
"value",
")",
"{",
"return",
"this",
".",
"putObject",
"(",
"bucketName",
",",
"key",
",",
"value",
",",
"new",
"ObjectMetadata",
"(",
")"... | Uploads the specified bytes to Bos under the specified bucket and key name.
@param bucketName The name of an existing bucket, to which you have Write permission.
@param key The key under which to store the specified file.
@param value The bytes containing the value to be uploaded to Bos.
@return A PutObjectResponse object containing the information returned by Bos for the newly created object. | [
"Uploads",
"the",
"specified",
"bytes",
"to",
"Bos",
"under",
"the",
"specified",
"bucket",
"and",
"key",
"name",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/bos/BosClient.java#L848-L850 |
hypercube1024/firefly | firefly/src/main/java/com/firefly/client/http2/SimpleHTTPClient.java | SimpleHTTPClient.getConnectionPoolSize | public int getConnectionPoolSize(String host, int port) {
RequestBuilder req = new RequestBuilder();
req.host = host;
req.port = port;
return _getPoolSize(req);
} | java | public int getConnectionPoolSize(String host, int port) {
RequestBuilder req = new RequestBuilder();
req.host = host;
req.port = port;
return _getPoolSize(req);
} | [
"public",
"int",
"getConnectionPoolSize",
"(",
"String",
"host",
",",
"int",
"port",
")",
"{",
"RequestBuilder",
"req",
"=",
"new",
"RequestBuilder",
"(",
")",
";",
"req",
".",
"host",
"=",
"host",
";",
"req",
".",
"port",
"=",
"port",
";",
"return",
"... | Get the HTTP connection pool size.
@param host The host name.
@param port The target port.
@return The HTTP connection pool size. | [
"Get",
"the",
"HTTP",
"connection",
"pool",
"size",
"."
] | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/client/http2/SimpleHTTPClient.java#L744-L749 |
michael-rapp/AndroidUtil | library/src/main/java/de/mrapp/android/util/multithreading/AbstractDataBinder.java | AbstractDataBinder.cacheData | private void cacheData(@NonNull final KeyType key, @NonNull final DataType data) {
synchronized (cache) {
if (useCache) {
cache.put(key, data);
}
}
} | java | private void cacheData(@NonNull final KeyType key, @NonNull final DataType data) {
synchronized (cache) {
if (useCache) {
cache.put(key, data);
}
}
} | [
"private",
"void",
"cacheData",
"(",
"@",
"NonNull",
"final",
"KeyType",
"key",
",",
"@",
"NonNull",
"final",
"DataType",
"data",
")",
"{",
"synchronized",
"(",
"cache",
")",
"{",
"if",
"(",
"useCache",
")",
"{",
"cache",
".",
"put",
"(",
"key",
",",
... | Adds the data, which corresponds to a specific key, to the cache, if caching is enabled.
@param key
The key of the data, which should be added to the cache, as an instance of the
generic type KeyType. The key may not be null
@param data
The data, which should be added to the cache, as an instance of the generic type
DataType. The data may not be null | [
"Adds",
"the",
"data",
"which",
"corresponds",
"to",
"a",
"specific",
"key",
"to",
"the",
"cache",
"if",
"caching",
"is",
"enabled",
"."
] | train | https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/multithreading/AbstractDataBinder.java#L334-L340 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/WebElementCreator.java | WebElementCreator.setLocation | private void setLocation(WebElement webElement, WebView webView, int x, int y, int width, int height ){
float scale = webView.getScale();
int[] locationOfWebViewXY = new int[2];
webView.getLocationOnScreen(locationOfWebViewXY);
int locationX = (int) (locationOfWebViewXY[0] + (x + (Math.floor(width / 2))) * scale);
int locationY = (int) (locationOfWebViewXY[1] + (y + (Math.floor(height / 2))) * scale);
webElement.setLocationX(locationX);
webElement.setLocationY(locationY);
} | java | private void setLocation(WebElement webElement, WebView webView, int x, int y, int width, int height ){
float scale = webView.getScale();
int[] locationOfWebViewXY = new int[2];
webView.getLocationOnScreen(locationOfWebViewXY);
int locationX = (int) (locationOfWebViewXY[0] + (x + (Math.floor(width / 2))) * scale);
int locationY = (int) (locationOfWebViewXY[1] + (y + (Math.floor(height / 2))) * scale);
webElement.setLocationX(locationX);
webElement.setLocationY(locationY);
} | [
"private",
"void",
"setLocation",
"(",
"WebElement",
"webElement",
",",
"WebView",
"webView",
",",
"int",
"x",
",",
"int",
"y",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"float",
"scale",
"=",
"webView",
".",
"getScale",
"(",
")",
";",
"int"... | Sets the location of a {@code WebElement}
@param webElement the {@code TextView} object to set location
@param webView the {@code WebView} the text is shown in
@param x the x location to set
@param y the y location to set
@param width the width to set
@param height the height to set | [
"Sets",
"the",
"location",
"of",
"a",
"{",
"@code",
"WebElement",
"}"
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/WebElementCreator.java#L103-L113 |
MTDdk/jawn | jawn-core/src/main/java/net/javapla/jawn/core/Controller.java | Controller.outputStream | public OutputStream outputStream(String contentType, Map<String, String> headers, int status) {
Result result = ResultBuilder.noBody(status).contentType(contentType);
headers.entrySet().forEach(header -> result.addHeader(header.getKey(), header.getValue()));
setControllerResult(result);
try {
//return context.responseOutputStream(); //TODO not possible, is it?
return context.responseOutputStream(result);
} catch(Exception e) {
throw new ControllerException(e);
}
} | java | public OutputStream outputStream(String contentType, Map<String, String> headers, int status) {
Result result = ResultBuilder.noBody(status).contentType(contentType);
headers.entrySet().forEach(header -> result.addHeader(header.getKey(), header.getValue()));
setControllerResult(result);
try {
//return context.responseOutputStream(); //TODO not possible, is it?
return context.responseOutputStream(result);
} catch(Exception e) {
throw new ControllerException(e);
}
} | [
"public",
"OutputStream",
"outputStream",
"(",
"String",
"contentType",
",",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
",",
"int",
"status",
")",
"{",
"Result",
"result",
"=",
"ResultBuilder",
".",
"noBody",
"(",
"status",
")",
".",
"contentType",... | Use to send raw data to HTTP client.
@param contentType content type
@param headers set of headers.
@param status status.
@return instance of output stream to send raw data directly to HTTP client. | [
"Use",
"to",
"send",
"raw",
"data",
"to",
"HTTP",
"client",
"."
] | train | https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core/src/main/java/net/javapla/jawn/core/Controller.java#L1522-L1533 |
hdbeukel/james-core | src/main/java/org/jamesframework/core/subset/neigh/SinglePerturbationNeighbourhood.java | SinglePerturbationNeighbourhood.canRemove | private boolean canRemove(SubsetSolution solution, Set<Integer> deleteCandidates){
return !deleteCandidates.isEmpty()
&& isValidSubsetSize(solution.getNumSelectedIDs()-1);
} | java | private boolean canRemove(SubsetSolution solution, Set<Integer> deleteCandidates){
return !deleteCandidates.isEmpty()
&& isValidSubsetSize(solution.getNumSelectedIDs()-1);
} | [
"private",
"boolean",
"canRemove",
"(",
"SubsetSolution",
"solution",
",",
"Set",
"<",
"Integer",
">",
"deleteCandidates",
")",
"{",
"return",
"!",
"deleteCandidates",
".",
"isEmpty",
"(",
")",
"&&",
"isValidSubsetSize",
"(",
"solution",
".",
"getNumSelectedIDs",
... | Check if it is allowed to remove one more item from the selection.
@param solution solution for which moves are generated
@param deleteCandidates set of candidate IDs to be deleted
@return <code>true</code> if it is allowed to remove an item from the selection | [
"Check",
"if",
"it",
"is",
"allowed",
"to",
"remove",
"one",
"more",
"item",
"from",
"the",
"selection",
"."
] | train | https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/subset/neigh/SinglePerturbationNeighbourhood.java#L233-L236 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/ActionsConfig.java | ActionsConfig.exports | private static void exports(Xml node, ActionRef action)
{
final Xml nodeAction = node.createChild(NODE_ACTION);
nodeAction.writeString(ATT_PATH, action.getPath());
for (final ActionRef ref : action.getRefs())
{
exports(nodeAction, ref);
}
} | java | private static void exports(Xml node, ActionRef action)
{
final Xml nodeAction = node.createChild(NODE_ACTION);
nodeAction.writeString(ATT_PATH, action.getPath());
for (final ActionRef ref : action.getRefs())
{
exports(nodeAction, ref);
}
} | [
"private",
"static",
"void",
"exports",
"(",
"Xml",
"node",
",",
"ActionRef",
"action",
")",
"{",
"final",
"Xml",
"nodeAction",
"=",
"node",
".",
"createChild",
"(",
"NODE_ACTION",
")",
";",
"nodeAction",
".",
"writeString",
"(",
"ATT_PATH",
",",
"action",
... | Export the action.
@param node The xml node (must not be <code>null</code>).
@param action The action to export (must not be <code>null</code>).
@throws LionEngineException If unable to write node. | [
"Export",
"the",
"action",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/ActionsConfig.java#L139-L148 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Math.java | Math.copySign | public static double copySign(double magnitude, double sign) {
return Double.longBitsToDouble((Double.doubleToRawLongBits(sign) &
(DoubleConsts.SIGN_BIT_MASK)) |
(Double.doubleToRawLongBits(magnitude) &
(DoubleConsts.EXP_BIT_MASK |
DoubleConsts.SIGNIF_BIT_MASK)));
} | java | public static double copySign(double magnitude, double sign) {
return Double.longBitsToDouble((Double.doubleToRawLongBits(sign) &
(DoubleConsts.SIGN_BIT_MASK)) |
(Double.doubleToRawLongBits(magnitude) &
(DoubleConsts.EXP_BIT_MASK |
DoubleConsts.SIGNIF_BIT_MASK)));
} | [
"public",
"static",
"double",
"copySign",
"(",
"double",
"magnitude",
",",
"double",
"sign",
")",
"{",
"return",
"Double",
".",
"longBitsToDouble",
"(",
"(",
"Double",
".",
"doubleToRawLongBits",
"(",
"sign",
")",
"&",
"(",
"DoubleConsts",
".",
"SIGN_BIT_MASK"... | Returns the first floating-point argument with the sign of the
second floating-point argument. Note that unlike the {@link
StrictMath#copySign(double, double) StrictMath.copySign}
method, this method does not require NaN {@code sign}
arguments to be treated as positive values; implementations are
permitted to treat some NaN arguments as positive and other NaN
arguments as negative to allow greater performance.
@param magnitude the parameter providing the magnitude of the result
@param sign the parameter providing the sign of the result
@return a value with the magnitude of {@code magnitude}
and the sign of {@code sign}.
@since 1.6 | [
"Returns",
"the",
"first",
"floating",
"-",
"point",
"argument",
"with",
"the",
"sign",
"of",
"the",
"second",
"floating",
"-",
"point",
"argument",
".",
"Note",
"that",
"unlike",
"the",
"{",
"@link",
"StrictMath#copySign",
"(",
"double",
"double",
")",
"Str... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Math.java#L1770-L1776 |
cverges/expect4j | src/main/java/expect4j/ConsumerImpl.java | ConsumerImpl.notifyBufferChange | protected void notifyBufferChange(char[] newData, int numChars) {
synchronized(bufferChangeLoggers) {
Iterator<BufferChangeLogger> iterator = bufferChangeLoggers.iterator();
while (iterator.hasNext()) {
iterator.next().bufferChanged(newData, numChars);
}
}
} | java | protected void notifyBufferChange(char[] newData, int numChars) {
synchronized(bufferChangeLoggers) {
Iterator<BufferChangeLogger> iterator = bufferChangeLoggers.iterator();
while (iterator.hasNext()) {
iterator.next().bufferChanged(newData, numChars);
}
}
} | [
"protected",
"void",
"notifyBufferChange",
"(",
"char",
"[",
"]",
"newData",
",",
"int",
"numChars",
")",
"{",
"synchronized",
"(",
"bufferChangeLoggers",
")",
"{",
"Iterator",
"<",
"BufferChangeLogger",
">",
"iterator",
"=",
"bufferChangeLoggers",
".",
"iterator"... | Notifies all registered BufferChangeLogger instances of a change.
@param newData the buffer that contains the new data being added
@param numChars the number of valid characters in the buffer | [
"Notifies",
"all",
"registered",
"BufferChangeLogger",
"instances",
"of",
"a",
"change",
"."
] | train | https://github.com/cverges/expect4j/blob/97b1da9b7bd231344cd7b7ce26d14caf8bb16cd6/src/main/java/expect4j/ConsumerImpl.java#L175-L182 |
berkesa/datatree | src/main/java/io/datatree/Tree.java | Tree.putList | public Tree putList(String path, boolean putIfAbsent) {
return putObjectInternal(path, new LinkedList<Object>(), putIfAbsent);
} | java | public Tree putList(String path, boolean putIfAbsent) {
return putObjectInternal(path, new LinkedList<Object>(), putIfAbsent);
} | [
"public",
"Tree",
"putList",
"(",
"String",
"path",
",",
"boolean",
"putIfAbsent",
")",
"{",
"return",
"putObjectInternal",
"(",
"path",
",",
"new",
"LinkedList",
"<",
"Object",
">",
"(",
")",
",",
"putIfAbsent",
")",
";",
"}"
] | Associates the specified List (~= JSON array) container with the
specified path. If the structure previously contained a mapping for the
path, the old value is replaced. Sample code:<br>
<br>
Tree node = new Tree();<br>
<br>
Tree list1 = node.putList("a.b.c");<br>
list1.add(1).add(2).add(3);<br>
<br>
Tree list2 = node.putList("a.b.c", true);<br>
list2.add(4).add(5).add(6);<br>
<br>
The "list2" contains 1, 2, 3, 4, 5 and 6.
@param path
path with which the specified List is to be associated
@param putIfAbsent
if true and the specified key is not already associated with a
value associates it with the given value and returns the new
List, else returns the previous List
@return Tree of the new List | [
"Associates",
"the",
"specified",
"List",
"(",
"~",
"=",
"JSON",
"array",
")",
"container",
"with",
"the",
"specified",
"path",
".",
"If",
"the",
"structure",
"previously",
"contained",
"a",
"mapping",
"for",
"the",
"path",
"the",
"old",
"value",
"is",
"re... | train | https://github.com/berkesa/datatree/blob/79aea9b45c7b46ab28af0a09310bc01c421c6b3a/src/main/java/io/datatree/Tree.java#L2078-L2080 |
grails/grails-core | grails-core/src/main/groovy/grails/plugins/DefaultGrailsPluginManager.java | DefaultGrailsPluginManager.isDependentOn | private boolean isDependentOn(GrailsPlugin plugin, GrailsPlugin dependency) {
for (String name : plugin.getDependencyNames()) {
String requiredVersion = plugin.getDependentVersion(name);
if (name.equals(dependency.getName()) &&
GrailsVersionUtils.isValidVersion(dependency.getVersion(), requiredVersion))
return true;
}
return false;
} | java | private boolean isDependentOn(GrailsPlugin plugin, GrailsPlugin dependency) {
for (String name : plugin.getDependencyNames()) {
String requiredVersion = plugin.getDependentVersion(name);
if (name.equals(dependency.getName()) &&
GrailsVersionUtils.isValidVersion(dependency.getVersion(), requiredVersion))
return true;
}
return false;
} | [
"private",
"boolean",
"isDependentOn",
"(",
"GrailsPlugin",
"plugin",
",",
"GrailsPlugin",
"dependency",
")",
"{",
"for",
"(",
"String",
"name",
":",
"plugin",
".",
"getDependencyNames",
"(",
")",
")",
"{",
"String",
"requiredVersion",
"=",
"plugin",
".",
"get... | Checks whether the first plugin is dependant on the second plugin.
@param plugin The plugin to check
@param dependency The plugin which the first argument may be dependant on
@return true if it is | [
"Checks",
"whether",
"the",
"first",
"plugin",
"is",
"dependant",
"on",
"the",
"second",
"plugin",
"."
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/plugins/DefaultGrailsPluginManager.java#L561-L570 |
lagom/lagom | service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/transport/TransportErrorCode.java | TransportErrorCode.fromHttp | public static TransportErrorCode fromHttp(int code) {
TransportErrorCode builtIn = HTTP_ERROR_CODE_MAP.get(code);
if (builtIn == null) {
if (code > 599 || code < 100) {
throw new IllegalArgumentException("Invalid http status code: " + code);
} else if (code < 400) {
throw new IllegalArgumentException("Invalid http error code: " + code);
} else {
return new TransportErrorCode(code, 4000 + code, "Unknown error code");
}
} else {
return builtIn;
}
} | java | public static TransportErrorCode fromHttp(int code) {
TransportErrorCode builtIn = HTTP_ERROR_CODE_MAP.get(code);
if (builtIn == null) {
if (code > 599 || code < 100) {
throw new IllegalArgumentException("Invalid http status code: " + code);
} else if (code < 400) {
throw new IllegalArgumentException("Invalid http error code: " + code);
} else {
return new TransportErrorCode(code, 4000 + code, "Unknown error code");
}
} else {
return builtIn;
}
} | [
"public",
"static",
"TransportErrorCode",
"fromHttp",
"(",
"int",
"code",
")",
"{",
"TransportErrorCode",
"builtIn",
"=",
"HTTP_ERROR_CODE_MAP",
".",
"get",
"(",
"code",
")",
";",
"if",
"(",
"builtIn",
"==",
"null",
")",
"{",
"if",
"(",
"code",
">",
"599",... | Get a transport error code from the given HTTP error code.
@param code The HTTP error code, must be between 400 and 599 inclusive.
@return The transport error code.
@throws IllegalArgumentException if the HTTP code was not between 400 and 599. | [
"Get",
"a",
"transport",
"error",
"code",
"from",
"the",
"given",
"HTTP",
"error",
"code",
"."
] | train | https://github.com/lagom/lagom/blob/3763055a9d1aace793a5d970f4e688aea61b1a5a/service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/transport/TransportErrorCode.java#L142-L155 |
mikepenz/MaterialDrawer | library/src/main/java/com/mikepenz/materialdrawer/holder/ImageHolder.java | ImageHolder.decideIcon | public Drawable decideIcon(Context ctx, int iconColor, boolean tint, int paddingDp) {
Drawable icon = getIcon();
if (mIIcon != null) {
icon = new IconicsDrawable(ctx, mIIcon).color(iconColor).sizeDp(24).paddingDp(paddingDp);
} else if (getIconRes() != -1) {
icon = AppCompatResources.getDrawable(ctx, getIconRes());
} else if (getUri() != null) {
try {
InputStream inputStream = ctx.getContentResolver().openInputStream(getUri());
icon = Drawable.createFromStream(inputStream, getUri().toString());
} catch (FileNotFoundException e) {
//no need to handle this
}
}
//if we got an icon AND we have auto tinting enabled AND it is no IIcon, tint it ;)
if (icon != null && tint && mIIcon == null) {
icon = icon.mutate();
icon.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN);
}
return icon;
} | java | public Drawable decideIcon(Context ctx, int iconColor, boolean tint, int paddingDp) {
Drawable icon = getIcon();
if (mIIcon != null) {
icon = new IconicsDrawable(ctx, mIIcon).color(iconColor).sizeDp(24).paddingDp(paddingDp);
} else if (getIconRes() != -1) {
icon = AppCompatResources.getDrawable(ctx, getIconRes());
} else if (getUri() != null) {
try {
InputStream inputStream = ctx.getContentResolver().openInputStream(getUri());
icon = Drawable.createFromStream(inputStream, getUri().toString());
} catch (FileNotFoundException e) {
//no need to handle this
}
}
//if we got an icon AND we have auto tinting enabled AND it is no IIcon, tint it ;)
if (icon != null && tint && mIIcon == null) {
icon = icon.mutate();
icon.setColorFilter(iconColor, PorterDuff.Mode.SRC_IN);
}
return icon;
} | [
"public",
"Drawable",
"decideIcon",
"(",
"Context",
"ctx",
",",
"int",
"iconColor",
",",
"boolean",
"tint",
",",
"int",
"paddingDp",
")",
"{",
"Drawable",
"icon",
"=",
"getIcon",
"(",
")",
";",
"if",
"(",
"mIIcon",
"!=",
"null",
")",
"{",
"icon",
"=",
... | this only handles Drawables
@param ctx
@param iconColor
@param tint
@return | [
"this",
"only",
"handles",
"Drawables"
] | train | https://github.com/mikepenz/MaterialDrawer/blob/f4fb31635767edead0a01cee7b7588942b89d8d9/library/src/main/java/com/mikepenz/materialdrawer/holder/ImageHolder.java#L97-L120 |
sdl/Testy | src/main/java/com/sdl/selenium/extjs6/form/DateField.java | DateField.setDate | private boolean setDate(String day, String month, String year) {
String fullDate = RetryUtils.retry(4, () -> monthYearButton.getText()).trim();
if (!fullDate.contains(month) || !fullDate.contains(year)) {
monthYearButton.click();
if (!yearAndMonth.ready()) {
monthYearButton.click();
}
goToYear(year, fullDate);
WebLink monthEl = new WebLink(monthContainer).setText(month, SearchType.EQUALS).setInfoMessage("month " + month);
monthEl.click();
selectOkButton.click();
}
WebLocator dayEl = new WebLocator(dayContainer).setText(day, SearchType.EQUALS).setVisibility(true).setInfoMessage("day " + day);
Utils.sleep(50);
return dayEl.click();
} | java | private boolean setDate(String day, String month, String year) {
String fullDate = RetryUtils.retry(4, () -> monthYearButton.getText()).trim();
if (!fullDate.contains(month) || !fullDate.contains(year)) {
monthYearButton.click();
if (!yearAndMonth.ready()) {
monthYearButton.click();
}
goToYear(year, fullDate);
WebLink monthEl = new WebLink(monthContainer).setText(month, SearchType.EQUALS).setInfoMessage("month " + month);
monthEl.click();
selectOkButton.click();
}
WebLocator dayEl = new WebLocator(dayContainer).setText(day, SearchType.EQUALS).setVisibility(true).setInfoMessage("day " + day);
Utils.sleep(50);
return dayEl.click();
} | [
"private",
"boolean",
"setDate",
"(",
"String",
"day",
",",
"String",
"month",
",",
"String",
"year",
")",
"{",
"String",
"fullDate",
"=",
"RetryUtils",
".",
"retry",
"(",
"4",
",",
"(",
")",
"->",
"monthYearButton",
".",
"getText",
"(",
")",
")",
".",... | example new DataField().setDate("19", "05", "2013")
@param day String 'dd'
@param month String 'MMM'
@param year String 'yyyy'
@return true if is selected date, false when DataField doesn't exist | [
"example",
"new",
"DataField",
"()",
".",
"setDate",
"(",
"19",
"05",
"2013",
")"
] | train | https://github.com/sdl/Testy/blob/b3ae061554016f926f04694a39ff00dab7576609/src/main/java/com/sdl/selenium/extjs6/form/DateField.java#L63-L78 |
SonarOpenCommunity/sonar-cxx | cxx-sensors/src/main/java/org/sonar/cxx/sensors/utils/CxxIssuesReportSensor.java | CxxIssuesReportSensor.saveUniqueViolation | public void saveUniqueViolation(SensorContext sensorContext, CxxReportIssue issue) {
if (uniqueIssues.add(issue)) {
saveViolation(sensorContext, issue);
}
} | java | public void saveUniqueViolation(SensorContext sensorContext, CxxReportIssue issue) {
if (uniqueIssues.add(issue)) {
saveViolation(sensorContext, issue);
}
} | [
"public",
"void",
"saveUniqueViolation",
"(",
"SensorContext",
"sensorContext",
",",
"CxxReportIssue",
"issue",
")",
"{",
"if",
"(",
"uniqueIssues",
".",
"add",
"(",
"issue",
")",
")",
"{",
"saveViolation",
"(",
"sensorContext",
",",
"issue",
")",
";",
"}",
... | Saves code violation only if it wasn't already saved
@param sensorContext
@param issue | [
"Saves",
"code",
"violation",
"only",
"if",
"it",
"wasn",
"t",
"already",
"saved"
] | train | https://github.com/SonarOpenCommunity/sonar-cxx/blob/7e7a3a44d6d86382a0434652a798f8235503c9b8/cxx-sensors/src/main/java/org/sonar/cxx/sensors/utils/CxxIssuesReportSensor.java#L130-L134 |
actframework/actframework | src/main/java/act/event/EventBus.java | EventBus.emitSync | public EventBus emitSync(String event, Object... args) {
return _emitWithOnceBus(eventContextSync(event, args));
} | java | public EventBus emitSync(String event, Object... args) {
return _emitWithOnceBus(eventContextSync(event, args));
} | [
"public",
"EventBus",
"emitSync",
"(",
"String",
"event",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"_emitWithOnceBus",
"(",
"eventContextSync",
"(",
"event",
",",
"args",
")",
")",
";",
"}"
] | Emit a string event with parameters and force all listener to be called synchronously.
@param event
the target event
@param args
the arguments passed in
@see #emit(String, Object...) | [
"Emit",
"a",
"string",
"event",
"with",
"parameters",
"and",
"force",
"all",
"listener",
"to",
"be",
"called",
"synchronously",
"."
] | train | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/event/EventBus.java#L1092-L1094 |
audit4j/audit4j-core | src/main/java/org/audit4j/core/schedule/ConcurrentTaskScheduler.java | ConcurrentTaskScheduler.decorateTask | private Runnable decorateTask(Runnable task, boolean isRepeatingTask) {
Runnable result = TaskUtils.decorateTaskWithErrorHandler(task, this.errorHandler, isRepeatingTask);
if (this.enterpriseConcurrentScheduler) {
result = ManagedTaskBuilder.buildManagedTask(result, task.toString());
}
return result;
} | java | private Runnable decorateTask(Runnable task, boolean isRepeatingTask) {
Runnable result = TaskUtils.decorateTaskWithErrorHandler(task, this.errorHandler, isRepeatingTask);
if (this.enterpriseConcurrentScheduler) {
result = ManagedTaskBuilder.buildManagedTask(result, task.toString());
}
return result;
} | [
"private",
"Runnable",
"decorateTask",
"(",
"Runnable",
"task",
",",
"boolean",
"isRepeatingTask",
")",
"{",
"Runnable",
"result",
"=",
"TaskUtils",
".",
"decorateTaskWithErrorHandler",
"(",
"task",
",",
"this",
".",
"errorHandler",
",",
"isRepeatingTask",
")",
";... | Decorate task.
@param task
the task
@param isRepeatingTask
the is repeating task
@return the runnable | [
"Decorate",
"task",
"."
] | train | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/schedule/ConcurrentTaskScheduler.java#L287-L293 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalCreator.java | JournalCreator.getNextPID | public String[] getNextPID(Context context, int numPIDs, String namespace)
throws ServerException {
try {
CreatorJournalEntry cje =
new CreatorJournalEntry(METHOD_GET_NEXT_PID, context);
cje.addArgument(ARGUMENT_NAME_NUM_PIDS, numPIDs);
cje.addArgument(ARGUMENT_NAME_NAMESPACE, namespace);
return (String[]) cje.invokeAndClose(delegate, writer);
} catch (JournalException e) {
throw new GeneralException("Problem creating the Journal", e);
}
} | java | public String[] getNextPID(Context context, int numPIDs, String namespace)
throws ServerException {
try {
CreatorJournalEntry cje =
new CreatorJournalEntry(METHOD_GET_NEXT_PID, context);
cje.addArgument(ARGUMENT_NAME_NUM_PIDS, numPIDs);
cje.addArgument(ARGUMENT_NAME_NAMESPACE, namespace);
return (String[]) cje.invokeAndClose(delegate, writer);
} catch (JournalException e) {
throw new GeneralException("Problem creating the Journal", e);
}
} | [
"public",
"String",
"[",
"]",
"getNextPID",
"(",
"Context",
"context",
",",
"int",
"numPIDs",
",",
"String",
"namespace",
")",
"throws",
"ServerException",
"{",
"try",
"{",
"CreatorJournalEntry",
"cje",
"=",
"new",
"CreatorJournalEntry",
"(",
"METHOD_GET_NEXT_PID"... | Create a journal entry, add the arguments, and invoke the method. | [
"Create",
"a",
"journal",
"entry",
"add",
"the",
"arguments",
"and",
"invoke",
"the",
"method",
"."
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalCreator.java#L360-L371 |
RestComm/media-core | network/src/main/java/org/restcomm/media/core/network/deprecated/UdpManager.java | UdpManager.bindLocal | public void bindLocal(DatagramChannel channel, int port) throws IOException {
// select port if wildcarded
if (port == PORT_ANY) {
port = localPortManager.next();
}
// try bind
IOException ex = null;
for (int q = 0; q < 100; q++) {
try {
channel.bind(new InetSocketAddress(localBindAddress, port));
ex = null;
break;
} catch (IOException e) {
ex = e;
logger.info("Failed trying to bind " + localBindAddress + ":" + port);
port = localPortManager.next();
}
}
if (ex != null) {
throw ex;
}
} | java | public void bindLocal(DatagramChannel channel, int port) throws IOException {
// select port if wildcarded
if (port == PORT_ANY) {
port = localPortManager.next();
}
// try bind
IOException ex = null;
for (int q = 0; q < 100; q++) {
try {
channel.bind(new InetSocketAddress(localBindAddress, port));
ex = null;
break;
} catch (IOException e) {
ex = e;
logger.info("Failed trying to bind " + localBindAddress + ":" + port);
port = localPortManager.next();
}
}
if (ex != null) {
throw ex;
}
} | [
"public",
"void",
"bindLocal",
"(",
"DatagramChannel",
"channel",
",",
"int",
"port",
")",
"throws",
"IOException",
"{",
"// select port if wildcarded",
"if",
"(",
"port",
"==",
"PORT_ANY",
")",
"{",
"port",
"=",
"localPortManager",
".",
"next",
"(",
")",
";",... | Binds socket to global bind address and specified port.
@param channel the channel
@param port the port to bind to
@throws IOException | [
"Binds",
"socket",
"to",
"global",
"bind",
"address",
"and",
"specified",
"port",
"."
] | train | https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/network/src/main/java/org/restcomm/media/core/network/deprecated/UdpManager.java#L390-L413 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/util/HashUtil.java | HashUtil.MurmurHash3_x64_64_direct | public static long MurmurHash3_x64_64_direct(MemoryAccessor mem, long base, int offset, int len) {
return MurmurHash3_x64_64(mem.isBigEndian() ? NARROW_DIRECT_LOADER : WIDE_DIRECT_LOADER,
mem, base + offset, len, DEFAULT_MURMUR_SEED);
} | java | public static long MurmurHash3_x64_64_direct(MemoryAccessor mem, long base, int offset, int len) {
return MurmurHash3_x64_64(mem.isBigEndian() ? NARROW_DIRECT_LOADER : WIDE_DIRECT_LOADER,
mem, base + offset, len, DEFAULT_MURMUR_SEED);
} | [
"public",
"static",
"long",
"MurmurHash3_x64_64_direct",
"(",
"MemoryAccessor",
"mem",
",",
"long",
"base",
",",
"int",
"offset",
",",
"int",
"len",
")",
"{",
"return",
"MurmurHash3_x64_64",
"(",
"mem",
".",
"isBigEndian",
"(",
")",
"?",
"NARROW_DIRECT_LOADER",
... | Returns the {@code MurmurHash3_x64_64} hash of a memory block accessed by the provided {@link MemoryAccessor}.
The {@code MemoryAccessor} will be used to access {@code long}-sized data at addresses {@code (base + offset)},
{@code (base + offset + 8)}, etc. The caller must ensure that the {@code MemoryAccessor} supports it, especially
when {@code (base + offset)} is not guaranteed to be 8 byte-aligned. | [
"Returns",
"the",
"{"
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/HashUtil.java#L153-L156 |
hortonworks/dstream | dstream-api/src/main/java/io/dstream/utils/StringUtils.java | StringUtils.compareLength | public static int compareLength(String a, String b){
return a.length() > b.length() ? 1 : a.length() < b.length() ? -1 : 0;
} | java | public static int compareLength(String a, String b){
return a.length() > b.length() ? 1 : a.length() < b.length() ? -1 : 0;
} | [
"public",
"static",
"int",
"compareLength",
"(",
"String",
"a",
",",
"String",
"b",
")",
"{",
"return",
"a",
".",
"length",
"(",
")",
">",
"b",
".",
"length",
"(",
")",
"?",
"1",
":",
"a",
".",
"length",
"(",
")",
"<",
"b",
".",
"length",
"(",
... | Will compare the length of two strings, maintaining semantics of the
traditional {@link Comparator} by returning <i>int</i>.
@param a first {@link String}
@param b second {@link String}
@return integer value of -1, 0 or 1 following this logic:<br>
<pre>
a.length() > b.length() ? 1 : a.length() < b.length() ? -1 : 0;
</pre> | [
"Will",
"compare",
"the",
"length",
"of",
"two",
"strings",
"maintaining",
"semantics",
"of",
"the",
"traditional",
"{"
] | train | https://github.com/hortonworks/dstream/blob/3a106c0f14725b028fe7fe2dbc660406d9a5f142/dstream-api/src/main/java/io/dstream/utils/StringUtils.java#L37-L39 |
stratosphere/stratosphere | stratosphere-core/src/main/java/eu/stratosphere/api/common/operators/base/GenericDataSinkBase.java | GenericDataSinkBase.setRangePartitioned | public void setRangePartitioned(Ordering partitionOrdering, DataDistribution distribution) {
if (partitionOrdering.getNumberOfFields() != distribution.getNumberOfFields()) {
throw new IllegalArgumentException("The number of keys in the distribution must match number of ordered fields.");
}
// TODO: check compatibility of distribution and ordering (number and order of keys, key types, etc.
// TODO: adapt partition ordering to data distribution (use prefix of ordering)
this.partitionOrdering = partitionOrdering;
this.distribution = distribution;
} | java | public void setRangePartitioned(Ordering partitionOrdering, DataDistribution distribution) {
if (partitionOrdering.getNumberOfFields() != distribution.getNumberOfFields()) {
throw new IllegalArgumentException("The number of keys in the distribution must match number of ordered fields.");
}
// TODO: check compatibility of distribution and ordering (number and order of keys, key types, etc.
// TODO: adapt partition ordering to data distribution (use prefix of ordering)
this.partitionOrdering = partitionOrdering;
this.distribution = distribution;
} | [
"public",
"void",
"setRangePartitioned",
"(",
"Ordering",
"partitionOrdering",
",",
"DataDistribution",
"distribution",
")",
"{",
"if",
"(",
"partitionOrdering",
".",
"getNumberOfFields",
"(",
")",
"!=",
"distribution",
".",
"getNumberOfFields",
"(",
")",
")",
"{",
... | Sets the sink to partition the records into ranges over the given ordering.
The bucket boundaries are determined using the given data distribution.
@param partitionOrdering The record ordering over which to partition in ranges.
@param distribution The distribution to use for the range partitioning. | [
"Sets",
"the",
"sink",
"to",
"partition",
"the",
"records",
"into",
"ranges",
"over",
"the",
"given",
"ordering",
".",
"The",
"bucket",
"boundaries",
"are",
"determined",
"using",
"the",
"given",
"data",
"distribution",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-core/src/main/java/eu/stratosphere/api/common/operators/base/GenericDataSinkBase.java#L221-L231 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AbstractDoclet.java | AbstractDoclet.generateClassFiles | protected void generateClassFiles(DocletEnvironment docEnv, ClassTree classtree)
throws DocletException {
generateClassFiles(classtree);
SortedSet<PackageElement> packages = new TreeSet<>(utils.makePackageComparator());
packages.addAll(configuration.getSpecifiedPackageElements());
configuration.modulePackages.values().stream().forEach(packages::addAll);
for (PackageElement pkg : packages) {
generateClassFiles(utils.getAllClasses(pkg), classtree);
}
} | java | protected void generateClassFiles(DocletEnvironment docEnv, ClassTree classtree)
throws DocletException {
generateClassFiles(classtree);
SortedSet<PackageElement> packages = new TreeSet<>(utils.makePackageComparator());
packages.addAll(configuration.getSpecifiedPackageElements());
configuration.modulePackages.values().stream().forEach(packages::addAll);
for (PackageElement pkg : packages) {
generateClassFiles(utils.getAllClasses(pkg), classtree);
}
} | [
"protected",
"void",
"generateClassFiles",
"(",
"DocletEnvironment",
"docEnv",
",",
"ClassTree",
"classtree",
")",
"throws",
"DocletException",
"{",
"generateClassFiles",
"(",
"classtree",
")",
";",
"SortedSet",
"<",
"PackageElement",
">",
"packages",
"=",
"new",
"T... | Iterate through all classes and construct documentation for them.
@param docEnv the DocletEnvironment
@param classtree the data structure representing the class tree
@throws DocletException if there is a problem while generating the documentation | [
"Iterate",
"through",
"all",
"classes",
"and",
"construct",
"documentation",
"for",
"them",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AbstractDoclet.java#L266-L275 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/refer/Referencer.java | Referencer.setReferencesForOne | public static void setReferencesForOne(IReferences references, Object component)
throws ReferenceException, ConfigException {
if (component instanceof IReferenceable)
((IReferenceable) component).setReferences(references);
} | java | public static void setReferencesForOne(IReferences references, Object component)
throws ReferenceException, ConfigException {
if (component instanceof IReferenceable)
((IReferenceable) component).setReferences(references);
} | [
"public",
"static",
"void",
"setReferencesForOne",
"(",
"IReferences",
"references",
",",
"Object",
"component",
")",
"throws",
"ReferenceException",
",",
"ConfigException",
"{",
"if",
"(",
"component",
"instanceof",
"IReferenceable",
")",
"(",
"(",
"IReferenceable",
... | Sets references to specific component.
To set references components must implement IReferenceable interface. If they
don't the call to this method has no effect.
@param references the references to be set.
@param component the component to set references to.
@throws ReferenceException when no references found.
@throws ConfigException when configuration is wrong.
@see IReferenceable | [
"Sets",
"references",
"to",
"specific",
"component",
"."
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/refer/Referencer.java#L25-L30 |
ModeShape/modeshape | index-providers/modeshape-elasticsearch-index-provider/src/main/java/org/modeshape/jcr/index/elasticsearch/EsIndexColumns.java | EsIndexColumns.noprefix | private String noprefix(String name, String... prefix) {
for (int i = 0; i < prefix.length; i++) {
if (name.startsWith(prefix[i])) {
name = name.replaceAll(prefix[i], "");
}
}
return name;
} | java | private String noprefix(String name, String... prefix) {
for (int i = 0; i < prefix.length; i++) {
if (name.startsWith(prefix[i])) {
name = name.replaceAll(prefix[i], "");
}
}
return name;
} | [
"private",
"String",
"noprefix",
"(",
"String",
"name",
",",
"String",
"...",
"prefix",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"prefix",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"name",
".",
"startsWith",
"(",
"pref... | Cuts name prefix for the pseudo column case.
@param name the name of the column or pseudo column.
@param prefix the list of prefixes to cut.
@return the name without prefix. | [
"Cuts",
"name",
"prefix",
"for",
"the",
"pseudo",
"column",
"case",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/index-providers/modeshape-elasticsearch-index-provider/src/main/java/org/modeshape/jcr/index/elasticsearch/EsIndexColumns.java#L92-L99 |
xmlet/XsdAsmFaster | src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java | XsdAsmInterfaces.createChoiceInterface | private List<InterfaceInfo> createChoiceInterface(List<XsdGroup> groupElements, List<XsdElement> directElements, String interfaceName, String className, String groupName, int interfaceIndex, String apiName) {
List<InterfaceInfo> interfaceInfoList = new ArrayList<>();
List<String> extendedInterfaces = new ArrayList<>();
for (XsdGroup groupElement : groupElements) {
InterfaceInfo interfaceInfo = iterativeCreation(groupElement, className, interfaceIndex + 1, apiName, groupName).get(0);
interfaceIndex = interfaceInfo.getInterfaceIndex();
extendedInterfaces.add(interfaceInfo.getInterfaceName());
interfaceInfoList.add(interfaceInfo);
}
Set<String> ambiguousMethods = getAmbiguousMethods(interfaceInfoList);
if (ambiguousMethods.isEmpty() && directElements.isEmpty()){
return interfaceInfoList;
}
String[] extendedInterfacesArr = listToArray(extendedInterfaces, TEXT_GROUP);
ClassWriter classWriter = generateClass(interfaceName, JAVA_OBJECT, extendedInterfacesArr, getInterfaceSignature(extendedInterfacesArr, apiName), ACC_PUBLIC + ACC_ABSTRACT + ACC_INTERFACE, apiName);
String interfaceType = getFullClassTypeName(interfaceName, apiName);
directElements.forEach(child -> {
generateMethodsForElement(classWriter, child, interfaceType, apiName);
createElement(child, apiName);
});
ambiguousMethods.forEach(ambiguousMethodName ->
generateMethodsForElement(classWriter, ambiguousMethodName, interfaceType, apiName, new String[]{"Ljava/lang/Override;"})
);
writeClassToFile(interfaceName, classWriter, apiName);
List<InterfaceInfo> choiceInterface = new ArrayList<>();
choiceInterface.add(new InterfaceInfo(interfaceName, interfaceIndex, directElements.stream().map(XsdElement::getName).collect(Collectors.toList()), interfaceInfoList));
return choiceInterface;
} | java | private List<InterfaceInfo> createChoiceInterface(List<XsdGroup> groupElements, List<XsdElement> directElements, String interfaceName, String className, String groupName, int interfaceIndex, String apiName) {
List<InterfaceInfo> interfaceInfoList = new ArrayList<>();
List<String> extendedInterfaces = new ArrayList<>();
for (XsdGroup groupElement : groupElements) {
InterfaceInfo interfaceInfo = iterativeCreation(groupElement, className, interfaceIndex + 1, apiName, groupName).get(0);
interfaceIndex = interfaceInfo.getInterfaceIndex();
extendedInterfaces.add(interfaceInfo.getInterfaceName());
interfaceInfoList.add(interfaceInfo);
}
Set<String> ambiguousMethods = getAmbiguousMethods(interfaceInfoList);
if (ambiguousMethods.isEmpty() && directElements.isEmpty()){
return interfaceInfoList;
}
String[] extendedInterfacesArr = listToArray(extendedInterfaces, TEXT_GROUP);
ClassWriter classWriter = generateClass(interfaceName, JAVA_OBJECT, extendedInterfacesArr, getInterfaceSignature(extendedInterfacesArr, apiName), ACC_PUBLIC + ACC_ABSTRACT + ACC_INTERFACE, apiName);
String interfaceType = getFullClassTypeName(interfaceName, apiName);
directElements.forEach(child -> {
generateMethodsForElement(classWriter, child, interfaceType, apiName);
createElement(child, apiName);
});
ambiguousMethods.forEach(ambiguousMethodName ->
generateMethodsForElement(classWriter, ambiguousMethodName, interfaceType, apiName, new String[]{"Ljava/lang/Override;"})
);
writeClassToFile(interfaceName, classWriter, apiName);
List<InterfaceInfo> choiceInterface = new ArrayList<>();
choiceInterface.add(new InterfaceInfo(interfaceName, interfaceIndex, directElements.stream().map(XsdElement::getName).collect(Collectors.toList()), interfaceInfoList));
return choiceInterface;
} | [
"private",
"List",
"<",
"InterfaceInfo",
">",
"createChoiceInterface",
"(",
"List",
"<",
"XsdGroup",
">",
"groupElements",
",",
"List",
"<",
"XsdElement",
">",
"directElements",
",",
"String",
"interfaceName",
",",
"String",
"className",
",",
"String",
"groupName"... | Generates an interface based on a {@link XsdChoice} element.
@param groupElements The contained groupElements.
@param directElements The direct elements of the {@link XsdChoice} element.
@param interfaceName The choice interface name.
@param className The name of the class that contains the {@link XsdChoice} element.
@param interfaceIndex The current interface index.
@param apiName The name of the generated fluent interface.
@param groupName The name of the group in which this {@link XsdChoice} element is contained, if any.
@return A {@link List} of {@link InterfaceInfo} objects containing relevant interface information. | [
"Generates",
"an",
"interface",
"based",
"on",
"a",
"{"
] | train | https://github.com/xmlet/XsdAsmFaster/blob/ccb78f9dd4b957ad5ac1ca349eaf24338c421e94/src/main/java/org/xmlet/xsdasmfaster/classes/XsdAsmInterfaces.java#L693-L733 |
codegist/crest | core/src/main/java/org/codegist/crest/CRestBuilder.java | CRestBuilder.basicAuth | public CRestBuilder basicAuth(String username, String password) {
this.auth = "basic";
this.username = username;
this.password = password;
return this;
} | java | public CRestBuilder basicAuth(String username, String password) {
this.auth = "basic";
this.username = username;
this.password = password;
return this;
} | [
"public",
"CRestBuilder",
"basicAuth",
"(",
"String",
"username",
",",
"String",
"password",
")",
"{",
"this",
".",
"auth",
"=",
"\"basic\"",
";",
"this",
".",
"username",
"=",
"username",
";",
"this",
".",
"password",
"=",
"password",
";",
"return",
"this... | <p>Configures the resulting <b>CRest</b> instance to authenticate all requests using Basic Auth</p>
@param username user name to authenticate the requests with
@param password password to authenticate the requests with
@return current builder | [
"<p",
">",
"Configures",
"the",
"resulting",
"<b",
">",
"CRest<",
"/",
"b",
">",
"instance",
"to",
"authenticate",
"all",
"requests",
"using",
"Basic",
"Auth<",
"/",
"p",
">"
] | train | https://github.com/codegist/crest/blob/e99ba7728b27d2ddb2c247261350f1b6fa7a6698/core/src/main/java/org/codegist/crest/CRestBuilder.java#L662-L667 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java | PredictionsImpl.predictImageWithNoStoreWithServiceResponseAsync | public Observable<ServiceResponse<ImagePrediction>> predictImageWithNoStoreWithServiceResponseAsync(UUID projectId, byte[] imageData, PredictImageWithNoStoreOptionalParameter predictImageWithNoStoreOptionalParameter) {
if (projectId == null) {
throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
}
if (imageData == null) {
throw new IllegalArgumentException("Parameter imageData is required and cannot be null.");
}
if (this.client.apiKey() == null) {
throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
}
final UUID iterationId = predictImageWithNoStoreOptionalParameter != null ? predictImageWithNoStoreOptionalParameter.iterationId() : null;
final String application = predictImageWithNoStoreOptionalParameter != null ? predictImageWithNoStoreOptionalParameter.application() : null;
return predictImageWithNoStoreWithServiceResponseAsync(projectId, imageData, iterationId, application);
} | java | public Observable<ServiceResponse<ImagePrediction>> predictImageWithNoStoreWithServiceResponseAsync(UUID projectId, byte[] imageData, PredictImageWithNoStoreOptionalParameter predictImageWithNoStoreOptionalParameter) {
if (projectId == null) {
throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
}
if (imageData == null) {
throw new IllegalArgumentException("Parameter imageData is required and cannot be null.");
}
if (this.client.apiKey() == null) {
throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
}
final UUID iterationId = predictImageWithNoStoreOptionalParameter != null ? predictImageWithNoStoreOptionalParameter.iterationId() : null;
final String application = predictImageWithNoStoreOptionalParameter != null ? predictImageWithNoStoreOptionalParameter.application() : null;
return predictImageWithNoStoreWithServiceResponseAsync(projectId, imageData, iterationId, application);
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"ImagePrediction",
">",
">",
"predictImageWithNoStoreWithServiceResponseAsync",
"(",
"UUID",
"projectId",
",",
"byte",
"[",
"]",
"imageData",
",",
"PredictImageWithNoStoreOptionalParameter",
"predictImageWithNoStoreOptionalPa... | Predict an image without saving the result.
@param projectId The project id
@param imageData the InputStream value
@param predictImageWithNoStoreOptionalParameter 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 ImagePrediction object | [
"Predict",
"an",
"image",
"without",
"saving",
"the",
"result",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java#L142-L156 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java | JvmTypesBuilder.setBody | public void setBody(/* @Nullable */ JvmExecutable logicalContainer, /* @Nullable */ XExpression expr) {
if (logicalContainer == null || expr == null)
return;
removeExistingBody(logicalContainer);
associator.associateLogicalContainer(expr, logicalContainer);
} | java | public void setBody(/* @Nullable */ JvmExecutable logicalContainer, /* @Nullable */ XExpression expr) {
if (logicalContainer == null || expr == null)
return;
removeExistingBody(logicalContainer);
associator.associateLogicalContainer(expr, logicalContainer);
} | [
"public",
"void",
"setBody",
"(",
"/* @Nullable */",
"JvmExecutable",
"logicalContainer",
",",
"/* @Nullable */",
"XExpression",
"expr",
")",
"{",
"if",
"(",
"logicalContainer",
"==",
"null",
"||",
"expr",
"==",
"null",
")",
"return",
";",
"removeExistingBody",
"(... | Sets the given {@link JvmExecutable} as the logical container for the given {@link XExpression}.
This defines the context and the scope for the given expression. Also it defines how the given JvmExecutable can be executed.
For instance {@link org.eclipse.xtext.xbase.compiler.JvmModelGenerator} automatically translates any given {@link XExpression}
into corresponding Java source code as the body of the given {@link JvmExecutable}.
@param logicalContainer
the {@link JvmExecutable} the expression is associated with. Can be <code>null</code> in which case this
function does nothing.
@param expr
the expression. Can be <code>null</code> in which case this function does nothing. | [
"Sets",
"the",
"given",
"{",
"@link",
"JvmExecutable",
"}",
"as",
"the",
"logical",
"container",
"for",
"the",
"given",
"{",
"@link",
"XExpression",
"}",
".",
"This",
"defines",
"the",
"context",
"and",
"the",
"scope",
"for",
"the",
"given",
"expression",
... | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java#L154-L159 |
apache/incubator-gobblin | gobblin-core-base/src/main/java/org/apache/gobblin/compression/CompressionConfigParser.java | CompressionConfigParser.getCompressionType | public static String getCompressionType(Map<String, Object> properties) {
return (String) properties.get(COMPRESSION_TYPE_KEY);
} | java | public static String getCompressionType(Map<String, Object> properties) {
return (String) properties.get(COMPRESSION_TYPE_KEY);
} | [
"public",
"static",
"String",
"getCompressionType",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"return",
"(",
"String",
")",
"properties",
".",
"get",
"(",
"COMPRESSION_TYPE_KEY",
")",
";",
"}"
] | Return compression type
@param properties Compression config settings
@return String representing compression type, null if none exists | [
"Return",
"compression",
"type"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core-base/src/main/java/org/apache/gobblin/compression/CompressionConfigParser.java#L57-L59 |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geometry/SweepHullDelaunay2D.java | SweepHullDelaunay2D.getHull | public Polygon getHull() {
if(hull == null) {
run(true);
}
DoubleMinMax minmaxX = new DoubleMinMax();
DoubleMinMax minmaxY = new DoubleMinMax();
List<double[]> hullp = new ArrayList<>(hull.size());
for(IntIntPair pair : hull) {
double[] v = points.get(pair.first);
hullp.add(v);
minmaxX.put(v[0]);
minmaxY.put(v[1]);
}
return new Polygon(hullp, minmaxX.getMin(), minmaxX.getMax(), minmaxY.getMin(), minmaxY.getMax());
} | java | public Polygon getHull() {
if(hull == null) {
run(true);
}
DoubleMinMax minmaxX = new DoubleMinMax();
DoubleMinMax minmaxY = new DoubleMinMax();
List<double[]> hullp = new ArrayList<>(hull.size());
for(IntIntPair pair : hull) {
double[] v = points.get(pair.first);
hullp.add(v);
minmaxX.put(v[0]);
minmaxY.put(v[1]);
}
return new Polygon(hullp, minmaxX.getMin(), minmaxX.getMax(), minmaxY.getMin(), minmaxY.getMax());
} | [
"public",
"Polygon",
"getHull",
"(",
")",
"{",
"if",
"(",
"hull",
"==",
"null",
")",
"{",
"run",
"(",
"true",
")",
";",
"}",
"DoubleMinMax",
"minmaxX",
"=",
"new",
"DoubleMinMax",
"(",
")",
";",
"DoubleMinMax",
"minmaxY",
"=",
"new",
"DoubleMinMax",
"(... | Get the convex hull only.
<p>
Note: if you also want the Delaunay Triangulation, you should get that
first!
@return Convex hull | [
"Get",
"the",
"convex",
"hull",
"only",
".",
"<p",
">",
"Note",
":",
"if",
"you",
"also",
"want",
"the",
"Delaunay",
"Triangulation",
"you",
"should",
"get",
"that",
"first!"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geometry/SweepHullDelaunay2D.java#L658-L672 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/UtilColor.java | UtilColor.isOpaqueTransparentExclusive | public static boolean isOpaqueTransparentExclusive(ColorRgba colorA, ColorRgba colorB)
{
Check.notNull(colorA);
Check.notNull(colorB);
return isOpaqueTransparentExclusive(colorA.getRgba(), colorB.getRgba());
} | java | public static boolean isOpaqueTransparentExclusive(ColorRgba colorA, ColorRgba colorB)
{
Check.notNull(colorA);
Check.notNull(colorB);
return isOpaqueTransparentExclusive(colorA.getRgba(), colorB.getRgba());
} | [
"public",
"static",
"boolean",
"isOpaqueTransparentExclusive",
"(",
"ColorRgba",
"colorA",
",",
"ColorRgba",
"colorB",
")",
"{",
"Check",
".",
"notNull",
"(",
"colorA",
")",
";",
"Check",
".",
"notNull",
"(",
"colorB",
")",
";",
"return",
"isOpaqueTransparentExc... | Check if colors transparency type are exclusive (one is {@link ColorRgba#OPAQUE} and the other
{@link ColorRgba#TRANSPARENT}).
@param colorA The first color (must not be <code>null</code>).
@param colorB The second color (must not be <code>null</code>).
@return <code>true</code> if exclusive, <code>false</code> else.
@throws LionEngineException If invalid arguments. | [
"Check",
"if",
"colors",
"transparency",
"type",
"are",
"exclusive",
"(",
"one",
"is",
"{",
"@link",
"ColorRgba#OPAQUE",
"}",
"and",
"the",
"other",
"{",
"@link",
"ColorRgba#TRANSPARENT",
"}",
")",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/graphic/UtilColor.java#L159-L165 |
belaban/JGroups | src/org/jgroups/Message.java | Message.putHeader | public Message putHeader(short id, Header hdr) {
if(id < 0)
throw new IllegalArgumentException("An ID of " + id + " is invalid");
if(hdr != null)
hdr.setProtId(id);
synchronized(this) {
Header[] resized_array=Headers.putHeader(this.headers, id, hdr, true);
if(resized_array != null)
this.headers=resized_array;
}
return this;
} | java | public Message putHeader(short id, Header hdr) {
if(id < 0)
throw new IllegalArgumentException("An ID of " + id + " is invalid");
if(hdr != null)
hdr.setProtId(id);
synchronized(this) {
Header[] resized_array=Headers.putHeader(this.headers, id, hdr, true);
if(resized_array != null)
this.headers=resized_array;
}
return this;
} | [
"public",
"Message",
"putHeader",
"(",
"short",
"id",
",",
"Header",
"hdr",
")",
"{",
"if",
"(",
"id",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"An ID of \"",
"+",
"id",
"+",
"\" is invalid\"",
")",
";",
"if",
"(",
"hdr",
"!=",
... | Puts a header given an ID into the hashmap. Overwrites potential existing entry. | [
"Puts",
"a",
"header",
"given",
"an",
"ID",
"into",
"the",
"hashmap",
".",
"Overwrites",
"potential",
"existing",
"entry",
"."
] | train | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/Message.java#L460-L471 |
beihaifeiwu/dolphin | dolphin-common/src/main/java/com/freetmp/common/type/ResolvableType.java | ResolvableType.forMethodParameter | public static ResolvableType forMethodParameter(MethodParameter methodParameter, Type targetType) {
Assert.notNull(methodParameter, "MethodParameter must not be null");
ResolvableType owner = forType(methodParameter.getContainingClass()).as(methodParameter.getDeclaringClass());
return forType(targetType, new MethodParameterTypeProvider(methodParameter), owner.asVariableResolver()).
getNested(methodParameter.getNestingLevel(), methodParameter.typeIndexesPerLevel);
} | java | public static ResolvableType forMethodParameter(MethodParameter methodParameter, Type targetType) {
Assert.notNull(methodParameter, "MethodParameter must not be null");
ResolvableType owner = forType(methodParameter.getContainingClass()).as(methodParameter.getDeclaringClass());
return forType(targetType, new MethodParameterTypeProvider(methodParameter), owner.asVariableResolver()).
getNested(methodParameter.getNestingLevel(), methodParameter.typeIndexesPerLevel);
} | [
"public",
"static",
"ResolvableType",
"forMethodParameter",
"(",
"MethodParameter",
"methodParameter",
",",
"Type",
"targetType",
")",
"{",
"Assert",
".",
"notNull",
"(",
"methodParameter",
",",
"\"MethodParameter must not be null\"",
")",
";",
"ResolvableType",
"owner",
... | Return a {@link ResolvableType} for the specified {@link MethodParameter},
overriding the target type to resolve with a specific given type.
@param methodParameter the source method parameter (must not be {@code null})
@param targetType the type to resolve (a part of the method parameter's type)
@return a {@link ResolvableType} for the specified method parameter
@see #forMethodParameter(Method, int) | [
"Return",
"a",
"{"
] | train | https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/type/ResolvableType.java#L1117-L1122 |
googleads/googleads-java-lib | modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/utils/v201902/DateTimes.java | DateTimes.toDateTime | public static DateTime toDateTime(String dateTime, String timeZoneId) {
return dateTimesHelper.toDateTime(dateTime, timeZoneId);
} | java | public static DateTime toDateTime(String dateTime, String timeZoneId) {
return dateTimesHelper.toDateTime(dateTime, timeZoneId);
} | [
"public",
"static",
"DateTime",
"toDateTime",
"(",
"String",
"dateTime",
",",
"String",
"timeZoneId",
")",
"{",
"return",
"dateTimesHelper",
".",
"toDateTime",
"(",
"dateTime",
",",
"timeZoneId",
")",
";",
"}"
] | Converts a string in the form of {@code yyyy-MM-dd'T'HH:mm:ss} to an API date time in the time
zone supplied. | [
"Converts",
"a",
"string",
"in",
"the",
"form",
"of",
"{"
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/utils/v201902/DateTimes.java#L52-L54 |
EdwardRaff/JSAT | JSAT/src/jsat/regression/RegressionDataSet.java | RegressionDataSet.addDataPoint | public void addDataPoint(Vec numerical, int[] categories, double val)
{
if(numerical.length() != numNumerVals)
throw new RuntimeException("Data point does not contain enough numerical data points");
if(categories.length != categories.length)
throw new RuntimeException("Data point does not contain enough categorical data points");
for(int i = 0; i < categories.length; i++)
if(!this.categories[i].isValidCategory(categories[i]) && categories[i] >= 0) // >= so that missing values (negative) are allowed
throw new RuntimeException("Categoriy value given is invalid");
DataPoint dp = new DataPoint(numerical, categories, this.categories);
addDataPoint(dp, val);
} | java | public void addDataPoint(Vec numerical, int[] categories, double val)
{
if(numerical.length() != numNumerVals)
throw new RuntimeException("Data point does not contain enough numerical data points");
if(categories.length != categories.length)
throw new RuntimeException("Data point does not contain enough categorical data points");
for(int i = 0; i < categories.length; i++)
if(!this.categories[i].isValidCategory(categories[i]) && categories[i] >= 0) // >= so that missing values (negative) are allowed
throw new RuntimeException("Categoriy value given is invalid");
DataPoint dp = new DataPoint(numerical, categories, this.categories);
addDataPoint(dp, val);
} | [
"public",
"void",
"addDataPoint",
"(",
"Vec",
"numerical",
",",
"int",
"[",
"]",
"categories",
",",
"double",
"val",
")",
"{",
"if",
"(",
"numerical",
".",
"length",
"(",
")",
"!=",
"numNumerVals",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"Data poin... | Creates a new data point to be added to the data set. The arguments will
be used directly, modifying them after will effect the data set.
@param numerical the numerical values for the data point
@param categories the categorical values for the data point
@param val the target value to predict
@throws IllegalArgumentException if the given values are inconsistent with the data this class stores. | [
"Creates",
"a",
"new",
"data",
"point",
"to",
"be",
"added",
"to",
"the",
"data",
"set",
".",
"The",
"arguments",
"will",
"be",
"used",
"directly",
"modifying",
"them",
"after",
"will",
"effect",
"the",
"data",
"set",
"."
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/regression/RegressionDataSet.java#L164-L177 |
haifengl/smile | math/src/main/java/smile/math/Math.java | Math.smoothed | private static double smoothed(int x, double slope, double intercept) {
return Math.exp(intercept + slope * Math.log(x));
} | java | private static double smoothed(int x, double slope, double intercept) {
return Math.exp(intercept + slope * Math.log(x));
} | [
"private",
"static",
"double",
"smoothed",
"(",
"int",
"x",
",",
"double",
"slope",
",",
"double",
"intercept",
")",
"{",
"return",
"Math",
".",
"exp",
"(",
"intercept",
"+",
"slope",
"*",
"Math",
".",
"log",
"(",
"x",
")",
")",
";",
"}"
] | Returns the fitted linear function value y = intercept + slope * log(x). | [
"Returns",
"the",
"fitted",
"linear",
"function",
"value",
"y",
"=",
"intercept",
"+",
"slope",
"*",
"log",
"(",
"x",
")",
"."
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/Math.java#L3248-L3250 |
ModeShape/modeshape | modeshape-common/src/main/java/org/modeshape/common/util/Reflection.java | Reflection.findMethod | public static Method findMethod(Class<?> type, String methodName) {
try {
return type.getDeclaredMethod(methodName);
} catch (NoSuchMethodException e) {
if (type.equals(Object.class) || type.isInterface()) {
throw new RuntimeException(e);
}
return findMethod(type.getSuperclass(), methodName);
}
} | java | public static Method findMethod(Class<?> type, String methodName) {
try {
return type.getDeclaredMethod(methodName);
} catch (NoSuchMethodException e) {
if (type.equals(Object.class) || type.isInterface()) {
throw new RuntimeException(e);
}
return findMethod(type.getSuperclass(), methodName);
}
} | [
"public",
"static",
"Method",
"findMethod",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"String",
"methodName",
")",
"{",
"try",
"{",
"return",
"type",
".",
"getDeclaredMethod",
"(",
"methodName",
")",
";",
"}",
"catch",
"(",
"NoSuchMethodException",
"e",
")... | Searches for a method with a given name in a class.
@param type a {@link Class} instance; never null
@param methodName the name of the method to search for; never null
@return a {@link Method} instance if the method is found | [
"Searches",
"for",
"a",
"method",
"with",
"a",
"given",
"name",
"in",
"a",
"class",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/Reflection.java#L249-L258 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/mps/ntp_sync.java | ntp_sync.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
ntp_sync_responses result = (ntp_sync_responses) service.get_payload_formatter().string_to_resource(ntp_sync_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ntp_sync_response_array);
}
ntp_sync[] result_ntp_sync = new ntp_sync[result.ntp_sync_response_array.length];
for(int i = 0; i < result.ntp_sync_response_array.length; i++)
{
result_ntp_sync[i] = result.ntp_sync_response_array[i].ntp_sync[0];
}
return result_ntp_sync;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
ntp_sync_responses result = (ntp_sync_responses) service.get_payload_formatter().string_to_resource(ntp_sync_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ntp_sync_response_array);
}
ntp_sync[] result_ntp_sync = new ntp_sync[result.ntp_sync_response_array.length];
for(int i = 0; i < result.ntp_sync_response_array.length; i++)
{
result_ntp_sync[i] = result.ntp_sync_response_array[i].ntp_sync[0];
}
return result_ntp_sync;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"ntp_sync_responses",
"result",
"=",
"(",
"ntp_sync_responses",
")",
"service",
".",
"get_payload_formatter",
... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/ntp_sync.java#L226-L243 |
cdk/cdk | tool/builder3d/src/main/java/org/openscience/cdk/modeling/builder3d/AtomPlacer3D.java | AtomPlacer3D.getPlacedHeavyAtom | public IAtom getPlacedHeavyAtom(IAtomContainer molecule, IAtom atom) {
List<IBond> bonds = molecule.getConnectedBondsList(atom);
for (IBond bond : bonds) {
IAtom connectedAtom = bond.getOther(atom);
if (isPlacedHeavyAtom(connectedAtom)) {
return connectedAtom;
}
}
return null;
} | java | public IAtom getPlacedHeavyAtom(IAtomContainer molecule, IAtom atom) {
List<IBond> bonds = molecule.getConnectedBondsList(atom);
for (IBond bond : bonds) {
IAtom connectedAtom = bond.getOther(atom);
if (isPlacedHeavyAtom(connectedAtom)) {
return connectedAtom;
}
}
return null;
} | [
"public",
"IAtom",
"getPlacedHeavyAtom",
"(",
"IAtomContainer",
"molecule",
",",
"IAtom",
"atom",
")",
"{",
"List",
"<",
"IBond",
">",
"bonds",
"=",
"molecule",
".",
"getConnectedBondsList",
"(",
"atom",
")",
";",
"for",
"(",
"IBond",
"bond",
":",
"bonds",
... | Returns a placed atom connected to a given atom.
@param molecule
@param atom The Atom whose placed bonding partners are to be returned
@return a placed heavy atom connected to a given atom
author: steinbeck | [
"Returns",
"a",
"placed",
"atom",
"connected",
"to",
"a",
"given",
"atom",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/builder3d/src/main/java/org/openscience/cdk/modeling/builder3d/AtomPlacer3D.java#L521-L530 |
zeroturnaround/maven-jrebel-plugin | src/main/java/org/zeroturnaround/javarebel/maven/GenerateRebelMojo.java | GenerateRebelMojo.fixFilePath | protected String fixFilePath(File file) throws MojoExecutionException {
File baseDir = getProject().getFile().getParentFile();
if (file.isAbsolute() && !isRelativeToPath(new File(baseDir, getRelativePath()), file)) {
return StringUtils.replace(getCanonicalPath(file), '\\', '/');
}
if (!file.isAbsolute()) {
file = new File(baseDir, file.getPath());
}
String relative = getRelativePath(new File(baseDir, getRelativePath()), file);
if (!(new File(relative)).isAbsolute()) {
return StringUtils.replace(getRootPath(), '\\', '/') + "/" + relative;
}
//relative path was outside baseDir
//if root path is absolute then try to get a path relative to root
if ((new File(getRootPath())).isAbsolute()) {
String s = getRelativePath(new File(getRootPath()), file);
if (!(new File(s)).isAbsolute()) {
return StringUtils.replace(getRootPath(), '\\', '/') + "/" + s;
}
else {
// root path and the calculated path are absolute, so
// just return calculated path
return s;
}
}
//return absolute path to file
return StringUtils.replace(file.getAbsolutePath(), '\\', '/');
} | java | protected String fixFilePath(File file) throws MojoExecutionException {
File baseDir = getProject().getFile().getParentFile();
if (file.isAbsolute() && !isRelativeToPath(new File(baseDir, getRelativePath()), file)) {
return StringUtils.replace(getCanonicalPath(file), '\\', '/');
}
if (!file.isAbsolute()) {
file = new File(baseDir, file.getPath());
}
String relative = getRelativePath(new File(baseDir, getRelativePath()), file);
if (!(new File(relative)).isAbsolute()) {
return StringUtils.replace(getRootPath(), '\\', '/') + "/" + relative;
}
//relative path was outside baseDir
//if root path is absolute then try to get a path relative to root
if ((new File(getRootPath())).isAbsolute()) {
String s = getRelativePath(new File(getRootPath()), file);
if (!(new File(s)).isAbsolute()) {
return StringUtils.replace(getRootPath(), '\\', '/') + "/" + s;
}
else {
// root path and the calculated path are absolute, so
// just return calculated path
return s;
}
}
//return absolute path to file
return StringUtils.replace(file.getAbsolutePath(), '\\', '/');
} | [
"protected",
"String",
"fixFilePath",
"(",
"File",
"file",
")",
"throws",
"MojoExecutionException",
"{",
"File",
"baseDir",
"=",
"getProject",
"(",
")",
".",
"getFile",
"(",
")",
".",
"getParentFile",
"(",
")",
";",
"if",
"(",
"file",
".",
"isAbsolute",
"(... | Returns path expressed through rootPath and relativePath.
@param file to be fixed
@return fixed path
@throws MojoExecutionException if something goes wrong | [
"Returns",
"path",
"expressed",
"through",
"rootPath",
"and",
"relativePath",
"."
] | train | https://github.com/zeroturnaround/maven-jrebel-plugin/blob/6a0d12529a13ae6b2b772658a714398147c091ca/src/main/java/org/zeroturnaround/javarebel/maven/GenerateRebelMojo.java#L814-L847 |
alkacon/opencms-core | src/org/opencms/ade/configuration/CmsConfigurationCache.java | CmsConfigurationCache.loadElementViews | protected Map<CmsUUID, CmsElementView> loadElementViews() {
List<CmsElementView> views = new ArrayList<CmsElementView>();
if (m_cms.existsResource("/")) {
views.add(CmsElementView.DEFAULT_ELEMENT_VIEW);
try {
@SuppressWarnings("deprecation")
CmsResourceFilter filter = CmsResourceFilter.ONLY_VISIBLE_NO_DELETED.addRequireType(
m_elementViewType.getTypeId());
List<CmsResource> groups = m_cms.readResources("/", filter);
for (CmsResource res : groups) {
try {
views.add(new CmsElementView(m_cms, res));
} catch (Exception e) {
LOG.error(e.getMessage(), e);
}
}
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
}
Collections.sort(views, new CmsElementView.ElementViewComparator());
Map<CmsUUID, CmsElementView> elementViews = new LinkedHashMap<CmsUUID, CmsElementView>();
for (CmsElementView view : views) {
elementViews.put(view.getId(), view);
}
return elementViews;
}
return null;
} | java | protected Map<CmsUUID, CmsElementView> loadElementViews() {
List<CmsElementView> views = new ArrayList<CmsElementView>();
if (m_cms.existsResource("/")) {
views.add(CmsElementView.DEFAULT_ELEMENT_VIEW);
try {
@SuppressWarnings("deprecation")
CmsResourceFilter filter = CmsResourceFilter.ONLY_VISIBLE_NO_DELETED.addRequireType(
m_elementViewType.getTypeId());
List<CmsResource> groups = m_cms.readResources("/", filter);
for (CmsResource res : groups) {
try {
views.add(new CmsElementView(m_cms, res));
} catch (Exception e) {
LOG.error(e.getMessage(), e);
}
}
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
}
Collections.sort(views, new CmsElementView.ElementViewComparator());
Map<CmsUUID, CmsElementView> elementViews = new LinkedHashMap<CmsUUID, CmsElementView>();
for (CmsElementView view : views) {
elementViews.put(view.getId(), view);
}
return elementViews;
}
return null;
} | [
"protected",
"Map",
"<",
"CmsUUID",
",",
"CmsElementView",
">",
"loadElementViews",
"(",
")",
"{",
"List",
"<",
"CmsElementView",
">",
"views",
"=",
"new",
"ArrayList",
"<",
"CmsElementView",
">",
"(",
")",
";",
"if",
"(",
"m_cms",
".",
"existsResource",
"... | Loads the available element views.<p>
@return the element views | [
"Loads",
"the",
"available",
"element",
"views",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsConfigurationCache.java#L477-L505 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getExplodedToOrderedSet | @Nonnull
@ReturnsMutableCopy
public static CommonsLinkedHashSet <String> getExplodedToOrderedSet (@Nonnull final String sSep,
@Nullable final String sElements)
{
return getExploded (sSep, sElements, -1, new CommonsLinkedHashSet <> ());
} | java | @Nonnull
@ReturnsMutableCopy
public static CommonsLinkedHashSet <String> getExplodedToOrderedSet (@Nonnull final String sSep,
@Nullable final String sElements)
{
return getExploded (sSep, sElements, -1, new CommonsLinkedHashSet <> ());
} | [
"@",
"Nonnull",
"@",
"ReturnsMutableCopy",
"public",
"static",
"CommonsLinkedHashSet",
"<",
"String",
">",
"getExplodedToOrderedSet",
"(",
"@",
"Nonnull",
"final",
"String",
"sSep",
",",
"@",
"Nullable",
"final",
"String",
"sElements",
")",
"{",
"return",
"getExpl... | Take a concatenated String and return an ordered {@link CommonsLinkedHashSet}
of all elements in the passed string, using specified separator string.
@param sSep
The separator to use. May not be <code>null</code>.
@param sElements
The concatenated String to convert. May be <code>null</code> or empty.
@return The ordered {@link Set} represented by the passed string. Never
<code>null</code>. If the passed input string is <code>null</code> or
"" an empty list is returned. | [
"Take",
"a",
"concatenated",
"String",
"and",
"return",
"an",
"ordered",
"{",
"@link",
"CommonsLinkedHashSet",
"}",
"of",
"all",
"elements",
"in",
"the",
"passed",
"string",
"using",
"specified",
"separator",
"string",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L2314-L2320 |
aws/aws-sdk-java | aws-java-sdk-redshift/src/main/java/com/amazonaws/services/redshift/model/GetClusterCredentialsRequest.java | GetClusterCredentialsRequest.getDbGroups | public java.util.List<String> getDbGroups() {
if (dbGroups == null) {
dbGroups = new com.amazonaws.internal.SdkInternalList<String>();
}
return dbGroups;
} | java | public java.util.List<String> getDbGroups() {
if (dbGroups == null) {
dbGroups = new com.amazonaws.internal.SdkInternalList<String>();
}
return dbGroups;
} | [
"public",
"java",
".",
"util",
".",
"List",
"<",
"String",
">",
"getDbGroups",
"(",
")",
"{",
"if",
"(",
"dbGroups",
"==",
"null",
")",
"{",
"dbGroups",
"=",
"new",
"com",
".",
"amazonaws",
".",
"internal",
".",
"SdkInternalList",
"<",
"String",
">",
... | <p>
A list of the names of existing database groups that the user named in <code>DbUser</code> will join for the
current session, in addition to any group memberships for an existing user. If not specified, a new user is added
only to PUBLIC.
</p>
<p>
Database group name constraints
</p>
<ul>
<li>
<p>
Must be 1 to 64 alphanumeric characters or hyphens
</p>
</li>
<li>
<p>
Must contain only lowercase letters, numbers, underscore, plus sign, period (dot), at symbol (@), or hyphen.
</p>
</li>
<li>
<p>
First character must be a letter.
</p>
</li>
<li>
<p>
Must not contain a colon ( : ) or slash ( / ).
</p>
</li>
<li>
<p>
Cannot be a reserved word. A list of reserved words can be found in <a
href="http://docs.aws.amazon.com/redshift/latest/dg/r_pg_keywords.html">Reserved Words</a> in the Amazon Redshift
Database Developer Guide.
</p>
</li>
</ul>
@return A list of the names of existing database groups that the user named in <code>DbUser</code> will join for
the current session, in addition to any group memberships for an existing user. If not specified, a new
user is added only to PUBLIC.</p>
<p>
Database group name constraints
</p>
<ul>
<li>
<p>
Must be 1 to 64 alphanumeric characters or hyphens
</p>
</li>
<li>
<p>
Must contain only lowercase letters, numbers, underscore, plus sign, period (dot), at symbol (@), or
hyphen.
</p>
</li>
<li>
<p>
First character must be a letter.
</p>
</li>
<li>
<p>
Must not contain a colon ( : ) or slash ( / ).
</p>
</li>
<li>
<p>
Cannot be a reserved word. A list of reserved words can be found in <a
href="http://docs.aws.amazon.com/redshift/latest/dg/r_pg_keywords.html">Reserved Words</a> in the Amazon
Redshift Database Developer Guide.
</p>
</li> | [
"<p",
">",
"A",
"list",
"of",
"the",
"names",
"of",
"existing",
"database",
"groups",
"that",
"the",
"user",
"named",
"in",
"<code",
">",
"DbUser<",
"/",
"code",
">",
"will",
"join",
"for",
"the",
"current",
"session",
"in",
"addition",
"to",
"any",
"g... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-redshift/src/main/java/com/amazonaws/services/redshift/model/GetClusterCredentialsRequest.java#L961-L966 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/LocalNameRangeQuery.java | LocalNameRangeQuery.getLowerTerm | private static Term getLowerTerm(String lowerName) {
String text;
if (lowerName == null) {
text = "";
} else {
text = lowerName;
}
return new Term(FieldNames.LOCAL_NAME, text);
} | java | private static Term getLowerTerm(String lowerName) {
String text;
if (lowerName == null) {
text = "";
} else {
text = lowerName;
}
return new Term(FieldNames.LOCAL_NAME, text);
} | [
"private",
"static",
"Term",
"getLowerTerm",
"(",
"String",
"lowerName",
")",
"{",
"String",
"text",
";",
"if",
"(",
"lowerName",
"==",
"null",
")",
"{",
"text",
"=",
"\"\"",
";",
"}",
"else",
"{",
"text",
"=",
"lowerName",
";",
"}",
"return",
"new",
... | Creates a {@link Term} for the lower bound local name.
@param lowerName the lower bound local name.
@return a {@link Term} for the lower bound local name. | [
"Creates",
"a",
"{",
"@link",
"Term",
"}",
"for",
"the",
"lower",
"bound",
"local",
"name",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/LocalNameRangeQuery.java#L52-L60 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.