repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jwtsso_fat/fat/src/com/ibm/ws/security/jwtsso/fat/utils/CommonExpectations.java | CommonExpectations.jwtCookieExists | public static Expectations jwtCookieExists(String testAction, WebClient webClient, String jwtCookieName) {
Expectations expectations = new Expectations();
expectations.addExpectation(new CookieExpectation(testAction, webClient, jwtCookieName, JwtFatConstants.JWT_REGEX, JwtFatConstants.NOT_SECURE, JwtFatConstants.HTTPONLY));
return expectations;
} | java | public static Expectations jwtCookieExists(String testAction, WebClient webClient, String jwtCookieName) {
Expectations expectations = new Expectations();
expectations.addExpectation(new CookieExpectation(testAction, webClient, jwtCookieName, JwtFatConstants.JWT_REGEX, JwtFatConstants.NOT_SECURE, JwtFatConstants.HTTPONLY));
return expectations;
} | [
"public",
"static",
"Expectations",
"jwtCookieExists",
"(",
"String",
"testAction",
",",
"WebClient",
"webClient",
",",
"String",
"jwtCookieName",
")",
"{",
"Expectations",
"expectations",
"=",
"new",
"Expectations",
"(",
")",
";",
"expectations",
".",
"addExpectati... | Sets expectations that will check:
<ol>
<li>The provided WebClient contains a cookie with the default JWT SSO cookie name, its value is a JWT, is NOT marked secure, and is marked HttpOnly
</ol> | [
"Sets",
"expectations",
"that",
"will",
"check",
":",
"<ol",
">",
"<li",
">",
"The",
"provided",
"WebClient",
"contains",
"a",
"cookie",
"with",
"the",
"default",
"JWT",
"SSO",
"cookie",
"name",
"its",
"value",
"is",
"a",
"JWT",
"is",
"NOT",
"marked",
"s... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwtsso_fat/fat/src/com/ibm/ws/security/jwtsso/fat/utils/CommonExpectations.java#L70-L74 |
uaihebert/uaiMockServer | src/main/java/com/uaihebert/uaimockserver/validator/body/XmlUnitWrapper.java | XmlUnitWrapper.isSimilar | public static boolean isSimilar(final String expected, final String actual) {
final Diff diff = createDiffResult(expected, actual, true);
return diff.similar();
} | java | public static boolean isSimilar(final String expected, final String actual) {
final Diff diff = createDiffResult(expected, actual, true);
return diff.similar();
} | [
"public",
"static",
"boolean",
"isSimilar",
"(",
"final",
"String",
"expected",
",",
"final",
"String",
"actual",
")",
"{",
"final",
"Diff",
"diff",
"=",
"createDiffResult",
"(",
"expected",
",",
"actual",
",",
"true",
")",
";",
"return",
"diff",
".",
"sim... | This method will compare both XMLs and WILL NOT validate its attribute order.
@param expected what are we expecting
@param actual what we receive
@return if they have same value | [
"This",
"method",
"will",
"compare",
"both",
"XMLs",
"and",
"WILL",
"NOT",
"validate",
"its",
"attribute",
"order",
"."
] | train | https://github.com/uaihebert/uaiMockServer/blob/8b0090d4018c2f430cfbbb3ae249347652802f2b/src/main/java/com/uaihebert/uaimockserver/validator/body/XmlUnitWrapper.java#L46-L50 |
b3dgs/lionengine | lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/LevelRipConverter.java | LevelRipConverter.checkPixel | private static boolean checkPixel(MapTile map, ImageBuffer tileRef, int progressTileX, int progressTileY)
{
final int x = progressTileX * map.getTileWidth();
final int y = progressTileY * map.getTileHeight();
final int pixel = tileRef.getRgb(x, y);
// Skip blank tile of image map
if (TilesExtractor.IGNORED_COLOR_VALUE != pixel)
{
// Search if tile is on sheet and get it
final Tile tile = searchForTile(map, tileRef, progressTileX, progressTileY);
if (tile == null)
{
return false;
}
map.setTile(tile);
}
return true;
} | java | private static boolean checkPixel(MapTile map, ImageBuffer tileRef, int progressTileX, int progressTileY)
{
final int x = progressTileX * map.getTileWidth();
final int y = progressTileY * map.getTileHeight();
final int pixel = tileRef.getRgb(x, y);
// Skip blank tile of image map
if (TilesExtractor.IGNORED_COLOR_VALUE != pixel)
{
// Search if tile is on sheet and get it
final Tile tile = searchForTile(map, tileRef, progressTileX, progressTileY);
if (tile == null)
{
return false;
}
map.setTile(tile);
}
return true;
} | [
"private",
"static",
"boolean",
"checkPixel",
"(",
"MapTile",
"map",
",",
"ImageBuffer",
"tileRef",
",",
"int",
"progressTileX",
",",
"int",
"progressTileY",
")",
"{",
"final",
"int",
"x",
"=",
"progressTileX",
"*",
"map",
".",
"getTileWidth",
"(",
")",
";",... | Check the pixel by searching tile on sheet.
@param map The destination map reference.
@param tileRef The tile sheet.
@param progressTileX The progress on horizontal tiles.
@param progressTileY The progress on vertical tiles.
@return <code>true</code> if tile found, <code>false</code> else. | [
"Check",
"the",
"pixel",
"by",
"searching",
"tile",
"on",
"sheet",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/LevelRipConverter.java#L127-L145 |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/dml/dialect/SqlBuilder.java | SqlBuilder.caseWhen | public static Case caseWhen(final Expression condition, final Expression trueAction) {
return Case.caseWhen(condition, trueAction);
} | java | public static Case caseWhen(final Expression condition, final Expression trueAction) {
return Case.caseWhen(condition, trueAction);
} | [
"public",
"static",
"Case",
"caseWhen",
"(",
"final",
"Expression",
"condition",
",",
"final",
"Expression",
"trueAction",
")",
"{",
"return",
"Case",
".",
"caseWhen",
"(",
"condition",
",",
"trueAction",
")",
";",
"}"
] | Creates a case expression.
@param condition The name of the view.
@param trueAction The name of the view.
@return The case when representation. | [
"Creates",
"a",
"case",
"expression",
"."
] | train | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/dml/dialect/SqlBuilder.java#L592-L594 |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/dfx/Segment3dfx.java | Segment3dfx.z1Property | @Pure
public DoubleProperty z1Property() {
if (this.p1.z == null) {
this.p1.z = new SimpleDoubleProperty(this, MathFXAttributeNames.Z1);
}
return this.p1.z;
} | java | @Pure
public DoubleProperty z1Property() {
if (this.p1.z == null) {
this.p1.z = new SimpleDoubleProperty(this, MathFXAttributeNames.Z1);
}
return this.p1.z;
} | [
"@",
"Pure",
"public",
"DoubleProperty",
"z1Property",
"(",
")",
"{",
"if",
"(",
"this",
".",
"p1",
".",
"z",
"==",
"null",
")",
"{",
"this",
".",
"p1",
".",
"z",
"=",
"new",
"SimpleDoubleProperty",
"(",
"this",
",",
"MathFXAttributeNames",
".",
"Z1",
... | Replies the property that is the z coordinate of the first segment point.
@return the z1 property. | [
"Replies",
"the",
"property",
"that",
"is",
"the",
"z",
"coordinate",
"of",
"the",
"first",
"segment",
"point",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/dfx/Segment3dfx.java#L241-L247 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCResultSet.java | JDBCResultSet.updateByte | public void updateByte(int columnIndex, byte x) throws SQLException {
startUpdate(columnIndex);
preparedStatement.setIntParameter(columnIndex, x);
} | java | public void updateByte(int columnIndex, byte x) throws SQLException {
startUpdate(columnIndex);
preparedStatement.setIntParameter(columnIndex, x);
} | [
"public",
"void",
"updateByte",
"(",
"int",
"columnIndex",
",",
"byte",
"x",
")",
"throws",
"SQLException",
"{",
"startUpdate",
"(",
"columnIndex",
")",
";",
"preparedStatement",
".",
"setIntParameter",
"(",
"columnIndex",
",",
"x",
")",
";",
"}"
] | <!-- start generic documentation -->
Updates the designated column with a <code>byte</code> value.
The updater methods are used to update column values in the
current row or the insert row. The updater methods do not
update the underlying database; instead the <code>updateRow</code> or
<code>insertRow</code> methods are called to update the database.
<!-- end generic documentation -->
<!-- start release-specific documentation -->
<div class="ReleaseSpecificDocumentation">
<h3>HSQLDB-Specific Information:</h3> <p>
HSQLDB supports this feature. <p>
</div>
<!-- end release-specific documentation -->
@param columnIndex the first column is 1, the second is 2, ...
@param x the new column value
@exception SQLException if a database access error occurs,
the result set concurrency is <code>CONCUR_READ_ONLY</code>
or this method is called on a closed result set
@exception SQLFeatureNotSupportedException if the JDBC driver does not support
this method
@since JDK 1.2 (JDK 1.1.x developers: read the overview for
JDBCResultSet) | [
"<!",
"--",
"start",
"generic",
"documentation",
"--",
">",
"Updates",
"the",
"designated",
"column",
"with",
"a",
"<code",
">",
"byte<",
"/",
"code",
">",
"value",
".",
"The",
"updater",
"methods",
"are",
"used",
"to",
"update",
"column",
"values",
"in",
... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCResultSet.java#L2685-L2688 |
sriharshachilakapati/WebGL4J | webgl4j/src/main/java/com/shc/webgl4j/client/WebGL10.java | WebGL10.glClearColor | public static void glClearColor(float r, float g, float b, float a)
{
checkContextCompatibility();
nglClearColor(r, g, b, a);
} | java | public static void glClearColor(float r, float g, float b, float a)
{
checkContextCompatibility();
nglClearColor(r, g, b, a);
} | [
"public",
"static",
"void",
"glClearColor",
"(",
"float",
"r",
",",
"float",
"g",
",",
"float",
"b",
",",
"float",
"a",
")",
"{",
"checkContextCompatibility",
"(",
")",
";",
"nglClearColor",
"(",
"r",
",",
"g",
",",
"b",
",",
"a",
")",
";",
"}"
] | {@code glClearColor} specifies the red, green, blue, and alpha values used by {@link #glClear(int)} to clear the
color buffers. Values specified by {@code glClearColor} are clamped to the range [0,1].
@param r Specifies the red value used when the color buffers are cleared.
@param g Specifies the green value used when the color buffers are cleared.
@param b Specifies the blue value used when the color buffers are cleared.
@param a Specifies the alpha value used when the color buffers are cleared. | [
"{",
"@code",
"glClearColor",
"}",
"specifies",
"the",
"red",
"green",
"blue",
"and",
"alpha",
"values",
"used",
"by",
"{",
"@link",
"#glClear",
"(",
"int",
")",
"}",
"to",
"clear",
"the",
"color",
"buffers",
".",
"Values",
"specified",
"by",
"{",
"@code... | train | https://github.com/sriharshachilakapati/WebGL4J/blob/7daa425300b08b338b50cef2935289849c92d415/webgl4j/src/main/java/com/shc/webgl4j/client/WebGL10.java#L1209-L1213 |
E7du/jfinal-ext3 | src/main/java/com/jfinal/ext/kit/SqlpKit.java | SqlpKit.select | public static SqlPara select(ModelExt<?> model, String... columns) {
return SqlpKit.select(model, FLAG.ALL, columns);
} | java | public static SqlPara select(ModelExt<?> model, String... columns) {
return SqlpKit.select(model, FLAG.ALL, columns);
} | [
"public",
"static",
"SqlPara",
"select",
"(",
"ModelExt",
"<",
"?",
">",
"model",
",",
"String",
"...",
"columns",
")",
"{",
"return",
"SqlpKit",
".",
"select",
"(",
"model",
",",
"FLAG",
".",
"ALL",
",",
"columns",
")",
";",
"}"
] | make SqlPara use the model with attr datas.
@param model
@columns fetch columns | [
"make",
"SqlPara",
"use",
"the",
"model",
"with",
"attr",
"datas",
"."
] | train | https://github.com/E7du/jfinal-ext3/blob/8ffcbd150fd50c72852bb778bd427b5eb19254dc/src/main/java/com/jfinal/ext/kit/SqlpKit.java#L107-L109 |
zaproxy/zaproxy | src/org/zaproxy/zap/extension/httpsessions/HttpSessionsSite.java | HttpSessionsSite.createEmptySessionAndSetAsActive | private void createEmptySessionAndSetAsActive(final String name) {
validateSessionName(name);
final HttpSession session = new HttpSession(name, extension.getHttpSessionTokensSet(getSite()));
addHttpSession(session);
setActiveSession(session);
} | java | private void createEmptySessionAndSetAsActive(final String name) {
validateSessionName(name);
final HttpSession session = new HttpSession(name, extension.getHttpSessionTokensSet(getSite()));
addHttpSession(session);
setActiveSession(session);
} | [
"private",
"void",
"createEmptySessionAndSetAsActive",
"(",
"final",
"String",
"name",
")",
"{",
"validateSessionName",
"(",
"name",
")",
";",
"final",
"HttpSession",
"session",
"=",
"new",
"HttpSession",
"(",
"name",
",",
"extension",
".",
"getHttpSessionTokensSet"... | Creates an empty session with the given {@code name} and sets it as the active session.
<p>
<strong>Note:</strong> It's responsibility of the caller to ensure that no session with the
given {@code name} already exists.
@param name the name of the session that will be created and set as the active session
@throws IllegalArgumentException if the {@code name} is {@code null} or an empty string
@see #addHttpSession(HttpSession)
@see #setActiveSession(HttpSession)
@see #isSessionNameUnique(String) | [
"Creates",
"an",
"empty",
"session",
"with",
"the",
"given",
"{",
"@code",
"name",
"}",
"and",
"sets",
"it",
"as",
"the",
"active",
"session",
".",
"<p",
">",
"<strong",
">",
"Note",
":",
"<",
"/",
"strong",
">",
"It",
"s",
"responsibility",
"of",
"t... | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/httpsessions/HttpSessionsSite.java#L278-L284 |
jparsec/jparsec | jparsec/src/main/java/org/jparsec/SourceLocator.java | SourceLocator.lookup | @Private Location lookup(int index) {
int size = lineBreakIndices.size();
if (size == 0) return location(0, index);
int lineNumber = binarySearch(lineBreakIndices, index);
if (lineNumber == 0) return location(0, index);
int previousBreak = lineBreakIndices.get(lineNumber - 1);
return location(lineNumber, index - previousBreak - 1);
} | java | @Private Location lookup(int index) {
int size = lineBreakIndices.size();
if (size == 0) return location(0, index);
int lineNumber = binarySearch(lineBreakIndices, index);
if (lineNumber == 0) return location(0, index);
int previousBreak = lineBreakIndices.get(lineNumber - 1);
return location(lineNumber, index - previousBreak - 1);
} | [
"@",
"Private",
"Location",
"lookup",
"(",
"int",
"index",
")",
"{",
"int",
"size",
"=",
"lineBreakIndices",
".",
"size",
"(",
")",
";",
"if",
"(",
"size",
"==",
"0",
")",
"return",
"location",
"(",
"0",
",",
"index",
")",
";",
"int",
"lineNumber",
... | Looks up the location identified by {@code ind} using the cached indices of line break
characters. This assumes that all line-break characters before {@code ind} are already scanned. | [
"Looks",
"up",
"the",
"location",
"identified",
"by",
"{"
] | train | https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/SourceLocator.java#L85-L92 |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectProperties.java | ProjectProperties.setBaselineDate | public void setBaselineDate(int baselineNumber, Date value)
{
set(selectField(ProjectFieldLists.BASELINE_DATES, baselineNumber), value);
} | java | public void setBaselineDate(int baselineNumber, Date value)
{
set(selectField(ProjectFieldLists.BASELINE_DATES, baselineNumber), value);
} | [
"public",
"void",
"setBaselineDate",
"(",
"int",
"baselineNumber",
",",
"Date",
"value",
")",
"{",
"set",
"(",
"selectField",
"(",
"ProjectFieldLists",
".",
"BASELINE_DATES",
",",
"baselineNumber",
")",
",",
"value",
")",
";",
"}"
] | Set a baseline value.
@param baselineNumber baseline index (1-10)
@param value baseline value | [
"Set",
"a",
"baseline",
"value",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectProperties.java#L2193-L2196 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/chess/ChessboardCornerClusterToGrid.java | ChessboardCornerClusterToGrid.convert | public boolean convert( ChessboardCornerGraph cluster , GridInfo info ) {
// default to an invalid value to ensure a failure doesn't go unnoticed.
info.reset();
// Get the edges in a consistent order
if( !orderEdges(cluster) )
return false;
// Now we need to order the nodes into a proper grid which follows right hand rule
if( !orderNodes(cluster.corners,info) )
return false;
// select a valid corner to be (0,0). If there are multiple options select the one which is
int corner = selectCorner(info);
if( corner == -1 ) {
if( verbose != null) verbose.println("Failed to find valid corner.");
return false;
}
// rotate the grid until the select corner is at (0,0)
for (int i = 0; i < corner; i++) {
rotateCCW(info);
}
return true;
} | java | public boolean convert( ChessboardCornerGraph cluster , GridInfo info ) {
// default to an invalid value to ensure a failure doesn't go unnoticed.
info.reset();
// Get the edges in a consistent order
if( !orderEdges(cluster) )
return false;
// Now we need to order the nodes into a proper grid which follows right hand rule
if( !orderNodes(cluster.corners,info) )
return false;
// select a valid corner to be (0,0). If there are multiple options select the one which is
int corner = selectCorner(info);
if( corner == -1 ) {
if( verbose != null) verbose.println("Failed to find valid corner.");
return false;
}
// rotate the grid until the select corner is at (0,0)
for (int i = 0; i < corner; i++) {
rotateCCW(info);
}
return true;
} | [
"public",
"boolean",
"convert",
"(",
"ChessboardCornerGraph",
"cluster",
",",
"GridInfo",
"info",
")",
"{",
"// default to an invalid value to ensure a failure doesn't go unnoticed.",
"info",
".",
"reset",
"(",
")",
";",
"// Get the edges in a consistent order",
"if",
"(",
... | Puts cluster nodes into grid order and computes the number of rows and columns. If the cluster is not
a complete grid this function will fail and return false
@param cluster (Input) cluster. Edge order will be modified.
@param info (Output) Contains ordered nodes and the grid's size.
@return true if successful or false if it failed | [
"Puts",
"cluster",
"nodes",
"into",
"grid",
"order",
"and",
"computes",
"the",
"number",
"of",
"rows",
"and",
"columns",
".",
"If",
"the",
"cluster",
"is",
"not",
"a",
"complete",
"grid",
"this",
"function",
"will",
"fail",
"and",
"return",
"false"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/chess/ChessboardCornerClusterToGrid.java#L79-L103 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCResultSet.java | JDBCResultSet.updateObject | public void updateObject(int columnIndex, Object x) throws SQLException {
startUpdate(columnIndex);
preparedStatement.setParameter(columnIndex, x);
} | java | public void updateObject(int columnIndex, Object x) throws SQLException {
startUpdate(columnIndex);
preparedStatement.setParameter(columnIndex, x);
} | [
"public",
"void",
"updateObject",
"(",
"int",
"columnIndex",
",",
"Object",
"x",
")",
"throws",
"SQLException",
"{",
"startUpdate",
"(",
"columnIndex",
")",
";",
"preparedStatement",
".",
"setParameter",
"(",
"columnIndex",
",",
"x",
")",
";",
"}"
] | <!-- start generic documentation -->
Updates the designated column with an <code>Object</code> value.
The updater methods are used to update column values in the
current row or the insert row. The updater methods do not
update the underlying database; instead the <code>updateRow</code> or
<code>insertRow</code> methods are called to update the database.
<!-- end generic documentation -->
<!-- start release-specific documentation -->
<div class="ReleaseSpecificDocumentation">
<h3>HSQLDB-Specific Information:</h3> <p>
HSQLDB supports this feature. <p>
</div>
<!-- end release-specific documentation -->
@param columnIndex the first column is 1, the second is 2, ...
@param x the new column value
@exception SQLException if a database access error occurs,
the result set concurrency is <code>CONCUR_READ_ONLY</code>
or this method is called on a closed result set
@exception SQLFeatureNotSupportedException if the JDBC driver does not support
this method
@since JDK 1.2 (JDK 1.1.x developers: read the overview for
JDBCResultSet) | [
"<!",
"--",
"start",
"generic",
"documentation",
"--",
">",
"Updates",
"the",
"designated",
"column",
"with",
"an",
"<code",
">",
"Object<",
"/",
"code",
">",
"value",
".",
"The",
"updater",
"methods",
"are",
"used",
"to",
"update",
"column",
"values",
"in... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCResultSet.java#L3232-L3235 |
monitorjbl/excel-streaming-reader | src/main/java/com/monitorjbl/xlsx/impl/StreamingSheetReader.java | StreamingSheetReader.setFormatString | void setFormatString(StartElement startElement, StreamingCell cell) {
Attribute cellStyle = startElement.getAttributeByName(new QName("s"));
String cellStyleString = (cellStyle != null) ? cellStyle.getValue() : null;
XSSFCellStyle style = null;
if(cellStyleString != null) {
style = stylesTable.getStyleAt(Integer.parseInt(cellStyleString));
} else if(stylesTable.getNumCellStyles() > 0) {
style = stylesTable.getStyleAt(0);
}
if(style != null) {
cell.setNumericFormatIndex(style.getDataFormat());
String formatString = style.getDataFormatString();
if(formatString != null) {
cell.setNumericFormat(formatString);
} else {
cell.setNumericFormat(BuiltinFormats.getBuiltinFormat(cell.getNumericFormatIndex()));
}
} else {
cell.setNumericFormatIndex(null);
cell.setNumericFormat(null);
}
} | java | void setFormatString(StartElement startElement, StreamingCell cell) {
Attribute cellStyle = startElement.getAttributeByName(new QName("s"));
String cellStyleString = (cellStyle != null) ? cellStyle.getValue() : null;
XSSFCellStyle style = null;
if(cellStyleString != null) {
style = stylesTable.getStyleAt(Integer.parseInt(cellStyleString));
} else if(stylesTable.getNumCellStyles() > 0) {
style = stylesTable.getStyleAt(0);
}
if(style != null) {
cell.setNumericFormatIndex(style.getDataFormat());
String formatString = style.getDataFormatString();
if(formatString != null) {
cell.setNumericFormat(formatString);
} else {
cell.setNumericFormat(BuiltinFormats.getBuiltinFormat(cell.getNumericFormatIndex()));
}
} else {
cell.setNumericFormatIndex(null);
cell.setNumericFormat(null);
}
} | [
"void",
"setFormatString",
"(",
"StartElement",
"startElement",
",",
"StreamingCell",
"cell",
")",
"{",
"Attribute",
"cellStyle",
"=",
"startElement",
".",
"getAttributeByName",
"(",
"new",
"QName",
"(",
"\"s\"",
")",
")",
";",
"String",
"cellStyleString",
"=",
... | Read the numeric format string out of the styles table for this cell. Stores
the result in the Cell.
@param startElement
@param cell | [
"Read",
"the",
"numeric",
"format",
"string",
"out",
"of",
"the",
"styles",
"table",
"for",
"this",
"cell",
".",
"Stores",
"the",
"result",
"in",
"the",
"Cell",
"."
] | train | https://github.com/monitorjbl/excel-streaming-reader/blob/4e95c9aaaecf33685a09f8c267af3a578ba5e070/src/main/java/com/monitorjbl/xlsx/impl/StreamingSheetReader.java#L265-L289 |
jboss/jboss-jsf-api_spec | src/main/java/javax/faces/component/UIViewRoot.java | UIViewRoot.createUniqueId | public String createUniqueId(FacesContext context, String seed) {
if (seed != null) {
return UIViewRoot.UNIQUE_ID_PREFIX + seed;
} else {
Integer i = (Integer) getStateHelper().get(PropertyKeys.lastId);
int lastId = ((i != null) ? i : 0);
getStateHelper().put(PropertyKeys.lastId, ++lastId);
return UIViewRoot.UNIQUE_ID_PREFIX + lastId;
}
} | java | public String createUniqueId(FacesContext context, String seed) {
if (seed != null) {
return UIViewRoot.UNIQUE_ID_PREFIX + seed;
} else {
Integer i = (Integer) getStateHelper().get(PropertyKeys.lastId);
int lastId = ((i != null) ? i : 0);
getStateHelper().put(PropertyKeys.lastId, ++lastId);
return UIViewRoot.UNIQUE_ID_PREFIX + lastId;
}
} | [
"public",
"String",
"createUniqueId",
"(",
"FacesContext",
"context",
",",
"String",
"seed",
")",
"{",
"if",
"(",
"seed",
"!=",
"null",
")",
"{",
"return",
"UIViewRoot",
".",
"UNIQUE_ID_PREFIX",
"+",
"seed",
";",
"}",
"else",
"{",
"Integer",
"i",
"=",
"(... | <p>Generate an identifier for a component. The identifier
will be prefixed with UNIQUE_ID_PREFIX, and will be unique
within this UIViewRoot. Optionally, a unique seed value can
be supplied by component creators which should be
included in the generated unique id.</p>
@param context FacesContext
@param seed an optional seed value - e.g. based on the position of the component in the VDL-template
@return a unique-id in this component-container | [
"<p",
">",
"Generate",
"an",
"identifier",
"for",
"a",
"component",
".",
"The",
"identifier",
"will",
"be",
"prefixed",
"with",
"UNIQUE_ID_PREFIX",
"and",
"will",
"be",
"unique",
"within",
"this",
"UIViewRoot",
".",
"Optionally",
"a",
"unique",
"seed",
"value"... | train | https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/component/UIViewRoot.java#L1327-L1336 |
mabe02/lanterna | src/main/java/com/googlecode/lanterna/terminal/swing/AWTTerminalFontConfiguration.java | AWTTerminalFontConfiguration.getFontSize | private static int getFontSize() {
if (Toolkit.getDefaultToolkit().getScreenResolution() >= 110) {
// Rely on DPI if it is a high value.
return Toolkit.getDefaultToolkit().getScreenResolution() / 7 + 1;
} else {
// Otherwise try to guess it from the monitor size:
// If the width is wider than Full HD (1080p, or 1920x1080), then assume it's high-DPI.
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
if (ge.getMaximumWindowBounds().getWidth() > 4096) {
return 56;
} else if (ge.getMaximumWindowBounds().getWidth() > 2048) {
return 28;
} else {
return 14;
}
}
} | java | private static int getFontSize() {
if (Toolkit.getDefaultToolkit().getScreenResolution() >= 110) {
// Rely on DPI if it is a high value.
return Toolkit.getDefaultToolkit().getScreenResolution() / 7 + 1;
} else {
// Otherwise try to guess it from the monitor size:
// If the width is wider than Full HD (1080p, or 1920x1080), then assume it's high-DPI.
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
if (ge.getMaximumWindowBounds().getWidth() > 4096) {
return 56;
} else if (ge.getMaximumWindowBounds().getWidth() > 2048) {
return 28;
} else {
return 14;
}
}
} | [
"private",
"static",
"int",
"getFontSize",
"(",
")",
"{",
"if",
"(",
"Toolkit",
".",
"getDefaultToolkit",
"(",
")",
".",
"getScreenResolution",
"(",
")",
">=",
"110",
")",
"{",
"// Rely on DPI if it is a high value.",
"return",
"Toolkit",
".",
"getDefaultToolkit",... | Here we check the screen resolution on the primary monitor and make a guess at if it's high-DPI or not | [
"Here",
"we",
"check",
"the",
"screen",
"resolution",
"on",
"the",
"primary",
"monitor",
"and",
"make",
"a",
"guess",
"at",
"if",
"it",
"s",
"high",
"-",
"DPI",
"or",
"not"
] | train | https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/terminal/swing/AWTTerminalFontConfiguration.java#L111-L127 |
svanoort/rest-compress | rest-compress-lib/src/main/java/com/restcompress/provider/LZFEncodingInterceptor.java | LZFEncodingInterceptor.write | public void write(MessageBodyWriterContext context) throws IOException, WebApplicationException {
Object encoding = context.getHeaders().getFirst(HttpHeaders.CONTENT_ENCODING);
if (encoding != null && encoding.toString().equalsIgnoreCase("lzf")) {
OutputStream old = context.getOutputStream();
// constructor writes to underlying OS causing headers to be written.
CommittedLZFOutputStream lzfOutputStream = new CommittedLZFOutputStream(old, null);
// Any content length set will be obsolete
context.getHeaders().remove("Content-Length");
context.setOutputStream(lzfOutputStream);
try {
context.proceed();
} finally {
if (lzfOutputStream.getLzf() != null) lzfOutputStream.getLzf().flush();
context.setOutputStream(old);
}
return;
} else {
context.proceed();
}
} | java | public void write(MessageBodyWriterContext context) throws IOException, WebApplicationException {
Object encoding = context.getHeaders().getFirst(HttpHeaders.CONTENT_ENCODING);
if (encoding != null && encoding.toString().equalsIgnoreCase("lzf")) {
OutputStream old = context.getOutputStream();
// constructor writes to underlying OS causing headers to be written.
CommittedLZFOutputStream lzfOutputStream = new CommittedLZFOutputStream(old, null);
// Any content length set will be obsolete
context.getHeaders().remove("Content-Length");
context.setOutputStream(lzfOutputStream);
try {
context.proceed();
} finally {
if (lzfOutputStream.getLzf() != null) lzfOutputStream.getLzf().flush();
context.setOutputStream(old);
}
return;
} else {
context.proceed();
}
} | [
"public",
"void",
"write",
"(",
"MessageBodyWriterContext",
"context",
")",
"throws",
"IOException",
",",
"WebApplicationException",
"{",
"Object",
"encoding",
"=",
"context",
".",
"getHeaders",
"(",
")",
".",
"getFirst",
"(",
"HttpHeaders",
".",
"CONTENT_ENCODING",... | Grab the outgoing message, if encoding is set to LZF, then wrap the OutputStream in an LZF OutputStream
before sending it on its merry way, compressing all the time.
Note: strips out the content-length header because the compression changes that unpredictably
@param context
@throws IOException
@throws WebApplicationException | [
"Grab",
"the",
"outgoing",
"message",
"if",
"encoding",
"is",
"set",
"to",
"LZF",
"then",
"wrap",
"the",
"OutputStream",
"in",
"an",
"LZF",
"OutputStream",
"before",
"sending",
"it",
"on",
"its",
"merry",
"way",
"compressing",
"all",
"the",
"time",
"."
] | train | https://github.com/svanoort/rest-compress/blob/4e34fcbe0d1b510962a93509a78b6a8ade234606/rest-compress-lib/src/main/java/com/restcompress/provider/LZFEncodingInterceptor.java#L65-L87 |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java | SARLOperationHelper._hasSideEffects | protected Boolean _hasSideEffects(XVariableDeclaration expression, ISideEffectContext context) {
if (hasSideEffects(expression.getRight(), context)) {
return true;
}
context.declareVariable(expression.getIdentifier(), expression.getRight());
return false;
} | java | protected Boolean _hasSideEffects(XVariableDeclaration expression, ISideEffectContext context) {
if (hasSideEffects(expression.getRight(), context)) {
return true;
}
context.declareVariable(expression.getIdentifier(), expression.getRight());
return false;
} | [
"protected",
"Boolean",
"_hasSideEffects",
"(",
"XVariableDeclaration",
"expression",
",",
"ISideEffectContext",
"context",
")",
"{",
"if",
"(",
"hasSideEffects",
"(",
"expression",
".",
"getRight",
"(",
")",
",",
"context",
")",
")",
"{",
"return",
"true",
";",... | Test if the given expression has side effects.
@param expression the expression.
@param context the list of context expressions.
@return {@code true} if the expression has side effects. | [
"Test",
"if",
"the",
"given",
"expression",
"has",
"side",
"effects",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java#L388-L394 |
fcrepo4/fcrepo4 | fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/utils/ContentDigest.java | ContentDigest.asURI | public static URI asURI(final String algorithm, final String value) {
try {
final String scheme = DIGEST_ALGORITHM.getScheme(algorithm);
return new URI(scheme, value, null);
} catch (final URISyntaxException unlikelyException) {
LOGGER.warn("Exception creating checksum URI: {}",
unlikelyException);
throw new RepositoryRuntimeException(unlikelyException);
}
} | java | public static URI asURI(final String algorithm, final String value) {
try {
final String scheme = DIGEST_ALGORITHM.getScheme(algorithm);
return new URI(scheme, value, null);
} catch (final URISyntaxException unlikelyException) {
LOGGER.warn("Exception creating checksum URI: {}",
unlikelyException);
throw new RepositoryRuntimeException(unlikelyException);
}
} | [
"public",
"static",
"URI",
"asURI",
"(",
"final",
"String",
"algorithm",
",",
"final",
"String",
"value",
")",
"{",
"try",
"{",
"final",
"String",
"scheme",
"=",
"DIGEST_ALGORITHM",
".",
"getScheme",
"(",
"algorithm",
")",
";",
"return",
"new",
"URI",
"(",... | Convert a MessageDigest algorithm and checksum value to a URN
@param algorithm the message digest algorithm
@param value the checksum value
@return URI | [
"Convert",
"a",
"MessageDigest",
"algorithm",
"and",
"checksum",
"value",
"to",
"a",
"URN"
] | train | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-api/src/main/java/org/fcrepo/kernel/api/utils/ContentDigest.java#L97-L107 |
hyperledger/fabric-sdk-java | src/main/java/org/hyperledger/fabric/sdk/Channel.java | Channel.lifecycleQueryChaincodeDefinition | public Collection<LifecycleQueryChaincodeDefinitionProposalResponse> lifecycleQueryChaincodeDefinition(
QueryLifecycleQueryChaincodeDefinitionRequest queryLifecycleQueryChaincodeDefinitionRequest, Collection<Peer> peers) throws InvalidArgumentException, ProposalException {
if (null == queryLifecycleQueryChaincodeDefinitionRequest) {
throw new InvalidArgumentException("The queryLifecycleQueryChaincodeDefinitionRequest parameter can not be null.");
}
checkChannelState();
checkPeers(peers);
try {
logger.trace(format("LifecycleQueryChaincodeDefinition channel: %s, chaincode name: %s", name, queryLifecycleQueryChaincodeDefinitionRequest.getChaincodeName()));
TransactionContext context = getTransactionContext(queryLifecycleQueryChaincodeDefinitionRequest);
LifecycleQueryChaincodeDefinitionBuilder lifecycleQueryChaincodeDefinitionBuilder = LifecycleQueryChaincodeDefinitionBuilder.newBuilder();
lifecycleQueryChaincodeDefinitionBuilder.context(context).setChaincodeName(queryLifecycleQueryChaincodeDefinitionRequest.getChaincodeName());
SignedProposal qProposal = getSignedProposal(context, lifecycleQueryChaincodeDefinitionBuilder.build());
return sendProposalToPeers(peers, qProposal, context, LifecycleQueryChaincodeDefinitionProposalResponse.class);
} catch (ProposalException e) {
throw e;
} catch (Exception e) {
throw new ProposalException(format("Query for peer %s channels failed. " + e.getMessage(), name), e);
}
} | java | public Collection<LifecycleQueryChaincodeDefinitionProposalResponse> lifecycleQueryChaincodeDefinition(
QueryLifecycleQueryChaincodeDefinitionRequest queryLifecycleQueryChaincodeDefinitionRequest, Collection<Peer> peers) throws InvalidArgumentException, ProposalException {
if (null == queryLifecycleQueryChaincodeDefinitionRequest) {
throw new InvalidArgumentException("The queryLifecycleQueryChaincodeDefinitionRequest parameter can not be null.");
}
checkChannelState();
checkPeers(peers);
try {
logger.trace(format("LifecycleQueryChaincodeDefinition channel: %s, chaincode name: %s", name, queryLifecycleQueryChaincodeDefinitionRequest.getChaincodeName()));
TransactionContext context = getTransactionContext(queryLifecycleQueryChaincodeDefinitionRequest);
LifecycleQueryChaincodeDefinitionBuilder lifecycleQueryChaincodeDefinitionBuilder = LifecycleQueryChaincodeDefinitionBuilder.newBuilder();
lifecycleQueryChaincodeDefinitionBuilder.context(context).setChaincodeName(queryLifecycleQueryChaincodeDefinitionRequest.getChaincodeName());
SignedProposal qProposal = getSignedProposal(context, lifecycleQueryChaincodeDefinitionBuilder.build());
return sendProposalToPeers(peers, qProposal, context, LifecycleQueryChaincodeDefinitionProposalResponse.class);
} catch (ProposalException e) {
throw e;
} catch (Exception e) {
throw new ProposalException(format("Query for peer %s channels failed. " + e.getMessage(), name), e);
}
} | [
"public",
"Collection",
"<",
"LifecycleQueryChaincodeDefinitionProposalResponse",
">",
"lifecycleQueryChaincodeDefinition",
"(",
"QueryLifecycleQueryChaincodeDefinitionRequest",
"queryLifecycleQueryChaincodeDefinitionRequest",
",",
"Collection",
"<",
"Peer",
">",
"peers",
")",
"throw... | lifecycleQueryChaincodeDefinition get definition of chaincode.
@param queryLifecycleQueryChaincodeDefinitionRequest The request see {@link QueryLifecycleQueryChaincodeDefinitionRequest}
@param peers The peers to send the request to.
@return A {@link LifecycleQueryChaincodeDefinitionProposalResponse}
@throws InvalidArgumentException
@throws ProposalException | [
"lifecycleQueryChaincodeDefinition",
"get",
"definition",
"of",
"chaincode",
"."
] | train | https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/Channel.java#L3828-L3855 |
nmorel/gwt-jackson | gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/JsonDeserializationContext.java | JsonDeserializationContext.addObjectId | public void addObjectId( IdKey id, Object instance ) {
if ( null == idToObject ) {
idToObject = new HashMap<IdKey, Object>();
}
idToObject.put( id, instance );
} | java | public void addObjectId( IdKey id, Object instance ) {
if ( null == idToObject ) {
idToObject = new HashMap<IdKey, Object>();
}
idToObject.put( id, instance );
} | [
"public",
"void",
"addObjectId",
"(",
"IdKey",
"id",
",",
"Object",
"instance",
")",
"{",
"if",
"(",
"null",
"==",
"idToObject",
")",
"{",
"idToObject",
"=",
"new",
"HashMap",
"<",
"IdKey",
",",
"Object",
">",
"(",
")",
";",
"}",
"idToObject",
".",
"... | <p>addObjectId</p>
@param id a {@link com.fasterxml.jackson.annotation.ObjectIdGenerator.IdKey} object.
@param instance a {@link java.lang.Object} object. | [
"<p",
">",
"addObjectId<",
"/",
"p",
">"
] | train | https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/JsonDeserializationContext.java#L411-L416 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/util/JsonUtil.java | JsonUtil.getDouble | public static double getDouble(JsonObject object, String field, double defaultValue) {
final JsonValue value = object.get(field);
if (value == null || value.isNull()) {
return defaultValue;
} else {
return value.asDouble();
}
} | java | public static double getDouble(JsonObject object, String field, double defaultValue) {
final JsonValue value = object.get(field);
if (value == null || value.isNull()) {
return defaultValue;
} else {
return value.asDouble();
}
} | [
"public",
"static",
"double",
"getDouble",
"(",
"JsonObject",
"object",
",",
"String",
"field",
",",
"double",
"defaultValue",
")",
"{",
"final",
"JsonValue",
"value",
"=",
"object",
".",
"get",
"(",
"field",
")",
";",
"if",
"(",
"value",
"==",
"null",
"... | Returns a field in a Json object as a double.
@param object the Json Object
@param field the field in the Json object to return
@param defaultValue a default value for the field if the field value is null
@return the Json field value as a double | [
"Returns",
"a",
"field",
"in",
"a",
"Json",
"object",
"as",
"a",
"double",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/JsonUtil.java#L120-L127 |
TheHortonMachine/hortonmachine | dbs/src/main/java/org/hortonmachine/ssh/SshUtilities.java | SshUtilities.runShellCommand | public static String runShellCommand( Session session, String command ) throws JSchException, IOException {
String remoteResponseStr = launchACommand(session, command);
return remoteResponseStr;
} | java | public static String runShellCommand( Session session, String command ) throws JSchException, IOException {
String remoteResponseStr = launchACommand(session, command);
return remoteResponseStr;
} | [
"public",
"static",
"String",
"runShellCommand",
"(",
"Session",
"session",
",",
"String",
"command",
")",
"throws",
"JSchException",
",",
"IOException",
"{",
"String",
"remoteResponseStr",
"=",
"launchACommand",
"(",
"session",
",",
"command",
")",
";",
"return",... | Launch a shell command.
@param session the session to use.
@param command the command to launch.
@return the output of the command.
@throws JSchException
@throws IOException | [
"Launch",
"a",
"shell",
"command",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/org/hortonmachine/ssh/SshUtilities.java#L280-L283 |
alipay/sofa-rpc | extension-impl/extension-common/src/main/java/com/alipay/sofa/rpc/bootstrap/DefaultConsumerBootstrap.java | DefaultConsumerBootstrap.subscribeFromDirectUrl | protected List<ProviderGroup> subscribeFromDirectUrl(String directUrl) {
List<ProviderGroup> result = new ArrayList<ProviderGroup>();
List<ProviderInfo> tmpProviderInfoList = new ArrayList<ProviderInfo>();
String[] providerStrs = StringUtils.splitWithCommaOrSemicolon(directUrl);
for (String providerStr : providerStrs) {
ProviderInfo providerInfo = convertToProviderInfo(providerStr);
if (providerInfo.getStaticAttr(ProviderInfoAttrs.ATTR_SOURCE) == null) {
providerInfo.setStaticAttr(ProviderInfoAttrs.ATTR_SOURCE, "direct");
}
tmpProviderInfoList.add(providerInfo);
}
result.add(new ProviderGroup(RpcConstants.ADDRESS_DIRECT_GROUP, tmpProviderInfoList));
return result;
} | java | protected List<ProviderGroup> subscribeFromDirectUrl(String directUrl) {
List<ProviderGroup> result = new ArrayList<ProviderGroup>();
List<ProviderInfo> tmpProviderInfoList = new ArrayList<ProviderInfo>();
String[] providerStrs = StringUtils.splitWithCommaOrSemicolon(directUrl);
for (String providerStr : providerStrs) {
ProviderInfo providerInfo = convertToProviderInfo(providerStr);
if (providerInfo.getStaticAttr(ProviderInfoAttrs.ATTR_SOURCE) == null) {
providerInfo.setStaticAttr(ProviderInfoAttrs.ATTR_SOURCE, "direct");
}
tmpProviderInfoList.add(providerInfo);
}
result.add(new ProviderGroup(RpcConstants.ADDRESS_DIRECT_GROUP, tmpProviderInfoList));
return result;
} | [
"protected",
"List",
"<",
"ProviderGroup",
">",
"subscribeFromDirectUrl",
"(",
"String",
"directUrl",
")",
"{",
"List",
"<",
"ProviderGroup",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"ProviderGroup",
">",
"(",
")",
";",
"List",
"<",
"ProviderInfo",
">",
... | Subscribe provider list from direct url
@param directUrl direct url of consume config
@return Provider group list | [
"Subscribe",
"provider",
"list",
"from",
"direct",
"url"
] | train | https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/extension-common/src/main/java/com/alipay/sofa/rpc/bootstrap/DefaultConsumerBootstrap.java#L278-L292 |
pravega/pravega | common/src/main/java/io/pravega/common/util/BitConverter.java | BitConverter.writeInt | public static int writeInt(byte[] target, int offset, int value) {
target[offset] = (byte) (value >>> 24);
target[offset + 1] = (byte) (value >>> 16);
target[offset + 2] = (byte) (value >>> 8);
target[offset + 3] = (byte) value;
return Integer.BYTES;
} | java | public static int writeInt(byte[] target, int offset, int value) {
target[offset] = (byte) (value >>> 24);
target[offset + 1] = (byte) (value >>> 16);
target[offset + 2] = (byte) (value >>> 8);
target[offset + 3] = (byte) value;
return Integer.BYTES;
} | [
"public",
"static",
"int",
"writeInt",
"(",
"byte",
"[",
"]",
"target",
",",
"int",
"offset",
",",
"int",
"value",
")",
"{",
"target",
"[",
"offset",
"]",
"=",
"(",
"byte",
")",
"(",
"value",
">>>",
"24",
")",
";",
"target",
"[",
"offset",
"+",
"... | Writes the given 32-bit Integer to the given byte array at the given offset.
@param target The byte array to write to.
@param offset The offset within the byte array to write at.
@param value The value to write.
@return The number of bytes written. | [
"Writes",
"the",
"given",
"32",
"-",
"bit",
"Integer",
"to",
"the",
"given",
"byte",
"array",
"at",
"the",
"given",
"offset",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/BitConverter.java#L68-L74 |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/markdown/Emitter.java | Emitter._emitLines | private void _emitLines (final MarkdownHCStack aOut, final Block aBlock)
{
switch (aBlock.m_eType)
{
case CODE:
_emitCodeLines (aOut, aBlock.m_aLines, aBlock.m_sMeta, true);
break;
case FENCED_CODE:
_emitCodeLines (aOut, aBlock.m_aLines, aBlock.m_sMeta, false);
break;
case PLUGIN:
emitPluginLines (aOut, aBlock.m_aLines, aBlock.m_sMeta);
break;
case XML:
_emitXMLLines (aOut, aBlock.m_aLines);
break;
case XML_COMMENT:
_emitXMLComment (aOut, aBlock.m_aLines);
break;
case PARAGRAPH:
_emitMarkedLines (aOut, aBlock.m_aLines);
break;
default:
_emitMarkedLines (aOut, aBlock.m_aLines);
break;
}
} | java | private void _emitLines (final MarkdownHCStack aOut, final Block aBlock)
{
switch (aBlock.m_eType)
{
case CODE:
_emitCodeLines (aOut, aBlock.m_aLines, aBlock.m_sMeta, true);
break;
case FENCED_CODE:
_emitCodeLines (aOut, aBlock.m_aLines, aBlock.m_sMeta, false);
break;
case PLUGIN:
emitPluginLines (aOut, aBlock.m_aLines, aBlock.m_sMeta);
break;
case XML:
_emitXMLLines (aOut, aBlock.m_aLines);
break;
case XML_COMMENT:
_emitXMLComment (aOut, aBlock.m_aLines);
break;
case PARAGRAPH:
_emitMarkedLines (aOut, aBlock.m_aLines);
break;
default:
_emitMarkedLines (aOut, aBlock.m_aLines);
break;
}
} | [
"private",
"void",
"_emitLines",
"(",
"final",
"MarkdownHCStack",
"aOut",
",",
"final",
"Block",
"aBlock",
")",
"{",
"switch",
"(",
"aBlock",
".",
"m_eType",
")",
"{",
"case",
"CODE",
":",
"_emitCodeLines",
"(",
"aOut",
",",
"aBlock",
".",
"m_aLines",
",",... | Transforms lines into HTML.
@param aOut
The StringBuilder to write to.
@param aBlock
The Block to process. | [
"Transforms",
"lines",
"into",
"HTML",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/markdown/Emitter.java#L219-L245 |
sdl/odata | odata_renderer/src/main/java/com/sdl/odata/renderer/xml/writer/XMLErrorResponseWriter.java | XMLErrorResponseWriter.startDocument | public void startDocument() throws ODataRenderException {
outputStream = new ByteArrayOutputStream();
try {
xmlWriter = xmlOutputFactory.createXMLStreamWriter(outputStream, UTF_8.name());
xmlWriter.writeStartDocument(UTF_8.name(), XML_VERSION);
xmlWriter.setPrefix(METADATA, ODATA_METADATA_NS);
} catch (XMLStreamException e) {
LOG.error("Not possible to start stream XML");
throw new ODataRenderException("Not possible to start stream XML: ", e);
}
} | java | public void startDocument() throws ODataRenderException {
outputStream = new ByteArrayOutputStream();
try {
xmlWriter = xmlOutputFactory.createXMLStreamWriter(outputStream, UTF_8.name());
xmlWriter.writeStartDocument(UTF_8.name(), XML_VERSION);
xmlWriter.setPrefix(METADATA, ODATA_METADATA_NS);
} catch (XMLStreamException e) {
LOG.error("Not possible to start stream XML");
throw new ODataRenderException("Not possible to start stream XML: ", e);
}
} | [
"public",
"void",
"startDocument",
"(",
")",
"throws",
"ODataRenderException",
"{",
"outputStream",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"try",
"{",
"xmlWriter",
"=",
"xmlOutputFactory",
".",
"createXMLStreamWriter",
"(",
"outputStream",
",",
"UTF_8",... | Start the XML stream document by defining things like the type of encoding, and prefixes used.
It needs to be used before calling any write method.
@throws ODataRenderException if unable to render | [
"Start",
"the",
"XML",
"stream",
"document",
"by",
"defining",
"things",
"like",
"the",
"type",
"of",
"encoding",
"and",
"prefixes",
"used",
".",
"It",
"needs",
"to",
"be",
"used",
"before",
"calling",
"any",
"write",
"method",
"."
] | train | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/renderer/xml/writer/XMLErrorResponseWriter.java#L60-L71 |
igniterealtime/Smack | smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java | OmemoStore.storeOmemoPreKeys | public void storeOmemoPreKeys(OmemoDevice userDevice, TreeMap<Integer, T_PreKey> preKeyHashMap) {
for (Map.Entry<Integer, T_PreKey> entry : preKeyHashMap.entrySet()) {
storeOmemoPreKey(userDevice, entry.getKey(), entry.getValue());
}
} | java | public void storeOmemoPreKeys(OmemoDevice userDevice, TreeMap<Integer, T_PreKey> preKeyHashMap) {
for (Map.Entry<Integer, T_PreKey> entry : preKeyHashMap.entrySet()) {
storeOmemoPreKey(userDevice, entry.getKey(), entry.getValue());
}
} | [
"public",
"void",
"storeOmemoPreKeys",
"(",
"OmemoDevice",
"userDevice",
",",
"TreeMap",
"<",
"Integer",
",",
"T_PreKey",
">",
"preKeyHashMap",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Integer",
",",
"T_PreKey",
">",
"entry",
":",
"preKeyHashMap",
".... | Store a whole bunch of preKeys.
@param userDevice our OmemoDevice.
@param preKeyHashMap HashMap of preKeys | [
"Store",
"a",
"whole",
"bunch",
"of",
"preKeys",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java#L404-L408 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/util/CmsClientStringUtil.java | CmsClientStringUtil.shortenString | public static String shortenString(String text, int maxLength) {
if (text.length() <= maxLength) {
return text;
}
String newText = text.substring(0, maxLength - 1);
if (text.startsWith("/")) {
// file name?
newText = CmsStringUtil.formatResourceName(text, maxLength);
} else if (maxLength > 2) {
// enough space for ellipsis?
newText += CmsDomUtil.Entity.hellip.html();
}
if (CmsStringUtil.isEmptyOrWhitespaceOnly(newText)) {
// if empty, it could break the layout
newText = CmsDomUtil.Entity.nbsp.html();
}
return newText;
} | java | public static String shortenString(String text, int maxLength) {
if (text.length() <= maxLength) {
return text;
}
String newText = text.substring(0, maxLength - 1);
if (text.startsWith("/")) {
// file name?
newText = CmsStringUtil.formatResourceName(text, maxLength);
} else if (maxLength > 2) {
// enough space for ellipsis?
newText += CmsDomUtil.Entity.hellip.html();
}
if (CmsStringUtil.isEmptyOrWhitespaceOnly(newText)) {
// if empty, it could break the layout
newText = CmsDomUtil.Entity.nbsp.html();
}
return newText;
} | [
"public",
"static",
"String",
"shortenString",
"(",
"String",
"text",
",",
"int",
"maxLength",
")",
"{",
"if",
"(",
"text",
".",
"length",
"(",
")",
"<=",
"maxLength",
")",
"{",
"return",
"text",
";",
"}",
"String",
"newText",
"=",
"text",
".",
"substr... | Shortens the string to the given maximum length.<p>
Will include HTML entity ellipses replacing the cut off text.<p>
@param text the string to shorten
@param maxLength the maximum length
@return the shortened string | [
"Shortens",
"the",
"string",
"to",
"the",
"given",
"maximum",
"length",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsClientStringUtil.java#L205-L223 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/io/IOUtils.java | IOUtils.writeObjectToFile | public static File writeObjectToFile(Object o, File file, boolean append) throws IOException {
// file.createNewFile(); // cdm may 2005: does nothing needed
ObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream(
new GZIPOutputStream(new FileOutputStream(file, append))));
oos.writeObject(o);
oos.close();
return file;
} | java | public static File writeObjectToFile(Object o, File file, boolean append) throws IOException {
// file.createNewFile(); // cdm may 2005: does nothing needed
ObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream(
new GZIPOutputStream(new FileOutputStream(file, append))));
oos.writeObject(o);
oos.close();
return file;
} | [
"public",
"static",
"File",
"writeObjectToFile",
"(",
"Object",
"o",
",",
"File",
"file",
",",
"boolean",
"append",
")",
"throws",
"IOException",
"{",
"// file.createNewFile(); // cdm may 2005: does nothing needed\r",
"ObjectOutputStream",
"oos",
"=",
"new",
"ObjectOutput... | Write an object to a specified File.
@param o
object to be written to file
@param file
The temp File
@param append If true, append to this file instead of overwriting it
@throws IOException
If File cannot be written
@return File containing the object | [
"Write",
"an",
"object",
"to",
"a",
"specified",
"File",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/io/IOUtils.java#L76-L83 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/GeoPackageOverlayFactory.java | GeoPackageOverlayFactory.getBoundedOverlay | public static BoundedOverlay getBoundedOverlay(TileDao tileDao, float density, TileScaling scaling) {
return new GeoPackageOverlay(tileDao, density, scaling);
} | java | public static BoundedOverlay getBoundedOverlay(TileDao tileDao, float density, TileScaling scaling) {
return new GeoPackageOverlay(tileDao, density, scaling);
} | [
"public",
"static",
"BoundedOverlay",
"getBoundedOverlay",
"(",
"TileDao",
"tileDao",
",",
"float",
"density",
",",
"TileScaling",
"scaling",
")",
"{",
"return",
"new",
"GeoPackageOverlay",
"(",
"tileDao",
",",
"density",
",",
"scaling",
")",
";",
"}"
] | Get a Bounded Overlay Tile Provider for the Tile DAO with the display density and tile creator options
@param tileDao tile dao
@param density display density: {@link android.util.DisplayMetrics#density}
@param scaling tile scaling options
@return bounded overlay
@since 3.2.0 | [
"Get",
"a",
"Bounded",
"Overlay",
"Tile",
"Provider",
"for",
"the",
"Tile",
"DAO",
"with",
"the",
"display",
"density",
"and",
"tile",
"creator",
"options"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/GeoPackageOverlayFactory.java#L107-L109 |
Samsung/GearVRf | GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/ListWidget.java | ListWidget.scrollByOffset | @Override
public boolean scrollByOffset(final float xOffset, final float yOffset, final float zOffset,
final LayoutScroller.OnScrollListener listener) {
if (isScrolling()) {
return false;
}
Vector3Axis offset = new Vector3Axis(xOffset, yOffset, zOffset);
if (offset.isInfinite() || offset.isNaN()) {
Log.e(TAG, new IllegalArgumentException(),
"Invalid scrolling delta: %s", offset);
return false;
}
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "scrollBy(%s): offset %s", getName(), offset);
onScrollImpl(offset, listener);
return true;
} | java | @Override
public boolean scrollByOffset(final float xOffset, final float yOffset, final float zOffset,
final LayoutScroller.OnScrollListener listener) {
if (isScrolling()) {
return false;
}
Vector3Axis offset = new Vector3Axis(xOffset, yOffset, zOffset);
if (offset.isInfinite() || offset.isNaN()) {
Log.e(TAG, new IllegalArgumentException(),
"Invalid scrolling delta: %s", offset);
return false;
}
Log.d(Log.SUBSYSTEM.LAYOUT, TAG, "scrollBy(%s): offset %s", getName(), offset);
onScrollImpl(offset, listener);
return true;
} | [
"@",
"Override",
"public",
"boolean",
"scrollByOffset",
"(",
"final",
"float",
"xOffset",
",",
"final",
"float",
"yOffset",
",",
"final",
"float",
"zOffset",
",",
"final",
"LayoutScroller",
".",
"OnScrollListener",
"listener",
")",
"{",
"if",
"(",
"isScrolling",... | Scroll all items in the {@link ListWidget} by {@code rotation} degrees}.
@param xOffset
@param yOffset
@param zOffset
The amount to scroll, in degrees. | [
"Scroll",
"all",
"items",
"in",
"the",
"{",
"@link",
"ListWidget",
"}",
"by",
"{",
"@code",
"rotation",
"}",
"degrees",
"}",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/ListWidget.java#L621-L638 |
forge/javaee-descriptors | impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/facelettaglibrary20/WebFacelettaglibraryDescriptorImpl.java | WebFacelettaglibraryDescriptorImpl.addNamespace | public WebFacelettaglibraryDescriptor addNamespace(String name, String value)
{
model.attribute(name, value);
return this;
} | java | public WebFacelettaglibraryDescriptor addNamespace(String name, String value)
{
model.attribute(name, value);
return this;
} | [
"public",
"WebFacelettaglibraryDescriptor",
"addNamespace",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"model",
".",
"attribute",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Adds a new namespace
@return the current instance of <code>WebFacelettaglibraryDescriptor</code> | [
"Adds",
"a",
"new",
"namespace"
] | train | https://github.com/forge/javaee-descriptors/blob/cb914330a1a0b04bfc1d0f199bd9cde3bbf0b3ed/impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/facelettaglibrary20/WebFacelettaglibraryDescriptorImpl.java#L87-L91 |
google/closure-templates | java/src/com/google/template/soy/soytree/SoyTreeUtils.java | SoyTreeUtils.cloneWithNewIds | public static <T extends SoyNode> T cloneWithNewIds(T origNode, IdGenerator nodeIdGen) {
// Clone the node.
@SuppressWarnings("unchecked")
T clone = (T) origNode.copy(new CopyState());
// Generate new ids.
(new GenNewIdsVisitor(nodeIdGen)).exec(clone);
return clone;
} | java | public static <T extends SoyNode> T cloneWithNewIds(T origNode, IdGenerator nodeIdGen) {
// Clone the node.
@SuppressWarnings("unchecked")
T clone = (T) origNode.copy(new CopyState());
// Generate new ids.
(new GenNewIdsVisitor(nodeIdGen)).exec(clone);
return clone;
} | [
"public",
"static",
"<",
"T",
"extends",
"SoyNode",
">",
"T",
"cloneWithNewIds",
"(",
"T",
"origNode",
",",
"IdGenerator",
"nodeIdGen",
")",
"{",
"// Clone the node.",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"T",
"clone",
"=",
"(",
"T",
")",
"ori... | Clones the given node and then generates and sets new ids on all the cloned nodes (by default,
SoyNode.copy(copyState) creates cloned nodes with the same ids as the original nodes).
<p>This function will use the original Soy tree's node id generator to generate the new node
ids for the cloned nodes. Thus, the original node to be cloned must be part of a full Soy tree.
However, this does not mean that the cloned node will become part of the original tree (unless
it is manually attached later). The cloned node will be an independent subtree with parent set
to null.
@param <T> The type of the node being cloned.
@param origNode The original node to be cloned. This node must be part of a full Soy tree,
because the generator for the new node ids will be retrieved from the root (SoyFileSetNode)
of the tree.
@param nodeIdGen The ID generator used for the tree.
@return The cloned node, with all new ids for its subtree. | [
"Clones",
"the",
"given",
"node",
"and",
"then",
"generates",
"and",
"sets",
"new",
"ids",
"on",
"all",
"the",
"cloned",
"nodes",
"(",
"by",
"default",
"SoyNode",
".",
"copy",
"(",
"copyState",
")",
"creates",
"cloned",
"nodes",
"with",
"the",
"same",
"i... | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/soytree/SoyTreeUtils.java#L281-L291 |
future-architect/uroborosql | src/main/java/jp/co/future/uroborosql/utils/StringFunction.java | StringFunction.leftPad | public String leftPad(final String str, final int size, final char padChar) {
return StringUtils.leftPad(str, size, padChar);
} | java | public String leftPad(final String str, final int size, final char padChar) {
return StringUtils.leftPad(str, size, padChar);
} | [
"public",
"String",
"leftPad",
"(",
"final",
"String",
"str",
",",
"final",
"int",
"size",
",",
"final",
"char",
"padChar",
")",
"{",
"return",
"StringUtils",
".",
"leftPad",
"(",
"str",
",",
"size",
",",
"padChar",
")",
";",
"}"
] | 文字列の先頭に指定した埋め込み文字を埋めて指定された長さにする
<pre>
StringUtils.leftPad(null, *, *) = null
StringUtils.leftPad("", 3, 'z') = "zzz"
StringUtils.leftPad("bat", 3, 'z') = "bat"
StringUtils.leftPad("bat", 5, 'z') = "zzbat"
StringUtils.leftPad("bat", 1, 'z') = "bat"
StringUtils.leftPad("bat", -1, 'z') = "bat"
</pre>
@param str 文字列
@param size 文字埋め後の長さ
@param padChar 埋め込み文字
@return 指定した長さになるまで末尾に埋め込み文字を埋めた文字列 | [
"文字列の先頭に指定した埋め込み文字を埋めて指定された長さにする"
] | train | https://github.com/future-architect/uroborosql/blob/4c26db51defdac3c6ed16866e33ab45e190e2e0c/src/main/java/jp/co/future/uroborosql/utils/StringFunction.java#L271-L273 |
landawn/AbacusUtil | src/com/landawn/abacus/util/N.java | N.checkState | public static void checkState(boolean b, String errorMessageTemplate, double p) {
if (!b) {
throw new IllegalStateException(format(errorMessageTemplate, p));
}
} | java | public static void checkState(boolean b, String errorMessageTemplate, double p) {
if (!b) {
throw new IllegalStateException(format(errorMessageTemplate, p));
}
} | [
"public",
"static",
"void",
"checkState",
"(",
"boolean",
"b",
",",
"String",
"errorMessageTemplate",
",",
"double",
"p",
")",
"{",
"if",
"(",
"!",
"b",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"format",
"(",
"errorMessageTemplate",
",",
"p",
... | Ensures the truth of an expression involving the state of the calling instance, but not
involving any parameters to the calling method.
<p>See {@link #checkState(boolean, String, Object...)} for details. | [
"Ensures",
"the",
"truth",
"of",
"an",
"expression",
"involving",
"the",
"state",
"of",
"the",
"calling",
"instance",
"but",
"not",
"involving",
"any",
"parameters",
"to",
"the",
"calling",
"method",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L6004-L6008 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/string/Levenshtein.java | Levenshtein.of | @SuppressWarnings("unchecked")
public static <T extends Levenshtein> T of(String baseTarget, String compareTarget) {
return (T) new LevenshteinEditDistance(baseTarget).update(compareTarget);
} | java | @SuppressWarnings("unchecked")
public static <T extends Levenshtein> T of(String baseTarget, String compareTarget) {
return (T) new LevenshteinEditDistance(baseTarget).update(compareTarget);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
"extends",
"Levenshtein",
">",
"T",
"of",
"(",
"String",
"baseTarget",
",",
"String",
"compareTarget",
")",
"{",
"return",
"(",
"T",
")",
"new",
"LevenshteinEditDistance",
"(",
... | Returns a new Levenshtein edit distance instance with compare target string
@see LevenshteinEditDistance
@param baseTarget
@param compareTarget
@return | [
"Returns",
"a",
"new",
"Levenshtein",
"edit",
"distance",
"instance",
"with",
"compare",
"target",
"string"
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/Levenshtein.java#L61-L64 |
mapsforge/mapsforge | mapsforge-core/src/main/java/org/mapsforge/core/model/LatLong.java | LatLong.fromMicroDegrees | public static LatLong fromMicroDegrees(int latitudeE6, int longitudeE6) {
return new LatLong(LatLongUtils.microdegreesToDegrees(latitudeE6),
LatLongUtils.microdegreesToDegrees(longitudeE6));
} | java | public static LatLong fromMicroDegrees(int latitudeE6, int longitudeE6) {
return new LatLong(LatLongUtils.microdegreesToDegrees(latitudeE6),
LatLongUtils.microdegreesToDegrees(longitudeE6));
} | [
"public",
"static",
"LatLong",
"fromMicroDegrees",
"(",
"int",
"latitudeE6",
",",
"int",
"longitudeE6",
")",
"{",
"return",
"new",
"LatLong",
"(",
"LatLongUtils",
".",
"microdegreesToDegrees",
"(",
"latitudeE6",
")",
",",
"LatLongUtils",
".",
"microdegreesToDegrees"... | Constructs a new LatLong with the given latitude and longitude values, measured in
microdegrees.
@param latitudeE6 the latitude value in microdegrees.
@param longitudeE6 the longitude value in microdegrees.
@return the LatLong
@throws IllegalArgumentException if the latitudeE6 or longitudeE6 value is invalid. | [
"Constructs",
"a",
"new",
"LatLong",
"with",
"the",
"given",
"latitude",
"and",
"longitude",
"values",
"measured",
"in",
"microdegrees",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/model/LatLong.java#L136-L139 |
contentful/contentful-management.java | src/main/java/com/contentful/java/cma/AbsModule.java | AbsModule.assertNotNull | void assertNotNull(Object object, String param) {
if (object == null) {
throw new IllegalArgumentException(String.format(
"%s may not be null.", param));
}
} | java | void assertNotNull(Object object, String param) {
if (object == null) {
throw new IllegalArgumentException(String.format(
"%s may not be null.", param));
}
} | [
"void",
"assertNotNull",
"(",
"Object",
"object",
",",
"String",
"param",
")",
"{",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"%s may not be null.\"",
",",
"param",
")",
")",... | Asserts that the given {@code object} with name {@code param} is not null, throws
{@link IllegalArgumentException} otherwise. | [
"Asserts",
"that",
"the",
"given",
"{"
] | train | https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/AbsModule.java#L60-L65 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/NormOps_DDRM.java | NormOps_DDRM.conditionP | public static double conditionP(DMatrixRMaj A , double p )
{
if( p == 2 ) {
return conditionP2(A);
} else if( A.numRows == A.numCols ){
// square matrices are the typical case
DMatrixRMaj A_inv = new DMatrixRMaj(A.numRows,A.numCols);
if( !CommonOps_DDRM.invert(A,A_inv) )
throw new IllegalArgumentException("A can't be inverted.");
return normP(A,p) * normP(A_inv,p);
} else {
DMatrixRMaj pinv = new DMatrixRMaj(A.numCols,A.numRows);
CommonOps_DDRM.pinv(A,pinv);
return normP(A,p) * normP(pinv,p);
}
} | java | public static double conditionP(DMatrixRMaj A , double p )
{
if( p == 2 ) {
return conditionP2(A);
} else if( A.numRows == A.numCols ){
// square matrices are the typical case
DMatrixRMaj A_inv = new DMatrixRMaj(A.numRows,A.numCols);
if( !CommonOps_DDRM.invert(A,A_inv) )
throw new IllegalArgumentException("A can't be inverted.");
return normP(A,p) * normP(A_inv,p);
} else {
DMatrixRMaj pinv = new DMatrixRMaj(A.numCols,A.numRows);
CommonOps_DDRM.pinv(A,pinv);
return normP(A,p) * normP(pinv,p);
}
} | [
"public",
"static",
"double",
"conditionP",
"(",
"DMatrixRMaj",
"A",
",",
"double",
"p",
")",
"{",
"if",
"(",
"p",
"==",
"2",
")",
"{",
"return",
"conditionP2",
"(",
"A",
")",
";",
"}",
"else",
"if",
"(",
"A",
".",
"numRows",
"==",
"A",
".",
"num... | <p>
The condition number of a matrix is used to measure the sensitivity of the linear
system <b>Ax=b</b>. A value near one indicates that it is a well conditioned matrix.<br>
<br>
κ<sub>p</sub> = ||A||<sub>p</sub>||A<sup>-1</sup>||<sub>p</sub>
</p>
<p>
If the matrix is not square then the condition of either A<sup>T</sup>A or AA<sup>T</sup> is computed.
<p>
@param A The matrix.
@param p p-norm
@return The condition number. | [
"<p",
">",
"The",
"condition",
"number",
"of",
"a",
"matrix",
"is",
"used",
"to",
"measure",
"the",
"sensitivity",
"of",
"the",
"linear",
"system",
"<b",
">",
"Ax",
"=",
"b<",
"/",
"b",
">",
".",
"A",
"value",
"near",
"one",
"indicates",
"that",
"it"... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/NormOps_DDRM.java#L98-L117 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/spider/ObjectUpdater.java | ObjectUpdater.addNewObject | public ObjectResult addNewObject(SpiderTransaction parentTran, DBObject dbObj) {
ObjectResult result = new ObjectResult();
try {
addBrandNewObject(dbObj);
result.setObjectID(dbObj.getObjectID());
result.setUpdated(true);
parentTran.mergeSubTransaction(m_dbTran);
m_logger.trace("addNewObject(): Object added/updated for ID={}", dbObj.getObjectID());
} catch (Throwable ex) {
buildErrorStatus(result, dbObj.getObjectID(), ex);
}
return result;
} | java | public ObjectResult addNewObject(SpiderTransaction parentTran, DBObject dbObj) {
ObjectResult result = new ObjectResult();
try {
addBrandNewObject(dbObj);
result.setObjectID(dbObj.getObjectID());
result.setUpdated(true);
parentTran.mergeSubTransaction(m_dbTran);
m_logger.trace("addNewObject(): Object added/updated for ID={}", dbObj.getObjectID());
} catch (Throwable ex) {
buildErrorStatus(result, dbObj.getObjectID(), ex);
}
return result;
} | [
"public",
"ObjectResult",
"addNewObject",
"(",
"SpiderTransaction",
"parentTran",
",",
"DBObject",
"dbObj",
")",
"{",
"ObjectResult",
"result",
"=",
"new",
"ObjectResult",
"(",
")",
";",
"try",
"{",
"addBrandNewObject",
"(",
"dbObj",
")",
";",
"result",
".",
"... | Add the given DBObject to the database as a new object. No check is made to see if
an object with the same ID already exists. If the update is successful, updates are
merged to the given parent SpiderTransaction.
@param parentTran Parent {@link SpiderTransaction} to which updates are applied
if the add is successful.
@param dbObj DBObject to be added to the database.
@return {@link ObjectResult} representing the results of the update. | [
"Add",
"the",
"given",
"DBObject",
"to",
"the",
"database",
"as",
"a",
"new",
"object",
".",
"No",
"check",
"is",
"made",
"to",
"see",
"if",
"an",
"object",
"with",
"the",
"same",
"ID",
"already",
"exists",
".",
"If",
"the",
"update",
"is",
"successful... | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/ObjectUpdater.java#L112-L124 |
querydsl/querydsl | querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java | ExpressionUtils.predicateTemplate | public static PredicateTemplate predicateTemplate(String template, Object... args) {
return predicateTemplate(TemplateFactory.DEFAULT.create(template), ImmutableList.copyOf(args));
} | java | public static PredicateTemplate predicateTemplate(String template, Object... args) {
return predicateTemplate(TemplateFactory.DEFAULT.create(template), ImmutableList.copyOf(args));
} | [
"public",
"static",
"PredicateTemplate",
"predicateTemplate",
"(",
"String",
"template",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"predicateTemplate",
"(",
"TemplateFactory",
".",
"DEFAULT",
".",
"create",
"(",
"template",
")",
",",
"ImmutableList",
".",
... | Create a new Template expression
@param template template
@param args template parameters
@return template expression | [
"Create",
"a",
"new",
"Template",
"expression"
] | train | https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java#L140-L142 |
DataArt/CalculationEngine | calculation-engine/engine-converters/src/main/java/com/dataart/spreadsheetanalytics/engine/DependencyExtractors.java | DependencyExtractors.createAttributeFunctionMeta | static <T extends FunctionMeta> T createAttributeFunctionMeta(Class<T> metaClass, String formula, IDataModel model) throws Exception {
T meta = (T) metaClass.newInstance().parse(formula);
meta.setDataModelId(model.getDataModelId());
if (meta.getName() == null) { meta.setName(model.getName()); }
return meta;
} | java | static <T extends FunctionMeta> T createAttributeFunctionMeta(Class<T> metaClass, String formula, IDataModel model) throws Exception {
T meta = (T) metaClass.newInstance().parse(formula);
meta.setDataModelId(model.getDataModelId());
if (meta.getName() == null) { meta.setName(model.getName()); }
return meta;
} | [
"static",
"<",
"T",
"extends",
"FunctionMeta",
">",
"T",
"createAttributeFunctionMeta",
"(",
"Class",
"<",
"T",
">",
"metaClass",
",",
"String",
"formula",
",",
"IDataModel",
"model",
")",
"throws",
"Exception",
"{",
"T",
"meta",
"=",
"(",
"T",
")",
"metaC... | Create an instance of new {@link FunctionMeta} and fills it with minimum information. | [
"Create",
"an",
"instance",
"of",
"new",
"{"
] | train | https://github.com/DataArt/CalculationEngine/blob/34ce1d9c1f9b57a502906b274311d28580b134e5/calculation-engine/engine-converters/src/main/java/com/dataart/spreadsheetanalytics/engine/DependencyExtractors.java#L210-L216 |
logic-ng/LogicNG | src/main/java/org/logicng/solvers/SATSolver.java | SATSolver.addWithRelaxation | public void addWithRelaxation(final Variable relaxationVar, final Collection<? extends Formula> formulas) {
for (final Formula formula : formulas) { this.addWithRelaxation(relaxationVar, formula); }
} | java | public void addWithRelaxation(final Variable relaxationVar, final Collection<? extends Formula> formulas) {
for (final Formula formula : formulas) { this.addWithRelaxation(relaxationVar, formula); }
} | [
"public",
"void",
"addWithRelaxation",
"(",
"final",
"Variable",
"relaxationVar",
",",
"final",
"Collection",
"<",
"?",
"extends",
"Formula",
">",
"formulas",
")",
"{",
"for",
"(",
"final",
"Formula",
"formula",
":",
"formulas",
")",
"{",
"this",
".",
"addWi... | Adds a collection of formulas to the solver.
@param relaxationVar the relaxation variable
@param formulas the collection of formulas | [
"Adds",
"a",
"collection",
"of",
"formulas",
"to",
"the",
"solver",
"."
] | train | https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/SATSolver.java#L161-L163 |
vvakame/JsonPullParser | jsonpullparser-apt/src/main/java/net/vvakame/apt/AptUtil.java | AptUtil.getTypeElement | public static TypeElement getTypeElement(Types typeUtils, Element element) {
TypeMirror type = element.asType();
return (TypeElement) typeUtils.asElement(type);
} | java | public static TypeElement getTypeElement(Types typeUtils, Element element) {
TypeMirror type = element.asType();
return (TypeElement) typeUtils.asElement(type);
} | [
"public",
"static",
"TypeElement",
"getTypeElement",
"(",
"Types",
"typeUtils",
",",
"Element",
"element",
")",
"{",
"TypeMirror",
"type",
"=",
"element",
".",
"asType",
"(",
")",
";",
"return",
"(",
"TypeElement",
")",
"typeUtils",
".",
"asElement",
"(",
"t... | Retrieves the corresponding {@link TypeElement} of the given element.
@param typeUtils
@param element
@return The corresponding {@link TypeElement}.
@author vvakame | [
"Retrieves",
"the",
"corresponding",
"{"
] | train | https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-apt/src/main/java/net/vvakame/apt/AptUtil.java#L147-L150 |
cache2k/cache2k | cache2k-spring/src/main/java/org/cache2k/extra/spring/SpringCache2kCacheManager.java | SpringCache2kCacheManager.addCaches | @SafeVarargs
public final SpringCache2kCacheManager addCaches(Function<Cache2kBuilder<?,?>, Cache2kBuilder<?,?>>... fs) {
for (Function<Cache2kBuilder<?,?>, Cache2kBuilder<?,?>> f : fs) {
addCache(f.apply(defaultSetup.apply(Cache2kBuilder.forUnknownTypes().manager(manager))));
}
return this;
} | java | @SafeVarargs
public final SpringCache2kCacheManager addCaches(Function<Cache2kBuilder<?,?>, Cache2kBuilder<?,?>>... fs) {
for (Function<Cache2kBuilder<?,?>, Cache2kBuilder<?,?>> f : fs) {
addCache(f.apply(defaultSetup.apply(Cache2kBuilder.forUnknownTypes().manager(manager))));
}
return this;
} | [
"@",
"SafeVarargs",
"public",
"final",
"SpringCache2kCacheManager",
"addCaches",
"(",
"Function",
"<",
"Cache2kBuilder",
"<",
"?",
",",
"?",
">",
",",
"Cache2kBuilder",
"<",
"?",
",",
"?",
">",
">",
"...",
"fs",
")",
"{",
"for",
"(",
"Function",
"<",
"Ca... | Adds a caches to this cache manager that maybe is configured via the {@link Cache2kBuilder}.
The configuration parameter {@link Cache2kBuilder#exceptionPropagator}
is managed by this class and cannot be used. This method can be used in case a programmatic
configuration of a cache manager is preferred.
<p>Rationale: The method provides a builder that is already seeded with the effective manager.
This makes it possible to use the builder without code bloat. Since the actual build is done
within this class, it is also possible to reset specific settings or do assertions.
@throws IllegalArgumentException if cache is already created | [
"Adds",
"a",
"caches",
"to",
"this",
"cache",
"manager",
"that",
"maybe",
"is",
"configured",
"via",
"the",
"{",
"@link",
"Cache2kBuilder",
"}",
".",
"The",
"configuration",
"parameter",
"{",
"@link",
"Cache2kBuilder#exceptionPropagator",
"}",
"is",
"managed",
"... | train | https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-spring/src/main/java/org/cache2k/extra/spring/SpringCache2kCacheManager.java#L129-L135 |
netty/netty | buffer/src/main/java/io/netty/buffer/Unpooled.java | Unpooled.copiedBuffer | public static ByteBuf copiedBuffer(char[] array, Charset charset) {
if (array == null) {
throw new NullPointerException("array");
}
return copiedBuffer(array, 0, array.length, charset);
} | java | public static ByteBuf copiedBuffer(char[] array, Charset charset) {
if (array == null) {
throw new NullPointerException("array");
}
return copiedBuffer(array, 0, array.length, charset);
} | [
"public",
"static",
"ByteBuf",
"copiedBuffer",
"(",
"char",
"[",
"]",
"array",
",",
"Charset",
"charset",
")",
"{",
"if",
"(",
"array",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"array\"",
")",
";",
"}",
"return",
"copiedBuffer... | Creates a new big-endian buffer whose content is the specified
{@code array} encoded in the specified {@code charset}.
The new buffer's {@code readerIndex} and {@code writerIndex} are
{@code 0} and the length of the encoded string respectively. | [
"Creates",
"a",
"new",
"big",
"-",
"endian",
"buffer",
"whose",
"content",
"is",
"the",
"specified",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/Unpooled.java#L628-L633 |
Netflix/governator | governator-legacy/src/main/java/com/netflix/governator/configuration/ConfigurationKey.java | ConfigurationKey.getKey | public String getKey(Map<String, String> variableValues)
{
StringBuilder key = new StringBuilder();
for ( ConfigurationKeyPart p : parts )
{
if ( p.isVariable() )
{
String value = variableValues.get(p.getValue());
if ( value == null )
{
log.warn("No value found for variable: " + p.getValue());
value = "";
}
key.append(value);
}
else
{
key.append(p.getValue());
}
}
return key.toString();
} | java | public String getKey(Map<String, String> variableValues)
{
StringBuilder key = new StringBuilder();
for ( ConfigurationKeyPart p : parts )
{
if ( p.isVariable() )
{
String value = variableValues.get(p.getValue());
if ( value == null )
{
log.warn("No value found for variable: " + p.getValue());
value = "";
}
key.append(value);
}
else
{
key.append(p.getValue());
}
}
return key.toString();
} | [
"public",
"String",
"getKey",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"variableValues",
")",
"{",
"StringBuilder",
"key",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"ConfigurationKeyPart",
"p",
":",
"parts",
")",
"{",
"if",
"(",
"p",
... | Return the final key applying variables as needed
@param variableValues map of variable names to values
@return the key | [
"Return",
"the",
"final",
"key",
"applying",
"variables",
"as",
"needed"
] | train | https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-legacy/src/main/java/com/netflix/governator/configuration/ConfigurationKey.java#L60-L82 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java | MapUtil.join | public static <K, V> String join(Map<K, V> map, String separator, String keyValueSeparator) {
return join(map, separator, keyValueSeparator, false);
} | java | public static <K, V> String join(Map<K, V> map, String separator, String keyValueSeparator) {
return join(map, separator, keyValueSeparator, false);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"String",
"join",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
",",
"String",
"separator",
",",
"String",
"keyValueSeparator",
")",
"{",
"return",
"join",
"(",
"map",
",",
"separator",
",",
"keyValueSeparator... | 将map转成字符串
@param <K> 键类型
@param <V> 值类型
@param map Map
@param separator entry之间的连接符
@param keyValueSeparator kv之间的连接符
@return 连接字符串
@since 3.1.1 | [
"将map转成字符串"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java#L427-L429 |
mikepenz/Android-Iconics | library-core/src/main/java/com/mikepenz/iconics/Iconics.java | Iconics.styleEditable | public static void styleEditable(@NonNull Context ctx, @NonNull Editable editable) {
styleEditable(ctx, null, editable, null, null);
} | java | public static void styleEditable(@NonNull Context ctx, @NonNull Editable editable) {
styleEditable(ctx, null, editable, null, null);
} | [
"public",
"static",
"void",
"styleEditable",
"(",
"@",
"NonNull",
"Context",
"ctx",
",",
"@",
"NonNull",
"Editable",
"editable",
")",
"{",
"styleEditable",
"(",
"ctx",
",",
"null",
",",
"editable",
",",
"null",
",",
"null",
")",
";",
"}"
] | Iterates over the editable once and replace icon font placeholders with the correct mapping.
Afterwards it will apply the styles | [
"Iterates",
"over",
"the",
"editable",
"once",
"and",
"replace",
"icon",
"font",
"placeholders",
"with",
"the",
"correct",
"mapping",
".",
"Afterwards",
"it",
"will",
"apply",
"the",
"styles"
] | train | https://github.com/mikepenz/Android-Iconics/blob/0b2c8f7d07b6d2715a417563c66311e7e1fcc7d8/library-core/src/main/java/com/mikepenz/iconics/Iconics.java#L235-L237 |
stripe/stripe-android | stripe/src/main/java/com/stripe/android/view/StripeEditText.java | StripeEditText.setHintDelayed | public void setHintDelayed(@StringRes final int hintResource, long delayMilliseconds) {
final Runnable hintRunnable = new Runnable() {
@Override
public void run() {
setHint(hintResource);
}
};
mHandler.postDelayed(hintRunnable, delayMilliseconds);
} | java | public void setHintDelayed(@StringRes final int hintResource, long delayMilliseconds) {
final Runnable hintRunnable = new Runnable() {
@Override
public void run() {
setHint(hintResource);
}
};
mHandler.postDelayed(hintRunnable, delayMilliseconds);
} | [
"public",
"void",
"setHintDelayed",
"(",
"@",
"StringRes",
"final",
"int",
"hintResource",
",",
"long",
"delayMilliseconds",
")",
"{",
"final",
"Runnable",
"hintRunnable",
"=",
"new",
"Runnable",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"run",
"(",
... | Change the hint value of this control after a delay.
@param hintResource the string resource for the hint to be set
@param delayMilliseconds a delay period, measured in milliseconds | [
"Change",
"the",
"hint",
"value",
"of",
"this",
"control",
"after",
"a",
"delay",
"."
] | train | https://github.com/stripe/stripe-android/blob/0f199255f3769a3b84583fe3ace47bfae8c3b1c8/stripe/src/main/java/com/stripe/android/view/StripeEditText.java#L140-L148 |
to2mbn/JMCCC | jmccc/src/main/java/org/to2mbn/jmccc/util/ExtraArgumentsTemplates.java | ExtraArgumentsTemplates.OSX_DOCK_ICON | public static String OSX_DOCK_ICON(MinecraftDirectory minecraftDir, Set<Asset> assetIndex) {
Objects.requireNonNull(minecraftDir);
Objects.requireNonNull(assetIndex);
for (Asset asset : assetIndex) {
if ("icons/minecraft.icns".equals(asset.getVirtualPath())) {
return "-Xdock:icon=" + minecraftDir.getAsset(asset).getAbsolutePath();
}
}
return null;
} | java | public static String OSX_DOCK_ICON(MinecraftDirectory minecraftDir, Set<Asset> assetIndex) {
Objects.requireNonNull(minecraftDir);
Objects.requireNonNull(assetIndex);
for (Asset asset : assetIndex) {
if ("icons/minecraft.icns".equals(asset.getVirtualPath())) {
return "-Xdock:icon=" + minecraftDir.getAsset(asset).getAbsolutePath();
}
}
return null;
} | [
"public",
"static",
"String",
"OSX_DOCK_ICON",
"(",
"MinecraftDirectory",
"minecraftDir",
",",
"Set",
"<",
"Asset",
">",
"assetIndex",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"minecraftDir",
")",
";",
"Objects",
".",
"requireNonNull",
"(",
"assetIndex",
... | Caution: This option is available only on OSX.
@param minecraftDir the minecraft directory
@param assetIndex the asset index
@return a <code>-Xdock:icon</code> option, null if the assets cannot be resolved
@see #OSX_DOCK_ICON(MinecraftDirectory, Version)
@see #OSX_DOCK_NAME | [
"Caution",
":",
"This",
"option",
"is",
"available",
"only",
"on",
"OSX",
"."
] | train | https://github.com/to2mbn/JMCCC/blob/17e5b1b56ff18255cfd60976dca1a24598946647/jmccc/src/main/java/org/to2mbn/jmccc/util/ExtraArgumentsTemplates.java#L42-L51 |
wcm-io/wcm-io-handler | link/src/main/java/io/wcm/handler/link/type/helpers/InternalLinkResolver.java | InternalLinkResolver.getTargetPage | private Page getTargetPage(String targetPath, InternalLinkResolverOptions options) {
if (StringUtils.isEmpty(targetPath)) {
return null;
}
// Rewrite target to current site context
String rewrittenPath;
if (options.isRewritePathToContext() && !useTargetContext(options)) {
rewrittenPath = urlHandler.rewritePathToContext(SyntheticNavigatableResource.get(targetPath, resourceResolver));
}
else {
rewrittenPath = targetPath;
}
if (StringUtils.isEmpty(rewrittenPath)) {
return null;
}
// Get target page referenced by target path and check for acceptance
Page targetPage = pageManager.getPage(rewrittenPath);
if (acceptPage(targetPage, options)) {
return targetPage;
}
else {
return null;
}
} | java | private Page getTargetPage(String targetPath, InternalLinkResolverOptions options) {
if (StringUtils.isEmpty(targetPath)) {
return null;
}
// Rewrite target to current site context
String rewrittenPath;
if (options.isRewritePathToContext() && !useTargetContext(options)) {
rewrittenPath = urlHandler.rewritePathToContext(SyntheticNavigatableResource.get(targetPath, resourceResolver));
}
else {
rewrittenPath = targetPath;
}
if (StringUtils.isEmpty(rewrittenPath)) {
return null;
}
// Get target page referenced by target path and check for acceptance
Page targetPage = pageManager.getPage(rewrittenPath);
if (acceptPage(targetPage, options)) {
return targetPage;
}
else {
return null;
}
} | [
"private",
"Page",
"getTargetPage",
"(",
"String",
"targetPath",
",",
"InternalLinkResolverOptions",
"options",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"targetPath",
")",
")",
"{",
"return",
"null",
";",
"}",
"// Rewrite target to current site conte... | Returns the target page for the given internal content link reference.
Checks validity of page.
@param targetPath Repository path
@return Target page or null if target reference is invalid. | [
"Returns",
"the",
"target",
"page",
"for",
"the",
"given",
"internal",
"content",
"link",
"reference",
".",
"Checks",
"validity",
"of",
"page",
"."
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/link/src/main/java/io/wcm/handler/link/type/helpers/InternalLinkResolver.java#L244-L270 |
primefaces-extensions/core | src/main/java/org/primefaces/extensions/util/JavascriptVarBuilder.java | JavascriptVarBuilder.appendRowColProperty | public JavascriptVarBuilder appendRowColProperty(final int row, final int col, final String propertyValue, final boolean quoted) {
return appendProperty("r" + row + "_c" + col, propertyValue, quoted);
} | java | public JavascriptVarBuilder appendRowColProperty(final int row, final int col, final String propertyValue, final boolean quoted) {
return appendProperty("r" + row + "_c" + col, propertyValue, quoted);
} | [
"public",
"JavascriptVarBuilder",
"appendRowColProperty",
"(",
"final",
"int",
"row",
",",
"final",
"int",
"col",
",",
"final",
"String",
"propertyValue",
",",
"final",
"boolean",
"quoted",
")",
"{",
"return",
"appendProperty",
"(",
"\"r\"",
"+",
"row",
"+",
"... | appends a property with the name "rYY_cXX" where YY is the row and XX is he column.
@param row
@param col
@param propertyValue
@param quoted
@return | [
"appends",
"a",
"property",
"with",
"the",
"name",
"rYY_cXX",
"where",
"YY",
"is",
"the",
"row",
"and",
"XX",
"is",
"he",
"column",
"."
] | train | https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/util/JavascriptVarBuilder.java#L95-L97 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AlignmentTools.java | AlignmentTools.replaceOptAln | public static AFPChain replaceOptAln(int[][][] newAlgn, AFPChain afpChain, Atom[] ca1, Atom[] ca2) throws StructureException {
//The order is the number of groups in the newAlgn
int order = newAlgn.length;
//Calculate the alignment length from all the subunits lengths
int[] optLens = new int[order];
for(int s=0;s<order;s++) {
optLens[s] = newAlgn[s][0].length;
}
int optLength = 0;
for(int s=0;s<order;s++) {
optLength += optLens[s];
}
//Create a copy of the original AFPChain and set everything needed for the structure update
AFPChain copyAFP = (AFPChain) afpChain.clone();
//Set the new parameters of the optimal alignment
copyAFP.setOptLength(optLength);
copyAFP.setOptLen(optLens);
copyAFP.setOptAln(newAlgn);
//Set the block information of the new alignment
copyAFP.setBlockNum(order);
copyAFP.setBlockSize(optLens);
copyAFP.setBlockResList(newAlgn);
copyAFP.setBlockResSize(optLens);
copyAFP.setBlockGap(calculateBlockGap(newAlgn));
//Recalculate properties: superposition, tm-score, etc
Atom[] ca2clone = StructureTools.cloneAtomArray(ca2); // don't modify ca2 positions
AlignmentTools.updateSuperposition(copyAFP, ca1, ca2clone);
//It re-does the sequence alignment strings from the OptAlgn information only
copyAFP.setAlnsymb(null);
AFPAlignmentDisplay.getAlign(copyAFP, ca1, ca2clone);
return copyAFP;
} | java | public static AFPChain replaceOptAln(int[][][] newAlgn, AFPChain afpChain, Atom[] ca1, Atom[] ca2) throws StructureException {
//The order is the number of groups in the newAlgn
int order = newAlgn.length;
//Calculate the alignment length from all the subunits lengths
int[] optLens = new int[order];
for(int s=0;s<order;s++) {
optLens[s] = newAlgn[s][0].length;
}
int optLength = 0;
for(int s=0;s<order;s++) {
optLength += optLens[s];
}
//Create a copy of the original AFPChain and set everything needed for the structure update
AFPChain copyAFP = (AFPChain) afpChain.clone();
//Set the new parameters of the optimal alignment
copyAFP.setOptLength(optLength);
copyAFP.setOptLen(optLens);
copyAFP.setOptAln(newAlgn);
//Set the block information of the new alignment
copyAFP.setBlockNum(order);
copyAFP.setBlockSize(optLens);
copyAFP.setBlockResList(newAlgn);
copyAFP.setBlockResSize(optLens);
copyAFP.setBlockGap(calculateBlockGap(newAlgn));
//Recalculate properties: superposition, tm-score, etc
Atom[] ca2clone = StructureTools.cloneAtomArray(ca2); // don't modify ca2 positions
AlignmentTools.updateSuperposition(copyAFP, ca1, ca2clone);
//It re-does the sequence alignment strings from the OptAlgn information only
copyAFP.setAlnsymb(null);
AFPAlignmentDisplay.getAlign(copyAFP, ca1, ca2clone);
return copyAFP;
} | [
"public",
"static",
"AFPChain",
"replaceOptAln",
"(",
"int",
"[",
"]",
"[",
"]",
"[",
"]",
"newAlgn",
",",
"AFPChain",
"afpChain",
",",
"Atom",
"[",
"]",
"ca1",
",",
"Atom",
"[",
"]",
"ca2",
")",
"throws",
"StructureException",
"{",
"//The order is the num... | It replaces an optimal alignment of an AFPChain and calculates all the new alignment scores and variables. | [
"It",
"replaces",
"an",
"optimal",
"alignment",
"of",
"an",
"AFPChain",
"and",
"calculates",
"all",
"the",
"new",
"alignment",
"scores",
"and",
"variables",
"."
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AlignmentTools.java#L698-L737 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Network.java | Network.createSubnetwork | public Operation createSubnetwork(
SubnetworkId subnetworkId, String ipRange, OperationOption... options) {
return compute.create(SubnetworkInfo.of(subnetworkId, getNetworkId(), ipRange), options);
} | java | public Operation createSubnetwork(
SubnetworkId subnetworkId, String ipRange, OperationOption... options) {
return compute.create(SubnetworkInfo.of(subnetworkId, getNetworkId(), ipRange), options);
} | [
"public",
"Operation",
"createSubnetwork",
"(",
"SubnetworkId",
"subnetworkId",
",",
"String",
"ipRange",
",",
"OperationOption",
"...",
"options",
")",
"{",
"return",
"compute",
".",
"create",
"(",
"SubnetworkInfo",
".",
"of",
"(",
"subnetworkId",
",",
"getNetwor... | Creates a subnetwork for this network given its identity and the range of IPv4 addresses in
CIDR format. Subnetwork creation is only supported for networks in "custom subnet mode" (i.e.
{@link #getConfiguration()} returns a {@link SubnetNetworkConfiguration}) with automatic
creation of subnetworks disabled (i.e. {@link
SubnetNetworkConfiguration#autoCreateSubnetworks()} returns {@code false}).
@return an operation object if creation request was successfully sent
@throws ComputeException upon failure
@see <a href="https://wikipedia.org/wiki/Classless_Inter-Domain_Routing">CIDR</a> | [
"Creates",
"a",
"subnetwork",
"for",
"this",
"network",
"given",
"its",
"identity",
"and",
"the",
"range",
"of",
"IPv4",
"addresses",
"in",
"CIDR",
"format",
".",
"Subnetwork",
"creation",
"is",
"only",
"supported",
"for",
"networks",
"in",
"custom",
"subnet",... | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Network.java#L148-L151 |
Jasig/uPortal | uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/ParameterEditManager.java | ParameterEditManager.removeParmEditDirective | public static void removeParmEditDirective(String targetId, String name, IPerson person)
throws PortalException {
Document plf = (Document) person.getAttribute(Constants.PLF);
Element parmSet = getParmEditSet(plf, person, false);
if (parmSet == null) return; // no set so no edit to remove
NodeList edits = parmSet.getChildNodes();
for (int i = 0; i < edits.getLength(); i++) {
Element edit = (Element) edits.item(i);
if (edit.getAttribute(Constants.ATT_TARGET).equals(targetId)
&& edit.getAttribute(Constants.ATT_NAME).equals(name)) {
parmSet.removeChild(edit);
break;
}
}
if (parmSet.getChildNodes().getLength() == 0) // no more edits, remove
{
Node parent = parmSet.getParentNode();
parent.removeChild(parmSet);
}
} | java | public static void removeParmEditDirective(String targetId, String name, IPerson person)
throws PortalException {
Document plf = (Document) person.getAttribute(Constants.PLF);
Element parmSet = getParmEditSet(plf, person, false);
if (parmSet == null) return; // no set so no edit to remove
NodeList edits = parmSet.getChildNodes();
for (int i = 0; i < edits.getLength(); i++) {
Element edit = (Element) edits.item(i);
if (edit.getAttribute(Constants.ATT_TARGET).equals(targetId)
&& edit.getAttribute(Constants.ATT_NAME).equals(name)) {
parmSet.removeChild(edit);
break;
}
}
if (parmSet.getChildNodes().getLength() == 0) // no more edits, remove
{
Node parent = parmSet.getParentNode();
parent.removeChild(parmSet);
}
} | [
"public",
"static",
"void",
"removeParmEditDirective",
"(",
"String",
"targetId",
",",
"String",
"name",
",",
"IPerson",
"person",
")",
"throws",
"PortalException",
"{",
"Document",
"plf",
"=",
"(",
"Document",
")",
"person",
".",
"getAttribute",
"(",
"Constants... | Remove a parameter edit directive from the parameter edits set for applying user specified
values to a named parameter of an incorporated channel represented by the passed-in target
id. If one doesn't exists for that node and that name then this call returns without any
effects. | [
"Remove",
"a",
"parameter",
"edit",
"directive",
"from",
"the",
"parameter",
"edits",
"set",
"for",
"applying",
"user",
"specified",
"values",
"to",
"a",
"named",
"parameter",
"of",
"an",
"incorporated",
"channel",
"represented",
"by",
"the",
"passed",
"-",
"i... | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/ParameterEditManager.java#L275-L297 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/lss/LssClient.java | LssClient.resumeDomainStream | public ResumeDomainStreamResponse resumeDomainStream(ResumeDomainStreamRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
checkStringNotEmpty(request.getDomain(), "Domain should NOT be empty.");
checkStringNotEmpty(request.getApp(), "App should NOT be empty.");
checkStringNotEmpty(request.getStream(), "Stream should NOT be empty.");
InternalRequest internalRequest = createRequest(HttpMethodName.PUT,
request, LIVE_DOMAIN, request.getDomain(),
LIVE_APP, request.getApp(),
LIVE_STREAM, request.getStream());
internalRequest.addParameter(RESUME, null);
return invokeHttpClient(internalRequest, ResumeDomainStreamResponse.class);
} | java | public ResumeDomainStreamResponse resumeDomainStream(ResumeDomainStreamRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
checkStringNotEmpty(request.getDomain(), "Domain should NOT be empty.");
checkStringNotEmpty(request.getApp(), "App should NOT be empty.");
checkStringNotEmpty(request.getStream(), "Stream should NOT be empty.");
InternalRequest internalRequest = createRequest(HttpMethodName.PUT,
request, LIVE_DOMAIN, request.getDomain(),
LIVE_APP, request.getApp(),
LIVE_STREAM, request.getStream());
internalRequest.addParameter(RESUME, null);
return invokeHttpClient(internalRequest, ResumeDomainStreamResponse.class);
} | [
"public",
"ResumeDomainStreamResponse",
"resumeDomainStream",
"(",
"ResumeDomainStreamRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"The parameter request should NOT be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getDomain",
"(",
... | pause domain's stream in the live stream service.
@param request The request object containing all options for pause a domain's stream
@return the response | [
"pause",
"domain",
"s",
"stream",
"in",
"the",
"live",
"stream",
"service",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1533-L1546 |
magro/memcached-session-manager | javolution-serializer/src/main/java/de/javakaffee/web/msm/serializer/javolution/JavolutionTranscoder.java | JavolutionTranscoder.deserializeAttributes | @Override
public ConcurrentMap<String, Object> deserializeAttributes(final byte[] in ) {
if ( LOG.isDebugEnabled() ) {
LOG.debug( "Reading serialized data:\n" + new String( in ) );
}
return doDeserialize( in, "attributes" );
} | java | @Override
public ConcurrentMap<String, Object> deserializeAttributes(final byte[] in ) {
if ( LOG.isDebugEnabled() ) {
LOG.debug( "Reading serialized data:\n" + new String( in ) );
}
return doDeserialize( in, "attributes" );
} | [
"@",
"Override",
"public",
"ConcurrentMap",
"<",
"String",
",",
"Object",
">",
"deserializeAttributes",
"(",
"final",
"byte",
"[",
"]",
"in",
")",
"{",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Reading seri... | Get the object represented by the given serialized bytes.
@param in
the bytes to deserialize
@return the resulting object | [
"Get",
"the",
"object",
"represented",
"by",
"the",
"given",
"serialized",
"bytes",
"."
] | train | https://github.com/magro/memcached-session-manager/blob/716e147c9840ab10298c4d2b9edd0662058331e6/javolution-serializer/src/main/java/de/javakaffee/web/msm/serializer/javolution/JavolutionTranscoder.java#L154-L162 |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/natures/SARLProjectConfigurator.java | SARLProjectConfigurator.safeRefresh | @SuppressWarnings("static-method")
protected void safeRefresh(IProject project, IProgressMonitor monitor) {
try {
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
} catch (CoreException exception) {
SARLEclipsePlugin.getDefault().log(exception);
}
} | java | @SuppressWarnings("static-method")
protected void safeRefresh(IProject project, IProgressMonitor monitor) {
try {
project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
} catch (CoreException exception) {
SARLEclipsePlugin.getDefault().log(exception);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"void",
"safeRefresh",
"(",
"IProject",
"project",
",",
"IProgressMonitor",
"monitor",
")",
"{",
"try",
"{",
"project",
".",
"refreshLocal",
"(",
"IResource",
".",
"DEPTH_INFINITE",
",",
"monitor... | Refresh the project file hierarchy.
@param project the project.
@param monitor the progress monitor. | [
"Refresh",
"the",
"project",
"file",
"hierarchy",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/natures/SARLProjectConfigurator.java#L197-L204 |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/bic/internaleventdispatching/AgentInternalEventsDispatcher.java | AgentInternalEventsDispatcher.immediateDispatchTo | public void immediateDispatchTo(Object listener, Event event) {
assert event != null;
Iterable<BehaviorGuardEvaluator> behaviorGuardEvaluators = null;
synchronized (this.behaviorGuardEvaluatorRegistry) {
behaviorGuardEvaluators = AgentInternalEventsDispatcher.this.behaviorGuardEvaluatorRegistry
.getBehaviorGuardEvaluatorsFor(event, listener);
}
if (behaviorGuardEvaluators != null) {
final Collection<Runnable> behaviorsMethodsToExecute;
try {
behaviorsMethodsToExecute = evaluateGuards(event, behaviorGuardEvaluators);
executeBehaviorMethodsInParalellWithSynchroAtTheEnd(behaviorsMethodsToExecute);
} catch (RuntimeException exception) {
throw exception;
} catch (InterruptedException | ExecutionException | InvocationTargetException e) {
throw new RuntimeException(e);
}
}
} | java | public void immediateDispatchTo(Object listener, Event event) {
assert event != null;
Iterable<BehaviorGuardEvaluator> behaviorGuardEvaluators = null;
synchronized (this.behaviorGuardEvaluatorRegistry) {
behaviorGuardEvaluators = AgentInternalEventsDispatcher.this.behaviorGuardEvaluatorRegistry
.getBehaviorGuardEvaluatorsFor(event, listener);
}
if (behaviorGuardEvaluators != null) {
final Collection<Runnable> behaviorsMethodsToExecute;
try {
behaviorsMethodsToExecute = evaluateGuards(event, behaviorGuardEvaluators);
executeBehaviorMethodsInParalellWithSynchroAtTheEnd(behaviorsMethodsToExecute);
} catch (RuntimeException exception) {
throw exception;
} catch (InterruptedException | ExecutionException | InvocationTargetException e) {
throw new RuntimeException(e);
}
}
} | [
"public",
"void",
"immediateDispatchTo",
"(",
"Object",
"listener",
",",
"Event",
"event",
")",
"{",
"assert",
"event",
"!=",
"null",
";",
"Iterable",
"<",
"BehaviorGuardEvaluator",
">",
"behaviorGuardEvaluators",
"=",
"null",
";",
"synchronized",
"(",
"this",
"... | Posts an event to the registered {@code BehaviorGuardEvaluator} of the given listener only.
The dispatch of this event will be done synchronously.
This method will return successfully after the event has been posted to all {@code BehaviorGuardEvaluator}, and regardless
of any exceptions thrown by {@code BehaviorGuardEvaluator}.
@param listener the listener to dispatch to.
@param event an event to dispatch synchronously. | [
"Posts",
"an",
"event",
"to",
"the",
"registered",
"{",
"@code",
"BehaviorGuardEvaluator",
"}",
"of",
"the",
"given",
"listener",
"only",
".",
"The",
"dispatch",
"of",
"this",
"event",
"will",
"be",
"done",
"synchronously",
".",
"This",
"method",
"will",
"re... | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/bic/internaleventdispatching/AgentInternalEventsDispatcher.java#L187-L206 |
tiesebarrell/process-assertions | process-assertions-api/src/main/java/org/toxos/processassertions/api/ProcessAssert.java | ProcessAssert.assertProcessInActivity | public static final void assertProcessInActivity(final String processInstanceId, final String activityId) {
Validate.notNull(processInstanceId);
Validate.notNull(activityId);
apiCallback.debug(LogMessage.PROCESS_15, processInstanceId, activityId);
try {
getProcessInstanceAssertable().processIsInActivity(processInstanceId, activityId);
} catch (final AssertionError ae) {
apiCallback.fail(ae, LogMessage.ERROR_PROCESS_6, processInstanceId, activityId);
}
} | java | public static final void assertProcessInActivity(final String processInstanceId, final String activityId) {
Validate.notNull(processInstanceId);
Validate.notNull(activityId);
apiCallback.debug(LogMessage.PROCESS_15, processInstanceId, activityId);
try {
getProcessInstanceAssertable().processIsInActivity(processInstanceId, activityId);
} catch (final AssertionError ae) {
apiCallback.fail(ae, LogMessage.ERROR_PROCESS_6, processInstanceId, activityId);
}
} | [
"public",
"static",
"final",
"void",
"assertProcessInActivity",
"(",
"final",
"String",
"processInstanceId",
",",
"final",
"String",
"activityId",
")",
"{",
"Validate",
".",
"notNull",
"(",
"processInstanceId",
")",
";",
"Validate",
".",
"notNull",
"(",
"activityI... | Asserts the process instance with the provided id is active and in (at lease) an activity with the provided id.
@param processInstanceId
the process instance's id to check for. May not be <code>null</code>
@param activityId
the activity's id to check for. May not be <code>null</code> | [
"Asserts",
"the",
"process",
"instance",
"with",
"the",
"provided",
"id",
"is",
"active",
"and",
"in",
"(",
"at",
"lease",
")",
"an",
"activity",
"with",
"the",
"provided",
"id",
"."
] | train | https://github.com/tiesebarrell/process-assertions/blob/932a8443982e356cdf5a230165a35c725d9306ab/process-assertions-api/src/main/java/org/toxos/processassertions/api/ProcessAssert.java#L100-L110 |
soulgalore/crawler | src/main/java/com/soulgalore/crawler/util/HTTPSFaker.java | HTTPSFaker.getClientThatAllowAnyHTTPS | @SuppressWarnings("deprecation")
public static DefaultHttpClient getClientThatAllowAnyHTTPS(ThreadSafeClientConnManager cm) {
final TrustManager easyTrustManager = new X509TrustManager() {
public void checkClientTrusted(X509Certificate[] xcs, String string)
throws CertificateException {}
public void checkServerTrusted(X509Certificate[] xcs, String string)
throws CertificateException {}
public X509Certificate[] getAcceptedIssuers() {
return null;
}
};
final X509HostnameVerifier easyVerifier = new X509HostnameVerifier() {
public boolean verify(String string, SSLSession ssls) {
return true;
}
public void verify(String string, SSLSocket ssls) throws IOException {}
public void verify(String string, String[] strings, String[] strings1) throws SSLException {}
public void verify(String string, X509Certificate xc) throws SSLException {}
};
SSLContext ctx = null;
try {
ctx = SSLContext.getInstance("TLS");
ctx.init(null, new TrustManager[] {easyTrustManager}, null);
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (KeyManagementException e) {
throw new RuntimeException(e);
}
final SSLSocketFactory ssf = new SSLSocketFactory(ctx);
ssf.setHostnameVerifier(easyVerifier);
cm.getSchemeRegistry().register(new Scheme(HTTPS, ssf, HTTPS_PORT));
return new DefaultHttpClient(cm);
} | java | @SuppressWarnings("deprecation")
public static DefaultHttpClient getClientThatAllowAnyHTTPS(ThreadSafeClientConnManager cm) {
final TrustManager easyTrustManager = new X509TrustManager() {
public void checkClientTrusted(X509Certificate[] xcs, String string)
throws CertificateException {}
public void checkServerTrusted(X509Certificate[] xcs, String string)
throws CertificateException {}
public X509Certificate[] getAcceptedIssuers() {
return null;
}
};
final X509HostnameVerifier easyVerifier = new X509HostnameVerifier() {
public boolean verify(String string, SSLSession ssls) {
return true;
}
public void verify(String string, SSLSocket ssls) throws IOException {}
public void verify(String string, String[] strings, String[] strings1) throws SSLException {}
public void verify(String string, X509Certificate xc) throws SSLException {}
};
SSLContext ctx = null;
try {
ctx = SSLContext.getInstance("TLS");
ctx.init(null, new TrustManager[] {easyTrustManager}, null);
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (KeyManagementException e) {
throw new RuntimeException(e);
}
final SSLSocketFactory ssf = new SSLSocketFactory(ctx);
ssf.setHostnameVerifier(easyVerifier);
cm.getSchemeRegistry().register(new Scheme(HTTPS, ssf, HTTPS_PORT));
return new DefaultHttpClient(cm);
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"static",
"DefaultHttpClient",
"getClientThatAllowAnyHTTPS",
"(",
"ThreadSafeClientConnManager",
"cm",
")",
"{",
"final",
"TrustManager",
"easyTrustManager",
"=",
"new",
"X509TrustManager",
"(",
")",
"{",
"... | Get a HttpClient that accept any HTTP certificate.
@param cm the connection manager to use when creating the new HttpClient
@return a httpClient that accept any HTTP certificate | [
"Get",
"a",
"HttpClient",
"that",
"accept",
"any",
"HTTP",
"certificate",
"."
] | train | https://github.com/soulgalore/crawler/blob/715ee7f1454eec14bebcb6d12563dfc32d9bbf48/src/main/java/com/soulgalore/crawler/util/HTTPSFaker.java#L61-L108 |
reactor/reactor-netty | src/main/java/reactor/netty/ByteBufMono.java | ByteBufMono.asByteBuffer | public final Mono<ByteBuffer> asByteBuffer() {
return handle((bb, sink) -> {
try {
sink.next(bb.nioBuffer());
}
catch (IllegalReferenceCountException e) {
sink.complete();
}
});
} | java | public final Mono<ByteBuffer> asByteBuffer() {
return handle((bb, sink) -> {
try {
sink.next(bb.nioBuffer());
}
catch (IllegalReferenceCountException e) {
sink.complete();
}
});
} | [
"public",
"final",
"Mono",
"<",
"ByteBuffer",
">",
"asByteBuffer",
"(",
")",
"{",
"return",
"handle",
"(",
"(",
"bb",
",",
"sink",
")",
"->",
"{",
"try",
"{",
"sink",
".",
"next",
"(",
"bb",
".",
"nioBuffer",
"(",
")",
")",
";",
"}",
"catch",
"("... | a {@link ByteBuffer} inbound {@link Mono}
@return a {@link ByteBuffer} inbound {@link Mono} | [
"a",
"{",
"@link",
"ByteBuffer",
"}",
"inbound",
"{",
"@link",
"Mono",
"}"
] | train | https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/ByteBufMono.java#L45-L54 |
jbundle/jbundle | main/calendar/src/main/java/org/jbundle/main/calendar/db/CalendarEntry.java | CalendarEntry.createSharedRecord | public Record createSharedRecord(Object objKey, RecordOwner recordOwner)
{
if (objKey instanceof Integer)
{
int iCalendarType = ((Integer)objKey).intValue();
if (iCalendarType == CalendarEntry.APPOINTMENT_ID)
return new Appointment(recordOwner);
if (iCalendarType == CalendarEntry.ANNIVERSARY_ID)
return new Anniversary(recordOwner);
}
return null;
} | java | public Record createSharedRecord(Object objKey, RecordOwner recordOwner)
{
if (objKey instanceof Integer)
{
int iCalendarType = ((Integer)objKey).intValue();
if (iCalendarType == CalendarEntry.APPOINTMENT_ID)
return new Appointment(recordOwner);
if (iCalendarType == CalendarEntry.ANNIVERSARY_ID)
return new Anniversary(recordOwner);
}
return null;
} | [
"public",
"Record",
"createSharedRecord",
"(",
"Object",
"objKey",
",",
"RecordOwner",
"recordOwner",
")",
"{",
"if",
"(",
"objKey",
"instanceof",
"Integer",
")",
"{",
"int",
"iCalendarType",
"=",
"(",
"(",
"Integer",
")",
"objKey",
")",
".",
"intValue",
"("... | Get the shared record that goes with this key.
(Always override this).
@param objKey The value that specifies the record type.
@return The correct (new) record for this type (or null if none). | [
"Get",
"the",
"shared",
"record",
"that",
"goes",
"with",
"this",
"key",
".",
"(",
"Always",
"override",
"this",
")",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/calendar/src/main/java/org/jbundle/main/calendar/db/CalendarEntry.java#L256-L267 |
appium/java-client | src/main/java/io/appium/java_client/TouchAction.java | TouchAction.waitAction | public T waitAction(WaitOptions waitOptions) {
ActionParameter action = new ActionParameter("wait", waitOptions);
parameterBuilder.add(action);
//noinspection unchecked
return (T) this;
} | java | public T waitAction(WaitOptions waitOptions) {
ActionParameter action = new ActionParameter("wait", waitOptions);
parameterBuilder.add(action);
//noinspection unchecked
return (T) this;
} | [
"public",
"T",
"waitAction",
"(",
"WaitOptions",
"waitOptions",
")",
"{",
"ActionParameter",
"action",
"=",
"new",
"ActionParameter",
"(",
"\"wait\"",
",",
"waitOptions",
")",
";",
"parameterBuilder",
".",
"add",
"(",
"action",
")",
";",
"//noinspection unchecked"... | Waits for specified amount of time to pass before continue to next touch action.
@param waitOptions see {@link WaitOptions}.
@return this TouchAction, for chaining. | [
"Waits",
"for",
"specified",
"amount",
"of",
"time",
"to",
"pass",
"before",
"continue",
"to",
"next",
"touch",
"action",
"."
] | train | https://github.com/appium/java-client/blob/5a17759b05d6fda8ef425b3ab6e766c73ed2e8df/src/main/java/io/appium/java_client/TouchAction.java#L139-L144 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/FeaturePyramid.java | FeaturePyramid.findLocalScaleSpaceMax | protected void findLocalScaleSpaceMax(PyramidFloat<T> ss, int layerID) {
int index0 = spaceIndex;
int index1 = (spaceIndex + 1) % 3;
int index2 = (spaceIndex + 2) % 3;
List<Point2D_I16> candidates = maximums[index1];
ImageBorder_F32 inten0 = (ImageBorder_F32) FactoryImageBorderAlgs.value(intensities[index0], 0);
GrayF32 inten1 = intensities[index1];
ImageBorder_F32 inten2 = (ImageBorder_F32) FactoryImageBorderAlgs.value(intensities[index2], 0);
float scale0 = (float) ss.scale[layerID - 1];
float scale1 = (float) ss.scale[layerID];
float scale2 = (float) ss.scale[layerID + 1];
float sigma0 = (float) ss.getSigma(layerID - 1);
float sigma1 = (float) ss.getSigma(layerID);
float sigma2 = (float) ss.getSigma(layerID + 1);
// not sure if this is the correct way to handle the change in scale
float ss0 = (float) (Math.pow(sigma0, scalePower)/scale0);
float ss1 = (float) (Math.pow(sigma1, scalePower)/scale1);
float ss2 = (float) (Math.pow(sigma2, scalePower)/scale2);
for (Point2D_I16 c : candidates) {
float val = ss1 * inten1.get(c.x, c.y);
// find pixel location in each image's local coordinate
int x0 = (int) (c.x * scale1 / scale0);
int y0 = (int) (c.y * scale1 / scale0);
int x2 = (int) (c.x * scale1 / scale2);
int y2 = (int) (c.y * scale1 / scale2);
if (checkMax(inten0, val / ss0, x0, y0) && checkMax(inten2, val / ss2, x2, y2)) {
// put features into the scale of the upper image
foundPoints.add(new ScalePoint(c.x * scale1, c.y * scale1, sigma1));
}
}
} | java | protected void findLocalScaleSpaceMax(PyramidFloat<T> ss, int layerID) {
int index0 = spaceIndex;
int index1 = (spaceIndex + 1) % 3;
int index2 = (spaceIndex + 2) % 3;
List<Point2D_I16> candidates = maximums[index1];
ImageBorder_F32 inten0 = (ImageBorder_F32) FactoryImageBorderAlgs.value(intensities[index0], 0);
GrayF32 inten1 = intensities[index1];
ImageBorder_F32 inten2 = (ImageBorder_F32) FactoryImageBorderAlgs.value(intensities[index2], 0);
float scale0 = (float) ss.scale[layerID - 1];
float scale1 = (float) ss.scale[layerID];
float scale2 = (float) ss.scale[layerID + 1];
float sigma0 = (float) ss.getSigma(layerID - 1);
float sigma1 = (float) ss.getSigma(layerID);
float sigma2 = (float) ss.getSigma(layerID + 1);
// not sure if this is the correct way to handle the change in scale
float ss0 = (float) (Math.pow(sigma0, scalePower)/scale0);
float ss1 = (float) (Math.pow(sigma1, scalePower)/scale1);
float ss2 = (float) (Math.pow(sigma2, scalePower)/scale2);
for (Point2D_I16 c : candidates) {
float val = ss1 * inten1.get(c.x, c.y);
// find pixel location in each image's local coordinate
int x0 = (int) (c.x * scale1 / scale0);
int y0 = (int) (c.y * scale1 / scale0);
int x2 = (int) (c.x * scale1 / scale2);
int y2 = (int) (c.y * scale1 / scale2);
if (checkMax(inten0, val / ss0, x0, y0) && checkMax(inten2, val / ss2, x2, y2)) {
// put features into the scale of the upper image
foundPoints.add(new ScalePoint(c.x * scale1, c.y * scale1, sigma1));
}
}
} | [
"protected",
"void",
"findLocalScaleSpaceMax",
"(",
"PyramidFloat",
"<",
"T",
">",
"ss",
",",
"int",
"layerID",
")",
"{",
"int",
"index0",
"=",
"spaceIndex",
";",
"int",
"index1",
"=",
"(",
"spaceIndex",
"+",
"1",
")",
"%",
"3",
";",
"int",
"index2",
"... | Searches the pyramid layers up and down to see if the found 2D features are also scale space maximums. | [
"Searches",
"the",
"pyramid",
"layers",
"up",
"and",
"down",
"to",
"see",
"if",
"the",
"found",
"2D",
"features",
"are",
"also",
"scale",
"space",
"maximums",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/interest/FeaturePyramid.java#L168-L206 |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/ChangeObjects.java | ChangeObjects.addAnnotationToMonomerNotation | public final static void addAnnotationToMonomerNotation(PolymerNotation polymer, int position, String annotation) {
polymer.getPolymerElements().getListOfElements().get(position).setAnnotation(annotation);
} | java | public final static void addAnnotationToMonomerNotation(PolymerNotation polymer, int position, String annotation) {
polymer.getPolymerElements().getListOfElements().get(position).setAnnotation(annotation);
} | [
"public",
"final",
"static",
"void",
"addAnnotationToMonomerNotation",
"(",
"PolymerNotation",
"polymer",
",",
"int",
"position",
",",
"String",
"annotation",
")",
"{",
"polymer",
".",
"getPolymerElements",
"(",
")",
".",
"getListOfElements",
"(",
")",
".",
"get",... | method to add an annotation to a MonomerNotation
@param polymer
PolymerNotation
@param position
position of the monomerNotation
@param annotation
new annotation | [
"method",
"to",
"add",
"an",
"annotation",
"to",
"a",
"MonomerNotation"
] | train | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L326-L328 |
googleapis/cloud-bigtable-client | bigtable-client-core-parent/bigtable-hbase/src/main/java/org/apache/hadoop/hbase/client/AbstractBigtableAdmin.java | AbstractBigtableAdmin.deleteColumn | @Deprecated
public void deleteColumn(String tableName, byte[] columnName) throws IOException {
deleteColumn(TableName.valueOf(tableName), columnName);
} | java | @Deprecated
public void deleteColumn(String tableName, byte[] columnName) throws IOException {
deleteColumn(TableName.valueOf(tableName), columnName);
} | [
"@",
"Deprecated",
"public",
"void",
"deleteColumn",
"(",
"String",
"tableName",
",",
"byte",
"[",
"]",
"columnName",
")",
"throws",
"IOException",
"{",
"deleteColumn",
"(",
"TableName",
".",
"valueOf",
"(",
"tableName",
")",
",",
"columnName",
")",
";",
"}"... | <p>deleteColumn.</p>
@param tableName a {@link java.lang.String} object.
@param columnName an array of byte.
@throws java.io.IOException if any. | [
"<p",
">",
"deleteColumn",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-hbase/src/main/java/org/apache/hadoop/hbase/client/AbstractBigtableAdmin.java#L645-L648 |
threerings/playn | android/src/playn/android/AndroidGraphics.java | AndroidGraphics.registerFont | public void registerFont(String path, String name, Font.Style style, String... ligatureGlyphs) {
try {
registerFont(platform.assets().getTypeface(path), name, style, ligatureGlyphs);
} catch (Exception e) {
platform.reportError("Failed to load font [name=" + name + ", path=" + path + "]", e);
}
} | java | public void registerFont(String path, String name, Font.Style style, String... ligatureGlyphs) {
try {
registerFont(platform.assets().getTypeface(path), name, style, ligatureGlyphs);
} catch (Exception e) {
platform.reportError("Failed to load font [name=" + name + ", path=" + path + "]", e);
}
} | [
"public",
"void",
"registerFont",
"(",
"String",
"path",
",",
"String",
"name",
",",
"Font",
".",
"Style",
"style",
",",
"String",
"...",
"ligatureGlyphs",
")",
"{",
"try",
"{",
"registerFont",
"(",
"platform",
".",
"assets",
"(",
")",
".",
"getTypeface",
... | Registers a font with the graphics system.
@param path the path to the font resource (relative to the asset manager's path prefix).
@param name the name under which to register the font.
@param style the style variant of the specified name provided by the font file. For example
one might {@code registerFont("myfont.ttf", "My Font", Font.Style.PLAIN)} and
{@code registerFont("myfontb.ttf", "My Font", Font.Style.BOLD)} to provide both the plain and
bold variants of a particular font.
@param ligatureGlyphs any known text sequences that are converted into a single ligature
character in this font. This works around an Android bug where measuring text for wrapping
that contains character sequences that are converted into ligatures (e.g. "fi" or "ae")
incorrectly reports the number of characters "consumed" from the to-be-wrapped string. | [
"Registers",
"a",
"font",
"with",
"the",
"graphics",
"system",
"."
] | train | https://github.com/threerings/playn/blob/c266eeb39188dcada4b00992a0d1199759e03d42/android/src/playn/android/AndroidGraphics.java#L94-L100 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java | QrCodeUtil.encode | public static BitMatrix encode(String content, int width, int height) {
return encode(content, BarcodeFormat.QR_CODE, width, height);
} | java | public static BitMatrix encode(String content, int width, int height) {
return encode(content, BarcodeFormat.QR_CODE, width, height);
} | [
"public",
"static",
"BitMatrix",
"encode",
"(",
"String",
"content",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"return",
"encode",
"(",
"content",
",",
"BarcodeFormat",
".",
"QR_CODE",
",",
"width",
",",
"height",
")",
";",
"}"
] | 将文本内容编码为二维码
@param content 文本内容
@param width 宽度
@param height 高度
@return {@link BitMatrix} | [
"将文本内容编码为二维码"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/qrcode/QrCodeUtil.java#L209-L211 |
dita-ot/dita-ot | src/main/java/org/dita/dost/writer/ConrefPushParser.java | ConrefPushParser.isPushedTypeMatch | private boolean isPushedTypeMatch(final DitaClass targetClassAttribute, final DocumentFragment content) {
DitaClass clazz = null;
if (content.hasChildNodes()) {
final NodeList nodeList = content.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
final Node node = nodeList.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) {
final Element elem = (Element) node;
clazz = new DitaClass(elem.getAttribute(ATTRIBUTE_NAME_CLASS));
break;
// get type of the target element
}
}
}
return targetClassAttribute.matches(clazz);
} | java | private boolean isPushedTypeMatch(final DitaClass targetClassAttribute, final DocumentFragment content) {
DitaClass clazz = null;
if (content.hasChildNodes()) {
final NodeList nodeList = content.getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
final Node node = nodeList.item(i);
if (node.getNodeType() == Node.ELEMENT_NODE) {
final Element elem = (Element) node;
clazz = new DitaClass(elem.getAttribute(ATTRIBUTE_NAME_CLASS));
break;
// get type of the target element
}
}
}
return targetClassAttribute.matches(clazz);
} | [
"private",
"boolean",
"isPushedTypeMatch",
"(",
"final",
"DitaClass",
"targetClassAttribute",
",",
"final",
"DocumentFragment",
"content",
")",
"{",
"DitaClass",
"clazz",
"=",
"null",
";",
"if",
"(",
"content",
".",
"hasChildNodes",
"(",
")",
")",
"{",
"final",
... | The function is to judge if the pushed content type march the type of content being pushed/replaced
@param targetClassAttribute the class attribute of target element which is being pushed
@param content pushedContent
@return boolean: if type match, return true, else return false | [
"The",
"function",
"is",
"to",
"judge",
"if",
"the",
"pushed",
"content",
"type",
"march",
"the",
"type",
"of",
"content",
"being",
"pushed",
"/",
"replaced"
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/writer/ConrefPushParser.java#L261-L278 |
rundeck/rundeck | core/src/main/java/com/dtolabs/shared/resources/ResourceXMLParser.java | ResourceXMLParser.parseEntProperties | private void parseEntProperties(final Entity ent, final Node node) throws ResourceXMLParserException {
if (null == entityProperties.get(node.getName())) {
throw new ResourceXMLParserException(
"Unexpected entity declaration: " + node.getName() + ": " + reportNodeErrorLocation(node));
}
final Element node1 = (Element) node;
//load all element attributes as properties
for (final Object o : node1.attributes()) {
final Attribute attr = (Attribute) o;
ent.properties.setProperty(attr.getName(), attr.getStringValue());
}
} | java | private void parseEntProperties(final Entity ent, final Node node) throws ResourceXMLParserException {
if (null == entityProperties.get(node.getName())) {
throw new ResourceXMLParserException(
"Unexpected entity declaration: " + node.getName() + ": " + reportNodeErrorLocation(node));
}
final Element node1 = (Element) node;
//load all element attributes as properties
for (final Object o : node1.attributes()) {
final Attribute attr = (Attribute) o;
ent.properties.setProperty(attr.getName(), attr.getStringValue());
}
} | [
"private",
"void",
"parseEntProperties",
"(",
"final",
"Entity",
"ent",
",",
"final",
"Node",
"node",
")",
"throws",
"ResourceXMLParserException",
"{",
"if",
"(",
"null",
"==",
"entityProperties",
".",
"get",
"(",
"node",
".",
"getName",
"(",
")",
")",
")",
... | Parse the DOM attributes as properties for the particular entity node type
@param ent Entity object
@param node entity DOM node
@throws ResourceXMLParserException if the DOM node is an unexpected tag name | [
"Parse",
"the",
"DOM",
"attributes",
"as",
"properties",
"for",
"the",
"particular",
"entity",
"node",
"type"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/shared/resources/ResourceXMLParser.java#L225-L236 |
jbundle/jbundle | thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/TaskProxy.java | TaskProxy.createRemoteReceiveQueue | public RemoteReceiveQueue createRemoteReceiveQueue(String strQueueName, String strQueueType) throws RemoteException
{
BaseTransport transport = this.createProxyTransport(CREATE_REMOTE_RECEIVE_QUEUE);
transport.addParam(MessageConstants.QUEUE_NAME, strQueueName);
transport.addParam(MessageConstants.QUEUE_TYPE, strQueueType);
String strID = (String)transport.sendMessageAndGetReply();
return new ReceiveQueueProxy(this, strID);
} | java | public RemoteReceiveQueue createRemoteReceiveQueue(String strQueueName, String strQueueType) throws RemoteException
{
BaseTransport transport = this.createProxyTransport(CREATE_REMOTE_RECEIVE_QUEUE);
transport.addParam(MessageConstants.QUEUE_NAME, strQueueName);
transport.addParam(MessageConstants.QUEUE_TYPE, strQueueType);
String strID = (String)transport.sendMessageAndGetReply();
return new ReceiveQueueProxy(this, strID);
} | [
"public",
"RemoteReceiveQueue",
"createRemoteReceiveQueue",
"(",
"String",
"strQueueName",
",",
"String",
"strQueueType",
")",
"throws",
"RemoteException",
"{",
"BaseTransport",
"transport",
"=",
"this",
".",
"createProxyTransport",
"(",
"CREATE_REMOTE_RECEIVE_QUEUE",
")",
... | Create a new remote receive queue.
@param strQueueName The queue name.
@param strQueueType The queue type (see MessageConstants). | [
"Create",
"a",
"new",
"remote",
"receive",
"queue",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/remote/proxy/TaskProxy.java#L129-L136 |
hawkular/hawkular-alerts | engine/src/main/java/org/hawkular/alerts/engine/impl/AlertsEngineCache.java | AlertsEngineCache.isDataIdActive | public boolean isDataIdActive(String tenantId, String dataId) {
return tenantId != null && dataId != null && activeDataIds.contains(new DataId(tenantId, dataId));
} | java | public boolean isDataIdActive(String tenantId, String dataId) {
return tenantId != null && dataId != null && activeDataIds.contains(new DataId(tenantId, dataId));
} | [
"public",
"boolean",
"isDataIdActive",
"(",
"String",
"tenantId",
",",
"String",
"dataId",
")",
"{",
"return",
"tenantId",
"!=",
"null",
"&&",
"dataId",
"!=",
"null",
"&&",
"activeDataIds",
".",
"contains",
"(",
"new",
"DataId",
"(",
"tenantId",
",",
"dataId... | Check if a specific dataId is active on this node
@param tenantId to check if has triggers deployed on this node
@param dataId to check if it has triggers deployed on this node
@return true if it is active
false otherwise | [
"Check",
"if",
"a",
"specific",
"dataId",
"is",
"active",
"on",
"this",
"node"
] | train | https://github.com/hawkular/hawkular-alerts/blob/b4a0c2909b38e03e72cc1828219562ee8fcbf426/engine/src/main/java/org/hawkular/alerts/engine/impl/AlertsEngineCache.java#L60-L62 |
DDTH/ddth-dao | ddth-dao-core/src/main/java/com/github/ddth/dao/jdbc/GenericMultiBoJdbcDao.java | GenericMultiBoJdbcDao.addDelegateDao | public <T> GenericMultiBoJdbcDao addDelegateDao(Class<T> clazz, IGenericBoDao<T> dao) {
delegateDaos.put(clazz, dao);
return this;
} | java | public <T> GenericMultiBoJdbcDao addDelegateDao(Class<T> clazz, IGenericBoDao<T> dao) {
delegateDaos.put(clazz, dao);
return this;
} | [
"public",
"<",
"T",
">",
"GenericMultiBoJdbcDao",
"addDelegateDao",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"IGenericBoDao",
"<",
"T",
">",
"dao",
")",
"{",
"delegateDaos",
".",
"put",
"(",
"clazz",
",",
"dao",
")",
";",
"return",
"this",
";",
"}"
] | Add a delegate dao to mapping list.
@param clazz
@param dao
@return | [
"Add",
"a",
"delegate",
"dao",
"to",
"mapping",
"list",
"."
] | train | https://github.com/DDTH/ddth-dao/blob/8d059ddf641a1629aa53851f9d1b41abf175a180/ddth-dao-core/src/main/java/com/github/ddth/dao/jdbc/GenericMultiBoJdbcDao.java#L75-L78 |
JOML-CI/JOML | src/org/joml/Matrix4d.java | Matrix4d.setPerspectiveRect | public Matrix4d setPerspectiveRect(double width, double height, double zNear, double zFar) {
return setPerspectiveRect(width, height, zNear, zFar, false);
} | java | public Matrix4d setPerspectiveRect(double width, double height, double zNear, double zFar) {
return setPerspectiveRect(width, height, zNear, zFar, false);
} | [
"public",
"Matrix4d",
"setPerspectiveRect",
"(",
"double",
"width",
",",
"double",
"height",
",",
"double",
"zNear",
",",
"double",
"zFar",
")",
"{",
"return",
"setPerspectiveRect",
"(",
"width",
",",
"height",
",",
"zNear",
",",
"zFar",
",",
"false",
")",
... | Set this matrix to be a symmetric perspective projection frustum transformation for a right-handed coordinate system
using OpenGL's NDC z range of <code>[-1..+1]</code>.
<p>
In order to apply the perspective projection transformation to an existing transformation,
use {@link #perspectiveRect(double, double, double, double) perspectiveRect()}.
@see #perspectiveRect(double, double, double, double)
@param width
the width of the near frustum plane
@param height
the height of the near frustum plane
@param zNear
near clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the near clipping plane will be at positive infinity.
In that case, <code>zFar</code> may not also be {@link Float#POSITIVE_INFINITY}.
@param zFar
far clipping plane distance. If the special value {@link Float#POSITIVE_INFINITY} is used, the far clipping plane will be at positive infinity.
In that case, <code>zNear</code> may not also be {@link Float#POSITIVE_INFINITY}.
@return this | [
"Set",
"this",
"matrix",
"to",
"be",
"a",
"symmetric",
"perspective",
"projection",
"frustum",
"transformation",
"for",
"a",
"right",
"-",
"handed",
"coordinate",
"system",
"using",
"OpenGL",
"s",
"NDC",
"z",
"range",
"of",
"<code",
">",
"[",
"-",
"1",
"..... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L12701-L12703 |
twitter/cloudhopper-commons | ch-commons-util/src/main/java/com/cloudhopper/commons/util/windowing/Window.java | Window.addListener | public void addListener(WindowListener<K,R,P> listener) {
this.listeners.addIfAbsent(new UnwrappedWeakReference<WindowListener<K,R,P>>(listener));
} | java | public void addListener(WindowListener<K,R,P> listener) {
this.listeners.addIfAbsent(new UnwrappedWeakReference<WindowListener<K,R,P>>(listener));
} | [
"public",
"void",
"addListener",
"(",
"WindowListener",
"<",
"K",
",",
"R",
",",
"P",
">",
"listener",
")",
"{",
"this",
".",
"listeners",
".",
"addIfAbsent",
"(",
"new",
"UnwrappedWeakReference",
"<",
"WindowListener",
"<",
"K",
",",
"R",
",",
"P",
">",... | Adds a new WindowListener if and only if it isn't already present.
@param listener The listener to add | [
"Adds",
"a",
"new",
"WindowListener",
"if",
"and",
"only",
"if",
"it",
"isn",
"t",
"already",
"present",
"."
] | train | https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/windowing/Window.java#L206-L208 |
astrapi69/jaulp-wicket | jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/form/RadioChoicesListView.java | RadioChoicesListView.newLabel | protected Label newLabel(final String id, final String label)
{
return ComponentFactory.newLabel(id, label);
} | java | protected Label newLabel(final String id, final String label)
{
return ComponentFactory.newLabel(id, label);
} | [
"protected",
"Label",
"newLabel",
"(",
"final",
"String",
"id",
",",
"final",
"String",
"label",
")",
"{",
"return",
"ComponentFactory",
".",
"newLabel",
"(",
"id",
",",
"label",
")",
";",
"}"
] | Factory method for creating the new {@link Label}. This method is invoked in the constructor
from the derived classes and can be overridden so users can provide their own version of a
new {@link Label}.
@param id
the id
@param label
the string for the label
@return the new {@link Label} | [
"Factory",
"method",
"for",
"creating",
"the",
"new",
"{",
"@link",
"Label",
"}",
".",
"This",
"method",
"is",
"invoked",
"in",
"the",
"constructor",
"from",
"the",
"derived",
"classes",
"and",
"can",
"be",
"overridden",
"so",
"users",
"can",
"provide",
"t... | train | https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/form/RadioChoicesListView.java#L103-L106 |
infinispan/infinispan | lucene/lucene-directory/src/main/java/org/infinispan/lucene/cacheloader/DirectoryLoaderAdaptor.java | DirectoryLoaderAdaptor.figureChunksNumber | public static int figureChunksNumber(final String fileName, final long fileLength, int chunkSize) {
if (chunkSize < 0) {
throw new IllegalStateException("Overflow in rescaling chunkSize. File way too large?");
}
final long numChunks = (fileLength % chunkSize == 0) ? (fileLength / chunkSize) : (fileLength / chunkSize) + 1;
if (numChunks > Integer.MAX_VALUE) {
log.rescalingChunksize(fileName, fileLength, chunkSize);
chunkSize = 32 * chunkSize;
return figureChunksNumber(fileName, fileLength, chunkSize);
}
else {
return (int)numChunks;
}
} | java | public static int figureChunksNumber(final String fileName, final long fileLength, int chunkSize) {
if (chunkSize < 0) {
throw new IllegalStateException("Overflow in rescaling chunkSize. File way too large?");
}
final long numChunks = (fileLength % chunkSize == 0) ? (fileLength / chunkSize) : (fileLength / chunkSize) + 1;
if (numChunks > Integer.MAX_VALUE) {
log.rescalingChunksize(fileName, fileLength, chunkSize);
chunkSize = 32 * chunkSize;
return figureChunksNumber(fileName, fileLength, chunkSize);
}
else {
return (int)numChunks;
}
} | [
"public",
"static",
"int",
"figureChunksNumber",
"(",
"final",
"String",
"fileName",
",",
"final",
"long",
"fileLength",
",",
"int",
"chunkSize",
")",
"{",
"if",
"(",
"chunkSize",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Overflow in... | Index segment files might be larger than 2GB; so it's possible to have an autoChunksize
which is too low to contain all bytes in a single array (overkill anyway).
In this case we ramp up and try splitting with larger chunkSize values. | [
"Index",
"segment",
"files",
"might",
"be",
"larger",
"than",
"2GB",
";",
"so",
"it",
"s",
"possible",
"to",
"have",
"an",
"autoChunksize",
"which",
"is",
"too",
"low",
"to",
"contain",
"all",
"bytes",
"in",
"a",
"single",
"array",
"(",
"overkill",
"anyw... | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/lucene-directory/src/main/java/org/infinispan/lucene/cacheloader/DirectoryLoaderAdaptor.java#L147-L160 |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/join/InnerJoinRecordReader.java | InnerJoinRecordReader.combine | protected boolean combine(Object[] srcs, TupleWritable dst) {
assert srcs.length == dst.size();
for (int i = 0; i < srcs.length; ++i) {
if (!dst.has(i)) {
return false;
}
}
return true;
} | java | protected boolean combine(Object[] srcs, TupleWritable dst) {
assert srcs.length == dst.size();
for (int i = 0; i < srcs.length; ++i) {
if (!dst.has(i)) {
return false;
}
}
return true;
} | [
"protected",
"boolean",
"combine",
"(",
"Object",
"[",
"]",
"srcs",
",",
"TupleWritable",
"dst",
")",
"{",
"assert",
"srcs",
".",
"length",
"==",
"dst",
".",
"size",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"srcs",
".",
"le... | Return true iff the tuple is full (all data sources contain this key). | [
"Return",
"true",
"iff",
"the",
"tuple",
"is",
"full",
"(",
"all",
"data",
"sources",
"contain",
"this",
"key",
")",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/join/InnerJoinRecordReader.java#L41-L49 |
deeplearning4j/deeplearning4j | datavec/datavec-spark/src/main/java/org/datavec/spark/storage/SparkStorageUtils.java | SparkStorageUtils.restoreSequenceFile | public static JavaRDD<List<Writable>> restoreSequenceFile(String path, JavaSparkContext sc) {
return restoreMapFile(path, sc).values();
} | java | public static JavaRDD<List<Writable>> restoreSequenceFile(String path, JavaSparkContext sc) {
return restoreMapFile(path, sc).values();
} | [
"public",
"static",
"JavaRDD",
"<",
"List",
"<",
"Writable",
">",
">",
"restoreSequenceFile",
"(",
"String",
"path",
",",
"JavaSparkContext",
"sc",
")",
"{",
"return",
"restoreMapFile",
"(",
"path",
",",
"sc",
")",
".",
"values",
"(",
")",
";",
"}"
] | Restore a {@code JavaRDD<List<Writable>>} previously saved with {@link #saveSequenceFile(String, JavaRDD)}
@param path Path of the sequence file
@param sc Spark context
@return The restored RDD | [
"Restore",
"a",
"{",
"@code",
"JavaRDD<List<Writable",
">>",
"}",
"previously",
"saved",
"with",
"{",
"@link",
"#saveSequenceFile",
"(",
"String",
"JavaRDD",
")",
"}"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/storage/SparkStorageUtils.java#L112-L114 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/ExpressionWindowed.java | ExpressionWindowed.voltAnnotateWindowedAggregateXML | public VoltXMLElement voltAnnotateWindowedAggregateXML(VoltXMLElement exp, SimpleColumnContext context)
throws HSQLParseException {
VoltXMLElement winspec = new VoltXMLElement("winspec");
exp.children.add(winspec);
if (m_partitionByList.size() > 0) {
VoltXMLElement pxe = new VoltXMLElement("partitionbyList");
winspec.children.add(pxe);
for (Expression e : m_partitionByList) {
pxe.children.add(e.voltGetXML(context, null));
}
}
VoltXMLElement rxe = new VoltXMLElement("orderbyList");
winspec.children.add(rxe);
if (m_sortAndSlice != null) {
for (int i = 0; i < m_sortAndSlice.exprList.size(); i++) {
Expression e = (Expression) m_sortAndSlice.exprList.get(i);
assert(e instanceof ExpressionOrderBy);
ExpressionOrderBy expr = (ExpressionOrderBy)e;
VoltXMLElement orderby = expr.voltGetXML(context, null);
boolean isDescending = expr.isDescending();
orderby.attributes.put("descending", isDescending ? "true": "false");
rxe.children.add(orderby);
}
}
return exp;
} | java | public VoltXMLElement voltAnnotateWindowedAggregateXML(VoltXMLElement exp, SimpleColumnContext context)
throws HSQLParseException {
VoltXMLElement winspec = new VoltXMLElement("winspec");
exp.children.add(winspec);
if (m_partitionByList.size() > 0) {
VoltXMLElement pxe = new VoltXMLElement("partitionbyList");
winspec.children.add(pxe);
for (Expression e : m_partitionByList) {
pxe.children.add(e.voltGetXML(context, null));
}
}
VoltXMLElement rxe = new VoltXMLElement("orderbyList");
winspec.children.add(rxe);
if (m_sortAndSlice != null) {
for (int i = 0; i < m_sortAndSlice.exprList.size(); i++) {
Expression e = (Expression) m_sortAndSlice.exprList.get(i);
assert(e instanceof ExpressionOrderBy);
ExpressionOrderBy expr = (ExpressionOrderBy)e;
VoltXMLElement orderby = expr.voltGetXML(context, null);
boolean isDescending = expr.isDescending();
orderby.attributes.put("descending", isDescending ? "true": "false");
rxe.children.add(orderby);
}
}
return exp;
} | [
"public",
"VoltXMLElement",
"voltAnnotateWindowedAggregateXML",
"(",
"VoltXMLElement",
"exp",
",",
"SimpleColumnContext",
"context",
")",
"throws",
"HSQLParseException",
"{",
"VoltXMLElement",
"winspec",
"=",
"new",
"VoltXMLElement",
"(",
"\"winspec\"",
")",
";",
"exp",
... | Create a VoltXMLElement for a windowed aggregate expression. The
children are parts of the expression. For example, consider the
expression <code>MAX(A+B) OVER (PARTITION BY E1, E2 ORDER BY E3 ASC)</code>.
There will be these children.
<ul>
<li>A child named "winspec" with the windowed specification. This
will have two children.
<ul>
<li>One will be named "partitionbyList", and will contain the
expressions E1 and E2.</li>
<li>The other will contain a list of expressions and sort orders
for the order by list, <E3, ASC>.</li>
</ul>
</li>
<li>All other children are the arguments to the aggregate. This
would be <code>A+B</code> in the expression above. Note that there are no
arguments to the rank functions, so this will be empty for the rank functions.
</ul>
@param exp
@param context
@return
@throws HSQLParseException | [
"Create",
"a",
"VoltXMLElement",
"for",
"a",
"windowed",
"aggregate",
"expression",
".",
"The",
"children",
"are",
"parts",
"of",
"the",
"expression",
".",
"For",
"example",
"consider",
"the",
"expression",
"<code",
">",
"MAX",
"(",
"A",
"+",
"B",
")",
"OV... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ExpressionWindowed.java#L234-L261 |
MGunlogson/CuckooFilter4J | src/main/java/com/github/mgunlogson/cuckoofilter4j/Utils.java | Utils.getBucketsNeeded | static long getBucketsNeeded(long maxKeys,double loadFactor,int bucketSize) {
/*
* force a power-of-two bucket count so hash functions for bucket index
* can hashBits%numBuckets and get randomly distributed index. See wiki
* "Modulo Bias". Only time we can get perfectly distributed index is
* when numBuckets is a power of 2.
*/
long bucketsNeeded = DoubleMath.roundToLong((1.0 / loadFactor) * maxKeys / bucketSize, RoundingMode.UP);
// get next biggest power of 2
long bitPos = Long.highestOneBit(bucketsNeeded);
if (bucketsNeeded > bitPos)
bitPos = bitPos << 1;
return bitPos;
} | java | static long getBucketsNeeded(long maxKeys,double loadFactor,int bucketSize) {
/*
* force a power-of-two bucket count so hash functions for bucket index
* can hashBits%numBuckets and get randomly distributed index. See wiki
* "Modulo Bias". Only time we can get perfectly distributed index is
* when numBuckets is a power of 2.
*/
long bucketsNeeded = DoubleMath.roundToLong((1.0 / loadFactor) * maxKeys / bucketSize, RoundingMode.UP);
// get next biggest power of 2
long bitPos = Long.highestOneBit(bucketsNeeded);
if (bucketsNeeded > bitPos)
bitPos = bitPos << 1;
return bitPos;
} | [
"static",
"long",
"getBucketsNeeded",
"(",
"long",
"maxKeys",
",",
"double",
"loadFactor",
",",
"int",
"bucketSize",
")",
"{",
"/*\r\n\t\t * force a power-of-two bucket count so hash functions for bucket index\r\n\t\t * can hashBits%numBuckets and get randomly distributed index. See wiki... | Calculates how many buckets are needed to hold the chosen number of keys,
taking the standard load factor into account.
@param maxKeys
the number of keys the filter is expected to hold before
insertion failure.
@return The number of buckets needed | [
"Calculates",
"how",
"many",
"buckets",
"are",
"needed",
"to",
"hold",
"the",
"chosen",
"number",
"of",
"keys",
"taking",
"the",
"standard",
"load",
"factor",
"into",
"account",
"."
] | train | https://github.com/MGunlogson/CuckooFilter4J/blob/e8472aa150b201f05046d1c81cac5a5ca4348db8/src/main/java/com/github/mgunlogson/cuckoofilter4j/Utils.java#L165-L178 |
junit-team/junit4 | src/main/java/org/junit/Assume.java | Assume.assumeThat | @Deprecated
public static <T> void assumeThat(T actual, Matcher<T> matcher) {
if (!matcher.matches(actual)) {
throw new AssumptionViolatedException(actual, matcher);
}
} | java | @Deprecated
public static <T> void assumeThat(T actual, Matcher<T> matcher) {
if (!matcher.matches(actual)) {
throw new AssumptionViolatedException(actual, matcher);
}
} | [
"@",
"Deprecated",
"public",
"static",
"<",
"T",
">",
"void",
"assumeThat",
"(",
"T",
"actual",
",",
"Matcher",
"<",
"T",
">",
"matcher",
")",
"{",
"if",
"(",
"!",
"matcher",
".",
"matches",
"(",
"actual",
")",
")",
"{",
"throw",
"new",
"AssumptionVi... | Call to assume that <code>actual</code> satisfies the condition specified by <code>matcher</code>.
If not, the test halts and is ignored.
Example:
<pre>:
assumeThat(1, is(1)); // passes
foo(); // will execute
assumeThat(0, is(1)); // assumption failure! test halts
int x = 1 / 0; // will never execute
</pre>
@param <T> the static type accepted by the matcher (this can flag obvious compile-time problems such as {@code assumeThat(1, is("a"))}
@param actual the computed value being compared
@param matcher an expression, built of {@link Matcher}s, specifying allowed values
@see org.hamcrest.CoreMatchers
@see org.junit.matchers.JUnitMatchers
@deprecated use {@code org.hamcrest.junit.MatcherAssume.assumeThat()} | [
"Call",
"to",
"assume",
"that",
"<code",
">",
"actual<",
"/",
"code",
">",
"satisfies",
"the",
"condition",
"specified",
"by",
"<code",
">",
"matcher<",
"/",
"code",
">",
".",
"If",
"not",
"the",
"test",
"halts",
"and",
"is",
"ignored",
".",
"Example",
... | train | https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/org/junit/Assume.java#L105-L110 |
salesforce/Argus | ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/AlertService.java | AlertService.updateNotification | public Notification updateNotification(BigInteger alertId, BigInteger notificationId, Notification notification) throws IOException, TokenExpiredException {
String requestUrl = RESOURCE + "/" + alertId.toString() + "/notifications/" + notificationId.toString();
ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.PUT, requestUrl, notification);
assertValidResponse(response, requestUrl);
return fromJson(response.getResult(), Notification.class);
} | java | public Notification updateNotification(BigInteger alertId, BigInteger notificationId, Notification notification) throws IOException, TokenExpiredException {
String requestUrl = RESOURCE + "/" + alertId.toString() + "/notifications/" + notificationId.toString();
ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.PUT, requestUrl, notification);
assertValidResponse(response, requestUrl);
return fromJson(response.getResult(), Notification.class);
} | [
"public",
"Notification",
"updateNotification",
"(",
"BigInteger",
"alertId",
",",
"BigInteger",
"notificationId",
",",
"Notification",
"notification",
")",
"throws",
"IOException",
",",
"TokenExpiredException",
"{",
"String",
"requestUrl",
"=",
"RESOURCE",
"+",
"\"/\""... | Updates an existing notification.
@param alertId The ID of the alert that owns the notification.
@param notificationId The ID of the notification to update.
@param notification The updated notification information.
@return The updated notification.
@throws IOException If the server cannot be reached.
@throws TokenExpiredException If the token sent along with the request has expired | [
"Updates",
"an",
"existing",
"notification",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/AlertService.java#L297-L303 |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/boosting/WaggingNormal.java | WaggingNormal.setMean | public void setMean(double mean)
{
if(Double.isInfinite(mean) || Double.isNaN(mean))
throw new ArithmeticException("Mean must be a real number, not " + mean);
((Normal)getDistribution()).setMean(mean);
} | java | public void setMean(double mean)
{
if(Double.isInfinite(mean) || Double.isNaN(mean))
throw new ArithmeticException("Mean must be a real number, not " + mean);
((Normal)getDistribution()).setMean(mean);
} | [
"public",
"void",
"setMean",
"(",
"double",
"mean",
")",
"{",
"if",
"(",
"Double",
".",
"isInfinite",
"(",
"mean",
")",
"||",
"Double",
".",
"isNaN",
"(",
"mean",
")",
")",
"throw",
"new",
"ArithmeticException",
"(",
"\"Mean must be a real number, not \"",
"... | Sets the mean value used for the normal distribution
@param mean the new mean value | [
"Sets",
"the",
"mean",
"value",
"used",
"for",
"the",
"normal",
"distribution"
] | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/boosting/WaggingNormal.java#L66-L71 |
aalmiray/Json-lib | src/main/java/net/sf/json/JSONObject.java | JSONObject.toBean | public static Object toBean( JSONObject jsonObject, Class beanClass ) {
JsonConfig jsonConfig = new JsonConfig();
jsonConfig.setRootClass( beanClass );
return toBean( jsonObject, jsonConfig );
} | java | public static Object toBean( JSONObject jsonObject, Class beanClass ) {
JsonConfig jsonConfig = new JsonConfig();
jsonConfig.setRootClass( beanClass );
return toBean( jsonObject, jsonConfig );
} | [
"public",
"static",
"Object",
"toBean",
"(",
"JSONObject",
"jsonObject",
",",
"Class",
"beanClass",
")",
"{",
"JsonConfig",
"jsonConfig",
"=",
"new",
"JsonConfig",
"(",
")",
";",
"jsonConfig",
".",
"setRootClass",
"(",
"beanClass",
")",
";",
"return",
"toBean"... | Creates a bean from a JSONObject, with a specific target class.<br> | [
"Creates",
"a",
"bean",
"from",
"a",
"JSONObject",
"with",
"a",
"specific",
"target",
"class",
".",
"<br",
">"
] | train | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JSONObject.java#L219-L223 |
alkacon/opencms-core | src/org/opencms/synchronize/CmsSynchronize.java | CmsSynchronize.getFileInRfs | private File getFileInRfs(String res) {
String path = m_destinationPathInRfs + res.substring(0, res.lastIndexOf("/"));
String fileName = res.substring(res.lastIndexOf("/") + 1);
return new File(path, fileName);
} | java | private File getFileInRfs(String res) {
String path = m_destinationPathInRfs + res.substring(0, res.lastIndexOf("/"));
String fileName = res.substring(res.lastIndexOf("/") + 1);
return new File(path, fileName);
} | [
"private",
"File",
"getFileInRfs",
"(",
"String",
"res",
")",
"{",
"String",
"path",
"=",
"m_destinationPathInRfs",
"+",
"res",
".",
"substring",
"(",
"0",
",",
"res",
".",
"lastIndexOf",
"(",
"\"/\"",
")",
")",
";",
"String",
"fileName",
"=",
"res",
"."... | Gets the corresponding file to a resource in the VFS. <p>
@param res path to the resource inside the VFS
@return the corresponding file in the FS | [
"Gets",
"the",
"corresponding",
"file",
"to",
"a",
"resource",
"in",
"the",
"VFS",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/synchronize/CmsSynchronize.java#L495-L500 |
OpenLiberty/open-liberty | dev/wlp-generateRepositoryContent/src/com/ibm/ws/wlp/repository/esa/GenerateEsas.java | GenerateEsas.addFileResource | public void addFileResource(File installRoot, final Set<String> content,
String locString) {
String[] locs;
if (locString.contains(",")) {
locs = locString.split(",");
} else {
locs = new String[] { locString };
}
for (String loc : locs) {
File test = new File(loc);
if (!test.isAbsolute()) {
test = new File(installRoot, loc);
}
loc = test.getAbsolutePath();
content.add(loc);
}
} | java | public void addFileResource(File installRoot, final Set<String> content,
String locString) {
String[] locs;
if (locString.contains(",")) {
locs = locString.split(",");
} else {
locs = new String[] { locString };
}
for (String loc : locs) {
File test = new File(loc);
if (!test.isAbsolute()) {
test = new File(installRoot, loc);
}
loc = test.getAbsolutePath();
content.add(loc);
}
} | [
"public",
"void",
"addFileResource",
"(",
"File",
"installRoot",
",",
"final",
"Set",
"<",
"String",
">",
"content",
",",
"String",
"locString",
")",
"{",
"String",
"[",
"]",
"locs",
";",
"if",
"(",
"locString",
".",
"contains",
"(",
"\",\"",
")",
")",
... | Adds a file resource to the set of file paths.
@param installRoot The install root where we are getting files from
@param content The content to add the file paths to
@param locString The location string from the feature resource | [
"Adds",
"a",
"file",
"resource",
"to",
"the",
"set",
"of",
"file",
"paths",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp-generateRepositoryContent/src/com/ibm/ws/wlp/repository/esa/GenerateEsas.java#L671-L688 |
cache2k/cache2k | cache2k-api/src/main/java/org/cache2k/Cache2kBuilder.java | Cache2kBuilder.buildForIntKey | @SuppressWarnings("unchecked")
public final IntCache<V> buildForIntKey() {
Cache2kConfiguration<K,V> cfg = config();
if (cfg.getKeyType().getType() != Integer.class) {
throw new IllegalArgumentException("Integer key type expected, was: " + cfg.getKeyType());
}
return (IntCache<V>) CacheManager.PROVIDER.createCache(manager, config());
} | java | @SuppressWarnings("unchecked")
public final IntCache<V> buildForIntKey() {
Cache2kConfiguration<K,V> cfg = config();
if (cfg.getKeyType().getType() != Integer.class) {
throw new IllegalArgumentException("Integer key type expected, was: " + cfg.getKeyType());
}
return (IntCache<V>) CacheManager.PROVIDER.createCache(manager, config());
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"final",
"IntCache",
"<",
"V",
">",
"buildForIntKey",
"(",
")",
"{",
"Cache2kConfiguration",
"<",
"K",
",",
"V",
">",
"cfg",
"=",
"config",
"(",
")",
";",
"if",
"(",
"cfg",
".",
"getKeyType",
... | Builds a cache with the specified configuration parameters.
The behavior is identical to {@link #build()} except that it checks that
the key type is {@code Integer} and casts the created cache to the specialized
interface.
@throws IllegalArgumentException if a cache of the same name is already active in the cache manager
@throws IllegalArgumentException if key type is unexpected
@throws IllegalArgumentException if a configuration entry for the named cache is required but not present | [
"Builds",
"a",
"cache",
"with",
"the",
"specified",
"configuration",
"parameters",
".",
"The",
"behavior",
"is",
"identical",
"to",
"{",
"@link",
"#build",
"()",
"}",
"except",
"that",
"it",
"checks",
"that",
"the",
"key",
"type",
"is",
"{",
"@code",
"Inte... | train | https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-api/src/main/java/org/cache2k/Cache2kBuilder.java#L887-L894 |
cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java | AttachmentManager.prepareAttachment | protected static PreparedAttachment prepareAttachment(String attachmentsDir,
AttachmentStreamFactory attachmentStreamFactory, Attachment attachment, long length, long encodedLength) throws AttachmentException {
PreparedAttachment pa = new PreparedAttachment(attachment, attachmentsDir, length, attachmentStreamFactory);
// check the length on disk is correct:
// - plain encoding, length on disk is signalled by the "length" metadata property
// - all other encodings, length on disk is signalled by the "encoded_length" metadata property
if (pa.attachment.encoding == Attachment.Encoding.Plain) {
if (pa.length != length) {
throw new AttachmentNotSavedException(String.format("Actual length of %d does not equal expected length of %d", pa.length, length));
}
} else {
if (pa.encodedLength != encodedLength) {
throw new AttachmentNotSavedException(String.format("Actual encoded length of %d does not equal expected encoded length of %d", pa.encodedLength, pa.length));
}
}
return pa;
} | java | protected static PreparedAttachment prepareAttachment(String attachmentsDir,
AttachmentStreamFactory attachmentStreamFactory, Attachment attachment, long length, long encodedLength) throws AttachmentException {
PreparedAttachment pa = new PreparedAttachment(attachment, attachmentsDir, length, attachmentStreamFactory);
// check the length on disk is correct:
// - plain encoding, length on disk is signalled by the "length" metadata property
// - all other encodings, length on disk is signalled by the "encoded_length" metadata property
if (pa.attachment.encoding == Attachment.Encoding.Plain) {
if (pa.length != length) {
throw new AttachmentNotSavedException(String.format("Actual length of %d does not equal expected length of %d", pa.length, length));
}
} else {
if (pa.encodedLength != encodedLength) {
throw new AttachmentNotSavedException(String.format("Actual encoded length of %d does not equal expected encoded length of %d", pa.encodedLength, pa.length));
}
}
return pa;
} | [
"protected",
"static",
"PreparedAttachment",
"prepareAttachment",
"(",
"String",
"attachmentsDir",
",",
"AttachmentStreamFactory",
"attachmentStreamFactory",
",",
"Attachment",
"attachment",
",",
"long",
"length",
",",
"long",
"encodedLength",
")",
"throws",
"AttachmentExce... | prepare an attachment and check validity of length and encodedLength metadata | [
"prepare",
"an",
"attachment",
"and",
"check",
"validity",
"of",
"length",
"and",
"encodedLength",
"metadata"
] | train | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java#L212-L228 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/hadoop/AbstractColumnFamilyOutputFormat.java | AbstractColumnFamilyOutputFormat.createAuthenticatedClient | public static Cassandra.Client createAuthenticatedClient(String host, int port, Configuration conf) throws Exception
{
logger.debug("Creating authenticated client for CF output format");
TTransport transport = ConfigHelper.getClientTransportFactory(conf).openTransport(host, port);
TProtocol binaryProtocol = new TBinaryProtocol(transport, true, true);
Cassandra.Client client = new Cassandra.Client(binaryProtocol);
client.set_keyspace(ConfigHelper.getOutputKeyspace(conf));
String user = ConfigHelper.getOutputKeyspaceUserName(conf);
String password = ConfigHelper.getOutputKeyspacePassword(conf);
if ((user != null) && (password != null))
login(user, password, client);
logger.debug("Authenticated client for CF output format created successfully");
return client;
} | java | public static Cassandra.Client createAuthenticatedClient(String host, int port, Configuration conf) throws Exception
{
logger.debug("Creating authenticated client for CF output format");
TTransport transport = ConfigHelper.getClientTransportFactory(conf).openTransport(host, port);
TProtocol binaryProtocol = new TBinaryProtocol(transport, true, true);
Cassandra.Client client = new Cassandra.Client(binaryProtocol);
client.set_keyspace(ConfigHelper.getOutputKeyspace(conf));
String user = ConfigHelper.getOutputKeyspaceUserName(conf);
String password = ConfigHelper.getOutputKeyspacePassword(conf);
if ((user != null) && (password != null))
login(user, password, client);
logger.debug("Authenticated client for CF output format created successfully");
return client;
} | [
"public",
"static",
"Cassandra",
".",
"Client",
"createAuthenticatedClient",
"(",
"String",
"host",
",",
"int",
"port",
",",
"Configuration",
"conf",
")",
"throws",
"Exception",
"{",
"logger",
".",
"debug",
"(",
"\"Creating authenticated client for CF output format\"",
... | Connects to the given server:port and returns a client based on the given socket that points to the configured
keyspace, and is logged in with the configured credentials.
@param host fully qualified host name to connect to
@param port RPC port of the server
@param conf a job configuration
@return a cassandra client
@throws Exception set of thrown exceptions may be implementation defined,
depending on the used transport factory | [
"Connects",
"to",
"the",
"given",
"server",
":",
"port",
"and",
"returns",
"a",
"client",
"based",
"on",
"the",
"given",
"socket",
"that",
"points",
"to",
"the",
"configured",
"keyspace",
"and",
"is",
"logged",
"in",
"with",
"the",
"configured",
"credentials... | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/hadoop/AbstractColumnFamilyOutputFormat.java#L120-L134 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/FolderResourcesImpl.java | FolderResourcesImpl.copyFolder | public Folder copyFolder(long folderId, ContainerDestination containerDestination, EnumSet<FolderCopyInclusion> includes, EnumSet<FolderRemapExclusion> skipRemap) throws SmartsheetException {
return copyFolder(folderId, containerDestination, includes, skipRemap, null);
} | java | public Folder copyFolder(long folderId, ContainerDestination containerDestination, EnumSet<FolderCopyInclusion> includes, EnumSet<FolderRemapExclusion> skipRemap) throws SmartsheetException {
return copyFolder(folderId, containerDestination, includes, skipRemap, null);
} | [
"public",
"Folder",
"copyFolder",
"(",
"long",
"folderId",
",",
"ContainerDestination",
"containerDestination",
",",
"EnumSet",
"<",
"FolderCopyInclusion",
">",
"includes",
",",
"EnumSet",
"<",
"FolderRemapExclusion",
">",
"skipRemap",
")",
"throws",
"SmartsheetExceptio... | Creates a copy of the specified Folder.
It mirrors to the following Smartsheet REST API method: POST /folders/{folderId}/copy
Exceptions:
IllegalArgumentException : if folder is null
InvalidRequestException : if there is any problem with the REST API request
AuthorizationException : if there is any problem with the REST API authorization(access token)
ServiceUnavailableException : if the REST API service is not available (possibly due to rate limiting)
SmartsheetRestException : if there is any other REST API related error occurred during the operation
SmartsheetException : if there is any other error occurred during the operation
@param folderId the folder id
@param containerDestination describes the destination container
@param includes optional parameters to include
@param skipRemap optional parameters to exclude
@return the folder
@throws SmartsheetException the smartsheet exception | [
"Creates",
"a",
"copy",
"of",
"the",
"specified",
"Folder",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/FolderResourcesImpl.java#L204-L206 |
algolia/algoliasearch-client-java | src/main/java/com/algolia/search/saas/Index.java | Index.saveRule | public JSONObject saveRule(String objectID, JSONObject rule) throws AlgoliaException {
return saveRule(objectID, rule, false);
} | java | public JSONObject saveRule(String objectID, JSONObject rule) throws AlgoliaException {
return saveRule(objectID, rule, false);
} | [
"public",
"JSONObject",
"saveRule",
"(",
"String",
"objectID",
",",
"JSONObject",
"rule",
")",
"throws",
"AlgoliaException",
"{",
"return",
"saveRule",
"(",
"objectID",
",",
"rule",
",",
"false",
")",
";",
"}"
] | Save a query rule
@param objectID the objectId of the query rule to save
@param rule the content of this query rule | [
"Save",
"a",
"query",
"rule"
] | train | https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L1713-L1715 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java | InstanceFailoverGroupsInner.forceFailoverAllowDataLossAsync | public Observable<InstanceFailoverGroupInner> forceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName) {
return forceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1<ServiceResponse<InstanceFailoverGroupInner>, InstanceFailoverGroupInner>() {
@Override
public InstanceFailoverGroupInner call(ServiceResponse<InstanceFailoverGroupInner> response) {
return response.body();
}
});
} | java | public Observable<InstanceFailoverGroupInner> forceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName) {
return forceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1<ServiceResponse<InstanceFailoverGroupInner>, InstanceFailoverGroupInner>() {
@Override
public InstanceFailoverGroupInner call(ServiceResponse<InstanceFailoverGroupInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"InstanceFailoverGroupInner",
">",
"forceFailoverAllowDataLossAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"locationName",
",",
"String",
"failoverGroupName",
")",
"{",
"return",
"forceFailoverAllowDataLossWithServiceResponseAsync",
"(... | Fails over from the current primary managed instance to this managed instance. This operation might result in data loss.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param locationName The name of the region where the resource is located.
@param failoverGroupName The name of the failover group.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Fails",
"over",
"from",
"the",
"current",
"primary",
"managed",
"instance",
"to",
"this",
"managed",
"instance",
".",
"This",
"operation",
"might",
"result",
"in",
"data",
"loss",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java#L891-L898 |
ThreeTen/threetenbp | src/main/java/org/threeten/bp/chrono/Chronology.java | Chronology.ensureChronoZonedDateTime | <D extends ChronoLocalDate> ChronoZonedDateTimeImpl<D> ensureChronoZonedDateTime(Temporal temporal) {
@SuppressWarnings("unchecked")
ChronoZonedDateTimeImpl<D> other = (ChronoZonedDateTimeImpl<D>) temporal;
if (this.equals(other.toLocalDate().getChronology()) == false) {
throw new ClassCastException("Chrono mismatch, required: " + getId()
+ ", supplied: " + other.toLocalDate().getChronology().getId());
}
return other;
} | java | <D extends ChronoLocalDate> ChronoZonedDateTimeImpl<D> ensureChronoZonedDateTime(Temporal temporal) {
@SuppressWarnings("unchecked")
ChronoZonedDateTimeImpl<D> other = (ChronoZonedDateTimeImpl<D>) temporal;
if (this.equals(other.toLocalDate().getChronology()) == false) {
throw new ClassCastException("Chrono mismatch, required: " + getId()
+ ", supplied: " + other.toLocalDate().getChronology().getId());
}
return other;
} | [
"<",
"D",
"extends",
"ChronoLocalDate",
">",
"ChronoZonedDateTimeImpl",
"<",
"D",
">",
"ensureChronoZonedDateTime",
"(",
"Temporal",
"temporal",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"ChronoZonedDateTimeImpl",
"<",
"D",
">",
"other",
"=",
"... | Casts the {@code Temporal} to {@code ChronoZonedDateTimeImpl} with the same chronology.
@param temporal a date-time to cast, not null
@return the date-time checked and cast to {@code ChronoZonedDateTimeImpl}, not null
@throws ClassCastException if the date-time cannot be cast to ChronoZonedDateTimeImpl
or the chronology is not equal this Chrono | [
"Casts",
"the",
"{",
"@code",
"Temporal",
"}",
"to",
"{",
"@code",
"ChronoZonedDateTimeImpl",
"}",
"with",
"the",
"same",
"chronology",
"."
] | train | https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/chrono/Chronology.java#L392-L400 |
mebigfatguy/fb-contrib | src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java | BloatedAssignmentScope.sawMonitorEnter | private void sawMonitorEnter(int pc) {
monitorSyncPCs.add(Integer.valueOf(pc));
ScopeBlock sb = new ScopeBlock(pc, Integer.MAX_VALUE);
sb.setSync();
rootScopeBlock.addChild(sb);
} | java | private void sawMonitorEnter(int pc) {
monitorSyncPCs.add(Integer.valueOf(pc));
ScopeBlock sb = new ScopeBlock(pc, Integer.MAX_VALUE);
sb.setSync();
rootScopeBlock.addChild(sb);
} | [
"private",
"void",
"sawMonitorEnter",
"(",
"int",
"pc",
")",
"{",
"monitorSyncPCs",
".",
"add",
"(",
"Integer",
".",
"valueOf",
"(",
"pc",
")",
")",
";",
"ScopeBlock",
"sb",
"=",
"new",
"ScopeBlock",
"(",
"pc",
",",
"Integer",
".",
"MAX_VALUE",
")",
";... | processes a monitor enter call to create a scope block
@param pc
the current program counter | [
"processes",
"a",
"monitor",
"enter",
"call",
"to",
"create",
"a",
"scope",
"block"
] | train | https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/BloatedAssignmentScope.java#L555-L561 |
graphhopper/graphhopper | core/src/main/java/com/graphhopper/geohash/LinearKeyAlgo.java | LinearKeyAlgo.decode | @Override
public final void decode(long linearKey, GHPoint latLon) {
double lat = linearKey / lonUnits * latDelta + bounds.minLat;
double lon = linearKey % lonUnits * lonDelta + bounds.minLon;
latLon.lat = lat + latDelta / 2;
latLon.lon = lon + lonDelta / 2;
} | java | @Override
public final void decode(long linearKey, GHPoint latLon) {
double lat = linearKey / lonUnits * latDelta + bounds.minLat;
double lon = linearKey % lonUnits * lonDelta + bounds.minLon;
latLon.lat = lat + latDelta / 2;
latLon.lon = lon + lonDelta / 2;
} | [
"@",
"Override",
"public",
"final",
"void",
"decode",
"(",
"long",
"linearKey",
",",
"GHPoint",
"latLon",
")",
"{",
"double",
"lat",
"=",
"linearKey",
"/",
"lonUnits",
"*",
"latDelta",
"+",
"bounds",
".",
"minLat",
";",
"double",
"lon",
"=",
"linearKey",
... | This method returns latitude and longitude via latLon - calculated from specified linearKey
<p>
@param linearKey is the input | [
"This",
"method",
"returns",
"latitude",
"and",
"longitude",
"via",
"latLon",
"-",
"calculated",
"from",
"specified",
"linearKey",
"<p",
">"
] | train | https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/geohash/LinearKeyAlgo.java#L96-L102 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java | Utility.parseChar | public static boolean parseChar(String id, int[] pos, char ch) {
int start = pos[0];
pos[0] = PatternProps.skipWhiteSpace(id, pos[0]);
if (pos[0] == id.length() ||
id.charAt(pos[0]) != ch) {
pos[0] = start;
return false;
}
++pos[0];
return true;
} | java | public static boolean parseChar(String id, int[] pos, char ch) {
int start = pos[0];
pos[0] = PatternProps.skipWhiteSpace(id, pos[0]);
if (pos[0] == id.length() ||
id.charAt(pos[0]) != ch) {
pos[0] = start;
return false;
}
++pos[0];
return true;
} | [
"public",
"static",
"boolean",
"parseChar",
"(",
"String",
"id",
",",
"int",
"[",
"]",
"pos",
",",
"char",
"ch",
")",
"{",
"int",
"start",
"=",
"pos",
"[",
"0",
"]",
";",
"pos",
"[",
"0",
"]",
"=",
"PatternProps",
".",
"skipWhiteSpace",
"(",
"id",
... | Parse a single non-whitespace character 'ch', optionally
preceded by whitespace.
@param id the string to be parsed
@param pos INPUT-OUTPUT parameter. On input, pos[0] is the
offset of the first character to be parsed. On output, pos[0]
is the index after the last parsed character. If the parse
fails, pos[0] will be unchanged.
@param ch the non-whitespace character to be parsed.
@return true if 'ch' is seen preceded by zero or more
whitespace characters. | [
"Parse",
"a",
"single",
"non",
"-",
"whitespace",
"character",
"ch",
"optionally",
"preceded",
"by",
"whitespace",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java#L1131-L1141 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.