repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
opencb/biodata | biodata-tools/src/main/java/org/opencb/biodata/tools/variant/LeftAligner.java | LeftAligner.isAlleleCorrect | private boolean isAlleleCorrect(String allele, boolean acceptAmbiguousBases) {
if (StringUtils.isNotEmpty(allele)) {
for (char base : allele.toCharArray()) {
if (!isValidBase(base, acceptAmbiguousBases)) {
return false;
}
}
}
return true;
} | java | private boolean isAlleleCorrect(String allele, boolean acceptAmbiguousBases) {
if (StringUtils.isNotEmpty(allele)) {
for (char base : allele.toCharArray()) {
if (!isValidBase(base, acceptAmbiguousBases)) {
return false;
}
}
}
return true;
} | [
"private",
"boolean",
"isAlleleCorrect",
"(",
"String",
"allele",
",",
"boolean",
"acceptAmbiguousBases",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"allele",
")",
")",
"{",
"for",
"(",
"char",
"base",
":",
"allele",
".",
"toCharArray",
"(",... | Checks if all bases in the allele are valid bases.
@param allele the reference bases
@return | [
"Checks",
"if",
"all",
"bases",
"in",
"the",
"allele",
"are",
"valid",
"bases",
"."
] | train | https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/LeftAligner.java#L148-L157 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/runtime/AbstractEJBRuntime.java | AbstractEJBRuntime.fireMetaDataCreatedAndStartBean | private EJSHome fireMetaDataCreatedAndStartBean(BeanMetaData bmd) // d648522
throws ContainerException {
if (!bmd.isManagedBean()) // F743-34301.1
{
try {
// Fire the ComponentMetaData event to the listeners
// (ie. we have loaded a new bean folks... )
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "startBean: Fire Component Metadata created event to listeners for: " + bmd.j2eeName);
bmd.ivMetaDataDestroyRequired = true; //d505055
fireMetaDataCreated(bmd);
} catch (Throwable t) //197547
{
FFDCFilter.processException(t, CLASS_NAME + "startBean", "445", this);
throw new ContainerException("Failed to start " + bmd.j2eeName, t);
}
}
return startBean(bmd); // d739043
} | java | private EJSHome fireMetaDataCreatedAndStartBean(BeanMetaData bmd) // d648522
throws ContainerException {
if (!bmd.isManagedBean()) // F743-34301.1
{
try {
// Fire the ComponentMetaData event to the listeners
// (ie. we have loaded a new bean folks... )
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "startBean: Fire Component Metadata created event to listeners for: " + bmd.j2eeName);
bmd.ivMetaDataDestroyRequired = true; //d505055
fireMetaDataCreated(bmd);
} catch (Throwable t) //197547
{
FFDCFilter.processException(t, CLASS_NAME + "startBean", "445", this);
throw new ContainerException("Failed to start " + bmd.j2eeName, t);
}
}
return startBean(bmd); // d739043
} | [
"private",
"EJSHome",
"fireMetaDataCreatedAndStartBean",
"(",
"BeanMetaData",
"bmd",
")",
"// d648522",
"throws",
"ContainerException",
"{",
"if",
"(",
"!",
"bmd",
".",
"isManagedBean",
"(",
")",
")",
"// F743-34301.1",
"{",
"try",
"{",
"// Fire the ComponentMetaData ... | Starts the bean by creating a home instance via the container. When this
method completes successfully, bmd.homeRecord.homeInternal will be set to
indicate that this home is started; this method must not be called if
this field is already set. The context class loader must be the bean
class loader when calling this method.
@param bmd the bean metadata
@return the home | [
"Starts",
"the",
"bean",
"by",
"creating",
"a",
"home",
"instance",
"via",
"the",
"container",
".",
"When",
"this",
"method",
"completes",
"successfully",
"bmd",
".",
"homeRecord",
".",
"homeInternal",
"will",
"be",
"set",
"to",
"indicate",
"that",
"this",
"... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ws/ejbcontainer/runtime/AbstractEJBRuntime.java#L1541-L1561 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/TimeZone.java | TimeZone.getDisplayName | public String getDisplayName(boolean daylightTime, int style, Locale locale) {
if (style != SHORT && style != LONG) {
throw new IllegalArgumentException("Illegal style: " + style);
}
String[][] zoneStrings = TimeZoneNames.getZoneStrings(locale);
String result = TimeZoneNames.getDisplayName(zoneStrings, getID(), daylightTime, style);
if (result != null) {
return result;
}
// If we get here, it's because icu4c has nothing for us. Most commonly, this is in the
// case of short names. For Pacific/Fiji, for example, icu4c has nothing better to offer
// than "GMT+12:00". Why do we re-do this work ourselves? Because we have up-to-date
// time zone transition data, which icu4c _doesn't_ use --- it uses its own baked-in copy,
// which only gets updated when we update icu4c. http://b/7955614 and http://b/8026776.
// TODO: should we generate these once, in TimeZoneNames.getDisplayName? Revisit when we
// upgrade to icu4c 50 and rewrite the underlying native code. See also the
// "element[j] != null" check in SimpleDateFormat.parseTimeZone, and the extra work in
// DateFormatSymbols.getZoneStrings.
int offsetMillis = getRawOffset();
if (daylightTime) {
offsetMillis += getDSTSavings();
}
return createGmtOffsetString(true /* includeGmt */, true /* includeMinuteSeparator */,
offsetMillis);
} | java | public String getDisplayName(boolean daylightTime, int style, Locale locale) {
if (style != SHORT && style != LONG) {
throw new IllegalArgumentException("Illegal style: " + style);
}
String[][] zoneStrings = TimeZoneNames.getZoneStrings(locale);
String result = TimeZoneNames.getDisplayName(zoneStrings, getID(), daylightTime, style);
if (result != null) {
return result;
}
// If we get here, it's because icu4c has nothing for us. Most commonly, this is in the
// case of short names. For Pacific/Fiji, for example, icu4c has nothing better to offer
// than "GMT+12:00". Why do we re-do this work ourselves? Because we have up-to-date
// time zone transition data, which icu4c _doesn't_ use --- it uses its own baked-in copy,
// which only gets updated when we update icu4c. http://b/7955614 and http://b/8026776.
// TODO: should we generate these once, in TimeZoneNames.getDisplayName? Revisit when we
// upgrade to icu4c 50 and rewrite the underlying native code. See also the
// "element[j] != null" check in SimpleDateFormat.parseTimeZone, and the extra work in
// DateFormatSymbols.getZoneStrings.
int offsetMillis = getRawOffset();
if (daylightTime) {
offsetMillis += getDSTSavings();
}
return createGmtOffsetString(true /* includeGmt */, true /* includeMinuteSeparator */,
offsetMillis);
} | [
"public",
"String",
"getDisplayName",
"(",
"boolean",
"daylightTime",
",",
"int",
"style",
",",
"Locale",
"locale",
")",
"{",
"if",
"(",
"style",
"!=",
"SHORT",
"&&",
"style",
"!=",
"LONG",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Illega... | Returns the {@link #SHORT short} or {@link #LONG long} name of this time
zone with either standard or daylight time, as written in {@code locale}.
If the name is not available, the result is in the format
{@code GMT[+-]hh:mm}.
@param daylightTime true for daylight time, false for standard time.
@param style either {@link TimeZone#LONG} or {@link TimeZone#SHORT}.
@param locale the display locale. | [
"Returns",
"the",
"{",
"@link",
"#SHORT",
"short",
"}",
"or",
"{",
"@link",
"#LONG",
"long",
"}",
"name",
"of",
"this",
"time",
"zone",
"with",
"either",
"standard",
"or",
"daylight",
"time",
"as",
"written",
"in",
"{",
"@code",
"locale",
"}",
".",
"If... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/TimeZone.java#L384-L411 |
ksclarke/freelib-utils | src/main/java/info/freelibrary/util/I18nObject.java | I18nObject.getI18n | protected String getI18n(final String aMessageKey, final File... aFileArray) {
final String[] fileNames = new String[aFileArray.length];
for (int index = 0; index < fileNames.length; index++) {
fileNames[index] = aFileArray[index].getAbsolutePath();
}
return StringUtils.normalizeWS(myBundle.get(aMessageKey, fileNames));
} | java | protected String getI18n(final String aMessageKey, final File... aFileArray) {
final String[] fileNames = new String[aFileArray.length];
for (int index = 0; index < fileNames.length; index++) {
fileNames[index] = aFileArray[index].getAbsolutePath();
}
return StringUtils.normalizeWS(myBundle.get(aMessageKey, fileNames));
} | [
"protected",
"String",
"getI18n",
"(",
"final",
"String",
"aMessageKey",
",",
"final",
"File",
"...",
"aFileArray",
")",
"{",
"final",
"String",
"[",
"]",
"fileNames",
"=",
"new",
"String",
"[",
"aFileArray",
".",
"length",
"]",
";",
"for",
"(",
"int",
"... | Gets the internationalized value for the supplied message key, using a file array as additional information.
@param aMessageKey A message key
@param aFileArray Additional details for the message
@return The internationalized message | [
"Gets",
"the",
"internationalized",
"value",
"for",
"the",
"supplied",
"message",
"key",
"using",
"a",
"file",
"array",
"as",
"additional",
"information",
"."
] | train | https://github.com/ksclarke/freelib-utils/blob/54e822ae4c11b3d74793fd82a1a535ffafffaf45/src/main/java/info/freelibrary/util/I18nObject.java#L123-L131 |
b3dgs/lionengine | lionengine-network/src/main/java/com/b3dgs/lionengine/network/message/NetworkMessageEntity.java | NetworkMessageEntity.addAction | public void addAction(M element, int value)
{
actions.put(element, Integer.valueOf(value));
} | java | public void addAction(M element, int value)
{
actions.put(element, Integer.valueOf(value));
} | [
"public",
"void",
"addAction",
"(",
"M",
"element",
",",
"int",
"value",
")",
"{",
"actions",
".",
"put",
"(",
"element",
",",
"Integer",
".",
"valueOf",
"(",
"value",
")",
")",
";",
"}"
] | Add an action.
@param element The action type.
@param value The action value. | [
"Add",
"an",
"action",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-network/src/main/java/com/b3dgs/lionengine/network/message/NetworkMessageEntity.java#L155-L158 |
agmip/ace-core | src/main/java/org/agmip/ace/AceComponent.java | AceComponent.getValueOr | public String getValueOr(String key, String alternateValue)
throws IOException {
String value = this.getValue(key);
if (value == null) {
return alternateValue;
} else {
return value;
}
} | java | public String getValueOr(String key, String alternateValue)
throws IOException {
String value = this.getValue(key);
if (value == null) {
return alternateValue;
} else {
return value;
}
} | [
"public",
"String",
"getValueOr",
"(",
"String",
"key",
",",
"String",
"alternateValue",
")",
"throws",
"IOException",
"{",
"String",
"value",
"=",
"this",
".",
"getValue",
"(",
"key",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"alte... | Return a value from the component, or return a default value.
<p>
<strong>NOTE:</strong>Use this for values only, not to retrieve
subcomponents. Use class specific methods to retrieve subcompnents.
<p>
Calls {@link #getValue} on the current component. If the value
is {@code null}, return {@code alternateValue}.
@param key Key to look up in the component.
@param alternateValue default value is key is not found in component.
@return a String value for this component.
@throws IOException if there is an I/O error | [
"Return",
"a",
"value",
"from",
"the",
"component",
"or",
"return",
"a",
"default",
"value",
".",
"<p",
">",
"<strong",
">",
"NOTE",
":",
"<",
"/",
"strong",
">",
"Use",
"this",
"for",
"values",
"only",
"not",
"to",
"retrieve",
"subcomponents",
".",
"U... | train | https://github.com/agmip/ace-core/blob/51957e79b4567d0083c52d0720f4a268c3a02f44/src/main/java/org/agmip/ace/AceComponent.java#L128-L136 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/CharsetUtil.java | CharsetUtil.convert | public static File convert(File file, Charset srcCharset, Charset destCharset) {
final String str = FileUtil.readString(file, srcCharset);
return FileUtil.writeString(str, file, destCharset);
} | java | public static File convert(File file, Charset srcCharset, Charset destCharset) {
final String str = FileUtil.readString(file, srcCharset);
return FileUtil.writeString(str, file, destCharset);
} | [
"public",
"static",
"File",
"convert",
"(",
"File",
"file",
",",
"Charset",
"srcCharset",
",",
"Charset",
"destCharset",
")",
"{",
"final",
"String",
"str",
"=",
"FileUtil",
".",
"readString",
"(",
"file",
",",
"srcCharset",
")",
";",
"return",
"FileUtil",
... | 转换文件编码<br>
此方法用于转换文件编码,读取的文件实际编码必须与指定的srcCharset编码一致,否则导致乱码
@param file 文件
@param srcCharset 原文件的编码,必须与文件内容的编码保持一致
@param destCharset 转码后的编码
@return 被转换编码的文件
@since 3.1.0 | [
"转换文件编码<br",
">",
"此方法用于转换文件编码,读取的文件实际编码必须与指定的srcCharset编码一致,否则导致乱码"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/CharsetUtil.java#L92-L95 |
lessthanoptimal/BoofCV | main/boofcv-ip/src/main/java/boofcv/core/encoding/ConvertYV12.java | ConvertYV12.yu12ToGray | public static GrayU8 yu12ToGray(byte[] data , int width , int height , GrayU8 output ) {
if( output != null ) {
if( output.width != width || output.height != height )
throw new IllegalArgumentException("output width and height must be "+width+" "+height);
} else {
output = new GrayU8(width,height);
}
if(BoofConcurrency.USE_CONCURRENT ) {
ImplConvertNV21_MT.nv21ToGray(data, output);
} else {
ImplConvertNV21.nv21ToGray(data, output);
}
return output;
} | java | public static GrayU8 yu12ToGray(byte[] data , int width , int height , GrayU8 output ) {
if( output != null ) {
if( output.width != width || output.height != height )
throw new IllegalArgumentException("output width and height must be "+width+" "+height);
} else {
output = new GrayU8(width,height);
}
if(BoofConcurrency.USE_CONCURRENT ) {
ImplConvertNV21_MT.nv21ToGray(data, output);
} else {
ImplConvertNV21.nv21ToGray(data, output);
}
return output;
} | [
"public",
"static",
"GrayU8",
"yu12ToGray",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"width",
",",
"int",
"height",
",",
"GrayU8",
"output",
")",
"{",
"if",
"(",
"output",
"!=",
"null",
")",
"{",
"if",
"(",
"output",
".",
"width",
"!=",
"width",
... | Converts an YV12 image into a gray scale U8 image.
@param data Input: YV12 image data
@param width Input: image width
@param height Input: image height
@param output Output: Optional storage for output image. Can be null.
@return Gray scale image | [
"Converts",
"an",
"YV12",
"image",
"into",
"a",
"gray",
"scale",
"U8",
"image",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/core/encoding/ConvertYV12.java#L110-L125 |
samskivert/samskivert | src/main/java/com/samskivert/util/Config.java | Config.getSubProperties | public void getSubProperties (String prefix, Properties target)
{
// slap a trailing dot on if necessary
if (!prefix.endsWith(".")) {
prefix = prefix + ".";
}
// build the sub-properties
for (Iterator<String> iter = keys(); iter.hasNext(); ) {
String key = iter.next();
if (!key.startsWith(prefix)) {
continue;
}
String value = getValue(key, (String)null);
if (value == null) {
continue;
}
target.put(key.substring(prefix.length()), value);
}
} | java | public void getSubProperties (String prefix, Properties target)
{
// slap a trailing dot on if necessary
if (!prefix.endsWith(".")) {
prefix = prefix + ".";
}
// build the sub-properties
for (Iterator<String> iter = keys(); iter.hasNext(); ) {
String key = iter.next();
if (!key.startsWith(prefix)) {
continue;
}
String value = getValue(key, (String)null);
if (value == null) {
continue;
}
target.put(key.substring(prefix.length()), value);
}
} | [
"public",
"void",
"getSubProperties",
"(",
"String",
"prefix",
",",
"Properties",
"target",
")",
"{",
"// slap a trailing dot on if necessary",
"if",
"(",
"!",
"prefix",
".",
"endsWith",
"(",
"\".\"",
")",
")",
"{",
"prefix",
"=",
"prefix",
"+",
"\".\"",
";",
... | Fills into the supplied properties object all configuration values that start with the
supplied prefix (plus a trailing "." which will be added if it doesn't already exist). The
keys in the sub-properties will have had the prefix stripped off. | [
"Fills",
"into",
"the",
"supplied",
"properties",
"object",
"all",
"configuration",
"values",
"that",
"start",
"with",
"the",
"supplied",
"prefix",
"(",
"plus",
"a",
"trailing",
".",
"which",
"will",
"be",
"added",
"if",
"it",
"doesn",
"t",
"already",
"exist... | train | https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/Config.java#L359-L378 |
tango-controls/JTango | server/src/main/java/org/tango/server/device/DeviceManager.java | DeviceManager.pushPipeEvent | public void pushPipeEvent(final String pipeName, final PipeValue blob) throws DevFailed {
// set attribute value
final PipeImpl pipe = DeviceImpl.getPipe(pipeName, device.getPipeList());
try {
pipe.updateValue(blob);
// push the event
EventManager.getInstance().pushPipeEvent(name, pipeName, blob);
} catch (final DevFailed e) {
EventManager.getInstance().pushPipeEvent(name, pipeName, e);
}
} | java | public void pushPipeEvent(final String pipeName, final PipeValue blob) throws DevFailed {
// set attribute value
final PipeImpl pipe = DeviceImpl.getPipe(pipeName, device.getPipeList());
try {
pipe.updateValue(blob);
// push the event
EventManager.getInstance().pushPipeEvent(name, pipeName, blob);
} catch (final DevFailed e) {
EventManager.getInstance().pushPipeEvent(name, pipeName, e);
}
} | [
"public",
"void",
"pushPipeEvent",
"(",
"final",
"String",
"pipeName",
",",
"final",
"PipeValue",
"blob",
")",
"throws",
"DevFailed",
"{",
"// set attribute value",
"final",
"PipeImpl",
"pipe",
"=",
"DeviceImpl",
".",
"getPipe",
"(",
"pipeName",
",",
"device",
"... | Push a PIPE EVENT event if some client had registered it
@param pipeName The pipe name
@param blob The pipe data
@throws DevFailed | [
"Push",
"a",
"PIPE",
"EVENT",
"event",
"if",
"some",
"client",
"had",
"registered",
"it"
] | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/device/DeviceManager.java#L307-L317 |
pawelprazak/java-extended | guava/src/main/java/com/bluecatcode/common/base/Strings.java | Strings.countToken | @SuppressWarnings("ConstantConditions")
@Beta
public static int countToken(@Nullable String target, String token) {
checkArgument(token != null && !token.isEmpty(), "Expected non-empty token, got: '%s'", token);
if (isNullOrEmpty(target)) {
return 0;
}
int count = 0;
int tokenIndex = 0;
while ((tokenIndex = target.indexOf(token, tokenIndex)) != -1) {
count++;
tokenIndex += token.length();
}
return count;
} | java | @SuppressWarnings("ConstantConditions")
@Beta
public static int countToken(@Nullable String target, String token) {
checkArgument(token != null && !token.isEmpty(), "Expected non-empty token, got: '%s'", token);
if (isNullOrEmpty(target)) {
return 0;
}
int count = 0;
int tokenIndex = 0;
while ((tokenIndex = target.indexOf(token, tokenIndex)) != -1) {
count++;
tokenIndex += token.length();
}
return count;
} | [
"@",
"SuppressWarnings",
"(",
"\"ConstantConditions\"",
")",
"@",
"Beta",
"public",
"static",
"int",
"countToken",
"(",
"@",
"Nullable",
"String",
"target",
",",
"String",
"token",
")",
"{",
"checkArgument",
"(",
"token",
"!=",
"null",
"&&",
"!",
"token",
".... | Returns the number of times the token appears in the target.
@param token Token value to be counted.
@param target Target value to count tokens in.
@return the number of tokens. | [
"Returns",
"the",
"number",
"of",
"times",
"the",
"token",
"appears",
"in",
"the",
"target",
"."
] | train | https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/guava/src/main/java/com/bluecatcode/common/base/Strings.java#L25-L41 |
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/util/POIUtils.java | POIUtils.setCellValueAsDate | public static void setCellValueAsDate(Cell cell, Date date, boolean dateStart1904) {
ArgUtils.notNull(cell, "cell");
ArgUtils.notNull(date, "date");
if(dateStart1904) {
// 1904年始まりの場合は、そのまま設定する
cell.setCellValue(date);
} else {
long timemills = date.getTime();
if(timemills <= MILLISECONDS_19000101_END) {
// 1900年1月0日の場合は、数値に変換してから設定する
// タイムゾーンを除去する
Date strip = new Date(date.getTime() + TimeZone.getDefault().getRawOffset());
double num = ExcelDateUtils.convertExcelNumber(strip, dateStart1904);
cell.setCellValue(num);
} else {
cell.setCellValue(date);
}
}
} | java | public static void setCellValueAsDate(Cell cell, Date date, boolean dateStart1904) {
ArgUtils.notNull(cell, "cell");
ArgUtils.notNull(date, "date");
if(dateStart1904) {
// 1904年始まりの場合は、そのまま設定する
cell.setCellValue(date);
} else {
long timemills = date.getTime();
if(timemills <= MILLISECONDS_19000101_END) {
// 1900年1月0日の場合は、数値に変換してから設定する
// タイムゾーンを除去する
Date strip = new Date(date.getTime() + TimeZone.getDefault().getRawOffset());
double num = ExcelDateUtils.convertExcelNumber(strip, dateStart1904);
cell.setCellValue(num);
} else {
cell.setCellValue(date);
}
}
} | [
"public",
"static",
"void",
"setCellValueAsDate",
"(",
"Cell",
"cell",
",",
"Date",
"date",
",",
"boolean",
"dateStart1904",
")",
"{",
"ArgUtils",
".",
"notNull",
"(",
"cell",
",",
"\"cell\"",
")",
";",
"ArgUtils",
".",
"notNull",
"(",
"date",
",",
"\"date... | セルに日時を設定する。
<p>1900年1月0日となる経過時間指定の場合は、POIのバグにより設定できあいため、数値として設定する。</p>
@param cell 設定するセル
@param date セルに設定する日時
@param dateStart1904 1904年始まりの設定のシートかどうか | [
"セルに日時を設定する。",
"<p",
">",
"1900年1月0日となる経過時間指定の場合は、POIのバグにより設定できあいため、数値として設定する。<",
"/",
"p",
">"
] | train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/util/POIUtils.java#L1122-L1147 |
NoraUi/NoraUi | src/main/java/com/github/noraui/application/steps/RESTSteps.java | RESTSteps.saveValueInDataOutputProvider | @Conditioned
@Et("Je sauvegarde la valeur de cette API REST '(.*)' '(.*)' '(.*)' dans '(.*)' du fournisseur de données en sortie[\\.|\\?]")
@And("I save the value of REST API '(.*)' '(.*)' '(.*)' in '(.*)' column of data output provider[\\.|\\?]")
public void saveValueInDataOutputProvider(String method, String pageKey, String uri, String targetColumn, List<GherkinStepCondition> conditions) throws TechnicalException, FailureException {
logger.debug("saveValue of REST API with method [{}].", method);
logger.debug("saveValue of REST API with pageKey [{}].", pageKey);
logger.debug("saveValue of REST API with uri [{}].", uri);
logger.debug("saveValue of REST API in targetColumn [{}].", targetColumn);
String json;
try {
json = httpService.get(Context.getUrlByPagekey(pageKey), uri);
for (final Integer line : Context.getDataInputProvider().getIndexData(Context.getCurrentScenarioData()).getIndexes()) {
Context.getDataOutputProvider().writeDataResult(targetColumn, line, json);
}
} catch (HttpServiceException e) {
new Result.Failure<>(Context.getApplicationByPagekey(pageKey), Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_CALL_API_REST), true, Context.getCallBack(Callbacks.RESTART_WEB_DRIVER));
} catch (final TechnicalException e) {
new Result.Warning<>(e.getMessage(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_WRITE_MESSAGE_IN_RESULT_FILE), targetColumn), false, 0);
}
} | java | @Conditioned
@Et("Je sauvegarde la valeur de cette API REST '(.*)' '(.*)' '(.*)' dans '(.*)' du fournisseur de données en sortie[\\.|\\?]")
@And("I save the value of REST API '(.*)' '(.*)' '(.*)' in '(.*)' column of data output provider[\\.|\\?]")
public void saveValueInDataOutputProvider(String method, String pageKey, String uri, String targetColumn, List<GherkinStepCondition> conditions) throws TechnicalException, FailureException {
logger.debug("saveValue of REST API with method [{}].", method);
logger.debug("saveValue of REST API with pageKey [{}].", pageKey);
logger.debug("saveValue of REST API with uri [{}].", uri);
logger.debug("saveValue of REST API in targetColumn [{}].", targetColumn);
String json;
try {
json = httpService.get(Context.getUrlByPagekey(pageKey), uri);
for (final Integer line : Context.getDataInputProvider().getIndexData(Context.getCurrentScenarioData()).getIndexes()) {
Context.getDataOutputProvider().writeDataResult(targetColumn, line, json);
}
} catch (HttpServiceException e) {
new Result.Failure<>(Context.getApplicationByPagekey(pageKey), Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_CALL_API_REST), true, Context.getCallBack(Callbacks.RESTART_WEB_DRIVER));
} catch (final TechnicalException e) {
new Result.Warning<>(e.getMessage(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_WRITE_MESSAGE_IN_RESULT_FILE), targetColumn), false, 0);
}
} | [
"@",
"Conditioned",
"@",
"Et",
"(",
"\"Je sauvegarde la valeur de cette API REST '(.*)' '(.*)' '(.*)' dans '(.*)' du fournisseur de données en sortie[\\\\.|\\\\?]\")",
"",
"@",
"And",
"(",
"\"I save the value of REST API '(.*)' '(.*)' '(.*)' in '(.*)' column of data output provider[\\\\.|\\\\?]\... | Save result of REST API in dataOutputProvider if all 'expected' parameters equals 'actual' parameters in conditions.
@param method
GET or POST
@param pageKey
is the key of page (example: GOOGLE_HOME)
@param uri
end of the url
@param targetColumn
Target column (in data output provider) to save retrieved value.
@param conditions
List of 'expected' values condition and 'actual' values ({@link com.github.noraui.gherkin.GherkinStepCondition}).
@throws TechnicalException
is thrown if you have a technical error (format, configuration, datas, ...) in NoraUi.
Exception with {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_EMPTY_DATA} message (no screenshot)
@throws FailureException
if the scenario encounters a functional error | [
"Save",
"result",
"of",
"REST",
"API",
"in",
"dataOutputProvider",
"if",
"all",
"expected",
"parameters",
"equals",
"actual",
"parameters",
"in",
"conditions",
"."
] | train | https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/RESTSteps.java#L98-L117 |
GerdHolz/TOVAL | src/de/invation/code/toval/graphic/diagrams/panels/ScatterChartPanel.java | ScatterChartPanel.getPointFor | protected Point getPointFor(int index) {
return new Point(getXFor(diagram.getValue(ValueDimension.X, index)), getYFor(diagram.getValue(ValueDimension.Y, index)));
} | java | protected Point getPointFor(int index) {
return new Point(getXFor(diagram.getValue(ValueDimension.X, index)), getYFor(diagram.getValue(ValueDimension.Y, index)));
} | [
"protected",
"Point",
"getPointFor",
"(",
"int",
"index",
")",
"{",
"return",
"new",
"Point",
"(",
"getXFor",
"(",
"diagram",
".",
"getValue",
"(",
"ValueDimension",
".",
"X",
",",
"index",
")",
")",
",",
"getYFor",
"(",
"diagram",
".",
"getValue",
"(",
... | Determines the point coordinates for a given value-vector on the base of the maintained dimensions.<br>
Given two dimensions X and Y with values x1,...,xn and y1,...,yn this method just returns a point
P(xi,yi) which matches the desired behavior of a standard 2-dimensional diagrams such as graph-plots.<br>
For changing the way these points are determined it is recommended to override the methods {@link #getXFor(Number)} and {@link #getXFor(Number)} rather than this method,
since it simply combines the values of these two methods.
@param index Index for values within the maintained value lists for different dimensions
@return Point determined on the basis of maintained values
@see #getXFor(Number)
@see #getYFor(Number) | [
"Determines",
"the",
"point",
"coordinates",
"for",
"a",
"given",
"value",
"-",
"vector",
"on",
"the",
"base",
"of",
"the",
"maintained",
"dimensions",
".",
"<br",
">",
"Given",
"two",
"dimensions",
"X",
"and",
"Y",
"with",
"values",
"x1",
"...",
"xn",
"... | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/graphic/diagrams/panels/ScatterChartPanel.java#L428-L430 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.jwtsso_fat/fat/src/com/ibm/ws/security/jwtsso/fat/utils/CommonExpectations.java | CommonExpectations.successfullyReachedProtectedResourceWithJwtCookie | public static Expectations successfullyReachedProtectedResourceWithJwtCookie(String testAction, String protectedUrl, String username, String issuerRegex) {
Expectations expectations = new Expectations();
expectations.addExpectations(successfullyReachedUrl(testAction, protectedUrl));
expectations.addExpectations(getResponseTextExpectationsForJwtCookie(testAction, JwtFatConstants.JWT_COOKIE_NAME, username));
expectations.addExpectations(getJwtPrincipalExpectations(testAction, username, issuerRegex));
return expectations;
} | java | public static Expectations successfullyReachedProtectedResourceWithJwtCookie(String testAction, String protectedUrl, String username, String issuerRegex) {
Expectations expectations = new Expectations();
expectations.addExpectations(successfullyReachedUrl(testAction, protectedUrl));
expectations.addExpectations(getResponseTextExpectationsForJwtCookie(testAction, JwtFatConstants.JWT_COOKIE_NAME, username));
expectations.addExpectations(getJwtPrincipalExpectations(testAction, username, issuerRegex));
return expectations;
} | [
"public",
"static",
"Expectations",
"successfullyReachedProtectedResourceWithJwtCookie",
"(",
"String",
"testAction",
",",
"String",
"protectedUrl",
",",
"String",
"username",
",",
"String",
"issuerRegex",
")",
"{",
"Expectations",
"expectations",
"=",
"new",
"Expectation... | Sets expectations that will check:
<ol>
<li>Successfully reached the specified URL
<li>Response text includes JWT cookie and principal information
</ol> | [
"Sets",
"expectations",
"that",
"will",
"check",
":",
"<ol",
">",
"<li",
">",
"Successfully",
"reached",
"the",
"specified",
"URL",
"<li",
">",
"Response",
"text",
"includes",
"JWT",
"cookie",
"and",
"principal",
"information",
"<",
"/",
"ol",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwtsso_fat/fat/src/com/ibm/ws/security/jwtsso/fat/utils/CommonExpectations.java#L42-L48 |
knowm/XChange | xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/v2/service/CoinbaseMarketDataServiceRaw.java | CoinbaseMarketDataServiceRaw.getCoinbaseSpotRate | public CoinbasePrice getCoinbaseSpotRate(Currency base, Currency counter) throws IOException {
return coinbase.getSpotRate(Coinbase.CB_VERSION_VALUE, base + "-" + counter).getData();
} | java | public CoinbasePrice getCoinbaseSpotRate(Currency base, Currency counter) throws IOException {
return coinbase.getSpotRate(Coinbase.CB_VERSION_VALUE, base + "-" + counter).getData();
} | [
"public",
"CoinbasePrice",
"getCoinbaseSpotRate",
"(",
"Currency",
"base",
",",
"Currency",
"counter",
")",
"throws",
"IOException",
"{",
"return",
"coinbase",
".",
"getSpotRate",
"(",
"Coinbase",
".",
"CB_VERSION_VALUE",
",",
"base",
"+",
"\"-\"",
"+",
"counter",... | Unauthenticated resource that tells you the current price of one unit. This is usually
somewhere in between the buy and sell price, current to within a few minutes.
@param pair The currency pair.
@return The price in the desired {@code currency} for one unit.
@throws IOException
@see <a
href="https://developers.coinbase.com/api/v2#get-spot-price">developers.coinbase.com/api/v2#get-spot-price</a> | [
"Unauthenticated",
"resource",
"that",
"tells",
"you",
"the",
"current",
"price",
"of",
"one",
"unit",
".",
"This",
"is",
"usually",
"somewhere",
"in",
"between",
"the",
"buy",
"and",
"sell",
"price",
"current",
"to",
"within",
"a",
"few",
"minutes",
"."
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/v2/service/CoinbaseMarketDataServiceRaw.java#L73-L76 |
DV8FromTheWorld/JDA | src/main/java/net/dv8tion/jda/core/utils/WidgetUtil.java | WidgetUtil.getPremadeWidgetHtml | public static String getPremadeWidgetHtml(String guildId, WidgetTheme theme, int width, int height)
{
Checks.notNull(guildId, "GuildId");
Checks.notNull(theme, "WidgetTheme");
Checks.notNegative(width, "Width");
Checks.notNegative(height, "Height");
return String.format(WIDGET_HTML, guildId, theme.name().toLowerCase(), width, height);
} | java | public static String getPremadeWidgetHtml(String guildId, WidgetTheme theme, int width, int height)
{
Checks.notNull(guildId, "GuildId");
Checks.notNull(theme, "WidgetTheme");
Checks.notNegative(width, "Width");
Checks.notNegative(height, "Height");
return String.format(WIDGET_HTML, guildId, theme.name().toLowerCase(), width, height);
} | [
"public",
"static",
"String",
"getPremadeWidgetHtml",
"(",
"String",
"guildId",
",",
"WidgetTheme",
"theme",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"Checks",
".",
"notNull",
"(",
"guildId",
",",
"\"GuildId\"",
")",
";",
"Checks",
".",
"notNull"... | Gets the pre-made HTML Widget for the specified guild using the specified
settings. The widget will only display correctly if the guild in question
has the Widget enabled. Additionally, this method can be used independently
of being on the guild in question.
@param guildId
the guild ID
@param theme
the theme, light or dark
@param width
the width of the widget
@param height
the height of the widget
@return a String containing the pre-made widget with the supplied settings | [
"Gets",
"the",
"pre",
"-",
"made",
"HTML",
"Widget",
"for",
"the",
"specified",
"guild",
"using",
"the",
"specified",
"settings",
".",
"The",
"widget",
"will",
"only",
"display",
"correctly",
"if",
"the",
"guild",
"in",
"question",
"has",
"the",
"Widget",
... | train | https://github.com/DV8FromTheWorld/JDA/blob/8ecbbe354d03f6bf448411bba573d0d4c268b560/src/main/java/net/dv8tion/jda/core/utils/WidgetUtil.java#L129-L136 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSContainer.java | EJSContainer.preInvoke | public EnterpriseBean preInvoke(EJSWrapperBase wrapper,
int methodId,
EJSDeployedSupport s,
EJBMethodInfoImpl methodInfo) throws RemoteException {
s.methodId = methodId; //130230 d140003.19
s.ivWrapper = wrapper; // d366807.1
return preInvokePmInternal(wrapper, methodId, s, methodInfo); //LIDB2617.11 //181971
} | java | public EnterpriseBean preInvoke(EJSWrapperBase wrapper,
int methodId,
EJSDeployedSupport s,
EJBMethodInfoImpl methodInfo) throws RemoteException {
s.methodId = methodId; //130230 d140003.19
s.ivWrapper = wrapper; // d366807.1
return preInvokePmInternal(wrapper, methodId, s, methodInfo); //LIDB2617.11 //181971
} | [
"public",
"EnterpriseBean",
"preInvoke",
"(",
"EJSWrapperBase",
"wrapper",
",",
"int",
"methodId",
",",
"EJSDeployedSupport",
"s",
",",
"EJBMethodInfoImpl",
"methodInfo",
")",
"throws",
"RemoteException",
"{",
"s",
".",
"methodId",
"=",
"methodId",
";",
"//130230 d1... | This method is called LinkTargetHelper.getLink when PM wants to provide
AccessIntent to use for ejbLink processing.
When this method is called, the methodId should be in the negative range to
indicate this is a special method with the method signature passed in. This
method signature is then used to create the EJSMethodInfo in mapMethodInfo call.
The method signature is in the form defined in BeanMetaData.java.
methodName ":" [ parameterType [ "," parameterType]* ]+
E.g. "findEJBRelationshipRole_Local:java.lang.Object"
"noParameterMethod:"
":" | [
"This",
"method",
"is",
"called",
"LinkTargetHelper",
".",
"getLink",
"when",
"PM",
"wants",
"to",
"provide",
"AccessIntent",
"to",
"use",
"for",
"ejbLink",
"processing",
".",
"When",
"this",
"method",
"is",
"called",
"the",
"methodId",
"should",
"be",
"in",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/EJSContainer.java#L2670-L2679 |
RestComm/Restcomm-Connect | restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/security/PermissionEvaluator.java | PermissionEvaluator.secureLevelControlApplications | private AuthOutcome secureLevelControlApplications(Account operatedAccount, String applicationAccountSid,
UserIdentityContext userIdentityContext) {
/*
// disabled strict policy that prevented access to sub-account applications
// operatingAccount and operatedAccount are not null at this point
Account operatingAccount = userIdentityContext.getEffectiveAccount();
String operatingAccountSid = operatingAccount.getSid().toString();
String operatedAccountSid = operatedAccount.getSid().toString();
if (!operatingAccountSid.equals(String.valueOf(operatedAccountSid))) {
return AuthOutcome.FAILED;
} else if (applicationAccountSid != null && !operatingAccountSid.equals(applicationAccountSid)) {
return AuthOutcome.FAILED;
}
return AuthOutcome.OK;
*/
// use the more liberal default policy that applies to other entities for applications too
return secureLevelControl(operatedAccount, applicationAccountSid, userIdentityContext);
} | java | private AuthOutcome secureLevelControlApplications(Account operatedAccount, String applicationAccountSid,
UserIdentityContext userIdentityContext) {
/*
// disabled strict policy that prevented access to sub-account applications
// operatingAccount and operatedAccount are not null at this point
Account operatingAccount = userIdentityContext.getEffectiveAccount();
String operatingAccountSid = operatingAccount.getSid().toString();
String operatedAccountSid = operatedAccount.getSid().toString();
if (!operatingAccountSid.equals(String.valueOf(operatedAccountSid))) {
return AuthOutcome.FAILED;
} else if (applicationAccountSid != null && !operatingAccountSid.equals(applicationAccountSid)) {
return AuthOutcome.FAILED;
}
return AuthOutcome.OK;
*/
// use the more liberal default policy that applies to other entities for applications too
return secureLevelControl(operatedAccount, applicationAccountSid, userIdentityContext);
} | [
"private",
"AuthOutcome",
"secureLevelControlApplications",
"(",
"Account",
"operatedAccount",
",",
"String",
"applicationAccountSid",
",",
"UserIdentityContext",
"userIdentityContext",
")",
"{",
"/*\n // disabled strict policy that prevented access to sub-account applications\n\n... | Uses the security policy applied by secureLevelControl(). See there for details.
DEPRECATED security policy:
Applies the following access control rules
If an application Account Sid is given:
- If operatingAccount is the same as the operated account and application resource belongs to operated account too
acces is granted.
If no application Account Sid is given:
- If operatingAccount is the same as the operated account access is granted.
NOTE: Parent/ancestor relationships on accounts do not grant access here.
@param operatedAccount
@param applicationAccountSid
@return | [
"Uses",
"the",
"security",
"policy",
"applied",
"by",
"secureLevelControl",
"()",
".",
"See",
"there",
"for",
"details",
"."
] | train | https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/security/PermissionEvaluator.java#L365-L384 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/props/WarningPropertyUtil.java | WarningPropertyUtil.pcToLocation | private static Location pcToLocation(ClassContext classContext, Method method, int pc) throws CFGBuilderException {
CFG cfg = classContext.getCFG(method);
for (Iterator<Location> i = cfg.locationIterator(); i.hasNext();) {
Location location = i.next();
if (location.getHandle().getPosition() == pc) {
return location;
}
}
return null;
} | java | private static Location pcToLocation(ClassContext classContext, Method method, int pc) throws CFGBuilderException {
CFG cfg = classContext.getCFG(method);
for (Iterator<Location> i = cfg.locationIterator(); i.hasNext();) {
Location location = i.next();
if (location.getHandle().getPosition() == pc) {
return location;
}
}
return null;
} | [
"private",
"static",
"Location",
"pcToLocation",
"(",
"ClassContext",
"classContext",
",",
"Method",
"method",
",",
"int",
"pc",
")",
"throws",
"CFGBuilderException",
"{",
"CFG",
"cfg",
"=",
"classContext",
".",
"getCFG",
"(",
"method",
")",
";",
"for",
"(",
... | Get a Location matching the given PC value. Because of JSR subroutines,
there may be multiple Locations referring to the given instruction. This
method simply returns one of them arbitrarily.
@param classContext
the ClassContext containing the method
@param method
the method
@param pc
a PC value of an instruction in the method
@return a Location corresponding to the PC value, or null if no such
Location can be found
@throws CFGBuilderException | [
"Get",
"a",
"Location",
"matching",
"the",
"given",
"PC",
"value",
".",
"Because",
"of",
"JSR",
"subroutines",
"there",
"may",
"be",
"multiple",
"Locations",
"referring",
"to",
"the",
"given",
"instruction",
".",
"This",
"method",
"simply",
"returns",
"one",
... | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/props/WarningPropertyUtil.java#L75-L84 |
sniffy/sniffy | sniffy-core/src/main/java/io/sniffy/LegacySpy.java | LegacySpy.verifyAtMostOnce | @Deprecated
public C verifyAtMostOnce(Threads threadMatcher, Query query) throws WrongNumberOfQueriesError {
return verify(SqlQueries.atMostOneQuery().threads(threadMatcher).type(adapter(query)));
} | java | @Deprecated
public C verifyAtMostOnce(Threads threadMatcher, Query query) throws WrongNumberOfQueriesError {
return verify(SqlQueries.atMostOneQuery().threads(threadMatcher).type(adapter(query)));
} | [
"@",
"Deprecated",
"public",
"C",
"verifyAtMostOnce",
"(",
"Threads",
"threadMatcher",
",",
"Query",
"query",
")",
"throws",
"WrongNumberOfQueriesError",
"{",
"return",
"verify",
"(",
"SqlQueries",
".",
"atMostOneQuery",
"(",
")",
".",
"threads",
"(",
"threadMatch... | Alias for {@link #verifyBetween(int, int, Threads, Query)} with arguments 0, 1, {@code threads}, {@code queryType}
@since 2.2 | [
"Alias",
"for",
"{"
] | train | https://github.com/sniffy/sniffy/blob/7bdddb9593e6b6e9fe5c7c87519f864acbc3a5c0/sniffy-core/src/main/java/io/sniffy/LegacySpy.java#L290-L293 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/JobApi.java | JobApi.playJob | public Job playJob(Object projectIdOrPath, int jobId) throws GitLabApiException {
GitLabApiForm formData = null;
Response response = post(Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId, "play");
return (response.readEntity(Job.class));
} | java | public Job playJob(Object projectIdOrPath, int jobId) throws GitLabApiException {
GitLabApiForm formData = null;
Response response = post(Status.CREATED, formData, "projects", getProjectIdOrPath(projectIdOrPath), "jobs", jobId, "play");
return (response.readEntity(Job.class));
} | [
"public",
"Job",
"playJob",
"(",
"Object",
"projectIdOrPath",
",",
"int",
"jobId",
")",
"throws",
"GitLabApiException",
"{",
"GitLabApiForm",
"formData",
"=",
"null",
";",
"Response",
"response",
"=",
"post",
"(",
"Status",
".",
"CREATED",
",",
"formData",
","... | Play specified job in a project.
<pre><code>GitLab Endpoint: POST /projects/:id/jobs/:job_id/play</code></pre>
@param projectIdOrPath id, path of the project, or a Project instance holding the project ID or path
@param jobId the ID to play job
@return job instance which just played
@throws GitLabApiException if any exception occurs during execution | [
"Play",
"specified",
"job",
"in",
"a",
"project",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/JobApi.java#L489-L493 |
code4everything/util | src/main/java/com/zhazhapan/util/BeanUtils.java | BeanUtils.converter | @SuppressWarnings("unchecked")
private static String converter(String fieldName, Object object) {
StringBuilder builder = new StringBuilder();
if (Checker.isNotEmpty(fieldName)) {
builder.append("\"").append(fieldName).append("\":");
}
if (object instanceof Collection) {
List list = (List) object;
builder.append("[");
list.forEach(obj -> builder.append(converter(ValueConsts.EMPTY_STRING, obj)));
return builder.substring(0, builder.length() - 1) + "],";
} else if (object instanceof Map) {
Map map = (Map) object;
builder.append("{");
map.forEach((k, v) -> builder.append(converter(k.toString(), v)));
return builder.substring(0, builder.length() - 1) + "},";
} else if (Checker.isEmpty(fieldName)) {
builder.append("\"").append(object).append("\",");
} else {
builder.append("\"").append(object).append("\",");
}
return builder.toString();
} | java | @SuppressWarnings("unchecked")
private static String converter(String fieldName, Object object) {
StringBuilder builder = new StringBuilder();
if (Checker.isNotEmpty(fieldName)) {
builder.append("\"").append(fieldName).append("\":");
}
if (object instanceof Collection) {
List list = (List) object;
builder.append("[");
list.forEach(obj -> builder.append(converter(ValueConsts.EMPTY_STRING, obj)));
return builder.substring(0, builder.length() - 1) + "],";
} else if (object instanceof Map) {
Map map = (Map) object;
builder.append("{");
map.forEach((k, v) -> builder.append(converter(k.toString(), v)));
return builder.substring(0, builder.length() - 1) + "},";
} else if (Checker.isEmpty(fieldName)) {
builder.append("\"").append(object).append("\",");
} else {
builder.append("\"").append(object).append("\",");
}
return builder.toString();
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"static",
"String",
"converter",
"(",
"String",
"fieldName",
",",
"Object",
"object",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"Checker",
".",
... | 手动转换 {@link List} 和 {@link Map}
@param fieldName 字段名
@param object 对象
@return json对象 | [
"手动转换",
"{",
"@link",
"List",
"}",
"和",
"{",
"@link",
"Map",
"}"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/BeanUtils.java#L363-L385 |
before/quality-check | modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java | Check.isNull | @Throws(IllegalNotNullArgumentException.class)
public static void isNull(@Nullable final Object reference, @Nullable final String name) {
if (reference != null) {
throw new IllegalNotNullArgumentException(name, reference);
}
} | java | @Throws(IllegalNotNullArgumentException.class)
public static void isNull(@Nullable final Object reference, @Nullable final String name) {
if (reference != null) {
throw new IllegalNotNullArgumentException(name, reference);
}
} | [
"@",
"Throws",
"(",
"IllegalNotNullArgumentException",
".",
"class",
")",
"public",
"static",
"void",
"isNull",
"(",
"@",
"Nullable",
"final",
"Object",
"reference",
",",
"@",
"Nullable",
"final",
"String",
"name",
")",
"{",
"if",
"(",
"reference",
"!=",
"nu... | Ensures that a given argument is {@code null}.
Normally, the usage of {@code null} arguments is disregarded by the authors of quality-check. Still, there are
certain circumstances where null is required, e.g. the primary key of an entity before it is written to the
database for the first time. In such cases it is ok to use null values and there should also be checks for them.
For example, to avoid overwriting an existing primary key with a new one.
@param reference
reference which must be null.
@param name
name of object reference (in source code)
@throws IllegalNotNullArgumentException
if the given argument {@code reference} is not null | [
"Ensures",
"that",
"a",
"given",
"argument",
"is",
"{",
"@code",
"null",
"}",
"."
] | train | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java#L1211-L1216 |
ixa-ehu/kaflib | src/main/java/ixa/kaflib/KAFDocument.java | KAFDocument.newChunk | public Chunk newChunk(String id, String phrase, Span<Term> span) {
idManager.updateCounter(AnnotationType.CHUNK, id);
Chunk newChunk = new Chunk(id, span);
newChunk.setPhrase(phrase);
annotationContainer.add(newChunk, Layer.CHUNKS, AnnotationType.CHUNK);
return newChunk;
} | java | public Chunk newChunk(String id, String phrase, Span<Term> span) {
idManager.updateCounter(AnnotationType.CHUNK, id);
Chunk newChunk = new Chunk(id, span);
newChunk.setPhrase(phrase);
annotationContainer.add(newChunk, Layer.CHUNKS, AnnotationType.CHUNK);
return newChunk;
} | [
"public",
"Chunk",
"newChunk",
"(",
"String",
"id",
",",
"String",
"phrase",
",",
"Span",
"<",
"Term",
">",
"span",
")",
"{",
"idManager",
".",
"updateCounter",
"(",
"AnnotationType",
".",
"CHUNK",
",",
"id",
")",
";",
"Chunk",
"newChunk",
"=",
"new",
... | Creates a chunk object to load an existing chunk. It receives it's ID as an argument. The Chunk is added to the document object.
@param id chunk's ID.
@param head the chunk head.
@param phrase type of the phrase.
@param terms the list of the terms in the chunk.
@return a new chunk. | [
"Creates",
"a",
"chunk",
"object",
"to",
"load",
"an",
"existing",
"chunk",
".",
"It",
"receives",
"it",
"s",
"ID",
"as",
"an",
"argument",
".",
"The",
"Chunk",
"is",
"added",
"to",
"the",
"document",
"object",
"."
] | train | https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L704-L710 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRSceneObject.java | GVRSceneObject.expandBoundingVolume | public final BoundingVolume expandBoundingVolume(final Vector3f point) {
return expandBoundingVolume(point.x, point.y, point.z);
} | java | public final BoundingVolume expandBoundingVolume(final Vector3f point) {
return expandBoundingVolume(point.x, point.y, point.z);
} | [
"public",
"final",
"BoundingVolume",
"expandBoundingVolume",
"(",
"final",
"Vector3f",
"point",
")",
"{",
"return",
"expandBoundingVolume",
"(",
"point",
".",
"x",
",",
"point",
".",
"y",
",",
"point",
".",
"z",
")",
";",
"}"
] | Expand the current volume by the given point
@param point point to add to bounding volume.
@return the updated BoundingVolume. | [
"Expand",
"the",
"current",
"volume",
"by",
"the",
"given",
"point"
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRSceneObject.java#L1272-L1274 |
real-logic/agrona | agrona/src/main/java/org/agrona/DeadlineTimerWheel.java | DeadlineTimerWheel.scheduleTimer | public long scheduleTimer(final long deadline)
{
final long ticks = Math.max((deadline - startTime) >> resolutionBitsToShift, currentTick);
final int wheelIndex = (int)(ticks & wheelMask);
final long[] array = wheel[wheelIndex];
for (int i = 0; i < array.length; i++)
{
if (NULL_TIMER == array[i])
{
array[i] = deadline;
timerCount++;
return timerIdForSlot(wheelIndex, i);
}
}
final long[] newArray = Arrays.copyOf(array, array.length + 1);
newArray[array.length] = deadline;
wheel[wheelIndex] = newArray;
timerCount++;
return timerIdForSlot(wheelIndex, array.length);
} | java | public long scheduleTimer(final long deadline)
{
final long ticks = Math.max((deadline - startTime) >> resolutionBitsToShift, currentTick);
final int wheelIndex = (int)(ticks & wheelMask);
final long[] array = wheel[wheelIndex];
for (int i = 0; i < array.length; i++)
{
if (NULL_TIMER == array[i])
{
array[i] = deadline;
timerCount++;
return timerIdForSlot(wheelIndex, i);
}
}
final long[] newArray = Arrays.copyOf(array, array.length + 1);
newArray[array.length] = deadline;
wheel[wheelIndex] = newArray;
timerCount++;
return timerIdForSlot(wheelIndex, array.length);
} | [
"public",
"long",
"scheduleTimer",
"(",
"final",
"long",
"deadline",
")",
"{",
"final",
"long",
"ticks",
"=",
"Math",
".",
"max",
"(",
"(",
"deadline",
"-",
"startTime",
")",
">>",
"resolutionBitsToShift",
",",
"currentTick",
")",
";",
"final",
"int",
"whe... | Schedule a timer for a given absolute time as a deadline in {@link #timeUnit()}s. A timerId will be assigned
and returned for future reference.
@param deadline after which the timer should expire.
@return timerId for the scheduled timer | [
"Schedule",
"a",
"timer",
"for",
"a",
"given",
"absolute",
"time",
"as",
"a",
"deadline",
"in",
"{",
"@link",
"#timeUnit",
"()",
"}",
"s",
".",
"A",
"timerId",
"will",
"be",
"assigned",
"and",
"returned",
"for",
"future",
"reference",
"."
] | train | https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/DeadlineTimerWheel.java#L205-L229 |
haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/DebugUtil.java | DebugUtil.printDebug | public static void printDebug(final Collection pCollection, final String pMethodName, final PrintStream pPrintStream) {
if (pPrintStream == null) {
System.err.println(PRINTSTREAM_IS_NULL_ERROR_MESSAGE);
return;
}
if (pCollection == null) {
pPrintStream.println(COLLECTION_IS_NULL_ERROR_MESSAGE);
return;
} else if (pCollection.isEmpty()) {
pPrintStream.println(COLLECTION_IS_EMPTY_ERROR_MESSAGE);
return;
}
for (Iterator i = pCollection.iterator(); i.hasNext(); ) {
printDebug(i.next(), pMethodName, pPrintStream);
}
} | java | public static void printDebug(final Collection pCollection, final String pMethodName, final PrintStream pPrintStream) {
if (pPrintStream == null) {
System.err.println(PRINTSTREAM_IS_NULL_ERROR_MESSAGE);
return;
}
if (pCollection == null) {
pPrintStream.println(COLLECTION_IS_NULL_ERROR_MESSAGE);
return;
} else if (pCollection.isEmpty()) {
pPrintStream.println(COLLECTION_IS_EMPTY_ERROR_MESSAGE);
return;
}
for (Iterator i = pCollection.iterator(); i.hasNext(); ) {
printDebug(i.next(), pMethodName, pPrintStream);
}
} | [
"public",
"static",
"void",
"printDebug",
"(",
"final",
"Collection",
"pCollection",
",",
"final",
"String",
"pMethodName",
",",
"final",
"PrintStream",
"pPrintStream",
")",
"{",
"if",
"(",
"pPrintStream",
"==",
"null",
")",
"{",
"System",
".",
"err",
".",
"... | Invokes a given method of every element in a {@code java.util.Collection} and prints the results to a {@code java.io.PrintStream}.
The method to be invoked must have no formal parameters.
<p>
If an exception is throwed during the method invocation, the element's {@code toString()} method is called.
For bulk data types, recursive invocations and invocations of other methods in this class, are used.
<p>
Be aware that the {@code Collection} interface embraces a large portion of the bulk data types in the {@code java.util} package,
e.g. {@code List}, {@code Set}, {@code Vector} and {@code HashSet}.
<p>
For debugging of arrays, use the method <a href="http://java.sun.com/products/jdk/1.3/docs/api/java/util/Arrays.html#asList(java.lang.Object[])">{@code java.util.Arrays.asList(Object[])}</a> method for converting the object array to a list before calling this method.
<p>
@param pCollection the {@code java.util.Collection} to be printed.
@param pMethodName a {@code java.lang.String} holding the name of the method to be invoked on each collection element.
@param pPrintStream the {@code java.io.PrintStream} for flushing the results.
@see <a href="http://java.sun.com/products/jdk/1.3/docs/api/java/util/Collection.html">{@code java.util.Collection}</a> | [
"Invokes",
"a",
"given",
"method",
"of",
"every",
"element",
"in",
"a",
"{"
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/DebugUtil.java#L486-L502 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/methods/AbstractMethod.java | AbstractMethod.getTypeReference | protected static TypeReference getTypeReference(Class aClass) throws MovieDbException {
if (TYPE_REFS.containsKey(aClass)) {
return TYPE_REFS.get(aClass);
} else {
throw new MovieDbException(ApiExceptionType.UNKNOWN_CAUSE, "Class type reference for '" + aClass.getSimpleName() + "' not found!");
}
} | java | protected static TypeReference getTypeReference(Class aClass) throws MovieDbException {
if (TYPE_REFS.containsKey(aClass)) {
return TYPE_REFS.get(aClass);
} else {
throw new MovieDbException(ApiExceptionType.UNKNOWN_CAUSE, "Class type reference for '" + aClass.getSimpleName() + "' not found!");
}
} | [
"protected",
"static",
"TypeReference",
"getTypeReference",
"(",
"Class",
"aClass",
")",
"throws",
"MovieDbException",
"{",
"if",
"(",
"TYPE_REFS",
".",
"containsKey",
"(",
"aClass",
")",
")",
"{",
"return",
"TYPE_REFS",
".",
"get",
"(",
"aClass",
")",
";",
... | Helper function to get a pre-generated TypeReference for a class
@param aClass
@return
@throws MovieDbException | [
"Helper",
"function",
"to",
"get",
"a",
"pre",
"-",
"generated",
"TypeReference",
"for",
"a",
"class"
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/AbstractMethod.java#L127-L133 |
redkale/redkale | src/org/redkale/util/ResourceFactory.java | ResourceFactory.findResourceFactory | public ResourceFactory findResourceFactory(String name, Type clazz) {
Map<String, ResourceEntry> map = this.store.get(clazz);
if (map != null && map.containsKey(name)) return this;
if (parent != null) return parent.findResourceFactory(name, clazz);
return null;
} | java | public ResourceFactory findResourceFactory(String name, Type clazz) {
Map<String, ResourceEntry> map = this.store.get(clazz);
if (map != null && map.containsKey(name)) return this;
if (parent != null) return parent.findResourceFactory(name, clazz);
return null;
} | [
"public",
"ResourceFactory",
"findResourceFactory",
"(",
"String",
"name",
",",
"Type",
"clazz",
")",
"{",
"Map",
"<",
"String",
",",
"ResourceEntry",
">",
"map",
"=",
"this",
".",
"store",
".",
"get",
"(",
"clazz",
")",
";",
"if",
"(",
"map",
"!=",
"n... | 查找指定资源名和资源类型的资源对象所在的ResourceFactory, 没有则返回null
@param name 资源名
@param clazz 资源类型
@return ResourceFactory | [
"查找指定资源名和资源类型的资源对象所在的ResourceFactory,",
"没有则返回null"
] | train | https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/util/ResourceFactory.java#L445-L450 |
Esri/spatial-framework-for-hadoop | hive/src/main/java/com/esri/hadoop/hive/BinUtils.java | BinUtils.queryEnvelope | public void queryEnvelope(long binId, Envelope envelope) {
long down = binId / numCols;
long over = binId % numCols;
double xmin = extentMin + (over * binSize);
double xmax = xmin + binSize;
double ymax = extentMax - (down * binSize);
double ymin = ymax - binSize;
envelope.setCoords(xmin, ymin, xmax, ymax);
} | java | public void queryEnvelope(long binId, Envelope envelope) {
long down = binId / numCols;
long over = binId % numCols;
double xmin = extentMin + (over * binSize);
double xmax = xmin + binSize;
double ymax = extentMax - (down * binSize);
double ymin = ymax - binSize;
envelope.setCoords(xmin, ymin, xmax, ymax);
} | [
"public",
"void",
"queryEnvelope",
"(",
"long",
"binId",
",",
"Envelope",
"envelope",
")",
"{",
"long",
"down",
"=",
"binId",
"/",
"numCols",
";",
"long",
"over",
"=",
"binId",
"%",
"numCols",
";",
"double",
"xmin",
"=",
"extentMin",
"+",
"(",
"over",
... | Gets the envelope for the bin ID.
@param binId
@param envelope | [
"Gets",
"the",
"envelope",
"for",
"the",
"bin",
"ID",
"."
] | train | https://github.com/Esri/spatial-framework-for-hadoop/blob/00959d6b4465313c934aaa8aaf17b52d6c9c60d4/hive/src/main/java/com/esri/hadoop/hive/BinUtils.java#L46-L56 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/util/selenium/by/BestMatchBy.java | BestMatchBy.findElement | public static <T extends WebElement> T findElement(By by, SearchContext context) {
WebElement element = null;
List<WebElement> elements = context.findElements(by);
if (elements.size() == 1) {
element = elements.get(0);
} else if (elements.size() > 1) {
element = BEST_FUNCTION.apply(context, elements);
}
return (T) element;
} | java | public static <T extends WebElement> T findElement(By by, SearchContext context) {
WebElement element = null;
List<WebElement> elements = context.findElements(by);
if (elements.size() == 1) {
element = elements.get(0);
} else if (elements.size() > 1) {
element = BEST_FUNCTION.apply(context, elements);
}
return (T) element;
} | [
"public",
"static",
"<",
"T",
"extends",
"WebElement",
">",
"T",
"findElement",
"(",
"By",
"by",
",",
"SearchContext",
"context",
")",
"{",
"WebElement",
"element",
"=",
"null",
";",
"List",
"<",
"WebElement",
">",
"elements",
"=",
"context",
".",
"findEle... | Returns 'best' result from by.
If there is no result: returns null,
if there is just one that is best,
otherwise the 'bestFunction' is applied to all results to determine best.
@param by by to use to find elements.
@param context context to search in.
@param <T> type of element expected.
@return 'best' element, will be <code>null</code> if no elements were found. | [
"Returns",
"best",
"result",
"from",
"by",
".",
"If",
"there",
"is",
"no",
"result",
":",
"returns",
"null",
"if",
"there",
"is",
"just",
"one",
"that",
"is",
"best",
"otherwise",
"the",
"bestFunction",
"is",
"applied",
"to",
"all",
"results",
"to",
"det... | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/selenium/by/BestMatchBy.java#L47-L56 |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/Handler.java | Handler.addToRootFileCache | static void addToRootFileCache(File sourceFile, JarFile jarFile) {
Map<File, JarFile> cache = rootFileCache.get();
if (cache == null) {
cache = new ConcurrentHashMap<>();
rootFileCache = new SoftReference<>(cache);
}
cache.put(sourceFile, jarFile);
} | java | static void addToRootFileCache(File sourceFile, JarFile jarFile) {
Map<File, JarFile> cache = rootFileCache.get();
if (cache == null) {
cache = new ConcurrentHashMap<>();
rootFileCache = new SoftReference<>(cache);
}
cache.put(sourceFile, jarFile);
} | [
"static",
"void",
"addToRootFileCache",
"(",
"File",
"sourceFile",
",",
"JarFile",
"jarFile",
")",
"{",
"Map",
"<",
"File",
",",
"JarFile",
">",
"cache",
"=",
"rootFileCache",
".",
"get",
"(",
")",
";",
"if",
"(",
"cache",
"==",
"null",
")",
"{",
"cach... | Add the given {@link JarFile} to the root file cache.
@param sourceFile the source file to add
@param jarFile the jar file. | [
"Add",
"the",
"given",
"{"
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/jar/Handler.java#L333-L340 |
MenoData/Time4J | base/src/main/java/net/time4j/range/Weeks.java | Weeks.between | public static <T extends TimePoint<? super CalendarUnit, T>> Weeks between(T t1, T t2) {
long delta = CalendarUnit.WEEKS.between(t1, t2);
return Weeks.of(MathUtils.safeCast(delta));
} | java | public static <T extends TimePoint<? super CalendarUnit, T>> Weeks between(T t1, T t2) {
long delta = CalendarUnit.WEEKS.between(t1, t2);
return Weeks.of(MathUtils.safeCast(delta));
} | [
"public",
"static",
"<",
"T",
"extends",
"TimePoint",
"<",
"?",
"super",
"CalendarUnit",
",",
"T",
">",
">",
"Weeks",
"between",
"(",
"T",
"t1",
",",
"T",
"t2",
")",
"{",
"long",
"delta",
"=",
"CalendarUnit",
".",
"WEEKS",
".",
"between",
"(",
"t1",
... | /*[deutsch]
<p>Bestimmt die gregorianische Wochendifferenz zwischen den angegebenen Zeitpunkten. </p>
@param <T> generic type of time-points
@param t1 first time-point
@param t2 second time-point
@return result of week difference
@see net.time4j.PlainDate
@see net.time4j.PlainTimestamp | [
"/",
"*",
"[",
"deutsch",
"]",
"<p",
">",
"Bestimmt",
"die",
"gregorianische",
"Wochendifferenz",
"zwischen",
"den",
"angegebenen",
"Zeitpunkten",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/range/Weeks.java#L119-L124 |
nguillaumin/slick2d-maven | slick2d-core/src/main/java/org/newdawn/slick/opengl/TextureLoader.java | TextureLoader.getTexture | public static Texture getTexture(String format, InputStream in, int filter) throws IOException {
return getTexture(format, in, false, filter);
} | java | public static Texture getTexture(String format, InputStream in, int filter) throws IOException {
return getTexture(format, in, false, filter);
} | [
"public",
"static",
"Texture",
"getTexture",
"(",
"String",
"format",
",",
"InputStream",
"in",
",",
"int",
"filter",
")",
"throws",
"IOException",
"{",
"return",
"getTexture",
"(",
"format",
",",
"in",
",",
"false",
",",
"filter",
")",
";",
"}"
] | Load a texture with a given format from the supplied input stream
@param format The format of the texture to be loaded (something like "PNG" or "TGA")
@param in The input stream from which the image data will be read
@param filter The GL texture filter to use for scaling up and down
@return The newly created texture
@throws IOException Indicates a failure to read the image data | [
"Load",
"a",
"texture",
"with",
"a",
"given",
"format",
"from",
"the",
"supplied",
"input",
"stream"
] | train | https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/opengl/TextureLoader.java#L49-L51 |
facebook/fresco | drawee/src/main/java/com/facebook/drawee/drawable/DrawableUtils.java | DrawableUtils.multiplyColorAlpha | public static int multiplyColorAlpha(int color, int alpha) {
if (alpha == 255) {
return color;
}
if (alpha == 0) {
return color & 0x00FFFFFF;
}
alpha = alpha + (alpha >> 7); // make it 0..256
int colorAlpha = color >>> 24;
int multipliedAlpha = colorAlpha * alpha >> 8;
return (multipliedAlpha << 24) | (color & 0x00FFFFFF);
} | java | public static int multiplyColorAlpha(int color, int alpha) {
if (alpha == 255) {
return color;
}
if (alpha == 0) {
return color & 0x00FFFFFF;
}
alpha = alpha + (alpha >> 7); // make it 0..256
int colorAlpha = color >>> 24;
int multipliedAlpha = colorAlpha * alpha >> 8;
return (multipliedAlpha << 24) | (color & 0x00FFFFFF);
} | [
"public",
"static",
"int",
"multiplyColorAlpha",
"(",
"int",
"color",
",",
"int",
"alpha",
")",
"{",
"if",
"(",
"alpha",
"==",
"255",
")",
"{",
"return",
"color",
";",
"}",
"if",
"(",
"alpha",
"==",
"0",
")",
"{",
"return",
"color",
"&",
"0x00FFFFFF"... | Multiplies the color with the given alpha.
@param color color to be multiplied
@param alpha value between 0 and 255
@return multiplied color | [
"Multiplies",
"the",
"color",
"with",
"the",
"given",
"alpha",
"."
] | train | https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/drawable/DrawableUtils.java#L90-L101 |
osmdroid/osmdroid | osmdroid-geopackage/src/main/java/org/osmdroid/gpkg/overlay/features/SphericalUtil.java | SphericalUtil.havDistance | static double havDistance(double lat1, double lat2, double dLng) {
return hav(lat1 - lat2) + hav(dLng) * cos(lat1) * cos(lat2);
} | java | static double havDistance(double lat1, double lat2, double dLng) {
return hav(lat1 - lat2) + hav(dLng) * cos(lat1) * cos(lat2);
} | [
"static",
"double",
"havDistance",
"(",
"double",
"lat1",
",",
"double",
"lat2",
",",
"double",
"dLng",
")",
"{",
"return",
"hav",
"(",
"lat1",
"-",
"lat2",
")",
"+",
"hav",
"(",
"dLng",
")",
"*",
"cos",
"(",
"lat1",
")",
"*",
"cos",
"(",
"lat2",
... | Returns hav() of distance from (lat1, lng1) to (lat2, lng2) on the unit sphere. | [
"Returns",
"hav",
"()",
"of",
"distance",
"from",
"(",
"lat1",
"lng1",
")",
"to",
"(",
"lat2",
"lng2",
")",
"on",
"the",
"unit",
"sphere",
"."
] | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-geopackage/src/main/java/org/osmdroid/gpkg/overlay/features/SphericalUtil.java#L125-L127 |
alkacon/opencms-core | src/org/opencms/jsp/CmsJspTagPdfThumbnail.java | CmsJspTagPdfThumbnail.pdfTagAction | public static String pdfTagAction(ServletRequest request, String file, int width, int height, String format)
throws CmsException {
CmsFlexController controller = CmsFlexController.getController(request);
CmsObject cms = controller.getCmsObject();
CmsResource pdfRes = cms.readResource(file);
CmsPdfThumbnailLink linkObj = new CmsPdfThumbnailLink(cms, pdfRes, width, height, format);
return linkObj.getLinkWithOptions();
} | java | public static String pdfTagAction(ServletRequest request, String file, int width, int height, String format)
throws CmsException {
CmsFlexController controller = CmsFlexController.getController(request);
CmsObject cms = controller.getCmsObject();
CmsResource pdfRes = cms.readResource(file);
CmsPdfThumbnailLink linkObj = new CmsPdfThumbnailLink(cms, pdfRes, width, height, format);
return linkObj.getLinkWithOptions();
} | [
"public",
"static",
"String",
"pdfTagAction",
"(",
"ServletRequest",
"request",
",",
"String",
"file",
",",
"int",
"width",
",",
"int",
"height",
",",
"String",
"format",
")",
"throws",
"CmsException",
"{",
"CmsFlexController",
"controller",
"=",
"CmsFlexControlle... | The implementation of the tag.<p>
@param request the current request
@param file the path to the PDF
@param width the thumbnail width
@param height the thumbnail height
@param format the image format
@throws CmsException if something goes wrong
@return the link to the PDF thumbnail | [
"The",
"implementation",
"of",
"the",
"tag",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagPdfThumbnail.java#L72-L80 |
molgenis/molgenis | molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlExceptionTranslator.java | PostgreSqlExceptionTranslator.translateUniqueKeyViolation | MolgenisValidationException translateUniqueKeyViolation(PSQLException pSqlException) {
ServerErrorMessage serverErrorMessage = pSqlException.getServerErrorMessage();
String tableName = serverErrorMessage.getTable();
String detailMessage = serverErrorMessage.getDetail();
Matcher matcher =
Pattern.compile("Key \\(\"?(.*?)\"?\\)=\\((.*?)\\) already exists.").matcher(detailMessage);
boolean matches = matcher.matches();
if (matches) {
ConstraintViolation constraintViolation;
// exception message when adding data that does not match constraint
String[] columnNames = matcher.group(1).split(", ");
if (columnNames.length == 1) {
String columnName = columnNames[0];
String value = matcher.group(2);
constraintViolation =
new ConstraintViolation(
format(
"Duplicate value '%s' for unique attribute '%s' from entity '%s'.",
value,
tryGetAttributeName(tableName, columnName).orElse(TOKEN_UNKNOWN),
tryGetEntityTypeName(tableName).orElse(TOKEN_UNKNOWN)),
null);
} else {
String columnName = columnNames[columnNames.length - 1];
String[] values = matcher.group(2).split(", ");
String idValue = values[0];
String value = values[1];
constraintViolation =
new ConstraintViolation(
format(
"Duplicate list value '%s' for attribute '%s' from entity '%s' with id '%s'.",
value,
tryGetAttributeName(tableName, columnName).orElse(TOKEN_UNKNOWN),
tryGetEntityTypeName(tableName).orElse(TOKEN_UNKNOWN),
idValue),
null);
}
return new MolgenisValidationException(singleton(constraintViolation));
} else {
// exception message when applying constraint on existing data
matcher =
Pattern.compile("Key \\(\"?(.*?)\"?\\)=\\((.*?)\\) is duplicated.")
.matcher(detailMessage);
matches = matcher.matches();
if (matches) {
String columnName = matcher.group(1);
String value = matcher.group(2);
ConstraintViolation constraintViolation =
new ConstraintViolation(
format(
"The attribute '%s' of entity '%s' contains duplicate value '%s'.",
tryGetAttributeName(tableName, columnName).orElse(TOKEN_UNKNOWN),
tryGetEntityTypeName(tableName).orElse(TOKEN_UNKNOWN),
value),
null);
return new MolgenisValidationException(singleton(constraintViolation));
} else {
LOG.error(ERROR_TRANSLATING_POSTGRES_EXC_MSG, pSqlException);
throw new RuntimeException(ERROR_TRANSLATING_EXCEPTION_MSG, pSqlException);
}
}
} | java | MolgenisValidationException translateUniqueKeyViolation(PSQLException pSqlException) {
ServerErrorMessage serverErrorMessage = pSqlException.getServerErrorMessage();
String tableName = serverErrorMessage.getTable();
String detailMessage = serverErrorMessage.getDetail();
Matcher matcher =
Pattern.compile("Key \\(\"?(.*?)\"?\\)=\\((.*?)\\) already exists.").matcher(detailMessage);
boolean matches = matcher.matches();
if (matches) {
ConstraintViolation constraintViolation;
// exception message when adding data that does not match constraint
String[] columnNames = matcher.group(1).split(", ");
if (columnNames.length == 1) {
String columnName = columnNames[0];
String value = matcher.group(2);
constraintViolation =
new ConstraintViolation(
format(
"Duplicate value '%s' for unique attribute '%s' from entity '%s'.",
value,
tryGetAttributeName(tableName, columnName).orElse(TOKEN_UNKNOWN),
tryGetEntityTypeName(tableName).orElse(TOKEN_UNKNOWN)),
null);
} else {
String columnName = columnNames[columnNames.length - 1];
String[] values = matcher.group(2).split(", ");
String idValue = values[0];
String value = values[1];
constraintViolation =
new ConstraintViolation(
format(
"Duplicate list value '%s' for attribute '%s' from entity '%s' with id '%s'.",
value,
tryGetAttributeName(tableName, columnName).orElse(TOKEN_UNKNOWN),
tryGetEntityTypeName(tableName).orElse(TOKEN_UNKNOWN),
idValue),
null);
}
return new MolgenisValidationException(singleton(constraintViolation));
} else {
// exception message when applying constraint on existing data
matcher =
Pattern.compile("Key \\(\"?(.*?)\"?\\)=\\((.*?)\\) is duplicated.")
.matcher(detailMessage);
matches = matcher.matches();
if (matches) {
String columnName = matcher.group(1);
String value = matcher.group(2);
ConstraintViolation constraintViolation =
new ConstraintViolation(
format(
"The attribute '%s' of entity '%s' contains duplicate value '%s'.",
tryGetAttributeName(tableName, columnName).orElse(TOKEN_UNKNOWN),
tryGetEntityTypeName(tableName).orElse(TOKEN_UNKNOWN),
value),
null);
return new MolgenisValidationException(singleton(constraintViolation));
} else {
LOG.error(ERROR_TRANSLATING_POSTGRES_EXC_MSG, pSqlException);
throw new RuntimeException(ERROR_TRANSLATING_EXCEPTION_MSG, pSqlException);
}
}
} | [
"MolgenisValidationException",
"translateUniqueKeyViolation",
"(",
"PSQLException",
"pSqlException",
")",
"{",
"ServerErrorMessage",
"serverErrorMessage",
"=",
"pSqlException",
".",
"getServerErrorMessage",
"(",
")",
";",
"String",
"tableName",
"=",
"serverErrorMessage",
".",... | Package private for testability
@param pSqlException PostgreSQL exception
@return translated validation exception | [
"Package",
"private",
"for",
"testability"
] | train | https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlExceptionTranslator.java#L391-L456 |
Bedework/bw-util | bw-util-directory/src/main/java/org/bedework/util/directory/common/DirRecord.java | DirRecord.attrValCompare | public int attrValCompare(Object val, String attrName,
boolean ignoreCase) throws NamingException {
Attribute a = findAttr(attrName);
if (a == null) {
return -2;
}
return attrValCompare(val, a, ignoreCase);
} | java | public int attrValCompare(Object val, String attrName,
boolean ignoreCase) throws NamingException {
Attribute a = findAttr(attrName);
if (a == null) {
return -2;
}
return attrValCompare(val, a, ignoreCase);
} | [
"public",
"int",
"attrValCompare",
"(",
"Object",
"val",
",",
"String",
"attrName",
",",
"boolean",
"ignoreCase",
")",
"throws",
"NamingException",
"{",
"Attribute",
"a",
"=",
"findAttr",
"(",
"attrName",
")",
";",
"if",
"(",
"a",
"==",
"null",
")",
"{",
... | Extract the target attribute from this record then
compare the given single value with the attribute value(s).
@param val
@param attrName
@param ignoreCase
@return -2 for not equal or not present in multi-valued attribute
-1 for val < that
0 for val = that
1 for val > that
2 for val present in multi-valued attr
@throws NamingException | [
"Extract",
"the",
"target",
"attribute",
"from",
"this",
"record",
"then",
"compare",
"the",
"given",
"single",
"value",
"with",
"the",
"attribute",
"value",
"(",
"s",
")",
"."
] | train | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-directory/src/main/java/org/bedework/util/directory/common/DirRecord.java#L418-L426 |
pawelprazak/java-extended | guava/src/main/java/com/bluecatcode/common/contract/Checks.java | Checks.checkIsInstance | @Beta
public static <T> T checkIsInstance(Class<T> class_, Object reference) {
return checkIsInstance(class_, reference, "Expected reference to be instance of %s, got %s",
class_ == null ? "null" : class_.getName(), reference == null ? "null" : reference.getClass().getName());
} | java | @Beta
public static <T> T checkIsInstance(Class<T> class_, Object reference) {
return checkIsInstance(class_, reference, "Expected reference to be instance of %s, got %s",
class_ == null ? "null" : class_.getName(), reference == null ? "null" : reference.getClass().getName());
} | [
"@",
"Beta",
"public",
"static",
"<",
"T",
">",
"T",
"checkIsInstance",
"(",
"Class",
"<",
"T",
">",
"class_",
",",
"Object",
"reference",
")",
"{",
"return",
"checkIsInstance",
"(",
"class_",
",",
"reference",
",",
"\"Expected reference to be instance of %s, go... | Performs a runtime check if the reference is an instance of the provided class
@param class_ the class to use
@param reference reference to check
@param <T> the reference type
@see Checks#checkIsInstance(Class, Object, String, Object...) | [
"Performs",
"a",
"runtime",
"check",
"if",
"the",
"reference",
"is",
"an",
"instance",
"of",
"the",
"provided",
"class"
] | train | https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/guava/src/main/java/com/bluecatcode/common/contract/Checks.java#L415-L419 |
crnk-project/crnk-framework | crnk-core/src/main/java/io/crnk/core/engine/internal/utils/PreconditionUtil.java | PreconditionUtil.assertEquals | public static void assertEquals(String message, Object expected, Object actual) {
verifyEquals(expected, actual, message);
} | java | public static void assertEquals(String message, Object expected, Object actual) {
verifyEquals(expected, actual, message);
} | [
"public",
"static",
"void",
"assertEquals",
"(",
"String",
"message",
",",
"Object",
"expected",
",",
"Object",
"actual",
")",
"{",
"verifyEquals",
"(",
"expected",
",",
"actual",
",",
"message",
")",
";",
"}"
] | Asserts that two objects are equal. If they are not, an
{@link AssertionError} is thrown with the given message. If
<code>expected</code> and <code>actual</code> are <code>null</code>, they
are considered equal.
@param message the identifying message for the {@link AssertionError} (
<code>null</code> okay)
@param expected expected value
@param actual actual value | [
"Asserts",
"that",
"two",
"objects",
"are",
"equal",
".",
"If",
"they",
"are",
"not",
"an",
"{",
"@link",
"AssertionError",
"}",
"is",
"thrown",
"with",
"the",
"given",
"message",
".",
"If",
"<code",
">",
"expected<",
"/",
"code",
">",
"and",
"<code",
... | train | https://github.com/crnk-project/crnk-framework/blob/2fd3ef9a991788d46fd2e83b43c8ea37cbaf8681/crnk-core/src/main/java/io/crnk/core/engine/internal/utils/PreconditionUtil.java#L22-L24 |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/TemplatesApi.java | TemplatesApi.getDocumentTabs | public Tabs getDocumentTabs(String accountId, String templateId, String documentId) throws ApiException {
return getDocumentTabs(accountId, templateId, documentId, null);
} | java | public Tabs getDocumentTabs(String accountId, String templateId, String documentId) throws ApiException {
return getDocumentTabs(accountId, templateId, documentId, null);
} | [
"public",
"Tabs",
"getDocumentTabs",
"(",
"String",
"accountId",
",",
"String",
"templateId",
",",
"String",
"documentId",
")",
"throws",
"ApiException",
"{",
"return",
"getDocumentTabs",
"(",
"accountId",
",",
"templateId",
",",
"documentId",
",",
"null",
")",
... | Returns tabs on the document.
@param accountId The external account number (int) or account ID Guid. (required)
@param templateId The ID of the template being accessed. (required)
@param documentId The ID of the document being accessed. (required)
@return Tabs | [
"Returns",
"tabs",
"on",
"the",
"document",
"."
] | train | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/TemplatesApi.java#L1468-L1470 |
aws/aws-sdk-java | aws-java-sdk-core/src/main/java/com/amazonaws/util/XpathUtils.java | XpathUtils.asInteger | public static Integer asInteger(String expression, Node node, XPath xpath)
throws XPathExpressionException {
String intString = evaluateAsString(expression, node, xpath);
return (isEmptyString(intString)) ? null : Integer.parseInt(intString);
} | java | public static Integer asInteger(String expression, Node node, XPath xpath)
throws XPathExpressionException {
String intString = evaluateAsString(expression, node, xpath);
return (isEmptyString(intString)) ? null : Integer.parseInt(intString);
} | [
"public",
"static",
"Integer",
"asInteger",
"(",
"String",
"expression",
",",
"Node",
"node",
",",
"XPath",
"xpath",
")",
"throws",
"XPathExpressionException",
"{",
"String",
"intString",
"=",
"evaluateAsString",
"(",
"expression",
",",
"node",
",",
"xpath",
")"... | Same as {@link #asInteger(String, Node)} but allows an xpath to be passed
in explicitly for reuse. | [
"Same",
"as",
"{"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/XpathUtils.java#L286-L290 |
apache/flink | flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/ShardConsumer.java | ShardConsumer.getRecords | private GetRecordsResult getRecords(String shardItr, int maxNumberOfRecords) throws Exception {
GetRecordsResult getRecordsResult = null;
while (getRecordsResult == null) {
try {
getRecordsResult = kinesis.getRecords(shardItr, maxNumberOfRecords);
// Update millis behind latest so it gets reported by the millisBehindLatest gauge
Long millisBehindLatest = getRecordsResult.getMillisBehindLatest();
if (millisBehindLatest != null) {
shardMetricsReporter.setMillisBehindLatest(millisBehindLatest);
}
} catch (ExpiredIteratorException eiEx) {
LOG.warn("Encountered an unexpected expired iterator {} for shard {};" +
" refreshing the iterator ...", shardItr, subscribedShard);
shardItr = getShardIterator(lastSequenceNum);
// sleep for the fetch interval before the next getRecords attempt with the refreshed iterator
if (fetchIntervalMillis != 0) {
Thread.sleep(fetchIntervalMillis);
}
}
}
return getRecordsResult;
} | java | private GetRecordsResult getRecords(String shardItr, int maxNumberOfRecords) throws Exception {
GetRecordsResult getRecordsResult = null;
while (getRecordsResult == null) {
try {
getRecordsResult = kinesis.getRecords(shardItr, maxNumberOfRecords);
// Update millis behind latest so it gets reported by the millisBehindLatest gauge
Long millisBehindLatest = getRecordsResult.getMillisBehindLatest();
if (millisBehindLatest != null) {
shardMetricsReporter.setMillisBehindLatest(millisBehindLatest);
}
} catch (ExpiredIteratorException eiEx) {
LOG.warn("Encountered an unexpected expired iterator {} for shard {};" +
" refreshing the iterator ...", shardItr, subscribedShard);
shardItr = getShardIterator(lastSequenceNum);
// sleep for the fetch interval before the next getRecords attempt with the refreshed iterator
if (fetchIntervalMillis != 0) {
Thread.sleep(fetchIntervalMillis);
}
}
}
return getRecordsResult;
} | [
"private",
"GetRecordsResult",
"getRecords",
"(",
"String",
"shardItr",
",",
"int",
"maxNumberOfRecords",
")",
"throws",
"Exception",
"{",
"GetRecordsResult",
"getRecordsResult",
"=",
"null",
";",
"while",
"(",
"getRecordsResult",
"==",
"null",
")",
"{",
"try",
"{... | Calls {@link KinesisProxyInterface#getRecords(String, int)}, while also handling unexpected
AWS {@link ExpiredIteratorException}s to assure that we get results and don't just fail on
such occasions. The returned shard iterator within the successful {@link GetRecordsResult} should
be used for the next call to this method.
<p>Note: it is important that this method is not called again before all the records from the last result have been
fully collected with {@link ShardConsumer#deserializeRecordForCollectionAndUpdateState(UserRecord)}, otherwise
{@link ShardConsumer#lastSequenceNum} may refer to a sub-record in the middle of an aggregated record, leading to
incorrect shard iteration if the iterator had to be refreshed.
@param shardItr shard iterator to use
@param maxNumberOfRecords the maximum number of records to fetch for this getRecords attempt
@return get records result
@throws InterruptedException | [
"Calls",
"{",
"@link",
"KinesisProxyInterface#getRecords",
"(",
"String",
"int",
")",
"}",
"while",
"also",
"handling",
"unexpected",
"AWS",
"{",
"@link",
"ExpiredIteratorException",
"}",
"s",
"to",
"assure",
"that",
"we",
"get",
"results",
"and",
"don",
"t",
... | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-connectors/flink-connector-kinesis/src/main/java/org/apache/flink/streaming/connectors/kinesis/internals/ShardConsumer.java#L396-L420 |
revapi/revapi | revapi-java-spi/src/main/java/org/revapi/java/spi/CheckBase.java | CheckBase.visitMethod | @Override
public final void visitMethod(@Nullable JavaMethodElement oldMethod, @Nullable JavaMethodElement newMethod) {
depth++;
doVisitMethod(oldMethod, newMethod);
} | java | @Override
public final void visitMethod(@Nullable JavaMethodElement oldMethod, @Nullable JavaMethodElement newMethod) {
depth++;
doVisitMethod(oldMethod, newMethod);
} | [
"@",
"Override",
"public",
"final",
"void",
"visitMethod",
"(",
"@",
"Nullable",
"JavaMethodElement",
"oldMethod",
",",
"@",
"Nullable",
"JavaMethodElement",
"newMethod",
")",
"{",
"depth",
"++",
";",
"doVisitMethod",
"(",
"oldMethod",
",",
"newMethod",
")",
";"... | Please override the
{@link #doVisitMethod(JavaMethodElement, JavaMethodElement)}
instead.
@see Check#visitMethod(JavaMethodElement, JavaMethodElement) | [
"Please",
"override",
"the",
"{",
"@link",
"#doVisitMethod",
"(",
"JavaMethodElement",
"JavaMethodElement",
")",
"}",
"instead",
"."
] | train | https://github.com/revapi/revapi/blob/e070b136d977441ab96fdce067a13e7e0423295b/revapi-java-spi/src/main/java/org/revapi/java/spi/CheckBase.java#L270-L274 |
box/box-java-sdk | src/main/java/com/box/sdk/BoxFolder.java | BoxFolder.canUpload | public void canUpload(String name, long fileSize) {
URL url = UPLOAD_FILE_URL.build(this.getAPI().getBaseURL());
BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, "OPTIONS");
JsonObject parent = new JsonObject();
parent.add("id", this.getID());
JsonObject preflightInfo = new JsonObject();
preflightInfo.add("parent", parent);
preflightInfo.add("name", name);
preflightInfo.add("size", fileSize);
request.setBody(preflightInfo.toString());
BoxAPIResponse response = request.send();
response.disconnect();
} | java | public void canUpload(String name, long fileSize) {
URL url = UPLOAD_FILE_URL.build(this.getAPI().getBaseURL());
BoxJSONRequest request = new BoxJSONRequest(this.getAPI(), url, "OPTIONS");
JsonObject parent = new JsonObject();
parent.add("id", this.getID());
JsonObject preflightInfo = new JsonObject();
preflightInfo.add("parent", parent);
preflightInfo.add("name", name);
preflightInfo.add("size", fileSize);
request.setBody(preflightInfo.toString());
BoxAPIResponse response = request.send();
response.disconnect();
} | [
"public",
"void",
"canUpload",
"(",
"String",
"name",
",",
"long",
"fileSize",
")",
"{",
"URL",
"url",
"=",
"UPLOAD_FILE_URL",
".",
"build",
"(",
"this",
".",
"getAPI",
"(",
")",
".",
"getBaseURL",
"(",
")",
")",
";",
"BoxJSONRequest",
"request",
"=",
... | Checks if the file can be successfully uploaded by using the preflight check.
@param name the name to give the uploaded file.
@param fileSize the size of the file used for account capacity calculations. | [
"Checks",
"if",
"the",
"file",
"can",
"be",
"successfully",
"uploaded",
"by",
"using",
"the",
"preflight",
"check",
"."
] | train | https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxFolder.java#L427-L443 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java | SynchronousRequest.getAllWvWMatchOverview | public AllWvWMatchOverview getAllWvWMatchOverview() throws GuildWars2Exception {
try {
Response<AllWvWMatchOverview> response = gw2API.getAllWvWMatchOverview().execute();
if (!response.isSuccessful()) throwError(response.code(), response.errorBody());
return response.body();
} catch (IOException e) {
throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage());
}
} | java | public AllWvWMatchOverview getAllWvWMatchOverview() throws GuildWars2Exception {
try {
Response<AllWvWMatchOverview> response = gw2API.getAllWvWMatchOverview().execute();
if (!response.isSuccessful()) throwError(response.code(), response.errorBody());
return response.body();
} catch (IOException e) {
throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage());
}
} | [
"public",
"AllWvWMatchOverview",
"getAllWvWMatchOverview",
"(",
")",
"throws",
"GuildWars2Exception",
"{",
"try",
"{",
"Response",
"<",
"AllWvWMatchOverview",
">",
"response",
"=",
"gw2API",
".",
"getAllWvWMatchOverview",
"(",
")",
".",
"execute",
"(",
")",
";",
"... | For more info on v1 wvw matches API go <a href="https://wiki.guildwars2.com/wiki/API:1/wvw/matches">here</a><br/>
@return simple wvw matches info
@throws GuildWars2Exception see {@link ErrorCode} for detail
@see AllWvWMatchOverview wvw matches | [
"For",
"more",
"info",
"on",
"v1",
"wvw",
"matches",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"1",
"/",
"wvw",
"/",
"matches",
">",
"here<",
"/",
"a",
">",
"<br",
"... | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java#L137-L145 |
thombergs/docx-stamper | src/main/java/org/wickedsource/docxstamper/processor/CommentProcessorRegistry.java | CommentProcessorRegistry.runProcessorsOnParagraphComment | private <T> void runProcessorsOnParagraphComment(final WordprocessingMLPackage document,
final Map<BigInteger, CommentWrapper> comments, ProxyBuilder<T> proxyBuilder,
ParagraphCoordinates paragraphCoordinates) {
Comments.Comment comment = CommentUtil
.getCommentFor(paragraphCoordinates.getParagraph(), document);
if (comment == null) {
// no comment to process
return;
}
String commentString = CommentUtil.getCommentString(comment);
for (final ICommentProcessor processor : commentProcessors) {
Class<?> commentProcessorInterface = commentProcessorInterfaces.get(processor);
proxyBuilder.withInterface(commentProcessorInterface, processor);
processor.setCurrentParagraphCoordinates(paragraphCoordinates);
}
CommentWrapper commentWrapper = comments.get(comment.getId());
try {
T contextRootProxy = proxyBuilder.build();
expressionResolver.resolveExpression(commentString, contextRootProxy);
CommentUtil.deleteComment(commentWrapper);
logger.debug(
String.format("Comment '%s' has been successfully processed by a comment processor.",
commentString));
} catch (SpelEvaluationException | SpelParseException e) {
if (failOnInvalidExpression) {
throw new UnresolvedExpressionException(commentString, e);
} else {
logger.warn(String.format(
"Skipping comment expression '%s' because it can not be resolved by any comment processor. Reason: %s. Set log level to TRACE to view Stacktrace.",
commentString, e.getMessage()));
logger.trace("Reason for skipping comment: ", e);
}
} catch (ProxyException e) {
throw new DocxStamperException("Could not create a proxy around context root object", e);
}
} | java | private <T> void runProcessorsOnParagraphComment(final WordprocessingMLPackage document,
final Map<BigInteger, CommentWrapper> comments, ProxyBuilder<T> proxyBuilder,
ParagraphCoordinates paragraphCoordinates) {
Comments.Comment comment = CommentUtil
.getCommentFor(paragraphCoordinates.getParagraph(), document);
if (comment == null) {
// no comment to process
return;
}
String commentString = CommentUtil.getCommentString(comment);
for (final ICommentProcessor processor : commentProcessors) {
Class<?> commentProcessorInterface = commentProcessorInterfaces.get(processor);
proxyBuilder.withInterface(commentProcessorInterface, processor);
processor.setCurrentParagraphCoordinates(paragraphCoordinates);
}
CommentWrapper commentWrapper = comments.get(comment.getId());
try {
T contextRootProxy = proxyBuilder.build();
expressionResolver.resolveExpression(commentString, contextRootProxy);
CommentUtil.deleteComment(commentWrapper);
logger.debug(
String.format("Comment '%s' has been successfully processed by a comment processor.",
commentString));
} catch (SpelEvaluationException | SpelParseException e) {
if (failOnInvalidExpression) {
throw new UnresolvedExpressionException(commentString, e);
} else {
logger.warn(String.format(
"Skipping comment expression '%s' because it can not be resolved by any comment processor. Reason: %s. Set log level to TRACE to view Stacktrace.",
commentString, e.getMessage()));
logger.trace("Reason for skipping comment: ", e);
}
} catch (ProxyException e) {
throw new DocxStamperException("Could not create a proxy around context root object", e);
}
} | [
"private",
"<",
"T",
">",
"void",
"runProcessorsOnParagraphComment",
"(",
"final",
"WordprocessingMLPackage",
"document",
",",
"final",
"Map",
"<",
"BigInteger",
",",
"CommentWrapper",
">",
"comments",
",",
"ProxyBuilder",
"<",
"T",
">",
"proxyBuilder",
",",
"Para... | Takes the first comment on the specified paragraph and tries to evaluate
the string within the comment against all registered
{@link ICommentProcessor}s.
@param document the word document.
@param comments the comments within the document.
@param proxyBuilder a builder for a proxy around the context root object to customize its interface
@param paragraphCoordinates the paragraph whose comments to evaluate.
@param <T> the type of the context root object. | [
"Takes",
"the",
"first",
"comment",
"on",
"the",
"specified",
"paragraph",
"and",
"tries",
"to",
"evaluate",
"the",
"string",
"within",
"the",
"comment",
"against",
"all",
"registered",
"{",
"@link",
"ICommentProcessor",
"}",
"s",
"."
] | train | https://github.com/thombergs/docx-stamper/blob/f1a7e3e92a59abaffac299532fe49450c3b041eb/src/main/java/org/wickedsource/docxstamper/processor/CommentProcessorRegistry.java#L162-L202 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/props/WarningPropertySet.java | WarningPropertySet.checkProperty | public boolean checkProperty(T prop, Object value) {
Object attribute = getProperty(prop);
return (attribute != null && attribute.equals(value));
} | java | public boolean checkProperty(T prop, Object value) {
Object attribute = getProperty(prop);
return (attribute != null && attribute.equals(value));
} | [
"public",
"boolean",
"checkProperty",
"(",
"T",
"prop",
",",
"Object",
"value",
")",
"{",
"Object",
"attribute",
"=",
"getProperty",
"(",
"prop",
")",
";",
"return",
"(",
"attribute",
"!=",
"null",
"&&",
"attribute",
".",
"equals",
"(",
"value",
")",
")"... | Check whether or not the given WarningProperty has the given attribute
value.
@param prop
the WarningProperty
@param value
the attribute value
@return true if the set contains the WarningProperty and has an attribute
equal to the one given, false otherwise | [
"Check",
"whether",
"or",
"not",
"the",
"given",
"WarningProperty",
"has",
"the",
"given",
"attribute",
"value",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/props/WarningPropertySet.java#L149-L152 |
joelittlejohn/jsonschema2pojo | jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/TypeRule.java | TypeRule.getNumberType | private JType getNumberType(JCodeModel owner, GenerationConfig config) {
if (config.isUseBigDecimals()) {
return unboxIfNecessary(owner.ref(BigDecimal.class), config);
} else if (config.isUseDoubleNumbers()) {
return unboxIfNecessary(owner.ref(Double.class), config);
} else {
return unboxIfNecessary(owner.ref(Float.class), config);
}
} | java | private JType getNumberType(JCodeModel owner, GenerationConfig config) {
if (config.isUseBigDecimals()) {
return unboxIfNecessary(owner.ref(BigDecimal.class), config);
} else if (config.isUseDoubleNumbers()) {
return unboxIfNecessary(owner.ref(Double.class), config);
} else {
return unboxIfNecessary(owner.ref(Float.class), config);
}
} | [
"private",
"JType",
"getNumberType",
"(",
"JCodeModel",
"owner",
",",
"GenerationConfig",
"config",
")",
"{",
"if",
"(",
"config",
".",
"isUseBigDecimals",
"(",
")",
")",
"{",
"return",
"unboxIfNecessary",
"(",
"owner",
".",
"ref",
"(",
"BigDecimal",
".",
"c... | Returns the JType for a number field. Handles type lookup and unboxing. | [
"Returns",
"the",
"JType",
"for",
"a",
"number",
"field",
".",
"Handles",
"type",
"lookup",
"and",
"unboxing",
"."
] | train | https://github.com/joelittlejohn/jsonschema2pojo/blob/0552b80db93214eb186e4ae45b40866cc1e7eb84/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/TypeRule.java#L162-L172 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/ComparableTimSort.java | ComparableTimSort.countRunAndMakeAscending | @SuppressWarnings({"unchecked", "rawtypes"})
private static int countRunAndMakeAscending(Object[] a, int lo, int hi) {
assert lo < hi;
int runHi = lo + 1;
if (runHi == hi)
return 1;
// Find end of run, and reverse range if descending
if (((Comparable) a[runHi++]).compareTo(a[lo]) < 0) { // Descending
while (runHi < hi && ((Comparable) a[runHi]).compareTo(a[runHi - 1]) < 0)
runHi++;
reverseRange(a, lo, runHi);
} else { // Ascending
while (runHi < hi && ((Comparable) a[runHi]).compareTo(a[runHi - 1]) >= 0)
runHi++;
}
return runHi - lo;
} | java | @SuppressWarnings({"unchecked", "rawtypes"})
private static int countRunAndMakeAscending(Object[] a, int lo, int hi) {
assert lo < hi;
int runHi = lo + 1;
if (runHi == hi)
return 1;
// Find end of run, and reverse range if descending
if (((Comparable) a[runHi++]).compareTo(a[lo]) < 0) { // Descending
while (runHi < hi && ((Comparable) a[runHi]).compareTo(a[runHi - 1]) < 0)
runHi++;
reverseRange(a, lo, runHi);
} else { // Ascending
while (runHi < hi && ((Comparable) a[runHi]).compareTo(a[runHi - 1]) >= 0)
runHi++;
}
return runHi - lo;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"private",
"static",
"int",
"countRunAndMakeAscending",
"(",
"Object",
"[",
"]",
"a",
",",
"int",
"lo",
",",
"int",
"hi",
")",
"{",
"assert",
"lo",
"<",
"hi",
";",
"int",
... | Returns the length of the run beginning at the specified position in
the specified array and reverses the run if it is descending (ensuring
that the run will always be ascending when the method returns).
A run is the longest ascending sequence with:
a[lo] <= a[lo + 1] <= a[lo + 2] <= ...
or the longest descending sequence with:
a[lo] > a[lo + 1] > a[lo + 2] > ...
For its intended use in a stable mergesort, the strictness of the
definition of "descending" is needed so that the call can safely
reverse a descending sequence without violating stability.
@param a the array in which a run is to be counted and possibly reversed
@param lo index of the first element in the run
@param hi index after the last element that may be contained in the run.
It is required that {@code lo < hi}.
@return the length of the run beginning at the specified position in
the specified array | [
"Returns",
"the",
"length",
"of",
"the",
"run",
"beginning",
"at",
"the",
"specified",
"position",
"in",
"the",
"specified",
"array",
"and",
"reverses",
"the",
"run",
"if",
"it",
"is",
"descending",
"(",
"ensuring",
"that",
"the",
"run",
"will",
"always",
... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/ComparableTimSort.java#L312-L330 |
alkacon/opencms-core | src/org/opencms/ade/containerpage/CmsElementUtil.java | CmsElementUtil.checkGroupAllowed | public static boolean checkGroupAllowed(String containerType, CmsGroupContainerBean groupContainer) {
return !Sets.intersection(CmsContainer.splitType(containerType), groupContainer.getTypes()).isEmpty();
} | java | public static boolean checkGroupAllowed(String containerType, CmsGroupContainerBean groupContainer) {
return !Sets.intersection(CmsContainer.splitType(containerType), groupContainer.getTypes()).isEmpty();
} | [
"public",
"static",
"boolean",
"checkGroupAllowed",
"(",
"String",
"containerType",
",",
"CmsGroupContainerBean",
"groupContainer",
")",
"{",
"return",
"!",
"Sets",
".",
"intersection",
"(",
"CmsContainer",
".",
"splitType",
"(",
"containerType",
")",
",",
"groupCon... | Checks if a group element is allowed in a container with a given type.<p>
@param containerType the container type spec (comma separated)
@param groupContainer the group
@return true if the group is allowed in the container | [
"Checks",
"if",
"a",
"group",
"element",
"is",
"allowed",
"in",
"a",
"container",
"with",
"a",
"given",
"type",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/containerpage/CmsElementUtil.java#L284-L287 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorsInner.java | ManagedInstanceEncryptionProtectorsInner.createOrUpdateAsync | public Observable<ManagedInstanceEncryptionProtectorInner> createOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceEncryptionProtectorInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1<ServiceResponse<ManagedInstanceEncryptionProtectorInner>, ManagedInstanceEncryptionProtectorInner>() {
@Override
public ManagedInstanceEncryptionProtectorInner call(ServiceResponse<ManagedInstanceEncryptionProtectorInner> response) {
return response.body();
}
});
} | java | public Observable<ManagedInstanceEncryptionProtectorInner> createOrUpdateAsync(String resourceGroupName, String managedInstanceName, ManagedInstanceEncryptionProtectorInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, parameters).map(new Func1<ServiceResponse<ManagedInstanceEncryptionProtectorInner>, ManagedInstanceEncryptionProtectorInner>() {
@Override
public ManagedInstanceEncryptionProtectorInner call(ServiceResponse<ManagedInstanceEncryptionProtectorInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ManagedInstanceEncryptionProtectorInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"managedInstanceName",
",",
"ManagedInstanceEncryptionProtectorInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServi... | Updates an existing encryption protector.
@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 managedInstanceName The name of the managed instance.
@param parameters The requested encryption protector resource state.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Updates",
"an",
"existing",
"encryption",
"protector",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/ManagedInstanceEncryptionProtectorsInner.java#L333-L340 |
kiegroup/drools | kie-pmml/src/main/java/org/kie/pmml/assembler/PMMLAssemblerService.java | PMMLAssemblerService.getPackageDescrs | private List<PackageDescr> getPackageDescrs(Resource resource) throws DroolsParserException, IOException {
List<PMMLResource> resources = pmmlCompiler.precompile(resource.getInputStream(), null, null);
if (resources != null && !resources.isEmpty()) {
return generatedResourcesToPackageDescr(resource, resources);
}
return null;
} | java | private List<PackageDescr> getPackageDescrs(Resource resource) throws DroolsParserException, IOException {
List<PMMLResource> resources = pmmlCompiler.precompile(resource.getInputStream(), null, null);
if (resources != null && !resources.isEmpty()) {
return generatedResourcesToPackageDescr(resource, resources);
}
return null;
} | [
"private",
"List",
"<",
"PackageDescr",
">",
"getPackageDescrs",
"(",
"Resource",
"resource",
")",
"throws",
"DroolsParserException",
",",
"IOException",
"{",
"List",
"<",
"PMMLResource",
">",
"resources",
"=",
"pmmlCompiler",
".",
"precompile",
"(",
"resource",
"... | This method calls the PMML compiler to get PMMLResource objects which are used to
create one or more PackageDescr objects
@param resource
@return
@throws DroolsParserException
@throws IOException | [
"This",
"method",
"calls",
"the",
"PMML",
"compiler",
"to",
"get",
"PMMLResource",
"objects",
"which",
"are",
"used",
"to",
"create",
"one",
"or",
"more",
"PackageDescr",
"objects"
] | train | https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-pmml/src/main/java/org/kie/pmml/assembler/PMMLAssemblerService.java#L124-L130 |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/preferences/ExtraLanguagePreferenceAccess.java | ExtraLanguagePreferenceAccess.hasProjectSpecificOptions | public boolean hasProjectSpecificOptions(String preferenceContainerID, IProject project) {
final IPreferenceStore store = getWritablePreferenceStore(project);
// Compute the key
String key = IS_PROJECT_SPECIFIC;
if (preferenceContainerID != null) {
key = getPropertyPrefix(preferenceContainerID) + "." + IS_PROJECT_SPECIFIC; //$NON-NLS-1$
}
// backward compatibility
final boolean oldSettingsUsed = store.getBoolean(IS_PROJECT_SPECIFIC);
final boolean newSettingsValue = store.getBoolean(key);
if (oldSettingsUsed && !newSettingsValue) {
store.setValue(key, true);
return true;
}
return newSettingsValue;
} | java | public boolean hasProjectSpecificOptions(String preferenceContainerID, IProject project) {
final IPreferenceStore store = getWritablePreferenceStore(project);
// Compute the key
String key = IS_PROJECT_SPECIFIC;
if (preferenceContainerID != null) {
key = getPropertyPrefix(preferenceContainerID) + "." + IS_PROJECT_SPECIFIC; //$NON-NLS-1$
}
// backward compatibility
final boolean oldSettingsUsed = store.getBoolean(IS_PROJECT_SPECIFIC);
final boolean newSettingsValue = store.getBoolean(key);
if (oldSettingsUsed && !newSettingsValue) {
store.setValue(key, true);
return true;
}
return newSettingsValue;
} | [
"public",
"boolean",
"hasProjectSpecificOptions",
"(",
"String",
"preferenceContainerID",
",",
"IProject",
"project",
")",
"{",
"final",
"IPreferenceStore",
"store",
"=",
"getWritablePreferenceStore",
"(",
"project",
")",
";",
"// Compute the key",
"String",
"key",
"=",... | Replies if the project has specific configuration for extra language generation provided by the given container.
<p>This code is copied from {@link AbstractGeneratorConfigurationBlock} and its super types.
@param preferenceContainerID the identifier of the generator's preference container.
@param project the context.
@return {@code true} if the given project has a specific configuration. {@code false} if
the general configuration should be used. | [
"Replies",
"if",
"the",
"project",
"has",
"specific",
"configuration",
"for",
"extra",
"language",
"generation",
"provided",
"by",
"the",
"given",
"container",
"."
] | train | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/preferences/ExtraLanguagePreferenceAccess.java#L221-L236 |
ical4j/ical4j | src/main/java/net/fortuna/ical4j/data/CalendarParserImpl.java | CalendarParserImpl.nextToken | private int nextToken(StreamTokenizer tokeniser, Reader in, boolean ignoreEOF) throws IOException, ParserException {
int token = tokeniser.nextToken();
if (!ignoreEOF && token == StreamTokenizer.TT_EOF) {
throw new ParserException("Unexpected end of file", getLineNumber(tokeniser, in));
}
return token;
} | java | private int nextToken(StreamTokenizer tokeniser, Reader in, boolean ignoreEOF) throws IOException, ParserException {
int token = tokeniser.nextToken();
if (!ignoreEOF && token == StreamTokenizer.TT_EOF) {
throw new ParserException("Unexpected end of file", getLineNumber(tokeniser, in));
}
return token;
} | [
"private",
"int",
"nextToken",
"(",
"StreamTokenizer",
"tokeniser",
",",
"Reader",
"in",
",",
"boolean",
"ignoreEOF",
")",
"throws",
"IOException",
",",
"ParserException",
"{",
"int",
"token",
"=",
"tokeniser",
".",
"nextToken",
"(",
")",
";",
"if",
"(",
"!"... | Reads the next token from the tokeniser.
This method throws a ParseException when reading EOF.
@param tokeniser
@param in
@param ignoreEOF
@return int value of the ttype field of the tokeniser
@throws ParseException When reading EOF. | [
"Reads",
"the",
"next",
"token",
"from",
"the",
"tokeniser",
".",
"This",
"method",
"throws",
"a",
"ParseException",
"when",
"reading",
"EOF",
"."
] | train | https://github.com/ical4j/ical4j/blob/7ac4bd1ce2bb2e0a2906fb69a56fbd2d9d974156/src/main/java/net/fortuna/ical4j/data/CalendarParserImpl.java#L634-L640 |
FINRAOS/JTAF-ExtWebDriver | src/main/java/org/finra/jtaf/ewd/session/SessionManager.java | SessionManager.getNewSession | public ExtWebDriver getNewSession(String key, String value) throws Exception {
return getNewSession(key, value, true);
} | java | public ExtWebDriver getNewSession(String key, String value) throws Exception {
return getNewSession(key, value, true);
} | [
"public",
"ExtWebDriver",
"getNewSession",
"(",
"String",
"key",
",",
"String",
"value",
")",
"throws",
"Exception",
"{",
"return",
"getNewSession",
"(",
"key",
",",
"value",
",",
"true",
")",
";",
"}"
] | Create and return a new ExtWebDriver instance. The instance is
constructed with default options, with the provided key/value pair
overriding the corresponding key and value in the options, and will
become the current session. This is a convenience method for use when
only a single option needs to be overridden. If overriding multiple
options, you must use getNewSession(string-string Map, boolean)
instead.
@param key
The key whose default value will be overridden
@param value
The value to be associated with the provided key
@return A new ExtWebDriver instance which is now the current session
@throws Exception | [
"Create",
"and",
"return",
"a",
"new",
"ExtWebDriver",
"instance",
".",
"The",
"instance",
"is",
"constructed",
"with",
"default",
"options",
"with",
"the",
"provided",
"key",
"/",
"value",
"pair",
"overriding",
"the",
"corresponding",
"key",
"and",
"value",
"... | train | https://github.com/FINRAOS/JTAF-ExtWebDriver/blob/78d646def1bf0904f79b19a81df0241e07f2c73a/src/main/java/org/finra/jtaf/ewd/session/SessionManager.java#L270-L272 |
percolate/caffeine | caffeine/src/main/java/com/percolate/caffeine/DialogUtils.java | DialogUtils.quickDialog | public static AlertDialog quickDialog(final Activity context, final String message) {
final SpannableString s = new SpannableString(message); //Make links clickable
Linkify.addLinks(s, Linkify.ALL);
final Builder builder = new AlertDialog.Builder(context);
builder.setMessage(s);
builder.setPositiveButton(android.R.string.ok, closeDialogListener());
AlertDialog dialog = builder.create();
if(!context.isFinishing()) {
dialog.show();
final TextView textView = (TextView) dialog.findViewById(android.R.id.message);
if (textView != null) {
textView.setMovementMethod(LinkMovementMethod.getInstance()); //Make links clickable
}
}
return dialog;
} | java | public static AlertDialog quickDialog(final Activity context, final String message) {
final SpannableString s = new SpannableString(message); //Make links clickable
Linkify.addLinks(s, Linkify.ALL);
final Builder builder = new AlertDialog.Builder(context);
builder.setMessage(s);
builder.setPositiveButton(android.R.string.ok, closeDialogListener());
AlertDialog dialog = builder.create();
if(!context.isFinishing()) {
dialog.show();
final TextView textView = (TextView) dialog.findViewById(android.R.id.message);
if (textView != null) {
textView.setMovementMethod(LinkMovementMethod.getInstance()); //Make links clickable
}
}
return dialog;
} | [
"public",
"static",
"AlertDialog",
"quickDialog",
"(",
"final",
"Activity",
"context",
",",
"final",
"String",
"message",
")",
"{",
"final",
"SpannableString",
"s",
"=",
"new",
"SpannableString",
"(",
"message",
")",
";",
"//Make links clickable",
"Linkify",
".",
... | Show a model dialog box. The <code>android.app.AlertDialog</code> object is returned so that
you can specify an OnDismissListener (or other listeners) if required.
<b>Note:</b> show() is already called on the AlertDialog being returned.
@param context The current Context or Activity that this method is called from.
@param message Message to display in the dialog.
@return AlertDialog that is being displayed. | [
"Show",
"a",
"model",
"dialog",
"box",
".",
"The",
"<code",
">",
"android",
".",
"app",
".",
"AlertDialog<",
"/",
"code",
">",
"object",
"is",
"returned",
"so",
"that",
"you",
"can",
"specify",
"an",
"OnDismissListener",
"(",
"or",
"other",
"listeners",
... | train | https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/DialogUtils.java#L30-L47 |
davidmoten/rxjava-jdbc | src/main/java/com/github/davidmoten/rx/jdbc/QueryUpdateOnSubscribe.java | QueryUpdateOnSubscribe.performRollback | @SuppressWarnings("unchecked")
private void performRollback(Subscriber<? super T> subscriber, State state) {
debug("rolling back");
query.context().endTransactionObserve();
Conditions.checkTrue(!Util.isAutoCommit(state.con));
Util.rollback(state.con);
// must close before onNext so that connection is released and is
// available to a query that might process the onNext
close(state);
subscriber.onNext((T) Integer.valueOf(0));
debug("rolled back");
complete(subscriber);
} | java | @SuppressWarnings("unchecked")
private void performRollback(Subscriber<? super T> subscriber, State state) {
debug("rolling back");
query.context().endTransactionObserve();
Conditions.checkTrue(!Util.isAutoCommit(state.con));
Util.rollback(state.con);
// must close before onNext so that connection is released and is
// available to a query that might process the onNext
close(state);
subscriber.onNext((T) Integer.valueOf(0));
debug("rolled back");
complete(subscriber);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"void",
"performRollback",
"(",
"Subscriber",
"<",
"?",
"super",
"T",
">",
"subscriber",
",",
"State",
"state",
")",
"{",
"debug",
"(",
"\"rolling back\"",
")",
";",
"query",
".",
"context",
"(",... | Rolls back the current transaction. Throws {@link RuntimeException} if
connection is in autoCommit mode.
@param subscriber
@param state | [
"Rolls",
"back",
"the",
"current",
"transaction",
".",
"Throws",
"{",
"@link",
"RuntimeException",
"}",
"if",
"connection",
"is",
"in",
"autoCommit",
"mode",
"."
] | train | https://github.com/davidmoten/rxjava-jdbc/blob/81e157d7071a825086bde81107b8694684cdff14/src/main/java/com/github/davidmoten/rx/jdbc/QueryUpdateOnSubscribe.java#L188-L200 |
lamarios/sherdog-parser | src/main/java/com/ftpix/sherdogparser/Sherdog.java | Sherdog.getFighterFromHtml | public Fighter getFighterFromHtml(String html) throws IOException, ParseException, SherdogParserException {
return new FighterParser(pictureProcessor, zoneId).parseFromHtml(html);
} | java | public Fighter getFighterFromHtml(String html) throws IOException, ParseException, SherdogParserException {
return new FighterParser(pictureProcessor, zoneId).parseFromHtml(html);
} | [
"public",
"Fighter",
"getFighterFromHtml",
"(",
"String",
"html",
")",
"throws",
"IOException",
",",
"ParseException",
",",
"SherdogParserException",
"{",
"return",
"new",
"FighterParser",
"(",
"pictureProcessor",
",",
"zoneId",
")",
".",
"parseFromHtml",
"(",
"html... | Get a fighter via it;s sherdog page HTML
@param html The web page HTML
@return a Fighter an all his fights
@throws IOException if connecting to sherdog fails
@throws ParseException if the page structure has changed
@throws SherdogParserException if anythign related to the parser goes wrong | [
"Get",
"a",
"fighter",
"via",
"it",
";",
"s",
"sherdog",
"page",
"HTML"
] | train | https://github.com/lamarios/sherdog-parser/blob/7cdb36280317caeaaa54db77c04dc4b4e1db053e/src/main/java/com/ftpix/sherdogparser/Sherdog.java#L127-L129 |
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.getPrebuiltEntityRoles | public List<EntityRole> getPrebuiltEntityRoles(UUID appId, String versionId, UUID entityId) {
return getPrebuiltEntityRolesWithServiceResponseAsync(appId, versionId, entityId).toBlocking().single().body();
} | java | public List<EntityRole> getPrebuiltEntityRoles(UUID appId, String versionId, UUID entityId) {
return getPrebuiltEntityRolesWithServiceResponseAsync(appId, versionId, entityId).toBlocking().single().body();
} | [
"public",
"List",
"<",
"EntityRole",
">",
"getPrebuiltEntityRoles",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
")",
"{",
"return",
"getPrebuiltEntityRolesWithServiceResponseAsync",
"(",
"appId",
",",
"versionId",
",",
"entityId",
")",... | Get All Entity Roles for a given entity.
@param appId The application ID.
@param versionId The version ID.
@param entityId entity Id
@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 List<EntityRole> object if successful. | [
"Get",
"All",
"Entity",
"Roles",
"for",
"a",
"given",
"entity",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L7939-L7941 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/installed/DefaultInstalledExtensionRepository.java | DefaultInstalledExtensionRepository.addInstalledFeatureToCache | private InstalledFeature addInstalledFeatureToCache(ExtensionId feature, String namespace,
DefaultInstalledExtension installedExtension, boolean forceCreate)
{
Map<String, InstalledFeature> installedExtensionsForFeature =
this.extensionNamespaceByFeature.get(feature.getId());
if (installedExtensionsForFeature == null) {
installedExtensionsForFeature = new HashMap<String, InstalledFeature>();
this.extensionNamespaceByFeature.put(feature.getId(), installedExtensionsForFeature);
}
InstalledFeature installedFeature = installedExtensionsForFeature.get(namespace);
if (forceCreate || installedFeature == null) {
// Find or create root feature
InstalledRootFeature rootInstalledFeature;
if (installedExtension.getId().getId().equals(feature.getId())) {
rootInstalledFeature = new InstalledRootFeature(namespace);
} else {
rootInstalledFeature = getInstalledFeatureFromCache(installedExtension.getId().getId(), namespace).root;
}
// Create new feature
installedFeature = new InstalledFeature(rootInstalledFeature, feature);
// Add new feature
installedExtensionsForFeature.put(namespace, installedFeature);
}
if (installedExtension.isValid(namespace)) {
installedFeature.root.extension = installedExtension;
} else {
installedFeature.root.invalidExtensions.add(installedExtension);
}
return installedFeature;
} | java | private InstalledFeature addInstalledFeatureToCache(ExtensionId feature, String namespace,
DefaultInstalledExtension installedExtension, boolean forceCreate)
{
Map<String, InstalledFeature> installedExtensionsForFeature =
this.extensionNamespaceByFeature.get(feature.getId());
if (installedExtensionsForFeature == null) {
installedExtensionsForFeature = new HashMap<String, InstalledFeature>();
this.extensionNamespaceByFeature.put(feature.getId(), installedExtensionsForFeature);
}
InstalledFeature installedFeature = installedExtensionsForFeature.get(namespace);
if (forceCreate || installedFeature == null) {
// Find or create root feature
InstalledRootFeature rootInstalledFeature;
if (installedExtension.getId().getId().equals(feature.getId())) {
rootInstalledFeature = new InstalledRootFeature(namespace);
} else {
rootInstalledFeature = getInstalledFeatureFromCache(installedExtension.getId().getId(), namespace).root;
}
// Create new feature
installedFeature = new InstalledFeature(rootInstalledFeature, feature);
// Add new feature
installedExtensionsForFeature.put(namespace, installedFeature);
}
if (installedExtension.isValid(namespace)) {
installedFeature.root.extension = installedExtension;
} else {
installedFeature.root.invalidExtensions.add(installedExtension);
}
return installedFeature;
} | [
"private",
"InstalledFeature",
"addInstalledFeatureToCache",
"(",
"ExtensionId",
"feature",
",",
"String",
"namespace",
",",
"DefaultInstalledExtension",
"installedExtension",
",",
"boolean",
"forceCreate",
")",
"{",
"Map",
"<",
"String",
",",
"InstalledFeature",
">",
"... | Get extension registered as installed for the provided feature and namespace or can register it if provided.
<p>
Only look at provide namespace and does take into account inheritance.
@param feature the feature provided by the extension
@param namespace the namespace where the extension is installed
@param installedExtension the extension
@return the installed extension informations | [
"Get",
"extension",
"registered",
"as",
"installed",
"for",
"the",
"provided",
"feature",
"and",
"namespace",
"or",
"can",
"register",
"it",
"if",
"provided",
".",
"<p",
">",
"Only",
"look",
"at",
"provide",
"namespace",
"and",
"does",
"take",
"into",
"accou... | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/installed/DefaultInstalledExtensionRepository.java#L627-L662 |
demidenko05/beigesoft-bcommon | src/main/java/org/beigesoft/service/UtlReflection.java | UtlReflection.retrieveSetterForField | @Override
public final Method retrieveSetterForField(final Class<?> pClazz,
final String pFieldName) throws Exception {
String setterName = "set" + pFieldName.substring(0, 1).toUpperCase()
+ pFieldName.substring(1);
return retrieveMethod(pClazz, setterName);
} | java | @Override
public final Method retrieveSetterForField(final Class<?> pClazz,
final String pFieldName) throws Exception {
String setterName = "set" + pFieldName.substring(0, 1).toUpperCase()
+ pFieldName.substring(1);
return retrieveMethod(pClazz, setterName);
} | [
"@",
"Override",
"public",
"final",
"Method",
"retrieveSetterForField",
"(",
"final",
"Class",
"<",
"?",
">",
"pClazz",
",",
"final",
"String",
"pFieldName",
")",
"throws",
"Exception",
"{",
"String",
"setterName",
"=",
"\"set\"",
"+",
"pFieldName",
".",
"subs... | <p>Retrieve setter from given class by field name.</p>
@param pClazz - class
@param pFieldName - field name
@return Method setter.
@throws Exception if method not exist | [
"<p",
">",
"Retrieve",
"setter",
"from",
"given",
"class",
"by",
"field",
"name",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/demidenko05/beigesoft-bcommon/blob/bb446822b4fc9b5a6a8cd3cc98d0b3d83d718daf/src/main/java/org/beigesoft/service/UtlReflection.java#L155-L161 |
eclipse/xtext-core | org.eclipse.xtext/src/org/eclipse/xtext/linking/lazy/LazyLinkingResource.java | LazyLinkingResource.resolveLazyCrossReference | protected void resolveLazyCrossReference(InternalEObject source, EStructuralFeature crossRef) {
if (isPotentialLazyCrossReference(crossRef)) {
doResolveLazyCrossReference(source, crossRef);
}
} | java | protected void resolveLazyCrossReference(InternalEObject source, EStructuralFeature crossRef) {
if (isPotentialLazyCrossReference(crossRef)) {
doResolveLazyCrossReference(source, crossRef);
}
} | [
"protected",
"void",
"resolveLazyCrossReference",
"(",
"InternalEObject",
"source",
",",
"EStructuralFeature",
"crossRef",
")",
"{",
"if",
"(",
"isPotentialLazyCrossReference",
"(",
"crossRef",
")",
")",
"{",
"doResolveLazyCrossReference",
"(",
"source",
",",
"crossRef"... | If the given {@code crossRef} may hold lazy linking proxies, they are attempted to be resolved.
@since 2.4
@see #isPotentialLazyCrossReference(EStructuralFeature)
@see #doResolveLazyCrossReference(InternalEObject, EStructuralFeature) | [
"If",
"the",
"given",
"{"
] | train | https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/src/org/eclipse/xtext/linking/lazy/LazyLinkingResource.java#L160-L164 |
stratosphere/stratosphere | stratosphere-core/src/main/java/eu/stratosphere/api/common/io/BinaryInputFormat.java | BinaryInputFormat.createStatistics | protected SequentialStatistics createStatistics(List<FileStatus> files, FileBaseStatistics stats)
throws IOException {
if (files.isEmpty()) {
return null;
}
BlockInfo blockInfo = this.createBlockInfo();
long totalCount = 0;
for (FileStatus file : files) {
// invalid file
if (file.getLen() < blockInfo.getInfoSize()) {
continue;
}
FSDataInputStream fdis = file.getPath().getFileSystem().open(file.getPath(), blockInfo.getInfoSize());
fdis.seek(file.getLen() - blockInfo.getInfoSize());
DataInputStream input = new DataInputStream(fdis);
blockInfo.read(input);
totalCount += blockInfo.getAccumulatedRecordCount();
}
final float avgWidth = totalCount == 0 ? 0 : ((float) stats.getTotalInputSize() / totalCount);
return new SequentialStatistics(stats.getLastModificationTime(), stats.getTotalInputSize(), avgWidth,
totalCount);
} | java | protected SequentialStatistics createStatistics(List<FileStatus> files, FileBaseStatistics stats)
throws IOException {
if (files.isEmpty()) {
return null;
}
BlockInfo blockInfo = this.createBlockInfo();
long totalCount = 0;
for (FileStatus file : files) {
// invalid file
if (file.getLen() < blockInfo.getInfoSize()) {
continue;
}
FSDataInputStream fdis = file.getPath().getFileSystem().open(file.getPath(), blockInfo.getInfoSize());
fdis.seek(file.getLen() - blockInfo.getInfoSize());
DataInputStream input = new DataInputStream(fdis);
blockInfo.read(input);
totalCount += blockInfo.getAccumulatedRecordCount();
}
final float avgWidth = totalCount == 0 ? 0 : ((float) stats.getTotalInputSize() / totalCount);
return new SequentialStatistics(stats.getLastModificationTime(), stats.getTotalInputSize(), avgWidth,
totalCount);
} | [
"protected",
"SequentialStatistics",
"createStatistics",
"(",
"List",
"<",
"FileStatus",
">",
"files",
",",
"FileBaseStatistics",
"stats",
")",
"throws",
"IOException",
"{",
"if",
"(",
"files",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
... | Fill in the statistics. The last modification time and the total input size are prefilled.
@param files
The files that are associated with this block input format.
@param stats
The pre-filled statistics. | [
"Fill",
"in",
"the",
"statistics",
".",
"The",
"last",
"modification",
"time",
"and",
"the",
"total",
"input",
"size",
"are",
"prefilled",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-core/src/main/java/eu/stratosphere/api/common/io/BinaryInputFormat.java#L197-L223 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/QrcodeAPI.java | QrcodeAPI.qrcodeCreateTemp | public static QrcodeTicket qrcodeCreateTemp(String access_token,int expire_seconds,long scene_id){
String json = String.format("{\"expire_seconds\": %d, \"action_name\": \"QR_SCENE\", \"action_info\": {\"scene\": {\"scene_id\": %d}}}",expire_seconds,scene_id);
return qrcodeCreate(access_token,json);
} | java | public static QrcodeTicket qrcodeCreateTemp(String access_token,int expire_seconds,long scene_id){
String json = String.format("{\"expire_seconds\": %d, \"action_name\": \"QR_SCENE\", \"action_info\": {\"scene\": {\"scene_id\": %d}}}",expire_seconds,scene_id);
return qrcodeCreate(access_token,json);
} | [
"public",
"static",
"QrcodeTicket",
"qrcodeCreateTemp",
"(",
"String",
"access_token",
",",
"int",
"expire_seconds",
",",
"long",
"scene_id",
")",
"{",
"String",
"json",
"=",
"String",
".",
"format",
"(",
"\"{\\\"expire_seconds\\\": %d, \\\"action_name\\\": \\\"QR_SCENE\\... | 创建临时二维码
@param access_token access_token
@param expire_seconds 最大不超过604800秒(即30天)
@param scene_id 场景值ID,32位非0整型 最多10万个
@return QrcodeTicket | [
"创建临时二维码"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/QrcodeAPI.java#L55-L58 |
LearnLib/automatalib | util/src/main/java/net/automatalib/util/ts/copy/TSCopy.java | TSCopy.copy | public static <S1, I1, T1, SP1, TP1, S2, I2, T2, SP2, TP2> Mapping<S1, S2> copy(TSTraversalMethod method,
UniversalTransitionSystem<S1, ? super I1, T1, ? extends SP1, ? extends TP1> in,
int limit,
Collection<? extends I1> inputs,
MutableAutomaton<S2, I2, T2, ? super SP2, ? super TP2> out,
Function<? super I1, ? extends I2> inputsMapping,
Function<? super SP1, ? extends SP2> spTransform,
Function<? super TP1, ? extends TP2> tpTransform,
Predicate<? super S1> stateFilter,
TransitionPredicate<? super S1, ? super I1, ? super T1> transFilter) {
Function<? super S1, ? extends SP2> spMapping =
(spTransform == null) ? null : TS.stateProperties(in).andThen(spTransform);
Function<? super T1, ? extends TP2> tpMapping =
(tpTransform == null) ? null : TS.transitionProperties(in).andThen(tpTransform);
return rawCopy(method, in, limit, inputs, out, inputsMapping, spMapping, tpMapping, stateFilter, transFilter);
} | java | public static <S1, I1, T1, SP1, TP1, S2, I2, T2, SP2, TP2> Mapping<S1, S2> copy(TSTraversalMethod method,
UniversalTransitionSystem<S1, ? super I1, T1, ? extends SP1, ? extends TP1> in,
int limit,
Collection<? extends I1> inputs,
MutableAutomaton<S2, I2, T2, ? super SP2, ? super TP2> out,
Function<? super I1, ? extends I2> inputsMapping,
Function<? super SP1, ? extends SP2> spTransform,
Function<? super TP1, ? extends TP2> tpTransform,
Predicate<? super S1> stateFilter,
TransitionPredicate<? super S1, ? super I1, ? super T1> transFilter) {
Function<? super S1, ? extends SP2> spMapping =
(spTransform == null) ? null : TS.stateProperties(in).andThen(spTransform);
Function<? super T1, ? extends TP2> tpMapping =
(tpTransform == null) ? null : TS.transitionProperties(in).andThen(tpTransform);
return rawCopy(method, in, limit, inputs, out, inputsMapping, spMapping, tpMapping, stateFilter, transFilter);
} | [
"public",
"static",
"<",
"S1",
",",
"I1",
",",
"T1",
",",
"SP1",
",",
"TP1",
",",
"S2",
",",
"I2",
",",
"T2",
",",
"SP2",
",",
"TP2",
">",
"Mapping",
"<",
"S1",
",",
"S2",
">",
"copy",
"(",
"TSTraversalMethod",
"method",
",",
"UniversalTransitionSy... | Copies a {@link UniversalAutomaton} to a {@link MutableAutomaton} with possibly heterogeneous input alphabets and
state and transition properties.
@param method
the traversal method to use
@param in
the input transition system
@param limit
the traversal limit, a value less than 0 means no limit
@param inputs
the inputs to consider
@param out
the output automaton
@param inputsMapping
the transformation for input symbols
@param spTransform
the transformation for state properties
@param tpTransform
the transformation for transition properties
@param stateFilter
the filter predicate for states
@param transFilter
the filter predicate for transitions
@return a mapping from old to new states | [
"Copies",
"a",
"{",
"@link",
"UniversalAutomaton",
"}",
"to",
"a",
"{",
"@link",
"MutableAutomaton",
"}",
"with",
"possibly",
"heterogeneous",
"input",
"alphabets",
"and",
"state",
"and",
"transition",
"properties",
"."
] | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/util/src/main/java/net/automatalib/util/ts/copy/TSCopy.java#L294-L309 |
knowm/XChange | xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/service/CoinbaseAccountServiceRaw.java | CoinbaseAccountServiceRaw.getCoinbaseRecurringPayments | public CoinbaseRecurringPayments getCoinbaseRecurringPayments(Integer page, final Integer limit)
throws IOException {
final CoinbaseRecurringPayments recurringPayments =
coinbase.getRecurringPayments(
page,
limit,
exchange.getExchangeSpecification().getApiKey(),
signatureCreator,
exchange.getNonceFactory());
return recurringPayments;
} | java | public CoinbaseRecurringPayments getCoinbaseRecurringPayments(Integer page, final Integer limit)
throws IOException {
final CoinbaseRecurringPayments recurringPayments =
coinbase.getRecurringPayments(
page,
limit,
exchange.getExchangeSpecification().getApiKey(),
signatureCreator,
exchange.getNonceFactory());
return recurringPayments;
} | [
"public",
"CoinbaseRecurringPayments",
"getCoinbaseRecurringPayments",
"(",
"Integer",
"page",
",",
"final",
"Integer",
"limit",
")",
"throws",
"IOException",
"{",
"final",
"CoinbaseRecurringPayments",
"recurringPayments",
"=",
"coinbase",
".",
"getRecurringPayments",
"(",
... | Authenticated resource that lets you list all your recurring payments (scheduled buys, sells,
and subscriptions you’ve created with merchants).
@param page Optional parameter to request a desired page of results. Will return page 1 if the
supplied page is null or less than 1.
@param limit Optional parameter to limit the maximum number of results to return. Will return
up to 25 results by default if null or less than 1.
@return
@throws IOException
@see <a
href="https://coinbase.com/api/doc/1.0/recurring_payments/index.html">coinbase.com/api/doc/1.0/recurring_payments/index.html</a> | [
"Authenticated",
"resource",
"that",
"lets",
"you",
"list",
"all",
"your",
"recurring",
"payments",
"(",
"scheduled",
"buys",
"sells",
"and",
"subscriptions",
"you’ve",
"created",
"with",
"merchants",
")",
"."
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-coinbase/src/main/java/org/knowm/xchange/coinbase/service/CoinbaseAccountServiceRaw.java#L623-L634 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java | SqlQueryStatement.appendSubQuery | private void appendSubQuery(Query subQuery, StringBuffer buf)
{
buf.append(" (");
buf.append(getSubQuerySQL(subQuery));
buf.append(") ");
} | java | private void appendSubQuery(Query subQuery, StringBuffer buf)
{
buf.append(" (");
buf.append(getSubQuerySQL(subQuery));
buf.append(") ");
} | [
"private",
"void",
"appendSubQuery",
"(",
"Query",
"subQuery",
",",
"StringBuffer",
"buf",
")",
"{",
"buf",
".",
"append",
"(",
"\" (\"",
")",
";",
"buf",
".",
"append",
"(",
"getSubQuerySQL",
"(",
"subQuery",
")",
")",
";",
"buf",
".",
"append",
"(",
... | Append a SubQuery the SQL-Clause
@param subQuery the subQuery value of SelectionCriteria | [
"Append",
"a",
"SubQuery",
"the",
"SQL",
"-",
"Clause"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java#L971-L976 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/gfx/context/VmlPathDecoder.java | VmlPathDecoder.decodeLine | private static String decodeLine(LineString line, float scale) {
if (line == null || line.isEmpty()) {
return "";
}
StringBuilder buffer = new StringBuilder();
addCoordinates(buffer, line.getCoordinates(), scale);
buffer.append(" e ");
return buffer.toString();
} | java | private static String decodeLine(LineString line, float scale) {
if (line == null || line.isEmpty()) {
return "";
}
StringBuilder buffer = new StringBuilder();
addCoordinates(buffer, line.getCoordinates(), scale);
buffer.append(" e ");
return buffer.toString();
} | [
"private",
"static",
"String",
"decodeLine",
"(",
"LineString",
"line",
",",
"float",
"scale",
")",
"{",
"if",
"(",
"line",
"==",
"null",
"||",
"line",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"\"\"",
";",
"}",
"StringBuilder",
"buffer",
"=",
"new... | Convert {@link LineString} to a VML string.
@param line
line to convert
@param scale
scale to use
@return vml string representation of linestring | [
"Convert",
"{",
"@link",
"LineString",
"}",
"to",
"a",
"VML",
"string",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/VmlPathDecoder.java#L86-L94 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceShipmentPersistenceImpl.java | CommerceShipmentPersistenceImpl.findAll | @Override
public List<CommerceShipment> findAll(int start, int end) {
return findAll(start, end, null);
} | java | @Override
public List<CommerceShipment> findAll(int start, int end) {
return findAll(start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceShipment",
">",
"findAll",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findAll",
"(",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the commerce shipments.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceShipmentModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param start the lower bound of the range of commerce shipments
@param end the upper bound of the range of commerce shipments (not inclusive)
@return the range of commerce shipments | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"shipments",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceShipmentPersistenceImpl.java#L1682-L1685 |
JodaOrg/joda-time | src/main/java/org/joda/time/Period.java | Period.withPeriodType | public Period withPeriodType(PeriodType type) {
type = DateTimeUtils.getPeriodType(type);
if (type.equals(getPeriodType())) {
return this;
}
return new Period(this, type);
} | java | public Period withPeriodType(PeriodType type) {
type = DateTimeUtils.getPeriodType(type);
if (type.equals(getPeriodType())) {
return this;
}
return new Period(this, type);
} | [
"public",
"Period",
"withPeriodType",
"(",
"PeriodType",
"type",
")",
"{",
"type",
"=",
"DateTimeUtils",
".",
"getPeriodType",
"(",
"type",
")",
";",
"if",
"(",
"type",
".",
"equals",
"(",
"getPeriodType",
"(",
")",
")",
")",
"{",
"return",
"this",
";",
... | Creates a new Period instance with the same field values but
different PeriodType.
<p>
This period instance is immutable and unaffected by this method call.
@param type the period type to use, null means standard
@return the new period instance
@throws IllegalArgumentException if the new period won't accept all of the current fields | [
"Creates",
"a",
"new",
"Period",
"instance",
"with",
"the",
"same",
"field",
"values",
"but",
"different",
"PeriodType",
".",
"<p",
">",
"This",
"period",
"instance",
"is",
"immutable",
"and",
"unaffected",
"by",
"this",
"method",
"call",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Period.java#L835-L841 |
alkacon/opencms-core | src/org/opencms/main/OpenCmsServlet.java | OpenCmsServlet.invokeHandler | protected void invokeHandler(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
String name = OpenCmsCore.getInstance().getPathInfo(req).substring(HANDLE_PATH.length());
I_CmsRequestHandler handler = OpenCmsCore.getInstance().getRequestHandler(name);
if ((handler == null) && name.contains("/")) {
// if the name contains a '/', also check for handlers matching the first path fragment only
name = name.substring(0, name.indexOf("/"));
handler = OpenCmsCore.getInstance().getRequestHandler(name);
}
if (handler != null) {
handler.handle(req, res, name);
} else {
openErrorHandler(req, res, HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
} | java | protected void invokeHandler(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
String name = OpenCmsCore.getInstance().getPathInfo(req).substring(HANDLE_PATH.length());
I_CmsRequestHandler handler = OpenCmsCore.getInstance().getRequestHandler(name);
if ((handler == null) && name.contains("/")) {
// if the name contains a '/', also check for handlers matching the first path fragment only
name = name.substring(0, name.indexOf("/"));
handler = OpenCmsCore.getInstance().getRequestHandler(name);
}
if (handler != null) {
handler.handle(req, res, name);
} else {
openErrorHandler(req, res, HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
}
} | [
"protected",
"void",
"invokeHandler",
"(",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"res",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"String",
"name",
"=",
"OpenCmsCore",
".",
"getInstance",
"(",
")",
".",
"getPathInfo",
"(",
"req... | Manages requests to internal OpenCms request handlers.<p>
@param req the current request
@param res the current response
@throws ServletException in case an error occurs
@throws ServletException in case an error occurs
@throws IOException in case an error occurs | [
"Manages",
"requests",
"to",
"internal",
"OpenCms",
"request",
"handlers",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/OpenCmsServlet.java#L282-L296 |
aol/cyclops | cyclops-futurestream/src/main/java/cyclops/stream/StreamSource.java | StreamSource.reactiveSeq | public <T> PushableReactiveSeq<T> reactiveSeq() {
final Queue<T> q = createQueue();
return new PushableReactiveSeq<T>(
q, q.stream());
} | java | public <T> PushableReactiveSeq<T> reactiveSeq() {
final Queue<T> q = createQueue();
return new PushableReactiveSeq<T>(
q, q.stream());
} | [
"public",
"<",
"T",
">",
"PushableReactiveSeq",
"<",
"T",
">",
"reactiveSeq",
"(",
")",
"{",
"final",
"Queue",
"<",
"T",
">",
"q",
"=",
"createQueue",
"(",
")",
";",
"return",
"new",
"PushableReactiveSeq",
"<",
"T",
">",
"(",
"q",
",",
"q",
".",
"s... | Create a pushable {@link PushableReactiveSeq}
<pre>
{@code
PushableReactiveSeq<Integer> pushable = StreamSource.ofUnbounded()
.reactiveSeq();
pushable.getInput()
.add(10);
on another thread
pushable.getStream()
.collect(CyclopsCollectors.toList()) //[10]
}
</pre>
@return PushableStream that can accept data to push into a {@see cyclops2.stream.ReactiveSeq}
to push it to the Stream | [
"Create",
"a",
"pushable",
"{",
"@link",
"PushableReactiveSeq",
"}"
] | train | https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-futurestream/src/main/java/cyclops/stream/StreamSource.java#L524-L528 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/MaterialAPI.java | MaterialAPI.add_material | public static Media add_material(String access_token,MediaType mediaType,File media,Description description){
HttpPost httpPost = new HttpPost(BASE_URI+"/cgi-bin/material/add_material");
FileBody bin = new FileBody(media);
MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create()
.addPart("media", bin);
if(description != null){
multipartEntityBuilder.addTextBody("description", JsonUtil.toJSONString(description),ContentType.create("text/plain",Charset.forName("utf-8")));
}
HttpEntity reqEntity = multipartEntityBuilder.addTextBody(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
.addTextBody("type",mediaType.uploadType())
.build();
httpPost.setEntity(reqEntity);
return LocalHttpClient.executeJsonResult(httpPost,Media.class);
} | java | public static Media add_material(String access_token,MediaType mediaType,File media,Description description){
HttpPost httpPost = new HttpPost(BASE_URI+"/cgi-bin/material/add_material");
FileBody bin = new FileBody(media);
MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create()
.addPart("media", bin);
if(description != null){
multipartEntityBuilder.addTextBody("description", JsonUtil.toJSONString(description),ContentType.create("text/plain",Charset.forName("utf-8")));
}
HttpEntity reqEntity = multipartEntityBuilder.addTextBody(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
.addTextBody("type",mediaType.uploadType())
.build();
httpPost.setEntity(reqEntity);
return LocalHttpClient.executeJsonResult(httpPost,Media.class);
} | [
"public",
"static",
"Media",
"add_material",
"(",
"String",
"access_token",
",",
"MediaType",
"mediaType",
",",
"File",
"media",
",",
"Description",
"description",
")",
"{",
"HttpPost",
"httpPost",
"=",
"new",
"HttpPost",
"(",
"BASE_URI",
"+",
"\"/cgi-bin/material... | 新增其他类型永久素材
@param access_token access_token
@param mediaType mediaType
@param media 多媒体文件有格式和大小限制,如下:
图片(image): 2M,支持bmp/png/jpeg/jpg/gif格式
语音(voice):5M,播放长度不超过60s,支持AMR\MP3格式
视频(video):10MB,支持MP4格式
缩略图(thumb):64KB,支持JPG格式
@param description 视频文件类型额外字段,其它类型不用添加
@return Media | [
"新增其他类型永久素材"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/MaterialAPI.java#L80-L93 |
apache/reef | lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/util/walk/graphviz/GraphvizConfigVisitor.java | GraphvizConfigVisitor.visit | @Override
public boolean visit(final Node nodeFrom, final Node nodeTo) {
if (!nodeFrom.getName().isEmpty()) {
this.graphStr
.append(" ")
.append(nodeFrom.getName())
.append(" -> ")
.append(nodeTo.getName())
.append(" [style=solid, dir=back, arrowtail=diamond];\n");
}
return true;
} | java | @Override
public boolean visit(final Node nodeFrom, final Node nodeTo) {
if (!nodeFrom.getName().isEmpty()) {
this.graphStr
.append(" ")
.append(nodeFrom.getName())
.append(" -> ")
.append(nodeTo.getName())
.append(" [style=solid, dir=back, arrowtail=diamond];\n");
}
return true;
} | [
"@",
"Override",
"public",
"boolean",
"visit",
"(",
"final",
"Node",
"nodeFrom",
",",
"final",
"Node",
"nodeTo",
")",
"{",
"if",
"(",
"!",
"nodeFrom",
".",
"getName",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"this",
".",
"graphStr",
".",
"append... | Process current edge of the configuration graph.
@param nodeFrom Current configuration node.
@param nodeTo Destination configuration node.
@return true to proceed with the next node, false to cancel. | [
"Process",
"current",
"edge",
"of",
"the",
"configuration",
"graph",
"."
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-tang/tang/src/main/java/org/apache/reef/tang/util/walk/graphviz/GraphvizConfigVisitor.java#L232-L243 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/spec/DESedeKeySpec.java | DESedeKeySpec.isParityAdjusted | public static boolean isParityAdjusted(byte[] key, int offset)
throws InvalidKeyException {
if (key.length - offset < 24) {
throw new InvalidKeyException("Wrong key size");
}
if (DESKeySpec.isParityAdjusted(key, offset) == false
|| DESKeySpec.isParityAdjusted(key, offset + 8) == false
|| DESKeySpec.isParityAdjusted(key, offset + 16) == false) {
return false;
}
return true;
} | java | public static boolean isParityAdjusted(byte[] key, int offset)
throws InvalidKeyException {
if (key.length - offset < 24) {
throw new InvalidKeyException("Wrong key size");
}
if (DESKeySpec.isParityAdjusted(key, offset) == false
|| DESKeySpec.isParityAdjusted(key, offset + 8) == false
|| DESKeySpec.isParityAdjusted(key, offset + 16) == false) {
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"isParityAdjusted",
"(",
"byte",
"[",
"]",
"key",
",",
"int",
"offset",
")",
"throws",
"InvalidKeyException",
"{",
"if",
"(",
"key",
".",
"length",
"-",
"offset",
"<",
"24",
")",
"{",
"throw",
"new",
"InvalidKeyException",
"(... | Checks if the given DES-EDE key, starting at <code>offset</code>
inclusive, is parity-adjusted.
@param key a byte array which holds the key value
@param offset the offset into the byte array
@return true if the given DES-EDE key is parity-adjusted, false
otherwise
@exception NullPointerException if <code>key</code> is null.
@exception InvalidKeyException if the given key material, starting at
<code>offset</code> inclusive, is shorter than 24 bytes | [
"Checks",
"if",
"the",
"given",
"DES",
"-",
"EDE",
"key",
"starting",
"at",
"<code",
">",
"offset<",
"/",
"code",
">",
"inclusive",
"is",
"parity",
"-",
"adjusted",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/spec/DESedeKeySpec.java#L114-L125 |
pippo-java/pippo | pippo-core/src/main/java/ro/pippo/core/ParameterValue.java | ParameterValue.toSet | public <T> Set<T> toSet(Class<T> classOfT) {
return toSet(classOfT, null);
} | java | public <T> Set<T> toSet(Class<T> classOfT) {
return toSet(classOfT, null);
} | [
"public",
"<",
"T",
">",
"Set",
"<",
"T",
">",
"toSet",
"(",
"Class",
"<",
"T",
">",
"classOfT",
")",
"{",
"return",
"toSet",
"(",
"classOfT",
",",
"null",
")",
";",
"}"
] | Converts a string value(s) to a Set of the target type.
@param classOfT
@return a set of the values | [
"Converts",
"a",
"string",
"value",
"(",
"s",
")",
"to",
"a",
"Set",
"of",
"the",
"target",
"type",
"."
] | train | https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/ParameterValue.java#L288-L290 |
aspectran/aspectran | core/src/main/java/com/aspectran/core/util/MethodUtils.java | MethodUtils.invokeStaticMethod | public static Object invokeStaticMethod(Class<?> objectClass, String methodName, Object arg)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
Object[] args = { arg };
return invokeStaticMethod(objectClass, methodName, args);
} | java | public static Object invokeStaticMethod(Class<?> objectClass, String methodName, Object arg)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
Object[] args = { arg };
return invokeStaticMethod(objectClass, methodName, args);
} | [
"public",
"static",
"Object",
"invokeStaticMethod",
"(",
"Class",
"<",
"?",
">",
"objectClass",
",",
"String",
"methodName",
",",
"Object",
"arg",
")",
"throws",
"NoSuchMethodException",
",",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"Object",
... | <p>Invoke a named static method whose parameter type matches the object type.</p>
<p>The behaviour of this method is less deterministic
than {@link #invokeExactMethod(Object, String, Object[], Class[])}.
It loops through all methods with names that match
and then executes the first it finds with compatible parameters.</p>
<p>This method supports calls to methods taking primitive parameters
via passing in wrapping classes. So, for example, a {@code Boolean} class
would match a {@code boolean} primitive.</p>
<p> This is a convenient wrapper for
{@link #invokeStaticMethod(Class objectClass,String methodName,Object[] args)}.
</p>
@param objectClass invoke static method on this class
@param methodName get method with this name
@param arg use this argument
@return the value returned by the invoked method
@throws NoSuchMethodException if there is no such accessible method
@throws InvocationTargetException wraps an exception thrown by the method invoked
@throws IllegalAccessException if the requested method is not accessible via reflection | [
"<p",
">",
"Invoke",
"a",
"named",
"static",
"method",
"whose",
"parameter",
"type",
"matches",
"the",
"object",
"type",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/MethodUtils.java#L429-L433 |
Netflix/conductor | client/src/main/java/com/netflix/conductor/client/http/WorkflowClient.java | WorkflowClient.rerunWorkflow | public String rerunWorkflow(String workflowId, RerunWorkflowRequest rerunWorkflowRequest) {
Preconditions.checkArgument(StringUtils.isNotBlank(workflowId), "workflow id cannot be blank");
Preconditions.checkNotNull(rerunWorkflowRequest, "RerunWorkflowRequest cannot be null");
return postForEntity("workflow/{workflowId}/rerun", rerunWorkflowRequest, null, String.class, workflowId);
} | java | public String rerunWorkflow(String workflowId, RerunWorkflowRequest rerunWorkflowRequest) {
Preconditions.checkArgument(StringUtils.isNotBlank(workflowId), "workflow id cannot be blank");
Preconditions.checkNotNull(rerunWorkflowRequest, "RerunWorkflowRequest cannot be null");
return postForEntity("workflow/{workflowId}/rerun", rerunWorkflowRequest, null, String.class, workflowId);
} | [
"public",
"String",
"rerunWorkflow",
"(",
"String",
"workflowId",
",",
"RerunWorkflowRequest",
"rerunWorkflowRequest",
")",
"{",
"Preconditions",
".",
"checkArgument",
"(",
"StringUtils",
".",
"isNotBlank",
"(",
"workflowId",
")",
",",
"\"workflow id cannot be blank\"",
... | Reruns the workflow from a specific task
@param workflowId the id of the workflow
@param rerunWorkflowRequest the request containing the task to rerun from
@return the id of the workflow | [
"Reruns",
"the",
"workflow",
"from",
"a",
"specific",
"task"
] | train | https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/client/src/main/java/com/netflix/conductor/client/http/WorkflowClient.java#L278-L283 |
haraldk/TwelveMonkeys | sandbox/sandbox-servlet/src/main/java/com/twelvemonkeys/servlet/jsp/droplet/taglib/IncludeTag.java | IncludeTag.addParameter | public void addParameter(String pName, Object pValue) {
// Check that we haven't already saved this parameter
if (!parameterNames.contains(pName)) {
parameterNames.add(pName);
// Now check if this parameter already exists in the page.
Object obj = getRequest().getAttribute(pName);
if (obj != null) {
oldParameters.put(pName, obj);
}
}
// Finally, insert the parameter in the request scope.
getRequest().setAttribute(pName, pValue);
} | java | public void addParameter(String pName, Object pValue) {
// Check that we haven't already saved this parameter
if (!parameterNames.contains(pName)) {
parameterNames.add(pName);
// Now check if this parameter already exists in the page.
Object obj = getRequest().getAttribute(pName);
if (obj != null) {
oldParameters.put(pName, obj);
}
}
// Finally, insert the parameter in the request scope.
getRequest().setAttribute(pName, pValue);
} | [
"public",
"void",
"addParameter",
"(",
"String",
"pName",
",",
"Object",
"pValue",
")",
"{",
"// Check that we haven't already saved this parameter\r",
"if",
"(",
"!",
"parameterNames",
".",
"contains",
"(",
"pName",
")",
")",
"{",
"parameterNames",
".",
"add",
"(... | Adds a parameter to the {@code PageContext.REQUEST_SCOPE} scope.
If a parameter with the same name as {@code pName} already exists,
then the old parameter is first placed in the {@code OldParameters}
member variable. When this tag is finished, the old value will be
restored.
@param pName The name of the new parameter to be stored in the
{@code PageContext.REQUEST_SCOPE} scope.
@param pValue The value for the parmeter to be stored in the {@code
PageContext.REQUEST_SCOPE} scope. | [
"Adds",
"a",
"parameter",
"to",
"the",
"{",
"@code",
"PageContext",
".",
"REQUEST_SCOPE",
"}",
"scope",
".",
"If",
"a",
"parameter",
"with",
"the",
"same",
"name",
"as",
"{",
"@code",
"pName",
"}",
"already",
"exists",
"then",
"the",
"old",
"parameter",
... | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-servlet/src/main/java/com/twelvemonkeys/servlet/jsp/droplet/taglib/IncludeTag.java#L86-L100 |
looly/hutool | hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java | ServletUtil.getClientIPByHeader | public static String getClientIPByHeader(HttpServletRequest request, String... headerNames) {
String ip;
for (String header : headerNames) {
ip = request.getHeader(header);
if (false == isUnknow(ip)) {
return getMultistageReverseProxyIp(ip);
}
}
ip = request.getRemoteAddr();
return getMultistageReverseProxyIp(ip);
} | java | public static String getClientIPByHeader(HttpServletRequest request, String... headerNames) {
String ip;
for (String header : headerNames) {
ip = request.getHeader(header);
if (false == isUnknow(ip)) {
return getMultistageReverseProxyIp(ip);
}
}
ip = request.getRemoteAddr();
return getMultistageReverseProxyIp(ip);
} | [
"public",
"static",
"String",
"getClientIPByHeader",
"(",
"HttpServletRequest",
"request",
",",
"String",
"...",
"headerNames",
")",
"{",
"String",
"ip",
";",
"for",
"(",
"String",
"header",
":",
"headerNames",
")",
"{",
"ip",
"=",
"request",
".",
"getHeader",... | 获取客户端IP
<p>
headerNames参数用于自定义检测的Header<br>
需要注意的是,使用此方法获取的客户IP地址必须在Http服务器(例如Nginx)中配置头信息,否则容易造成IP伪造。
</p>
@param request 请求对象{@link HttpServletRequest}
@param headerNames 自定义头,通常在Http服务器(例如Nginx)中配置
@return IP地址
@since 4.4.1 | [
"获取客户端IP"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/servlet/ServletUtil.java#L222-L233 |
CloudSlang/cs-actions | cs-xml/src/main/java/io/cloudslang/content/xml/utils/DocumentUtils.java | DocumentUtils.documentToString | public static String documentToString(Document xmlDocument) throws IOException {
String encoding = (xmlDocument.getXmlEncoding() == null) ? "UTF-8" : xmlDocument.getXmlEncoding();
OutputFormat format = new OutputFormat(xmlDocument);
format.setLineWidth(65);
format.setIndenting(true);
format.setIndent(2);
format.setEncoding(encoding);
try (Writer out = new StringWriter()) {
XMLSerializer serializer = new XMLSerializer(out, format);
serializer.serialize(xmlDocument);
return out.toString();
}
} | java | public static String documentToString(Document xmlDocument) throws IOException {
String encoding = (xmlDocument.getXmlEncoding() == null) ? "UTF-8" : xmlDocument.getXmlEncoding();
OutputFormat format = new OutputFormat(xmlDocument);
format.setLineWidth(65);
format.setIndenting(true);
format.setIndent(2);
format.setEncoding(encoding);
try (Writer out = new StringWriter()) {
XMLSerializer serializer = new XMLSerializer(out, format);
serializer.serialize(xmlDocument);
return out.toString();
}
} | [
"public",
"static",
"String",
"documentToString",
"(",
"Document",
"xmlDocument",
")",
"throws",
"IOException",
"{",
"String",
"encoding",
"=",
"(",
"xmlDocument",
".",
"getXmlEncoding",
"(",
")",
"==",
"null",
")",
"?",
"\"UTF-8\"",
":",
"xmlDocument",
".",
"... | Returns a String representation for the XML Document.
@param xmlDocument the XML Document
@return String representation for the XML Document
@throws IOException | [
"Returns",
"a",
"String",
"representation",
"for",
"the",
"XML",
"Document",
"."
] | train | https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-xml/src/main/java/io/cloudslang/content/xml/utils/DocumentUtils.java#L38-L50 |
jbundle/jbundle | thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/SyncRemoteTable.java | SyncRemoteTable.doMove | public Object doMove(int iRelPosition, int iRecordCount) throws DBException, RemoteException
{
synchronized(m_objSync)
{
return m_tableRemote.doMove(iRelPosition, iRecordCount);
}
} | java | public Object doMove(int iRelPosition, int iRecordCount) throws DBException, RemoteException
{
synchronized(m_objSync)
{
return m_tableRemote.doMove(iRelPosition, iRecordCount);
}
} | [
"public",
"Object",
"doMove",
"(",
"int",
"iRelPosition",
",",
"int",
"iRecordCount",
")",
"throws",
"DBException",
",",
"RemoteException",
"{",
"synchronized",
"(",
"m_objSync",
")",
"{",
"return",
"m_tableRemote",
".",
"doMove",
"(",
"iRelPosition",
",",
"iRec... | Move the current position and read the record (optionally read several records).
@param iRelPosition relative Position to read the next record.
@param iRecordCount Records to read.
@return If I read 1 record, this is the record's data.
@return If I read several records, this is a vector of the returned records.
@return If at EOF, or error, returns the error code as a Integer.
@exception DBException File exception. | [
"Move",
"the",
"current",
"position",
"and",
"read",
"the",
"record",
"(",
"optionally",
"read",
"several",
"records",
")",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/SyncRemoteTable.java#L164-L170 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/WxaAPI.java | WxaAPI.img_sec_check | public static BaseResult img_sec_check(String access_token,InputStream media){
HttpPost httpPost = new HttpPost(BASE_URI + "/wxa/img_sec_check");
byte[] data = null;
try {
data = StreamUtils.copyToByteArray(media);
} catch (IOException e) {
logger.error("", e);
}
HttpEntity reqEntity = MultipartEntityBuilder.create()
.addBinaryBody("media", data, ContentType.DEFAULT_BINARY, "temp.jpg")
.addTextBody(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
.build();
httpPost.setEntity(reqEntity);
return LocalHttpClient.executeJsonResult(httpPost, BaseResult.class);
} | java | public static BaseResult img_sec_check(String access_token,InputStream media){
HttpPost httpPost = new HttpPost(BASE_URI + "/wxa/img_sec_check");
byte[] data = null;
try {
data = StreamUtils.copyToByteArray(media);
} catch (IOException e) {
logger.error("", e);
}
HttpEntity reqEntity = MultipartEntityBuilder.create()
.addBinaryBody("media", data, ContentType.DEFAULT_BINARY, "temp.jpg")
.addTextBody(PARAM_ACCESS_TOKEN, API.accessToken(access_token))
.build();
httpPost.setEntity(reqEntity);
return LocalHttpClient.executeJsonResult(httpPost, BaseResult.class);
} | [
"public",
"static",
"BaseResult",
"img_sec_check",
"(",
"String",
"access_token",
",",
"InputStream",
"media",
")",
"{",
"HttpPost",
"httpPost",
"=",
"new",
"HttpPost",
"(",
"BASE_URI",
"+",
"\"/wxa/img_sec_check\"",
")",
";",
"byte",
"[",
"]",
"data",
"=",
"n... | <strong>图片检查</strong><br>
校验一张图片是否含有违法违规内容。<br>
应用场景举例:<br>
1)图片智能鉴黄:涉及拍照的工具类应用(如美拍,识图类应用)用户拍照上传检测;电商类商品上架图片检测;媒体类用户文章里的图片检测等;<br>
2)敏感人脸识别:用户头像;媒体类用户文章里的图片检测;社交类用户上传的图片检测等<br>
<br>
频率限制:单个 appId 调用上限为 1000 次/分钟,100,000 次/天
@since 2.8.20
@param access_token access_token
@param media 要检测的图片文件,格式支持PNG、JPEG、JPG、GIF,图片尺寸不超过 750px * 1334px
@return result | [
"<strong",
">",
"图片检查<",
"/",
"strong",
">",
"<br",
">",
"校验一张图片是否含有违法违规内容。<br",
">",
"应用场景举例:<br",
">",
"1)图片智能鉴黄:涉及拍照的工具类应用",
"(",
"如美拍,识图类应用",
")",
"用户拍照上传检测;电商类商品上架图片检测;媒体类用户文章里的图片检测等;<br",
">",
"2)敏感人脸识别:用户头像;媒体类用户文章里的图片检测;社交类用户上传的图片检测等<br",
">",
"<br",
">",
"频率限制:单个... | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/WxaAPI.java#L565-L579 |
greenmail-mail-test/greenmail | greenmail-core/src/main/java/com/icegreen/greenmail/configuration/GreenMailConfiguration.java | GreenMailConfiguration.withUser | public GreenMailConfiguration withUser(final String login, final String password) {
return withUser(login, login, password);
} | java | public GreenMailConfiguration withUser(final String login, final String password) {
return withUser(login, login, password);
} | [
"public",
"GreenMailConfiguration",
"withUser",
"(",
"final",
"String",
"login",
",",
"final",
"String",
"password",
")",
"{",
"return",
"withUser",
"(",
"login",
",",
"login",
",",
"password",
")",
";",
"}"
] | The given {@link com.icegreen.greenmail.user.GreenMailUser} will be created when servers will start.
@param login User id and email address
@param password Password of user that belongs to login name
@return Modified configuration | [
"The",
"given",
"{",
"@link",
"com",
".",
"icegreen",
".",
"greenmail",
".",
"user",
".",
"GreenMailUser",
"}",
"will",
"be",
"created",
"when",
"servers",
"will",
"start",
"."
] | train | https://github.com/greenmail-mail-test/greenmail/blob/6d19a62233d1ef6fedbbd1f6fdde2d28e713834a/greenmail-core/src/main/java/com/icegreen/greenmail/configuration/GreenMailConfiguration.java#L20-L22 |
apache/groovy | src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java | StaticTypeCheckingVisitor.inferLoopElementType | public static ClassNode inferLoopElementType(final ClassNode collectionType) {
ClassNode componentType = collectionType.getComponentType();
if (componentType == null) {
if (implementsInterfaceOrIsSubclassOf(collectionType, ITERABLE_TYPE)) {
ClassNode intf = GenericsUtils.parameterizeType(collectionType, ITERABLE_TYPE);
GenericsType[] genericsTypes = intf.getGenericsTypes();
componentType = genericsTypes[0].getType();
} else if (implementsInterfaceOrIsSubclassOf(collectionType, MAP_TYPE)) {
// GROOVY-6240
ClassNode intf = GenericsUtils.parameterizeType(collectionType, MAP_TYPE);
GenericsType[] genericsTypes = intf.getGenericsTypes();
componentType = MAP_ENTRY_TYPE.getPlainNodeReference();
componentType.setGenericsTypes(genericsTypes);
} else if (STRING_TYPE.equals(collectionType)) {
componentType = ClassHelper.STRING_TYPE;
} else if (ENUMERATION_TYPE.equals(collectionType)) {
// GROOVY-6123
ClassNode intf = GenericsUtils.parameterizeType(collectionType, ENUMERATION_TYPE);
GenericsType[] genericsTypes = intf.getGenericsTypes();
componentType = genericsTypes[0].getType();
} else {
componentType = ClassHelper.OBJECT_TYPE;
}
}
return componentType;
} | java | public static ClassNode inferLoopElementType(final ClassNode collectionType) {
ClassNode componentType = collectionType.getComponentType();
if (componentType == null) {
if (implementsInterfaceOrIsSubclassOf(collectionType, ITERABLE_TYPE)) {
ClassNode intf = GenericsUtils.parameterizeType(collectionType, ITERABLE_TYPE);
GenericsType[] genericsTypes = intf.getGenericsTypes();
componentType = genericsTypes[0].getType();
} else if (implementsInterfaceOrIsSubclassOf(collectionType, MAP_TYPE)) {
// GROOVY-6240
ClassNode intf = GenericsUtils.parameterizeType(collectionType, MAP_TYPE);
GenericsType[] genericsTypes = intf.getGenericsTypes();
componentType = MAP_ENTRY_TYPE.getPlainNodeReference();
componentType.setGenericsTypes(genericsTypes);
} else if (STRING_TYPE.equals(collectionType)) {
componentType = ClassHelper.STRING_TYPE;
} else if (ENUMERATION_TYPE.equals(collectionType)) {
// GROOVY-6123
ClassNode intf = GenericsUtils.parameterizeType(collectionType, ENUMERATION_TYPE);
GenericsType[] genericsTypes = intf.getGenericsTypes();
componentType = genericsTypes[0].getType();
} else {
componentType = ClassHelper.OBJECT_TYPE;
}
}
return componentType;
} | [
"public",
"static",
"ClassNode",
"inferLoopElementType",
"(",
"final",
"ClassNode",
"collectionType",
")",
"{",
"ClassNode",
"componentType",
"=",
"collectionType",
".",
"getComponentType",
"(",
")",
";",
"if",
"(",
"componentType",
"==",
"null",
")",
"{",
"if",
... | Given a loop collection type, returns the inferred type of the loop element. Used, for
example, to infer the element type of a (for e in list) loop.
@param collectionType the type of the collection
@return the inferred component type | [
"Given",
"a",
"loop",
"collection",
"type",
"returns",
"the",
"inferred",
"type",
"of",
"the",
"loop",
"element",
".",
"Used",
"for",
"example",
"to",
"infer",
"the",
"element",
"type",
"of",
"a",
"(",
"for",
"e",
"in",
"list",
")",
"loop",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java#L2008-L2033 |
xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/util/CloneUtil.java | CloneUtil.cloneBean | public static <T> T cloneBean(T from, Class<T> beanClass) {
if (from == null || from instanceof Collection || from.getClass().isArray()) {
throw new IllegalArgumentException("Only java bean class is allowed here.");
}
JSONObject jsonObject = (JSONObject) JSON.toJSON(from);
return jsonObject.toJavaObject(beanClass);
} | java | public static <T> T cloneBean(T from, Class<T> beanClass) {
if (from == null || from instanceof Collection || from.getClass().isArray()) {
throw new IllegalArgumentException("Only java bean class is allowed here.");
}
JSONObject jsonObject = (JSONObject) JSON.toJSON(from);
return jsonObject.toJavaObject(beanClass);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"cloneBean",
"(",
"T",
"from",
",",
"Class",
"<",
"T",
">",
"beanClass",
")",
"{",
"if",
"(",
"from",
"==",
"null",
"||",
"from",
"instanceof",
"Collection",
"||",
"from",
".",
"getClass",
"(",
")",
".",
"isA... | clone a java bean. (We use fastjson.)
@param from the bean you want to clone from. This must be a standard bean object.
@param beanClass the bean type
@param <T> the generic type.
@return the cloned object. | [
"clone",
"a",
"java",
"bean",
".",
"(",
"We",
"use",
"fastjson",
".",
")"
] | train | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/util/CloneUtil.java#L23-L29 |
UrielCh/ovh-java-sdk | ovh-java-sdk-router/src/main/java/net/minidev/ovh/api/ApiOvhRouter.java | ApiOvhRouter.serviceName_network_ipNet_PUT | public void serviceName_network_ipNet_PUT(String serviceName, String ipNet, OvhNetwork body) throws IOException {
String qPath = "/router/{serviceName}/network/{ipNet}";
StringBuilder sb = path(qPath, serviceName, ipNet);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void serviceName_network_ipNet_PUT(String serviceName, String ipNet, OvhNetwork body) throws IOException {
String qPath = "/router/{serviceName}/network/{ipNet}";
StringBuilder sb = path(qPath, serviceName, ipNet);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"serviceName_network_ipNet_PUT",
"(",
"String",
"serviceName",
",",
"String",
"ipNet",
",",
"OvhNetwork",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/router/{serviceName}/network/{ipNet}\"",
";",
"StringBuilder",
"sb",
"=",
... | Alter this object properties
REST: PUT /router/{serviceName}/network/{ipNet}
@param body [required] New object properties
@param serviceName [required] The internal name of your Router offer
@param ipNet [required] Gateway IP / CIDR Netmask | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-router/src/main/java/net/minidev/ovh/api/ApiOvhRouter.java#L289-L293 |
trustathsh/ifmapj | src/main/java/de/hshannover/f4/trust/ifmapj/IfmapJ.java | IfmapJ.createSsrc | @Deprecated
public static SSRC createSsrc(String url, String user, String pass, TrustManager[] tms)
throws InitializationException {
return new SsrcImpl(url, user, pass, tms, 120 * 1000);
} | java | @Deprecated
public static SSRC createSsrc(String url, String user, String pass, TrustManager[] tms)
throws InitializationException {
return new SsrcImpl(url, user, pass, tms, 120 * 1000);
} | [
"@",
"Deprecated",
"public",
"static",
"SSRC",
"createSsrc",
"(",
"String",
"url",
",",
"String",
"user",
",",
"String",
"pass",
",",
"TrustManager",
"[",
"]",
"tms",
")",
"throws",
"InitializationException",
"{",
"return",
"new",
"SsrcImpl",
"(",
"url",
","... | Create a new {@link SSRC} object to operate on the given url
using basic authentication.
@param url
the URL to connect to
@param user
basic authentication user
@param pass
basic authentication password
@param tms
TrustManager instances to initialize the {@link SSLContext} with.
@return a new {@link SSRC} that uses basic authentication
@throws IOException
@deprecated use createSsrc(BasicAuthConfig) instead | [
"Create",
"a",
"new",
"{",
"@link",
"SSRC",
"}",
"object",
"to",
"operate",
"on",
"the",
"given",
"url",
"using",
"basic",
"authentication",
"."
] | train | https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/IfmapJ.java#L97-L101 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/DFSClient.java | DFSClient.saveNamespace | void saveNamespace(boolean force, boolean uncompressed)
throws AccessControlException, IOException {
try {
if (namenodeProtocolProxy == null) {
versionBasedSaveNamespace(force, uncompressed);
} else {
methodBasedSaveNamespace(force, uncompressed);
}
} catch(RemoteException re) {
throw re.unwrapRemoteException(AccessControlException.class);
}
} | java | void saveNamespace(boolean force, boolean uncompressed)
throws AccessControlException, IOException {
try {
if (namenodeProtocolProxy == null) {
versionBasedSaveNamespace(force, uncompressed);
} else {
methodBasedSaveNamespace(force, uncompressed);
}
} catch(RemoteException re) {
throw re.unwrapRemoteException(AccessControlException.class);
}
} | [
"void",
"saveNamespace",
"(",
"boolean",
"force",
",",
"boolean",
"uncompressed",
")",
"throws",
"AccessControlException",
",",
"IOException",
"{",
"try",
"{",
"if",
"(",
"namenodeProtocolProxy",
"==",
"null",
")",
"{",
"versionBasedSaveNamespace",
"(",
"force",
"... | Save namespace image.
See {@link ClientProtocol#saveNamespace()}
for more details.
@see ClientProtocol#saveNamespace() | [
"Save",
"namespace",
"image",
".",
"See",
"{",
"@link",
"ClientProtocol#saveNamespace",
"()",
"}",
"for",
"more",
"details",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java#L2354-L2365 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/string/StringHelper.java | StringHelper.getRepeated | @Nonnull
public static String getRepeated (@Nonnull final String sElement, @Nonnegative final int nRepeats)
{
ValueEnforcer.notNull (sElement, "Element");
ValueEnforcer.isGE0 (nRepeats, "Repeats");
final int nElementLength = sElement.length ();
// Check if result length would exceed int range
if ((long) nElementLength * nRepeats > Integer.MAX_VALUE)
throw new IllegalArgumentException ("Resulting string exceeds the maximum integer length");
if (nElementLength == 0 || nRepeats == 0)
return "";
if (nRepeats == 1)
return sElement;
// use character version
if (nElementLength == 1)
return getRepeated (sElement.charAt (0), nRepeats);
// combine via StringBuilder
final StringBuilder ret = new StringBuilder (nElementLength * nRepeats);
for (int i = 0; i < nRepeats; ++i)
ret.append (sElement);
return ret.toString ();
} | java | @Nonnull
public static String getRepeated (@Nonnull final String sElement, @Nonnegative final int nRepeats)
{
ValueEnforcer.notNull (sElement, "Element");
ValueEnforcer.isGE0 (nRepeats, "Repeats");
final int nElementLength = sElement.length ();
// Check if result length would exceed int range
if ((long) nElementLength * nRepeats > Integer.MAX_VALUE)
throw new IllegalArgumentException ("Resulting string exceeds the maximum integer length");
if (nElementLength == 0 || nRepeats == 0)
return "";
if (nRepeats == 1)
return sElement;
// use character version
if (nElementLength == 1)
return getRepeated (sElement.charAt (0), nRepeats);
// combine via StringBuilder
final StringBuilder ret = new StringBuilder (nElementLength * nRepeats);
for (int i = 0; i < nRepeats; ++i)
ret.append (sElement);
return ret.toString ();
} | [
"@",
"Nonnull",
"public",
"static",
"String",
"getRepeated",
"(",
"@",
"Nonnull",
"final",
"String",
"sElement",
",",
"@",
"Nonnegative",
"final",
"int",
"nRepeats",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"sElement",
",",
"\"Element\"",
")",
";",
"V... | Get the passed string element repeated for a certain number of times. Each
string element is simply appended at the end of the string.
@param sElement
The string to get repeated. May not be <code>null</code>.
@param nRepeats
The number of repetitions to retrieve. May not be < 0.
@return A non-<code>null</code> string containing the string element for the
given number of times. | [
"Get",
"the",
"passed",
"string",
"element",
"repeated",
"for",
"a",
"certain",
"number",
"of",
"times",
".",
"Each",
"string",
"element",
"is",
"simply",
"appended",
"at",
"the",
"end",
"of",
"the",
"string",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L2379-L2405 |
dbflute-session/tomcat-boot | src/main/java/org/dbflute/tomcat/util/BotmReflectionUtil.java | BotmReflectionUtil.getPublicMethod | public static Method getPublicMethod(Class<?> clazz, String methodName, Class<?>[] argTypes) {
assertObjectNotNull("clazz", clazz);
assertStringNotNullAndNotTrimmedEmpty("methodName", methodName);
return findMethod(clazz, methodName, argTypes, VisibilityType.PUBLIC, false);
} | java | public static Method getPublicMethod(Class<?> clazz, String methodName, Class<?>[] argTypes) {
assertObjectNotNull("clazz", clazz);
assertStringNotNullAndNotTrimmedEmpty("methodName", methodName);
return findMethod(clazz, methodName, argTypes, VisibilityType.PUBLIC, false);
} | [
"public",
"static",
"Method",
"getPublicMethod",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"methodName",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"argTypes",
")",
"{",
"assertObjectNotNull",
"(",
"\"clazz\"",
",",
"clazz",
")",
";",
"assertStringN... | Get the public method.
@param clazz The type of class that defines the method. (NotNull)
@param methodName The name of method. (NotNull)
@param argTypes The type of argument. (NotNull)
@return The instance of method. (NullAllowed: if null, not found) | [
"Get",
"the",
"public",
"method",
"."
] | train | https://github.com/dbflute-session/tomcat-boot/blob/fe941f88b6be083781873126f5b12d4c16bb9073/src/main/java/org/dbflute/tomcat/util/BotmReflectionUtil.java#L368-L372 |
ManfredTremmel/gwt-commons-lang3 | src/main/java/org/apache/commons/lang3/math/Fraction.java | Fraction.getReducedFraction | public static Fraction getReducedFraction(int numerator, int denominator) {
if (denominator == 0) {
throw new ArithmeticException("The denominator must not be zero");
}
if (numerator == 0) {
return ZERO; // normalize zero.
}
// allow 2^k/-2^31 as a valid fraction (where k>0)
if (denominator == Integer.MIN_VALUE && (numerator & 1) == 0) {
numerator /= 2;
denominator /= 2;
}
if (denominator < 0) {
if (numerator == Integer.MIN_VALUE || denominator == Integer.MIN_VALUE) {
throw new ArithmeticException("overflow: can't negate");
}
numerator = -numerator;
denominator = -denominator;
}
// simplify fraction.
final int gcd = greatestCommonDivisor(numerator, denominator);
numerator /= gcd;
denominator /= gcd;
return new Fraction(numerator, denominator);
} | java | public static Fraction getReducedFraction(int numerator, int denominator) {
if (denominator == 0) {
throw new ArithmeticException("The denominator must not be zero");
}
if (numerator == 0) {
return ZERO; // normalize zero.
}
// allow 2^k/-2^31 as a valid fraction (where k>0)
if (denominator == Integer.MIN_VALUE && (numerator & 1) == 0) {
numerator /= 2;
denominator /= 2;
}
if (denominator < 0) {
if (numerator == Integer.MIN_VALUE || denominator == Integer.MIN_VALUE) {
throw new ArithmeticException("overflow: can't negate");
}
numerator = -numerator;
denominator = -denominator;
}
// simplify fraction.
final int gcd = greatestCommonDivisor(numerator, denominator);
numerator /= gcd;
denominator /= gcd;
return new Fraction(numerator, denominator);
} | [
"public",
"static",
"Fraction",
"getReducedFraction",
"(",
"int",
"numerator",
",",
"int",
"denominator",
")",
"{",
"if",
"(",
"denominator",
"==",
"0",
")",
"{",
"throw",
"new",
"ArithmeticException",
"(",
"\"The denominator must not be zero\"",
")",
";",
"}",
... | <p>Creates a reduced <code>Fraction</code> instance with the 2 parts
of a fraction Y/Z.</p>
<p>For example, if the input parameters represent 2/4, then the created
fraction will be 1/2.</p>
<p>Any negative signs are resolved to be on the numerator.</p>
@param numerator the numerator, for example the three in 'three sevenths'
@param denominator the denominator, for example the seven in 'three sevenths'
@return a new fraction instance, with the numerator and denominator reduced
@throws ArithmeticException if the denominator is <code>zero</code> | [
"<p",
">",
"Creates",
"a",
"reduced",
"<code",
">",
"Fraction<",
"/",
"code",
">",
"instance",
"with",
"the",
"2",
"parts",
"of",
"a",
"fraction",
"Y",
"/",
"Z",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/math/Fraction.java#L208-L232 |
apache/incubator-gobblin | gobblin-service/src/main/java/org/apache/gobblin/service/modules/core/GitConfigMonitor.java | GitConfigMonitor.removeChange | @Override
public void removeChange(DiffEntry change) {
if (checkConfigFilePath(change.getOldPath())) {
Path configFilePath = new Path(this.repositoryDir, change.getOldPath());
String flowName = FSSpecStore.getSpecName(configFilePath);
String flowGroup = FSSpecStore.getSpecGroup(configFilePath);
// build a dummy config to get the proper URI for delete
Config dummyConfig = ConfigBuilder.create()
.addPrimitive(ConfigurationKeys.FLOW_GROUP_KEY, flowGroup)
.addPrimitive(ConfigurationKeys.FLOW_NAME_KEY, flowName)
.build();
FlowSpec spec = FlowSpec.builder()
.withConfig(dummyConfig)
.withVersion(SPEC_VERSION)
.withDescription(SPEC_DESCRIPTION)
.build();
this.flowCatalog.remove(spec.getUri());
}
} | java | @Override
public void removeChange(DiffEntry change) {
if (checkConfigFilePath(change.getOldPath())) {
Path configFilePath = new Path(this.repositoryDir, change.getOldPath());
String flowName = FSSpecStore.getSpecName(configFilePath);
String flowGroup = FSSpecStore.getSpecGroup(configFilePath);
// build a dummy config to get the proper URI for delete
Config dummyConfig = ConfigBuilder.create()
.addPrimitive(ConfigurationKeys.FLOW_GROUP_KEY, flowGroup)
.addPrimitive(ConfigurationKeys.FLOW_NAME_KEY, flowName)
.build();
FlowSpec spec = FlowSpec.builder()
.withConfig(dummyConfig)
.withVersion(SPEC_VERSION)
.withDescription(SPEC_DESCRIPTION)
.build();
this.flowCatalog.remove(spec.getUri());
}
} | [
"@",
"Override",
"public",
"void",
"removeChange",
"(",
"DiffEntry",
"change",
")",
"{",
"if",
"(",
"checkConfigFilePath",
"(",
"change",
".",
"getOldPath",
"(",
")",
")",
")",
"{",
"Path",
"configFilePath",
"=",
"new",
"Path",
"(",
"this",
".",
"repositor... | remove a {@link FlowSpec} for a deleted or renamed flow config
@param change | [
"remove",
"a",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-service/src/main/java/org/apache/gobblin/service/modules/core/GitConfigMonitor.java#L117-L138 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/ui/SeaGlassTableUI.java | SeaGlassTableUI.extendRect | private Rectangle extendRect(Rectangle rect, boolean horizontal) {
if (rect == null) {
return rect;
}
if (horizontal) {
rect.x = 0;
rect.width = table.getWidth();
} else {
rect.y = 0;
if (table.getRowCount() != 0) {
Rectangle lastRect = table.getCellRect(table.getRowCount() - 1, 0, true);
rect.height = lastRect.y + lastRect.height;
} else {
rect.height = table.getHeight();
}
}
return rect;
} | java | private Rectangle extendRect(Rectangle rect, boolean horizontal) {
if (rect == null) {
return rect;
}
if (horizontal) {
rect.x = 0;
rect.width = table.getWidth();
} else {
rect.y = 0;
if (table.getRowCount() != 0) {
Rectangle lastRect = table.getCellRect(table.getRowCount() - 1, 0, true);
rect.height = lastRect.y + lastRect.height;
} else {
rect.height = table.getHeight();
}
}
return rect;
} | [
"private",
"Rectangle",
"extendRect",
"(",
"Rectangle",
"rect",
",",
"boolean",
"horizontal",
")",
"{",
"if",
"(",
"rect",
"==",
"null",
")",
"{",
"return",
"rect",
";",
"}",
"if",
"(",
"horizontal",
")",
"{",
"rect",
".",
"x",
"=",
"0",
";",
"rect",... | DOCUMENT ME!
@param rect DOCUMENT ME!
@param horizontal DOCUMENT ME!
@return DOCUMENT ME! | [
"DOCUMENT",
"ME!"
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassTableUI.java#L707-L728 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/rewrite/rewritepolicy_stats.java | rewritepolicy_stats.get | public static rewritepolicy_stats get(nitro_service service, String name) throws Exception{
rewritepolicy_stats obj = new rewritepolicy_stats();
obj.set_name(name);
rewritepolicy_stats response = (rewritepolicy_stats) obj.stat_resource(service);
return response;
} | java | public static rewritepolicy_stats get(nitro_service service, String name) throws Exception{
rewritepolicy_stats obj = new rewritepolicy_stats();
obj.set_name(name);
rewritepolicy_stats response = (rewritepolicy_stats) obj.stat_resource(service);
return response;
} | [
"public",
"static",
"rewritepolicy_stats",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"rewritepolicy_stats",
"obj",
"=",
"new",
"rewritepolicy_stats",
"(",
")",
";",
"obj",
".",
"set_name",
"(",
"name",
")",
... | Use this API to fetch statistics of rewritepolicy_stats resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"statistics",
"of",
"rewritepolicy_stats",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/rewrite/rewritepolicy_stats.java#L169-L174 |
xwiki/xwiki-rendering | xwiki-rendering-api/src/main/java/org/xwiki/rendering/block/match/BlockNavigator.java | BlockNavigator.addBlock | private <T extends Block> void addBlock(Block currentBlock, List<T> blocks)
{
if (currentBlock != null && this.matcher.match(currentBlock)) {
blocks.add((T) currentBlock);
}
} | java | private <T extends Block> void addBlock(Block currentBlock, List<T> blocks)
{
if (currentBlock != null && this.matcher.match(currentBlock)) {
blocks.add((T) currentBlock);
}
} | [
"private",
"<",
"T",
"extends",
"Block",
">",
"void",
"addBlock",
"(",
"Block",
"currentBlock",
",",
"List",
"<",
"T",
">",
"blocks",
")",
"{",
"if",
"(",
"currentBlock",
"!=",
"null",
"&&",
"this",
".",
"matcher",
".",
"match",
"(",
"currentBlock",
")... | Add provided {@link Block} to provided list (or create list of null) if block validate the provided
{@link BlockMatcher}.
@param <T> the class of the Blocks to return
@param currentBlock the block to search from
@param blocks the list of blocks to fill | [
"Add",
"provided",
"{",
"@link",
"Block",
"}",
"to",
"provided",
"list",
"(",
"or",
"create",
"list",
"of",
"null",
")",
"if",
"block",
"validate",
"the",
"provided",
"{",
"@link",
"BlockMatcher",
"}",
"."
] | train | https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-api/src/main/java/org/xwiki/rendering/block/match/BlockNavigator.java#L151-L156 |
spotify/helios | helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java | ZooKeeperMasterModel.getDeployment | @Override
public Deployment getDeployment(final String host, final JobId jobId) {
final String path = Paths.configHostJob(host, jobId);
final ZooKeeperClient client = provider.get("getDeployment");
try {
final byte[] data = client.getData(path);
final Task task = parse(data, Task.class);
return Deployment.of(jobId, task.getGoal(), task.getDeployerUser(), task.getDeployerMaster(),
task.getDeploymentGroupName());
} catch (KeeperException.NoNodeException e) {
return null;
} catch (KeeperException | IOException e) {
throw new HeliosRuntimeException("getting deployment failed", e);
}
} | java | @Override
public Deployment getDeployment(final String host, final JobId jobId) {
final String path = Paths.configHostJob(host, jobId);
final ZooKeeperClient client = provider.get("getDeployment");
try {
final byte[] data = client.getData(path);
final Task task = parse(data, Task.class);
return Deployment.of(jobId, task.getGoal(), task.getDeployerUser(), task.getDeployerMaster(),
task.getDeploymentGroupName());
} catch (KeeperException.NoNodeException e) {
return null;
} catch (KeeperException | IOException e) {
throw new HeliosRuntimeException("getting deployment failed", e);
}
} | [
"@",
"Override",
"public",
"Deployment",
"getDeployment",
"(",
"final",
"String",
"host",
",",
"final",
"JobId",
"jobId",
")",
"{",
"final",
"String",
"path",
"=",
"Paths",
".",
"configHostJob",
"(",
"host",
",",
"jobId",
")",
";",
"final",
"ZooKeeperClient"... | Returns the current deployment state of {@code jobId} on {@code host}. | [
"Returns",
"the",
"current",
"deployment",
"state",
"of",
"{"
] | train | https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java#L1724-L1738 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.