repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
jbundle/jbundle | base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBaseGridScreen.java | HBaseGridScreen.printEndRecordGridData | public void printEndRecordGridData(PrintWriter out, int iPrintOptions)
{
out.println("</table>");
if ((iPrintOptions & HtmlConstants.DETAIL_SCREEN) == HtmlConstants.DETAIL_SCREEN)
{
out.println("</td>\n</tr>");
}
} | java | public void printEndRecordGridData(PrintWriter out, int iPrintOptions)
{
out.println("</table>");
if ((iPrintOptions & HtmlConstants.DETAIL_SCREEN) == HtmlConstants.DETAIL_SCREEN)
{
out.println("</td>\n</tr>");
}
} | [
"public",
"void",
"printEndRecordGridData",
"(",
"PrintWriter",
"out",
",",
"int",
"iPrintOptions",
")",
"{",
"out",
".",
"println",
"(",
"\"</table>\"",
")",
";",
"if",
"(",
"(",
"iPrintOptions",
"&",
"HtmlConstants",
".",
"DETAIL_SCREEN",
")",
"==",
"HtmlCon... | Display the end grid in input format.
@return true if default params were found for this form.
@param out The http output stream.
@exception DBException File exception. | [
"Display",
"the",
"end",
"grid",
"in",
"input",
"format",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBaseGridScreen.java#L175-L182 |
soulgalore/crawler | src/main/java/com/soulgalore/crawler/util/AuthUtil.java | AuthUtil.createAuthsFromString | public Set<Auth> createAuthsFromString(String authInfo) {
if ("".equals(authInfo) || authInfo == null) return Collections.emptySet();
String[] parts = authInfo.split(",");
final Set<Auth> auths = new HashSet<Auth>();
try {
for (String auth : parts) {
StringTokenizer tokenizer = new StringTokenizer(auth, ":");
while (tokenizer.hasMoreTokens()) {
auths.add(new Auth(tokenizer.nextToken(), tokenizer.nextToken(), tokenizer.nextToken(),
tokenizer.nextToken()));
}
}
return auths;
} catch (NoSuchElementException e) {
final StringBuilder b = new StringBuilder();
for (String auth : parts) {
b.append(auth);
}
throw new IllegalArgumentException(
"Auth configuration is configured wrongly:" + b.toString(), e);
}
} | java | public Set<Auth> createAuthsFromString(String authInfo) {
if ("".equals(authInfo) || authInfo == null) return Collections.emptySet();
String[] parts = authInfo.split(",");
final Set<Auth> auths = new HashSet<Auth>();
try {
for (String auth : parts) {
StringTokenizer tokenizer = new StringTokenizer(auth, ":");
while (tokenizer.hasMoreTokens()) {
auths.add(new Auth(tokenizer.nextToken(), tokenizer.nextToken(), tokenizer.nextToken(),
tokenizer.nextToken()));
}
}
return auths;
} catch (NoSuchElementException e) {
final StringBuilder b = new StringBuilder();
for (String auth : parts) {
b.append(auth);
}
throw new IllegalArgumentException(
"Auth configuration is configured wrongly:" + b.toString(), e);
}
} | [
"public",
"Set",
"<",
"Auth",
">",
"createAuthsFromString",
"(",
"String",
"authInfo",
")",
"{",
"if",
"(",
"\"\"",
".",
"equals",
"(",
"authInfo",
")",
"||",
"authInfo",
"==",
"null",
")",
"return",
"Collections",
".",
"emptySet",
"(",
")",
";",
"String... | Create a auth object from a String looking like.
@param authInfo the authinfo in the form of
@return a Set of auth | [
"Create",
"a",
"auth",
"object",
"from",
"a",
"String",
"looking",
"like",
"."
] | train | https://github.com/soulgalore/crawler/blob/715ee7f1454eec14bebcb6d12563dfc32d9bbf48/src/main/java/com/soulgalore/crawler/util/AuthUtil.java#L36-L65 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/utils/btree/NodeBuilder.java | NodeBuilder.addExtraChild | private void addExtraChild(Object[] child, Object upperBound)
{
ensureRoom(buildKeyPosition + 1);
buildKeys[buildKeyPosition++] = upperBound;
buildChildren[buildChildPosition++] = child;
} | java | private void addExtraChild(Object[] child, Object upperBound)
{
ensureRoom(buildKeyPosition + 1);
buildKeys[buildKeyPosition++] = upperBound;
buildChildren[buildChildPosition++] = child;
} | [
"private",
"void",
"addExtraChild",
"(",
"Object",
"[",
"]",
"child",
",",
"Object",
"upperBound",
")",
"{",
"ensureRoom",
"(",
"buildKeyPosition",
"+",
"1",
")",
";",
"buildKeys",
"[",
"buildKeyPosition",
"++",
"]",
"=",
"upperBound",
";",
"buildChildren",
... | adds a new and unexpected child to the builder - called by children that overflow | [
"adds",
"a",
"new",
"and",
"unexpected",
"child",
"to",
"the",
"builder",
"-",
"called",
"by",
"children",
"that",
"overflow"
] | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/utils/btree/NodeBuilder.java#L341-L346 |
lessthanoptimal/BoofCV | main/boofcv-io/src/main/java/boofcv/io/image/ConvertBufferedImage.java | ConvertBufferedImage.extractBuffered | public static BufferedImage extractBuffered(GrayU8 img) {
if (img.isSubimage())
throw new IllegalArgumentException("Sub-images are not supported for this operation");
final int width = img.width;
final int height = img.height;
// wrap the byte array
DataBuffer bufferByte = new DataBufferByte(img.data, width * height, 0);
ColorModel colorModel;
int[] bOffs = new int[]{0};
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
int[] nBits = {8};
colorModel = new ComponentColorModel(cs, nBits, false, true,
Transparency.OPAQUE,
DataBuffer.TYPE_BYTE);
// Create a raster using the sample model and data buffer
WritableRaster raster = Raster.createInterleavedRaster(
bufferByte, width, height, img.stride, 1, bOffs, new Point(0, 0));
// Combine the color model and raster into a buffered image
return new BufferedImage(colorModel, raster, false, null);
} | java | public static BufferedImage extractBuffered(GrayU8 img) {
if (img.isSubimage())
throw new IllegalArgumentException("Sub-images are not supported for this operation");
final int width = img.width;
final int height = img.height;
// wrap the byte array
DataBuffer bufferByte = new DataBufferByte(img.data, width * height, 0);
ColorModel colorModel;
int[] bOffs = new int[]{0};
ColorSpace cs = ColorSpace.getInstance(ColorSpace.CS_GRAY);
int[] nBits = {8};
colorModel = new ComponentColorModel(cs, nBits, false, true,
Transparency.OPAQUE,
DataBuffer.TYPE_BYTE);
// Create a raster using the sample model and data buffer
WritableRaster raster = Raster.createInterleavedRaster(
bufferByte, width, height, img.stride, 1, bOffs, new Point(0, 0));
// Combine the color model and raster into a buffered image
return new BufferedImage(colorModel, raster, false, null);
} | [
"public",
"static",
"BufferedImage",
"extractBuffered",
"(",
"GrayU8",
"img",
")",
"{",
"if",
"(",
"img",
".",
"isSubimage",
"(",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Sub-images are not supported for this operation\"",
")",
";",
"final",
"in... | <p>
Creates a new BufferedImage that internally uses the same data as the provided
GrayU8. The returned BufferedImage will be of type TYPE_BYTE_GRAY.
</p>
<p/>
<p>
NOTE: This only works on images which are not subimages!
</p>
@param img Input image who's data will be wrapped by the returned BufferedImage.
@return BufferedImage which shared data with the input image. | [
"<p",
">",
"Creates",
"a",
"new",
"BufferedImage",
"that",
"internally",
"uses",
"the",
"same",
"data",
"as",
"the",
"provided",
"GrayU8",
".",
"The",
"returned",
"BufferedImage",
"will",
"be",
"of",
"type",
"TYPE_BYTE_GRAY",
".",
"<",
"/",
"p",
">",
"<p",... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-io/src/main/java/boofcv/io/image/ConvertBufferedImage.java#L235-L260 |
apache/incubator-druid | core/src/main/java/org/apache/druid/math/expr/ExprMacroTable.java | ExprMacroTable.get | @Nullable
public Expr get(final String functionName, final List<Expr> args)
{
final ExprMacro exprMacro = macroMap.get(StringUtils.toLowerCase(functionName));
if (exprMacro == null) {
return null;
}
return exprMacro.apply(args);
} | java | @Nullable
public Expr get(final String functionName, final List<Expr> args)
{
final ExprMacro exprMacro = macroMap.get(StringUtils.toLowerCase(functionName));
if (exprMacro == null) {
return null;
}
return exprMacro.apply(args);
} | [
"@",
"Nullable",
"public",
"Expr",
"get",
"(",
"final",
"String",
"functionName",
",",
"final",
"List",
"<",
"Expr",
">",
"args",
")",
"{",
"final",
"ExprMacro",
"exprMacro",
"=",
"macroMap",
".",
"get",
"(",
"StringUtils",
".",
"toLowerCase",
"(",
"functi... | Returns an expr corresponding to a function call if this table has an entry for {@code functionName}.
Otherwise, returns null.
@param functionName function name
@param args function arguments
@return expr for this function call, or null | [
"Returns",
"an",
"expr",
"corresponding",
"to",
"a",
"function",
"call",
"if",
"this",
"table",
"has",
"an",
"entry",
"for",
"{",
"@code",
"functionName",
"}",
".",
"Otherwise",
"returns",
"null",
"."
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/math/expr/ExprMacroTable.java#L66-L75 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java | Calc.getTransformation | public static Matrix4d getTransformation(Matrix rot, Atom trans) {
return new Matrix4d(new Matrix3d(rot.getColumnPackedCopy()),
new Vector3d(trans.getCoordsAsPoint3d()), 1.0);
} | java | public static Matrix4d getTransformation(Matrix rot, Atom trans) {
return new Matrix4d(new Matrix3d(rot.getColumnPackedCopy()),
new Vector3d(trans.getCoordsAsPoint3d()), 1.0);
} | [
"public",
"static",
"Matrix4d",
"getTransformation",
"(",
"Matrix",
"rot",
",",
"Atom",
"trans",
")",
"{",
"return",
"new",
"Matrix4d",
"(",
"new",
"Matrix3d",
"(",
"rot",
".",
"getColumnPackedCopy",
"(",
")",
")",
",",
"new",
"Vector3d",
"(",
"trans",
"."... | Convert JAMA rotation and translation to a Vecmath transformation matrix.
Because the JAMA matrix is a pre-multiplication matrix and the Vecmath
matrix is a post-multiplication one, the rotation matrix is transposed to
ensure that the transformation they produce is the same.
@param rot
3x3 Rotation matrix
@param trans
3x1 translation vector in Atom coordinates
@return 4x4 transformation matrix | [
"Convert",
"JAMA",
"rotation",
"and",
"translation",
"to",
"a",
"Vecmath",
"transformation",
"matrix",
".",
"Because",
"the",
"JAMA",
"matrix",
"is",
"a",
"pre",
"-",
"multiplication",
"matrix",
"and",
"the",
"Vecmath",
"matrix",
"is",
"a",
"post",
"-",
"mul... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L1199-L1202 |
MariaDB/mariadb-connector-j | src/main/java/org/mariadb/jdbc/BasePrepareStatement.java | BasePrepareStatement.setBlob | public void setBlob(final int parameterIndex, final Blob blob) throws SQLException {
if (blob == null) {
setNull(parameterIndex, Types.BLOB);
return;
}
setParameter(parameterIndex,
new StreamParameter(blob.getBinaryStream(), blob.length(), noBackslashEscapes));
hasLongData = true;
} | java | public void setBlob(final int parameterIndex, final Blob blob) throws SQLException {
if (blob == null) {
setNull(parameterIndex, Types.BLOB);
return;
}
setParameter(parameterIndex,
new StreamParameter(blob.getBinaryStream(), blob.length(), noBackslashEscapes));
hasLongData = true;
} | [
"public",
"void",
"setBlob",
"(",
"final",
"int",
"parameterIndex",
",",
"final",
"Blob",
"blob",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"blob",
"==",
"null",
")",
"{",
"setNull",
"(",
"parameterIndex",
",",
"Types",
".",
"BLOB",
")",
";",
"retur... | Sets the designated parameter to the given <code>java.sql.Blob</code> object. The driver
converts this to an SQL
<code>BLOB</code> value when it sends it to the database.
@param parameterIndex the first parameter is 1, the second is 2, ...
@param blob a <code>Blob</code> object that maps an SQL <code>BLOB</code> value
@throws SQLException if parameterIndex does not correspond to a parameter
marker in the SQL statement; if a database access error
occurs or this method is called on a closed
<code>PreparedStatement</code> | [
"Sets",
"the",
"designated",
"parameter",
"to",
"the",
"given",
"<code",
">",
"java",
".",
"sql",
".",
"Blob<",
"/",
"code",
">",
"object",
".",
"The",
"driver",
"converts",
"this",
"to",
"an",
"SQL",
"<code",
">",
"BLOB<",
"/",
"code",
">",
"value",
... | train | https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/BasePrepareStatement.java#L305-L313 |
beangle/beangle3 | commons/core/src/main/java/org/beangle/commons/collection/FastHashMap.java | FastHashMap.removeEntry | private void removeEntry(EntryImpl<K, V> entry) {
// Removes from bucket.
EntryImpl<K, V> previous = entry._previous;
EntryImpl<K, V> next = entry._next;
if (previous != null) {
previous._next = next;
entry._previous = null;
} else { // First in bucket.
_entries[entry._index] = next;
}
if (next != null) {
next._previous = previous;
entry._next = null;
} // Else do nothing, no last pointer.
// Removes from collection.
EntryImpl<K, V> before = entry._before;
EntryImpl<K, V> after = entry._after;
if (before != null) {
before._after = after;
entry._before = null;
} else { // First in collection.
_mapFirst = after;
}
if (after != null) {
after._before = before;
} else { // Last in collection.
_mapLast = before;
}
// Clears value and key.
entry._key = null;
entry._value = null;
// Recycles.
entry._after = _poolFirst;
_poolFirst = entry;
// Updates size.
_size--;
sizeChanged();
} | java | private void removeEntry(EntryImpl<K, V> entry) {
// Removes from bucket.
EntryImpl<K, V> previous = entry._previous;
EntryImpl<K, V> next = entry._next;
if (previous != null) {
previous._next = next;
entry._previous = null;
} else { // First in bucket.
_entries[entry._index] = next;
}
if (next != null) {
next._previous = previous;
entry._next = null;
} // Else do nothing, no last pointer.
// Removes from collection.
EntryImpl<K, V> before = entry._before;
EntryImpl<K, V> after = entry._after;
if (before != null) {
before._after = after;
entry._before = null;
} else { // First in collection.
_mapFirst = after;
}
if (after != null) {
after._before = before;
} else { // Last in collection.
_mapLast = before;
}
// Clears value and key.
entry._key = null;
entry._value = null;
// Recycles.
entry._after = _poolFirst;
_poolFirst = entry;
// Updates size.
_size--;
sizeChanged();
} | [
"private",
"void",
"removeEntry",
"(",
"EntryImpl",
"<",
"K",
",",
"V",
">",
"entry",
")",
"{",
"// Removes from bucket.",
"EntryImpl",
"<",
"K",
",",
"V",
">",
"previous",
"=",
"entry",
".",
"_previous",
";",
"EntryImpl",
"<",
"K",
",",
"V",
">",
"nex... | Removes the specified entry from the map.
@param entry the entry to be removed. | [
"Removes",
"the",
"specified",
"entry",
"from",
"the",
"map",
"."
] | train | https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/collection/FastHashMap.java#L690-L732 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/WebSiteManagementClientImpl.java | WebSiteManagementClientImpl.moveAsync | public Observable<Void> moveAsync(String resourceGroupName, CsmMoveResourceEnvelope moveResourceEnvelope) {
return moveWithServiceResponseAsync(resourceGroupName, moveResourceEnvelope).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> moveAsync(String resourceGroupName, CsmMoveResourceEnvelope moveResourceEnvelope) {
return moveWithServiceResponseAsync(resourceGroupName, moveResourceEnvelope).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"moveAsync",
"(",
"String",
"resourceGroupName",
",",
"CsmMoveResourceEnvelope",
"moveResourceEnvelope",
")",
"{",
"return",
"moveWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"moveResourceEnvelope",
")",
".",
"map",
... | Move resources between resource groups.
Move resources between resource groups.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param moveResourceEnvelope Object that represents the resource to move.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Move",
"resources",
"between",
"resource",
"groups",
".",
"Move",
"resources",
"between",
"resource",
"groups",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/WebSiteManagementClientImpl.java#L2176-L2183 |
banq/jdonframework | src/main/java/com/jdon/util/UtilDateTime.java | UtilDateTime.toTimeString | public static String toTimeString(int hour, int minute, int second) {
String hourStr;
String minuteStr;
String secondStr;
if (hour < 10) {
hourStr = "0" + hour;
} else {
hourStr = "" + hour;
}
if (minute < 10) {
minuteStr = "0" + minute;
} else {
minuteStr = "" + minute;
}
if (second < 10) {
secondStr = "0" + second;
} else {
secondStr = "" + second;
}
if (second == 0)
return hourStr + ":" + minuteStr;
else
return hourStr + ":" + minuteStr + ":" + secondStr;
} | java | public static String toTimeString(int hour, int minute, int second) {
String hourStr;
String minuteStr;
String secondStr;
if (hour < 10) {
hourStr = "0" + hour;
} else {
hourStr = "" + hour;
}
if (minute < 10) {
minuteStr = "0" + minute;
} else {
minuteStr = "" + minute;
}
if (second < 10) {
secondStr = "0" + second;
} else {
secondStr = "" + second;
}
if (second == 0)
return hourStr + ":" + minuteStr;
else
return hourStr + ":" + minuteStr + ":" + secondStr;
} | [
"public",
"static",
"String",
"toTimeString",
"(",
"int",
"hour",
",",
"int",
"minute",
",",
"int",
"second",
")",
"{",
"String",
"hourStr",
";",
"String",
"minuteStr",
";",
"String",
"secondStr",
";",
"if",
"(",
"hour",
"<",
"10",
")",
"{",
"hourStr",
... | Makes a time String in the format HH:MM:SS from a separate ints for hour,
minute, and second. If the seconds are 0, then the output is in HH:MM.
@param hour
The hour int
@param minute
The minute int
@param second
The second int
@return A time String in the format HH:MM:SS or HH:MM | [
"Makes",
"a",
"time",
"String",
"in",
"the",
"format",
"HH",
":",
"MM",
":",
"SS",
"from",
"a",
"separate",
"ints",
"for",
"hour",
"minute",
"and",
"second",
".",
"If",
"the",
"seconds",
"are",
"0",
"then",
"the",
"output",
"is",
"in",
"HH",
":",
"... | train | https://github.com/banq/jdonframework/blob/72b451caac04f775e57f52aaed3d8775044ead53/src/main/java/com/jdon/util/UtilDateTime.java#L484-L508 |
respoke/respoke-sdk-android | respokeSDK/src/main/java/com/digium/respokesdk/RespokeClient.java | RespokeClient.getConnection | public RespokeConnection getConnection(String connectionID, String endpointID, boolean skipCreate) {
RespokeConnection connection = null;
if (null != connectionID) {
RespokeEndpoint endpoint = getEndpoint(endpointID, skipCreate);
if (null != endpoint) {
for (RespokeConnection eachConnection : endpoint.connections) {
if (eachConnection.connectionID.equals(connectionID)) {
connection = eachConnection;
break;
}
}
if ((null == connection) && (!skipCreate)) {
connection = new RespokeConnection(connectionID, endpoint);
endpoint.connections.add(connection);
}
}
}
return connection;
} | java | public RespokeConnection getConnection(String connectionID, String endpointID, boolean skipCreate) {
RespokeConnection connection = null;
if (null != connectionID) {
RespokeEndpoint endpoint = getEndpoint(endpointID, skipCreate);
if (null != endpoint) {
for (RespokeConnection eachConnection : endpoint.connections) {
if (eachConnection.connectionID.equals(connectionID)) {
connection = eachConnection;
break;
}
}
if ((null == connection) && (!skipCreate)) {
connection = new RespokeConnection(connectionID, endpoint);
endpoint.connections.add(connection);
}
}
}
return connection;
} | [
"public",
"RespokeConnection",
"getConnection",
"(",
"String",
"connectionID",
",",
"String",
"endpointID",
",",
"boolean",
"skipCreate",
")",
"{",
"RespokeConnection",
"connection",
"=",
"null",
";",
"if",
"(",
"null",
"!=",
"connectionID",
")",
"{",
"RespokeEndp... | Find a Connection by id and return it. In most cases, if we don't find it we will create it. This is useful
in the case of dynamic endpoints where groups are not in use. Set skipCreate=true to return null
if the Connection is not already known.
@param connectionID The ID of the connection to return
@param endpointID The ID of the endpoint to which this connection belongs
@param skipCreate If true, return null if the connection is not already known
@return The connection whose ID was specified | [
"Find",
"a",
"Connection",
"by",
"id",
"and",
"return",
"it",
".",
"In",
"most",
"cases",
"if",
"we",
"don",
"t",
"find",
"it",
"we",
"will",
"create",
"it",
".",
"This",
"is",
"useful",
"in",
"the",
"case",
"of",
"dynamic",
"endpoints",
"where",
"gr... | train | https://github.com/respoke/respoke-sdk-android/blob/34a15f0558d29b1f1bc8481bbc5c505e855e05ef/respokeSDK/src/main/java/com/digium/respokesdk/RespokeClient.java#L456-L478 |
IBM/ibm-cos-sdk-java | ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/aspera/transfer/AsperaTransferManager.java | AsperaTransferManager.uploadDirectory | public Future<AsperaTransaction> uploadDirectory(String bucketName, String virtualDirectoryKeyPrefix, File directory,
boolean includeSubdirectories) {
return uploadDirectory(bucketName, virtualDirectoryKeyPrefix, directory, includeSubdirectories, asperaConfig, null);
} | java | public Future<AsperaTransaction> uploadDirectory(String bucketName, String virtualDirectoryKeyPrefix, File directory,
boolean includeSubdirectories) {
return uploadDirectory(bucketName, virtualDirectoryKeyPrefix, directory, includeSubdirectories, asperaConfig, null);
} | [
"public",
"Future",
"<",
"AsperaTransaction",
">",
"uploadDirectory",
"(",
"String",
"bucketName",
",",
"String",
"virtualDirectoryKeyPrefix",
",",
"File",
"directory",
",",
"boolean",
"includeSubdirectories",
")",
"{",
"return",
"uploadDirectory",
"(",
"bucketName",
... | Subdirectories are included in the upload by default, to exclude ensure you pass through 'false' for
includeSubdirectories param
@param bucketName
@param virtualDirectoryKeyPrefix
@param directory
@param includeSubdirectories
@return | [
"Subdirectories",
"are",
"included",
"in",
"the",
"upload",
"by",
"default",
"to",
"exclude",
"ensure",
"you",
"pass",
"through",
"false",
"for",
"includeSubdirectories",
"param"
] | train | https://github.com/IBM/ibm-cos-sdk-java/blob/d0bb2dd754c328a05e7dba8dc42e28b271b6daf2/ibm-cos-java-sdk-s3/src/main/java/com/ibm/cloud/objectstorage/services/aspera/transfer/AsperaTransferManager.java#L237-L240 |
wildfly/wildfly-core | process-controller/src/main/java/org/jboss/as/process/ProcessUtils.java | ProcessUtils.resolveProcessId | private int resolveProcessId(final String processName, int id) throws IOException {
final String jpsCommand = getJpsCommand();
if(jpsCommand == null) {
ProcessLogger.ROOT_LOGGER.jpsCommandNotFound(processName);
return -1;
}
final Process p = Runtime.getRuntime().exec(jpsCommand);
final List<String> processes = new ArrayList<>();
final BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream(), StandardCharsets.UTF_8));
try {
String line;
// See if the process contains "jboss-modules.jar" and "-D[Server:server-one]"
final String process = "-D[" + processName + "]";
final String idParam = id < 0 ? null : "-D[pcid:" + id + "]";
while ((line = input.readLine()) != null) {
if (line.contains(modulesJar) && line.contains(process)
&& (idParam == null || line.contains(idParam))) {
processes.add(line);
}
}
} finally {
StreamUtils.safeClose(input);
}
if(processes.size() == 1) {
final String proc = processes.get(0);
final int i = proc.indexOf(' ');
return Integer.parseInt(proc.substring(0, i));
}
if(processes.isEmpty()) {
ProcessLogger.ROOT_LOGGER.processNotFound(processName);
} else {
ProcessLogger.ROOT_LOGGER.multipleProcessesFound(processName);
}
return -1;
} | java | private int resolveProcessId(final String processName, int id) throws IOException {
final String jpsCommand = getJpsCommand();
if(jpsCommand == null) {
ProcessLogger.ROOT_LOGGER.jpsCommandNotFound(processName);
return -1;
}
final Process p = Runtime.getRuntime().exec(jpsCommand);
final List<String> processes = new ArrayList<>();
final BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream(), StandardCharsets.UTF_8));
try {
String line;
// See if the process contains "jboss-modules.jar" and "-D[Server:server-one]"
final String process = "-D[" + processName + "]";
final String idParam = id < 0 ? null : "-D[pcid:" + id + "]";
while ((line = input.readLine()) != null) {
if (line.contains(modulesJar) && line.contains(process)
&& (idParam == null || line.contains(idParam))) {
processes.add(line);
}
}
} finally {
StreamUtils.safeClose(input);
}
if(processes.size() == 1) {
final String proc = processes.get(0);
final int i = proc.indexOf(' ');
return Integer.parseInt(proc.substring(0, i));
}
if(processes.isEmpty()) {
ProcessLogger.ROOT_LOGGER.processNotFound(processName);
} else {
ProcessLogger.ROOT_LOGGER.multipleProcessesFound(processName);
}
return -1;
} | [
"private",
"int",
"resolveProcessId",
"(",
"final",
"String",
"processName",
",",
"int",
"id",
")",
"throws",
"IOException",
"{",
"final",
"String",
"jpsCommand",
"=",
"getJpsCommand",
"(",
")",
";",
"if",
"(",
"jpsCommand",
"==",
"null",
")",
"{",
"ProcessL... | Iterate through all java processes and try to find the one matching to the given process id.
This will return the resolved process-id or {@code -1} if not resolvable.
@param processName the process name
@param id the process integer id, or {@code -1} if this is not relevant
@return the process id
@throws IOException | [
"Iterate",
"through",
"all",
"java",
"processes",
"and",
"try",
"to",
"find",
"the",
"one",
"matching",
"to",
"the",
"given",
"process",
"id",
".",
"This",
"will",
"return",
"the",
"resolved",
"process",
"-",
"id",
"or",
"{",
"@code",
"-",
"1",
"}",
"i... | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/process-controller/src/main/java/org/jboss/as/process/ProcessUtils.java#L89-L123 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/loader/PersistenceXMLLoader.java | PersistenceXMLLoader.getElementContent | private static String getElementContent(Element element, String defaultStr)
{
if (element == null)
{
return defaultStr;
}
NodeList children = element.getChildNodes();
StringBuilder result = new StringBuilder("");
for (int i = 0; i < children.getLength(); i++)
{
if (children.item(i).getNodeType() == Node.TEXT_NODE
|| children.item(i).getNodeType() == Node.CDATA_SECTION_NODE)
{
result.append(children.item(i).getNodeValue());
}
}
return result.toString().trim();
} | java | private static String getElementContent(Element element, String defaultStr)
{
if (element == null)
{
return defaultStr;
}
NodeList children = element.getChildNodes();
StringBuilder result = new StringBuilder("");
for (int i = 0; i < children.getLength(); i++)
{
if (children.item(i).getNodeType() == Node.TEXT_NODE
|| children.item(i).getNodeType() == Node.CDATA_SECTION_NODE)
{
result.append(children.item(i).getNodeValue());
}
}
return result.toString().trim();
} | [
"private",
"static",
"String",
"getElementContent",
"(",
"Element",
"element",
",",
"String",
"defaultStr",
")",
"{",
"if",
"(",
"element",
"==",
"null",
")",
"{",
"return",
"defaultStr",
";",
"}",
"NodeList",
"children",
"=",
"element",
".",
"getChildNodes",
... | Get the content of the given element.
@param element
The element to get the content for.
@param defaultStr
The default to return when there is no content.
@return The content of the element or the default.
@throws Exception
the exception | [
"Get",
"the",
"content",
"of",
"the",
"given",
"element",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/loader/PersistenceXMLLoader.java#L535-L553 |
jhunters/jprotobuf | src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLProxy.java | ProtobufIDLProxy.createSingle | public static IDLProxyObject createSingle(InputStream is, boolean debug, File path) throws IOException {
return createSingle(is, debug, path, true);
} | java | public static IDLProxyObject createSingle(InputStream is, boolean debug, File path) throws IOException {
return createSingle(is, debug, path, true);
} | [
"public",
"static",
"IDLProxyObject",
"createSingle",
"(",
"InputStream",
"is",
",",
"boolean",
"debug",
",",
"File",
"path",
")",
"throws",
"IOException",
"{",
"return",
"createSingle",
"(",
"is",
",",
"debug",
",",
"path",
",",
"true",
")",
";",
"}"
] | Creates the single.
@param is the is
@param debug the debug
@param path the path
@return the IDL proxy object
@throws IOException Signals that an I/O exception has occurred. | [
"Creates",
"the",
"single",
"."
] | train | https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/src/main/java/com/baidu/bjf/remoting/protobuf/ProtobufIDLProxy.java#L1002-L1004 |
wildfly/wildfly-maven-plugin | core/src/main/java/org/wildfly/plugin/core/Deployment.java | Deployment.of | public static Deployment of(final Path content) {
final DeploymentContent deploymentContent = DeploymentContent.of(Assert.checkNotNullParam("content", content));
return new Deployment(deploymentContent, null);
} | java | public static Deployment of(final Path content) {
final DeploymentContent deploymentContent = DeploymentContent.of(Assert.checkNotNullParam("content", content));
return new Deployment(deploymentContent, null);
} | [
"public",
"static",
"Deployment",
"of",
"(",
"final",
"Path",
"content",
")",
"{",
"final",
"DeploymentContent",
"deploymentContent",
"=",
"DeploymentContent",
".",
"of",
"(",
"Assert",
".",
"checkNotNullParam",
"(",
"\"content\"",
",",
"content",
")",
")",
";",... | Creates a new deployment for the path. If the path is a directory the content will be deployed exploded using
the file system location.
@param content the path containing the content
@return the deployment | [
"Creates",
"a",
"new",
"deployment",
"for",
"the",
"path",
".",
"If",
"the",
"path",
"is",
"a",
"directory",
"the",
"content",
"will",
"be",
"deployed",
"exploded",
"using",
"the",
"file",
"system",
"location",
"."
] | train | https://github.com/wildfly/wildfly-maven-plugin/blob/c0e2d7ee28e511092561801959eae253b2b56def/core/src/main/java/org/wildfly/plugin/core/Deployment.java#L79-L82 |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/designer/LayoutManager.java | LayoutManager.show | public static void show(boolean manage, String deflt, IEventListener closeListener) {
Map<String, Object> args = new HashMap<>();
args.put("manage", manage);
args.put("deflt", deflt);
PopupDialog.show(RESOURCE_PREFIX + "layoutManager.fsp", args, true, true, true, closeListener);
} | java | public static void show(boolean manage, String deflt, IEventListener closeListener) {
Map<String, Object> args = new HashMap<>();
args.put("manage", manage);
args.put("deflt", deflt);
PopupDialog.show(RESOURCE_PREFIX + "layoutManager.fsp", args, true, true, true, closeListener);
} | [
"public",
"static",
"void",
"show",
"(",
"boolean",
"manage",
",",
"String",
"deflt",
",",
"IEventListener",
"closeListener",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"args",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"args",
".",
"put",
"(... | Invokes the layout manager dialog.
@param manage If true, open in management mode; otherwise, in selection mode.
@param deflt Default layout name.
@param closeListener Close event listener. | [
"Invokes",
"the",
"layout",
"manager",
"dialog",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/designer/LayoutManager.java#L171-L176 |
gallandarakhneorg/afc | core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java | GraphPath.removeBefore | @Override
public boolean removeBefore(ST obj, PT pt) {
return removeUntil(indexOf(obj, pt), false);
} | java | @Override
public boolean removeBefore(ST obj, PT pt) {
return removeUntil(indexOf(obj, pt), false);
} | [
"@",
"Override",
"public",
"boolean",
"removeBefore",
"(",
"ST",
"obj",
",",
"PT",
"pt",
")",
"{",
"return",
"removeUntil",
"(",
"indexOf",
"(",
"obj",
",",
"pt",
")",
",",
"false",
")",
";",
"}"
] | Remove the path's elements before the
specified one which is starting
at the specified point. The specified element will
not be removed.
<p>This function removes until the <i>first occurence</i>
of the given object.
@param obj is the segment to remove
@param pt is the point on which the segment was connected
as its first point.
@return <code>true</code> on success, otherwise <code>false</code> | [
"Remove",
"the",
"path",
"s",
"elements",
"before",
"the",
"specified",
"one",
"which",
"is",
"starting",
"at",
"the",
"specified",
"point",
".",
"The",
"specified",
"element",
"will",
"not",
"be",
"removed",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java#L658-L661 |
lessthanoptimal/ddogleg | src/org/ddogleg/nn/FactoryNearestNeighbor.java | FactoryNearestNeighbor.kdRandomForest | public static <P> NearestNeighbor<P> kdRandomForest( KdTreeDistance<P> distance ,
int maxNodesSearched , int numTrees , int numConsiderSplit ,
long randomSeed ) {
Random rand = new Random(randomSeed);
return new KdForestBbfSearch<>(numTrees,maxNodesSearched,distance,
new AxisSplitterMedian<>(distance,new AxisSplitRuleRandomK(rand,numConsiderSplit)));
} | java | public static <P> NearestNeighbor<P> kdRandomForest( KdTreeDistance<P> distance ,
int maxNodesSearched , int numTrees , int numConsiderSplit ,
long randomSeed ) {
Random rand = new Random(randomSeed);
return new KdForestBbfSearch<>(numTrees,maxNodesSearched,distance,
new AxisSplitterMedian<>(distance,new AxisSplitRuleRandomK(rand,numConsiderSplit)));
} | [
"public",
"static",
"<",
"P",
">",
"NearestNeighbor",
"<",
"P",
">",
"kdRandomForest",
"(",
"KdTreeDistance",
"<",
"P",
">",
"distance",
",",
"int",
"maxNodesSearched",
",",
"int",
"numTrees",
",",
"int",
"numConsiderSplit",
",",
"long",
"randomSeed",
")",
"... | Approximate {@link NearestNeighbor} search which uses a set of randomly generated K-D trees and a Best-Bin-First
search. Designed to work in high dimensional space. Distance measure is Euclidean squared.
@see KdForestBbfSearch
@see AxisSplitterMedian
@param distance Specifies how distance is computed between two points.
@param maxNodesSearched Maximum number of nodes it will search. Controls speed and accuracy.
@param numTrees Number of trees that are considered. Try 10 and tune.
@param numConsiderSplit Number of nodes that are considered when generating a tree. Must be less than the
point's dimension. Try 5
@param randomSeed Seed used by random number generator
@param <P> Point type.
@return {@link NearestNeighbor} implementation | [
"Approximate",
"{",
"@link",
"NearestNeighbor",
"}",
"search",
"which",
"uses",
"a",
"set",
"of",
"randomly",
"generated",
"K",
"-",
"D",
"trees",
"and",
"a",
"Best",
"-",
"Bin",
"-",
"First",
"search",
".",
"Designed",
"to",
"work",
"in",
"high",
"dimen... | train | https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/nn/FactoryNearestNeighbor.java#L88-L96 |
code4everything/util | src/main/java/com/zhazhapan/util/RandomUtils.java | RandomUtils.getRandomIntegerIgnoreRange | public static int getRandomIntegerIgnoreRange(int floor, int ceil, int[]... ranges) {
int result = getRandomInteger(floor, ceil);
for (int[] range : ranges) {
if (range[0] <= result && result <= range[1]) {
if (range[0] > floor) {
result = getRandomIntegerIgnoreRange(floor, range[0], ranges);
} else if (range[1] < ceil) {
result = getRandomIntegerIgnoreRange(range[1], ceil, ranges);
} else {
return -1;
}
}
}
return result;
} | java | public static int getRandomIntegerIgnoreRange(int floor, int ceil, int[]... ranges) {
int result = getRandomInteger(floor, ceil);
for (int[] range : ranges) {
if (range[0] <= result && result <= range[1]) {
if (range[0] > floor) {
result = getRandomIntegerIgnoreRange(floor, range[0], ranges);
} else if (range[1] < ceil) {
result = getRandomIntegerIgnoreRange(range[1], ceil, ranges);
} else {
return -1;
}
}
}
return result;
} | [
"public",
"static",
"int",
"getRandomIntegerIgnoreRange",
"(",
"int",
"floor",
",",
"int",
"ceil",
",",
"int",
"[",
"]",
"...",
"ranges",
")",
"{",
"int",
"result",
"=",
"getRandomInteger",
"(",
"floor",
",",
"ceil",
")",
";",
"for",
"(",
"int",
"[",
"... | 获取忽略多个区间段的随机整数
@param floor 下限
@param ceil 上限
@param ranges 忽略区间(包含下限和上限长度为2的一维数组),可以有多个忽略区间
@return {@link Integer} | [
"获取忽略多个区间段的随机整数"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/RandomUtils.java#L194-L208 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/inject/annotation/DefaultAnnotationMetadata.java | DefaultAnnotationMetadata.registerAnnotationDefaults | @SuppressWarnings("unused")
@Internal
@UsedByGeneratedCode
protected static void registerAnnotationDefaults(String annotation, Map<String, Object> defaultValues) {
AnnotationMetadataSupport.registerDefaultValues(annotation, defaultValues);
} | java | @SuppressWarnings("unused")
@Internal
@UsedByGeneratedCode
protected static void registerAnnotationDefaults(String annotation, Map<String, Object> defaultValues) {
AnnotationMetadataSupport.registerDefaultValues(annotation, defaultValues);
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"@",
"Internal",
"@",
"UsedByGeneratedCode",
"protected",
"static",
"void",
"registerAnnotationDefaults",
"(",
"String",
"annotation",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"defaultValues",
")",
"{",
"Annot... | Registers annotation default values. Used by generated byte code. DO NOT REMOVE.
@param annotation The annotation name
@param defaultValues The default values | [
"Registers",
"annotation",
"default",
"values",
".",
"Used",
"by",
"generated",
"byte",
"code",
".",
"DO",
"NOT",
"REMOVE",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/inject/annotation/DefaultAnnotationMetadata.java#L510-L515 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/admin/ui/AbstractUserInterfaceObject.java | AbstractUserInterfaceObject.hasAccess | public boolean hasAccess(final TargetMode _targetMode,
final Instance _instance)
throws EFapsException
{
return hasAccess(_targetMode, _instance, null, null);
} | java | public boolean hasAccess(final TargetMode _targetMode,
final Instance _instance)
throws EFapsException
{
return hasAccess(_targetMode, _instance, null, null);
} | [
"public",
"boolean",
"hasAccess",
"(",
"final",
"TargetMode",
"_targetMode",
",",
"final",
"Instance",
"_instance",
")",
"throws",
"EFapsException",
"{",
"return",
"hasAccess",
"(",
"_targetMode",
",",
"_instance",
",",
"null",
",",
"null",
")",
";",
"}"
] | Check, if the user of the context has access to this user interface
object. <br>
The Check is made in the following order: <br>
<ol>
<li>If no access User or role is assigned to this user interface object,
all user have access and the return is <i>true</i> => go on with Step 3</li>
<li>else check if the context person is assigned to one of the user
objects.</li>
<li>if Step 1 or Step 2 have <i>true</i> and the context an Event of the
Type <code>TriggerEvent.ACCESSCHECK</code>, the return of the trigger
initiated program is returned</li>
</ol>
@param _targetMode targetmode of the access
@param _instance the field will represent, e.g. on edit mode
@return <i>true</i> if context user has access, otherwise <i>false</i> is
returned
@throws EFapsException on error | [
"Check",
"if",
"the",
"user",
"of",
"the",
"context",
"has",
"access",
"to",
"this",
"user",
"interface",
"object",
".",
"<br",
">",
"The",
"Check",
"is",
"made",
"in",
"the",
"following",
"order",
":",
"<br",
">",
"<ol",
">",
"<li",
">",
"If",
"no",... | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/ui/AbstractUserInterfaceObject.java#L202-L207 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxAPIRequest.java | BoxAPIRequest.writeBody | protected void writeBody(HttpURLConnection connection, ProgressListener listener) {
if (this.body == null) {
return;
}
connection.setDoOutput(true);
try {
OutputStream output = connection.getOutputStream();
if (listener != null) {
output = new ProgressOutputStream(output, listener, this.bodyLength);
}
int b = this.body.read();
while (b != -1) {
output.write(b);
b = this.body.read();
}
output.close();
} catch (IOException e) {
throw new BoxAPIException("Couldn't connect to the Box API due to a network error.", e);
}
} | java | protected void writeBody(HttpURLConnection connection, ProgressListener listener) {
if (this.body == null) {
return;
}
connection.setDoOutput(true);
try {
OutputStream output = connection.getOutputStream();
if (listener != null) {
output = new ProgressOutputStream(output, listener, this.bodyLength);
}
int b = this.body.read();
while (b != -1) {
output.write(b);
b = this.body.read();
}
output.close();
} catch (IOException e) {
throw new BoxAPIException("Couldn't connect to the Box API due to a network error.", e);
}
} | [
"protected",
"void",
"writeBody",
"(",
"HttpURLConnection",
"connection",
",",
"ProgressListener",
"listener",
")",
"{",
"if",
"(",
"this",
".",
"body",
"==",
"null",
")",
"{",
"return",
";",
"}",
"connection",
".",
"setDoOutput",
"(",
"true",
")",
";",
"t... | Writes the body of this request to an HttpURLConnection.
<p>Subclasses overriding this method must remember to close the connection's OutputStream after writing.</p>
@param connection the connection to which the body should be written.
@param listener an optional listener for monitoring the write progress.
@throws BoxAPIException if an error occurs while writing to the connection. | [
"Writes",
"the",
"body",
"of",
"this",
"request",
"to",
"an",
"HttpURLConnection",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxAPIRequest.java#L450-L470 |
defei/codelogger-utils | src/main/java/org/codelogger/utils/DateUtils.java | DateUtils.getDateOfWeeksBack | public static Date getDateOfWeeksBack(final int weeksBack, final Date date) {
return dateBack(Calendar.WEEK_OF_MONTH, weeksBack, date);
} | java | public static Date getDateOfWeeksBack(final int weeksBack, final Date date) {
return dateBack(Calendar.WEEK_OF_MONTH, weeksBack, date);
} | [
"public",
"static",
"Date",
"getDateOfWeeksBack",
"(",
"final",
"int",
"weeksBack",
",",
"final",
"Date",
"date",
")",
"{",
"return",
"dateBack",
"(",
"Calendar",
".",
"WEEK_OF_MONTH",
",",
"weeksBack",
",",
"date",
")",
";",
"}"
] | Get specify weeks back from given date.
@param weeksBack how many weeks want to be back.
@param date date to be handled.
@return a new Date object. | [
"Get",
"specify",
"weeks",
"back",
"from",
"given",
"date",
"."
] | train | https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L197-L200 |
jcuda/jcusparse | JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java | JCusparse.cusparseSdoti | public static int cusparseSdoti(
cusparseHandle handle,
int nnz,
Pointer xVal,
Pointer xInd,
Pointer y,
Pointer resultDevHostPtr,
int idxBase)
{
return checkResult(cusparseSdotiNative(handle, nnz, xVal, xInd, y, resultDevHostPtr, idxBase));
} | java | public static int cusparseSdoti(
cusparseHandle handle,
int nnz,
Pointer xVal,
Pointer xInd,
Pointer y,
Pointer resultDevHostPtr,
int idxBase)
{
return checkResult(cusparseSdotiNative(handle, nnz, xVal, xInd, y, resultDevHostPtr, idxBase));
} | [
"public",
"static",
"int",
"cusparseSdoti",
"(",
"cusparseHandle",
"handle",
",",
"int",
"nnz",
",",
"Pointer",
"xVal",
",",
"Pointer",
"xInd",
",",
"Pointer",
"y",
",",
"Pointer",
"resultDevHostPtr",
",",
"int",
"idxBase",
")",
"{",
"return",
"checkResult",
... | Description: dot product of a sparse vector x and a dense vector y. | [
"Description",
":",
"dot",
"product",
"of",
"a",
"sparse",
"vector",
"x",
"and",
"a",
"dense",
"vector",
"y",
"."
] | train | https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L726-L736 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/ssl/jdbc4/LibPQFactory.java | LibPQFactory.verify | @Deprecated
public boolean verify(String hostname, SSLSession session) {
if (!sslMode.verifyPeerName()) {
return true;
}
return PGjdbcHostnameVerifier.INSTANCE.verify(hostname, session);
} | java | @Deprecated
public boolean verify(String hostname, SSLSession session) {
if (!sslMode.verifyPeerName()) {
return true;
}
return PGjdbcHostnameVerifier.INSTANCE.verify(hostname, session);
} | [
"@",
"Deprecated",
"public",
"boolean",
"verify",
"(",
"String",
"hostname",
",",
"SSLSession",
"session",
")",
"{",
"if",
"(",
"!",
"sslMode",
".",
"verifyPeerName",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"PGjdbcHostnameVerifier",
".",
... | Verifies the server certificate according to the libpq rules. The cn attribute of the
certificate is matched against the hostname. If the cn attribute starts with an asterisk (*),
it will be treated as a wildcard, and will match all characters except a dot (.). This means
the certificate will not match subdomains. If the connection is made using an IP address
instead of a hostname, the IP address will be matched (without doing any DNS lookups).
@deprecated use PgjdbcHostnameVerifier
@param hostname Hostname or IP address of the server.
@param session The SSL session.
@return true if the certificate belongs to the server, false otherwise.
@see PGjdbcHostnameVerifier | [
"Verifies",
"the",
"server",
"certificate",
"according",
"to",
"the",
"libpq",
"rules",
".",
"The",
"cn",
"attribute",
"of",
"the",
"certificate",
"is",
"matched",
"against",
"the",
"hostname",
".",
"If",
"the",
"cn",
"attribute",
"starts",
"with",
"an",
"as... | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/ssl/jdbc4/LibPQFactory.java#L76-L82 |
opencb/biodata | biodata-tools/src/main/java/org/opencb/biodata/tools/variant/algorithm/IdentityByStateClustering.java | IdentityByStateClustering.countSharedAlleles | public int countSharedAlleles(int allelesCount, Genotype genotypeFirst, Genotype genotypeSecond) {
// amount of different alleles: reference, alternate. other alleles (missing, or multiallelic) are ignored
int[] allelesCountsFirst = new int[2];
int[] allelesCountsSecond = new int[2];
for (int k = 0; k < allelesCount; k++) {
if (genotypeFirst.getAllele(k) == 0) {
allelesCountsFirst[0]++;
} else if (genotypeFirst.getAllele(k) == 1) {
allelesCountsFirst[1]++;
}
if (genotypeSecond.getAllele(k) == 0) {
allelesCountsSecond[0]++;
} else if (genotypeSecond.getAllele(k) == 1) {
allelesCountsSecond[1]++;
}
}
int whichIBS = Math.min(allelesCountsFirst[0], allelesCountsSecond[0])
+ Math.min(allelesCountsFirst[1], allelesCountsSecond[1]);
return whichIBS;
} | java | public int countSharedAlleles(int allelesCount, Genotype genotypeFirst, Genotype genotypeSecond) {
// amount of different alleles: reference, alternate. other alleles (missing, or multiallelic) are ignored
int[] allelesCountsFirst = new int[2];
int[] allelesCountsSecond = new int[2];
for (int k = 0; k < allelesCount; k++) {
if (genotypeFirst.getAllele(k) == 0) {
allelesCountsFirst[0]++;
} else if (genotypeFirst.getAllele(k) == 1) {
allelesCountsFirst[1]++;
}
if (genotypeSecond.getAllele(k) == 0) {
allelesCountsSecond[0]++;
} else if (genotypeSecond.getAllele(k) == 1) {
allelesCountsSecond[1]++;
}
}
int whichIBS = Math.min(allelesCountsFirst[0], allelesCountsSecond[0])
+ Math.min(allelesCountsFirst[1], allelesCountsSecond[1]);
return whichIBS;
} | [
"public",
"int",
"countSharedAlleles",
"(",
"int",
"allelesCount",
",",
"Genotype",
"genotypeFirst",
",",
"Genotype",
"genotypeSecond",
")",
"{",
"// amount of different alleles: reference, alternate. other alleles (missing, or multiallelic) are ignored",
"int",
"[",
"]",
"allele... | Counts the amount of shared alleles in two individuals.
This is which IBS kind is this pair: IBS0, IBS1 or IBS2.
The idea is to count how many alleles there are of each kind: for instance, 0 reference alleles for individual 1
and 2 reference alleles for individual 2, and then count the alternate alleles. Then take the minimum of each
kind and sum all the minimums.
@param allelesCount ploidy
@param genotypeFirst first individual's genotype
@param genotypeSecond second individual's genotype
@return shared alleles count. | [
"Counts",
"the",
"amount",
"of",
"shared",
"alleles",
"in",
"two",
"individuals",
".",
"This",
"is",
"which",
"IBS",
"kind",
"is",
"this",
"pair",
":",
"IBS0",
"IBS1",
"or",
"IBS2",
".",
"The",
"idea",
"is",
"to",
"count",
"how",
"many",
"alleles",
"th... | train | https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/algorithm/IdentityByStateClustering.java#L108-L131 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/tools/offlineEditsViewer/XmlEditsVisitor.java | XmlEditsVisitor.writeTag | private void writeTag(String tag, String value) throws IOException {
printIndents();
if(value.length() > 0) {
write("<" + tag + ">" + value + "</" + tag + ">\n");
} else {
write("<" + tag + "/>\n");
}
} | java | private void writeTag(String tag, String value) throws IOException {
printIndents();
if(value.length() > 0) {
write("<" + tag + ">" + value + "</" + tag + ">\n");
} else {
write("<" + tag + "/>\n");
}
} | [
"private",
"void",
"writeTag",
"(",
"String",
"tag",
",",
"String",
"value",
")",
"throws",
"IOException",
"{",
"printIndents",
"(",
")",
";",
"if",
"(",
"value",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"write",
"(",
"\"<\"",
"+",
"tag",
"+",
... | Write an XML tag
@param tag a tag name
@param value a tag value | [
"Write",
"an",
"XML",
"tag"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/tools/offlineEditsViewer/XmlEditsVisitor.java#L136-L143 |
haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectReader.java | ObjectReader.readObjects | public Object[] readObjects(Class pObjClass, Hashtable pMapping,
Hashtable pWhere) throws SQLException {
return readObjects0(pObjClass, pMapping, pWhere);
} | java | public Object[] readObjects(Class pObjClass, Hashtable pMapping,
Hashtable pWhere) throws SQLException {
return readObjects0(pObjClass, pMapping, pWhere);
} | [
"public",
"Object",
"[",
"]",
"readObjects",
"(",
"Class",
"pObjClass",
",",
"Hashtable",
"pMapping",
",",
"Hashtable",
"pWhere",
")",
"throws",
"SQLException",
"{",
"return",
"readObjects0",
"(",
"pObjClass",
",",
"pMapping",
",",
"pWhere",
")",
";",
"}"
] | Reads all objects from the database, using the given mapping.
This is the most general form of readObjects().
@param objClass The class of the objects to read
@param mapping The hashtable containing the object mapping
@param where An hashtable containing extra criteria for the read
@return An array of Objects, or an zero-length array if none was found | [
"Reads",
"all",
"objects",
"from",
"the",
"database",
"using",
"the",
"given",
"mapping",
".",
"This",
"is",
"the",
"most",
"general",
"form",
"of",
"readObjects",
"()",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/ObjectReader.java#L611-L614 |
line/armeria | saml/src/main/java/com/linecorp/armeria/server/saml/KeyStoreCredentialResolverBuilder.java | KeyStoreCredentialResolverBuilder.addKeyPassword | public KeyStoreCredentialResolverBuilder addKeyPassword(String name, String password) {
requireNonNull(name, "name");
requireNonNull(password, "password");
checkArgument(!keyPasswords.containsKey(name), "key already exists: %s", name);
keyPasswords.put(name, password);
return this;
} | java | public KeyStoreCredentialResolverBuilder addKeyPassword(String name, String password) {
requireNonNull(name, "name");
requireNonNull(password, "password");
checkArgument(!keyPasswords.containsKey(name), "key already exists: %s", name);
keyPasswords.put(name, password);
return this;
} | [
"public",
"KeyStoreCredentialResolverBuilder",
"addKeyPassword",
"(",
"String",
"name",
",",
"String",
"password",
")",
"{",
"requireNonNull",
"(",
"name",
",",
"\"name\"",
")",
";",
"requireNonNull",
"(",
"password",
",",
"\"password\"",
")",
";",
"checkArgument",
... | Adds a key name and its password to the {@link KeyStoreCredentialResolverBuilder}. | [
"Adds",
"a",
"key",
"name",
"and",
"its",
"password",
"to",
"the",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/saml/src/main/java/com/linecorp/armeria/server/saml/KeyStoreCredentialResolverBuilder.java#L97-L103 |
openxc/openxc-android | library/src/main/java/com/openxc/VehicleManager.java | VehicleManager.removeListener | public void removeListener(MessageKey key, VehicleMessage.Listener listener) {
removeListener(ExactKeyMatcher.buildExactMatcher(key), listener);
} | java | public void removeListener(MessageKey key, VehicleMessage.Listener listener) {
removeListener(ExactKeyMatcher.buildExactMatcher(key), listener);
} | [
"public",
"void",
"removeListener",
"(",
"MessageKey",
"key",
",",
"VehicleMessage",
".",
"Listener",
"listener",
")",
"{",
"removeListener",
"(",
"ExactKeyMatcher",
".",
"buildExactMatcher",
"(",
"key",
")",
",",
"listener",
")",
";",
"}"
] | Unregister a previously registered key listener.
@param key The key this listener was previously registered to
receive updates on.
@param listener The listener to remove. | [
"Unregister",
"a",
"previously",
"registered",
"key",
"listener",
"."
] | train | https://github.com/openxc/openxc-android/blob/799adbdcd107a72fe89737bbf19c039dc2881665/library/src/main/java/com/openxc/VehicleManager.java#L474-L476 |
lucee/Lucee | core/src/main/java/lucee/runtime/op/Caster.java | Caster.toQueryColumn | public static QueryColumn toQueryColumn(Object o, PageContext pc) throws PageException {
if (o instanceof QueryColumn) return (QueryColumn) o;
if (o instanceof String) {
o = VariableInterpreter.getVariableAsCollection(pc, (String) o);
if (o instanceof QueryColumn) return (QueryColumn) o;
}
throw new CasterException(o, "querycolumn");
} | java | public static QueryColumn toQueryColumn(Object o, PageContext pc) throws PageException {
if (o instanceof QueryColumn) return (QueryColumn) o;
if (o instanceof String) {
o = VariableInterpreter.getVariableAsCollection(pc, (String) o);
if (o instanceof QueryColumn) return (QueryColumn) o;
}
throw new CasterException(o, "querycolumn");
} | [
"public",
"static",
"QueryColumn",
"toQueryColumn",
"(",
"Object",
"o",
",",
"PageContext",
"pc",
")",
"throws",
"PageException",
"{",
"if",
"(",
"o",
"instanceof",
"QueryColumn",
")",
"return",
"(",
"QueryColumn",
")",
"o",
";",
"if",
"(",
"o",
"instanceof"... | converts a object to a QueryColumn, if possible, also variable declarations are allowed. this
method is used within the generated bytecode
@param o
@return
@throws PageException
@info used in bytecode generation | [
"converts",
"a",
"object",
"to",
"a",
"QueryColumn",
"if",
"possible",
"also",
"variable",
"declarations",
"are",
"allowed",
".",
"this",
"method",
"is",
"used",
"within",
"the",
"generated",
"bytecode"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L3004-L3012 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java | BootstrapConfig.getOutputFile | public File getOutputFile(String relativeServerPath) {
if (relativeServerPath == null)
return outputDir;
else
return new File(outputDir, relativeServerPath);
} | java | public File getOutputFile(String relativeServerPath) {
if (relativeServerPath == null)
return outputDir;
else
return new File(outputDir, relativeServerPath);
} | [
"public",
"File",
"getOutputFile",
"(",
"String",
"relativeServerPath",
")",
"{",
"if",
"(",
"relativeServerPath",
"==",
"null",
")",
"return",
"outputDir",
";",
"else",
"return",
"new",
"File",
"(",
"outputDir",
",",
"relativeServerPath",
")",
";",
"}"
] | Allocate a file in the server output directory, e.g.
server-data/serverName/relativeServerPath
@param relativeServerPath
relative path of file to create in the server directory
@return File object for relative path, or for the server directory itself
if the relative path argument is null | [
"Allocate",
"a",
"file",
"in",
"the",
"server",
"output",
"directory",
"e",
".",
"g",
".",
"server",
"-",
"data",
"/",
"serverName",
"/",
"relativeServerPath"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/BootstrapConfig.java#L628-L633 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/wrapper/PAbstractObject.java | PAbstractObject.optString | @Override
public final String optString(final String key, final String defaultValue) {
String result = optString(key);
return result == null ? defaultValue : result;
} | java | @Override
public final String optString(final String key, final String defaultValue) {
String result = optString(key);
return result == null ? defaultValue : result;
} | [
"@",
"Override",
"public",
"final",
"String",
"optString",
"(",
"final",
"String",
"key",
",",
"final",
"String",
"defaultValue",
")",
"{",
"String",
"result",
"=",
"optString",
"(",
"key",
")",
";",
"return",
"result",
"==",
"null",
"?",
"defaultValue",
"... | Get a property as a string or defaultValue.
@param key the property name
@param defaultValue the default value | [
"Get",
"a",
"property",
"as",
"a",
"string",
"or",
"defaultValue",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/wrapper/PAbstractObject.java#L39-L43 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java | SameDiff.zero | public SDVariable zero(String name, org.nd4j.linalg.api.buffer.DataType dataType, int... shape) {
return var(name, new ZeroInitScheme(), dataType, ArrayUtil.toLongArray(shape));
} | java | public SDVariable zero(String name, org.nd4j.linalg.api.buffer.DataType dataType, int... shape) {
return var(name, new ZeroInitScheme(), dataType, ArrayUtil.toLongArray(shape));
} | [
"public",
"SDVariable",
"zero",
"(",
"String",
"name",
",",
"org",
".",
"nd4j",
".",
"linalg",
".",
"api",
".",
"buffer",
".",
"DataType",
"dataType",
",",
"int",
"...",
"shape",
")",
"{",
"return",
"var",
"(",
"name",
",",
"new",
"ZeroInitScheme",
"("... | Create a new variable with the specified shape, with all values initialized to 0
@param name the name of the variable to create
@param shape the shape of the array to be created
@return the created variable | [
"Create",
"a",
"new",
"variable",
"with",
"the",
"specified",
"shape",
"with",
"all",
"values",
"initialized",
"to",
"0"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L1989-L1991 |
sagiegurari/fax4j | src/main/java/org/fax4j/spi/http/AbstractMappingHTTPResponseHandler.java | AbstractMappingHTTPResponseHandler.updateFaxJob | public void updateFaxJob(FaxJob faxJob,HTTPResponse httpResponse,FaxActionType faxActionType)
{
//get path
String path=this.getPathToResponseData(faxActionType);
//get fax job ID
String id=this.findValue(httpResponse,path);
if(id!=null)
{
faxJob.setID(id);
}
} | java | public void updateFaxJob(FaxJob faxJob,HTTPResponse httpResponse,FaxActionType faxActionType)
{
//get path
String path=this.getPathToResponseData(faxActionType);
//get fax job ID
String id=this.findValue(httpResponse,path);
if(id!=null)
{
faxJob.setID(id);
}
} | [
"public",
"void",
"updateFaxJob",
"(",
"FaxJob",
"faxJob",
",",
"HTTPResponse",
"httpResponse",
",",
"FaxActionType",
"faxActionType",
")",
"{",
"//get path",
"String",
"path",
"=",
"this",
".",
"getPathToResponseData",
"(",
"faxActionType",
")",
";",
"//get fax job... | Updates the fax job based on the data from the HTTP response data.
@param faxJob
The fax job object
@param httpResponse
The HTTP response
@param faxActionType
The fax action type | [
"Updates",
"the",
"fax",
"job",
"based",
"on",
"the",
"data",
"from",
"the",
"HTTP",
"response",
"data",
"."
] | train | https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/http/AbstractMappingHTTPResponseHandler.java#L172-L184 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java | DateUtil.formatChineseDate | public static String formatChineseDate(Date date, boolean isUppercase) {
if (null == date) {
return null;
}
String format = DatePattern.CHINESE_DATE_FORMAT.format(date);
if (isUppercase) {
final StringBuilder builder = StrUtil.builder(format.length());
builder.append(Convert.numberToChinese(Integer.parseInt(format.substring(0, 1)), false));
builder.append(Convert.numberToChinese(Integer.parseInt(format.substring(1, 2)), false));
builder.append(Convert.numberToChinese(Integer.parseInt(format.substring(2, 3)), false));
builder.append(Convert.numberToChinese(Integer.parseInt(format.substring(3, 4)), false));
builder.append(format.substring(4, 5));
builder.append(Convert.numberToChinese(Integer.parseInt(format.substring(5, 7)), false));
builder.append(format.substring(7, 8));
builder.append(Convert.numberToChinese(Integer.parseInt(format.substring(8, 10)), false));
builder.append(format.substring(10));
format = builder.toString().replace('零', '〇');
}
return format;
} | java | public static String formatChineseDate(Date date, boolean isUppercase) {
if (null == date) {
return null;
}
String format = DatePattern.CHINESE_DATE_FORMAT.format(date);
if (isUppercase) {
final StringBuilder builder = StrUtil.builder(format.length());
builder.append(Convert.numberToChinese(Integer.parseInt(format.substring(0, 1)), false));
builder.append(Convert.numberToChinese(Integer.parseInt(format.substring(1, 2)), false));
builder.append(Convert.numberToChinese(Integer.parseInt(format.substring(2, 3)), false));
builder.append(Convert.numberToChinese(Integer.parseInt(format.substring(3, 4)), false));
builder.append(format.substring(4, 5));
builder.append(Convert.numberToChinese(Integer.parseInt(format.substring(5, 7)), false));
builder.append(format.substring(7, 8));
builder.append(Convert.numberToChinese(Integer.parseInt(format.substring(8, 10)), false));
builder.append(format.substring(10));
format = builder.toString().replace('零', '〇');
}
return format;
} | [
"public",
"static",
"String",
"formatChineseDate",
"(",
"Date",
"date",
",",
"boolean",
"isUppercase",
")",
"{",
"if",
"(",
"null",
"==",
"date",
")",
"{",
"return",
"null",
";",
"}",
"String",
"format",
"=",
"DatePattern",
".",
"CHINESE_DATE_FORMAT",
".",
... | 格式化为中文日期格式,如果isUppercase为false,则返回类似:2018年10月24日,否则返回二〇一八年十月二十四日
@param date 被格式化的日期
@param isUppercase 是否采用大写形式
@return 中文日期字符串
@since 4.1.19 | [
"格式化为中文日期格式,如果isUppercase为false,则返回类似:2018年10月24日,否则返回二〇一八年十月二十四日"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/DateUtil.java#L565-L585 |
JM-Lab/utils-elasticsearch | src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchIndex.java | JMElasticsearchIndex.sendDataWithObjectMapper | public String sendDataWithObjectMapper(Object sourceObject, String index,
String type) {
return sendDataWithObjectMapper(sourceObject, index, type, null)
.getId();
} | java | public String sendDataWithObjectMapper(Object sourceObject, String index,
String type) {
return sendDataWithObjectMapper(sourceObject, index, type, null)
.getId();
} | [
"public",
"String",
"sendDataWithObjectMapper",
"(",
"Object",
"sourceObject",
",",
"String",
"index",
",",
"String",
"type",
")",
"{",
"return",
"sendDataWithObjectMapper",
"(",
"sourceObject",
",",
"index",
",",
"type",
",",
"null",
")",
".",
"getId",
"(",
"... | Send data with object mapper string.
@param sourceObject the source object
@param index the index
@param type the type
@return the string | [
"Send",
"data",
"with",
"object",
"mapper",
"string",
"."
] | train | https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchIndex.java#L276-L280 |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/antlr4/CSSErrorStrategy.java | CSSErrorStrategy.consumeUntilGreedy | protected void consumeUntilGreedy(Parser recognizer, IntervalSet follow) {
logger.trace("CONSUME UNTIL GREEDY {}", follow.toString());
for (int ttype = recognizer.getInputStream().LA(1); ttype != -1 && !follow.contains(ttype); ttype = recognizer.getInputStream().LA(1)) {
Token t = recognizer.consume();
logger.trace("Skipped greedy: {}", t.getText());
}
Token t = recognizer.consume();
logger.trace("Skipped greedy: {} follow: {}", t.getText(), follow);
} | java | protected void consumeUntilGreedy(Parser recognizer, IntervalSet follow) {
logger.trace("CONSUME UNTIL GREEDY {}", follow.toString());
for (int ttype = recognizer.getInputStream().LA(1); ttype != -1 && !follow.contains(ttype); ttype = recognizer.getInputStream().LA(1)) {
Token t = recognizer.consume();
logger.trace("Skipped greedy: {}", t.getText());
}
Token t = recognizer.consume();
logger.trace("Skipped greedy: {} follow: {}", t.getText(), follow);
} | [
"protected",
"void",
"consumeUntilGreedy",
"(",
"Parser",
"recognizer",
",",
"IntervalSet",
"follow",
")",
"{",
"logger",
".",
"trace",
"(",
"\"CONSUME UNTIL GREEDY {}\"",
",",
"follow",
".",
"toString",
"(",
")",
")",
";",
"for",
"(",
"int",
"ttype",
"=",
"... | Consumes token until lexer state is balanced and
token from follow is matched. Matched token is also consumed | [
"Consumes",
"token",
"until",
"lexer",
"state",
"is",
"balanced",
"and",
"token",
"from",
"follow",
"is",
"matched",
".",
"Matched",
"token",
"is",
"also",
"consumed"
] | train | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/antlr4/CSSErrorStrategy.java#L57-L66 |
BlueBrain/bluima | modules/bluima_typesystem/src/main/java/de/julielab/jules/types/ace/Document.java | Document.setEntities | public void setEntities(int i, Entity v) {
if (Document_Type.featOkTst && ((Document_Type)jcasType).casFeat_entities == null)
jcasType.jcas.throwFeatMissing("entities", "de.julielab.jules.types.ace.Document");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Document_Type)jcasType).casFeatCode_entities), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Document_Type)jcasType).casFeatCode_entities), i, jcasType.ll_cas.ll_getFSRef(v));} | java | public void setEntities(int i, Entity v) {
if (Document_Type.featOkTst && ((Document_Type)jcasType).casFeat_entities == null)
jcasType.jcas.throwFeatMissing("entities", "de.julielab.jules.types.ace.Document");
jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Document_Type)jcasType).casFeatCode_entities), i);
jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Document_Type)jcasType).casFeatCode_entities), i, jcasType.ll_cas.ll_getFSRef(v));} | [
"public",
"void",
"setEntities",
"(",
"int",
"i",
",",
"Entity",
"v",
")",
"{",
"if",
"(",
"Document_Type",
".",
"featOkTst",
"&&",
"(",
"(",
"Document_Type",
")",
"jcasType",
")",
".",
"casFeat_entities",
"==",
"null",
")",
"jcasType",
".",
"jcas",
".",... | indexed setter for entities - sets an indexed value -
@generated
@param i index in the array to set
@param v value to set into the array | [
"indexed",
"setter",
"for",
"entities",
"-",
"sets",
"an",
"indexed",
"value",
"-"
] | train | https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/de/julielab/jules/types/ace/Document.java#L138-L142 |
VoltDB/voltdb | examples/fraud-detection/client/frauddetection/FraudSimulation.java | FraudSimulation.runBenchmark | public void runBenchmark() throws Exception {
printHeading("Publishing Train Activities");
String trains[] = { "1", "2", "3", "4", "5", "6", "7", "8" };
List<TrainActivityPublisher> trainPubs = new ArrayList<>();
SwipeEntryActivityPublisher entry = new SwipeEntryActivityPublisher(config, producerConfig, config.count);
entry.start();
SwipeExitActivityPublisher exit = new SwipeExitActivityPublisher(config, producerConfig, config.count);
exit.start();
SwipeReplenishActivityPublisher replenish = new SwipeReplenishActivityPublisher(config, producerConfig, config.count/5);
replenish.start();
//Wait for a min to start trains.
Thread.sleep(6000);
System.out.println("Starting All Trains....");
for (String train : trains) {
TrainActivityPublisher redLine = new TrainActivityPublisher(train, config, producerConfig, Integer.MAX_VALUE);
redLine.start();
trainPubs.add(redLine);
}
System.out.println("All Trains Started....");
entry.join();
exit.close = true;
exit.join();
replenish.close = true;
replenish.join();
} | java | public void runBenchmark() throws Exception {
printHeading("Publishing Train Activities");
String trains[] = { "1", "2", "3", "4", "5", "6", "7", "8" };
List<TrainActivityPublisher> trainPubs = new ArrayList<>();
SwipeEntryActivityPublisher entry = new SwipeEntryActivityPublisher(config, producerConfig, config.count);
entry.start();
SwipeExitActivityPublisher exit = new SwipeExitActivityPublisher(config, producerConfig, config.count);
exit.start();
SwipeReplenishActivityPublisher replenish = new SwipeReplenishActivityPublisher(config, producerConfig, config.count/5);
replenish.start();
//Wait for a min to start trains.
Thread.sleep(6000);
System.out.println("Starting All Trains....");
for (String train : trains) {
TrainActivityPublisher redLine = new TrainActivityPublisher(train, config, producerConfig, Integer.MAX_VALUE);
redLine.start();
trainPubs.add(redLine);
}
System.out.println("All Trains Started....");
entry.join();
exit.close = true;
exit.join();
replenish.close = true;
replenish.join();
} | [
"public",
"void",
"runBenchmark",
"(",
")",
"throws",
"Exception",
"{",
"printHeading",
"(",
"\"Publishing Train Activities\"",
")",
";",
"String",
"trains",
"[",
"]",
"=",
"{",
"\"1\"",
",",
"\"2\"",
",",
"\"3\"",
",",
"\"4\"",
",",
"\"5\"",
",",
"\"6\"",
... | Core benchmark code.
Connect. Initialize. Run the loop. Cleanup. Print Results.
@throws Exception if anything unexpected happens. | [
"Core",
"benchmark",
"code",
".",
"Connect",
".",
"Initialize",
".",
"Run",
"the",
"loop",
".",
"Cleanup",
".",
"Print",
"Results",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/examples/fraud-detection/client/frauddetection/FraudSimulation.java#L582-L607 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ConcurrentSkipListMap.java | Node.appendMarker | boolean appendMarker(Node<K,V> f) {
return casNext(f, new Node<K,V>(f));
} | java | boolean appendMarker(Node<K,V> f) {
return casNext(f, new Node<K,V>(f));
} | [
"boolean",
"appendMarker",
"(",
"Node",
"<",
"K",
",",
"V",
">",
"f",
")",
"{",
"return",
"casNext",
"(",
"f",
",",
"new",
"Node",
"<",
"K",
",",
"V",
">",
"(",
"f",
")",
")",
";",
"}"
] | Tries to append a deletion marker to this node.
@param f the assumed current successor of this node
@return true if successful | [
"Tries",
"to",
"append",
"a",
"deletion",
"marker",
"to",
"this",
"node",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ConcurrentSkipListMap.java#L488-L490 |
UweTrottmann/getglue-java | src/main/java/com/uwetrottmann/getglue/GetGlue.java | GetGlue.getAuthorizationRequest | public static OAuthClientRequest getAuthorizationRequest(String clientId, String redirectUri)
throws OAuthSystemException {
return OAuthClientRequest
.authorizationLocation(OAUTH2_AUTHORIZATION_URL)
.setScope("public read write")
.setResponseType(ResponseType.CODE.toString())
.setClientId(clientId)
.setRedirectURI(redirectUri)
.buildQueryMessage();
} | java | public static OAuthClientRequest getAuthorizationRequest(String clientId, String redirectUri)
throws OAuthSystemException {
return OAuthClientRequest
.authorizationLocation(OAUTH2_AUTHORIZATION_URL)
.setScope("public read write")
.setResponseType(ResponseType.CODE.toString())
.setClientId(clientId)
.setRedirectURI(redirectUri)
.buildQueryMessage();
} | [
"public",
"static",
"OAuthClientRequest",
"getAuthorizationRequest",
"(",
"String",
"clientId",
",",
"String",
"redirectUri",
")",
"throws",
"OAuthSystemException",
"{",
"return",
"OAuthClientRequest",
".",
"authorizationLocation",
"(",
"OAUTH2_AUTHORIZATION_URL",
")",
".",... | Build an OAuth authorization request.
@param clientId The OAuth client id obtained from tvtag.
@param redirectUri The URI to redirect to with appended auth code query parameter.
@throws OAuthSystemException | [
"Build",
"an",
"OAuth",
"authorization",
"request",
"."
] | train | https://github.com/UweTrottmann/getglue-java/blob/9d79c150124f7e71c88568510df5f4f7ccd75d25/src/main/java/com/uwetrottmann/getglue/GetGlue.java#L62-L71 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/quorum/impl/QuorumImpl.java | QuorumImpl.onHeartbeat | void onHeartbeat(Member member, long timestamp) {
if (!heartbeatAwareQuorumFunction) {
return;
}
((HeartbeatAware) quorumFunction).onHeartbeat(member, timestamp);
} | java | void onHeartbeat(Member member, long timestamp) {
if (!heartbeatAwareQuorumFunction) {
return;
}
((HeartbeatAware) quorumFunction).onHeartbeat(member, timestamp);
} | [
"void",
"onHeartbeat",
"(",
"Member",
"member",
",",
"long",
"timestamp",
")",
"{",
"if",
"(",
"!",
"heartbeatAwareQuorumFunction",
")",
"{",
"return",
";",
"}",
"(",
"(",
"HeartbeatAware",
")",
"quorumFunction",
")",
".",
"onHeartbeat",
"(",
"member",
",",
... | Notify a {@link HeartbeatAware} {@code QuorumFunction} that a heartbeat has been received from a member.
@param member source member
@param timestamp heartbeat's timestamp | [
"Notify",
"a",
"{",
"@link",
"HeartbeatAware",
"}",
"{",
"@code",
"QuorumFunction",
"}",
"that",
"a",
"heartbeat",
"has",
"been",
"received",
"from",
"a",
"member",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/quorum/impl/QuorumImpl.java#L120-L125 |
couchbase/couchbase-jvm-core | src/main/java/com/couchbase/client/core/env/DefaultCoreEnvironment.java | DefaultCoreEnvironment.wrapBestEffortShutdown | private Observable<ShutdownStatus> wrapBestEffortShutdown(Observable<Boolean> source, final String target) {
return wrapShutdown(source, target)
.map(new Func1<ShutdownStatus, ShutdownStatus>() {
@Override
public ShutdownStatus call(ShutdownStatus original) {
if (original.cause == null && !original.success) {
LOGGER.info(target + " shutdown is best effort, ignoring failure");
return new ShutdownStatus(target, true, null);
} else {
return original;
}
}
});
} | java | private Observable<ShutdownStatus> wrapBestEffortShutdown(Observable<Boolean> source, final String target) {
return wrapShutdown(source, target)
.map(new Func1<ShutdownStatus, ShutdownStatus>() {
@Override
public ShutdownStatus call(ShutdownStatus original) {
if (original.cause == null && !original.success) {
LOGGER.info(target + " shutdown is best effort, ignoring failure");
return new ShutdownStatus(target, true, null);
} else {
return original;
}
}
});
} | [
"private",
"Observable",
"<",
"ShutdownStatus",
">",
"wrapBestEffortShutdown",
"(",
"Observable",
"<",
"Boolean",
">",
"source",
",",
"final",
"String",
"target",
")",
"{",
"return",
"wrapShutdown",
"(",
"source",
",",
"target",
")",
".",
"map",
"(",
"new",
... | This method wraps an Observable of Boolean (for shutdown hook) into an Observable of ShutdownStatus.
It will log each status with a short message indicating which target has been shut down, and the result of
the call.
Additionally it will ignore signals that shutdown status is false (as long as no exception is detected), logging that the target is "best effort" only. | [
"This",
"method",
"wraps",
"an",
"Observable",
"of",
"Boolean",
"(",
"for",
"shutdown",
"hook",
")",
"into",
"an",
"Observable",
"of",
"ShutdownStatus",
".",
"It",
"will",
"log",
"each",
"status",
"with",
"a",
"short",
"message",
"indicating",
"which",
"targ... | train | https://github.com/couchbase/couchbase-jvm-core/blob/97f0427112c2168fee1d6499904f5fa0e24c6797/src/main/java/com/couchbase/client/core/env/DefaultCoreEnvironment.java#L699-L712 |
deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/linalg/collection/MultiDimensionalMap.java | MultiDimensionalMap.putAll | public void putAll(Map<? extends Pair<K, T>, ? extends V> m) {
backedMap.putAll(m);
} | java | public void putAll(Map<? extends Pair<K, T>, ? extends V> m) {
backedMap.putAll(m);
} | [
"public",
"void",
"putAll",
"(",
"Map",
"<",
"?",
"extends",
"Pair",
"<",
"K",
",",
"T",
">",
",",
"?",
"extends",
"V",
">",
"m",
")",
"{",
"backedMap",
".",
"putAll",
"(",
"m",
")",
";",
"}"
] | Copies all of the mappings from the specified map to this map
(optional operation). The effect of this call is equivalent to that
of calling {@link Map<>#put(k, v)} on this map once
for each mapping from key <tt>k</tt> to value <tt>v</tt> in the
specified map. The behavior of this operation is undefined if the
specified map is modified while the operation is in progress.
@param m mappings to be stored in this map
@throws UnsupportedOperationException if the <tt>putAll</tt> operation
is not supported by this map
@throws ClassCastException if the class of a key or value in the
specified map prevents it from being stored in this map
@throws NullPointerException if the specified map is null, or if
this map does not permit null keys or values, and the
specified map contains null keys or values
@throws IllegalArgumentException if some property of a key or value in
the specified map prevents it from being stored in this map | [
"Copies",
"all",
"of",
"the",
"mappings",
"from",
"the",
"specified",
"map",
"to",
"this",
"map",
"(",
"optional",
"operation",
")",
".",
"The",
"effect",
"of",
"this",
"call",
"is",
"equivalent",
"to",
"that",
"of",
"calling",
"{",
"@link",
"Map<",
">",... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/collection/MultiDimensionalMap.java#L262-L264 |
Azure/azure-sdk-for-java | hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ExtensionsInner.java | ExtensionsInner.getMonitoringStatus | public ClusterMonitoringResponseInner getMonitoringStatus(String resourceGroupName, String clusterName) {
return getMonitoringStatusWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body();
} | java | public ClusterMonitoringResponseInner getMonitoringStatus(String resourceGroupName, String clusterName) {
return getMonitoringStatusWithServiceResponseAsync(resourceGroupName, clusterName).toBlocking().single().body();
} | [
"public",
"ClusterMonitoringResponseInner",
"getMonitoringStatus",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
")",
"{",
"return",
"getMonitoringStatusWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"clusterName",
")",
".",
"toBlocking",
"(",
... | Gets the status of Operations Management Suite (OMS) on the HDInsight cluster.
@param resourceGroupName The name of the resource group.
@param clusterName The name of the cluster.
@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 ClusterMonitoringResponseInner object if successful. | [
"Gets",
"the",
"status",
"of",
"Operations",
"Management",
"Suite",
"(",
"OMS",
")",
"on",
"the",
"HDInsight",
"cluster",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ExtensionsInner.java#L281-L283 |
Waikato/moa | moa/src/main/java/moa/gui/visualization/AbstractGraphPlot.java | AbstractGraphPlot.setGraph | protected void setGraph(MeasureCollection[] measures, MeasureCollection[] stds, Color[] colors) {
this.measures = measures;
this.measureStds = stds;
this.colors = colors;
repaint();
} | java | protected void setGraph(MeasureCollection[] measures, MeasureCollection[] stds, Color[] colors) {
this.measures = measures;
this.measureStds = stds;
this.colors = colors;
repaint();
} | [
"protected",
"void",
"setGraph",
"(",
"MeasureCollection",
"[",
"]",
"measures",
",",
"MeasureCollection",
"[",
"]",
"stds",
",",
"Color",
"[",
"]",
"colors",
")",
"{",
"this",
".",
"measures",
"=",
"measures",
";",
"this",
".",
"measureStds",
"=",
"stds",... | Sets the graph by updating the measures and currently measure index.
This method should not be directly called, but may be used by subclasses
to save space.
@param measures measure information
@param stds standard deviation of the measures
@param colors color encoding for the plots | [
"Sets",
"the",
"graph",
"by",
"updating",
"the",
"measures",
"and",
"currently",
"measure",
"index",
".",
"This",
"method",
"should",
"not",
"be",
"directly",
"called",
"but",
"may",
"be",
"used",
"by",
"subclasses",
"to",
"save",
"space",
"."
] | train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/visualization/AbstractGraphPlot.java#L94-L99 |
lucee/Lucee | core/src/main/java/lucee/runtime/net/http/ReqRspUtil.java | ReqRspUtil.encodeRedirectURLEL | public static String encodeRedirectURLEL(HttpServletResponse rsp, String url) {
try {
return rsp.encodeRedirectURL(url);
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
return url;
}
} | java | public static String encodeRedirectURLEL(HttpServletResponse rsp, String url) {
try {
return rsp.encodeRedirectURL(url);
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
return url;
}
} | [
"public",
"static",
"String",
"encodeRedirectURLEL",
"(",
"HttpServletResponse",
"rsp",
",",
"String",
"url",
")",
"{",
"try",
"{",
"return",
"rsp",
".",
"encodeRedirectURL",
"(",
"url",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"ExceptionUtil... | if encodings fails the given url is returned
@param rsp
@param url
@return | [
"if",
"encodings",
"fails",
"the",
"given",
"url",
"is",
"returned"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/http/ReqRspUtil.java#L612-L620 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/carouselItem/CarouselItemRenderer.java | CarouselItemRenderer.encodeBegin | @Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
CarouselItem carouselItem = (CarouselItem) component;
ResponseWriter rw = context.getResponseWriter();
// String clientId = carouselItem.getClientId();
// put custom code here
// Simple demo widget that simply renders every attribute value
rw.startElement("div", carouselItem);
Tooltip.generateTooltip(context, carouselItem, rw);
rw.writeAttribute("style", carouselItem.getStyle(), "style");
String styleClass = carouselItem.getStyleClass();
if (null == styleClass)
styleClass="item";
else
styleClass = "item " + styleClass;
if (carouselItem.isActive()) {
styleClass += " active";
}
rw.writeAttribute("class", styleClass, "class");
rw.writeAttribute("id", carouselItem.getId(), "id");
Tooltip.activateTooltips(context, carouselItem);
AJAXRenderer.generateBootsFacesAJAXAndJavaScript(context, carouselItem, rw, false);
} | java | @Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
CarouselItem carouselItem = (CarouselItem) component;
ResponseWriter rw = context.getResponseWriter();
// String clientId = carouselItem.getClientId();
// put custom code here
// Simple demo widget that simply renders every attribute value
rw.startElement("div", carouselItem);
Tooltip.generateTooltip(context, carouselItem, rw);
rw.writeAttribute("style", carouselItem.getStyle(), "style");
String styleClass = carouselItem.getStyleClass();
if (null == styleClass)
styleClass="item";
else
styleClass = "item " + styleClass;
if (carouselItem.isActive()) {
styleClass += " active";
}
rw.writeAttribute("class", styleClass, "class");
rw.writeAttribute("id", carouselItem.getId(), "id");
Tooltip.activateTooltips(context, carouselItem);
AJAXRenderer.generateBootsFacesAJAXAndJavaScript(context, carouselItem, rw, false);
} | [
"@",
"Override",
"public",
"void",
"encodeBegin",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"component",
".",
"isRendered",
"(",
")",
")",
"{",
"return",
";",
"}",
"CarouselItem",
"car... | This methods generates the HTML code of the current b:carouselItem.
<code>encodeBegin</code> generates the start of the component. After the, the JSF framework calls <code>encodeChildren()</code>
to generate the HTML code between the beginning and the end of the component. For instance, in the case of a panel component
the content of the panel is generated by <code>encodeChildren()</code>. After that, <code>encodeEnd()</code> is called
to generate the rest of the HTML code.
@param context the FacesContext.
@param component the current b:carouselItem.
@throws IOException thrown if something goes wrong when writing the HTML code. | [
"This",
"methods",
"generates",
"the",
"HTML",
"code",
"of",
"the",
"current",
"b",
":",
"carouselItem",
".",
"<code",
">",
"encodeBegin<",
"/",
"code",
">",
"generates",
"the",
"start",
"of",
"the",
"component",
".",
"After",
"the",
"the",
"JSF",
"framewo... | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/carouselItem/CarouselItemRenderer.java#L62-L90 |
cuba-platform/yarg | core/modules/core/src/com/haulmont/yarg/formatters/impl/XLSFormatter.java | XLSFormatter.addRangeBounds | protected void addRangeBounds(BandData band, CellReference[] crefs) {
if (templateBounds.containsKey(band.getName()))
return;
Bounds bounds = new Bounds(crefs[0].getRow(), crefs[0].getCol(), crefs[crefs.length - 1].getRow(), crefs[crefs.length - 1].getCol());
templateBounds.put(band.getName(), bounds);
} | java | protected void addRangeBounds(BandData band, CellReference[] crefs) {
if (templateBounds.containsKey(band.getName()))
return;
Bounds bounds = new Bounds(crefs[0].getRow(), crefs[0].getCol(), crefs[crefs.length - 1].getRow(), crefs[crefs.length - 1].getCol());
templateBounds.put(band.getName(), bounds);
} | [
"protected",
"void",
"addRangeBounds",
"(",
"BandData",
"band",
",",
"CellReference",
"[",
"]",
"crefs",
")",
"{",
"if",
"(",
"templateBounds",
".",
"containsKey",
"(",
"band",
".",
"getName",
"(",
")",
")",
")",
"return",
";",
"Bounds",
"bounds",
"=",
"... | This method adds range bounds to cache. Key is bandName
@param band - band
@param crefs - range | [
"This",
"method",
"adds",
"range",
"bounds",
"to",
"cache",
".",
"Key",
"is",
"bandName"
] | train | https://github.com/cuba-platform/yarg/blob/d157286cbe29448f3e1f445e8c5dd88808351da0/core/modules/core/src/com/haulmont/yarg/formatters/impl/XLSFormatter.java#L710-L715 |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/DynamicRegistrationBean.java | DynamicRegistrationBean.addInitParameter | public void addInitParameter(String name, String value) {
Assert.notNull(name, "Name must not be null");
this.initParameters.put(name, value);
} | java | public void addInitParameter(String name, String value) {
Assert.notNull(name, "Name must not be null");
this.initParameters.put(name, value);
} | [
"public",
"void",
"addInitParameter",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"Assert",
".",
"notNull",
"(",
"name",
",",
"\"Name must not be null\"",
")",
";",
"this",
".",
"initParameters",
".",
"put",
"(",
"name",
",",
"value",
")",
";"... | Add a single init-parameter, replacing any existing parameter with the same name.
@param name the init-parameter name
@param value the init-parameter value | [
"Add",
"a",
"single",
"init",
"-",
"parameter",
"replacing",
"any",
"existing",
"parameter",
"with",
"the",
"same",
"name",
"."
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/servlet/DynamicRegistrationBean.java#L102-L105 |
santhosh-tekuri/jlibs | xml/src/main/java/jlibs/xml/xsl/TransformerUtil.java | TransformerUtil.newTransformerHandler | public static TransformerHandler newTransformerHandler(Source source, boolean omitXMLDeclaration, int indentAmount, String encoding) throws TransformerConfigurationException{
SAXTransformerFactory factory = (SAXTransformerFactory)TransformerFactory.newInstance();
TransformerHandler handler = source!=null ? factory.newTransformerHandler(source) : factory.newTransformerHandler();
setOutputProperties(handler.getTransformer(), omitXMLDeclaration, indentAmount, encoding);
return handler;
} | java | public static TransformerHandler newTransformerHandler(Source source, boolean omitXMLDeclaration, int indentAmount, String encoding) throws TransformerConfigurationException{
SAXTransformerFactory factory = (SAXTransformerFactory)TransformerFactory.newInstance();
TransformerHandler handler = source!=null ? factory.newTransformerHandler(source) : factory.newTransformerHandler();
setOutputProperties(handler.getTransformer(), omitXMLDeclaration, indentAmount, encoding);
return handler;
} | [
"public",
"static",
"TransformerHandler",
"newTransformerHandler",
"(",
"Source",
"source",
",",
"boolean",
"omitXMLDeclaration",
",",
"int",
"indentAmount",
",",
"String",
"encoding",
")",
"throws",
"TransformerConfigurationException",
"{",
"SAXTransformerFactory",
"factor... | Creates TransformerHandler
@param source source of xsl document, use null for identity transformer
@param omitXMLDeclaration omit xml declaration or not
@param indentAmount the number fo spaces used for indentation.
use <=0, in case you dont want indentation
@param encoding required encoding. use null to don't set any encoding
@return the same transformer which is passed as argument | [
"Creates",
"TransformerHandler"
] | train | https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/xml/src/main/java/jlibs/xml/xsl/TransformerUtil.java#L87-L92 |
zeroturnaround/zt-zip | src/main/java/org/zeroturnaround/zip/ZipUtil.java | ZipUtil.explode | public static void explode(File zip) {
try {
// Find a new unique name is the same directory
File tempFile = FileUtils.getTempFileFor(zip);
// Rename the archive
FileUtils.moveFile(zip, tempFile);
// Unpack it
unpack(tempFile, zip);
// Delete the archive
if (!tempFile.delete()) {
throw new IOException("Unable to delete file: " + tempFile);
}
}
catch (IOException e) {
throw ZipExceptionUtil.rethrow(e);
}
} | java | public static void explode(File zip) {
try {
// Find a new unique name is the same directory
File tempFile = FileUtils.getTempFileFor(zip);
// Rename the archive
FileUtils.moveFile(zip, tempFile);
// Unpack it
unpack(tempFile, zip);
// Delete the archive
if (!tempFile.delete()) {
throw new IOException("Unable to delete file: " + tempFile);
}
}
catch (IOException e) {
throw ZipExceptionUtil.rethrow(e);
}
} | [
"public",
"static",
"void",
"explode",
"(",
"File",
"zip",
")",
"{",
"try",
"{",
"// Find a new unique name is the same directory",
"File",
"tempFile",
"=",
"FileUtils",
".",
"getTempFileFor",
"(",
"zip",
")",
";",
"// Rename the archive",
"FileUtils",
".",
"moveFil... | Unpacks a ZIP file to its own location.
<p>
The ZIP file will be first renamed (using a temporary name). After the
extraction it will be deleted.
@param zip
input ZIP file as well as the target directory.
@see #unpack(File, File) | [
"Unpacks",
"a",
"ZIP",
"file",
"to",
"its",
"own",
"location",
".",
"<p",
">",
"The",
"ZIP",
"file",
"will",
"be",
"first",
"renamed",
"(",
"using",
"a",
"temporary",
"name",
")",
".",
"After",
"the",
"extraction",
"it",
"will",
"be",
"deleted",
"."
] | train | https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L1321-L1340 |
languagetool-org/languagetool | languagetool-core/src/main/java/org/languagetool/XMLValidator.java | XMLValidator.validateWithXmlSchema | public void validateWithXmlSchema(String filename, String xmlSchemaPath) throws IOException {
try (InputStream xmlStream = this.getClass().getResourceAsStream(filename)) {
if (xmlStream == null) {
throw new IOException("File not found in classpath: " + filename);
}
URL schemaUrl = this.getClass().getResource(xmlSchemaPath);
if (schemaUrl == null) {
throw new IOException("XML schema not found in classpath: " + xmlSchemaPath);
}
validateInternal(new StreamSource(xmlStream), schemaUrl);
} catch (Exception e) {
throw new IOException("Cannot load or parse '" + filename + "'", e);
}
} | java | public void validateWithXmlSchema(String filename, String xmlSchemaPath) throws IOException {
try (InputStream xmlStream = this.getClass().getResourceAsStream(filename)) {
if (xmlStream == null) {
throw new IOException("File not found in classpath: " + filename);
}
URL schemaUrl = this.getClass().getResource(xmlSchemaPath);
if (schemaUrl == null) {
throw new IOException("XML schema not found in classpath: " + xmlSchemaPath);
}
validateInternal(new StreamSource(xmlStream), schemaUrl);
} catch (Exception e) {
throw new IOException("Cannot load or parse '" + filename + "'", e);
}
} | [
"public",
"void",
"validateWithXmlSchema",
"(",
"String",
"filename",
",",
"String",
"xmlSchemaPath",
")",
"throws",
"IOException",
"{",
"try",
"(",
"InputStream",
"xmlStream",
"=",
"this",
".",
"getClass",
"(",
")",
".",
"getResourceAsStream",
"(",
"filename",
... | Validate XML file using the given XSD. Throws an exception on error.
@param filename File in classpath to validate
@param xmlSchemaPath XML schema file in classpath | [
"Validate",
"XML",
"file",
"using",
"the",
"given",
"XSD",
".",
"Throws",
"an",
"exception",
"on",
"error",
"."
] | train | https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/XMLValidator.java#L112-L125 |
netty/netty | handler/src/main/java/io/netty/handler/logging/LoggingHandler.java | LoggingHandler.formatByteBufHolder | private static String formatByteBufHolder(ChannelHandlerContext ctx, String eventName, ByteBufHolder msg) {
String chStr = ctx.channel().toString();
String msgStr = msg.toString();
ByteBuf content = msg.content();
int length = content.readableBytes();
if (length == 0) {
StringBuilder buf = new StringBuilder(chStr.length() + 1 + eventName.length() + 2 + msgStr.length() + 4);
buf.append(chStr).append(' ').append(eventName).append(", ").append(msgStr).append(", 0B");
return buf.toString();
} else {
int rows = length / 16 + (length % 15 == 0? 0 : 1) + 4;
StringBuilder buf = new StringBuilder(
chStr.length() + 1 + eventName.length() + 2 + msgStr.length() + 2 + 10 + 1 + 2 + rows * 80);
buf.append(chStr).append(' ').append(eventName).append(": ")
.append(msgStr).append(", ").append(length).append('B').append(NEWLINE);
appendPrettyHexDump(buf, content);
return buf.toString();
}
} | java | private static String formatByteBufHolder(ChannelHandlerContext ctx, String eventName, ByteBufHolder msg) {
String chStr = ctx.channel().toString();
String msgStr = msg.toString();
ByteBuf content = msg.content();
int length = content.readableBytes();
if (length == 0) {
StringBuilder buf = new StringBuilder(chStr.length() + 1 + eventName.length() + 2 + msgStr.length() + 4);
buf.append(chStr).append(' ').append(eventName).append(", ").append(msgStr).append(", 0B");
return buf.toString();
} else {
int rows = length / 16 + (length % 15 == 0? 0 : 1) + 4;
StringBuilder buf = new StringBuilder(
chStr.length() + 1 + eventName.length() + 2 + msgStr.length() + 2 + 10 + 1 + 2 + rows * 80);
buf.append(chStr).append(' ').append(eventName).append(": ")
.append(msgStr).append(", ").append(length).append('B').append(NEWLINE);
appendPrettyHexDump(buf, content);
return buf.toString();
}
} | [
"private",
"static",
"String",
"formatByteBufHolder",
"(",
"ChannelHandlerContext",
"ctx",
",",
"String",
"eventName",
",",
"ByteBufHolder",
"msg",
")",
"{",
"String",
"chStr",
"=",
"ctx",
".",
"channel",
"(",
")",
".",
"toString",
"(",
")",
";",
"String",
"... | Generates the default log message of the specified event whose argument is a {@link ByteBufHolder}. | [
"Generates",
"the",
"default",
"log",
"message",
"of",
"the",
"specified",
"event",
"whose",
"argument",
"is",
"a",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/logging/LoggingHandler.java#L344-L364 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java | ApiOvhDedicatedCloud.serviceName_ip_network_details_GET | public ArrayList<OvhIpDetails> serviceName_ip_network_details_GET(String serviceName, String network) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/ip/{network}/details";
StringBuilder sb = path(qPath, serviceName, network);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t3);
} | java | public ArrayList<OvhIpDetails> serviceName_ip_network_details_GET(String serviceName, String network) throws IOException {
String qPath = "/dedicatedCloud/{serviceName}/ip/{network}/details";
StringBuilder sb = path(qPath, serviceName, network);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t3);
} | [
"public",
"ArrayList",
"<",
"OvhIpDetails",
">",
"serviceName_ip_network_details_GET",
"(",
"String",
"serviceName",
",",
"String",
"network",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicatedCloud/{serviceName}/ip/{network}/details\"",
";",
"StringBu... | List details about this IP Block
REST: GET /dedicatedCloud/{serviceName}/ip/{network}/details
@param serviceName [required] Domain of the service
@param network [required] IP ex: 213.186.33.34/24 | [
"List",
"details",
"about",
"this",
"IP",
"Block"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L1310-L1315 |
liferay/com-liferay-commerce | commerce-user-segment-service/src/main/java/com/liferay/commerce/user/segment/service/persistence/impl/CommerceUserSegmentCriterionPersistenceImpl.java | CommerceUserSegmentCriterionPersistenceImpl.findAll | @Override
public List<CommerceUserSegmentCriterion> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | java | @Override
public List<CommerceUserSegmentCriterion> findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceUserSegmentCriterion",
">",
"findAll",
"(",
")",
"{",
"return",
"findAll",
"(",
"QueryUtil",
".",
"ALL_POS",
",",
"QueryUtil",
".",
"ALL_POS",
",",
"null",
")",
";",
"}"
] | Returns all the commerce user segment criterions.
@return the commerce user segment criterions | [
"Returns",
"all",
"the",
"commerce",
"user",
"segment",
"criterions",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-user-segment-service/src/main/java/com/liferay/commerce/user/segment/service/persistence/impl/CommerceUserSegmentCriterionPersistenceImpl.java#L1169-L1172 |
fcrepo3/fcrepo | fcrepo-server/src/main/java/org/fcrepo/server/access/DefaultAccess.java | DefaultAccess.getDatastreamHeaders | private static Property[] getDatastreamHeaders(String pid, Datastream ds) {
Property[] result = new Property[3];
result[0] = new Property(HttpHeaders.ACCEPT_RANGES,"bytes");
result[1] = new Property(HttpHeaders.ETAG, Datastream.defaultETag(pid, ds));
result[2] = new Property(HttpHeaders.LAST_MODIFIED, DateUtil.formatDate(ds.DSCreateDT));
return result;
} | java | private static Property[] getDatastreamHeaders(String pid, Datastream ds) {
Property[] result = new Property[3];
result[0] = new Property(HttpHeaders.ACCEPT_RANGES,"bytes");
result[1] = new Property(HttpHeaders.ETAG, Datastream.defaultETag(pid, ds));
result[2] = new Property(HttpHeaders.LAST_MODIFIED, DateUtil.formatDate(ds.DSCreateDT));
return result;
} | [
"private",
"static",
"Property",
"[",
"]",
"getDatastreamHeaders",
"(",
"String",
"pid",
",",
"Datastream",
"ds",
")",
"{",
"Property",
"[",
"]",
"result",
"=",
"new",
"Property",
"[",
"3",
"]",
";",
"result",
"[",
"0",
"]",
"=",
"new",
"Property",
"("... | Content-Length is determined elsewhere
Content-Type is determined elsewhere
Last-Modified
ETag
@param ds
@return | [
"Content",
"-",
"Length",
"is",
"determined",
"elsewhere",
"Content",
"-",
"Type",
"is",
"determined",
"elsewhere",
"Last",
"-",
"Modified",
"ETag"
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/access/DefaultAccess.java#L1183-L1189 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/WorkbinsApi.java | WorkbinsApi.getWorkbinContent | public ApiSuccessResponse getWorkbinContent(String workbinId, GetWorkbinContentData getWorkbinContentData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = getWorkbinContentWithHttpInfo(workbinId, getWorkbinContentData);
return resp.getData();
} | java | public ApiSuccessResponse getWorkbinContent(String workbinId, GetWorkbinContentData getWorkbinContentData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = getWorkbinContentWithHttpInfo(workbinId, getWorkbinContentData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"getWorkbinContent",
"(",
"String",
"workbinId",
",",
"GetWorkbinContentData",
"getWorkbinContentData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"getWorkbinContentWithHttpInfo",
"(",
"wor... | Get the content of a Workbin.
@param workbinId Id of the Workbin (required)
@param getWorkbinContentData (required)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Get",
"the",
"content",
"of",
"a",
"Workbin",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/WorkbinsApi.java#L404-L407 |
groupon/robo-remote | RoboRemoteClientCommon/src/main/com/groupon/roboremote/roboremoteclientcommon/Client.java | Client.isListening | public boolean isListening() throws Exception {
try {
JSONObject resp = new JSONObject(Get.get(API_BASE_URL + ":" + API_PORT, Constants.REQUEST_HEARTBEAT, ""));
return true;
} catch (Exception e) {
return false;
}
} | java | public boolean isListening() throws Exception {
try {
JSONObject resp = new JSONObject(Get.get(API_BASE_URL + ":" + API_PORT, Constants.REQUEST_HEARTBEAT, ""));
return true;
} catch (Exception e) {
return false;
}
} | [
"public",
"boolean",
"isListening",
"(",
")",
"throws",
"Exception",
"{",
"try",
"{",
"JSONObject",
"resp",
"=",
"new",
"JSONObject",
"(",
"Get",
".",
"get",
"(",
"API_BASE_URL",
"+",
"\":\"",
"+",
"API_PORT",
",",
"Constants",
".",
"REQUEST_HEARTBEAT",
",",... | Returns true if there is RoboRemoteServer currently listening
@return
@throws Exception | [
"Returns",
"true",
"if",
"there",
"is",
"RoboRemoteServer",
"currently",
"listening"
] | train | https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteClientCommon/src/main/com/groupon/roboremote/roboremoteclientcommon/Client.java#L78-L86 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/util/ClassesManager.java | ClassesManager.isMapped | private static boolean isMapped(Class<?> aClass,XML xml){
return xml.isInheritedMapped(aClass) || Annotation.isInheritedMapped(aClass);
} | java | private static boolean isMapped(Class<?> aClass,XML xml){
return xml.isInheritedMapped(aClass) || Annotation.isInheritedMapped(aClass);
} | [
"private",
"static",
"boolean",
"isMapped",
"(",
"Class",
"<",
"?",
">",
"aClass",
",",
"XML",
"xml",
")",
"{",
"return",
"xml",
".",
"isInheritedMapped",
"(",
"aClass",
")",
"||",
"Annotation",
".",
"isInheritedMapped",
"(",
"aClass",
")",
";",
"}"
] | Returns true if the class is configured in annotation or xml, false otherwise.
@param aClass a class
@param xml xml to check
@return true if the class is configured in annotation or xml, false otherwise | [
"Returns",
"true",
"if",
"the",
"class",
"is",
"configured",
"in",
"annotation",
"or",
"xml",
"false",
"otherwise",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/util/ClassesManager.java#L438-L440 |
percolate/caffeine | caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java | ViewUtils.findViewById | @SuppressWarnings("unchecked")
public static <T extends View> T findViewById(Activity context, int id) {
T view = null;
View genericView = context.findViewById(id);
try {
view = (T) (genericView);
} catch (Exception ex) {
String message = "Can't cast view (" + id + ") to a " + view.getClass() + ". Is actually a " + genericView.getClass() + ".";
Log.e("Caffeine", message);
throw new ClassCastException(message);
}
return view;
} | java | @SuppressWarnings("unchecked")
public static <T extends View> T findViewById(Activity context, int id) {
T view = null;
View genericView = context.findViewById(id);
try {
view = (T) (genericView);
} catch (Exception ex) {
String message = "Can't cast view (" + id + ") to a " + view.getClass() + ". Is actually a " + genericView.getClass() + ".";
Log.e("Caffeine", message);
throw new ClassCastException(message);
}
return view;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
"extends",
"View",
">",
"T",
"findViewById",
"(",
"Activity",
"context",
",",
"int",
"id",
")",
"{",
"T",
"view",
"=",
"null",
";",
"View",
"genericView",
"=",
"context",
"... | Utility method to make getting a View via findViewById() more safe & simple.
<p/>
- Casts view to appropriate type based on expected return value
- Handles & logs invalid casts
@param context The current Context or Activity that this method is called from.
@param id R.id value for view.
@return View object, cast to appropriate type based on expected return value.
@throws ClassCastException if cast to the expected type breaks. | [
"Utility",
"method",
"to",
"make",
"getting",
"a",
"View",
"via",
"findViewById",
"()",
"more",
"safe",
"&",
"simple",
".",
"<p",
"/",
">",
"-",
"Casts",
"view",
"to",
"appropriate",
"type",
"based",
"on",
"expected",
"return",
"value",
"-",
"Handles",
"... | train | https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java#L46-L59 |
susom/database | src/main/java/com/github/susom/database/DatabaseProviderVertx.java | DatabaseProviderVertx.transactAsync | public <T> void transactAsync(final DbCodeTypedTx<T> code, Handler<AsyncResult<T>> resultHandler) {
VertxUtil.executeBlocking(executor, future -> {
try {
T returnValue = null;
Transaction tx = new TransactionImpl();
tx.setRollbackOnError(true);
tx.setRollbackOnly(false);
boolean complete = false;
try {
returnValue = code.run(this, tx);
complete = true;
} catch (ThreadDeath | DatabaseException t) {
throw t;
} catch (Throwable t) {
throw new DatabaseException("Error during transaction", t);
} finally {
if ((!complete && tx.isRollbackOnError()) || tx.isRollbackOnly()) {
rollbackAndClose();
} else {
commitAndClose();
}
}
future.complete(returnValue);
} catch (ThreadDeath t) {
throw t;
} catch (Throwable t) {
future.fail(t);
}
}, resultHandler);
} | java | public <T> void transactAsync(final DbCodeTypedTx<T> code, Handler<AsyncResult<T>> resultHandler) {
VertxUtil.executeBlocking(executor, future -> {
try {
T returnValue = null;
Transaction tx = new TransactionImpl();
tx.setRollbackOnError(true);
tx.setRollbackOnly(false);
boolean complete = false;
try {
returnValue = code.run(this, tx);
complete = true;
} catch (ThreadDeath | DatabaseException t) {
throw t;
} catch (Throwable t) {
throw new DatabaseException("Error during transaction", t);
} finally {
if ((!complete && tx.isRollbackOnError()) || tx.isRollbackOnly()) {
rollbackAndClose();
} else {
commitAndClose();
}
}
future.complete(returnValue);
} catch (ThreadDeath t) {
throw t;
} catch (Throwable t) {
future.fail(t);
}
}, resultHandler);
} | [
"public",
"<",
"T",
">",
"void",
"transactAsync",
"(",
"final",
"DbCodeTypedTx",
"<",
"T",
">",
"code",
",",
"Handler",
"<",
"AsyncResult",
"<",
"T",
">",
">",
"resultHandler",
")",
"{",
"VertxUtil",
".",
"executeBlocking",
"(",
"executor",
",",
"future",
... | Execute a transaction on a Vert.x worker thread, with default semantics (commit if
the code completes successfully, or rollback if it throws an error). The provided
result handler will be call after the commit or rollback, and will run on the event
loop thread (the same thread that is calling this method). | [
"Execute",
"a",
"transaction",
"on",
"a",
"Vert",
".",
"x",
"worker",
"thread",
"with",
"default",
"semantics",
"(",
"commit",
"if",
"the",
"code",
"completes",
"successfully",
"or",
"rollback",
"if",
"it",
"throws",
"an",
"error",
")",
".",
"The",
"provid... | train | https://github.com/susom/database/blob/25add9e08ad863712f9b5e319b6cb826f6f97640/src/main/java/com/github/susom/database/DatabaseProviderVertx.java#L254-L283 |
meltmedia/cadmium | email/src/main/java/com/meltmedia/cadmium/email/Email.java | Email.addAddressHelper | private void addAddressHelper(InternetAddressSet set, String address) {
if (address.contains(",") || address.contains(";")) {
String[] addresses = address.split("[,;]");
for (String a : addresses) {
set.add(a);
}
}
else {
set.add(address);
}
} | java | private void addAddressHelper(InternetAddressSet set, String address) {
if (address.contains(",") || address.contains(";")) {
String[] addresses = address.split("[,;]");
for (String a : addresses) {
set.add(a);
}
}
else {
set.add(address);
}
} | [
"private",
"void",
"addAddressHelper",
"(",
"InternetAddressSet",
"set",
",",
"String",
"address",
")",
"{",
"if",
"(",
"address",
".",
"contains",
"(",
"\",\"",
")",
"||",
"address",
".",
"contains",
"(",
"\";\"",
")",
")",
"{",
"String",
"[",
"]",
"add... | Checks if the addresses need to be split either on , or ;
@param set Internet address set to add the address to
@param address address or addresses to add to the given set | [
"Checks",
"if",
"the",
"addresses",
"need",
"to",
"be",
"split",
"either",
"on",
"or",
";"
] | train | https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/email/src/main/java/com/meltmedia/cadmium/email/Email.java#L59-L70 |
jbossas/jboss-vfs | src/main/java/org/jboss/vfs/VFSUtils.java | VFSUtils.getVirtualURL | public static URL getVirtualURL(VirtualFile file) throws MalformedURLException {
try {
final URI uri = getVirtualURI(file);
final String scheme = uri.getScheme();
return AccessController.doPrivileged(new PrivilegedExceptionAction<URL>() {
@Override
public URL run() throws MalformedURLException{
if (VFS_PROTOCOL.equals(scheme)) {
return new URL(null, uri.toString(), VFS_URL_HANDLER);
} else if ("file".equals(scheme)) {
return new URL(null, uri.toString(), FILE_URL_HANDLER);
} else {
return uri.toURL();
}
}
});
} catch (URISyntaxException e) {
throw new MalformedURLException(e.getMessage());
} catch (PrivilegedActionException e) {
throw (MalformedURLException) e.getException();
}
} | java | public static URL getVirtualURL(VirtualFile file) throws MalformedURLException {
try {
final URI uri = getVirtualURI(file);
final String scheme = uri.getScheme();
return AccessController.doPrivileged(new PrivilegedExceptionAction<URL>() {
@Override
public URL run() throws MalformedURLException{
if (VFS_PROTOCOL.equals(scheme)) {
return new URL(null, uri.toString(), VFS_URL_HANDLER);
} else if ("file".equals(scheme)) {
return new URL(null, uri.toString(), FILE_URL_HANDLER);
} else {
return uri.toURL();
}
}
});
} catch (URISyntaxException e) {
throw new MalformedURLException(e.getMessage());
} catch (PrivilegedActionException e) {
throw (MalformedURLException) e.getException();
}
} | [
"public",
"static",
"URL",
"getVirtualURL",
"(",
"VirtualFile",
"file",
")",
"throws",
"MalformedURLException",
"{",
"try",
"{",
"final",
"URI",
"uri",
"=",
"getVirtualURI",
"(",
"file",
")",
";",
"final",
"String",
"scheme",
"=",
"uri",
".",
"getScheme",
"(... | Get the virtual URL for a virtual file. This URL can be used to access the virtual file; however, taking the file
part of the URL and attempting to use it with the {@link java.io.File} class may fail if the file is not present
on the physical filesystem, and in general should not be attempted.
<b>Note:</b> if the given VirtualFile refers to a directory <b>at the time of this
method invocation</b>, a trailing slash will be appended to the URL; this means that invoking
this method may require a filesystem access, and in addition, may not produce consistent results
over time.
@param file the virtual file
@return the URL
@throws MalformedURLException if the file cannot be coerced into a URL for some reason
@see VirtualFile#asDirectoryURL()
@see VirtualFile#asFileURL() | [
"Get",
"the",
"virtual",
"URL",
"for",
"a",
"virtual",
"file",
".",
"This",
"URL",
"can",
"be",
"used",
"to",
"access",
"the",
"virtual",
"file",
";",
"however",
"taking",
"the",
"file",
"part",
"of",
"the",
"URL",
"and",
"attempting",
"to",
"use",
"it... | train | https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VFSUtils.java#L493-L514 |
b3dgs/lionengine | lionengine-core/src/main/java/com/b3dgs/lionengine/audio/AudioFactory.java | AudioFactory.loadAudio | public static synchronized <A extends Audio> A loadAudio(Media media, Class<A> type)
{
Check.notNull(media);
Check.notNull(type);
final String extension = UtilFile.getExtension(media.getPath());
try
{
return type.cast(Optional.ofNullable(FACTORIES.get(extension))
.orElseThrow(() -> new LionEngineException(media, ERROR_FORMAT))
.loadAudio(media));
}
catch (final ClassCastException exception)
{
throw new LionEngineException(exception, media, ERROR_FORMAT);
}
} | java | public static synchronized <A extends Audio> A loadAudio(Media media, Class<A> type)
{
Check.notNull(media);
Check.notNull(type);
final String extension = UtilFile.getExtension(media.getPath());
try
{
return type.cast(Optional.ofNullable(FACTORIES.get(extension))
.orElseThrow(() -> new LionEngineException(media, ERROR_FORMAT))
.loadAudio(media));
}
catch (final ClassCastException exception)
{
throw new LionEngineException(exception, media, ERROR_FORMAT);
}
} | [
"public",
"static",
"synchronized",
"<",
"A",
"extends",
"Audio",
">",
"A",
"loadAudio",
"(",
"Media",
"media",
",",
"Class",
"<",
"A",
">",
"type",
")",
"{",
"Check",
".",
"notNull",
"(",
"media",
")",
";",
"Check",
".",
"notNull",
"(",
"type",
")",... | Load an audio file and prepare it to be played.
@param <A> The audio type.
@param media The audio media (must not be <code>null</code>).
@param type The expected audio type (must not be <code>null</code>).
@return The loaded audio.
@throws LionEngineException If invalid arguments or invalid audio. | [
"Load",
"an",
"audio",
"file",
"and",
"prepare",
"it",
"to",
"be",
"played",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/audio/AudioFactory.java#L70-L86 |
JoeKerouac/utils | src/main/java/com/joe/utils/poi/WorkBookAccesser.java | WorkBookAccesser.mergedRegion | private void mergedRegion(Sheet sheet, int firstRow, int lastRow, int firstCol, int lastCol) {
sheet.addMergedRegion(new CellRangeAddress(firstRow, lastRow, firstCol, lastCol));
} | java | private void mergedRegion(Sheet sheet, int firstRow, int lastRow, int firstCol, int lastCol) {
sheet.addMergedRegion(new CellRangeAddress(firstRow, lastRow, firstCol, lastCol));
} | [
"private",
"void",
"mergedRegion",
"(",
"Sheet",
"sheet",
",",
"int",
"firstRow",
",",
"int",
"lastRow",
",",
"int",
"firstCol",
",",
"int",
"lastCol",
")",
"{",
"sheet",
".",
"addMergedRegion",
"(",
"new",
"CellRangeAddress",
"(",
"firstRow",
",",
"lastRow"... | 合并指定sheet指定区域的单元格
@param sheet sheet
@param firstRow 要合并的第一行
@param lastRow 要合并的最后一行
@param firstCol 要合并的第一列
@param lastCol 要合并的最后一列 | [
"合并指定sheet指定区域的单元格"
] | train | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/poi/WorkBookAccesser.java#L116-L118 |
BioPAX/Paxtools | pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java | PatternBox.inSameComplex | public static Pattern inSameComplex()
{
Pattern p = new Pattern(EntityReference.class, "first ER");
p.add(erToPE(), "first ER", "first simple PE");
p.add(linkToComplex(), "first simple PE", "Complex");
p.add(new Type(Complex.class), "Complex");
p.add(linkToSpecific(), "Complex", "second simple PE");
p.add(equal(false), "first simple PE", "second simple PE");
p.add(new PEChainsIntersect(false, true), "first simple PE", "Complex", "second simple PE", "Complex");
p.add(peToER(), "second simple PE", "second ER");
p.add(equal(false), "first ER", "second ER");
return p;
} | java | public static Pattern inSameComplex()
{
Pattern p = new Pattern(EntityReference.class, "first ER");
p.add(erToPE(), "first ER", "first simple PE");
p.add(linkToComplex(), "first simple PE", "Complex");
p.add(new Type(Complex.class), "Complex");
p.add(linkToSpecific(), "Complex", "second simple PE");
p.add(equal(false), "first simple PE", "second simple PE");
p.add(new PEChainsIntersect(false, true), "first simple PE", "Complex", "second simple PE", "Complex");
p.add(peToER(), "second simple PE", "second ER");
p.add(equal(false), "first ER", "second ER");
return p;
} | [
"public",
"static",
"Pattern",
"inSameComplex",
"(",
")",
"{",
"Pattern",
"p",
"=",
"new",
"Pattern",
"(",
"EntityReference",
".",
"class",
",",
"\"first ER\"",
")",
";",
"p",
".",
"add",
"(",
"erToPE",
"(",
")",
",",
"\"first ER\"",
",",
"\"first simple P... | Pattern for two different EntityReference have member PhysicalEntity in the same Complex.
Complex membership can be through multiple nesting and/or through homology relations.
@return the pattern | [
"Pattern",
"for",
"two",
"different",
"EntityReference",
"have",
"member",
"PhysicalEntity",
"in",
"the",
"same",
"Complex",
".",
"Complex",
"membership",
"can",
"be",
"through",
"multiple",
"nesting",
"and",
"/",
"or",
"through",
"homology",
"relations",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/PatternBox.java#L716-L728 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/AppEventsLogger.java | AppEventsLogger.logEvent | public void logEvent(String eventName, double valueToSum, Bundle parameters) {
logEvent(eventName, valueToSum, parameters, false);
} | java | public void logEvent(String eventName, double valueToSum, Bundle parameters) {
logEvent(eventName, valueToSum, parameters, false);
} | [
"public",
"void",
"logEvent",
"(",
"String",
"eventName",
",",
"double",
"valueToSum",
",",
"Bundle",
"parameters",
")",
"{",
"logEvent",
"(",
"eventName",
",",
"valueToSum",
",",
"parameters",
",",
"false",
")",
";",
"}"
] | Log an app event with the specified name, supplied value, and set of parameters.
@param eventName eventName used to denote the event. Choose amongst the EVENT_NAME_* constants in
{@link AppEventsConstants} when possible. Or create your own if none of the EVENT_NAME_*
constants are applicable.
Event names should be 40 characters or less, alphanumeric, and can include spaces, underscores
or hyphens, but mustn't have a space or hyphen as the first character. Any given app should
have no more than ~300 distinct event names.
@param valueToSum a value to associate with the event which will be summed up in Insights for across all
instances of the event, so that average values can be determined, etc.
@param parameters A Bundle of parameters to log with the event. Insights will allow looking at the logs of these
events via different parameter values. You can log on the order of 10 parameters with each
distinct eventName. It's advisable to keep the number of unique values provided for each
parameter in the, at most, thousands. As an example, don't attempt to provide a unique
parameter value for each unique user in your app. You won't get meaningful aggregate reporting
on so many parameter values. The values in the bundles should be Strings or numeric values. | [
"Log",
"an",
"app",
"event",
"with",
"the",
"specified",
"name",
"supplied",
"value",
"and",
"set",
"of",
"parameters",
"."
] | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/AppEventsLogger.java#L492-L494 |
stephanenicolas/toothpick | toothpick-runtime/src/main/java/toothpick/configuration/RuntimeCheckOnConfiguration.java | RuntimeCheckOnConfiguration.checkIllegalBinding | @Override
public void checkIllegalBinding(Binding binding, Scope scope) {
Class<?> clazz;
switch (binding.getMode()) {
case SIMPLE:
clazz = binding.getKey();
break;
case CLASS:
clazz = binding.getImplementationClass();
break;
case PROVIDER_CLASS:
clazz = binding.getProviderClass();
break;
default:
return;
}
for (Annotation annotation : clazz.getAnnotations()) {
Class<? extends Annotation> annotationType = annotation.annotationType();
if (annotationType.isAnnotationPresent(javax.inject.Scope.class)) {
if (!scope.isBoundToScopeAnnotation(annotationType)) {
throw new IllegalBindingException(format("Class %s cannot be bound."
+ " It has a scope annotation: %s that is not supported by current scope: %s",
clazz.getName(), annotationType.getName(), scope.getName()));
}
}
}
} | java | @Override
public void checkIllegalBinding(Binding binding, Scope scope) {
Class<?> clazz;
switch (binding.getMode()) {
case SIMPLE:
clazz = binding.getKey();
break;
case CLASS:
clazz = binding.getImplementationClass();
break;
case PROVIDER_CLASS:
clazz = binding.getProviderClass();
break;
default:
return;
}
for (Annotation annotation : clazz.getAnnotations()) {
Class<? extends Annotation> annotationType = annotation.annotationType();
if (annotationType.isAnnotationPresent(javax.inject.Scope.class)) {
if (!scope.isBoundToScopeAnnotation(annotationType)) {
throw new IllegalBindingException(format("Class %s cannot be bound."
+ " It has a scope annotation: %s that is not supported by current scope: %s",
clazz.getName(), annotationType.getName(), scope.getName()));
}
}
}
} | [
"@",
"Override",
"public",
"void",
"checkIllegalBinding",
"(",
"Binding",
"binding",
",",
"Scope",
"scope",
")",
"{",
"Class",
"<",
"?",
">",
"clazz",
";",
"switch",
"(",
"binding",
".",
"getMode",
"(",
")",
")",
"{",
"case",
"SIMPLE",
":",
"clazz",
"=... | check that a binding's target annotation scope, if present, is supported
by the scope {@code scope}.
@param binding the binding being installed.
@param scope the scope where the binding is installed. | [
"check",
"that",
"a",
"binding",
"s",
"target",
"annotation",
"scope",
"if",
"present",
"is",
"supported",
"by",
"the",
"scope",
"{"
] | train | https://github.com/stephanenicolas/toothpick/blob/54476ca9a5fa48809c15a46e43e38db9ed7e1a75/toothpick-runtime/src/main/java/toothpick/configuration/RuntimeCheckOnConfiguration.java#L29-L56 |
pressgang-ccms/PressGangCCMSContentSpecProcessor | src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecValidator.java | ContentSpecValidator.checkForConflictingCondition | protected void checkForConflictingCondition(final IOptionsNode node, final ContentSpec contentSpec) {
if (!isNullOrEmpty(node.getConditionStatement())) {
final String publicanCfg;
if (!contentSpec.getDefaultPublicanCfg().equals(CommonConstants.CS_PUBLICAN_CFG_TITLE)) {
final String name = contentSpec.getDefaultPublicanCfg();
final Matcher matcher = CSConstants.CUSTOM_PUBLICAN_CFG_PATTERN.matcher(name);
final String fixedName = matcher.find() ? matcher.group(1) : name;
publicanCfg = contentSpec.getAdditionalPublicanCfg(fixedName);
} else {
publicanCfg = contentSpec.getPublicanCfg();
}
// Make sure a publican.cfg is defined before doing any checks
if (!isNullOrEmpty(publicanCfg)) {
if (publicanCfg.contains("condition:")) {
log.warn(String.format(ProcessorConstants.WARN_CONDITION_IGNORED_MSG, node.getLineNumber(), node.getText()));
}
}
}
} | java | protected void checkForConflictingCondition(final IOptionsNode node, final ContentSpec contentSpec) {
if (!isNullOrEmpty(node.getConditionStatement())) {
final String publicanCfg;
if (!contentSpec.getDefaultPublicanCfg().equals(CommonConstants.CS_PUBLICAN_CFG_TITLE)) {
final String name = contentSpec.getDefaultPublicanCfg();
final Matcher matcher = CSConstants.CUSTOM_PUBLICAN_CFG_PATTERN.matcher(name);
final String fixedName = matcher.find() ? matcher.group(1) : name;
publicanCfg = contentSpec.getAdditionalPublicanCfg(fixedName);
} else {
publicanCfg = contentSpec.getPublicanCfg();
}
// Make sure a publican.cfg is defined before doing any checks
if (!isNullOrEmpty(publicanCfg)) {
if (publicanCfg.contains("condition:")) {
log.warn(String.format(ProcessorConstants.WARN_CONDITION_IGNORED_MSG, node.getLineNumber(), node.getText()));
}
}
}
} | [
"protected",
"void",
"checkForConflictingCondition",
"(",
"final",
"IOptionsNode",
"node",
",",
"final",
"ContentSpec",
"contentSpec",
")",
"{",
"if",
"(",
"!",
"isNullOrEmpty",
"(",
"node",
".",
"getConditionStatement",
"(",
")",
")",
")",
"{",
"final",
"String... | Check if the condition on a node will conflict with a condition in the defined publican.cfg file.
@param node The node to be checked.
@param contentSpec The content spec the node belongs to. | [
"Check",
"if",
"the",
"condition",
"on",
"a",
"node",
"will",
"conflict",
"with",
"a",
"condition",
"in",
"the",
"defined",
"publican",
".",
"cfg",
"file",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecValidator.java#L487-L506 |
landawn/AbacusUtil | src/com/landawn/abacus/util/LongList.java | LongList.anyMatch | public <E extends Exception> boolean anyMatch(Try.LongPredicate<E> filter) throws E {
return anyMatch(0, size(), filter);
} | java | public <E extends Exception> boolean anyMatch(Try.LongPredicate<E> filter) throws E {
return anyMatch(0, size(), filter);
} | [
"public",
"<",
"E",
"extends",
"Exception",
">",
"boolean",
"anyMatch",
"(",
"Try",
".",
"LongPredicate",
"<",
"E",
">",
"filter",
")",
"throws",
"E",
"{",
"return",
"anyMatch",
"(",
"0",
",",
"size",
"(",
")",
",",
"filter",
")",
";",
"}"
] | Returns whether any elements of this List match the provided predicate.
@param filter
@return | [
"Returns",
"whether",
"any",
"elements",
"of",
"this",
"List",
"match",
"the",
"provided",
"predicate",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/LongList.java#L944-L946 |
eFaps/eFaps-Kernel | src/main/java/org/efaps/beans/ValueList.java | ValueList.addExpression | public void addExpression(final String _expression)
{
this.tokens.add(new Token(ValueList.TokenType.EXPRESSION, _expression));
getExpressions().add(_expression);
} | java | public void addExpression(final String _expression)
{
this.tokens.add(new Token(ValueList.TokenType.EXPRESSION, _expression));
getExpressions().add(_expression);
} | [
"public",
"void",
"addExpression",
"(",
"final",
"String",
"_expression",
")",
"{",
"this",
".",
"tokens",
".",
"add",
"(",
"new",
"Token",
"(",
"ValueList",
".",
"TokenType",
".",
"EXPRESSION",
",",
"_expression",
")",
")",
";",
"getExpressions",
"(",
")"... | Add an Expression to this ValueList.
@param _expression String with the expression | [
"Add",
"an",
"Expression",
"to",
"this",
"ValueList",
"."
] | train | https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/beans/ValueList.java#L110-L114 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCamera.java | GVRCamera.setBackgroundColor | public void setBackgroundColor(float r, float g, float b, float a) {
setBackgroundColorR(r);
setBackgroundColorG(g);
setBackgroundColorB(b);
setBackgroundColorA(a);
} | java | public void setBackgroundColor(float r, float g, float b, float a) {
setBackgroundColorR(r);
setBackgroundColorG(g);
setBackgroundColorB(b);
setBackgroundColorA(a);
} | [
"public",
"void",
"setBackgroundColor",
"(",
"float",
"r",
",",
"float",
"g",
",",
"float",
"b",
",",
"float",
"a",
")",
"{",
"setBackgroundColorR",
"(",
"r",
")",
";",
"setBackgroundColorG",
"(",
"g",
")",
";",
"setBackgroundColorB",
"(",
"b",
")",
";",... | Sets the background color of the scene rendered by this camera.
If you don't set the background color, the default is an opaque black.
Meaningful parameter values are from 0 to 1, inclusive: values
{@literal < 0} are clamped to 0; values {@literal > 1} are clamped to 1. | [
"Sets",
"the",
"background",
"color",
"of",
"the",
"scene",
"rendered",
"by",
"this",
"camera",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRCamera.java#L97-L102 |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DatastoreUtils.java | DatastoreUtils.incrementVersion | static Entity incrementVersion(Entity nativeEntity, PropertyMetadata versionMetadata) {
String versionPropertyName = versionMetadata.getMappedName();
long version = nativeEntity.getLong(versionPropertyName);
return Entity.newBuilder(nativeEntity).set(versionPropertyName, ++version).build();
} | java | static Entity incrementVersion(Entity nativeEntity, PropertyMetadata versionMetadata) {
String versionPropertyName = versionMetadata.getMappedName();
long version = nativeEntity.getLong(versionPropertyName);
return Entity.newBuilder(nativeEntity).set(versionPropertyName, ++version).build();
} | [
"static",
"Entity",
"incrementVersion",
"(",
"Entity",
"nativeEntity",
",",
"PropertyMetadata",
"versionMetadata",
")",
"{",
"String",
"versionPropertyName",
"=",
"versionMetadata",
".",
"getMappedName",
"(",
")",
";",
"long",
"version",
"=",
"nativeEntity",
".",
"g... | Increments the version property of the given entity by one.
@param nativeEntity
the target entity
@param versionMetadata
the metadata of the version property
@return a new entity (copy of the given), but with the incremented version. | [
"Increments",
"the",
"version",
"property",
"of",
"the",
"given",
"entity",
"by",
"one",
"."
] | train | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DatastoreUtils.java#L151-L155 |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tag/common/fmt/BundleSupport.java | BundleSupport.findMatch | private static ResourceBundle findMatch(String basename, Locale pref) {
ResourceBundle match = null;
try {
ClassLoader cl = getClassLoaderCheckingPrivilege();
ResourceBundle bundle = ResourceBundle.getBundle(basename, pref, cl);
Locale avail = bundle.getLocale();
if (pref.equals(avail)) {
// Exact match
match = bundle;
} else {
/*
* We have to make sure that the match we got is for
* the specified locale. The way ResourceBundle.getBundle()
* works, if a match is not found with (1) the specified locale,
* it tries to match with (2) the current default locale as
* returned by Locale.getDefault() or (3) the root resource
* bundle (basename).
* We must ignore any match that could have worked with (2) or (3).
* So if an exact match is not found, we make the following extra
* tests:
* - avail locale must be equal to preferred locale
* - avail country must be empty or equal to preferred country
* (the equality match might have failed on the variant)
*/
if (pref.getLanguage().equals(avail.getLanguage())
&& ("".equals(avail.getCountry()) || pref.getCountry().equals(avail.getCountry()))) {
/*
* Language match.
* By making sure the available locale does not have a
* country and matches the preferred locale's language, we
* rule out "matches" based on the container's default
* locale. For example, if the preferred locale is
* "en-US", the container's default locale is "en-UK", and
* there is a resource bundle (with the requested base
* name) available for "en-UK", ResourceBundle.getBundle()
* will return it, but even though its language matches
* that of the preferred locale, we must ignore it,
* because matches based on the container's default locale
* are not portable across different containers with
* different default locales.
*/
match = bundle;
}
}
} catch (MissingResourceException mre) {
}
return match;
} | java | private static ResourceBundle findMatch(String basename, Locale pref) {
ResourceBundle match = null;
try {
ClassLoader cl = getClassLoaderCheckingPrivilege();
ResourceBundle bundle = ResourceBundle.getBundle(basename, pref, cl);
Locale avail = bundle.getLocale();
if (pref.equals(avail)) {
// Exact match
match = bundle;
} else {
/*
* We have to make sure that the match we got is for
* the specified locale. The way ResourceBundle.getBundle()
* works, if a match is not found with (1) the specified locale,
* it tries to match with (2) the current default locale as
* returned by Locale.getDefault() or (3) the root resource
* bundle (basename).
* We must ignore any match that could have worked with (2) or (3).
* So if an exact match is not found, we make the following extra
* tests:
* - avail locale must be equal to preferred locale
* - avail country must be empty or equal to preferred country
* (the equality match might have failed on the variant)
*/
if (pref.getLanguage().equals(avail.getLanguage())
&& ("".equals(avail.getCountry()) || pref.getCountry().equals(avail.getCountry()))) {
/*
* Language match.
* By making sure the available locale does not have a
* country and matches the preferred locale's language, we
* rule out "matches" based on the container's default
* locale. For example, if the preferred locale is
* "en-US", the container's default locale is "en-UK", and
* there is a resource bundle (with the requested base
* name) available for "en-UK", ResourceBundle.getBundle()
* will return it, but even though its language matches
* that of the preferred locale, we must ignore it,
* because matches based on the container's default locale
* are not portable across different containers with
* different default locales.
*/
match = bundle;
}
}
} catch (MissingResourceException mre) {
}
return match;
} | [
"private",
"static",
"ResourceBundle",
"findMatch",
"(",
"String",
"basename",
",",
"Locale",
"pref",
")",
"{",
"ResourceBundle",
"match",
"=",
"null",
";",
"try",
"{",
"ClassLoader",
"cl",
"=",
"getClassLoaderCheckingPrivilege",
"(",
")",
";",
"ResourceBundle",
... | /*
Gets the resource bundle with the given base name and preferred locale.
This method calls java.util.ResourceBundle.getBundle(), but ignores
its return value unless its locale represents an exact or language match
with the given preferred locale.
@param basename the resource bundle base name
@param pref the preferred locale
@return the requested resource bundle, or <tt>null</tt> if no resource
bundle with the given base name exists or if there is no exact- or
language-match between the preferred locale and the locale of
the bundle returned by java.util.ResourceBundle.getBundle(). | [
"/",
"*",
"Gets",
"the",
"resource",
"bundle",
"with",
"the",
"given",
"base",
"name",
"and",
"preferred",
"locale",
"."
] | train | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tag/common/fmt/BundleSupport.java#L266-L315 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/methods/TmdbTV.java | TmdbTV.getTVInfo | public TVInfo getTVInfo(int tvID, String language, String... appendToResponse) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, tvID);
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.APPEND, appendToResponse);
URL url = new ApiUrl(apiKey, MethodBase.TV).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
return MAPPER.readValue(webpage, TVInfo.class);
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get TV Info", url, ex);
}
} | java | public TVInfo getTVInfo(int tvID, String language, String... appendToResponse) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, tvID);
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.APPEND, appendToResponse);
URL url = new ApiUrl(apiKey, MethodBase.TV).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
return MAPPER.readValue(webpage, TVInfo.class);
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get TV Info", url, ex);
}
} | [
"public",
"TVInfo",
"getTVInfo",
"(",
"int",
"tvID",
",",
"String",
"language",
",",
"String",
"...",
"appendToResponse",
")",
"throws",
"MovieDbException",
"{",
"TmdbParameters",
"parameters",
"=",
"new",
"TmdbParameters",
"(",
")",
";",
"parameters",
".",
"add... | Get the primary information about a TV series by id.
@param tvID
@param language
@param appendToResponse
@return
@throws com.omertron.themoviedbapi.MovieDbException | [
"Get",
"the",
"primary",
"information",
"about",
"a",
"TV",
"series",
"by",
"id",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbTV.java#L81-L95 |
qmetric/halreader | src/main/java/com/qmetric/hal/reader/HalResource.java | HalResource.getResourcesByRel | public List<HalResource> getResourcesByRel(final String rel)
{
final List<? extends ReadableRepresentation> resources = representation.getResourcesByRel(rel);
return resources.stream()
.map(representation -> new HalResource(objectMapper, representation))
.collect(Collectors.toList());
} | java | public List<HalResource> getResourcesByRel(final String rel)
{
final List<? extends ReadableRepresentation> resources = representation.getResourcesByRel(rel);
return resources.stream()
.map(representation -> new HalResource(objectMapper, representation))
.collect(Collectors.toList());
} | [
"public",
"List",
"<",
"HalResource",
">",
"getResourcesByRel",
"(",
"final",
"String",
"rel",
")",
"{",
"final",
"List",
"<",
"?",
"extends",
"ReadableRepresentation",
">",
"resources",
"=",
"representation",
".",
"getResourcesByRel",
"(",
"rel",
")",
";",
"r... | Get embedded resources by relation
@param rel Relation name
@return Embedded resources | [
"Get",
"embedded",
"resources",
"by",
"relation"
] | train | https://github.com/qmetric/halreader/blob/584167b25ac7ae0559c6e3cdd300b8a02e59b00b/src/main/java/com/qmetric/hal/reader/HalResource.java#L71-L78 |
alkacon/opencms-core | src-gwt/org/opencms/ade/galleries/client/preview/CmsFocalPointController.java | CmsFocalPointController.transformRegionBack | private static CmsRectangle transformRegionBack(I_CmsTransform transform, CmsRectangle region) {
CmsPoint topLeft = region.getTopLeft();
CmsPoint bottomRight = region.getBottomRight();
return CmsRectangle.fromPoints(transform.transformBack(topLeft), transform.transformBack(bottomRight));
} | java | private static CmsRectangle transformRegionBack(I_CmsTransform transform, CmsRectangle region) {
CmsPoint topLeft = region.getTopLeft();
CmsPoint bottomRight = region.getBottomRight();
return CmsRectangle.fromPoints(transform.transformBack(topLeft), transform.transformBack(bottomRight));
} | [
"private",
"static",
"CmsRectangle",
"transformRegionBack",
"(",
"I_CmsTransform",
"transform",
",",
"CmsRectangle",
"region",
")",
"{",
"CmsPoint",
"topLeft",
"=",
"region",
".",
"getTopLeft",
"(",
")",
";",
"CmsPoint",
"bottomRight",
"=",
"region",
".",
"getBott... | Transforms a rectangle with the inverse of a coordinate transform.<p>
@param transform the coordinate transform
@param region the rectangle to transform
@return the transformed rectangle | [
"Transforms",
"a",
"rectangle",
"with",
"the",
"inverse",
"of",
"a",
"coordinate",
"transform",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/preview/CmsFocalPointController.java#L160-L165 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberFormat.java | NumberFormat.getPattern | @Deprecated
protected static String getPattern(Locale forLocale, int choice) {
return getPattern(ULocale.forLocale(forLocale), choice);
} | java | @Deprecated
protected static String getPattern(Locale forLocale, int choice) {
return getPattern(ULocale.forLocale(forLocale), choice);
} | [
"@",
"Deprecated",
"protected",
"static",
"String",
"getPattern",
"(",
"Locale",
"forLocale",
",",
"int",
"choice",
")",
"{",
"return",
"getPattern",
"(",
"ULocale",
".",
"forLocale",
"(",
"forLocale",
")",
",",
"choice",
")",
";",
"}"
] | Returns the pattern for the provided locale and choice.
@param forLocale the locale of the data.
@param choice the pattern format.
@return the pattern
@deprecated ICU 3.4 subclassers should override getPattern(ULocale, int) instead of this method.
@hide original deprecated declaration | [
"Returns",
"the",
"pattern",
"for",
"the",
"provided",
"locale",
"and",
"choice",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberFormat.java#L1355-L1358 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Logger.java | Logger.entering | public void entering(String sourceClass, String sourceMethod) {
if (Level.FINER.intValue() < levelValue) {
return;
}
logp(Level.FINER, sourceClass, sourceMethod, "ENTRY");
} | java | public void entering(String sourceClass, String sourceMethod) {
if (Level.FINER.intValue() < levelValue) {
return;
}
logp(Level.FINER, sourceClass, sourceMethod, "ENTRY");
} | [
"public",
"void",
"entering",
"(",
"String",
"sourceClass",
",",
"String",
"sourceMethod",
")",
"{",
"if",
"(",
"Level",
".",
"FINER",
".",
"intValue",
"(",
")",
"<",
"levelValue",
")",
"{",
"return",
";",
"}",
"logp",
"(",
"Level",
".",
"FINER",
",",
... | Log a method entry.
<p>
This is a convenience method that can be used to log entry
to a method. A LogRecord with message "ENTRY", log level
FINER, and the given sourceMethod and sourceClass is logged.
<p>
@param sourceClass name of class that issued the logging request
@param sourceMethod name of method that is being entered | [
"Log",
"a",
"method",
"entry",
".",
"<p",
">",
"This",
"is",
"a",
"convenience",
"method",
"that",
"can",
"be",
"used",
"to",
"log",
"entry",
"to",
"a",
"method",
".",
"A",
"LogRecord",
"with",
"message",
"ENTRY",
"log",
"level",
"FINER",
"and",
"the",... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Logger.java#L1026-L1031 |
Netflix/denominator | core/src/main/java/denominator/CredentialsConfiguration.java | CredentialsConfiguration.exceptionMessage | public static String exceptionMessage(Credentials input, denominator.Provider provider) {
StringBuilder msg = new StringBuilder();
if (input == null || input == AnonymousCredentials.INSTANCE) {
msg.append("no credentials supplied. ");
} else {
msg.append("incorrect credentials supplied. ");
}
msg.append(provider.name()).append(" requires ");
Map<String, Collection<String>>
credentialTypeToParameterNames =
provider.credentialTypeToParameterNames();
if (credentialTypeToParameterNames.size() == 1) {
msg.append(join(',', credentialTypeToParameterNames.values().iterator().next().toArray()));
} else {
msg.append("one of the following forms: when type is ");
for (Entry<String, Collection<String>> entry : credentialTypeToParameterNames.entrySet()) {
msg.append(entry.getKey()).append(": ").append(join(',', entry.getValue().toArray()))
.append("; ");
}
msg.trimToSize();
msg.setLength(msg.length() - 2);// remove last '; '
}
return msg.toString();
} | java | public static String exceptionMessage(Credentials input, denominator.Provider provider) {
StringBuilder msg = new StringBuilder();
if (input == null || input == AnonymousCredentials.INSTANCE) {
msg.append("no credentials supplied. ");
} else {
msg.append("incorrect credentials supplied. ");
}
msg.append(provider.name()).append(" requires ");
Map<String, Collection<String>>
credentialTypeToParameterNames =
provider.credentialTypeToParameterNames();
if (credentialTypeToParameterNames.size() == 1) {
msg.append(join(',', credentialTypeToParameterNames.values().iterator().next().toArray()));
} else {
msg.append("one of the following forms: when type is ");
for (Entry<String, Collection<String>> entry : credentialTypeToParameterNames.entrySet()) {
msg.append(entry.getKey()).append(": ").append(join(',', entry.getValue().toArray()))
.append("; ");
}
msg.trimToSize();
msg.setLength(msg.length() - 2);// remove last '; '
}
return msg.toString();
} | [
"public",
"static",
"String",
"exceptionMessage",
"(",
"Credentials",
"input",
",",
"denominator",
".",
"Provider",
"provider",
")",
"{",
"StringBuilder",
"msg",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"input",
"==",
"null",
"||",
"input",
"==... | Use this method to generate a consistent error message when the credentials supplied are not
valid for the provider. Typically, this will be the message of an {@code
IllegalArgumentException}
@param input nullable credentials you know are invalid
@param provider provider they are invalid for | [
"Use",
"this",
"method",
"to",
"generate",
"a",
"consistent",
"error",
"message",
"when",
"the",
"credentials",
"supplied",
"are",
"not",
"valid",
"for",
"the",
"provider",
".",
"Typically",
"this",
"will",
"be",
"the",
"message",
"of",
"an",
"{",
"@code",
... | train | https://github.com/Netflix/denominator/blob/c565e3b8c6043051252e0947029511f9ac5d306f/core/src/main/java/denominator/CredentialsConfiguration.java#L169-L193 |
cuba-platform/yarg | core/modules/core/src/com/haulmont/yarg/formatters/impl/DocFormatter.java | DocFormatter.replaceAllAliasesInDocument | protected void replaceAllAliasesInDocument() {
XTextDocument xTextDocument = as(XTextDocument.class, xComponent);
XReplaceable xReplaceable = as(XReplaceable.class, xTextDocument);
XSearchDescriptor searchDescriptor = xReplaceable.createSearchDescriptor();
searchDescriptor.setSearchString(ALIAS_WITH_BAND_NAME_REGEXP);
try {
searchDescriptor.setPropertyValue(SEARCH_REGULAR_EXPRESSION, true);
} catch (Exception e) {
throw new OpenOfficeException("An error occurred while setting search properties in Open office", e);
}
XIndexAccess indexAccess = xReplaceable.findAll(searchDescriptor);
for (int i = 0; i < indexAccess.getCount(); i++) {
try {
XTextRange textRange = as(XTextRange.class, indexAccess.getByIndex(i));
String alias = unwrapParameterName(textRange.getString());
BandPathAndParameterName bandAndParameter = separateBandNameAndParameterName(alias);
BandData band = findBandByPath(bandAndParameter.getBandPath());
if (band != null) {
insertValue(textRange.getText(), textRange, band, bandAndParameter.getParameterName());
} else {
throw wrapWithReportingException(String.format("No band for alias [%s] found", alias));
}
} catch (ReportingException e) {
throw e;
} catch (Exception e) {
throw wrapWithReportingException(String.format("An error occurred while replacing aliases in document. Regexp [%s]. Replacement number [%d]", ALIAS_WITH_BAND_NAME_REGEXP, i), e);
}
}
} | java | protected void replaceAllAliasesInDocument() {
XTextDocument xTextDocument = as(XTextDocument.class, xComponent);
XReplaceable xReplaceable = as(XReplaceable.class, xTextDocument);
XSearchDescriptor searchDescriptor = xReplaceable.createSearchDescriptor();
searchDescriptor.setSearchString(ALIAS_WITH_BAND_NAME_REGEXP);
try {
searchDescriptor.setPropertyValue(SEARCH_REGULAR_EXPRESSION, true);
} catch (Exception e) {
throw new OpenOfficeException("An error occurred while setting search properties in Open office", e);
}
XIndexAccess indexAccess = xReplaceable.findAll(searchDescriptor);
for (int i = 0; i < indexAccess.getCount(); i++) {
try {
XTextRange textRange = as(XTextRange.class, indexAccess.getByIndex(i));
String alias = unwrapParameterName(textRange.getString());
BandPathAndParameterName bandAndParameter = separateBandNameAndParameterName(alias);
BandData band = findBandByPath(bandAndParameter.getBandPath());
if (band != null) {
insertValue(textRange.getText(), textRange, band, bandAndParameter.getParameterName());
} else {
throw wrapWithReportingException(String.format("No band for alias [%s] found", alias));
}
} catch (ReportingException e) {
throw e;
} catch (Exception e) {
throw wrapWithReportingException(String.format("An error occurred while replacing aliases in document. Regexp [%s]. Replacement number [%d]", ALIAS_WITH_BAND_NAME_REGEXP, i), e);
}
}
} | [
"protected",
"void",
"replaceAllAliasesInDocument",
"(",
")",
"{",
"XTextDocument",
"xTextDocument",
"=",
"as",
"(",
"XTextDocument",
".",
"class",
",",
"xComponent",
")",
";",
"XReplaceable",
"xReplaceable",
"=",
"as",
"(",
"XReplaceable",
".",
"class",
",",
"x... | Replaces all aliases ${bandname.paramname} in document text.
@throws com.haulmont.yarg.exception.ReportingException If there is not appropriate band or alias is bad | [
"Replaces",
"all",
"aliases",
"$",
"{",
"bandname",
".",
"paramname",
"}",
"in",
"document",
"text",
"."
] | train | https://github.com/cuba-platform/yarg/blob/d157286cbe29448f3e1f445e8c5dd88808351da0/core/modules/core/src/com/haulmont/yarg/formatters/impl/DocFormatter.java#L252-L284 |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java | ContextItems.lookupItemName | private String lookupItemName(String itemName, boolean autoAdd) {
String indexedName = index.get(itemName.toLowerCase());
if (indexedName == null && autoAdd) {
index.put(itemName.toLowerCase(), itemName);
}
return indexedName == null ? itemName : indexedName;
} | java | private String lookupItemName(String itemName, boolean autoAdd) {
String indexedName = index.get(itemName.toLowerCase());
if (indexedName == null && autoAdd) {
index.put(itemName.toLowerCase(), itemName);
}
return indexedName == null ? itemName : indexedName;
} | [
"private",
"String",
"lookupItemName",
"(",
"String",
"itemName",
",",
"boolean",
"autoAdd",
")",
"{",
"String",
"indexedName",
"=",
"index",
".",
"get",
"(",
"itemName",
".",
"toLowerCase",
"(",
")",
")",
";",
"if",
"(",
"indexedName",
"==",
"null",
"&&",... | Performs a case-insensitive lookup of the item name in the index.
@param itemName Item name
@param autoAdd If true and item name not in index, add it.
@return Item name as stored internally. If not already stored, returns the item name as it
was specified in itemName. | [
"Performs",
"a",
"case",
"-",
"insensitive",
"lookup",
"of",
"the",
"item",
"name",
"in",
"the",
"index",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java#L67-L75 |
grails/gorm-hibernate5 | grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/query/AbstractHibernateCriteriaBuilder.java | AbstractHibernateCriteriaBuilder.sqlRestriction | public org.grails.datastore.mapping.query.api.Criteria sqlRestriction(String sqlRestriction, List<?> values) {
if (!validateSimpleExpression()) {
throwRuntimeException(new IllegalArgumentException("Call to [sqlRestriction] with value [" +
sqlRestriction + "] not allowed here."));
}
final int numberOfParameters = values.size();
final Type[] typesArray = new Type[numberOfParameters];
final Object[] valuesArray = new Object[numberOfParameters];
if (numberOfParameters > 0) {
final TypeHelper typeHelper = sessionFactory.getTypeHelper();
for (int i = 0; i < typesArray.length; i++) {
final Object value = values.get(i);
typesArray[i] = typeHelper.basic(value.getClass());
valuesArray[i] = value;
}
}
addToCriteria(Restrictions.sqlRestriction(sqlRestriction, valuesArray, typesArray));
return this;
} | java | public org.grails.datastore.mapping.query.api.Criteria sqlRestriction(String sqlRestriction, List<?> values) {
if (!validateSimpleExpression()) {
throwRuntimeException(new IllegalArgumentException("Call to [sqlRestriction] with value [" +
sqlRestriction + "] not allowed here."));
}
final int numberOfParameters = values.size();
final Type[] typesArray = new Type[numberOfParameters];
final Object[] valuesArray = new Object[numberOfParameters];
if (numberOfParameters > 0) {
final TypeHelper typeHelper = sessionFactory.getTypeHelper();
for (int i = 0; i < typesArray.length; i++) {
final Object value = values.get(i);
typesArray[i] = typeHelper.basic(value.getClass());
valuesArray[i] = value;
}
}
addToCriteria(Restrictions.sqlRestriction(sqlRestriction, valuesArray, typesArray));
return this;
} | [
"public",
"org",
".",
"grails",
".",
"datastore",
".",
"mapping",
".",
"query",
".",
"api",
".",
"Criteria",
"sqlRestriction",
"(",
"String",
"sqlRestriction",
",",
"List",
"<",
"?",
">",
"values",
")",
"{",
"if",
"(",
"!",
"validateSimpleExpression",
"(",... | Applies a sql restriction to the results to allow something like:
@param sqlRestriction the sql restriction
@param values jdbc parameters
@return a Criteria instance | [
"Applies",
"a",
"sql",
"restriction",
"to",
"the",
"results",
"to",
"allow",
"something",
"like",
":"
] | train | https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/query/AbstractHibernateCriteriaBuilder.java#L1158-L1178 |
jbundle/jbundle | base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBasePanel.java | HBasePanel.printScreen | public void printScreen(PrintWriter out, ResourceBundle reg)
throws DBException
{
String strParamHelp = this.getProperty(DBParams.HELP); // Display record
if (strParamHelp != null)
return; // Don't do this for help screens
this.printHtmlStartForm(out);
int iHtmlOptions = this.getScreenField().getPrintOptions();
if ((iHtmlOptions & HtmlConstants.PRINT_TOOLBAR_BEFORE) != 0)
this.printZmlToolbarData(out, iHtmlOptions);
if ((iHtmlOptions & HtmlConstants.DONT_PRINT_SCREEN) == 0)
this.getScreenField().printData(out, iHtmlOptions); // DO print screen
if ((iHtmlOptions & HtmlConstants.PRINT_TOOLBAR_AFTER) != 0)
this.printZmlToolbarData(out, iHtmlOptions);
this.printHtmlEndForm(out);
} | java | public void printScreen(PrintWriter out, ResourceBundle reg)
throws DBException
{
String strParamHelp = this.getProperty(DBParams.HELP); // Display record
if (strParamHelp != null)
return; // Don't do this for help screens
this.printHtmlStartForm(out);
int iHtmlOptions = this.getScreenField().getPrintOptions();
if ((iHtmlOptions & HtmlConstants.PRINT_TOOLBAR_BEFORE) != 0)
this.printZmlToolbarData(out, iHtmlOptions);
if ((iHtmlOptions & HtmlConstants.DONT_PRINT_SCREEN) == 0)
this.getScreenField().printData(out, iHtmlOptions); // DO print screen
if ((iHtmlOptions & HtmlConstants.PRINT_TOOLBAR_AFTER) != 0)
this.printZmlToolbarData(out, iHtmlOptions);
this.printHtmlEndForm(out);
} | [
"public",
"void",
"printScreen",
"(",
"PrintWriter",
"out",
",",
"ResourceBundle",
"reg",
")",
"throws",
"DBException",
"{",
"String",
"strParamHelp",
"=",
"this",
".",
"getProperty",
"(",
"DBParams",
".",
"HELP",
")",
";",
"// Display record",
"if",
"(",
"str... | Print this screen's content area.
@param out The out stream.
@exception DBException File exception. | [
"Print",
"this",
"screen",
"s",
"content",
"area",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/HBasePanel.java#L137-L155 |
huangp/entityunit | src/main/java/com/github/huangp/entityunit/maker/IntervalValuesMaker.java | IntervalValuesMaker.startFrom | public static <T> Maker<T> startFrom(T start, long difference) {
if (Integer.class.isInstance(start)) {
return new IntervalIntegerValuesMaker<T>(start, difference);
}
if (Long.class.isInstance(start)) {
return new IntervalLongValuesMaker<T>(start, difference);
}
if (Date.class.isInstance(start)) {
return new IntervalDateValuesMaker<T>(start, difference);
}
if (String.class.isInstance(start)) {
return new IntervalStringValuesMaker<T>((String) start, difference);
}
throw new UnsupportedOperationException("only support Number, Date and String type");
} | java | public static <T> Maker<T> startFrom(T start, long difference) {
if (Integer.class.isInstance(start)) {
return new IntervalIntegerValuesMaker<T>(start, difference);
}
if (Long.class.isInstance(start)) {
return new IntervalLongValuesMaker<T>(start, difference);
}
if (Date.class.isInstance(start)) {
return new IntervalDateValuesMaker<T>(start, difference);
}
if (String.class.isInstance(start)) {
return new IntervalStringValuesMaker<T>((String) start, difference);
}
throw new UnsupportedOperationException("only support Number, Date and String type");
} | [
"public",
"static",
"<",
"T",
">",
"Maker",
"<",
"T",
">",
"startFrom",
"(",
"T",
"start",
",",
"long",
"difference",
")",
"{",
"if",
"(",
"Integer",
".",
"class",
".",
"isInstance",
"(",
"start",
")",
")",
"{",
"return",
"new",
"IntervalIntegerValuesM... | Example:
<pre>
{@code
public void canGetIntervalInteger() {
Maker<Integer> maker = IntervalValuesMaker.startFrom(1, 2);
assertThat(maker.value(), Matchers.equalTo(1));
assertThat(maker.value(), Matchers.equalTo(3));
assertThat(maker.value(), Matchers.equalTo(5));
}
public void canGetIntervalLong() {
Maker<Long> maker = IntervalValuesMaker.startFrom(1L, 2);
assertThat(maker.value(), Matchers.equalTo(1L));
assertThat(maker.value(), Matchers.equalTo(3L));
assertThat(maker.value(), Matchers.equalTo(5L));
}
public void canGetIntervalDate() {
Date start = new Date();
// hint: could use IntervalValuesMaker.startFrom(new Date(), -TimeUnit.DAYS.toMillis(1))
Maker<Date> maker = IntervalValuesMaker.startFrom(start, -1000);
assertThat(maker.value().getTime(), Matchers.equalTo(start.getTime()));
assertThat(maker.value().getTime(), Matchers.equalTo(start.getTime() - 1000));
assertThat(maker.value().getTime(), Matchers.equalTo(start.getTime() - 2000));
}
public void canGetIntervalString() {
Maker<String> maker = IntervalValuesMaker.startFrom("hello ", 1000);
assertThat(maker.value(), Matchers.equalTo("hello 1000"));
assertThat(maker.value(), Matchers.equalTo("hello 2000"));
assertThat(maker.value(), Matchers.equalTo("hello 3000"));
}
}
</pre>
@param start
starting value
@param difference
interval difference
@param <T>
value type
@return a Maker will make interval values infinitely | [
"Example",
":",
"<pre",
">",
"{",
"@code"
] | train | https://github.com/huangp/entityunit/blob/1a09b530149d707dbff7ff46f5428d9db709a4b4/src/main/java/com/github/huangp/entityunit/maker/IntervalValuesMaker.java#L62-L76 |
mnlipp/jgrapes | org.jgrapes.io/src/org/jgrapes/io/PurgeTerminator.java | PurgeTerminator.onPurge | @Handler
public void onPurge(Purge event, IOSubchannel channel) {
// Needn't close this more than once
event.stop();
channel.respond(new Close());
} | java | @Handler
public void onPurge(Purge event, IOSubchannel channel) {
// Needn't close this more than once
event.stop();
channel.respond(new Close());
} | [
"@",
"Handler",
"public",
"void",
"onPurge",
"(",
"Purge",
"event",
",",
"IOSubchannel",
"channel",
")",
"{",
"// Needn't close this more than once",
"event",
".",
"stop",
"(",
")",
";",
"channel",
".",
"respond",
"(",
"new",
"Close",
"(",
")",
")",
";",
"... | Handles a {@link Purge} event by sending a {@link Close} event.
@param event the event
@param channel the channel | [
"Handles",
"a",
"{",
"@link",
"Purge",
"}",
"event",
"by",
"sending",
"a",
"{",
"@link",
"Close",
"}",
"event",
"."
] | train | https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.io/src/org/jgrapes/io/PurgeTerminator.java#L46-L51 |
Alluxio/alluxio | shell/src/main/java/alluxio/cli/LogLevel.java | LogLevel.logLevel | public static void logLevel(String[] args, AlluxioConfiguration alluxioConf)
throws ParseException, IOException {
CommandLineParser parser = new DefaultParser();
CommandLine cmd = parser.parse(OPTIONS, args, true /* stopAtNonOption */);
List<TargetInfo> targets = parseOptTarget(cmd, alluxioConf);
String logName = parseOptLogName(cmd);
String level = parseOptLevel(cmd);
for (TargetInfo targetInfo : targets) {
setLogLevel(targetInfo, logName, level);
}
} | java | public static void logLevel(String[] args, AlluxioConfiguration alluxioConf)
throws ParseException, IOException {
CommandLineParser parser = new DefaultParser();
CommandLine cmd = parser.parse(OPTIONS, args, true /* stopAtNonOption */);
List<TargetInfo> targets = parseOptTarget(cmd, alluxioConf);
String logName = parseOptLogName(cmd);
String level = parseOptLevel(cmd);
for (TargetInfo targetInfo : targets) {
setLogLevel(targetInfo, logName, level);
}
} | [
"public",
"static",
"void",
"logLevel",
"(",
"String",
"[",
"]",
"args",
",",
"AlluxioConfiguration",
"alluxioConf",
")",
"throws",
"ParseException",
",",
"IOException",
"{",
"CommandLineParser",
"parser",
"=",
"new",
"DefaultParser",
"(",
")",
";",
"CommandLine",... | Implements log level setting and getting.
@param args list of arguments contains target, logName and level
@param alluxioConf Alluxio configuration
@exception ParseException if there is an error in parsing | [
"Implements",
"log",
"level",
"setting",
"and",
"getting",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/shell/src/main/java/alluxio/cli/LogLevel.java#L106-L118 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/CollectionExtensions.java | CollectionExtensions.addAll | @Inline(value="$3.$4addAll($1, $2)", imported=Iterables.class)
public static <T> boolean addAll(Collection<T> collection, Iterable<? extends T> elements) {
return Iterables.addAll(collection, elements);
} | java | @Inline(value="$3.$4addAll($1, $2)", imported=Iterables.class)
public static <T> boolean addAll(Collection<T> collection, Iterable<? extends T> elements) {
return Iterables.addAll(collection, elements);
} | [
"@",
"Inline",
"(",
"value",
"=",
"\"$3.$4addAll($1, $2)\"",
",",
"imported",
"=",
"Iterables",
".",
"class",
")",
"public",
"static",
"<",
"T",
">",
"boolean",
"addAll",
"(",
"Collection",
"<",
"T",
">",
"collection",
",",
"Iterable",
"<",
"?",
"extends",... | Adds all of the specified elements to the specified collection.
@param collection
the collection into which the {@code elements} are to be inserted. May not be <code>null</code>.
@param elements
the elements to insert into the {@code collection}. May not be <code>null</code> but may contain
<code>null</code> entries if the {@code collection} allows that.
@return <code>true</code> if the collection changed as a result of the call | [
"Adds",
"all",
"of",
"the",
"specified",
"elements",
"to",
"the",
"specified",
"collection",
"."
] | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/CollectionExtensions.java#L268-L271 |
jayantk/jklol | src/com/jayantkrish/jklol/tensor/SparseTensor.java | SparseTensor.fromUnorderedKeyValuesNoCopy | public static SparseTensor fromUnorderedKeyValuesNoCopy(int[] dimensionNumbers,
int[] dimensionSizes, long[] keyNums, double[] values) {
ArrayUtils.sortKeyValuePairs(keyNums, values, 0, keyNums.length);
return new SparseTensor(dimensionNumbers, dimensionSizes, keyNums, values);
} | java | public static SparseTensor fromUnorderedKeyValuesNoCopy(int[] dimensionNumbers,
int[] dimensionSizes, long[] keyNums, double[] values) {
ArrayUtils.sortKeyValuePairs(keyNums, values, 0, keyNums.length);
return new SparseTensor(dimensionNumbers, dimensionSizes, keyNums, values);
} | [
"public",
"static",
"SparseTensor",
"fromUnorderedKeyValuesNoCopy",
"(",
"int",
"[",
"]",
"dimensionNumbers",
",",
"int",
"[",
"]",
"dimensionSizes",
",",
"long",
"[",
"]",
"keyNums",
",",
"double",
"[",
"]",
"values",
")",
"{",
"ArrayUtils",
".",
"sortKeyValu... | Same as {@link #fromUnorderedKeyValues}, except that neither
input array is copied. These arrays must not be modified by the
caller after invoking this method.
@param dimensionNumbers
@param dimensionSizes
@param keyNums
@param values | [
"Same",
"as",
"{",
"@link",
"#fromUnorderedKeyValues",
"}",
"except",
"that",
"neither",
"input",
"array",
"is",
"copied",
".",
"These",
"arrays",
"must",
"not",
"be",
"modified",
"by",
"the",
"caller",
"after",
"invoking",
"this",
"method",
"."
] | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/tensor/SparseTensor.java#L1286-L1290 |
protostuff/protostuff | protostuff-json/src/main/java/io/protostuff/JsonIOUtil.java | JsonIOUtil.newJsonGenerator | public static UTF8JsonGenerator newJsonGenerator(OutputStream out, byte[] buf)
{
return newJsonGenerator(out, buf, 0, false, new IOContext(
DEFAULT_JSON_FACTORY._getBufferRecycler(), out, false));
} | java | public static UTF8JsonGenerator newJsonGenerator(OutputStream out, byte[] buf)
{
return newJsonGenerator(out, buf, 0, false, new IOContext(
DEFAULT_JSON_FACTORY._getBufferRecycler(), out, false));
} | [
"public",
"static",
"UTF8JsonGenerator",
"newJsonGenerator",
"(",
"OutputStream",
"out",
",",
"byte",
"[",
"]",
"buf",
")",
"{",
"return",
"newJsonGenerator",
"(",
"out",
",",
"buf",
",",
"0",
",",
"false",
",",
"new",
"IOContext",
"(",
"DEFAULT_JSON_FACTORY",... | Creates a {@link UTF8JsonGenerator} for the outputstream with the supplied buf {@code outBuffer} to use. | [
"Creates",
"a",
"{"
] | train | https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-json/src/main/java/io/protostuff/JsonIOUtil.java#L210-L214 |
apruve/apruve-java | src/main/java/com/apruve/models/Payment.java | Payment.getAll | public static ApruveResponse<List<Payment>> getAll(String paymentRequestId) {
return ApruveClient.getInstance().index(
getPaymentsPath(paymentRequestId),
new GenericType<List<Payment>>() {
});
} | java | public static ApruveResponse<List<Payment>> getAll(String paymentRequestId) {
return ApruveClient.getInstance().index(
getPaymentsPath(paymentRequestId),
new GenericType<List<Payment>>() {
});
} | [
"public",
"static",
"ApruveResponse",
"<",
"List",
"<",
"Payment",
">",
">",
"getAll",
"(",
"String",
"paymentRequestId",
")",
"{",
"return",
"ApruveClient",
".",
"getInstance",
"(",
")",
".",
"index",
"(",
"getPaymentsPath",
"(",
"paymentRequestId",
")",
",",... | Fetches all Payments belonging to the PaymentRequest with the specified
ID.
@see <a
href="https://www.apruve.com/doc/developers/rest-api/">https://www.apruve.com/doc/developers/rest-api/</a>
@param paymentRequestId
The ID of the PaymentRequest that owns the Payment
@return List of Payments, or null if the PaymentRequest is not found | [
"Fetches",
"all",
"Payments",
"belonging",
"to",
"the",
"PaymentRequest",
"with",
"the",
"specified",
"ID",
"."
] | train | https://github.com/apruve/apruve-java/blob/b188d6b17f777823c2e46427847318849978685e/src/main/java/com/apruve/models/Payment.java#L117-L122 |
aNNiMON/Lightweight-Stream-API | stream/src/main/java/com/annimon/stream/DoubleStream.java | DoubleStream.findLast | @NotNull
public OptionalDouble findLast() {
return reduce(new DoubleBinaryOperator() {
@Override
public double applyAsDouble(double left, double right) {
return right;
}
});
} | java | @NotNull
public OptionalDouble findLast() {
return reduce(new DoubleBinaryOperator() {
@Override
public double applyAsDouble(double left, double right) {
return right;
}
});
} | [
"@",
"NotNull",
"public",
"OptionalDouble",
"findLast",
"(",
")",
"{",
"return",
"reduce",
"(",
"new",
"DoubleBinaryOperator",
"(",
")",
"{",
"@",
"Override",
"public",
"double",
"applyAsDouble",
"(",
"double",
"left",
",",
"double",
"right",
")",
"{",
"retu... | Returns the last element wrapped by {@code OptionalDouble} class.
If stream is empty, returns {@code OptionalDouble.empty()}.
<p>This is a short-circuiting terminal operation.
@return an {@code OptionalDouble} with the last element
or {@code OptionalDouble.empty()} if the stream is empty
@since 1.1.8 | [
"Returns",
"the",
"last",
"element",
"wrapped",
"by",
"{",
"@code",
"OptionalDouble",
"}",
"class",
".",
"If",
"stream",
"is",
"empty",
"returns",
"{",
"@code",
"OptionalDouble",
".",
"empty",
"()",
"}",
"."
] | train | https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/DoubleStream.java#L1148-L1156 |
opentracing-contrib/java-kafka-client | opentracing-kafka-client/src/main/java/io/opentracing/contrib/kafka/TracingKafkaUtils.java | TracingKafkaUtils.injectSecond | static void injectSecond(SpanContext spanContext, Headers headers,
Tracer tracer) {
tracer.inject(spanContext, Format.Builtin.TEXT_MAP,
new HeadersMapInjectAdapter(headers, true));
} | java | static void injectSecond(SpanContext spanContext, Headers headers,
Tracer tracer) {
tracer.inject(spanContext, Format.Builtin.TEXT_MAP,
new HeadersMapInjectAdapter(headers, true));
} | [
"static",
"void",
"injectSecond",
"(",
"SpanContext",
"spanContext",
",",
"Headers",
"headers",
",",
"Tracer",
"tracer",
")",
"{",
"tracer",
".",
"inject",
"(",
"spanContext",
",",
"Format",
".",
"Builtin",
".",
"TEXT_MAP",
",",
"new",
"HeadersMapInjectAdapter",... | Inject second Span Context to record headers
@param spanContext Span Context
@param headers record headers | [
"Inject",
"second",
"Span",
"Context",
"to",
"record",
"headers"
] | train | https://github.com/opentracing-contrib/java-kafka-client/blob/e3aeec8d68d3a2dead89b9dbdfea3791817e1a26/opentracing-kafka-client/src/main/java/io/opentracing/contrib/kafka/TracingKafkaUtils.java#L75-L79 |
pedrovgs/Renderers | renderers/src/main/java/com/pedrogomez/renderers/RVRendererAdapter.java | RVRendererAdapter.onBindViewHolder | @Override public void onBindViewHolder(RendererViewHolder viewHolder, int position) {
T content = getItem(position);
Renderer<T> renderer = viewHolder.getRenderer();
if (renderer == null) {
throw new NullRendererBuiltException("RendererBuilder have to return a not null renderer");
}
renderer.setContent(content);
updateRendererExtraValues(content, renderer, position);
renderer.render();
} | java | @Override public void onBindViewHolder(RendererViewHolder viewHolder, int position) {
T content = getItem(position);
Renderer<T> renderer = viewHolder.getRenderer();
if (renderer == null) {
throw new NullRendererBuiltException("RendererBuilder have to return a not null renderer");
}
renderer.setContent(content);
updateRendererExtraValues(content, renderer, position);
renderer.render();
} | [
"@",
"Override",
"public",
"void",
"onBindViewHolder",
"(",
"RendererViewHolder",
"viewHolder",
",",
"int",
"position",
")",
"{",
"T",
"content",
"=",
"getItem",
"(",
"position",
")",
";",
"Renderer",
"<",
"T",
">",
"renderer",
"=",
"viewHolder",
".",
"getRe... | Given a RendererViewHolder passed as argument and a position renders the view using the
Renderer previously stored into the RendererViewHolder.
@param viewHolder with a Renderer class inside.
@param position to render. | [
"Given",
"a",
"RendererViewHolder",
"passed",
"as",
"argument",
"and",
"a",
"position",
"renders",
"the",
"view",
"using",
"the",
"Renderer",
"previously",
"stored",
"into",
"the",
"RendererViewHolder",
"."
] | train | https://github.com/pedrovgs/Renderers/blob/7477fb6e3984468b32b59c8520b66afb765081ea/renderers/src/main/java/com/pedrogomez/renderers/RVRendererAdapter.java#L113-L122 |
JodaOrg/joda-time | src/main/java/org/joda/time/field/BaseDateTimeField.java | BaseDateTimeField.getAsText | public String getAsText(ReadablePartial partial, int fieldValue, Locale locale) {
return getAsText(fieldValue, locale);
} | java | public String getAsText(ReadablePartial partial, int fieldValue, Locale locale) {
return getAsText(fieldValue, locale);
} | [
"public",
"String",
"getAsText",
"(",
"ReadablePartial",
"partial",
",",
"int",
"fieldValue",
",",
"Locale",
"locale",
")",
"{",
"return",
"getAsText",
"(",
"fieldValue",
",",
"locale",
")",
";",
"}"
] | Get the human-readable, text value of this field from a partial instant.
If the specified locale is null, the default locale is used.
<p>
The default implementation returns getAsText(fieldValue, locale).
@param partial the partial instant to query
@param fieldValue the field value of this field, provided for performance
@param locale the locale to use for selecting a text symbol, null for default
@return the text value of the field | [
"Get",
"the",
"human",
"-",
"readable",
"text",
"value",
"of",
"this",
"field",
"from",
"a",
"partial",
"instant",
".",
"If",
"the",
"specified",
"locale",
"is",
"null",
"the",
"default",
"locale",
"is",
"used",
".",
"<p",
">",
"The",
"default",
"impleme... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/field/BaseDateTimeField.java#L120-L122 |
eyp/serfj | src/main/java/net/sf/serfj/ResponseHelper.java | ResponseHelper.setFile | public void setFile(File file, String attachmentFilename, String contentType) {
this.file = file;
this.attachmentFilename = attachmentFilename;
this.contentType = contentType;
} | java | public void setFile(File file, String attachmentFilename, String contentType) {
this.file = file;
this.attachmentFilename = attachmentFilename;
this.contentType = contentType;
} | [
"public",
"void",
"setFile",
"(",
"File",
"file",
",",
"String",
"attachmentFilename",
",",
"String",
"contentType",
")",
"{",
"this",
".",
"file",
"=",
"file",
";",
"this",
".",
"attachmentFilename",
"=",
"attachmentFilename",
";",
"this",
".",
"contentType",... | Sets the file to send to the client. If a file is set then the framework will try to read it
and write it into the response using a FileSerializer.
@param file The file.
@param attachmentFilename Name for the file that will be sent.
@param contentType Content type for the response header. | [
"Sets",
"the",
"file",
"to",
"send",
"to",
"the",
"client",
".",
"If",
"a",
"file",
"is",
"set",
"then",
"the",
"framework",
"will",
"try",
"to",
"read",
"it",
"and",
"write",
"it",
"into",
"the",
"response",
"using",
"a",
"FileSerializer",
"."
] | train | https://github.com/eyp/serfj/blob/e617592af6f24e59ea58443f2785c44aa2312189/src/main/java/net/sf/serfj/ResponseHelper.java#L214-L218 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SubWriterHolderWriter.java | SubWriterHolderWriter.addSummaryLinkComment | public void addSummaryLinkComment(AbstractMemberWriter mw, Element member, Content contentTree) {
List<? extends DocTree> tags = utils.getFirstSentenceTrees(member);
addSummaryLinkComment(mw, member, tags, contentTree);
} | java | public void addSummaryLinkComment(AbstractMemberWriter mw, Element member, Content contentTree) {
List<? extends DocTree> tags = utils.getFirstSentenceTrees(member);
addSummaryLinkComment(mw, member, tags, contentTree);
} | [
"public",
"void",
"addSummaryLinkComment",
"(",
"AbstractMemberWriter",
"mw",
",",
"Element",
"member",
",",
"Content",
"contentTree",
")",
"{",
"List",
"<",
"?",
"extends",
"DocTree",
">",
"tags",
"=",
"utils",
".",
"getFirstSentenceTrees",
"(",
"member",
")",
... | Add the summary link for the member.
@param mw the writer for the member being documented
@param member the member to be documented
@param contentTree the content tree to which the link will be added | [
"Add",
"the",
"summary",
"link",
"for",
"the",
"member",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SubWriterHolderWriter.java#L228-L231 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.