repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 218 | func_name stringlengths 5 140 | whole_func_string stringlengths 79 3.99k | language stringclasses 1
value | func_code_string stringlengths 79 3.99k | func_code_tokens listlengths 20 624 | func_documentation_string stringlengths 61 1.96k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 107 339 |
|---|---|---|---|---|---|---|---|---|---|---|
Wadpam/guja | guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java | GeneratedDContactDaoImpl.queryByWebPage | public Iterable<DContact> queryByWebPage(Object parent, java.lang.String webPage) {
return queryByField(parent, DContactMapper.Field.WEBPAGE.getFieldName(), webPage);
} | java | public Iterable<DContact> queryByWebPage(Object parent, java.lang.String webPage) {
return queryByField(parent, DContactMapper.Field.WEBPAGE.getFieldName(), webPage);
} | [
"public",
"Iterable",
"<",
"DContact",
">",
"queryByWebPage",
"(",
"Object",
"parent",
",",
"java",
".",
"lang",
".",
"String",
"webPage",
")",
"{",
"return",
"queryByField",
"(",
"parent",
",",
"DContactMapper",
".",
"Field",
".",
"WEBPAGE",
".",
"getFieldN... | query-by method for field webPage
@param webPage the specified attribute
@return an Iterable of DContacts for the specified webPage | [
"query",
"-",
"by",
"method",
"for",
"field",
"webPage"
] | train | https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/dao/GeneratedDContactDaoImpl.java#L313-L315 |
Alluxio/alluxio | core/server/master/src/main/java/alluxio/master/block/meta/MasterWorkerInfo.java | MasterWorkerInfo.updateToRemovedBlock | public void updateToRemovedBlock(boolean add, long blockId) {
if (add) {
if (mBlocks.contains(blockId)) {
mToRemoveBlocks.add(blockId);
}
} else {
mToRemoveBlocks.remove(blockId);
}
} | java | public void updateToRemovedBlock(boolean add, long blockId) {
if (add) {
if (mBlocks.contains(blockId)) {
mToRemoveBlocks.add(blockId);
}
} else {
mToRemoveBlocks.remove(blockId);
}
} | [
"public",
"void",
"updateToRemovedBlock",
"(",
"boolean",
"add",
",",
"long",
"blockId",
")",
"{",
"if",
"(",
"add",
")",
"{",
"if",
"(",
"mBlocks",
".",
"contains",
"(",
"blockId",
")",
")",
"{",
"mToRemoveBlocks",
".",
"add",
"(",
"blockId",
")",
";"... | Adds or removes a block from the to-be-removed blocks set of the worker.
@param add true if to add, to remove otherwise
@param blockId the id of the block to be added or removed | [
"Adds",
"or",
"removes",
"a",
"block",
"from",
"the",
"to",
"-",
"be",
"-",
"removed",
"blocks",
"set",
"of",
"the",
"worker",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/block/meta/MasterWorkerInfo.java#L397-L405 |
apache/spark | common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java | UTF8String.indexOf | public int indexOf(UTF8String v, int start) {
if (v.numBytes() == 0) {
return 0;
}
// locate to the start position.
int i = 0; // position in byte
int c = 0; // position in character
while (i < numBytes && c < start) {
i += numBytesForFirstByte(getByte(i));
c += 1;
}
do {
if (i + v.numBytes > numBytes) {
return -1;
}
if (ByteArrayMethods.arrayEquals(base, offset + i, v.base, v.offset, v.numBytes)) {
return c;
}
i += numBytesForFirstByte(getByte(i));
c += 1;
} while (i < numBytes);
return -1;
} | java | public int indexOf(UTF8String v, int start) {
if (v.numBytes() == 0) {
return 0;
}
// locate to the start position.
int i = 0; // position in byte
int c = 0; // position in character
while (i < numBytes && c < start) {
i += numBytesForFirstByte(getByte(i));
c += 1;
}
do {
if (i + v.numBytes > numBytes) {
return -1;
}
if (ByteArrayMethods.arrayEquals(base, offset + i, v.base, v.offset, v.numBytes)) {
return c;
}
i += numBytesForFirstByte(getByte(i));
c += 1;
} while (i < numBytes);
return -1;
} | [
"public",
"int",
"indexOf",
"(",
"UTF8String",
"v",
",",
"int",
"start",
")",
"{",
"if",
"(",
"v",
".",
"numBytes",
"(",
")",
"==",
"0",
")",
"{",
"return",
"0",
";",
"}",
"// locate to the start position.",
"int",
"i",
"=",
"0",
";",
"// position in b... | Returns the position of the first occurrence of substr in
current string from the specified position (0-based index).
@param v the string to be searched
@param start the start position of the current string for searching
@return the position of the first occurrence of substr, if not found, -1 returned. | [
"Returns",
"the",
"position",
"of",
"the",
"first",
"occurrence",
"of",
"substr",
"in",
"current",
"string",
"from",
"the",
"specified",
"position",
"(",
"0",
"-",
"based",
"index",
")",
"."
] | train | https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/unsafe/src/main/java/org/apache/spark/unsafe/types/UTF8String.java#L710-L735 |
BigBadaboom/androidsvg | androidsvg/src/main/java/com/caverock/androidsvg/SVGAndroidRenderer.java | SVGAndroidRenderer.calculateViewBoxTransform | private Matrix calculateViewBoxTransform(Box viewPort, Box viewBox, PreserveAspectRatio positioning)
{
Matrix m = new Matrix();
if (positioning == null || positioning.getAlignment() == null)
return m;
float xScale = viewPort.width / viewBox.width;
float yScale = viewPort.height / viewBox.height;
float xOffset = -viewBox.minX;
float yOffset = -viewBox.minY;
// 'none' means scale both dimensions to fit the viewport
if (positioning.equals(PreserveAspectRatio.STRETCH))
{
m.preTranslate(viewPort.minX, viewPort.minY);
m.preScale(xScale, yScale);
m.preTranslate(xOffset, yOffset);
return m;
}
// Otherwise, the aspect ratio of the image is kept.
// What scale are we going to use?
float scale = (positioning.getScale() == PreserveAspectRatio.Scale.slice) ? Math.max(xScale, yScale) : Math.min(xScale, yScale);
// What size will the image end up being?
float imageW = viewPort.width / scale;
float imageH = viewPort.height / scale;
// Determine final X position
switch (positioning.getAlignment())
{
case xMidYMin:
case xMidYMid:
case xMidYMax:
xOffset -= (viewBox.width - imageW) / 2;
break;
case xMaxYMin:
case xMaxYMid:
case xMaxYMax:
xOffset -= (viewBox.width - imageW);
break;
default:
// nothing to do
break;
}
// Determine final Y position
switch (positioning.getAlignment())
{
case xMinYMid:
case xMidYMid:
case xMaxYMid:
yOffset -= (viewBox.height - imageH) / 2;
break;
case xMinYMax:
case xMidYMax:
case xMaxYMax:
yOffset -= (viewBox.height - imageH);
break;
default:
// nothing to do
break;
}
m.preTranslate(viewPort.minX, viewPort.minY);
m.preScale(scale, scale);
m.preTranslate(xOffset, yOffset);
return m;
} | java | private Matrix calculateViewBoxTransform(Box viewPort, Box viewBox, PreserveAspectRatio positioning)
{
Matrix m = new Matrix();
if (positioning == null || positioning.getAlignment() == null)
return m;
float xScale = viewPort.width / viewBox.width;
float yScale = viewPort.height / viewBox.height;
float xOffset = -viewBox.minX;
float yOffset = -viewBox.minY;
// 'none' means scale both dimensions to fit the viewport
if (positioning.equals(PreserveAspectRatio.STRETCH))
{
m.preTranslate(viewPort.minX, viewPort.minY);
m.preScale(xScale, yScale);
m.preTranslate(xOffset, yOffset);
return m;
}
// Otherwise, the aspect ratio of the image is kept.
// What scale are we going to use?
float scale = (positioning.getScale() == PreserveAspectRatio.Scale.slice) ? Math.max(xScale, yScale) : Math.min(xScale, yScale);
// What size will the image end up being?
float imageW = viewPort.width / scale;
float imageH = viewPort.height / scale;
// Determine final X position
switch (positioning.getAlignment())
{
case xMidYMin:
case xMidYMid:
case xMidYMax:
xOffset -= (viewBox.width - imageW) / 2;
break;
case xMaxYMin:
case xMaxYMid:
case xMaxYMax:
xOffset -= (viewBox.width - imageW);
break;
default:
// nothing to do
break;
}
// Determine final Y position
switch (positioning.getAlignment())
{
case xMinYMid:
case xMidYMid:
case xMaxYMid:
yOffset -= (viewBox.height - imageH) / 2;
break;
case xMinYMax:
case xMidYMax:
case xMaxYMax:
yOffset -= (viewBox.height - imageH);
break;
default:
// nothing to do
break;
}
m.preTranslate(viewPort.minX, viewPort.minY);
m.preScale(scale, scale);
m.preTranslate(xOffset, yOffset);
return m;
} | [
"private",
"Matrix",
"calculateViewBoxTransform",
"(",
"Box",
"viewPort",
",",
"Box",
"viewBox",
",",
"PreserveAspectRatio",
"positioning",
")",
"{",
"Matrix",
"m",
"=",
"new",
"Matrix",
"(",
")",
";",
"if",
"(",
"positioning",
"==",
"null",
"||",
"positioning... | /*
Calculate the transform required to fit the supplied viewBox into the current viewPort.
See spec section 7.8 for an explanation of how this works.
aspectRatioRule determines where the graphic is placed in the viewPort when aspect ration
is kept. xMin means left justified, xMid is centred, xMax is right justified etc.
slice determines whether we see the whole image or not. True fill the whole viewport.
If slice is false, the image will be "letter-boxed".
Note values in the two Box parameters whould be in user units. If you pass values
that are in "objectBoundingBox" space, you will get incorrect results. | [
"/",
"*",
"Calculate",
"the",
"transform",
"required",
"to",
"fit",
"the",
"supplied",
"viewBox",
"into",
"the",
"current",
"viewPort",
".",
"See",
"spec",
"section",
"7",
".",
"8",
"for",
"an",
"explanation",
"of",
"how",
"this",
"works",
"."
] | train | https://github.com/BigBadaboom/androidsvg/blob/0d1614dd1a4da10ea4afe3b0cea1361a4ac6b45a/androidsvg/src/main/java/com/caverock/androidsvg/SVGAndroidRenderer.java#L2025-L2091 |
Impetus/Kundera | src/kundera-kudu/src/main/java/com/impetus/client/kudu/KuduDBClient.java | KuduDBClient.onPersist | @Override
protected void onPersist(EntityMetadata entityMetadata, Object entity, Object id, List<RelationHolder> rlHolders)
{
KuduSession session = kuduClient.newSession();
KuduTable table = null;
try
{
table = kuduClient.openTable(entityMetadata.getTableName());
}
catch (Exception e)
{
logger.error("Cannot open table : " + entityMetadata.getTableName(), e);
throw new KunderaException("Cannot open table : " + entityMetadata.getTableName(), e);
}
Operation operation = isUpdate ? table.newUpdate() : table.newInsert();
PartialRow row = operation.getRow();
populatePartialRow(row, entityMetadata, entity);
try
{
session.apply(operation);
}
catch (Exception e)
{
logger.error("Cannot insert/update row in table : " + entityMetadata.getTableName(), e);
throw new KunderaException("Cannot insert/update row in table : " + entityMetadata.getTableName(), e);
}
finally
{
try
{
session.close();
}
catch (Exception e)
{
logger.error("Cannot close session", e);
throw new KunderaException("Cannot close session", e);
}
}
} | java | @Override
protected void onPersist(EntityMetadata entityMetadata, Object entity, Object id, List<RelationHolder> rlHolders)
{
KuduSession session = kuduClient.newSession();
KuduTable table = null;
try
{
table = kuduClient.openTable(entityMetadata.getTableName());
}
catch (Exception e)
{
logger.error("Cannot open table : " + entityMetadata.getTableName(), e);
throw new KunderaException("Cannot open table : " + entityMetadata.getTableName(), e);
}
Operation operation = isUpdate ? table.newUpdate() : table.newInsert();
PartialRow row = operation.getRow();
populatePartialRow(row, entityMetadata, entity);
try
{
session.apply(operation);
}
catch (Exception e)
{
logger.error("Cannot insert/update row in table : " + entityMetadata.getTableName(), e);
throw new KunderaException("Cannot insert/update row in table : " + entityMetadata.getTableName(), e);
}
finally
{
try
{
session.close();
}
catch (Exception e)
{
logger.error("Cannot close session", e);
throw new KunderaException("Cannot close session", e);
}
}
} | [
"@",
"Override",
"protected",
"void",
"onPersist",
"(",
"EntityMetadata",
"entityMetadata",
",",
"Object",
"entity",
",",
"Object",
"id",
",",
"List",
"<",
"RelationHolder",
">",
"rlHolders",
")",
"{",
"KuduSession",
"session",
"=",
"kuduClient",
".",
"newSessio... | On persist.
@param entityMetadata
the entity metadata
@param entity
the entity
@param id
the id
@param rlHolders
the rl holders | [
"On",
"persist",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-kudu/src/main/java/com/impetus/client/kudu/KuduDBClient.java#L611-L650 |
EasyinnovaSL/Tiff-Library-4J | src/main/java/com/easyinnova/tiff/profiles/BaselineProfile.java | BaselineProfile.CheckTransparencyMask | private void CheckTransparencyMask(IfdTags metadata, int n) {
// Samples per pixel
if (!metadata.containsTagId(TiffTags.getTagId("SamplesPerPixel"))) {
validation.addErrorLoc("Missing Samples Per Pixel", "IFD" + n);
} else {
long spp = metadata.get(TiffTags.getTagId("SamplesPerPixel")).getFirstNumericValue();
if (spp != 1) {
validation.addError("Invalid Samples Per Pixel", "IFD" + n, spp);
}
}
// BitsPerSample
if (!metadata.containsTagId(TiffTags.getTagId("BitsPerSample"))) {
validation.addErrorLoc("Missing BitsPerSample", "IFD" + n);
} else {
long bps = metadata.get(TiffTags.getTagId("BitsPerSample")).getFirstNumericValue();
if (bps != 1) {
validation.addError("Invalid BitsPerSample", "IFD" + n, bps);
}
}
} | java | private void CheckTransparencyMask(IfdTags metadata, int n) {
// Samples per pixel
if (!metadata.containsTagId(TiffTags.getTagId("SamplesPerPixel"))) {
validation.addErrorLoc("Missing Samples Per Pixel", "IFD" + n);
} else {
long spp = metadata.get(TiffTags.getTagId("SamplesPerPixel")).getFirstNumericValue();
if (spp != 1) {
validation.addError("Invalid Samples Per Pixel", "IFD" + n, spp);
}
}
// BitsPerSample
if (!metadata.containsTagId(TiffTags.getTagId("BitsPerSample"))) {
validation.addErrorLoc("Missing BitsPerSample", "IFD" + n);
} else {
long bps = metadata.get(TiffTags.getTagId("BitsPerSample")).getFirstNumericValue();
if (bps != 1) {
validation.addError("Invalid BitsPerSample", "IFD" + n, bps);
}
}
} | [
"private",
"void",
"CheckTransparencyMask",
"(",
"IfdTags",
"metadata",
",",
"int",
"n",
")",
"{",
"// Samples per pixel",
"if",
"(",
"!",
"metadata",
".",
"containsTagId",
"(",
"TiffTags",
".",
"getTagId",
"(",
"\"SamplesPerPixel\"",
")",
")",
")",
"{",
"vali... | Check transparency mask.
@param metadata the metadata
@param n the ifd number | [
"Check",
"transparency",
"mask",
"."
] | train | https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/profiles/BaselineProfile.java#L318-L338 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/RepositoryReaderImpl.java | RepositoryReaderImpl.getLogLists | @Override
public Iterable<ServerInstanceLogRecordList> getLogLists(RepositoryPointer after, Date maxTime) {
return getLogLists(after, maxTime, (LogRecordFilter) null);
} | java | @Override
public Iterable<ServerInstanceLogRecordList> getLogLists(RepositoryPointer after, Date maxTime) {
return getLogLists(after, maxTime, (LogRecordFilter) null);
} | [
"@",
"Override",
"public",
"Iterable",
"<",
"ServerInstanceLogRecordList",
">",
"getLogLists",
"(",
"RepositoryPointer",
"after",
",",
"Date",
"maxTime",
")",
"{",
"return",
"getLogLists",
"(",
"after",
",",
"maxTime",
",",
"(",
"LogRecordFilter",
")",
"null",
"... | returns log records from the binary repository that are after a given location and less than or equal to a given date
Callers would have to invoke {@link RepositoryLogRecord#getRepositoryPointer()} to obtain the RepositoryPointer of the last record read.
@param after RepositoryPointer of the last read log record.
@param maxTime the maximum {@link Date} value that the returned records can have
@return the iterable instance of a list of log records within a process that are within the parameter range and satisfy the condition.
If no records meet the criteria, an Iterable is returned with no entries | [
"returns",
"log",
"records",
"from",
"the",
"binary",
"repository",
"that",
"are",
"after",
"a",
"given",
"location",
"and",
"less",
"than",
"or",
"equal",
"to",
"a",
"given",
"date",
"Callers",
"would",
"have",
"to",
"invoke",
"{",
"@link",
"RepositoryLogRe... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/websphere/logging/hpel/reader/RepositoryReaderImpl.java#L774-L777 |
VoltDB/voltdb | src/frontend/org/voltdb/compiler/StatementCompiler.java | StatementCompiler.addFunctionDependence | private static void addFunctionDependence(Function function, Procedure procedure, Statement catalogStmt) {
String funcDeps = function.getStmtdependers();
Set<String> stmtSet = new TreeSet<>();
for (String stmtName : funcDeps.split(",")) {
if (! stmtName.isEmpty()) {
stmtSet.add(stmtName);
}
}
String statementName = procedure.getTypeName() + ":" + catalogStmt.getTypeName();
if (stmtSet.contains(statementName)) {
return;
}
stmtSet.add(statementName);
StringBuilder sb = new StringBuilder();
// We will add this procedure:statement pair. So make sure we have
// an initial comma. Note that an empty set must be represented
// by an empty string. We represent the set {pp:ss, qq:tt},
// where "pp" and "qq" are procedures and "ss" and "tt" are
// statements in their procedures respectively, with
// the string ",pp:ss,qq:tt,". If we search for "pp:ss" we will
// never find "ppp:sss" by accident.
//
// Do to this, when we add something to string we start with a single
// comma, and then add "qq:tt," at the end.
sb.append(",");
for (String stmtName : stmtSet) {
sb.append(stmtName + ",");
}
function.setStmtdependers(sb.toString());
} | java | private static void addFunctionDependence(Function function, Procedure procedure, Statement catalogStmt) {
String funcDeps = function.getStmtdependers();
Set<String> stmtSet = new TreeSet<>();
for (String stmtName : funcDeps.split(",")) {
if (! stmtName.isEmpty()) {
stmtSet.add(stmtName);
}
}
String statementName = procedure.getTypeName() + ":" + catalogStmt.getTypeName();
if (stmtSet.contains(statementName)) {
return;
}
stmtSet.add(statementName);
StringBuilder sb = new StringBuilder();
// We will add this procedure:statement pair. So make sure we have
// an initial comma. Note that an empty set must be represented
// by an empty string. We represent the set {pp:ss, qq:tt},
// where "pp" and "qq" are procedures and "ss" and "tt" are
// statements in their procedures respectively, with
// the string ",pp:ss,qq:tt,". If we search for "pp:ss" we will
// never find "ppp:sss" by accident.
//
// Do to this, when we add something to string we start with a single
// comma, and then add "qq:tt," at the end.
sb.append(",");
for (String stmtName : stmtSet) {
sb.append(stmtName + ",");
}
function.setStmtdependers(sb.toString());
} | [
"private",
"static",
"void",
"addFunctionDependence",
"(",
"Function",
"function",
",",
"Procedure",
"procedure",
",",
"Statement",
"catalogStmt",
")",
"{",
"String",
"funcDeps",
"=",
"function",
".",
"getStmtdependers",
"(",
")",
";",
"Set",
"<",
"String",
">",... | Add a dependence to a function of a statement. The function's
dependence string is altered with this function.
@param function The function to add as dependee.
@param procedure The procedure of the statement.
@param catalogStmt The statement to add as depender. | [
"Add",
"a",
"dependence",
"to",
"a",
"function",
"of",
"a",
"statement",
".",
"The",
"function",
"s",
"dependence",
"string",
"is",
"altered",
"with",
"this",
"function",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/compiler/StatementCompiler.java#L386-L418 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/lib/ArrayUtil.java | ArrayUtil.haveEqualSets | public static boolean haveEqualSets(int[] arra, int[] arrb, int count) {
if (ArrayUtil.haveEqualArrays(arra, arrb, count)) {
return true;
}
if (count > arra.length || count > arrb.length) {
return false;
}
if (count == 1) {
return arra[0] == arrb[0];
}
int[] tempa = (int[]) resizeArray(arra, count);
int[] tempb = (int[]) resizeArray(arrb, count);
sortArray(tempa);
sortArray(tempb);
for (int j = 0; j < count; j++) {
if (tempa[j] != tempb[j]) {
return false;
}
}
return true;
} | java | public static boolean haveEqualSets(int[] arra, int[] arrb, int count) {
if (ArrayUtil.haveEqualArrays(arra, arrb, count)) {
return true;
}
if (count > arra.length || count > arrb.length) {
return false;
}
if (count == 1) {
return arra[0] == arrb[0];
}
int[] tempa = (int[]) resizeArray(arra, count);
int[] tempb = (int[]) resizeArray(arrb, count);
sortArray(tempa);
sortArray(tempb);
for (int j = 0; j < count; j++) {
if (tempa[j] != tempb[j]) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"haveEqualSets",
"(",
"int",
"[",
"]",
"arra",
",",
"int",
"[",
"]",
"arrb",
",",
"int",
"count",
")",
"{",
"if",
"(",
"ArrayUtil",
".",
"haveEqualArrays",
"(",
"arra",
",",
"arrb",
",",
"count",
")",
")",
"{",
"return"... | Returns true if the first count elements of arra and arrb are identical
sets of integers (not necessarily in the same order). | [
"Returns",
"true",
"if",
"the",
"first",
"count",
"elements",
"of",
"arra",
"and",
"arrb",
"are",
"identical",
"sets",
"of",
"integers",
"(",
"not",
"necessarily",
"in",
"the",
"same",
"order",
")",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/ArrayUtil.java#L343-L370 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/string/FindingReplacing.java | FindingReplacing.betns | public S betns(String left, String right) {
return betn(left, right).late();
} | java | public S betns(String left, String right) {
return betn(left, right).late();
} | [
"public",
"S",
"betns",
"(",
"String",
"left",
",",
"String",
"right",
")",
"{",
"return",
"betn",
"(",
"left",
",",
"right",
")",
".",
"late",
"(",
")",
";",
"}"
] | Sets the substrings in given left tag and right tag as the search string
<B>May multiple substring matched.</B>
@see Betner#between(String, String)
@param leftSameWithRight
@return | [
"Sets",
"the",
"substrings",
"in",
"given",
"left",
"tag",
"and",
"right",
"tag",
"as",
"the",
"search",
"string",
"<B",
">",
"May",
"multiple",
"substring",
"matched",
".",
"<",
"/",
"B",
">"
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/FindingReplacing.java#L202-L204 |
raydac/java-binary-block-parser | jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/JBBPCompilerUtils.java | JBBPCompilerUtils.findIndexForFieldPath | public static int findIndexForFieldPath(final String fieldPath, final List<JBBPNamedFieldInfo> namedFields) {
final String normalized = JBBPUtils.normalizeFieldNameOrPath(fieldPath);
int result = -1;
for (int i = namedFields.size() - 1; i >= 0; i--) {
final JBBPNamedFieldInfo f = namedFields.get(i);
if (normalized.equals(f.getFieldPath())) {
result = i;
break;
}
}
return result;
} | java | public static int findIndexForFieldPath(final String fieldPath, final List<JBBPNamedFieldInfo> namedFields) {
final String normalized = JBBPUtils.normalizeFieldNameOrPath(fieldPath);
int result = -1;
for (int i = namedFields.size() - 1; i >= 0; i--) {
final JBBPNamedFieldInfo f = namedFields.get(i);
if (normalized.equals(f.getFieldPath())) {
result = i;
break;
}
}
return result;
} | [
"public",
"static",
"int",
"findIndexForFieldPath",
"(",
"final",
"String",
"fieldPath",
",",
"final",
"List",
"<",
"JBBPNamedFieldInfo",
">",
"namedFields",
")",
"{",
"final",
"String",
"normalized",
"=",
"JBBPUtils",
".",
"normalizeFieldNameOrPath",
"(",
"fieldPat... | Find a named field info index in a list for its path.
@param fieldPath a field path, it must not be null.
@param namedFields a list contains named field info items.
@return the index of a field for the path if found one, -1 otherwise | [
"Find",
"a",
"named",
"field",
"info",
"index",
"in",
"a",
"list",
"for",
"its",
"path",
"."
] | train | https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/compiler/JBBPCompilerUtils.java#L42-L53 |
ZenHarbinger/l2fprod-properties-editor | src/main/java/com/l2fprod/common/swing/StatusBar.java | StatusBar.setZones | public void setZones(String[] ids, Component[] zones, String[] constraints) {
removeAll();
idToZones.clear();
for (int i = 0, c = zones.length; i < c; i++) {
addZone(ids[i], zones[i], constraints[i]);
}
} | java | public void setZones(String[] ids, Component[] zones, String[] constraints) {
removeAll();
idToZones.clear();
for (int i = 0, c = zones.length; i < c; i++) {
addZone(ids[i], zones[i], constraints[i]);
}
} | [
"public",
"void",
"setZones",
"(",
"String",
"[",
"]",
"ids",
",",
"Component",
"[",
"]",
"zones",
",",
"String",
"[",
"]",
"constraints",
")",
"{",
"removeAll",
"(",
")",
";",
"idToZones",
".",
"clear",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
... | For example:
<code>
setZones(new String[]{"A","B"},
new JComponent[]{new JLabel(), new JLabel()},
new String[]{"33%","*"});
</code>
would construct a new status bar with two zones (two JLabels) named A and
B, the first zone A will occupy 33 percents of the overall size of the
status bar and B the left space.
@param ids a value of type 'String[]'
@param zones a value of type 'JComponent[]'
@param constraints a value of type 'String[]' | [
"For",
"example",
":"
] | train | https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/swing/StatusBar.java#L113-L119 |
opsmatters/newrelic-api | src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java | HttpContext.applyHeaders | private void applyHeaders(Invocation.Builder builder, Map<String, Object> headers)
{
if(headers != null)
{
for (Map.Entry<String, Object> e : headers.entrySet())
{
builder.header(e.getKey(), e.getValue());
}
}
} | java | private void applyHeaders(Invocation.Builder builder, Map<String, Object> headers)
{
if(headers != null)
{
for (Map.Entry<String, Object> e : headers.entrySet())
{
builder.header(e.getKey(), e.getValue());
}
}
} | [
"private",
"void",
"applyHeaders",
"(",
"Invocation",
".",
"Builder",
"builder",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"headers",
")",
"{",
"if",
"(",
"headers",
"!=",
"null",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"O... | Add the given set of headers to the web target.
@param builder The invocation to add the headers to
@param headers The headers to add | [
"Add",
"the",
"given",
"set",
"of",
"headers",
"to",
"the",
"web",
"target",
"."
] | train | https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L573-L582 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/spatial/topography/ST_Drape.java | ST_Drape.drapeMultiLineString | public static Geometry drapeMultiLineString(MultiLineString lines, Geometry triangles, STRtree sTRtree) {
GeometryFactory factory = lines.getFactory();
//Split the triangles in lines to perform all intersections
Geometry triangleLines = LinearComponentExtracter.getGeometry(triangles, true);
int nbLines = lines.getNumGeometries();
LineString[] lineStrings = new LineString[nbLines];
for (int i = 0; i < nbLines; i++) {
lineStrings[i] = (LineString) lineMerge(lines.getGeometryN(i).difference(triangleLines), factory);
}
Geometry diffExt = factory.createMultiLineString(lineStrings);
CoordinateSequenceFilter drapeFilter = new DrapeFilter(sTRtree);
diffExt.apply(drapeFilter);
return diffExt;
} | java | public static Geometry drapeMultiLineString(MultiLineString lines, Geometry triangles, STRtree sTRtree) {
GeometryFactory factory = lines.getFactory();
//Split the triangles in lines to perform all intersections
Geometry triangleLines = LinearComponentExtracter.getGeometry(triangles, true);
int nbLines = lines.getNumGeometries();
LineString[] lineStrings = new LineString[nbLines];
for (int i = 0; i < nbLines; i++) {
lineStrings[i] = (LineString) lineMerge(lines.getGeometryN(i).difference(triangleLines), factory);
}
Geometry diffExt = factory.createMultiLineString(lineStrings);
CoordinateSequenceFilter drapeFilter = new DrapeFilter(sTRtree);
diffExt.apply(drapeFilter);
return diffExt;
} | [
"public",
"static",
"Geometry",
"drapeMultiLineString",
"(",
"MultiLineString",
"lines",
",",
"Geometry",
"triangles",
",",
"STRtree",
"sTRtree",
")",
"{",
"GeometryFactory",
"factory",
"=",
"lines",
".",
"getFactory",
"(",
")",
";",
"//Split the triangles in lines to... | Drape a multilinestring to a set of triangles
@param lines
@param triangles
@param sTRtree
@return | [
"Drape",
"a",
"multilinestring",
"to",
"a",
"set",
"of",
"triangles"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/topography/ST_Drape.java#L128-L141 |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/newproject/BuildSettingWizardPage.java | BuildSettingWizardPage.updateStatus | private void updateStatus(Throwable event) {
Throwable cause = event;
while (cause != null
&& (!(cause instanceof CoreException))
&& cause.getCause() != null
&& cause.getCause() != cause) {
cause = cause.getCause();
}
if (cause instanceof CoreException) {
updateStatus(((CoreException) cause).getStatus());
} else {
final String message;
if (cause != null) {
message = cause.getLocalizedMessage();
} else {
message = event.getLocalizedMessage();
}
final IStatus status = new StatusInfo(IStatus.ERROR, message);
updateStatus(status);
}
} | java | private void updateStatus(Throwable event) {
Throwable cause = event;
while (cause != null
&& (!(cause instanceof CoreException))
&& cause.getCause() != null
&& cause.getCause() != cause) {
cause = cause.getCause();
}
if (cause instanceof CoreException) {
updateStatus(((CoreException) cause).getStatus());
} else {
final String message;
if (cause != null) {
message = cause.getLocalizedMessage();
} else {
message = event.getLocalizedMessage();
}
final IStatus status = new StatusInfo(IStatus.ERROR, message);
updateStatus(status);
}
} | [
"private",
"void",
"updateStatus",
"(",
"Throwable",
"event",
")",
"{",
"Throwable",
"cause",
"=",
"event",
";",
"while",
"(",
"cause",
"!=",
"null",
"&&",
"(",
"!",
"(",
"cause",
"instanceof",
"CoreException",
")",
")",
"&&",
"cause",
".",
"getCause",
"... | Update the status of this page according to the given exception.
@param event the exception. | [
"Update",
"the",
"status",
"of",
"this",
"page",
"according",
"to",
"the",
"given",
"exception",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/newproject/BuildSettingWizardPage.java#L193-L213 |
BranchMetrics/android-branch-deep-linking | Branch-SDK/src/io/branch/referral/PrefHelper.java | PrefHelper.setInteger | public void setInteger(String key, int value) {
prefHelper_.prefsEditor_.putInt(key, value);
prefHelper_.prefsEditor_.apply();
} | java | public void setInteger(String key, int value) {
prefHelper_.prefsEditor_.putInt(key, value);
prefHelper_.prefsEditor_.apply();
} | [
"public",
"void",
"setInteger",
"(",
"String",
"key",
",",
"int",
"value",
")",
"{",
"prefHelper_",
".",
"prefsEditor_",
".",
"putInt",
"(",
"key",
",",
"value",
")",
";",
"prefHelper_",
".",
"prefsEditor_",
".",
"apply",
"(",
")",
";",
"}"
] | <p>Sets the value of the {@link String} key value supplied in preferences.</p>
@param key A {@link String} value containing the key to reference.
@param value An {@link Integer} value to set the preference record to. | [
"<p",
">",
"Sets",
"the",
"value",
"of",
"the",
"{",
"@link",
"String",
"}",
"key",
"value",
"supplied",
"in",
"preferences",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/PrefHelper.java#L970-L973 |
azkaban/azkaban | az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/ORCFileViewer.java | ORCFileViewer.getSchema | @Override
public String getSchema(FileSystem fs, Path path) {
String schema = null;
try {
Reader orcReader = OrcFile.createReader(fs, path);
schema = orcReader.getObjectInspector().getTypeName();
} catch (IOException e) {
logger
.warn("Cannot get schema for file: " + path.toUri().getPath());
return null;
}
return schema;
} | java | @Override
public String getSchema(FileSystem fs, Path path) {
String schema = null;
try {
Reader orcReader = OrcFile.createReader(fs, path);
schema = orcReader.getObjectInspector().getTypeName();
} catch (IOException e) {
logger
.warn("Cannot get schema for file: " + path.toUri().getPath());
return null;
}
return schema;
} | [
"@",
"Override",
"public",
"String",
"getSchema",
"(",
"FileSystem",
"fs",
",",
"Path",
"path",
")",
"{",
"String",
"schema",
"=",
"null",
";",
"try",
"{",
"Reader",
"orcReader",
"=",
"OrcFile",
".",
"createReader",
"(",
"fs",
",",
"path",
")",
";",
"s... | Get schema in same syntax as in hadoop --orcdump {@inheritDoc}
@see HdfsFileViewer#getSchema(org.apache.hadoop.fs.FileSystem,
org.apache.hadoop.fs.Path) | [
"Get",
"schema",
"in",
"same",
"syntax",
"as",
"in",
"hadoop",
"--",
"orcdump",
"{",
"@inheritDoc",
"}"
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-hdfs-viewer/src/main/java/azkaban/viewer/hdfs/ORCFileViewer.java#L139-L152 |
aspectran/aspectran | shell/src/main/java/com/aspectran/shell/command/option/HelpFormatter.java | HelpFormatter.appendOptionGroup | private void appendOptionGroup(StringBuilder sb, OptionGroup group) {
if (!group.isRequired()) {
sb.append(OPTIONAL_BRACKET_OPEN);
}
List<Option> optList = new ArrayList<>(group.getOptions());
if (optList.size() > 1 && getOptionComparator() != null) {
optList.sort(getOptionComparator());
}
// for each option in the OptionGroup
for (Iterator<Option> it = optList.iterator(); it.hasNext();) {
// whether the option is required or not is handled at group level
appendOption(sb, it.next(), true);
if (it.hasNext()) {
sb.append(" | ");
}
}
if (!group.isRequired()) {
sb.append(OPTIONAL_BRACKET_CLOSE);
}
} | java | private void appendOptionGroup(StringBuilder sb, OptionGroup group) {
if (!group.isRequired()) {
sb.append(OPTIONAL_BRACKET_OPEN);
}
List<Option> optList = new ArrayList<>(group.getOptions());
if (optList.size() > 1 && getOptionComparator() != null) {
optList.sort(getOptionComparator());
}
// for each option in the OptionGroup
for (Iterator<Option> it = optList.iterator(); it.hasNext();) {
// whether the option is required or not is handled at group level
appendOption(sb, it.next(), true);
if (it.hasNext()) {
sb.append(" | ");
}
}
if (!group.isRequired()) {
sb.append(OPTIONAL_BRACKET_CLOSE);
}
} | [
"private",
"void",
"appendOptionGroup",
"(",
"StringBuilder",
"sb",
",",
"OptionGroup",
"group",
")",
"{",
"if",
"(",
"!",
"group",
".",
"isRequired",
"(",
")",
")",
"{",
"sb",
".",
"append",
"(",
"OPTIONAL_BRACKET_OPEN",
")",
";",
"}",
"List",
"<",
"Opt... | Appends the usage clause for an OptionGroup to a StringBuilder.
The clause is wrapped in square brackets if the group is required.
The display of the options is handled by appendOption.
@param sb the StringBuilder to append to
@param group the group to append | [
"Appends",
"the",
"usage",
"clause",
"for",
"an",
"OptionGroup",
"to",
"a",
"StringBuilder",
".",
"The",
"clause",
"is",
"wrapped",
"in",
"square",
"brackets",
"if",
"the",
"group",
"is",
"required",
".",
"The",
"display",
"of",
"the",
"options",
"is",
"ha... | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/shell/src/main/java/com/aspectran/shell/command/option/HelpFormatter.java#L261-L280 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/core/managers/AccountManager.java | AccountManager.setPassword | @CheckReturnValue
public AccountManager setPassword(String newPassword, String currentPassword)
{
Checks.notNull(newPassword, "password");
Checks.check(newPassword.length() >= 6 && newPassword.length() <= 128, "Password must be between 2-128 characters long");
this.currentPassword = currentPassword;
this.password = newPassword;
set |= PASSWORD;
return this;
} | java | @CheckReturnValue
public AccountManager setPassword(String newPassword, String currentPassword)
{
Checks.notNull(newPassword, "password");
Checks.check(newPassword.length() >= 6 && newPassword.length() <= 128, "Password must be between 2-128 characters long");
this.currentPassword = currentPassword;
this.password = newPassword;
set |= PASSWORD;
return this;
} | [
"@",
"CheckReturnValue",
"public",
"AccountManager",
"setPassword",
"(",
"String",
"newPassword",
",",
"String",
"currentPassword",
")",
"{",
"Checks",
".",
"notNull",
"(",
"newPassword",
",",
"\"password\"",
")",
";",
"Checks",
".",
"check",
"(",
"newPassword",
... | Sets the password for the currently logged in client account.
<br>If the new password is equal to the current password this does nothing.
@param newPassword
The new password for the currently logged in account
@param currentPassword
The <b>valid</b> current password for the represented account
@throws net.dv8tion.jda.core.exceptions.AccountTypeException
If the currently logged in account is not from {@link net.dv8tion.jda.core.AccountType#CLIENT}
@throws IllegalArgumentException
If any of the provided passwords are {@code null} or empty
@return AccountManager for chaining convenience | [
"Sets",
"the",
"password",
"for",
"the",
"currently",
"logged",
"in",
"client",
"account",
".",
"<br",
">",
"If",
"the",
"new",
"password",
"is",
"equal",
"to",
"the",
"current",
"password",
"this",
"does",
"nothing",
"."
] | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/managers/AccountManager.java#L304-L313 |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/kerneldiscovery/StandardKernelDiscoveryService.java | StandardKernelDiscoveryService.postConstruction | @Inject
void postConstruction(NetworkService networkService, ExecutorService executorService) {
this.network = networkService;
this.network.addListener(new NetworkStartListener(), executorService.getExecutorService());
} | java | @Inject
void postConstruction(NetworkService networkService, ExecutorService executorService) {
this.network = networkService;
this.network.addListener(new NetworkStartListener(), executorService.getExecutorService());
} | [
"@",
"Inject",
"void",
"postConstruction",
"(",
"NetworkService",
"networkService",
",",
"ExecutorService",
"executorService",
")",
"{",
"this",
".",
"network",
"=",
"networkService",
";",
"this",
".",
"network",
".",
"addListener",
"(",
"new",
"NetworkStartListener... | Do the post initialization.
@param networkService network service to be linked to.
@param executorService execution service to use. | [
"Do",
"the",
"post",
"initialization",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/kerneldiscovery/StandardKernelDiscoveryService.java#L85-L89 |
inkstand-io/scribble | scribble-file/src/main/java/io/inkstand/scribble/rules/builder/TemporaryFileBuilder.java | TemporaryFileBuilder.asZip | public ZipFileBuilder asZip() {
final ZipFileBuilder zfb = new ZipFileBuilder(folder, filename);
if(this.content != null) {
zfb.addResource(getContenFileName(), this.content);
}
return zfb;
} | java | public ZipFileBuilder asZip() {
final ZipFileBuilder zfb = new ZipFileBuilder(folder, filename);
if(this.content != null) {
zfb.addResource(getContenFileName(), this.content);
}
return zfb;
} | [
"public",
"ZipFileBuilder",
"asZip",
"(",
")",
"{",
"final",
"ZipFileBuilder",
"zfb",
"=",
"new",
"ZipFileBuilder",
"(",
"folder",
",",
"filename",
")",
";",
"if",
"(",
"this",
".",
"content",
"!=",
"null",
")",
"{",
"zfb",
".",
"addResource",
"(",
"getC... | Indicates the content for the file should be zipped. If only one content reference is provided, the zip
will only contain this file.
@return
the builder | [
"Indicates",
"the",
"content",
"for",
"the",
"file",
"should",
"be",
"zipped",
".",
"If",
"only",
"one",
"content",
"reference",
"is",
"provided",
"the",
"zip",
"will",
"only",
"contain",
"this",
"file",
"."
] | train | https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-file/src/main/java/io/inkstand/scribble/rules/builder/TemporaryFileBuilder.java#L100-L106 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/core/utils/PermissionUtil.java | PermissionUtil.canInteract | public static boolean canInteract(Member issuer, Member target)
{
Checks.notNull(issuer, "Issuer Member");
Checks.notNull(target, "Target Member");
Guild guild = issuer.getGuild();
if (!guild.equals(target.getGuild()))
throw new IllegalArgumentException("Provided members must both be Member objects of the same Guild!");
if(guild.getOwner().equals(issuer))
return true;
if(guild.getOwner().equals(target))
return false;
List<Role> issuerRoles = issuer.getRoles();
List<Role> targetRoles = target.getRoles();
return !issuerRoles.isEmpty() && (targetRoles.isEmpty() || canInteract(issuerRoles.get(0), targetRoles.get(0)));
} | java | public static boolean canInteract(Member issuer, Member target)
{
Checks.notNull(issuer, "Issuer Member");
Checks.notNull(target, "Target Member");
Guild guild = issuer.getGuild();
if (!guild.equals(target.getGuild()))
throw new IllegalArgumentException("Provided members must both be Member objects of the same Guild!");
if(guild.getOwner().equals(issuer))
return true;
if(guild.getOwner().equals(target))
return false;
List<Role> issuerRoles = issuer.getRoles();
List<Role> targetRoles = target.getRoles();
return !issuerRoles.isEmpty() && (targetRoles.isEmpty() || canInteract(issuerRoles.get(0), targetRoles.get(0)));
} | [
"public",
"static",
"boolean",
"canInteract",
"(",
"Member",
"issuer",
",",
"Member",
"target",
")",
"{",
"Checks",
".",
"notNull",
"(",
"issuer",
",",
"\"Issuer Member\"",
")",
";",
"Checks",
".",
"notNull",
"(",
"target",
",",
"\"Target Member\"",
")",
";"... | Checks if one given Member can interact with a 2nd given Member - in a permission sense (kick/ban/modify perms).
This only checks the Role-Position and does not check the actual permission (kick/ban/manage_role/...)
@param issuer
The member that tries to interact with 2nd member
@param target
The member that is the target of the interaction
@throws IllegalArgumentException
if any of the provided parameters is {@code null}
or the provided entities are not from the same guild
@return True, if issuer can interact with target in guild | [
"Checks",
"if",
"one",
"given",
"Member",
"can",
"interact",
"with",
"a",
"2nd",
"given",
"Member",
"-",
"in",
"a",
"permission",
"sense",
"(",
"kick",
"/",
"ban",
"/",
"modify",
"perms",
")",
".",
"This",
"only",
"checks",
"the",
"Role",
"-",
"Positio... | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/utils/PermissionUtil.java#L43-L58 |
datumbox/lpsolve | src/main/java/lpsolve/LpSolve.java | LpSolve.putAbortfunc | public void putAbortfunc(AbortListener listener, Object userhandle) throws LpSolveException {
abortListener = listener;
abortUserhandle = (listener != null) ? userhandle : null;
addLp(this);
registerAbortfunc();
} | java | public void putAbortfunc(AbortListener listener, Object userhandle) throws LpSolveException {
abortListener = listener;
abortUserhandle = (listener != null) ? userhandle : null;
addLp(this);
registerAbortfunc();
} | [
"public",
"void",
"putAbortfunc",
"(",
"AbortListener",
"listener",
",",
"Object",
"userhandle",
")",
"throws",
"LpSolveException",
"{",
"abortListener",
"=",
"listener",
";",
"abortUserhandle",
"=",
"(",
"listener",
"!=",
"null",
")",
"?",
"userhandle",
":",
"n... | Register an <code>AbortListener</code> for callback.
@param listener the listener that should be called by lp_solve
@param userhandle an arbitrary object that is passed to the listener on call | [
"Register",
"an",
"<code",
">",
"AbortListener<",
"/",
"code",
">",
"for",
"callback",
"."
] | train | https://github.com/datumbox/lpsolve/blob/201b3e99153d907bb99c189e5647bc71a3a1add6/src/main/java/lpsolve/LpSolve.java#L1595-L1600 |
devcon5io/common | cli/src/main/java/io/devcon5/cli/OptionInjector.java | OptionInjector.injectParameters | private void injectParameters(Object target, Map<String, Option> options) {
ClassStreams.selfAndSupertypes(target.getClass()).forEach(type -> {
for (Field f : type.getDeclaredFields()) {
Optional.ofNullable(f.getAnnotation(CliOption.class))
.ifPresent(opt -> populate(f, target, getEffectiveValue(options, opt)));
Optional.ofNullable(f.getAnnotation(CliOptionGroup.class))
.ifPresent(opt -> populate(f, target, options));
}
});
} | java | private void injectParameters(Object target, Map<String, Option> options) {
ClassStreams.selfAndSupertypes(target.getClass()).forEach(type -> {
for (Field f : type.getDeclaredFields()) {
Optional.ofNullable(f.getAnnotation(CliOption.class))
.ifPresent(opt -> populate(f, target, getEffectiveValue(options, opt)));
Optional.ofNullable(f.getAnnotation(CliOptionGroup.class))
.ifPresent(opt -> populate(f, target, options));
}
});
} | [
"private",
"void",
"injectParameters",
"(",
"Object",
"target",
",",
"Map",
"<",
"String",
",",
"Option",
">",
"options",
")",
"{",
"ClassStreams",
".",
"selfAndSupertypes",
"(",
"target",
".",
"getClass",
"(",
")",
")",
".",
"forEach",
"(",
"type",
"->",
... | Inject parameter values from the map of options.
@param target
the target instance to parse cli parameters
@param options
the map of options, mapping short option names to {@link org.apache.commons.cli.Option} instances | [
"Inject",
"parameter",
"values",
"from",
"the",
"map",
"of",
"options",
"."
] | train | https://github.com/devcon5io/common/blob/363688e0dc904d559682bf796bd6c836b4e0efc7/cli/src/main/java/io/devcon5/cli/OptionInjector.java#L141-L150 |
h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/ModelMojoReader.java | ModelMojoReader.readFrom | public static MojoModel readFrom(MojoReaderBackend reader, final boolean readModelDescriptor) throws IOException {
try {
Map<String, Object> info = parseModelInfo(reader);
if (! info.containsKey("algorithm"))
throw new IllegalStateException("Unable to find information about the model's algorithm.");
String algo = String.valueOf(info.get("algorithm"));
ModelMojoReader mmr = ModelMojoFactory.INSTANCE.getMojoReader(algo);
mmr._lkv = info;
mmr._reader = reader;
mmr.readAll(readModelDescriptor);
return mmr._model;
} finally {
if (reader instanceof Closeable)
((Closeable) reader).close();
}
} | java | public static MojoModel readFrom(MojoReaderBackend reader, final boolean readModelDescriptor) throws IOException {
try {
Map<String, Object> info = parseModelInfo(reader);
if (! info.containsKey("algorithm"))
throw new IllegalStateException("Unable to find information about the model's algorithm.");
String algo = String.valueOf(info.get("algorithm"));
ModelMojoReader mmr = ModelMojoFactory.INSTANCE.getMojoReader(algo);
mmr._lkv = info;
mmr._reader = reader;
mmr.readAll(readModelDescriptor);
return mmr._model;
} finally {
if (reader instanceof Closeable)
((Closeable) reader).close();
}
} | [
"public",
"static",
"MojoModel",
"readFrom",
"(",
"MojoReaderBackend",
"reader",
",",
"final",
"boolean",
"readModelDescriptor",
")",
"throws",
"IOException",
"{",
"try",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"info",
"=",
"parseModelInfo",
"(",
"reader"... | De-serializes a {@link MojoModel}, creating an instance of {@link MojoModel} useful for scoring
and model evaluation.
@param reader An instance of {@link MojoReaderBackend} to read from existing MOJO
@param readModelDescriptor If true,
@return De-serialized {@link MojoModel}
@throws IOException Whenever there is an error reading the {@link MojoModel}'s data. | [
"De",
"-",
"serializes",
"a",
"{",
"@link",
"MojoModel",
"}",
"creating",
"an",
"instance",
"of",
"{",
"@link",
"MojoModel",
"}",
"useful",
"for",
"scoring",
"and",
"model",
"evaluation",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/ModelMojoReader.java#L50-L65 |
alkacon/opencms-core | src/org/opencms/loader/CmsRedirectLoader.java | CmsRedirectLoader.getController | protected CmsFlexController getController(
CmsObject cms,
CmsResource resource,
HttpServletRequest req,
HttpServletResponse res,
boolean streaming,
boolean top) {
CmsFlexController controller = null;
if (top) {
// only check for existing controller if this is the "top" request/response
controller = CmsFlexController.getController(req);
}
if (controller == null) {
// create new request / response wrappers
controller = new CmsFlexController(cms, resource, m_cache, req, res, streaming, top);
CmsFlexController.setController(req, controller);
CmsFlexRequest f_req = new CmsFlexRequest(req, controller);
CmsFlexResponse f_res = new CmsFlexResponse(res, controller, streaming, true);
controller.push(f_req, f_res);
} else if (controller.isForwardMode()) {
// reset CmsObject (because of URI) if in forward mode
controller = new CmsFlexController(cms, controller);
CmsFlexController.setController(req, controller);
}
return controller;
} | java | protected CmsFlexController getController(
CmsObject cms,
CmsResource resource,
HttpServletRequest req,
HttpServletResponse res,
boolean streaming,
boolean top) {
CmsFlexController controller = null;
if (top) {
// only check for existing controller if this is the "top" request/response
controller = CmsFlexController.getController(req);
}
if (controller == null) {
// create new request / response wrappers
controller = new CmsFlexController(cms, resource, m_cache, req, res, streaming, top);
CmsFlexController.setController(req, controller);
CmsFlexRequest f_req = new CmsFlexRequest(req, controller);
CmsFlexResponse f_res = new CmsFlexResponse(res, controller, streaming, true);
controller.push(f_req, f_res);
} else if (controller.isForwardMode()) {
// reset CmsObject (because of URI) if in forward mode
controller = new CmsFlexController(cms, controller);
CmsFlexController.setController(req, controller);
}
return controller;
} | [
"protected",
"CmsFlexController",
"getController",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
",",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"res",
",",
"boolean",
"streaming",
",",
"boolean",
"top",
")",
"{",
"CmsFlexController",
"control... | Delivers a Flex controller, either by creating a new one, or by re-using an existing one.<p>
@param cms the initial CmsObject to wrap in the controller
@param resource the resource requested
@param req the current request
@param res the current response
@param streaming indicates if the response is streaming
@param top indicates if the response is the top response
@return a Flex controller | [
"Delivers",
"a",
"Flex",
"controller",
"either",
"by",
"creating",
"a",
"new",
"one",
"or",
"by",
"re",
"-",
"using",
"an",
"existing",
"one",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsRedirectLoader.java#L209-L235 |
JodaOrg/joda-money | src/main/java/org/joda/money/Money.java | Money.ofMajor | public static Money ofMajor(CurrencyUnit currency, long amountMajor) {
return Money.of(currency, BigDecimal.valueOf(amountMajor), RoundingMode.UNNECESSARY);
} | java | public static Money ofMajor(CurrencyUnit currency, long amountMajor) {
return Money.of(currency, BigDecimal.valueOf(amountMajor), RoundingMode.UNNECESSARY);
} | [
"public",
"static",
"Money",
"ofMajor",
"(",
"CurrencyUnit",
"currency",
",",
"long",
"amountMajor",
")",
"{",
"return",
"Money",
".",
"of",
"(",
"currency",
",",
"BigDecimal",
".",
"valueOf",
"(",
"amountMajor",
")",
",",
"RoundingMode",
".",
"UNNECESSARY",
... | Obtains an instance of {@code Money} from an amount in major units.
<p>
This allows you to create an instance with a specific currency and amount.
The amount is a whole number only. Thus you can initialise the value
'USD 20', but not the value 'USD 20.32'.
For example, {@code ofMajor(USD, 25)} creates the instance {@code USD 25.00}.
@param currency the currency, not null
@param amountMajor the amount of money in the major division of the currency
@return the new instance, never null | [
"Obtains",
"an",
"instance",
"of",
"{",
"@code",
"Money",
"}",
"from",
"an",
"amount",
"in",
"major",
"units",
".",
"<p",
">",
"This",
"allows",
"you",
"to",
"create",
"an",
"instance",
"with",
"a",
"specific",
"currency",
"and",
"amount",
".",
"The",
... | train | https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/Money.java#L162-L164 |
Azure/azure-sdk-for-java | logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/CertificatesInner.java | CertificatesInner.getAsync | public Observable<IntegrationAccountCertificateInner> getAsync(String resourceGroupName, String integrationAccountName, String certificateName) {
return getWithServiceResponseAsync(resourceGroupName, integrationAccountName, certificateName).map(new Func1<ServiceResponse<IntegrationAccountCertificateInner>, IntegrationAccountCertificateInner>() {
@Override
public IntegrationAccountCertificateInner call(ServiceResponse<IntegrationAccountCertificateInner> response) {
return response.body();
}
});
} | java | public Observable<IntegrationAccountCertificateInner> getAsync(String resourceGroupName, String integrationAccountName, String certificateName) {
return getWithServiceResponseAsync(resourceGroupName, integrationAccountName, certificateName).map(new Func1<ServiceResponse<IntegrationAccountCertificateInner>, IntegrationAccountCertificateInner>() {
@Override
public IntegrationAccountCertificateInner call(ServiceResponse<IntegrationAccountCertificateInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"IntegrationAccountCertificateInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"integrationAccountName",
",",
"String",
"certificateName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",... | Gets an integration account certificate.
@param resourceGroupName The resource group name.
@param integrationAccountName The integration account name.
@param certificateName The integration account certificate name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the IntegrationAccountCertificateInner object | [
"Gets",
"an",
"integration",
"account",
"certificate",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/CertificatesInner.java#L369-L376 |
Azure/azure-sdk-for-java | sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersInner.java | SyncMembersInner.beginCreateOrUpdateAsync | public Observable<SyncMemberInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters).map(new Func1<ServiceResponse<SyncMemberInner>, SyncMemberInner>() {
@Override
public SyncMemberInner call(ServiceResponse<SyncMemberInner> response) {
return response.body();
}
});
} | java | public Observable<SyncMemberInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters).map(new Func1<ServiceResponse<SyncMemberInner>, SyncMemberInner>() {
@Override
public SyncMemberInner call(ServiceResponse<SyncMemberInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"SyncMemberInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
",",
"String",
"syncGroupName",
",",
"String",
"syncMemberName",
",",
"SyncMemberInner",
"par... | Creates or updates a sync member.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database on which the sync group is hosted.
@param syncGroupName The name of the sync group on which the sync member is hosted.
@param syncMemberName The name of the sync member.
@param parameters The requested sync member resource state.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the SyncMemberInner object | [
"Creates",
"or",
"updates",
"a",
"sync",
"member",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersInner.java#L372-L379 |
albfernandez/itext2 | src/main/java/com/lowagie/text/rtf/RtfWriter2.java | RtfWriter2.importRtfDocument | public void importRtfDocument(InputStream documentSource, EventListener[] events ) throws IOException, DocumentException {
if(!this.open) {
throw new DocumentException("The document must be open to import RTF documents.");
}
RtfParser rtfImport = new RtfParser(this.document);
if(events != null) {
for(int idx=0;idx<events.length;idx++) {
rtfImport.addListener(events[idx]);
}
}
rtfImport.importRtfDocument(documentSource, this.rtfDoc);
} | java | public void importRtfDocument(InputStream documentSource, EventListener[] events ) throws IOException, DocumentException {
if(!this.open) {
throw new DocumentException("The document must be open to import RTF documents.");
}
RtfParser rtfImport = new RtfParser(this.document);
if(events != null) {
for(int idx=0;idx<events.length;idx++) {
rtfImport.addListener(events[idx]);
}
}
rtfImport.importRtfDocument(documentSource, this.rtfDoc);
} | [
"public",
"void",
"importRtfDocument",
"(",
"InputStream",
"documentSource",
",",
"EventListener",
"[",
"]",
"events",
")",
"throws",
"IOException",
",",
"DocumentException",
"{",
"if",
"(",
"!",
"this",
".",
"open",
")",
"{",
"throw",
"new",
"DocumentException"... | Adds the complete RTF document to the current RTF document being generated.
It will parse the font and color tables and correct the font and color references
so that the imported RTF document retains its formattings.
Uses new RtfParser object.
(author: Howard Shank)
@param documentSource The InputStream to read the RTF document from.
@param events The array of event listeners. May be null
@throws IOException
@throws DocumentException
@see RtfParser
@see RtfParser#importRtfDocument(InputStream, RtfDocument)
@since 2.0.8 | [
"Adds",
"the",
"complete",
"RTF",
"document",
"to",
"the",
"current",
"RTF",
"document",
"being",
"generated",
".",
"It",
"will",
"parse",
"the",
"font",
"and",
"color",
"tables",
"and",
"correct",
"the",
"font",
"and",
"color",
"references",
"so",
"that",
... | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/RtfWriter2.java#L286-L297 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/message/StringFormatterMessageFactory.java | StringFormatterMessageFactory.newMessage | @Override
public Message newMessage(final String message, final Object... params) {
return new StringFormattedMessage(message, params);
} | java | @Override
public Message newMessage(final String message, final Object... params) {
return new StringFormattedMessage(message, params);
} | [
"@",
"Override",
"public",
"Message",
"newMessage",
"(",
"final",
"String",
"message",
",",
"final",
"Object",
"...",
"params",
")",
"{",
"return",
"new",
"StringFormattedMessage",
"(",
"message",
",",
"params",
")",
";",
"}"
] | Creates {@link StringFormattedMessage} instances.
@param message The message pattern.
@param params The parameters to the message.
@return The Message.
@see MessageFactory#newMessage(String, Object...) | [
"Creates",
"{",
"@link",
"StringFormattedMessage",
"}",
"instances",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/message/StringFormatterMessageFactory.java#L60-L63 |
jglobus/JGlobus | myproxy/src/main/java/org/globus/myproxy/MyProxy.java | MyProxy.get | public GSSCredential get(String username,
String passphrase,
int lifetime)
throws MyProxyException {
return get(null, username, passphrase, lifetime);
} | java | public GSSCredential get(String username,
String passphrase,
int lifetime)
throws MyProxyException {
return get(null, username, passphrase, lifetime);
} | [
"public",
"GSSCredential",
"get",
"(",
"String",
"username",
",",
"String",
"passphrase",
",",
"int",
"lifetime",
")",
"throws",
"MyProxyException",
"{",
"return",
"get",
"(",
"null",
",",
"username",
",",
"passphrase",
",",
"lifetime",
")",
";",
"}"
] | Retrieves delegated credentials from MyProxy server Anonymously
(without local credentials)
Notes: Performs simple verification of private/public keys of
the delegated credential. Should be improved later.
And only checks for RSA keys.
@param username
The username of the credentials to retrieve.
@param passphrase
The passphrase of the credentials to retrieve.
@param lifetime
The requested lifetime of the retrieved credential (in seconds).
@return GSSCredential
The retrieved delegated credentials.
@exception MyProxyException
If an error occurred during the operation. | [
"Retrieves",
"delegated",
"credentials",
"from",
"MyProxy",
"server",
"Anonymously",
"(",
"without",
"local",
"credentials",
")"
] | train | https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/myproxy/src/main/java/org/globus/myproxy/MyProxy.java#L897-L902 |
apache/groovy | subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java | DateTimeExtensions.isUptoEligible | private static boolean isUptoEligible(Temporal from, Temporal to) {
TemporalAmount amount = rightShift(from, to);
if (amount instanceof Period) {
return isNonnegative((Period) amount);
} else if (amount instanceof Duration) {
return isNonnegative((Duration) amount);
} else {
throw new GroovyRuntimeException("Temporal implementations of "
+ from.getClass().getCanonicalName() + " are not supported by upto().");
}
} | java | private static boolean isUptoEligible(Temporal from, Temporal to) {
TemporalAmount amount = rightShift(from, to);
if (amount instanceof Period) {
return isNonnegative((Period) amount);
} else if (amount instanceof Duration) {
return isNonnegative((Duration) amount);
} else {
throw new GroovyRuntimeException("Temporal implementations of "
+ from.getClass().getCanonicalName() + " are not supported by upto().");
}
} | [
"private",
"static",
"boolean",
"isUptoEligible",
"(",
"Temporal",
"from",
",",
"Temporal",
"to",
")",
"{",
"TemporalAmount",
"amount",
"=",
"rightShift",
"(",
"from",
",",
"to",
")",
";",
"if",
"(",
"amount",
"instanceof",
"Period",
")",
"{",
"return",
"i... | Returns true if the {@code from} can be iterated up to {@code to}. | [
"Returns",
"true",
"if",
"the",
"{"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java#L169-L179 |
alkacon/opencms-core | src/org/opencms/workplace/CmsWorkplace.java | CmsWorkplace.getWorkplaceExplorerLink | public static String getWorkplaceExplorerLink(final CmsObject cms, final String explorerRootPath) {
// split the root site:
String targetSiteRoot = OpenCms.getSiteManager().getSiteRoot(explorerRootPath);
if (targetSiteRoot == null) {
if (OpenCms.getSiteManager().startsWithShared(explorerRootPath)) {
targetSiteRoot = OpenCms.getSiteManager().getSharedFolder();
} else {
targetSiteRoot = "";
}
}
String targetVfsFolder;
if (explorerRootPath.startsWith(targetSiteRoot)) {
targetVfsFolder = explorerRootPath.substring(targetSiteRoot.length());
targetVfsFolder = CmsStringUtil.joinPaths("/", targetVfsFolder);
} else {
targetVfsFolder = "/";
// happens in case of the shared site
}
StringBuilder link2Source = new StringBuilder();
link2Source.append(JSP_WORKPLACE_URI);
link2Source.append("?");
link2Source.append(CmsWorkplace.PARAM_WP_EXPLORER_RESOURCE);
link2Source.append("=");
link2Source.append(targetVfsFolder);
link2Source.append("&");
link2Source.append(PARAM_WP_VIEW);
link2Source.append("=");
link2Source.append(
OpenCms.getLinkManager().substituteLinkForUnknownTarget(
cms,
"/system/workplace/views/explorer/explorer_fs.jsp"));
link2Source.append("&");
link2Source.append(PARAM_WP_SITE);
link2Source.append("=");
link2Source.append(targetSiteRoot);
String result = link2Source.toString();
result = OpenCms.getLinkManager().substituteLinkForUnknownTarget(cms, result);
return result;
} | java | public static String getWorkplaceExplorerLink(final CmsObject cms, final String explorerRootPath) {
// split the root site:
String targetSiteRoot = OpenCms.getSiteManager().getSiteRoot(explorerRootPath);
if (targetSiteRoot == null) {
if (OpenCms.getSiteManager().startsWithShared(explorerRootPath)) {
targetSiteRoot = OpenCms.getSiteManager().getSharedFolder();
} else {
targetSiteRoot = "";
}
}
String targetVfsFolder;
if (explorerRootPath.startsWith(targetSiteRoot)) {
targetVfsFolder = explorerRootPath.substring(targetSiteRoot.length());
targetVfsFolder = CmsStringUtil.joinPaths("/", targetVfsFolder);
} else {
targetVfsFolder = "/";
// happens in case of the shared site
}
StringBuilder link2Source = new StringBuilder();
link2Source.append(JSP_WORKPLACE_URI);
link2Source.append("?");
link2Source.append(CmsWorkplace.PARAM_WP_EXPLORER_RESOURCE);
link2Source.append("=");
link2Source.append(targetVfsFolder);
link2Source.append("&");
link2Source.append(PARAM_WP_VIEW);
link2Source.append("=");
link2Source.append(
OpenCms.getLinkManager().substituteLinkForUnknownTarget(
cms,
"/system/workplace/views/explorer/explorer_fs.jsp"));
link2Source.append("&");
link2Source.append(PARAM_WP_SITE);
link2Source.append("=");
link2Source.append(targetSiteRoot);
String result = link2Source.toString();
result = OpenCms.getLinkManager().substituteLinkForUnknownTarget(cms, result);
return result;
} | [
"public",
"static",
"String",
"getWorkplaceExplorerLink",
"(",
"final",
"CmsObject",
"cms",
",",
"final",
"String",
"explorerRootPath",
")",
"{",
"// split the root site:",
"String",
"targetSiteRoot",
"=",
"OpenCms",
".",
"getSiteManager",
"(",
")",
".",
"getSiteRoot"... | Creates a link for the OpenCms workplace that will reload the whole workplace, switch to the explorer view, the
site of the given explorerRootPath and show the folder given in the explorerRootPath.
<p>
@param cms
the cms object
@param explorerRootPath
a root relative folder link (has to end with '/').
@return a link for the OpenCms workplace that will reload the whole workplace, switch to the explorer view, the
site of the given explorerRootPath and show the folder given in the explorerRootPath. | [
"Creates",
"a",
"link",
"for",
"the",
"OpenCms",
"workplace",
"that",
"will",
"reload",
"the",
"whole",
"workplace",
"switch",
"to",
"the",
"explorer",
"view",
"the",
"site",
"of",
"the",
"given",
"explorerRootPath",
"and",
"show",
"the",
"folder",
"given",
... | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplace.java#L773-L814 |
ironjacamar/ironjacamar | codegenerator/src/main/java/org/ironjacamar/codegenerator/xml/RaXmlGen.java | RaXmlGen.writeRequireConfigPropsXml | void writeRequireConfigPropsXml(List<ConfigPropType> props, Writer out, int indent) throws IOException
{
if (props == null || props.size() == 0)
return;
for (ConfigPropType prop : props)
{
if (prop.isRequired())
{
writeIndent(out, indent);
out.write("<required-config-property>");
writeEol(out);
writeIndent(out, indent + 1);
out.write("<config-property-name>" + prop.getName() + "</config-property-name>");
writeEol(out);
writeIndent(out, indent);
out.write("</required-config-property>");
writeEol(out);
}
}
writeEol(out);
} | java | void writeRequireConfigPropsXml(List<ConfigPropType> props, Writer out, int indent) throws IOException
{
if (props == null || props.size() == 0)
return;
for (ConfigPropType prop : props)
{
if (prop.isRequired())
{
writeIndent(out, indent);
out.write("<required-config-property>");
writeEol(out);
writeIndent(out, indent + 1);
out.write("<config-property-name>" + prop.getName() + "</config-property-name>");
writeEol(out);
writeIndent(out, indent);
out.write("</required-config-property>");
writeEol(out);
}
}
writeEol(out);
} | [
"void",
"writeRequireConfigPropsXml",
"(",
"List",
"<",
"ConfigPropType",
">",
"props",
",",
"Writer",
"out",
",",
"int",
"indent",
")",
"throws",
"IOException",
"{",
"if",
"(",
"props",
"==",
"null",
"||",
"props",
".",
"size",
"(",
")",
"==",
"0",
")",... | Output required config props xml part
@param props config properties
@param out Writer
@param indent space number
@throws IOException ioException | [
"Output",
"required",
"config",
"props",
"xml",
"part"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/xml/RaXmlGen.java#L211-L233 |
infinispan/infinispan | counter/src/main/java/org/infinispan/counter/impl/weak/WeakCounterImpl.java | WeakCounterImpl.removeWeakCounter | public static void removeWeakCounter(Cache<WeakCounterKey, CounterValue> cache, CounterConfiguration configuration,
String counterName) {
ByteString counterNameByteString = ByteString.fromString(counterName);
for (int i = 0; i < configuration.concurrencyLevel(); ++i) {
cache.remove(new WeakCounterKey(counterNameByteString, i));
}
} | java | public static void removeWeakCounter(Cache<WeakCounterKey, CounterValue> cache, CounterConfiguration configuration,
String counterName) {
ByteString counterNameByteString = ByteString.fromString(counterName);
for (int i = 0; i < configuration.concurrencyLevel(); ++i) {
cache.remove(new WeakCounterKey(counterNameByteString, i));
}
} | [
"public",
"static",
"void",
"removeWeakCounter",
"(",
"Cache",
"<",
"WeakCounterKey",
",",
"CounterValue",
">",
"cache",
",",
"CounterConfiguration",
"configuration",
",",
"String",
"counterName",
")",
"{",
"ByteString",
"counterNameByteString",
"=",
"ByteString",
"."... | It removes a weak counter from the {@code cache}, identified by the {@code counterName}.
@param cache The {@link Cache} to remove the counter from.
@param configuration The counter's configuration.
@param counterName The counter's name. | [
"It",
"removes",
"a",
"weak",
"counter",
"from",
"the",
"{",
"@code",
"cache",
"}",
"identified",
"by",
"the",
"{",
"@code",
"counterName",
"}",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/counter/src/main/java/org/infinispan/counter/impl/weak/WeakCounterImpl.java#L113-L119 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WLinkRenderer.java | WLinkRenderer.paintAjaxTrigger | private void paintAjaxTrigger(final WLink link, final XmlStringBuilder xml) {
AjaxTarget[] actionTargets = link.getActionTargets();
// Start tag
xml.appendTagOpen("ui:ajaxtrigger");
xml.appendAttribute("triggerId", link.getId());
xml.appendClose();
if (actionTargets != null && actionTargets.length > 0) {
// Targets
for (AjaxTarget target : actionTargets) {
xml.appendTagOpen("ui:ajaxtargetid");
xml.appendAttribute("targetId", target.getId());
xml.appendEnd();
}
} else {
// Target itself
xml.appendTagOpen("ui:ajaxtargetid");
xml.appendAttribute("targetId", link.getId());
xml.appendEnd();
}
// End tag
xml.appendEndTag("ui:ajaxtrigger");
} | java | private void paintAjaxTrigger(final WLink link, final XmlStringBuilder xml) {
AjaxTarget[] actionTargets = link.getActionTargets();
// Start tag
xml.appendTagOpen("ui:ajaxtrigger");
xml.appendAttribute("triggerId", link.getId());
xml.appendClose();
if (actionTargets != null && actionTargets.length > 0) {
// Targets
for (AjaxTarget target : actionTargets) {
xml.appendTagOpen("ui:ajaxtargetid");
xml.appendAttribute("targetId", target.getId());
xml.appendEnd();
}
} else {
// Target itself
xml.appendTagOpen("ui:ajaxtargetid");
xml.appendAttribute("targetId", link.getId());
xml.appendEnd();
}
// End tag
xml.appendEndTag("ui:ajaxtrigger");
} | [
"private",
"void",
"paintAjaxTrigger",
"(",
"final",
"WLink",
"link",
",",
"final",
"XmlStringBuilder",
"xml",
")",
"{",
"AjaxTarget",
"[",
"]",
"actionTargets",
"=",
"link",
".",
"getActionTargets",
"(",
")",
";",
"// Start tag",
"xml",
".",
"appendTagOpen",
... | Paint the AJAX trigger if the link has an action.
@param link the link component being rendered
@param xml the XmlStringBuilder to paint to. | [
"Paint",
"the",
"AJAX",
"trigger",
"if",
"the",
"link",
"has",
"an",
"action",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WLinkRenderer.java#L130-L154 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.addEntity | public UUID addEntity(UUID appId, String versionId, AddEntityOptionalParameter addEntityOptionalParameter) {
return addEntityWithServiceResponseAsync(appId, versionId, addEntityOptionalParameter).toBlocking().single().body();
} | java | public UUID addEntity(UUID appId, String versionId, AddEntityOptionalParameter addEntityOptionalParameter) {
return addEntityWithServiceResponseAsync(appId, versionId, addEntityOptionalParameter).toBlocking().single().body();
} | [
"public",
"UUID",
"addEntity",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"AddEntityOptionalParameter",
"addEntityOptionalParameter",
")",
"{",
"return",
"addEntityWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"addEntityOptionalParameter",
")... | Adds an entity extractor to the application.
@param appId The application ID.
@param versionId The version ID.
@param addEntityOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws ErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the UUID object if successful. | [
"Adds",
"an",
"entity",
"extractor",
"to",
"the",
"application",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L932-L934 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/TableWriteItems.java | TableWriteItems.withHashOnlyKeysToDelete | public TableWriteItems withHashOnlyKeysToDelete(String hashKeyName,
Object... hashKeyValues) {
if (hashKeyName == null)
throw new IllegalArgumentException();
PrimaryKey[] primaryKeys = new PrimaryKey[hashKeyValues.length];
for (int i=0; i < hashKeyValues.length; i++)
primaryKeys[i] = new PrimaryKey(hashKeyName, hashKeyValues[i]);
return withPrimaryKeysToDelete(primaryKeys);
} | java | public TableWriteItems withHashOnlyKeysToDelete(String hashKeyName,
Object... hashKeyValues) {
if (hashKeyName == null)
throw new IllegalArgumentException();
PrimaryKey[] primaryKeys = new PrimaryKey[hashKeyValues.length];
for (int i=0; i < hashKeyValues.length; i++)
primaryKeys[i] = new PrimaryKey(hashKeyName, hashKeyValues[i]);
return withPrimaryKeysToDelete(primaryKeys);
} | [
"public",
"TableWriteItems",
"withHashOnlyKeysToDelete",
"(",
"String",
"hashKeyName",
",",
"Object",
"...",
"hashKeyValues",
")",
"{",
"if",
"(",
"hashKeyName",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"PrimaryKey",
"[",
"]",
... | Used to specify multiple hash-only primary keys to be deleted from the
current table.
@param hashKeyName
hash-only key name
@param hashKeyValues
a list of hash key values | [
"Used",
"to",
"specify",
"multiple",
"hash",
"-",
"only",
"primary",
"keys",
"to",
"be",
"deleted",
"from",
"the",
"current",
"table",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/TableWriteItems.java#L83-L91 |
krummas/DrizzleJDBC | src/main/java/org/drizzle/jdbc/DrizzleConnection.java | DrizzleConnection.setSavepoint | public Savepoint setSavepoint(final String name) throws SQLException {
final Savepoint drizzleSavepoint = new DrizzleSavepoint(name, savepointCount++);
try {
protocol.setSavepoint(drizzleSavepoint.toString());
} catch (QueryException e) {
throw SQLExceptionMapper.get(e);
}
return drizzleSavepoint;
} | java | public Savepoint setSavepoint(final String name) throws SQLException {
final Savepoint drizzleSavepoint = new DrizzleSavepoint(name, savepointCount++);
try {
protocol.setSavepoint(drizzleSavepoint.toString());
} catch (QueryException e) {
throw SQLExceptionMapper.get(e);
}
return drizzleSavepoint;
} | [
"public",
"Savepoint",
"setSavepoint",
"(",
"final",
"String",
"name",
")",
"throws",
"SQLException",
"{",
"final",
"Savepoint",
"drizzleSavepoint",
"=",
"new",
"DrizzleSavepoint",
"(",
"name",
",",
"savepointCount",
"++",
")",
";",
"try",
"{",
"protocol",
".",
... | Creates a savepoint with the given name in the current transaction and returns the new <code>Savepoint</code>
object that represents it.
<p/>
<p> if setSavepoint is invoked outside of an active transaction, a transaction will be started at this newly
created savepoint.
@param name a <code>String</code> containing the name of the savepoint
@return the new <code>Savepoint</code> object
@throws java.sql.SQLException if a database access error occurs, this method is called while participating in a
distributed transaction, this method is called on a closed connection or this
<code>Connection</code> object is currently in auto-commit mode
@throws java.sql.SQLFeatureNotSupportedException
if the JDBC driver does not support this method
@see java.sql.Savepoint
@since 1.4 | [
"Creates",
"a",
"savepoint",
"with",
"the",
"given",
"name",
"in",
"the",
"current",
"transaction",
"and",
"returns",
"the",
"new",
"<code",
">",
"Savepoint<",
"/",
"code",
">",
"object",
"that",
"represents",
"it",
".",
"<p",
"/",
">",
"<p",
">",
"if",
... | train | https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/DrizzleConnection.java#L616-L625 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java | HashCodeBuilder.reflectionHashCode | @GwtIncompatible("incompatible method")
public static int reflectionHashCode(final Object object, final Collection<String> excludeFields) {
return reflectionHashCode(object, ReflectionToStringBuilder.toNoNullStringArray(excludeFields));
} | java | @GwtIncompatible("incompatible method")
public static int reflectionHashCode(final Object object, final Collection<String> excludeFields) {
return reflectionHashCode(object, ReflectionToStringBuilder.toNoNullStringArray(excludeFields));
} | [
"@",
"GwtIncompatible",
"(",
"\"incompatible method\"",
")",
"public",
"static",
"int",
"reflectionHashCode",
"(",
"final",
"Object",
"object",
",",
"final",
"Collection",
"<",
"String",
">",
"excludeFields",
")",
"{",
"return",
"reflectionHashCode",
"(",
"object",
... | <p>
Uses reflection to build a valid hash code from the fields of {@code object}.
</p>
<p>
This constructor uses two hard coded choices for the constants needed to build a hash code.
</p>
<p>
It uses <code>AccessibleObject.setAccessible</code> to gain access to private fields. This means that it will
throw a security exception if run under a security manager, if the permissions are not set up correctly. It is
also not as efficient as testing explicitly.
</p>
<p>
Transient members will be not be used, as they are likely derived fields, and not part of the value of the
<code>Object</code>.
</p>
<p>
Static fields will not be tested. Superclass fields will be included. If no fields are found to include
in the hash code, the result of this method will be constant.
</p>
@param object
the Object to create a <code>hashCode</code> for
@param excludeFields
Collection of String field names to exclude from use in calculation of hash code
@return int hash code
@throws IllegalArgumentException
if the object is <code>null</code>
@see HashCodeExclude | [
"<p",
">",
"Uses",
"reflection",
"to",
"build",
"a",
"valid",
"hash",
"code",
"from",
"the",
"fields",
"of",
"{",
"@code",
"object",
"}",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java#L453-L456 |
lessthanoptimal/BoofCV | main/boofcv-types/src/main/java/boofcv/struct/convolve/Kernel2D_S32.java | Kernel2D_S32.wrap | public static Kernel2D_S32 wrap(int data[], int width, int offset) {
if (width % 2 == 0 && width <= 0 && width * width > data.length)
throw new IllegalArgumentException("invalid width");
Kernel2D_S32 ret = new Kernel2D_S32();
ret.data = data;
ret.width = width;
ret.offset = offset;
return ret;
} | java | public static Kernel2D_S32 wrap(int data[], int width, int offset) {
if (width % 2 == 0 && width <= 0 && width * width > data.length)
throw new IllegalArgumentException("invalid width");
Kernel2D_S32 ret = new Kernel2D_S32();
ret.data = data;
ret.width = width;
ret.offset = offset;
return ret;
} | [
"public",
"static",
"Kernel2D_S32",
"wrap",
"(",
"int",
"data",
"[",
"]",
",",
"int",
"width",
",",
"int",
"offset",
")",
"{",
"if",
"(",
"width",
"%",
"2",
"==",
"0",
"&&",
"width",
"<=",
"0",
"&&",
"width",
"*",
"width",
">",
"data",
".",
"leng... | Creates a kernel whose elements are the specified data array and has
the specified width.
@param data The array who will be the kernel's data. Reference is saved.
@param width The kernel's width.
@param offset Kernel origin's offset from element 0.
@return A new kernel. | [
"Creates",
"a",
"kernel",
"whose",
"elements",
"are",
"the",
"specified",
"data",
"array",
"and",
"has",
"the",
"specified",
"width",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/struct/convolve/Kernel2D_S32.java#L87-L97 |
DataArt/CalculationEngine | calculation-engine/engine-converters/src/main/java/com/dataart/spreadsheetanalytics/engine/DataSetConverters.java | DataSetConverters.toXlsxFile | static OutputStream toXlsxFile(final IDataSet dataSet, final InputStream formatting) {
ByteArrayOutputStream xlsx = new ByteArrayOutputStream();
try { toWorkbook(dataSet, ConverterUtils.newWorkbook(formatting)).write(xlsx); }
catch (IOException e) { throw new CalculationEngineException(e); }
return xlsx;
} | java | static OutputStream toXlsxFile(final IDataSet dataSet, final InputStream formatting) {
ByteArrayOutputStream xlsx = new ByteArrayOutputStream();
try { toWorkbook(dataSet, ConverterUtils.newWorkbook(formatting)).write(xlsx); }
catch (IOException e) { throw new CalculationEngineException(e); }
return xlsx;
} | [
"static",
"OutputStream",
"toXlsxFile",
"(",
"final",
"IDataSet",
"dataSet",
",",
"final",
"InputStream",
"formatting",
")",
"{",
"ByteArrayOutputStream",
"xlsx",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"try",
"{",
"toWorkbook",
"(",
"dataSet",
",",
... | Converts {@link IDataSet} to {@link Workbook},
then writes this Workbook to new {@link ByteArrayOutputStream}.
Middle-state {@link Workbook} is created from @param formatting. | [
"Converts",
"{"
] | train | https://github.com/DataArt/CalculationEngine/blob/34ce1d9c1f9b57a502906b274311d28580b134e5/calculation-engine/engine-converters/src/main/java/com/dataart/spreadsheetanalytics/engine/DataSetConverters.java#L115-L122 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.pinholeToMatrix | public static DMatrixRMaj pinholeToMatrix(CameraPinhole param , DMatrixRMaj K )
{
return ImplPerspectiveOps_F64.pinholeToMatrix(param, K);
} | java | public static DMatrixRMaj pinholeToMatrix(CameraPinhole param , DMatrixRMaj K )
{
return ImplPerspectiveOps_F64.pinholeToMatrix(param, K);
} | [
"public",
"static",
"DMatrixRMaj",
"pinholeToMatrix",
"(",
"CameraPinhole",
"param",
",",
"DMatrixRMaj",
"K",
")",
"{",
"return",
"ImplPerspectiveOps_F64",
".",
"pinholeToMatrix",
"(",
"param",
",",
"K",
")",
";",
"}"
] | Given the intrinsic parameters create a calibration matrix
@param param Intrinsic parameters structure that is to be converted into a matrix
@param K Storage for calibration matrix, must be 3x3. If null then a new matrix is declared
@return Calibration matrix 3x3 | [
"Given",
"the",
"intrinsic",
"parameters",
"create",
"a",
"calibration",
"matrix"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L259-L262 |
samskivert/samskivert | src/main/java/com/samskivert/velocity/Application.java | Application.handleException | protected String handleException (HttpServletRequest req, Logic logic, Exception error)
{
log.warning(logic + " failed on: " + RequestUtils.reconstructURL(req), error);
return ExceptionMap.getMessage(error);
} | java | protected String handleException (HttpServletRequest req, Logic logic, Exception error)
{
log.warning(logic + " failed on: " + RequestUtils.reconstructURL(req), error);
return ExceptionMap.getMessage(error);
} | [
"protected",
"String",
"handleException",
"(",
"HttpServletRequest",
"req",
",",
"Logic",
"logic",
",",
"Exception",
"error",
")",
"{",
"log",
".",
"warning",
"(",
"logic",
"+",
"\" failed on: \"",
"+",
"RequestUtils",
".",
"reconstructURL",
"(",
"req",
")",
"... | If a generic exception propagates up from {@link Logic#invoke} and is not otherwise
converted into a friendly or redirect exception, the application will be required to provide
a generic error message to be inserted into the context and should take this opportunity to
log the exception.
<p><em>Note:</em> the string returned by this method will be translated using the
application's message manager before being inserted into the Velocity context. | [
"If",
"a",
"generic",
"exception",
"propagates",
"up",
"from",
"{",
"@link",
"Logic#invoke",
"}",
"and",
"is",
"not",
"otherwise",
"converted",
"into",
"a",
"friendly",
"or",
"redirect",
"exception",
"the",
"application",
"will",
"be",
"required",
"to",
"provi... | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/velocity/Application.java#L200-L204 |
nextreports/nextreports-engine | src/ro/nextreports/engine/util/ReportUtil.java | ReportUtil.isValidSqlWithMessage | public static String isValidSqlWithMessage(Connection con, String sql, List<QueryParameter> parameters) {
try {
QueryUtil qu = new QueryUtil(con, DialectUtil.getDialect(con));
Map<String, QueryParameter> params = new HashMap<String, QueryParameter>();
for (QueryParameter qp : parameters) {
params.put(qp.getName(), qp);
}
qu.getColumnNames(sql, params);
} catch (Exception ex) {
LOG.error(ex.getMessage(), ex);
return ex.getMessage();
}
return null;
} | java | public static String isValidSqlWithMessage(Connection con, String sql, List<QueryParameter> parameters) {
try {
QueryUtil qu = new QueryUtil(con, DialectUtil.getDialect(con));
Map<String, QueryParameter> params = new HashMap<String, QueryParameter>();
for (QueryParameter qp : parameters) {
params.put(qp.getName(), qp);
}
qu.getColumnNames(sql, params);
} catch (Exception ex) {
LOG.error(ex.getMessage(), ex);
return ex.getMessage();
}
return null;
} | [
"public",
"static",
"String",
"isValidSqlWithMessage",
"(",
"Connection",
"con",
",",
"String",
"sql",
",",
"List",
"<",
"QueryParameter",
">",
"parameters",
")",
"{",
"try",
"{",
"QueryUtil",
"qu",
"=",
"new",
"QueryUtil",
"(",
"con",
",",
"DialectUtil",
".... | Test if sql with parameters is valid
@param con database connection
@param sql sql
@return return message error if sql is not valid, null otherwise | [
"Test",
"if",
"sql",
"with",
"parameters",
"is",
"valid"
] | train | https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L761-L774 |
facebook/fresco | drawee/src/main/java/com/facebook/drawee/drawable/RoundedCornersDrawable.java | RoundedCornersDrawable.setBorder | @Override
public void setBorder(int color, float width) {
mBorderColor = color;
mBorderWidth = width;
updatePath();
invalidateSelf();
} | java | @Override
public void setBorder(int color, float width) {
mBorderColor = color;
mBorderWidth = width;
updatePath();
invalidateSelf();
} | [
"@",
"Override",
"public",
"void",
"setBorder",
"(",
"int",
"color",
",",
"float",
"width",
")",
"{",
"mBorderColor",
"=",
"color",
";",
"mBorderWidth",
"=",
"width",
";",
"updatePath",
"(",
")",
";",
"invalidateSelf",
"(",
")",
";",
"}"
] | Sets the border
@param color of the border
@param width of the border | [
"Sets",
"the",
"border"
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/drawable/RoundedCornersDrawable.java#L155-L161 |
Whiley/WhileyCompiler | src/main/java/wyc/io/WhileyFileParser.java | WhileyFileParser.tryAndMatchAtIndent | private Token tryAndMatchAtIndent(boolean terminated, Indent indent, Token.Kind... kinds) {
int start = index;
Indent r = getIndent();
if (r != null && r.equivalent(indent)) {
Token t = tryAndMatch(terminated, kinds);
if (t != null) {
return r;
}
}
// backtrack in all failing cases.
index = start;
return null;
} | java | private Token tryAndMatchAtIndent(boolean terminated, Indent indent, Token.Kind... kinds) {
int start = index;
Indent r = getIndent();
if (r != null && r.equivalent(indent)) {
Token t = tryAndMatch(terminated, kinds);
if (t != null) {
return r;
}
}
// backtrack in all failing cases.
index = start;
return null;
} | [
"private",
"Token",
"tryAndMatchAtIndent",
"(",
"boolean",
"terminated",
",",
"Indent",
"indent",
",",
"Token",
".",
"Kind",
"...",
"kinds",
")",
"{",
"int",
"start",
"=",
"index",
";",
"Indent",
"r",
"=",
"getIndent",
"(",
")",
";",
"if",
"(",
"r",
"!... | Attempt to match a given token(s) at a given level of indent, whilst
ignoring any whitespace in between. Note that, in the case it fails to
match, then the index will be unchanged. This latter point is important,
otherwise we could accidentally gobble up some important indentation. If
more than one kind is provided then this will try to match any of them.
@param terminated
Indicates whether or not this function should be concerned
with new lines. The terminated flag indicates whether or not
the current construct being parsed is known to be terminated.
If so, then we don't need to worry about newlines and can
greedily consume them (i.e. since we'll eventually run into
the terminating symbol).
@param indent
The indentation level to try and match the tokens at.
@param kinds
@return | [
"Attempt",
"to",
"match",
"a",
"given",
"token",
"(",
"s",
")",
"at",
"a",
"given",
"level",
"of",
"indent",
"whilst",
"ignoring",
"any",
"whitespace",
"in",
"between",
".",
"Note",
"that",
"in",
"the",
"case",
"it",
"fails",
"to",
"match",
"then",
"th... | train | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L4229-L4241 |
hexagonframework/spring-data-ebean | src/main/java/org/springframework/data/ebean/repository/query/ParameterBinder.java | ParameterBinder.bindAndPrepare | public EbeanQueryWrapper bindAndPrepare(EbeanQueryWrapper query) {
Assert.notNull(query, "query must not be null!");
return bindAndPrepare(query, parameters);
} | java | public EbeanQueryWrapper bindAndPrepare(EbeanQueryWrapper query) {
Assert.notNull(query, "query must not be null!");
return bindAndPrepare(query, parameters);
} | [
"public",
"EbeanQueryWrapper",
"bindAndPrepare",
"(",
"EbeanQueryWrapper",
"query",
")",
"{",
"Assert",
".",
"notNull",
"(",
"query",
",",
"\"query must not be null!\"",
")",
";",
"return",
"bindAndPrepare",
"(",
"query",
",",
"parameters",
")",
";",
"}"
] | Binds the parameters to the given query and applies special parameter types (e.g. pagination).
@param query must not be {@literal null}.
@return | [
"Binds",
"the",
"parameters",
"to",
"the",
"given",
"query",
"and",
"applies",
"special",
"parameter",
"types",
"(",
"e",
".",
"g",
".",
"pagination",
")",
"."
] | train | https://github.com/hexagonframework/spring-data-ebean/blob/dd11b97654982403b50dd1d5369cadad71fce410/src/main/java/org/springframework/data/ebean/repository/query/ParameterBinder.java#L75-L78 |
ibm-bluemix-mobile-services/bms-clientsdk-android-core | lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/core/internal/BaseRequest.java | BaseRequest.updateProgressListener | protected void updateProgressListener(ProgressListener progressListener, Response response) {
InputStream responseStream = response.getResponseByteStream();
int bytesDownloaded = 0;
long totalBytesExpected = response.getContentLength();
// Reading 2 KiB at a time to be consistent with the upload segment size in ProgressRequestBody
final int segmentSize = 2048;
byte[] responseBytes;
if (totalBytesExpected > Integer.MAX_VALUE) {
logger.warn("The response body for " + getUrl() + " is too large to hold in a byte array. Only the first 2 GiB will be available.");
responseBytes = new byte[Integer.MAX_VALUE];
}
else {
responseBytes = new byte[(int)totalBytesExpected];
}
// For every 2 KiB downloaded:
// 1) Call the user's ProgressListener
// 2) Append the downloaded bytes into a byte array
int nextByte;
try {
while ((nextByte = responseStream.read()) != -1) {
if (bytesDownloaded % segmentSize == 0) {
progressListener.onProgress(bytesDownloaded, totalBytesExpected);
}
responseBytes[bytesDownloaded] = (byte)nextByte;
bytesDownloaded += 1;
}
}
catch (IOException e) {
logger.error("IO Exception: " + e.getMessage());
}
// Transfer the downloaded data to the Response object so that the user can later retrieve it
if (response instanceof ResponseImpl) {
((ResponseImpl)response).setResponseBytes(responseBytes);
}
} | java | protected void updateProgressListener(ProgressListener progressListener, Response response) {
InputStream responseStream = response.getResponseByteStream();
int bytesDownloaded = 0;
long totalBytesExpected = response.getContentLength();
// Reading 2 KiB at a time to be consistent with the upload segment size in ProgressRequestBody
final int segmentSize = 2048;
byte[] responseBytes;
if (totalBytesExpected > Integer.MAX_VALUE) {
logger.warn("The response body for " + getUrl() + " is too large to hold in a byte array. Only the first 2 GiB will be available.");
responseBytes = new byte[Integer.MAX_VALUE];
}
else {
responseBytes = new byte[(int)totalBytesExpected];
}
// For every 2 KiB downloaded:
// 1) Call the user's ProgressListener
// 2) Append the downloaded bytes into a byte array
int nextByte;
try {
while ((nextByte = responseStream.read()) != -1) {
if (bytesDownloaded % segmentSize == 0) {
progressListener.onProgress(bytesDownloaded, totalBytesExpected);
}
responseBytes[bytesDownloaded] = (byte)nextByte;
bytesDownloaded += 1;
}
}
catch (IOException e) {
logger.error("IO Exception: " + e.getMessage());
}
// Transfer the downloaded data to the Response object so that the user can later retrieve it
if (response instanceof ResponseImpl) {
((ResponseImpl)response).setResponseBytes(responseBytes);
}
} | [
"protected",
"void",
"updateProgressListener",
"(",
"ProgressListener",
"progressListener",
",",
"Response",
"response",
")",
"{",
"InputStream",
"responseStream",
"=",
"response",
".",
"getResponseByteStream",
"(",
")",
";",
"int",
"bytesDownloaded",
"=",
"0",
";",
... | As a download request progresses, periodically call the user's ProgressListener | [
"As",
"a",
"download",
"request",
"progresses",
"periodically",
"call",
"the",
"user",
"s",
"ProgressListener"
] | train | https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core/blob/8db4f00d0d564792397bfc0e5bd57d52a238b858/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/core/internal/BaseRequest.java#L794-L832 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java | CassandraSchemaManager.handleCreate | private void handleCreate(TableInfo tableInfo, KsDef ksDef) throws Exception
{
if (containsCompositeKey(tableInfo))
{
validateCompoundKey(tableInfo);
// First drop existing column family.
dropTableUsingCql(tableInfo);
}
else
{
onDrop(tableInfo);
}
createOrUpdateColumnFamily(tableInfo, ksDef);
} | java | private void handleCreate(TableInfo tableInfo, KsDef ksDef) throws Exception
{
if (containsCompositeKey(tableInfo))
{
validateCompoundKey(tableInfo);
// First drop existing column family.
dropTableUsingCql(tableInfo);
}
else
{
onDrop(tableInfo);
}
createOrUpdateColumnFamily(tableInfo, ksDef);
} | [
"private",
"void",
"handleCreate",
"(",
"TableInfo",
"tableInfo",
",",
"KsDef",
"ksDef",
")",
"throws",
"Exception",
"{",
"if",
"(",
"containsCompositeKey",
"(",
"tableInfo",
")",
")",
"{",
"validateCompoundKey",
"(",
"tableInfo",
")",
";",
"// First drop existing... | Handle create.
@param tableInfo
the table info
@param ksDef
the ks def
@throws Exception
the exception | [
"Handle",
"create",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java#L601-L614 |
Wolfgang-Schuetzelhofer/jcypher | src/main/java/iot/jcypher/query/values/JcElement.java | JcElement.booleanProperty | public JcBoolean booleanProperty(String name) {
JcBoolean ret = new JcBoolean(name, this, OPERATOR.PropertyContainer.PROPERTY_ACCESS);
QueryRecorder.recordInvocationConditional(this, "booleanProperty", ret, QueryRecorder.literal(name));
return ret;
} | java | public JcBoolean booleanProperty(String name) {
JcBoolean ret = new JcBoolean(name, this, OPERATOR.PropertyContainer.PROPERTY_ACCESS);
QueryRecorder.recordInvocationConditional(this, "booleanProperty", ret, QueryRecorder.literal(name));
return ret;
} | [
"public",
"JcBoolean",
"booleanProperty",
"(",
"String",
"name",
")",
"{",
"JcBoolean",
"ret",
"=",
"new",
"JcBoolean",
"(",
"name",
",",
"this",
",",
"OPERATOR",
".",
"PropertyContainer",
".",
"PROPERTY_ACCESS",
")",
";",
"QueryRecorder",
".",
"recordInvocation... | <div color='red' style="font-size:24px;color:red"><b><i><u>JCYPHER</u></i></b></div>
<div color='red' style="font-size:18px;color:red"><i>access a named boolean property, return a <b>JcBoolean</b></i></div>
<br/> | [
"<div",
"color",
"=",
"red",
"style",
"=",
"font",
"-",
"size",
":",
"24px",
";",
"color",
":",
"red",
">",
"<b",
">",
"<i",
">",
"<u",
">",
"JCYPHER<",
"/",
"u",
">",
"<",
"/",
"i",
">",
"<",
"/",
"b",
">",
"<",
"/",
"div",
">",
"<div",
... | train | https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/query/values/JcElement.java#L75-L79 |
alkacon/opencms-core | src/org/opencms/workplace/CmsWorkplaceMessages.java | CmsWorkplaceMessages.getResourceTypeDescription | public static String getResourceTypeDescription(CmsWorkplace wp, String name) {
// try to find the localized key
String key = OpenCms.getWorkplaceManager().getExplorerTypeSetting(name).getInfo();
return wp.keyDefault(key, name);
} | java | public static String getResourceTypeDescription(CmsWorkplace wp, String name) {
// try to find the localized key
String key = OpenCms.getWorkplaceManager().getExplorerTypeSetting(name).getInfo();
return wp.keyDefault(key, name);
} | [
"public",
"static",
"String",
"getResourceTypeDescription",
"(",
"CmsWorkplace",
"wp",
",",
"String",
"name",
")",
"{",
"// try to find the localized key",
"String",
"key",
"=",
"OpenCms",
".",
"getWorkplaceManager",
"(",
")",
".",
"getExplorerTypeSetting",
"(",
"name... | Returns the description of the given resource type name.<p>
If this key is not found, the value of the name input will be returned.<p>
@param wp an instance of a {@link CmsWorkplace} to resolve the key name with
@param name the resource type name to generate the nice name for
@return the description of the given resource type name | [
"Returns",
"the",
"description",
"of",
"the",
"given",
"resource",
"type",
"name",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsWorkplaceMessages.java#L132-L137 |
k0shk0sh/PermissionHelper | permission/src/main/java/com/fastaccess/permission/base/activity/BasePermissionActivity.java | BasePermissionActivity.requestPermission | protected void requestPermission(final PermissionModel model) {
new AlertDialog.Builder(this)
.setTitle(model.getTitle())
.setMessage(model.getExplanationMessage())
.setPositiveButton("Request", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (model.getPermissionName().equalsIgnoreCase(Manifest.permission.SYSTEM_ALERT_WINDOW)) {
permissionHelper.requestSystemAlertPermission();
} else {
permissionHelper.requestAfterExplanation(model.getPermissionName());
}
}
}).show();
} | java | protected void requestPermission(final PermissionModel model) {
new AlertDialog.Builder(this)
.setTitle(model.getTitle())
.setMessage(model.getExplanationMessage())
.setPositiveButton("Request", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (model.getPermissionName().equalsIgnoreCase(Manifest.permission.SYSTEM_ALERT_WINDOW)) {
permissionHelper.requestSystemAlertPermission();
} else {
permissionHelper.requestAfterExplanation(model.getPermissionName());
}
}
}).show();
} | [
"protected",
"void",
"requestPermission",
"(",
"final",
"PermissionModel",
"model",
")",
"{",
"new",
"AlertDialog",
".",
"Builder",
"(",
"this",
")",
".",
"setTitle",
"(",
"model",
".",
"getTitle",
"(",
")",
")",
".",
"setMessage",
"(",
"model",
".",
"getE... | internal usage to show dialog with explanation you provided and a button to ask the user to request the permission | [
"internal",
"usage",
"to",
"show",
"dialog",
"with",
"explanation",
"you",
"provided",
"and",
"a",
"button",
"to",
"ask",
"the",
"user",
"to",
"request",
"the",
"permission"
] | train | https://github.com/k0shk0sh/PermissionHelper/blob/04edce2af49981d1dd321bcdfbe981a1000b29d7/permission/src/main/java/com/fastaccess/permission/base/activity/BasePermissionActivity.java#L257-L271 |
elki-project/elki | elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/datasource/bundle/BundleWriter.java | BundleWriter.flushBuffer | private void flushBuffer(ByteBuffer buffer, WritableByteChannel output) throws IOException {
buffer.flip();
output.write(buffer);
buffer.flip();
buffer.limit(buffer.capacity());
} | java | private void flushBuffer(ByteBuffer buffer, WritableByteChannel output) throws IOException {
buffer.flip();
output.write(buffer);
buffer.flip();
buffer.limit(buffer.capacity());
} | [
"private",
"void",
"flushBuffer",
"(",
"ByteBuffer",
"buffer",
",",
"WritableByteChannel",
"output",
")",
"throws",
"IOException",
"{",
"buffer",
".",
"flip",
"(",
")",
";",
"output",
".",
"write",
"(",
"buffer",
")",
";",
"buffer",
".",
"flip",
"(",
")",
... | Flush the current write buffer to disk.
@param buffer Buffer to write
@param output Output channel
@throws IOException on IO errors | [
"Flush",
"the",
"current",
"write",
"buffer",
"to",
"disk",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-api/src/main/java/de/lmu/ifi/dbs/elki/datasource/bundle/BundleWriter.java#L126-L131 |
salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/dto/EntityDTO.java | EntityDTO.createDtoObject | public static <D extends EntityDTO, E extends JPAEntity> D createDtoObject(Class<D> clazz, E entity) {
D result = null;
try {
result = clazz.newInstance();
BeanUtils.copyProperties(result, entity);
// Now set IDs of JPA entity
result.setCreatedById(entity.getCreatedBy() != null ? entity.getCreatedBy().getId() : null);
result.setModifiedById(entity.getModifiedBy() != null ? entity.getModifiedBy().getId() : null);
} catch (Exception ex) {
throw new WebApplicationException("DTO transformation failed.", Status.INTERNAL_SERVER_ERROR);
}
return result;
} | java | public static <D extends EntityDTO, E extends JPAEntity> D createDtoObject(Class<D> clazz, E entity) {
D result = null;
try {
result = clazz.newInstance();
BeanUtils.copyProperties(result, entity);
// Now set IDs of JPA entity
result.setCreatedById(entity.getCreatedBy() != null ? entity.getCreatedBy().getId() : null);
result.setModifiedById(entity.getModifiedBy() != null ? entity.getModifiedBy().getId() : null);
} catch (Exception ex) {
throw new WebApplicationException("DTO transformation failed.", Status.INTERNAL_SERVER_ERROR);
}
return result;
} | [
"public",
"static",
"<",
"D",
"extends",
"EntityDTO",
",",
"E",
"extends",
"JPAEntity",
">",
"D",
"createDtoObject",
"(",
"Class",
"<",
"D",
">",
"clazz",
",",
"E",
"entity",
")",
"{",
"D",
"result",
"=",
"null",
";",
"try",
"{",
"result",
"=",
"claz... | Creates BaseDto object and copies properties from entity object.
@param <D> BaseDto object type.
@param <E> Entity type.
@param clazz BaseDto entity class.
@param entity entity object.
@return BaseDto object.
@throws WebApplicationException The exception with 500 status will be thrown. | [
"Creates",
"BaseDto",
"object",
"and",
"copies",
"properties",
"from",
"entity",
"object",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/dto/EntityDTO.java#L72-L86 |
google/closure-compiler | src/com/google/javascript/jscomp/TypeInferencePass.java | TypeInferencePass.process | @Override
public void process(Node externsRoot, Node jsRoot) {
Node externsAndJs = jsRoot.getParent();
checkState(externsAndJs != null);
checkState(externsRoot == null || externsAndJs.hasChild(externsRoot));
inferAllScopes(externsAndJs);
} | java | @Override
public void process(Node externsRoot, Node jsRoot) {
Node externsAndJs = jsRoot.getParent();
checkState(externsAndJs != null);
checkState(externsRoot == null || externsAndJs.hasChild(externsRoot));
inferAllScopes(externsAndJs);
} | [
"@",
"Override",
"public",
"void",
"process",
"(",
"Node",
"externsRoot",
",",
"Node",
"jsRoot",
")",
"{",
"Node",
"externsAndJs",
"=",
"jsRoot",
".",
"getParent",
"(",
")",
";",
"checkState",
"(",
"externsAndJs",
"!=",
"null",
")",
";",
"checkState",
"(",... | Main entry point for type inference when running over the whole tree.
@param externsRoot The root of the externs parse tree.
@param jsRoot The root of the input parse tree to be checked. | [
"Main",
"entry",
"point",
"for",
"type",
"inference",
"when",
"running",
"over",
"the",
"whole",
"tree",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeInferencePass.java#L61-L68 |
GerdHolz/TOVAL | src/de/invation/code/toval/validate/Validate.java | Validate.notNull | public static <O extends Object> void notNull(O o, String message) {
if(!validation) return;
notNull(message);
if(o == null)
throw new ParameterException(ErrorCode.NULLPOINTER, message);
} | java | public static <O extends Object> void notNull(O o, String message) {
if(!validation) return;
notNull(message);
if(o == null)
throw new ParameterException(ErrorCode.NULLPOINTER, message);
} | [
"public",
"static",
"<",
"O",
"extends",
"Object",
">",
"void",
"notNull",
"(",
"O",
"o",
",",
"String",
"message",
")",
"{",
"if",
"(",
"!",
"validation",
")",
"return",
";",
"notNull",
"(",
"message",
")",
";",
"if",
"(",
"o",
"==",
"null",
")",
... | Checks if the given object is <code>null</code>
@param o The object to validate.
@param message The error message to include in the Exception in case the validation fails.
@throws ParameterException if the given object is <code>null</code>. | [
"Checks",
"if",
"the",
"given",
"object",
"is",
"<code",
">",
"null<",
"/",
"code",
">"
] | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/validate/Validate.java#L42-L47 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java | SeaGlassLookAndFeel.defineSeparators | private void defineSeparators(UIDefaults d) {
String c = PAINTER_PREFIX + "SeparatorPainter";
d.put("Separator.contentMargins", new InsetsUIResource(0, 0, 0, 0));
d.put("Separator[Enabled].backgroundPainter", new LazyPainter(c, SeparatorPainter.Which.BACKGROUND_ENABLED));
} | java | private void defineSeparators(UIDefaults d) {
String c = PAINTER_PREFIX + "SeparatorPainter";
d.put("Separator.contentMargins", new InsetsUIResource(0, 0, 0, 0));
d.put("Separator[Enabled].backgroundPainter", new LazyPainter(c, SeparatorPainter.Which.BACKGROUND_ENABLED));
} | [
"private",
"void",
"defineSeparators",
"(",
"UIDefaults",
"d",
")",
"{",
"String",
"c",
"=",
"PAINTER_PREFIX",
"+",
"\"SeparatorPainter\"",
";",
"d",
".",
"put",
"(",
"\"Separator.contentMargins\"",
",",
"new",
"InsetsUIResource",
"(",
"0",
",",
"0",
",",
"0",... | Initialize the separator settings.
@param d the UI defaults map. | [
"Initialize",
"the",
"separator",
"settings",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L1771-L1775 |
Azure/azure-sdk-for-java | kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/ClustersInner.java | ClustersInner.beginCreateOrUpdateAsync | public Observable<ClusterInner> beginCreateOrUpdateAsync(String resourceGroupName, String clusterName, ClusterInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1<ServiceResponse<ClusterInner>, ClusterInner>() {
@Override
public ClusterInner call(ServiceResponse<ClusterInner> response) {
return response.body();
}
});
} | java | public Observable<ClusterInner> beginCreateOrUpdateAsync(String resourceGroupName, String clusterName, ClusterInner parameters) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1<ServiceResponse<ClusterInner>, ClusterInner>() {
@Override
public ClusterInner call(ServiceResponse<ClusterInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ClusterInner",
">",
"beginCreateOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
",",
"ClusterInner",
"parameters",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",... | Create or update a Kusto cluster.
@param resourceGroupName The name of the resource group containing the Kusto cluster.
@param clusterName The name of the Kusto cluster.
@param parameters The Kusto cluster parameters supplied to the CreateOrUpdate operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ClusterInner object | [
"Create",
"or",
"update",
"a",
"Kusto",
"cluster",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/ClustersInner.java#L335-L342 |
grandstaish/paperparcel | paperparcel-compiler/src/main/java/paperparcel/Utils.java | Utils.paramAsMemberOf | private static TypeMirror paramAsMemberOf(
Types types, DeclaredType type, TypeParameterElement param) {
TypeMirror resolved = paramAsMemberOfImpl(types, type, param);
checkState(resolved != null, "Could not resolve parameter: " + param);
return resolved;
} | java | private static TypeMirror paramAsMemberOf(
Types types, DeclaredType type, TypeParameterElement param) {
TypeMirror resolved = paramAsMemberOfImpl(types, type, param);
checkState(resolved != null, "Could not resolve parameter: " + param);
return resolved;
} | [
"private",
"static",
"TypeMirror",
"paramAsMemberOf",
"(",
"Types",
"types",
",",
"DeclaredType",
"type",
",",
"TypeParameterElement",
"param",
")",
"{",
"TypeMirror",
"resolved",
"=",
"paramAsMemberOfImpl",
"(",
"types",
",",
"type",
",",
"param",
")",
";",
"ch... | A custom implementation for getting the resolved value of a {@link TypeParameterElement}
from a {@link DeclaredType}.
Usually this can be resolved using {@link Types#asMemberOf(DeclaredType, Element)}, but the
Jack compiler implementation currently does not work with {@link TypeParameterElement}s.
See https://code.google.com/p/android/issues/detail?id=231164. | [
"A",
"custom",
"implementation",
"for",
"getting",
"the",
"resolved",
"value",
"of",
"a",
"{",
"@link",
"TypeParameterElement",
"}",
"from",
"a",
"{",
"@link",
"DeclaredType",
"}",
"."
] | train | https://github.com/grandstaish/paperparcel/blob/917686ced81b335b6708d81d6cc0e3e496f7280d/paperparcel-compiler/src/main/java/paperparcel/Utils.java#L262-L267 |
alexvasilkov/GestureViews | sample/src/main/java/com/alexvasilkov/gestures/sample/demo/utils/RecyclerAdapterHelper.java | RecyclerAdapterHelper.notifyChanges | public static <T> void notifyChanges(RecyclerView.Adapter<?> adapter,
final List<T> oldList, final List<T> newList) {
DiffUtil.calculateDiff(new DiffUtil.Callback() {
@Override
public int getOldListSize() {
return oldList == null ? 0 : oldList.size();
}
@Override
public int getNewListSize() {
return newList == null ? 0 : newList.size();
}
@Override
public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {
return oldList.get(oldItemPosition).equals(newList.get(newItemPosition));
}
@Override
public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {
return areItemsTheSame(oldItemPosition, newItemPosition);
}
}).dispatchUpdatesTo(adapter);
} | java | public static <T> void notifyChanges(RecyclerView.Adapter<?> adapter,
final List<T> oldList, final List<T> newList) {
DiffUtil.calculateDiff(new DiffUtil.Callback() {
@Override
public int getOldListSize() {
return oldList == null ? 0 : oldList.size();
}
@Override
public int getNewListSize() {
return newList == null ? 0 : newList.size();
}
@Override
public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {
return oldList.get(oldItemPosition).equals(newList.get(newItemPosition));
}
@Override
public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {
return areItemsTheSame(oldItemPosition, newItemPosition);
}
}).dispatchUpdatesTo(adapter);
} | [
"public",
"static",
"<",
"T",
">",
"void",
"notifyChanges",
"(",
"RecyclerView",
".",
"Adapter",
"<",
"?",
">",
"adapter",
",",
"final",
"List",
"<",
"T",
">",
"oldList",
",",
"final",
"List",
"<",
"T",
">",
"newList",
")",
"{",
"DiffUtil",
".",
"cal... | Calls adapter's notify* methods when items are added / removed / moved / updated. | [
"Calls",
"adapter",
"s",
"notify",
"*",
"methods",
"when",
"items",
"are",
"added",
"/",
"removed",
"/",
"moved",
"/",
"updated",
"."
] | train | https://github.com/alexvasilkov/GestureViews/blob/f0a4c266e31dcad23bd0d9013531bc1c501b9c9f/sample/src/main/java/com/alexvasilkov/gestures/sample/demo/utils/RecyclerAdapterHelper.java#L15-L39 |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java | SphereUtil.bearingDegDeg | public static double bearingDegDeg(double latS, double lngS, double latE, double lngE) {
return rad2deg(bearingRad(deg2rad(latS), deg2rad(lngS), deg2rad(latE), deg2rad(lngE)));
} | java | public static double bearingDegDeg(double latS, double lngS, double latE, double lngE) {
return rad2deg(bearingRad(deg2rad(latS), deg2rad(lngS), deg2rad(latE), deg2rad(lngE)));
} | [
"public",
"static",
"double",
"bearingDegDeg",
"(",
"double",
"latS",
",",
"double",
"lngS",
",",
"double",
"latE",
",",
"double",
"lngE",
")",
"{",
"return",
"rad2deg",
"(",
"bearingRad",
"(",
"deg2rad",
"(",
"latS",
")",
",",
"deg2rad",
"(",
"lngS",
")... | Compute the bearing from start to end.
@param latS Start latitude, in degree
@param lngS Start longitude, in degree
@param latE End latitude, in degree
@param lngE End longitude, in degree
@return Bearing in degree | [
"Compute",
"the",
"bearing",
"from",
"start",
"to",
"end",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/geodesy/SphereUtil.java#L865-L867 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDNN.java | SDNN.dotProductAttention | public SDVariable dotProductAttention(SDVariable queries, SDVariable keys, SDVariable values, SDVariable mask, boolean scaled){
return dotProductAttention(null, queries, keys, values, mask, scaled);
} | java | public SDVariable dotProductAttention(SDVariable queries, SDVariable keys, SDVariable values, SDVariable mask, boolean scaled){
return dotProductAttention(null, queries, keys, values, mask, scaled);
} | [
"public",
"SDVariable",
"dotProductAttention",
"(",
"SDVariable",
"queries",
",",
"SDVariable",
"keys",
",",
"SDVariable",
"values",
",",
"SDVariable",
"mask",
",",
"boolean",
"scaled",
")",
"{",
"return",
"dotProductAttention",
"(",
"null",
",",
"queries",
",",
... | This operation performs dot product attention on the given timeseries input with the given queries
@see #dotProductAttention(String, SDVariable, SDVariable, SDVariable, SDVariable, boolean, boolean) | [
"This",
"operation",
"performs",
"dot",
"product",
"attention",
"on",
"the",
"given",
"timeseries",
"input",
"with",
"the",
"given",
"queries"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDNN.java#L834-L836 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FacesImpl.java | FacesImpl.detectWithStream | public List<DetectedFace> detectWithStream(byte[] image, DetectWithStreamOptionalParameter detectWithStreamOptionalParameter) {
return detectWithStreamWithServiceResponseAsync(image, detectWithStreamOptionalParameter).toBlocking().single().body();
} | java | public List<DetectedFace> detectWithStream(byte[] image, DetectWithStreamOptionalParameter detectWithStreamOptionalParameter) {
return detectWithStreamWithServiceResponseAsync(image, detectWithStreamOptionalParameter).toBlocking().single().body();
} | [
"public",
"List",
"<",
"DetectedFace",
">",
"detectWithStream",
"(",
"byte",
"[",
"]",
"image",
",",
"DetectWithStreamOptionalParameter",
"detectWithStreamOptionalParameter",
")",
"{",
"return",
"detectWithStreamWithServiceResponseAsync",
"(",
"image",
",",
"detectWithStrea... | Detect human faces in an image and returns face locations, and optionally with faceIds, landmarks, and attributes.
@param image An image stream.
@param detectWithStreamOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@throws APIErrorException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the List<DetectedFace> object if successful. | [
"Detect",
"human",
"faces",
"in",
"an",
"image",
"and",
"returns",
"face",
"locations",
"and",
"optionally",
"with",
"faceIds",
"landmarks",
"and",
"attributes",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/faceapi/src/main/java/com/microsoft/azure/cognitiveservices/vision/faceapi/implementation/FacesImpl.java#L925-L927 |
apache/incubator-atlas | webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java | EntityResource.getEntityListByType | public Response getEntityListByType(String entityType) {
try {
Preconditions.checkNotNull(entityType, "Entity type cannot be null");
if (LOG.isDebugEnabled()) {
LOG.debug("Fetching entity list for type={} ", entityType);
}
final List<String> entityList = metadataService.getEntityList(entityType);
JSONObject response = new JSONObject();
response.put(AtlasClient.REQUEST_ID, Servlets.getRequestId());
response.put(AtlasClient.TYPENAME, entityType);
response.put(AtlasClient.RESULTS, new JSONArray(entityList));
response.put(AtlasClient.COUNT, entityList.size());
return Response.ok(response).build();
} catch (NullPointerException e) {
LOG.error("Entity type cannot be null", e);
throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
} catch (AtlasException | IllegalArgumentException e) {
LOG.error("Unable to get entity list for type {}", entityType, e);
throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
} catch (WebApplicationException e) {
LOG.error("Unable to get entity list for type {}", entityType, e);
throw e;
} catch (Throwable e) {
LOG.error("Unable to get entity list for type {}", entityType, e);
throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
}
} | java | public Response getEntityListByType(String entityType) {
try {
Preconditions.checkNotNull(entityType, "Entity type cannot be null");
if (LOG.isDebugEnabled()) {
LOG.debug("Fetching entity list for type={} ", entityType);
}
final List<String> entityList = metadataService.getEntityList(entityType);
JSONObject response = new JSONObject();
response.put(AtlasClient.REQUEST_ID, Servlets.getRequestId());
response.put(AtlasClient.TYPENAME, entityType);
response.put(AtlasClient.RESULTS, new JSONArray(entityList));
response.put(AtlasClient.COUNT, entityList.size());
return Response.ok(response).build();
} catch (NullPointerException e) {
LOG.error("Entity type cannot be null", e);
throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
} catch (AtlasException | IllegalArgumentException e) {
LOG.error("Unable to get entity list for type {}", entityType, e);
throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
} catch (WebApplicationException e) {
LOG.error("Unable to get entity list for type {}", entityType, e);
throw e;
} catch (Throwable e) {
LOG.error("Unable to get entity list for type {}", entityType, e);
throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
}
} | [
"public",
"Response",
"getEntityListByType",
"(",
"String",
"entityType",
")",
"{",
"try",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"entityType",
",",
"\"Entity type cannot be null\"",
")",
";",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",... | Gets the list of entities for a given entity type.
@param entityType name of a type which is unique | [
"Gets",
"the",
"list",
"of",
"entities",
"for",
"a",
"given",
"entity",
"type",
"."
] | train | https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java#L711-L741 |
netty/netty | codec-http2/src/main/java/io/netty/handler/codec/http2/HttpConversionUtil.java | HttpConversionUtil.toFullHttpResponse | public static FullHttpResponse toFullHttpResponse(int streamId, Http2Headers http2Headers, ByteBufAllocator alloc,
boolean validateHttpHeaders)
throws Http2Exception {
HttpResponseStatus status = parseStatus(http2Headers.status());
// HTTP/2 does not define a way to carry the version or reason phrase that is included in an
// HTTP/1.1 status line.
FullHttpResponse msg = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, status, alloc.buffer(),
validateHttpHeaders);
try {
addHttp2ToHttpHeaders(streamId, http2Headers, msg, false);
} catch (Http2Exception e) {
msg.release();
throw e;
} catch (Throwable t) {
msg.release();
throw streamError(streamId, PROTOCOL_ERROR, t, "HTTP/2 to HTTP/1.x headers conversion error");
}
return msg;
} | java | public static FullHttpResponse toFullHttpResponse(int streamId, Http2Headers http2Headers, ByteBufAllocator alloc,
boolean validateHttpHeaders)
throws Http2Exception {
HttpResponseStatus status = parseStatus(http2Headers.status());
// HTTP/2 does not define a way to carry the version or reason phrase that is included in an
// HTTP/1.1 status line.
FullHttpResponse msg = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, status, alloc.buffer(),
validateHttpHeaders);
try {
addHttp2ToHttpHeaders(streamId, http2Headers, msg, false);
} catch (Http2Exception e) {
msg.release();
throw e;
} catch (Throwable t) {
msg.release();
throw streamError(streamId, PROTOCOL_ERROR, t, "HTTP/2 to HTTP/1.x headers conversion error");
}
return msg;
} | [
"public",
"static",
"FullHttpResponse",
"toFullHttpResponse",
"(",
"int",
"streamId",
",",
"Http2Headers",
"http2Headers",
",",
"ByteBufAllocator",
"alloc",
",",
"boolean",
"validateHttpHeaders",
")",
"throws",
"Http2Exception",
"{",
"HttpResponseStatus",
"status",
"=",
... | Create a new object to contain the response data
@param streamId The stream associated with the response
@param http2Headers The initial set of HTTP/2 headers to create the response with
@param alloc The {@link ByteBufAllocator} to use to generate the content of the message
@param validateHttpHeaders <ul>
<li>{@code true} to validate HTTP headers in the http-codec</li>
<li>{@code false} not to validate HTTP headers in the http-codec</li>
</ul>
@return A new response object which represents headers/data
@throws Http2Exception see {@link #addHttp2ToHttpHeaders(int, Http2Headers, FullHttpMessage, boolean)} | [
"Create",
"a",
"new",
"object",
"to",
"contain",
"the",
"response",
"data"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HttpConversionUtil.java#L213-L231 |
lucmoreau/ProvToolbox | prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java | ProvFactory.newEntity | public Entity newEntity(QualifiedName id, Collection<Attribute> attributes) {
Entity res = newEntity(id);
setAttributes(res, attributes);
return res;
} | java | public Entity newEntity(QualifiedName id, Collection<Attribute> attributes) {
Entity res = newEntity(id);
setAttributes(res, attributes);
return res;
} | [
"public",
"Entity",
"newEntity",
"(",
"QualifiedName",
"id",
",",
"Collection",
"<",
"Attribute",
">",
"attributes",
")",
"{",
"Entity",
"res",
"=",
"newEntity",
"(",
"id",
")",
";",
"setAttributes",
"(",
"res",
",",
"attributes",
")",
";",
"return",
"res"... | Creates a new {@link Entity} with provided identifier and attributes
@param id a {@link QualifiedName} for the entity
@param attributes a collection of {@link Attribute} for the entity
@return an object of type {@link Entity} | [
"Creates",
"a",
"new",
"{"
] | train | https://github.com/lucmoreau/ProvToolbox/blob/f865952868ffb69432937b08728c86bebbe4678a/prov-model/src/main/java/org/openprovenance/prov/model/ProvFactory.java#L638-L642 |
json-path/JsonPath | json-path/src/main/java/com/jayway/jsonpath/JsonPath.java | JsonPath.put | public <T> T put(Object jsonObject, String key, Object value, Configuration configuration) {
notNull(jsonObject, "json can not be null");
notEmpty(key, "key can not be null or empty");
notNull(configuration, "configuration can not be null");
EvaluationContext evaluationContext = path.evaluate(jsonObject, jsonObject, configuration, true);
for (PathRef updateOperation : evaluationContext.updateOperations()) {
updateOperation.put(key, value, configuration);
}
return resultByConfiguration(jsonObject, configuration, evaluationContext);
} | java | public <T> T put(Object jsonObject, String key, Object value, Configuration configuration) {
notNull(jsonObject, "json can not be null");
notEmpty(key, "key can not be null or empty");
notNull(configuration, "configuration can not be null");
EvaluationContext evaluationContext = path.evaluate(jsonObject, jsonObject, configuration, true);
for (PathRef updateOperation : evaluationContext.updateOperations()) {
updateOperation.put(key, value, configuration);
}
return resultByConfiguration(jsonObject, configuration, evaluationContext);
} | [
"public",
"<",
"T",
">",
"T",
"put",
"(",
"Object",
"jsonObject",
",",
"String",
"key",
",",
"Object",
"value",
",",
"Configuration",
"configuration",
")",
"{",
"notNull",
"(",
"jsonObject",
",",
"\"json can not be null\"",
")",
";",
"notEmpty",
"(",
"key",
... | Adds or updates the Object this path points to in the provided jsonObject with a key with a value
@param jsonObject a json object
@param key the key to add or update
@param value the new value
@param configuration configuration to use
@param <T> expected return type
@return the updated jsonObject or the path list to updated objects if option AS_PATH_LIST is set. | [
"Adds",
"or",
"updates",
"the",
"Object",
"this",
"path",
"points",
"to",
"in",
"the",
"provided",
"jsonObject",
"with",
"a",
"key",
"with",
"a",
"value"
] | train | https://github.com/json-path/JsonPath/blob/5a09489c3252b74bbf81992aadb3073be59c04f9/json-path/src/main/java/com/jayway/jsonpath/JsonPath.java#L294-L303 |
rey5137/material | material/src/main/java/com/rey/material/app/DatePickerDialog.java | DatePickerDialog.dateRange | public DatePickerDialog dateRange(int minDay, int minMonth, int minYear, int maxDay, int maxMonth, int maxYear){
mDatePickerLayout.setDateRange(minDay, minMonth, minYear, maxDay, maxMonth, maxYear);
return this;
} | java | public DatePickerDialog dateRange(int minDay, int minMonth, int minYear, int maxDay, int maxMonth, int maxYear){
mDatePickerLayout.setDateRange(minDay, minMonth, minYear, maxDay, maxMonth, maxYear);
return this;
} | [
"public",
"DatePickerDialog",
"dateRange",
"(",
"int",
"minDay",
",",
"int",
"minMonth",
",",
"int",
"minYear",
",",
"int",
"maxDay",
",",
"int",
"maxMonth",
",",
"int",
"maxYear",
")",
"{",
"mDatePickerLayout",
".",
"setDateRange",
"(",
"minDay",
",",
"minM... | Set the range of selectable dates.
@param minDay The day value of minimum date.
@param minMonth The month value of minimum date.
@param minYear The year value of minimum date.
@param maxDay The day value of maximum date.
@param maxMonth The month value of maximum date.
@param maxYear The year value of maximum date.
@return The DatePickerDialog for chaining methods. | [
"Set",
"the",
"range",
"of",
"selectable",
"dates",
"."
] | train | https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/material/src/main/java/com/rey/material/app/DatePickerDialog.java#L103-L106 |
jeremylong/DependencyCheck | utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java | Settings.setArrayIfNotEmpty | public void setArrayIfNotEmpty(@NotNull final String key, @Nullable final List<String> value) {
if (null != value && !value.isEmpty()) {
setString(key, new Gson().toJson(value));
}
} | java | public void setArrayIfNotEmpty(@NotNull final String key, @Nullable final List<String> value) {
if (null != value && !value.isEmpty()) {
setString(key, new Gson().toJson(value));
}
} | [
"public",
"void",
"setArrayIfNotEmpty",
"(",
"@",
"NotNull",
"final",
"String",
"key",
",",
"@",
"Nullable",
"final",
"List",
"<",
"String",
">",
"value",
")",
"{",
"if",
"(",
"null",
"!=",
"value",
"&&",
"!",
"value",
".",
"isEmpty",
"(",
")",
")",
... | Sets a property value only if the array value is not null and not empty.
@param key the key for the property
@param value the value for the property | [
"Sets",
"a",
"property",
"value",
"only",
"if",
"the",
"array",
"value",
"is",
"not",
"null",
"and",
"not",
"empty",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java#L712-L716 |
jcuda/jcuda | JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java | JCudaDriver.cuModuleGetGlobal | public static int cuModuleGetGlobal(CUdeviceptr dptr, long bytes[], CUmodule hmod, String name)
{
return checkResult(cuModuleGetGlobalNative(dptr, bytes, hmod, name));
} | java | public static int cuModuleGetGlobal(CUdeviceptr dptr, long bytes[], CUmodule hmod, String name)
{
return checkResult(cuModuleGetGlobalNative(dptr, bytes, hmod, name));
} | [
"public",
"static",
"int",
"cuModuleGetGlobal",
"(",
"CUdeviceptr",
"dptr",
",",
"long",
"bytes",
"[",
"]",
",",
"CUmodule",
"hmod",
",",
"String",
"name",
")",
"{",
"return",
"checkResult",
"(",
"cuModuleGetGlobalNative",
"(",
"dptr",
",",
"bytes",
",",
"hm... | Returns a global pointer from a module.
<pre>
CUresult cuModuleGetGlobal (
CUdeviceptr* dptr,
size_t* bytes,
CUmodule hmod,
const char* name )
</pre>
<div>
<p>Returns a global pointer from a module.
Returns in <tt>*dptr</tt> and <tt>*bytes</tt> the base pointer and
size of the global of name <tt>name</tt> located in module <tt>hmod</tt>. If no variable of that name exists, cuModuleGetGlobal()
returns CUDA_ERROR_NOT_FOUND. Both parameters <tt>dptr</tt> and <tt>bytes</tt> are optional. If one of them is NULL, it is ignored.
</p>
<div>
<span>Note:</span>
<p>Note that this
function may also return error codes from previous, asynchronous
launches.
</p>
</div>
</p>
</div>
@param dptr Returned global device pointer
@param bytes Returned global size in bytes
@param hmod Module to retrieve global from
@param name Name of global to retrieve
@return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED,
CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE,
CUDA_ERROR_NOT_FOUND
@see JCudaDriver#cuModuleGetFunction
@see JCudaDriver#cuModuleGetTexRef
@see JCudaDriver#cuModuleLoad
@see JCudaDriver#cuModuleLoadData
@see JCudaDriver#cuModuleLoadDataEx
@see JCudaDriver#cuModuleLoadFatBinary
@see JCudaDriver#cuModuleUnload | [
"Returns",
"a",
"global",
"pointer",
"from",
"a",
"module",
"."
] | train | https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L2636-L2639 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/CommandGroup.java | CommandGroup.createButtonBar | public JComponent createButtonBar(final ColumnSpec columnSpec, final RowSpec rowSpec, final Border border) {
final ButtonBarGroupContainerPopulator container = new ButtonBarGroupContainerPopulator();
container.setColumnSpec(columnSpec);
container.setRowSpec(rowSpec);
addCommandsToGroupContainer(container);
return GuiStandardUtils.attachBorder(container.getButtonBar(), border);
} | java | public JComponent createButtonBar(final ColumnSpec columnSpec, final RowSpec rowSpec, final Border border) {
final ButtonBarGroupContainerPopulator container = new ButtonBarGroupContainerPopulator();
container.setColumnSpec(columnSpec);
container.setRowSpec(rowSpec);
addCommandsToGroupContainer(container);
return GuiStandardUtils.attachBorder(container.getButtonBar(), border);
} | [
"public",
"JComponent",
"createButtonBar",
"(",
"final",
"ColumnSpec",
"columnSpec",
",",
"final",
"RowSpec",
"rowSpec",
",",
"final",
"Border",
"border",
")",
"{",
"final",
"ButtonBarGroupContainerPopulator",
"container",
"=",
"new",
"ButtonBarGroupContainerPopulator",
... | Create a button bar with buttons for all the commands in this.
@param columnSpec Custom columnSpec for each column containing a button,
can be <code>null</code>.
@param rowSpec Custom rowspec for the buttonbar, can be <code>null</code>.
@param border if null, then don't use a border
@return never null | [
"Create",
"a",
"button",
"bar",
"with",
"buttons",
"for",
"all",
"the",
"commands",
"in",
"this",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/CommandGroup.java#L472-L478 |
BotMill/fb-botmill | src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/TextMessageBuilder.java | TextMessageBuilder.build | public FbBotMillResponse build(MessageEnvelope envelope) {
User recipient = getRecipient(envelope);
Message message = new TextMessage(messageText);
message.setQuickReplies(quickReplies);
return new FbBotMillMessageResponse(recipient, message);
} | java | public FbBotMillResponse build(MessageEnvelope envelope) {
User recipient = getRecipient(envelope);
Message message = new TextMessage(messageText);
message.setQuickReplies(quickReplies);
return new FbBotMillMessageResponse(recipient, message);
} | [
"public",
"FbBotMillResponse",
"build",
"(",
"MessageEnvelope",
"envelope",
")",
"{",
"User",
"recipient",
"=",
"getRecipient",
"(",
"envelope",
")",
";",
"Message",
"message",
"=",
"new",
"TextMessage",
"(",
"messageText",
")",
";",
"message",
".",
"setQuickRep... | {@inheritDoc} Returns a response containing a plain text message. | [
"{"
] | train | https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/TextMessageBuilder.java#L142-L147 |
nguyenq/tess4j | src/main/java/net/sourceforge/tess4j/util/ImageHelper.java | ImageHelper.getScaledInstance | public static BufferedImage getScaledInstance(BufferedImage image, int targetWidth, int targetHeight) {
int type = (image.getTransparency() == Transparency.OPAQUE)
? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB;
BufferedImage tmp = new BufferedImage(targetWidth, targetHeight, type);
Graphics2D g2 = tmp.createGraphics();
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
g2.drawImage(image, 0, 0, targetWidth, targetHeight, null);
g2.dispose();
return tmp;
} | java | public static BufferedImage getScaledInstance(BufferedImage image, int targetWidth, int targetHeight) {
int type = (image.getTransparency() == Transparency.OPAQUE)
? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB;
BufferedImage tmp = new BufferedImage(targetWidth, targetHeight, type);
Graphics2D g2 = tmp.createGraphics();
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
g2.drawImage(image, 0, 0, targetWidth, targetHeight, null);
g2.dispose();
return tmp;
} | [
"public",
"static",
"BufferedImage",
"getScaledInstance",
"(",
"BufferedImage",
"image",
",",
"int",
"targetWidth",
",",
"int",
"targetHeight",
")",
"{",
"int",
"type",
"=",
"(",
"image",
".",
"getTransparency",
"(",
")",
"==",
"Transparency",
".",
"OPAQUE",
"... | Convenience method that returns a scaled instance of the provided
{@code BufferedImage}.
@param image the original image to be scaled
@param targetWidth the desired width of the scaled instance, in pixels
@param targetHeight the desired height of the scaled instance, in pixels
@return a scaled version of the original {@code BufferedImage} | [
"Convenience",
"method",
"that",
"returns",
"a",
"scaled",
"instance",
"of",
"the",
"provided",
"{",
"@code",
"BufferedImage",
"}",
"."
] | train | https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/net/sourceforge/tess4j/util/ImageHelper.java#L39-L48 |
netty/netty | common/src/main/java/io/netty/util/internal/ThreadExecutorMap.java | ThreadExecutorMap.apply | public static ThreadFactory apply(final ThreadFactory threadFactory, final EventExecutor eventExecutor) {
ObjectUtil.checkNotNull(threadFactory, "command");
ObjectUtil.checkNotNull(eventExecutor, "eventExecutor");
return new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
return threadFactory.newThread(apply(r, eventExecutor));
}
};
} | java | public static ThreadFactory apply(final ThreadFactory threadFactory, final EventExecutor eventExecutor) {
ObjectUtil.checkNotNull(threadFactory, "command");
ObjectUtil.checkNotNull(eventExecutor, "eventExecutor");
return new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
return threadFactory.newThread(apply(r, eventExecutor));
}
};
} | [
"public",
"static",
"ThreadFactory",
"apply",
"(",
"final",
"ThreadFactory",
"threadFactory",
",",
"final",
"EventExecutor",
"eventExecutor",
")",
"{",
"ObjectUtil",
".",
"checkNotNull",
"(",
"threadFactory",
",",
"\"command\"",
")",
";",
"ObjectUtil",
".",
"checkNo... | Decorate the given {@link ThreadFactory} and ensure {@link #currentExecutor()} will return {@code eventExecutor}
when called from within the {@link Runnable} during execution. | [
"Decorate",
"the",
"given",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/ThreadExecutorMap.java#L86-L95 |
eobermuhlner/big-math | ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java | BigDecimalMath.atanh | public static BigDecimal atanh(BigDecimal x, MathContext mathContext) {
if (x.compareTo(BigDecimal.ONE) >= 0) {
throw new ArithmeticException("Illegal atanh(x) for x >= 1: x = " + x);
}
if (x.compareTo(MINUS_ONE) <= 0) {
throw new ArithmeticException("Illegal atanh(x) for x <= -1: x = " + x);
}
checkMathContext(mathContext);
MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode());
BigDecimal result = log(ONE.add(x, mc).divide(ONE.subtract(x, mc), mc), mc).multiply(ONE_HALF, mc);
return round(result, mathContext);
} | java | public static BigDecimal atanh(BigDecimal x, MathContext mathContext) {
if (x.compareTo(BigDecimal.ONE) >= 0) {
throw new ArithmeticException("Illegal atanh(x) for x >= 1: x = " + x);
}
if (x.compareTo(MINUS_ONE) <= 0) {
throw new ArithmeticException("Illegal atanh(x) for x <= -1: x = " + x);
}
checkMathContext(mathContext);
MathContext mc = new MathContext(mathContext.getPrecision() + 6, mathContext.getRoundingMode());
BigDecimal result = log(ONE.add(x, mc).divide(ONE.subtract(x, mc), mc), mc).multiply(ONE_HALF, mc);
return round(result, mathContext);
} | [
"public",
"static",
"BigDecimal",
"atanh",
"(",
"BigDecimal",
"x",
",",
"MathContext",
"mathContext",
")",
"{",
"if",
"(",
"x",
".",
"compareTo",
"(",
"BigDecimal",
".",
"ONE",
")",
">=",
"0",
")",
"{",
"throw",
"new",
"ArithmeticException",
"(",
"\"Illega... | Calculates the arc hyperbolic tangens (inverse hyperbolic tangens) of {@link BigDecimal} x.
<p>See: <a href="https://en.wikipedia.org/wiki/Hyperbolic_function">Wikipedia: Hyperbolic function</a></p>
@param x the {@link BigDecimal} to calculate the arc hyperbolic tangens for
@param mathContext the {@link MathContext} used for the result
@return the calculated arc hyperbolic tangens {@link BigDecimal} with the precision specified in the <code>mathContext</code>
@throws UnsupportedOperationException if the {@link MathContext} has unlimited precision | [
"Calculates",
"the",
"arc",
"hyperbolic",
"tangens",
"(",
"inverse",
"hyperbolic",
"tangens",
")",
"of",
"{",
"@link",
"BigDecimal",
"}",
"x",
"."
] | train | https://github.com/eobermuhlner/big-math/blob/52c4fc334d0d722b295de740c1018ee400e3e8f2/ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java#L1635-L1647 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java | NodeIndexer.createFulltextField | protected Fieldable createFulltextField(Reader value)
{
if (supportHighlighting)
{
return new TextFieldExtractor(FieldNames.FULLTEXT, value, true, true);
}
else
{
return new TextFieldExtractor(FieldNames.FULLTEXT, value, false, false);
}
} | java | protected Fieldable createFulltextField(Reader value)
{
if (supportHighlighting)
{
return new TextFieldExtractor(FieldNames.FULLTEXT, value, true, true);
}
else
{
return new TextFieldExtractor(FieldNames.FULLTEXT, value, false, false);
}
} | [
"protected",
"Fieldable",
"createFulltextField",
"(",
"Reader",
"value",
")",
"{",
"if",
"(",
"supportHighlighting",
")",
"{",
"return",
"new",
"TextFieldExtractor",
"(",
"FieldNames",
".",
"FULLTEXT",
",",
"value",
",",
"true",
",",
"true",
")",
";",
"}",
"... | Creates a fulltext field for the reader <code>value</code>.
@param value the reader value.
@return a lucene field. | [
"Creates",
"a",
"fulltext",
"field",
"for",
"the",
"reader",
"<code",
">",
"value<",
"/",
"code",
">",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java#L919-L929 |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/customer/B2BAccountUrl.java | B2BAccountUrl.getB2BAccountAttributeUrl | public static MozuUrl getB2BAccountAttributeUrl(Integer accountId, String attributeFQN, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/b2baccounts/{accountId}/attributes/{attributeFQN}?responseFields={responseFields}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("attributeFQN", attributeFQN);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getB2BAccountAttributeUrl(Integer accountId, String attributeFQN, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/b2baccounts/{accountId}/attributes/{attributeFQN}?responseFields={responseFields}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("attributeFQN", attributeFQN);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getB2BAccountAttributeUrl",
"(",
"Integer",
"accountId",
",",
"String",
"attributeFQN",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/customer/b2baccounts/{accountId}... | Get Resource Url for GetB2BAccountAttribute
@param accountId Unique identifier of the customer account.
@param attributeFQN Fully qualified name for an attribute.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetB2BAccountAttribute"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/customer/B2BAccountUrl.java#L49-L56 |
cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/CouchClient.java | CouchClient.revsDiff | public Map<String, MissingRevisions> revsDiff(Map<String, Set<String>> revisions) {
Misc.checkNotNull(revisions, "Input revisions");
URI uri = this.uriHelper.revsDiffUri();
String payload = JSONUtils.toJson(revisions);
HttpConnection connection = Http.POST(uri, "application/json");
connection.setRequestBody(payload);
return executeToJsonObjectWithRetry(connection, JSONUtils.STRING_MISSING_REVS_MAP_TYPE_DEF);
} | java | public Map<String, MissingRevisions> revsDiff(Map<String, Set<String>> revisions) {
Misc.checkNotNull(revisions, "Input revisions");
URI uri = this.uriHelper.revsDiffUri();
String payload = JSONUtils.toJson(revisions);
HttpConnection connection = Http.POST(uri, "application/json");
connection.setRequestBody(payload);
return executeToJsonObjectWithRetry(connection, JSONUtils.STRING_MISSING_REVS_MAP_TYPE_DEF);
} | [
"public",
"Map",
"<",
"String",
",",
"MissingRevisions",
">",
"revsDiff",
"(",
"Map",
"<",
"String",
",",
"Set",
"<",
"String",
">",
">",
"revisions",
")",
"{",
"Misc",
".",
"checkNotNull",
"(",
"revisions",
",",
"\"Input revisions\"",
")",
";",
"URI",
"... | Returns the subset of given the documentId/revisions that are not stored in the database.
The input revisions is a map, whose key is document ID, and value is a list of revisions.
An example input could be (in JSON format):
{ "03ee06461a12f3c288bb865b22000170":
[
"1-b2e54331db828310f3c772d6e042ac9c",
"2-3a24009a9525bde9e4bfa8a99046b00d"
],
"82e04f650661c9bdb88c57e044000a4b":
[
"3-bb39f8c740c6ffb8614c7031b46ac162"
]
}
The output is in same format.
If the ID has no missing revision, it should not appear in the Map's key set. If all IDs
do not have missing revisions, the returned Map should be empty map, but never null.
@see
<a target="_blank" href="http://wiki.apache.org/couchdb/HttpPostRevsDiff">HttpPostRevsDiff
documentation</a> | [
"Returns",
"the",
"subset",
"of",
"given",
"the",
"documentId",
"/",
"revisions",
"that",
"are",
"not",
"stored",
"in",
"the",
"database",
"."
] | train | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/CouchClient.java#L865-L873 |
FasterXML/jackson-jr | jr-objects/src/main/java/com/fasterxml/jackson/jr/type/TypeBindings.java | TypeBindings.withUnboundVariable | public TypeBindings withUnboundVariable(String name)
{
int len = (_unboundVariables == null) ? 0 : _unboundVariables.length;
String[] names = (len == 0)
? new String[1] : Arrays.copyOf(_unboundVariables, len+1);
names[len] = name;
return new TypeBindings(_names, _types, names);
} | java | public TypeBindings withUnboundVariable(String name)
{
int len = (_unboundVariables == null) ? 0 : _unboundVariables.length;
String[] names = (len == 0)
? new String[1] : Arrays.copyOf(_unboundVariables, len+1);
names[len] = name;
return new TypeBindings(_names, _types, names);
} | [
"public",
"TypeBindings",
"withUnboundVariable",
"(",
"String",
"name",
")",
"{",
"int",
"len",
"=",
"(",
"_unboundVariables",
"==",
"null",
")",
"?",
"0",
":",
"_unboundVariables",
".",
"length",
";",
"String",
"[",
"]",
"names",
"=",
"(",
"len",
"==",
... | Method for creating an instance that has same bindings as this object,
plus an indicator for additional type variable that may be unbound within
this context; this is needed to resolve recursive self-references. | [
"Method",
"for",
"creating",
"an",
"instance",
"that",
"has",
"same",
"bindings",
"as",
"this",
"object",
"plus",
"an",
"indicator",
"for",
"additional",
"type",
"variable",
"that",
"may",
"be",
"unbound",
"within",
"this",
"context",
";",
"this",
"is",
"nee... | train | https://github.com/FasterXML/jackson-jr/blob/62ca7a82bd90a9be77028e0b62364307d7532837/jr-objects/src/main/java/com/fasterxml/jackson/jr/type/TypeBindings.java#L78-L85 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.listModelsAsync | public Observable<List<ModelInfoResponse>> listModelsAsync(UUID appId, String versionId, ListModelsOptionalParameter listModelsOptionalParameter) {
return listModelsWithServiceResponseAsync(appId, versionId, listModelsOptionalParameter).map(new Func1<ServiceResponse<List<ModelInfoResponse>>, List<ModelInfoResponse>>() {
@Override
public List<ModelInfoResponse> call(ServiceResponse<List<ModelInfoResponse>> response) {
return response.body();
}
});
} | java | public Observable<List<ModelInfoResponse>> listModelsAsync(UUID appId, String versionId, ListModelsOptionalParameter listModelsOptionalParameter) {
return listModelsWithServiceResponseAsync(appId, versionId, listModelsOptionalParameter).map(new Func1<ServiceResponse<List<ModelInfoResponse>>, List<ModelInfoResponse>>() {
@Override
public List<ModelInfoResponse> call(ServiceResponse<List<ModelInfoResponse>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"ModelInfoResponse",
">",
">",
"listModelsAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"ListModelsOptionalParameter",
"listModelsOptionalParameter",
")",
"{",
"return",
"listModelsWithServiceResponseAsync",
"(",
... | Gets information about the application version models.
@param appId The application ID.
@param versionId The version ID.
@param listModelsOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<ModelInfoResponse> object | [
"Gets",
"information",
"about",
"the",
"application",
"version",
"models",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L2472-L2479 |
esigate/esigate | esigate-core/src/main/java/org/esigate/Driver.java | Driver.performRendering | private String performRendering(String pageUrl, DriverRequest originalRequest, CloseableHttpResponse response,
String body, Renderer[] renderers) throws IOException, HttpErrorPage {
// Start rendering
RenderEvent renderEvent = new RenderEvent(pageUrl, originalRequest, response);
// Create renderer list from parameters.
renderEvent.getRenderers().addAll(Arrays.asList(renderers));
String currentBody = body;
this.eventManager.fire(EventManager.EVENT_RENDER_PRE, renderEvent);
for (Renderer renderer : renderEvent.getRenderers()) {
StringBuilderWriter stringWriter = new StringBuilderWriter(Parameters.DEFAULT_BUFFER_SIZE);
renderer.render(originalRequest, currentBody, stringWriter);
stringWriter.close();
currentBody = stringWriter.toString();
}
this.eventManager.fire(EventManager.EVENT_RENDER_POST, renderEvent);
return currentBody;
} | java | private String performRendering(String pageUrl, DriverRequest originalRequest, CloseableHttpResponse response,
String body, Renderer[] renderers) throws IOException, HttpErrorPage {
// Start rendering
RenderEvent renderEvent = new RenderEvent(pageUrl, originalRequest, response);
// Create renderer list from parameters.
renderEvent.getRenderers().addAll(Arrays.asList(renderers));
String currentBody = body;
this.eventManager.fire(EventManager.EVENT_RENDER_PRE, renderEvent);
for (Renderer renderer : renderEvent.getRenderers()) {
StringBuilderWriter stringWriter = new StringBuilderWriter(Parameters.DEFAULT_BUFFER_SIZE);
renderer.render(originalRequest, currentBody, stringWriter);
stringWriter.close();
currentBody = stringWriter.toString();
}
this.eventManager.fire(EventManager.EVENT_RENDER_POST, renderEvent);
return currentBody;
} | [
"private",
"String",
"performRendering",
"(",
"String",
"pageUrl",
",",
"DriverRequest",
"originalRequest",
",",
"CloseableHttpResponse",
"response",
",",
"String",
"body",
",",
"Renderer",
"[",
"]",
"renderers",
")",
"throws",
"IOException",
",",
"HttpErrorPage",
"... | Performs rendering (apply a render list) on an http response body (as a String).
@param pageUrl
The remove url from which the body was retrieved.
@param originalRequest
The request received by esigate.
@param response
The Http Reponse.
@param body
The body of the Http Response which will be rendered.
@param renderers
list of renderers to apply.
@return The rendered response body.
@throws HttpErrorPage
@throws IOException | [
"Performs",
"rendering",
"(",
"apply",
"a",
"render",
"list",
")",
"on",
"an",
"http",
"response",
"body",
"(",
"as",
"a",
"String",
")",
"."
] | train | https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/Driver.java#L399-L418 |
aws/aws-sdk-java | aws-java-sdk-glacier/src/main/java/com/amazonaws/services/glacier/model/AddTagsToVaultRequest.java | AddTagsToVaultRequest.withTags | public AddTagsToVaultRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public AddTagsToVaultRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"AddTagsToVaultRequest",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The tags to add to the vault. Each tag is composed of a key and a value. The value can be an empty string.
</p>
@param tags
The tags to add to the vault. Each tag is composed of a key and a value. The value can be an empty string.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"tags",
"to",
"add",
"to",
"the",
"vault",
".",
"Each",
"tag",
"is",
"composed",
"of",
"a",
"key",
"and",
"a",
"value",
".",
"The",
"value",
"can",
"be",
"an",
"empty",
"string",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glacier/src/main/java/com/amazonaws/services/glacier/model/AddTagsToVaultRequest.java#L184-L187 |
VoltDB/voltdb | src/frontend/org/voltdb/types/GeographyPointValue.java | GeographyPointValue.fromWKT | public static GeographyPointValue fromWKT(String param) {
if (param == null) {
throw new IllegalArgumentException("Null well known text argument to GeographyPointValue constructor.");
}
Matcher m = wktPattern.matcher(param);
if (m.find()) {
// Add 0.0 to avoid -0.0.
double longitude = toDouble(m.group(1), m.group(2)) + 0.0;
double latitude = toDouble(m.group(3), m.group(4)) + 0.0;
if (Math.abs(latitude) > 90.0) {
throw new IllegalArgumentException(String.format("Latitude \"%f\" out of bounds.", latitude));
}
if (Math.abs(longitude) > 180.0) {
throw new IllegalArgumentException(String.format("Longitude \"%f\" out of bounds.", longitude));
}
return new GeographyPointValue(longitude, latitude);
} else {
throw new IllegalArgumentException("Cannot construct GeographyPointValue value from \"" + param + "\"");
}
} | java | public static GeographyPointValue fromWKT(String param) {
if (param == null) {
throw new IllegalArgumentException("Null well known text argument to GeographyPointValue constructor.");
}
Matcher m = wktPattern.matcher(param);
if (m.find()) {
// Add 0.0 to avoid -0.0.
double longitude = toDouble(m.group(1), m.group(2)) + 0.0;
double latitude = toDouble(m.group(3), m.group(4)) + 0.0;
if (Math.abs(latitude) > 90.0) {
throw new IllegalArgumentException(String.format("Latitude \"%f\" out of bounds.", latitude));
}
if (Math.abs(longitude) > 180.0) {
throw new IllegalArgumentException(String.format("Longitude \"%f\" out of bounds.", longitude));
}
return new GeographyPointValue(longitude, latitude);
} else {
throw new IllegalArgumentException("Cannot construct GeographyPointValue value from \"" + param + "\"");
}
} | [
"public",
"static",
"GeographyPointValue",
"fromWKT",
"(",
"String",
"param",
")",
"{",
"if",
"(",
"param",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Null well known text argument to GeographyPointValue constructor.\"",
")",
";",
"}",
... | Create a GeographyPointValue from a well-known text string.
@param param A well-known text string.
@return A new instance of GeographyPointValue. | [
"Create",
"a",
"GeographyPointValue",
"from",
"a",
"well",
"-",
"known",
"text",
"string",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/types/GeographyPointValue.java#L91-L110 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/proxy/cglib/CglibLazyInitializer.java | CglibLazyInitializer.getProxyFactory | public static Class getProxyFactory(Class persistentClass, Class[] interfaces) throws PersistenceException
{
Enhancer e = new Enhancer();
e.setSuperclass(interfaces.length == 1 ? persistentClass : null);
e.setInterfaces(interfaces);
e.setCallbackTypes(new Class[] { InvocationHandler.class, NoOp.class, });
e.setCallbackFilter(FINALIZE_FILTER);
e.setUseFactory(false);
e.setInterceptDuringConstruction(false);
return e.createClass();
} | java | public static Class getProxyFactory(Class persistentClass, Class[] interfaces) throws PersistenceException
{
Enhancer e = new Enhancer();
e.setSuperclass(interfaces.length == 1 ? persistentClass : null);
e.setInterfaces(interfaces);
e.setCallbackTypes(new Class[] { InvocationHandler.class, NoOp.class, });
e.setCallbackFilter(FINALIZE_FILTER);
e.setUseFactory(false);
e.setInterceptDuringConstruction(false);
return e.createClass();
} | [
"public",
"static",
"Class",
"getProxyFactory",
"(",
"Class",
"persistentClass",
",",
"Class",
"[",
"]",
"interfaces",
")",
"throws",
"PersistenceException",
"{",
"Enhancer",
"e",
"=",
"new",
"Enhancer",
"(",
")",
";",
"e",
".",
"setSuperclass",
"(",
"interfac... | Gets the proxy factory.
@param persistentClass
the persistent class
@param interfaces
the interfaces
@return the proxy factory
@throws PersistenceException
the persistence exception | [
"Gets",
"the",
"proxy",
"factory",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/proxy/cglib/CglibLazyInitializer.java#L189-L199 |
jmeetsma/Iglu-Common | src/main/java/org/ijsberg/iglu/caching/module/StandardCache.java | StandardCache.createCache | public static <K, V> Cache<K, V> createCache(String cacheName) {
return createCache(cacheName, DEFAULT_TTL, DEFAULT_CLEANUP_INTERVAL/*, application, layer*/);
} | java | public static <K, V> Cache<K, V> createCache(String cacheName) {
return createCache(cacheName, DEFAULT_TTL, DEFAULT_CLEANUP_INTERVAL/*, application, layer*/);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Cache",
"<",
"K",
",",
"V",
">",
"createCache",
"(",
"String",
"cacheName",
")",
"{",
"return",
"createCache",
"(",
"cacheName",
",",
"DEFAULT_TTL",
",",
"DEFAULT_CLEANUP_INTERVAL",
"/*, application, layer*/",
")",... | Retrieves a cache from the current layer or creates it.
Only a root request will be able to embed the constructed cache in the
application.
@param cacheName cache service ID
@return | [
"Retrieves",
"a",
"cache",
"from",
"the",
"current",
"layer",
"or",
"creates",
"it",
".",
"Only",
"a",
"root",
"request",
"will",
"be",
"able",
"to",
"embed",
"the",
"constructed",
"cache",
"in",
"the",
"application",
"."
] | train | https://github.com/jmeetsma/Iglu-Common/blob/0fb0885775b576209ff1b5a0f67e3c25a99a6420/src/main/java/org/ijsberg/iglu/caching/module/StandardCache.java#L404-L406 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java | JavacFileManager.isValidFile | private boolean isValidFile(String s, Set<JavaFileObject.Kind> fileKinds) {
JavaFileObject.Kind kind = getKind(s);
return fileKinds.contains(kind);
} | java | private boolean isValidFile(String s, Set<JavaFileObject.Kind> fileKinds) {
JavaFileObject.Kind kind = getKind(s);
return fileKinds.contains(kind);
} | [
"private",
"boolean",
"isValidFile",
"(",
"String",
"s",
",",
"Set",
"<",
"JavaFileObject",
".",
"Kind",
">",
"fileKinds",
")",
"{",
"JavaFileObject",
".",
"Kind",
"kind",
"=",
"getKind",
"(",
"s",
")",
";",
"return",
"fileKinds",
".",
"contains",
"(",
"... | container is a directory, a zip file, or a non-existent path. | [
"container",
"is",
"a",
"directory",
"a",
"zip",
"file",
"or",
"a",
"non",
"-",
"existent",
"path",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java#L613-L616 |
BioPAX/Paxtools | sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java | L3ToSBGNPDConverter.createProcessAndConnections | private void createProcessAndConnections(Conversion cnv, ConversionDirectionType direction)
{
assert cnv.getConversionDirection() == null ||
cnv.getConversionDirection().equals(direction) ||
cnv.getConversionDirection().equals(ConversionDirectionType.REVERSIBLE);
// create the process for the conversion in that direction
Glyph process = factory.createGlyph();
process.setClazz(GlyphClazz.PROCESS.getClazz());
process.setId(convertID(cnv.getUri()) + "_" + direction.name().replaceAll("_",""));
glyphMap.put(process.getId(), process);
// Determine input and output sets
Set<PhysicalEntity> input = direction.equals(ConversionDirectionType.RIGHT_TO_LEFT) ?
cnv.getRight() : cnv.getLeft();
Set<PhysicalEntity> output = direction.equals(ConversionDirectionType.RIGHT_TO_LEFT) ?
cnv.getLeft() : cnv.getRight();
// Create input and outputs ports for the process
addPorts(process);
Map<PhysicalEntity, Stoichiometry> stoic = getStoichiometry(cnv);
// Associate inputs to input port
for (PhysicalEntity pe : input) {
Glyph g = getGlyphToLink(pe, process.getId());
createArc(g, process.getPort().get(0), direction == ConversionDirectionType.REVERSIBLE ?
ArcClazz.PRODUCTION.getClazz() : ArcClazz.CONSUMPTION.getClazz(), stoic.get(pe));
}
// Associate outputs to output port
for (PhysicalEntity pe : output) {
Glyph g = getGlyphToLink(pe, process.getId());
createArc(process.getPort().get(1), g, ArcClazz.PRODUCTION.getClazz(), stoic.get(pe));
}
processControllers(cnv.getControlledOf(), process);
// Record mapping
Set<String> uris = new HashSet<String>();
uris.add(cnv.getUri());
sbgn2BPMap.put(process.getId(), uris);
} | java | private void createProcessAndConnections(Conversion cnv, ConversionDirectionType direction)
{
assert cnv.getConversionDirection() == null ||
cnv.getConversionDirection().equals(direction) ||
cnv.getConversionDirection().equals(ConversionDirectionType.REVERSIBLE);
// create the process for the conversion in that direction
Glyph process = factory.createGlyph();
process.setClazz(GlyphClazz.PROCESS.getClazz());
process.setId(convertID(cnv.getUri()) + "_" + direction.name().replaceAll("_",""));
glyphMap.put(process.getId(), process);
// Determine input and output sets
Set<PhysicalEntity> input = direction.equals(ConversionDirectionType.RIGHT_TO_LEFT) ?
cnv.getRight() : cnv.getLeft();
Set<PhysicalEntity> output = direction.equals(ConversionDirectionType.RIGHT_TO_LEFT) ?
cnv.getLeft() : cnv.getRight();
// Create input and outputs ports for the process
addPorts(process);
Map<PhysicalEntity, Stoichiometry> stoic = getStoichiometry(cnv);
// Associate inputs to input port
for (PhysicalEntity pe : input) {
Glyph g = getGlyphToLink(pe, process.getId());
createArc(g, process.getPort().get(0), direction == ConversionDirectionType.REVERSIBLE ?
ArcClazz.PRODUCTION.getClazz() : ArcClazz.CONSUMPTION.getClazz(), stoic.get(pe));
}
// Associate outputs to output port
for (PhysicalEntity pe : output) {
Glyph g = getGlyphToLink(pe, process.getId());
createArc(process.getPort().get(1), g, ArcClazz.PRODUCTION.getClazz(), stoic.get(pe));
}
processControllers(cnv.getControlledOf(), process);
// Record mapping
Set<String> uris = new HashSet<String>();
uris.add(cnv.getUri());
sbgn2BPMap.put(process.getId(), uris);
} | [
"private",
"void",
"createProcessAndConnections",
"(",
"Conversion",
"cnv",
",",
"ConversionDirectionType",
"direction",
")",
"{",
"assert",
"cnv",
".",
"getConversionDirection",
"(",
")",
"==",
"null",
"||",
"cnv",
".",
"getConversionDirection",
"(",
")",
".",
"e... | /*
Creates a representation for Conversion.
@param cnv the conversion
@param direction direction of the conversion to create | [
"/",
"*",
"Creates",
"a",
"representation",
"for",
"Conversion",
"."
] | train | https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java#L924-L965 |
sockeqwe/AdapterDelegates | library/src/main/java/com/hannesdorfmann/adapterdelegates4/AdapterDelegatesManager.java | AdapterDelegatesManager.getItemViewType | public int getItemViewType(@NonNull T items, int position) {
if (items == null) {
throw new NullPointerException("Items datasource is null!");
}
int delegatesCount = delegates.size();
for (int i = 0; i < delegatesCount; i++) {
AdapterDelegate<T> delegate = delegates.valueAt(i);
if (delegate.isForViewType(items, position)) {
return delegates.keyAt(i);
}
}
if (fallbackDelegate != null) {
return FALLBACK_DELEGATE_VIEW_TYPE;
}
throw new NullPointerException(
"No AdapterDelegate added that matches position=" + position + " in data source");
} | java | public int getItemViewType(@NonNull T items, int position) {
if (items == null) {
throw new NullPointerException("Items datasource is null!");
}
int delegatesCount = delegates.size();
for (int i = 0; i < delegatesCount; i++) {
AdapterDelegate<T> delegate = delegates.valueAt(i);
if (delegate.isForViewType(items, position)) {
return delegates.keyAt(i);
}
}
if (fallbackDelegate != null) {
return FALLBACK_DELEGATE_VIEW_TYPE;
}
throw new NullPointerException(
"No AdapterDelegate added that matches position=" + position + " in data source");
} | [
"public",
"int",
"getItemViewType",
"(",
"@",
"NonNull",
"T",
"items",
",",
"int",
"position",
")",
"{",
"if",
"(",
"items",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Items datasource is null!\"",
")",
";",
"}",
"int",
"delegate... | Must be called from {@link RecyclerView.Adapter#getItemViewType(int)}. Internally it scans all
the registered {@link AdapterDelegate} and picks the right one to return the ViewType integer.
@param items Adapter's data source
@param position the position in adapters data source
@return the ViewType (integer). Returns {@link #FALLBACK_DELEGATE_VIEW_TYPE} in case that the
fallback adapter delegate should be used
@throws NullPointerException if no {@link AdapterDelegate} has been found that is
responsible for the given data element in data set (No {@link AdapterDelegate} for the given
ViewType)
@throws NullPointerException if items is null | [
"Must",
"be",
"called",
"from",
"{",
"@link",
"RecyclerView",
".",
"Adapter#getItemViewType",
"(",
"int",
")",
"}",
".",
"Internally",
"it",
"scans",
"all",
"the",
"registered",
"{",
"@link",
"AdapterDelegate",
"}",
"and",
"picks",
"the",
"right",
"one",
"to... | train | https://github.com/sockeqwe/AdapterDelegates/blob/d18dc609415e5d17a3354bddf4bae62440e017af/library/src/main/java/com/hannesdorfmann/adapterdelegates4/AdapterDelegatesManager.java#L214-L234 |
roboconf/roboconf-platform | core/roboconf-agent-monitoring/src/main/java/net/roboconf/agent/monitoring/internal/nagios/LiveStatusClient.java | LiveStatusClient.queryLivestatus | public String queryLivestatus( String nagiosQuery ) throws UnknownHostException, IOException {
Socket liveStatusSocket = null;
try {
this.logger.fine( "About to open a connection through Live Status..." );
liveStatusSocket = new Socket( this.host, this.port );
this.logger.fine( "A connection was established through Live Status." );
Writer osw = new OutputStreamWriter( liveStatusSocket.getOutputStream(), StandardCharsets.UTF_8 );
PrintWriter printer = new PrintWriter( osw, false );
printer.print( nagiosQuery );
printer.flush();
liveStatusSocket.shutdownOutput();
ByteArrayOutputStream os = new ByteArrayOutputStream();
Utils.copyStreamSafely( liveStatusSocket.getInputStream(), os );
String result = os.toString( "UTF-8" );
result = format( nagiosQuery, result );
return result;
} finally {
if( liveStatusSocket != null )
liveStatusSocket.close();
this.logger.fine( "The Live Status connection was closed." );
}
} | java | public String queryLivestatus( String nagiosQuery ) throws UnknownHostException, IOException {
Socket liveStatusSocket = null;
try {
this.logger.fine( "About to open a connection through Live Status..." );
liveStatusSocket = new Socket( this.host, this.port );
this.logger.fine( "A connection was established through Live Status." );
Writer osw = new OutputStreamWriter( liveStatusSocket.getOutputStream(), StandardCharsets.UTF_8 );
PrintWriter printer = new PrintWriter( osw, false );
printer.print( nagiosQuery );
printer.flush();
liveStatusSocket.shutdownOutput();
ByteArrayOutputStream os = new ByteArrayOutputStream();
Utils.copyStreamSafely( liveStatusSocket.getInputStream(), os );
String result = os.toString( "UTF-8" );
result = format( nagiosQuery, result );
return result;
} finally {
if( liveStatusSocket != null )
liveStatusSocket.close();
this.logger.fine( "The Live Status connection was closed." );
}
} | [
"public",
"String",
"queryLivestatus",
"(",
"String",
"nagiosQuery",
")",
"throws",
"UnknownHostException",
",",
"IOException",
"{",
"Socket",
"liveStatusSocket",
"=",
"null",
";",
"try",
"{",
"this",
".",
"logger",
".",
"fine",
"(",
"\"About to open a connection th... | Queries a live status server.
@param nagiosQuery the query to pass through a socket (not null)
@return the response
@throws UnknownHostException
@throws IOException | [
"Queries",
"a",
"live",
"status",
"server",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent-monitoring/src/main/java/net/roboconf/agent/monitoring/internal/nagios/LiveStatusClient.java#L73-L101 |
glyptodon/guacamole-client | extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/usergroup/ModeledUserGroup.java | ModeledUserGroup.putRestrictedAttributes | private void putRestrictedAttributes(Map<String, String> attributes) {
// Set disabled attribute
attributes.put(DISABLED_ATTRIBUTE_NAME, getModel().isDisabled() ? "true" : null);
} | java | private void putRestrictedAttributes(Map<String, String> attributes) {
// Set disabled attribute
attributes.put(DISABLED_ATTRIBUTE_NAME, getModel().isDisabled() ? "true" : null);
} | [
"private",
"void",
"putRestrictedAttributes",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"// Set disabled attribute",
"attributes",
".",
"put",
"(",
"DISABLED_ATTRIBUTE_NAME",
",",
"getModel",
"(",
")",
".",
"isDisabled",
"(",
")",
"?... | Stores all restricted (privileged) attributes within the given Map,
pulling the values of those attributes from the underlying user group
model. If no value is yet defined for an attribute, that attribute will
be set to null.
@param attributes
The Map to store all restricted attributes within. | [
"Stores",
"all",
"restricted",
"(",
"privileged",
")",
"attributes",
"within",
"the",
"given",
"Map",
"pulling",
"the",
"values",
"of",
"those",
"attributes",
"from",
"the",
"underlying",
"user",
"group",
"model",
".",
"If",
"no",
"value",
"is",
"yet",
"defi... | train | https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/usergroup/ModeledUserGroup.java#L134-L139 |
square/pollexor | src/main/java/com/squareup/pollexor/ThumborUrlBuilder.java | ThumborUrlBuilder.roundCorner | public static String roundCorner(int radiusInner, int radiusOuter, int color) {
if (radiusInner < 1) {
throw new IllegalArgumentException("Radius must be greater than zero.");
}
if (radiusOuter < 0) {
throw new IllegalArgumentException("Outer radius must be greater than or equal to zero.");
}
StringBuilder builder = new StringBuilder(FILTER_ROUND_CORNER).append("(").append(radiusInner);
if (radiusOuter > 0) {
builder.append("|").append(radiusOuter);
}
final int r = (color & 0xFF0000) >>> 16;
final int g = (color & 0xFF00) >>> 8;
final int b = color & 0xFF;
return builder.append(",") //
.append(r).append(",") //
.append(g).append(",") //
.append(b).append(")") //
.toString();
} | java | public static String roundCorner(int radiusInner, int radiusOuter, int color) {
if (radiusInner < 1) {
throw new IllegalArgumentException("Radius must be greater than zero.");
}
if (radiusOuter < 0) {
throw new IllegalArgumentException("Outer radius must be greater than or equal to zero.");
}
StringBuilder builder = new StringBuilder(FILTER_ROUND_CORNER).append("(").append(radiusInner);
if (radiusOuter > 0) {
builder.append("|").append(radiusOuter);
}
final int r = (color & 0xFF0000) >>> 16;
final int g = (color & 0xFF00) >>> 8;
final int b = color & 0xFF;
return builder.append(",") //
.append(r).append(",") //
.append(g).append(",") //
.append(b).append(")") //
.toString();
} | [
"public",
"static",
"String",
"roundCorner",
"(",
"int",
"radiusInner",
",",
"int",
"radiusOuter",
",",
"int",
"color",
")",
"{",
"if",
"(",
"radiusInner",
"<",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Radius must be greater than zero.\""... | This filter adds rounded corners to the image using the specified color as the background.
@param radiusInner amount of pixels to use as radius.
@param radiusOuter specifies the second value for the ellipse used for the radius. Use 0 for
no value.
@param color fill color for clipped region. | [
"This",
"filter",
"adds",
"rounded",
"corners",
"to",
"the",
"image",
"using",
"the",
"specified",
"color",
"as",
"the",
"background",
"."
] | train | https://github.com/square/pollexor/blob/b72430d2799f617f7fcbb2d3ceb27810c9c6d38f/src/main/java/com/squareup/pollexor/ThumborUrlBuilder.java#L601-L620 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/RouteFiltersInner.java | RouteFiltersInner.beginUpdateAsync | public Observable<RouteFilterInner> beginUpdateAsync(String resourceGroupName, String routeFilterName, PatchRouteFilter routeFilterParameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, routeFilterName, routeFilterParameters).map(new Func1<ServiceResponse<RouteFilterInner>, RouteFilterInner>() {
@Override
public RouteFilterInner call(ServiceResponse<RouteFilterInner> response) {
return response.body();
}
});
} | java | public Observable<RouteFilterInner> beginUpdateAsync(String resourceGroupName, String routeFilterName, PatchRouteFilter routeFilterParameters) {
return beginUpdateWithServiceResponseAsync(resourceGroupName, routeFilterName, routeFilterParameters).map(new Func1<ServiceResponse<RouteFilterInner>, RouteFilterInner>() {
@Override
public RouteFilterInner call(ServiceResponse<RouteFilterInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RouteFilterInner",
">",
"beginUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"routeFilterName",
",",
"PatchRouteFilter",
"routeFilterParameters",
")",
"{",
"return",
"beginUpdateWithServiceResponseAsync",
"(",
"resourceGroupName... | Updates a route filter in a specified resource group.
@param resourceGroupName The name of the resource group.
@param routeFilterName The name of the route filter.
@param routeFilterParameters Parameters supplied to the update route filter operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RouteFilterInner object | [
"Updates",
"a",
"route",
"filter",
"in",
"a",
"specified",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/RouteFiltersInner.java#L713-L720 |
mediathekview/MServer | src/main/java/mServer/tool/MserverDatumZeit.java | MserverDatumZeit.formatDate | public static String formatDate(String dateValue, FastDateFormat sdf) {
try {
return FDF_OUT_DAY.format(sdf.parse(dateValue));
} catch (ParseException ex) {
LOG.debug(String.format("Fehler beim Parsen des Datums %s: %s", dateValue, ex.getMessage()));
}
return "";
} | java | public static String formatDate(String dateValue, FastDateFormat sdf) {
try {
return FDF_OUT_DAY.format(sdf.parse(dateValue));
} catch (ParseException ex) {
LOG.debug(String.format("Fehler beim Parsen des Datums %s: %s", dateValue, ex.getMessage()));
}
return "";
} | [
"public",
"static",
"String",
"formatDate",
"(",
"String",
"dateValue",
",",
"FastDateFormat",
"sdf",
")",
"{",
"try",
"{",
"return",
"FDF_OUT_DAY",
".",
"format",
"(",
"sdf",
".",
"parse",
"(",
"dateValue",
")",
")",
";",
"}",
"catch",
"(",
"ParseExceptio... | formats a date/datetime string to the date format used in DatenFilm
@param dateValue the date/datetime value
@param sdf the format of dateValue
@return the formatted date string | [
"formats",
"a",
"date",
"/",
"datetime",
"string",
"to",
"the",
"date",
"format",
"used",
"in",
"DatenFilm"
] | train | https://github.com/mediathekview/MServer/blob/ba8d03e6a1a303db3807a1327f553f1decd30388/src/main/java/mServer/tool/MserverDatumZeit.java#L82-L90 |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.getSystemDefault | @Pure
public static String getSystemDefault(TrafficDirection direction, int valueIndex) {
// Values from the IGN-BDCarto standard
switch (direction) {
case DOUBLE_WAY:
switch (valueIndex) {
case 0:
return DEFAULT_DOUBLE_WAY_TRAFFIC_DIRECTION_0;
case 1:
return DEFAULT_DOUBLE_WAY_TRAFFIC_DIRECTION_1;
default:
throw new IndexOutOfBoundsException();
}
case NO_ENTRY:
switch (valueIndex) {
case 0:
return DEFAULT_NO_ENTRY_TRAFFIC_DIRECTION_0;
case 1:
return DEFAULT_NO_ENTRY_TRAFFIC_DIRECTION_1;
default:
throw new IndexOutOfBoundsException();
}
case NO_WAY:
switch (valueIndex) {
case 0:
return DEFAULT_NO_WAY_TRAFFIC_DIRECTION_0;
case 1:
return DEFAULT_NO_WAY_TRAFFIC_DIRECTION_1;
default:
throw new IndexOutOfBoundsException();
}
case ONE_WAY:
switch (valueIndex) {
case 0:
return DEFAULT_ONE_WAY_TRAFFIC_DIRECTION_0;
case 1:
return DEFAULT_ONE_WAY_TRAFFIC_DIRECTION_1;
default:
throw new IndexOutOfBoundsException();
}
default:
}
throw new IllegalArgumentException();
} | java | @Pure
public static String getSystemDefault(TrafficDirection direction, int valueIndex) {
// Values from the IGN-BDCarto standard
switch (direction) {
case DOUBLE_WAY:
switch (valueIndex) {
case 0:
return DEFAULT_DOUBLE_WAY_TRAFFIC_DIRECTION_0;
case 1:
return DEFAULT_DOUBLE_WAY_TRAFFIC_DIRECTION_1;
default:
throw new IndexOutOfBoundsException();
}
case NO_ENTRY:
switch (valueIndex) {
case 0:
return DEFAULT_NO_ENTRY_TRAFFIC_DIRECTION_0;
case 1:
return DEFAULT_NO_ENTRY_TRAFFIC_DIRECTION_1;
default:
throw new IndexOutOfBoundsException();
}
case NO_WAY:
switch (valueIndex) {
case 0:
return DEFAULT_NO_WAY_TRAFFIC_DIRECTION_0;
case 1:
return DEFAULT_NO_WAY_TRAFFIC_DIRECTION_1;
default:
throw new IndexOutOfBoundsException();
}
case ONE_WAY:
switch (valueIndex) {
case 0:
return DEFAULT_ONE_WAY_TRAFFIC_DIRECTION_0;
case 1:
return DEFAULT_ONE_WAY_TRAFFIC_DIRECTION_1;
default:
throw new IndexOutOfBoundsException();
}
default:
}
throw new IllegalArgumentException();
} | [
"@",
"Pure",
"public",
"static",
"String",
"getSystemDefault",
"(",
"TrafficDirection",
"direction",
",",
"int",
"valueIndex",
")",
"{",
"// Values from the IGN-BDCarto standard",
"switch",
"(",
"direction",
")",
"{",
"case",
"DOUBLE_WAY",
":",
"switch",
"(",
"value... | Replies the system default string-value for the traffic direction, at the
given index in the list of system default values.
@param direction is the direction for which the string value should be replied
@param valueIndex is the position of the string-value.
@return the string-value at the given position, never <code>null</code>
@throws IndexOutOfBoundsException is the given index is wrong.
@throws IllegalArgumentException is the given direction is wrong. | [
"Replies",
"the",
"system",
"default",
"string",
"-",
"value",
"for",
"the",
"traffic",
"direction",
"at",
"the",
"given",
"index",
"in",
"the",
"list",
"of",
"system",
"default",
"values",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L441-L484 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/file/PathOperations.java | PathOperations.renameFile | @Nonnull
public static FileIOError renameFile (@Nonnull final Path aSourceFile, @Nonnull final Path aTargetFile)
{
ValueEnforcer.notNull (aSourceFile, "SourceFile");
ValueEnforcer.notNull (aTargetFile, "TargetFile");
final Path aRealSourceFile = _getUnifiedPath (aSourceFile);
final Path aRealTargetFile = _getUnifiedPath (aTargetFile);
// Does the source file exist?
if (!aRealSourceFile.toFile ().isFile ())
return EFileIOErrorCode.SOURCE_DOES_NOT_EXIST.getAsIOError (EFileIOOperation.RENAME_FILE, aRealSourceFile);
// Are source and target different?
if (EqualsHelper.equals (aRealSourceFile, aRealTargetFile))
return EFileIOErrorCode.SOURCE_EQUALS_TARGET.getAsIOError (EFileIOOperation.RENAME_FILE, aRealSourceFile);
// Does the target file already exist?
if (aRealTargetFile.toFile ().exists ())
return EFileIOErrorCode.TARGET_ALREADY_EXISTS.getAsIOError (EFileIOOperation.RENAME_FILE, aRealTargetFile);
// Is the source parent directory writable?
final Path aSourceParentDir = aRealSourceFile.getParent ();
if (aSourceParentDir != null && !Files.isWritable (aSourceParentDir))
return EFileIOErrorCode.SOURCE_PARENT_NOT_WRITABLE.getAsIOError (EFileIOOperation.RENAME_FILE, aRealSourceFile);
// Is the target parent directory writable?
final Path aTargetParentDir = aRealTargetFile.getParent ();
if (aTargetParentDir != null && aTargetParentDir.toFile ().exists () && !Files.isWritable (aTargetParentDir))
return EFileIOErrorCode.TARGET_PARENT_NOT_WRITABLE.getAsIOError (EFileIOOperation.RENAME_FILE, aRealTargetFile);
// Ensure parent of target directory is present
PathHelper.ensureParentDirectoryIsPresent (aRealTargetFile);
return _perform (EFileIOOperation.RENAME_FILE, PathOperations::_atomicMove, aRealSourceFile, aRealTargetFile);
} | java | @Nonnull
public static FileIOError renameFile (@Nonnull final Path aSourceFile, @Nonnull final Path aTargetFile)
{
ValueEnforcer.notNull (aSourceFile, "SourceFile");
ValueEnforcer.notNull (aTargetFile, "TargetFile");
final Path aRealSourceFile = _getUnifiedPath (aSourceFile);
final Path aRealTargetFile = _getUnifiedPath (aTargetFile);
// Does the source file exist?
if (!aRealSourceFile.toFile ().isFile ())
return EFileIOErrorCode.SOURCE_DOES_NOT_EXIST.getAsIOError (EFileIOOperation.RENAME_FILE, aRealSourceFile);
// Are source and target different?
if (EqualsHelper.equals (aRealSourceFile, aRealTargetFile))
return EFileIOErrorCode.SOURCE_EQUALS_TARGET.getAsIOError (EFileIOOperation.RENAME_FILE, aRealSourceFile);
// Does the target file already exist?
if (aRealTargetFile.toFile ().exists ())
return EFileIOErrorCode.TARGET_ALREADY_EXISTS.getAsIOError (EFileIOOperation.RENAME_FILE, aRealTargetFile);
// Is the source parent directory writable?
final Path aSourceParentDir = aRealSourceFile.getParent ();
if (aSourceParentDir != null && !Files.isWritable (aSourceParentDir))
return EFileIOErrorCode.SOURCE_PARENT_NOT_WRITABLE.getAsIOError (EFileIOOperation.RENAME_FILE, aRealSourceFile);
// Is the target parent directory writable?
final Path aTargetParentDir = aRealTargetFile.getParent ();
if (aTargetParentDir != null && aTargetParentDir.toFile ().exists () && !Files.isWritable (aTargetParentDir))
return EFileIOErrorCode.TARGET_PARENT_NOT_WRITABLE.getAsIOError (EFileIOOperation.RENAME_FILE, aRealTargetFile);
// Ensure parent of target directory is present
PathHelper.ensureParentDirectoryIsPresent (aRealTargetFile);
return _perform (EFileIOOperation.RENAME_FILE, PathOperations::_atomicMove, aRealSourceFile, aRealTargetFile);
} | [
"@",
"Nonnull",
"public",
"static",
"FileIOError",
"renameFile",
"(",
"@",
"Nonnull",
"final",
"Path",
"aSourceFile",
",",
"@",
"Nonnull",
"final",
"Path",
"aTargetFile",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aSourceFile",
",",
"\"SourceFile\"",
")",
... | Rename a file.
@param aSourceFile
The original file name. May not be <code>null</code>.
@param aTargetFile
The destination file name. May not be <code>null</code>.
@return A non-<code>null</code> error code. | [
"Rename",
"a",
"file",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/file/PathOperations.java#L430-L465 |
TheHortonMachine/hortonmachine | gears/src/main/java/oms3/io/DataIO.java | DataIO.createTableModel | public static TableModel createTableModel(final CSTable src) {
final List<String[]> rows = new ArrayList<String[]>();
for (String[] row : src.rows()) {
rows.add(row);
}
return new TableModel() {
@Override
public int getColumnCount() {
return src.getColumnCount();
}
@Override
public String getColumnName(int column) {
return src.getColumnName(column);
}
@Override
public int getRowCount() {
return rows.size();
}
@Override
public Class<?> getColumnClass(int columnIndex) {
return String.class;
}
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
return false;
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
return rows.get(rowIndex)[columnIndex];
}
@Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
// rows.get(rowIndex)[columnIndex] = (String) aValue;
}
@Override
public void addTableModelListener(TableModelListener l) {
}
@Override
public void removeTableModelListener(TableModelListener l) {
}
};
} | java | public static TableModel createTableModel(final CSTable src) {
final List<String[]> rows = new ArrayList<String[]>();
for (String[] row : src.rows()) {
rows.add(row);
}
return new TableModel() {
@Override
public int getColumnCount() {
return src.getColumnCount();
}
@Override
public String getColumnName(int column) {
return src.getColumnName(column);
}
@Override
public int getRowCount() {
return rows.size();
}
@Override
public Class<?> getColumnClass(int columnIndex) {
return String.class;
}
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
return false;
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
return rows.get(rowIndex)[columnIndex];
}
@Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
// rows.get(rowIndex)[columnIndex] = (String) aValue;
}
@Override
public void addTableModelListener(TableModelListener l) {
}
@Override
public void removeTableModelListener(TableModelListener l) {
}
};
} | [
"public",
"static",
"TableModel",
"createTableModel",
"(",
"final",
"CSTable",
"src",
")",
"{",
"final",
"List",
"<",
"String",
"[",
"]",
">",
"rows",
"=",
"new",
"ArrayList",
"<",
"String",
"[",
"]",
">",
"(",
")",
";",
"for",
"(",
"String",
"[",
"]... | Create a r/o data tablemodel
@param src
@return a table model to the CSTable | [
"Create",
"a",
"r",
"/",
"o",
"data",
"tablemodel"
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/io/DataIO.java#L497-L548 |
hypercube1024/firefly | firefly-common/src/main/java/com/firefly/utils/lang/Loader.java | Loader.loadClass | @SuppressWarnings("rawtypes")
public static Class loadClass(Class loaderClass, String name) throws ClassNotFoundException {
if (loaderClass != null && loaderClass.getClassLoader() != null)
return loaderClass.getClassLoader().loadClass(name);
return loadClass(name);
} | java | @SuppressWarnings("rawtypes")
public static Class loadClass(Class loaderClass, String name) throws ClassNotFoundException {
if (loaderClass != null && loaderClass.getClassLoader() != null)
return loaderClass.getClassLoader().loadClass(name);
return loadClass(name);
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"static",
"Class",
"loadClass",
"(",
"Class",
"loaderClass",
",",
"String",
"name",
")",
"throws",
"ClassNotFoundException",
"{",
"if",
"(",
"loaderClass",
"!=",
"null",
"&&",
"loaderClass",
".",
"getC... | Load a class. Load a class from the same classloader as the passed
<code>loadClass</code>, or if none then use {@link #loadClass(String)}
@param loaderClass a similar class, belong in the same classloader of the desired
class to load
@param name the name of the new class to load
@return Class
@throws ClassNotFoundException if not able to find the class | [
"Load",
"a",
"class",
".",
"Load",
"a",
"class",
"from",
"the",
"same",
"classloader",
"as",
"the",
"passed",
"<code",
">",
"loadClass<",
"/",
"code",
">",
"or",
"if",
"none",
"then",
"use",
"{",
"@link",
"#loadClass",
"(",
"String",
")",
"}"
] | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/lang/Loader.java#L76-L81 |
FilteredPush/event_date_qc | src/main/java/org/filteredpush/qc/date/DateUtils.java | DateUtils.eventsAreSameInterval | public static Boolean eventsAreSameInterval(String eventDate, String secondEventDate) {
boolean result = false;
try {
Interval interval = null;
Interval secondInterval = null;
interval = DateUtils.extractDateInterval(eventDate);
secondInterval = DateUtils.extractDateInterval(secondEventDate);
logger.debug(interval.toString());
logger.debug(secondInterval.toString());
result = interval.equals(secondInterval);
} catch (IllegalFieldValueException ex) {
// field format error, can't parse as date, log at debug level.
logger.debug(ex.getMessage());
} catch (Exception e) {
logger.error(e.getMessage());
}
return result;
} | java | public static Boolean eventsAreSameInterval(String eventDate, String secondEventDate) {
boolean result = false;
try {
Interval interval = null;
Interval secondInterval = null;
interval = DateUtils.extractDateInterval(eventDate);
secondInterval = DateUtils.extractDateInterval(secondEventDate);
logger.debug(interval.toString());
logger.debug(secondInterval.toString());
result = interval.equals(secondInterval);
} catch (IllegalFieldValueException ex) {
// field format error, can't parse as date, log at debug level.
logger.debug(ex.getMessage());
} catch (Exception e) {
logger.error(e.getMessage());
}
return result;
} | [
"public",
"static",
"Boolean",
"eventsAreSameInterval",
"(",
"String",
"eventDate",
",",
"String",
"secondEventDate",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"try",
"{",
"Interval",
"interval",
"=",
"null",
";",
"Interval",
"secondInterval",
"=",
"null... | Compare two strings that should represent event dates (ingoring time, if not a date range)
@param eventDate to compare with second event date
@param secondEventDate to compare with
@return true if the two provided event dates represent the same interval. | [
"Compare",
"two",
"strings",
"that",
"should",
"represent",
"event",
"dates",
"(",
"ingoring",
"time",
"if",
"not",
"a",
"date",
"range",
")"
] | train | https://github.com/FilteredPush/event_date_qc/blob/52957a71b94b00b767e37924f976e2c7e8868ff3/src/main/java/org/filteredpush/qc/date/DateUtils.java#L2608-L2625 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.