repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
xiaosunzhu/resource-utils | src/main/java/net/sunyijun/resource/config/Configs.java | Configs.modifyHavePathSelfConfig | public static void modifyHavePathSelfConfig(IConfigKeyWithPath key, String value) throws IOException {
String configAbsoluteClassPath = key.getConfigPath();
OneProperties configs = otherConfigs.get(configAbsoluteClassPath);
if (configs == null) {
return;
}
configs.modifyConfig(key, value);
} | java | public static void modifyHavePathSelfConfig(IConfigKeyWithPath key, String value) throws IOException {
String configAbsoluteClassPath = key.getConfigPath();
OneProperties configs = otherConfigs.get(configAbsoluteClassPath);
if (configs == null) {
return;
}
configs.modifyConfig(key, value);
} | [
"public",
"static",
"void",
"modifyHavePathSelfConfig",
"(",
"IConfigKeyWithPath",
"key",
",",
"String",
"value",
")",
"throws",
"IOException",
"{",
"String",
"configAbsoluteClassPath",
"=",
"key",
".",
"getConfigPath",
"(",
")",
";",
"OneProperties",
"configs",
"="... | Modify one self config.
@param key need update config's key with configAbsoluteClassPath
@param value new config value
@throws IOException | [
"Modify",
"one",
"self",
"config",
"."
] | train | https://github.com/xiaosunzhu/resource-utils/blob/4f2bf3f36df10195a978f122ed682ba1eb0462b5/src/main/java/net/sunyijun/resource/config/Configs.java#L577-L584 |
hellosign/hellosign-java-sdk | src/main/java/com/hellosign/sdk/HelloSignClient.java | HelloSignClient.getEmbeddedTemplateEditUrl | public EmbeddedResponse getEmbeddedTemplateEditUrl(String templateId) throws HelloSignException {
return getEmbeddedTemplateEditUrl(templateId, false, false, false);
} | java | public EmbeddedResponse getEmbeddedTemplateEditUrl(String templateId) throws HelloSignException {
return getEmbeddedTemplateEditUrl(templateId, false, false, false);
} | [
"public",
"EmbeddedResponse",
"getEmbeddedTemplateEditUrl",
"(",
"String",
"templateId",
")",
"throws",
"HelloSignException",
"{",
"return",
"getEmbeddedTemplateEditUrl",
"(",
"templateId",
",",
"false",
",",
"false",
",",
"false",
")",
";",
"}"
] | Retrieves the necessary information to edit an embedded template.
@param templateId String ID of the signature request to embed
@return EmbeddedResponse
@throws HelloSignException thrown if there's a problem processing the
HTTP request or the JSON response. | [
"Retrieves",
"the",
"necessary",
"information",
"to",
"edit",
"an",
"embedded",
"template",
"."
] | train | https://github.com/hellosign/hellosign-java-sdk/blob/08fa7aeb3b0c68ddb6c7ea797d114d55d36d36b1/src/main/java/com/hellosign/sdk/HelloSignClient.java#L856-L858 |
aragozin/jvm-tools | hprof-heap/src/main/java/org/netbeans/lib/profiler/heap/HeapFactory.java | HeapFactory.createFastHeap | public static Heap createFastHeap(File heapDump, long bufferSize) throws FileNotFoundException, IOException {
return new FastHprofHeap(createBuffer(heapDump, bufferSize), 0);
} | java | public static Heap createFastHeap(File heapDump, long bufferSize) throws FileNotFoundException, IOException {
return new FastHprofHeap(createBuffer(heapDump, bufferSize), 0);
} | [
"public",
"static",
"Heap",
"createFastHeap",
"(",
"File",
"heapDump",
",",
"long",
"bufferSize",
")",
"throws",
"FileNotFoundException",
",",
"IOException",
"{",
"return",
"new",
"FastHprofHeap",
"(",
"createBuffer",
"(",
"heapDump",
",",
"bufferSize",
")",
",",
... | Fast {@link Heap} implementation is optimized for batch processing of dump.
Unlike normal {@link Heap} it doesn't create/use any temporary files.
@param bufferSize if file can be mapped to memory no buffer would be used, overwise limits memory used for buffering | [
"Fast",
"{",
"@link",
"Heap",
"}",
"implementation",
"is",
"optimized",
"for",
"batch",
"processing",
"of",
"dump",
".",
"Unlike",
"normal",
"{",
"@link",
"Heap",
"}",
"it",
"doesn",
"t",
"create",
"/",
"use",
"any",
"temporary",
"files",
"."
] | train | https://github.com/aragozin/jvm-tools/blob/d3a4d0c6a47fb9317f274988569655f30dcd2f76/hprof-heap/src/main/java/org/netbeans/lib/profiler/heap/HeapFactory.java#L102-L104 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/impl/ImplRectifyImageOps_F64.java | ImplRectifyImageOps_F64.adjustCalibrated | private static void adjustCalibrated(DMatrixRMaj rectifyLeft, DMatrixRMaj rectifyRight,
DMatrixRMaj rectifyK,
RectangleLength2D_F64 bound, double scale) {
// translation
double deltaX = -bound.x0*scale;
double deltaY = -bound.y0*scale;
// adjustment matrix
SimpleMatrix A = new SimpleMatrix(3,3,true,new double[]{scale,0,deltaX,0,scale,deltaY,0,0,1});
SimpleMatrix rL = SimpleMatrix.wrap(rectifyLeft);
SimpleMatrix rR = SimpleMatrix.wrap(rectifyRight);
SimpleMatrix K = SimpleMatrix.wrap(rectifyK);
// remove previous calibration matrix
SimpleMatrix K_inv = K.invert();
rL = K_inv.mult(rL);
rR = K_inv.mult(rR);
// compute new calibration matrix and apply it
K = A.mult(K);
rectifyK.set(K.getDDRM());
rectifyLeft.set(K.mult(rL).getDDRM());
rectifyRight.set(K.mult(rR).getDDRM());
} | java | private static void adjustCalibrated(DMatrixRMaj rectifyLeft, DMatrixRMaj rectifyRight,
DMatrixRMaj rectifyK,
RectangleLength2D_F64 bound, double scale) {
// translation
double deltaX = -bound.x0*scale;
double deltaY = -bound.y0*scale;
// adjustment matrix
SimpleMatrix A = new SimpleMatrix(3,3,true,new double[]{scale,0,deltaX,0,scale,deltaY,0,0,1});
SimpleMatrix rL = SimpleMatrix.wrap(rectifyLeft);
SimpleMatrix rR = SimpleMatrix.wrap(rectifyRight);
SimpleMatrix K = SimpleMatrix.wrap(rectifyK);
// remove previous calibration matrix
SimpleMatrix K_inv = K.invert();
rL = K_inv.mult(rL);
rR = K_inv.mult(rR);
// compute new calibration matrix and apply it
K = A.mult(K);
rectifyK.set(K.getDDRM());
rectifyLeft.set(K.mult(rL).getDDRM());
rectifyRight.set(K.mult(rR).getDDRM());
} | [
"private",
"static",
"void",
"adjustCalibrated",
"(",
"DMatrixRMaj",
"rectifyLeft",
",",
"DMatrixRMaj",
"rectifyRight",
",",
"DMatrixRMaj",
"rectifyK",
",",
"RectangleLength2D_F64",
"bound",
",",
"double",
"scale",
")",
"{",
"// translation",
"double",
"deltaX",
"=",
... | Internal function which applies the rectification adjustment to a calibrated stereo pair | [
"Internal",
"function",
"which",
"applies",
"the",
"rectification",
"adjustment",
"to",
"a",
"calibrated",
"stereo",
"pair"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/impl/ImplRectifyImageOps_F64.java#L127-L151 |
rzwitserloot/lombok | src/core/lombok/eclipse/handlers/HandleSuperBuilder.java | HandleSuperBuilder.generateStaticFillValuesMethod | private MethodDeclaration generateStaticFillValuesMethod(EclipseNode tdParent, String builderClassName, TypeParameter[] typeParams, java.util.List<BuilderFieldData> builderFields, ASTNode source) {
MethodDeclaration out = new MethodDeclaration(((CompilationUnitDeclaration) tdParent.top().get()).compilationResult);
out.selector = FILL_VALUES_STATIC_METHOD_NAME;
out.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
out.modifiers = ClassFileConstants.AccPrivate | ClassFileConstants.AccStatic;
out.returnType = TypeReference.baseTypeReference(TypeIds.T_void, 0);
TypeReference[] wildcards = new TypeReference[] {new Wildcard(Wildcard.UNBOUND), new Wildcard(Wildcard.UNBOUND)};
TypeReference builderType = new ParameterizedSingleTypeReference(builderClassName.toCharArray(), mergeToTypeReferences(typeParams, wildcards), 0, 0);
Argument builderArgument = new Argument(BUILDER_VARIABLE_NAME, 0, builderType, Modifier.FINAL);
TypeReference parentArgument = createTypeReferenceWithTypeParameters(tdParent.getName(), typeParams);
out.arguments = new Argument[] {new Argument(INSTANCE_VARIABLE_NAME, 0, parentArgument, Modifier.FINAL), builderArgument};
// Add type params if there are any.
if (typeParams.length > 0) out.typeParameters = copyTypeParams(typeParams, source);
List<Statement> body = new ArrayList<Statement>();
// Call the builder's setter methods to fill the values from the instance.
for (BuilderFieldData bfd : builderFields) {
MessageSend exec = createSetterCallWithInstanceValue(bfd, tdParent, source);
body.add(exec);
}
out.statements = body.isEmpty() ? null : body.toArray(new Statement[0]);
return out;
} | java | private MethodDeclaration generateStaticFillValuesMethod(EclipseNode tdParent, String builderClassName, TypeParameter[] typeParams, java.util.List<BuilderFieldData> builderFields, ASTNode source) {
MethodDeclaration out = new MethodDeclaration(((CompilationUnitDeclaration) tdParent.top().get()).compilationResult);
out.selector = FILL_VALUES_STATIC_METHOD_NAME;
out.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
out.modifiers = ClassFileConstants.AccPrivate | ClassFileConstants.AccStatic;
out.returnType = TypeReference.baseTypeReference(TypeIds.T_void, 0);
TypeReference[] wildcards = new TypeReference[] {new Wildcard(Wildcard.UNBOUND), new Wildcard(Wildcard.UNBOUND)};
TypeReference builderType = new ParameterizedSingleTypeReference(builderClassName.toCharArray(), mergeToTypeReferences(typeParams, wildcards), 0, 0);
Argument builderArgument = new Argument(BUILDER_VARIABLE_NAME, 0, builderType, Modifier.FINAL);
TypeReference parentArgument = createTypeReferenceWithTypeParameters(tdParent.getName(), typeParams);
out.arguments = new Argument[] {new Argument(INSTANCE_VARIABLE_NAME, 0, parentArgument, Modifier.FINAL), builderArgument};
// Add type params if there are any.
if (typeParams.length > 0) out.typeParameters = copyTypeParams(typeParams, source);
List<Statement> body = new ArrayList<Statement>();
// Call the builder's setter methods to fill the values from the instance.
for (BuilderFieldData bfd : builderFields) {
MessageSend exec = createSetterCallWithInstanceValue(bfd, tdParent, source);
body.add(exec);
}
out.statements = body.isEmpty() ? null : body.toArray(new Statement[0]);
return out;
} | [
"private",
"MethodDeclaration",
"generateStaticFillValuesMethod",
"(",
"EclipseNode",
"tdParent",
",",
"String",
"builderClassName",
",",
"TypeParameter",
"[",
"]",
"typeParams",
",",
"java",
".",
"util",
".",
"List",
"<",
"BuilderFieldData",
">",
"builderFields",
","... | Generates a <code>$fillValuesFromInstanceIntoBuilder()</code> method in
the builder implementation class that copies all fields from the instance
to the builder. It looks like this:
<pre>
protected B $fillValuesFromInstanceIntoBuilder(Foobar instance, FoobarBuilder<?, ?> b) {
b.field(instance.field);
}
</pre> | [
"Generates",
"a",
"<code",
">",
"$fillValuesFromInstanceIntoBuilder",
"()",
"<",
"/",
"code",
">",
"method",
"in",
"the",
"builder",
"implementation",
"class",
"that",
"copies",
"all",
"fields",
"from",
"the",
"instance",
"to",
"the",
"builder",
".",
"It",
"lo... | train | https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/eclipse/handlers/HandleSuperBuilder.java#L688-L715 |
JM-Lab/utils-java8 | src/main/java/kr/jm/utils/collections/JMListTimeSeries.java | JMListTimeSeries.addAll | public void addAll(long timestamp, List<T> objectList) {
for (T object : objectList)
add(timestamp, object);
}
/*
* (non-Javadoc)
*
* @see kr.jm.utils.collections.JMTimeSeries#toString()
*/
@Override
public String toString() {
return "JMListTimeSeries(intervalSeconds=" + getIntervalSeconds()
+ ", timeSeriesMap=" + timeSeriesMap.toString() + ")";
}
} | java | public void addAll(long timestamp, List<T> objectList) {
for (T object : objectList)
add(timestamp, object);
}
/*
* (non-Javadoc)
*
* @see kr.jm.utils.collections.JMTimeSeries#toString()
*/
@Override
public String toString() {
return "JMListTimeSeries(intervalSeconds=" + getIntervalSeconds()
+ ", timeSeriesMap=" + timeSeriesMap.toString() + ")";
}
} | [
"public",
"void",
"addAll",
"(",
"long",
"timestamp",
",",
"List",
"<",
"T",
">",
"objectList",
")",
"{",
"for",
"(",
"T",
"object",
":",
"objectList",
")",
"add",
"(",
"timestamp",
",",
"object",
")",
";",
"}",
"/*\n\t * (non-Javadoc)\n *\n * @see k... | Add all.
@param timestamp the timestamp
@param objectList the object list | [
"Add",
"all",
"."
] | train | https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/collections/JMListTimeSeries.java#L41-L57 |
mikepenz/FastAdapter | library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/dialog/FastAdapterDialog.java | FastAdapterDialog.withNeutralButton | public FastAdapterDialog<Item> withNeutralButton(String text, OnClickListener listener) {
return withButton(BUTTON_NEUTRAL, text, listener);
} | java | public FastAdapterDialog<Item> withNeutralButton(String text, OnClickListener listener) {
return withButton(BUTTON_NEUTRAL, text, listener);
} | [
"public",
"FastAdapterDialog",
"<",
"Item",
">",
"withNeutralButton",
"(",
"String",
"text",
",",
"OnClickListener",
"listener",
")",
"{",
"return",
"withButton",
"(",
"BUTTON_NEUTRAL",
",",
"text",
",",
"listener",
")",
";",
"}"
] | Set a listener to be invoked when the neutral button of the dialog is pressed.
@param text The text to display in the neutral button
@param listener The {@link DialogInterface.OnClickListener} to use.
@return This Builder object to allow for chaining of calls to set methods | [
"Set",
"a",
"listener",
"to",
"be",
"invoked",
"when",
"the",
"neutral",
"button",
"of",
"the",
"dialog",
"is",
"pressed",
"."
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/dialog/FastAdapterDialog.java#L195-L197 |
spring-projects/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java | JSONObject.optLong | public long optLong(String name, long fallback) {
Object object = opt(name);
Long result = JSON.toLong(object);
return result != null ? result : fallback;
} | java | public long optLong(String name, long fallback) {
Object object = opt(name);
Long result = JSON.toLong(object);
return result != null ? result : fallback;
} | [
"public",
"long",
"optLong",
"(",
"String",
"name",
",",
"long",
"fallback",
")",
"{",
"Object",
"object",
"=",
"opt",
"(",
"name",
")",
";",
"Long",
"result",
"=",
"JSON",
".",
"toLong",
"(",
"object",
")",
";",
"return",
"result",
"!=",
"null",
"?"... | Returns the value mapped by {@code name} if it exists and is a long or can be
coerced to a long. Returns {@code fallback} otherwise. Note that JSON represents
numbers as doubles, so this is <a href="#lossy">lossy</a>; use strings to transfer
numbers via JSON.
@param name the name of the property
@param fallback a fallback value
@return the value or {@code fallback} | [
"Returns",
"the",
"value",
"mapped",
"by",
"{"
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONObject.java#L548-L552 |
upwork/java-upwork | src/com/Upwork/api/Routers/Messages.java | Messages.sendMessageToRoom | public JSONObject sendMessageToRoom(String company, String roomId, HashMap<String, String> params) throws JSONException {
return oClient.post("/messages/v3/" + company + "/rooms/" + roomId + "/stories", params);
} | java | public JSONObject sendMessageToRoom(String company, String roomId, HashMap<String, String> params) throws JSONException {
return oClient.post("/messages/v3/" + company + "/rooms/" + roomId + "/stories", params);
} | [
"public",
"JSONObject",
"sendMessageToRoom",
"(",
"String",
"company",
",",
"String",
"roomId",
",",
"HashMap",
"<",
"String",
",",
"String",
">",
"params",
")",
"throws",
"JSONException",
"{",
"return",
"oClient",
".",
"post",
"(",
"\"/messages/v3/\"",
"+",
"... | Send a message to a room
@param company Company ID
@param roomId Room ID
@param params Parameters
@throws JSONException If error occurred
@return {@link JSONObject} | [
"Send",
"a",
"message",
"to",
"a",
"room"
] | train | https://github.com/upwork/java-upwork/blob/342297161503a74e9e0bddbd381ab5eebf4dc454/src/com/Upwork/api/Routers/Messages.java#L126-L128 |
looly/hutool | hutool-db/src/main/java/cn/hutool/db/sql/Condition.java | Condition.buildValuePartForBETWEEN | private void buildValuePartForBETWEEN(StringBuilder conditionStrBuilder, List<Object> paramValues) {
// BETWEEN x AND y 的情况,两个参数
if (isPlaceHolder()) {
// 使用条件表达式占位符
conditionStrBuilder.append(" ?");
if(null != paramValues) {
paramValues.add(this.value);
}
} else {
// 直接使用条件值
conditionStrBuilder.append(CharUtil.SPACE).append(this.value);
}
// 处理 AND y
conditionStrBuilder.append(StrUtil.SPACE).append(LogicalOperator.AND.toString());
if (isPlaceHolder()) {
// 使用条件表达式占位符
conditionStrBuilder.append(" ?");
if(null != paramValues) {
paramValues.add(this.secondValue);
}
} else {
// 直接使用条件值
conditionStrBuilder.append(CharUtil.SPACE).append(this.secondValue);
}
} | java | private void buildValuePartForBETWEEN(StringBuilder conditionStrBuilder, List<Object> paramValues) {
// BETWEEN x AND y 的情况,两个参数
if (isPlaceHolder()) {
// 使用条件表达式占位符
conditionStrBuilder.append(" ?");
if(null != paramValues) {
paramValues.add(this.value);
}
} else {
// 直接使用条件值
conditionStrBuilder.append(CharUtil.SPACE).append(this.value);
}
// 处理 AND y
conditionStrBuilder.append(StrUtil.SPACE).append(LogicalOperator.AND.toString());
if (isPlaceHolder()) {
// 使用条件表达式占位符
conditionStrBuilder.append(" ?");
if(null != paramValues) {
paramValues.add(this.secondValue);
}
} else {
// 直接使用条件值
conditionStrBuilder.append(CharUtil.SPACE).append(this.secondValue);
}
} | [
"private",
"void",
"buildValuePartForBETWEEN",
"(",
"StringBuilder",
"conditionStrBuilder",
",",
"List",
"<",
"Object",
">",
"paramValues",
")",
"{",
"// BETWEEN x AND y 的情况,两个参数\r",
"if",
"(",
"isPlaceHolder",
"(",
")",
")",
"{",
"// 使用条件表达式占位符\r",
"conditionStrBuilder... | 构建BETWEEN语句中的值部分<br>
开头必须加空格,类似:" ? AND ?" 或者 " 1 AND 2"
@param conditionStrBuilder 条件语句构建器
@param paramValues 参数集合,用于参数占位符对应参数回填 | [
"构建BETWEEN语句中的值部分<br",
">",
"开头必须加空格,类似:",
"?",
"AND",
"?",
"或者",
"1",
"AND",
"2"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/Condition.java#L320-L345 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.createIntrinsic | public static CameraPinhole createIntrinsic(int width, int height, double hfov, double vfov) {
CameraPinhole intrinsic = new CameraPinhole();
intrinsic.width = width;
intrinsic.height = height;
intrinsic.cx = width / 2;
intrinsic.cy = height / 2;
intrinsic.fx = intrinsic.cx / Math.tan(UtilAngle.degreeToRadian(hfov/2.0));
intrinsic.fy = intrinsic.cy / Math.tan(UtilAngle.degreeToRadian(vfov/2.0));
return intrinsic;
} | java | public static CameraPinhole createIntrinsic(int width, int height, double hfov, double vfov) {
CameraPinhole intrinsic = new CameraPinhole();
intrinsic.width = width;
intrinsic.height = height;
intrinsic.cx = width / 2;
intrinsic.cy = height / 2;
intrinsic.fx = intrinsic.cx / Math.tan(UtilAngle.degreeToRadian(hfov/2.0));
intrinsic.fy = intrinsic.cy / Math.tan(UtilAngle.degreeToRadian(vfov/2.0));
return intrinsic;
} | [
"public",
"static",
"CameraPinhole",
"createIntrinsic",
"(",
"int",
"width",
",",
"int",
"height",
",",
"double",
"hfov",
",",
"double",
"vfov",
")",
"{",
"CameraPinhole",
"intrinsic",
"=",
"new",
"CameraPinhole",
"(",
")",
";",
"intrinsic",
".",
"width",
"=... | Creates a set of intrinsic parameters, without distortion, for a camera with the specified characteristics
@param width Image width
@param height Image height
@param hfov Horizontal FOV in degrees
@param vfov Vertical FOV in degrees
@return guess camera parameters | [
"Creates",
"a",
"set",
"of",
"intrinsic",
"parameters",
"without",
"distortion",
"for",
"a",
"camera",
"with",
"the",
"specified",
"characteristics"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L97-L107 |
pressgang-ccms/PressGangCCMSContentSpec | src/main/java/org/jboss/pressgang/ccms/contentspec/entities/InjectionOptions.java | InjectionOptions.getInjectionSetting | private String getInjectionSetting(final String input, final char startDelim) {
return input == null || input.equals("") ? null : StringUtilities.split(input, startDelim)[0].trim();
} | java | private String getInjectionSetting(final String input, final char startDelim) {
return input == null || input.equals("") ? null : StringUtilities.split(input, startDelim)[0].trim();
} | [
"private",
"String",
"getInjectionSetting",
"(",
"final",
"String",
"input",
",",
"final",
"char",
"startDelim",
")",
"{",
"return",
"input",
"==",
"null",
"||",
"input",
".",
"equals",
"(",
"\"\"",
")",
"?",
"null",
":",
"StringUtilities",
".",
"split",
"... | Gets the Injection Setting for these options when using the String Constructor.
@param input The input to be parsed to get the setting.
@param startDelim The delimiter that specifies that start of options (ie '[')
@return The title as a String or null if the title is blank. | [
"Gets",
"the",
"Injection",
"Setting",
"for",
"these",
"options",
"when",
"using",
"the",
"String",
"Constructor",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/entities/InjectionOptions.java#L78-L80 |
playn/playn | core/src/playn/core/json/JsonArray.java | JsonArray.getString | public String getString(int key, String default_) {
Object o = get(key);
return (o instanceof String) ? (String)o : default_;
} | java | public String getString(int key, String default_) {
Object o = get(key);
return (o instanceof String) ? (String)o : default_;
} | [
"public",
"String",
"getString",
"(",
"int",
"key",
",",
"String",
"default_",
")",
"{",
"Object",
"o",
"=",
"get",
"(",
"key",
")",
";",
"return",
"(",
"o",
"instanceof",
"String",
")",
"?",
"(",
"String",
")",
"o",
":",
"default_",
";",
"}"
] | Returns the {@link String} at the given index, or the default if it does not exist or is the wrong type. | [
"Returns",
"the",
"{"
] | train | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/json/JsonArray.java#L194-L197 |
henkexbg/gallery-api | src/main/java/com/github/henkexbg/gallery/service/impl/GalleryServiceImpl.java | GalleryServiceImpl.getPublicPathFromRealFile | @Override
public String getPublicPathFromRealFile(String publicRoot, File file) throws IOException, NotAllowedException {
String actualFilePath = file.getCanonicalPath();
File rootFile = galleryAuthorizationService.getRootPathsForCurrentUser().get(publicRoot);
String relativePath = actualFilePath.substring(rootFile.getCanonicalPath().length(), actualFilePath.length());
StringBuilder builder = new StringBuilder();
builder.append(publicRoot);
builder.append(relativePath);
String publicPath = separatorsToUnix(builder.toString());
LOG.debug("Actual file: {}, generated public path: {}", file, publicPath);
return publicPath;
} | java | @Override
public String getPublicPathFromRealFile(String publicRoot, File file) throws IOException, NotAllowedException {
String actualFilePath = file.getCanonicalPath();
File rootFile = galleryAuthorizationService.getRootPathsForCurrentUser().get(publicRoot);
String relativePath = actualFilePath.substring(rootFile.getCanonicalPath().length(), actualFilePath.length());
StringBuilder builder = new StringBuilder();
builder.append(publicRoot);
builder.append(relativePath);
String publicPath = separatorsToUnix(builder.toString());
LOG.debug("Actual file: {}, generated public path: {}", file, publicPath);
return publicPath;
} | [
"@",
"Override",
"public",
"String",
"getPublicPathFromRealFile",
"(",
"String",
"publicRoot",
",",
"File",
"file",
")",
"throws",
"IOException",
",",
"NotAllowedException",
"{",
"String",
"actualFilePath",
"=",
"file",
".",
"getCanonicalPath",
"(",
")",
";",
"Fil... | A kind of inverse lookup - finding the public path given the actual file.
<strong>NOTE! This method does NOT verify that the current user actually
has the right to access the given publicRoot! It is the responsibility of
calling methods to make sure only allowed root paths are used.</strong>
@param publicRoot
@param file
@return The public path of the given file for the given publicRoot.
@throws IOException
@throws NotAllowedException | [
"A",
"kind",
"of",
"inverse",
"lookup",
"-",
"finding",
"the",
"public",
"path",
"given",
"the",
"actual",
"file",
".",
"<strong",
">",
"NOTE!",
"This",
"method",
"does",
"NOT",
"verify",
"that",
"the",
"current",
"user",
"actually",
"has",
"the",
"right",... | train | https://github.com/henkexbg/gallery-api/blob/530e68c225b5e8fc3b608d670b34bd539a5b0a71/src/main/java/com/github/henkexbg/gallery/service/impl/GalleryServiceImpl.java#L321-L332 |
square/spoon | spoon-runner/src/main/java/com/squareup/spoon/html/HtmlUtils.java | HtmlUtils.processStackTrace | static ExceptionInfo processStackTrace(StackTrace exception) {
if (exception == null) {
return null;
}
// Escape any special HTML characters in the exception that would otherwise break the HTML
// rendering (e.g. the angle brackets around the default toString() for enums).
String message = StringEscapeUtils.escapeHtml4(exception.toString());
// Newline characters are usually stripped out by the parsing code in
// {@link StackTrace#from(String)}, but they can sometimes remain (e.g. when the stack trace
// is not in an expected format). This replacement needs to be done after any HTML escaping.
message = message.replace("\n", "<br/>");
List<String> lines = exception.getElements()
.stream()
.map(element -> " at " + element.toString())
.collect(toList());
while (exception.getCause() != null) {
exception = exception.getCause();
String causeMessage = StringEscapeUtils.escapeHtml4(exception.toString());
lines.add("Caused by: " + causeMessage.replace("\n", "<br/>"));
}
return new ExceptionInfo(message, lines);
} | java | static ExceptionInfo processStackTrace(StackTrace exception) {
if (exception == null) {
return null;
}
// Escape any special HTML characters in the exception that would otherwise break the HTML
// rendering (e.g. the angle brackets around the default toString() for enums).
String message = StringEscapeUtils.escapeHtml4(exception.toString());
// Newline characters are usually stripped out by the parsing code in
// {@link StackTrace#from(String)}, but they can sometimes remain (e.g. when the stack trace
// is not in an expected format). This replacement needs to be done after any HTML escaping.
message = message.replace("\n", "<br/>");
List<String> lines = exception.getElements()
.stream()
.map(element -> " at " + element.toString())
.collect(toList());
while (exception.getCause() != null) {
exception = exception.getCause();
String causeMessage = StringEscapeUtils.escapeHtml4(exception.toString());
lines.add("Caused by: " + causeMessage.replace("\n", "<br/>"));
}
return new ExceptionInfo(message, lines);
} | [
"static",
"ExceptionInfo",
"processStackTrace",
"(",
"StackTrace",
"exception",
")",
"{",
"if",
"(",
"exception",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"// Escape any special HTML characters in the exception that would otherwise break the HTML",
"// rendering (e... | Parse the string representation of an exception to a {@link ExceptionInfo} instance. | [
"Parse",
"the",
"string",
"representation",
"of",
"an",
"exception",
"to",
"a",
"{"
] | train | https://github.com/square/spoon/blob/ebd51fbc1498f6bdcb61aa1281bbac2af99117b3/spoon-runner/src/main/java/com/squareup/spoon/html/HtmlUtils.java#L135-L158 |
drapostolos/rdp4j | src/main/java/com/github/drapostolos/rdp4j/DirectoryPoller.java | DirectoryPoller.awaitTermination | public void awaitTermination() {
try {
latch.await();
} catch (InterruptedException e) {
String message = "awaitTermination() method was interrupted!";
throw new UnsupportedOperationException(message, e);
}
} | java | public void awaitTermination() {
try {
latch.await();
} catch (InterruptedException e) {
String message = "awaitTermination() method was interrupted!";
throw new UnsupportedOperationException(message, e);
}
} | [
"public",
"void",
"awaitTermination",
"(",
")",
"{",
"try",
"{",
"latch",
".",
"await",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"String",
"message",
"=",
"\"awaitTermination() method was interrupted!\"",
";",
"throw",
"new",
"U... | Blocks until the last poll-cycle has finished and all {@link AfterStopEvent} has been
processed. | [
"Blocks",
"until",
"the",
"last",
"poll",
"-",
"cycle",
"has",
"finished",
"and",
"all",
"{"
] | train | https://github.com/drapostolos/rdp4j/blob/ec1db2444d245b7ccd6607182bb56a027fa66d6b/src/main/java/com/github/drapostolos/rdp4j/DirectoryPoller.java#L194-L201 |
graphhopper/graphhopper | core/src/main/java/com/graphhopper/routing/QueryGraph.java | QueryGraph.unfavorVirtualEdgePair | public void unfavorVirtualEdgePair(int virtualNodeId, int virtualEdgeId) {
if (!isVirtualNode(virtualNodeId)) {
throw new IllegalArgumentException("Node id " + virtualNodeId
+ " must be a virtual node.");
}
VirtualEdgeIteratorState incomingEdge =
(VirtualEdgeIteratorState) getEdgeIteratorState(virtualEdgeId, virtualNodeId);
VirtualEdgeIteratorState reverseEdge = (VirtualEdgeIteratorState) getEdgeIteratorState(
virtualEdgeId, incomingEdge.getBaseNode());
incomingEdge.setUnfavored(true);
unfavoredEdges.add(incomingEdge);
reverseEdge.setUnfavored(true);
unfavoredEdges.add(reverseEdge);
} | java | public void unfavorVirtualEdgePair(int virtualNodeId, int virtualEdgeId) {
if (!isVirtualNode(virtualNodeId)) {
throw new IllegalArgumentException("Node id " + virtualNodeId
+ " must be a virtual node.");
}
VirtualEdgeIteratorState incomingEdge =
(VirtualEdgeIteratorState) getEdgeIteratorState(virtualEdgeId, virtualNodeId);
VirtualEdgeIteratorState reverseEdge = (VirtualEdgeIteratorState) getEdgeIteratorState(
virtualEdgeId, incomingEdge.getBaseNode());
incomingEdge.setUnfavored(true);
unfavoredEdges.add(incomingEdge);
reverseEdge.setUnfavored(true);
unfavoredEdges.add(reverseEdge);
} | [
"public",
"void",
"unfavorVirtualEdgePair",
"(",
"int",
"virtualNodeId",
",",
"int",
"virtualEdgeId",
")",
"{",
"if",
"(",
"!",
"isVirtualNode",
"(",
"virtualNodeId",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Node id \"",
"+",
"virtualNode... | Sets the virtual edge with virtualEdgeId and its reverse edge to 'unfavored', which
effectively penalizes both virtual edges towards an adjacent node of virtualNodeId.
This makes it more likely (but does not guarantee) that the router chooses a route towards
the other adjacent node of virtualNodeId.
<p>
@param virtualNodeId virtual node at which edges get unfavored
@param virtualEdgeId this edge and the reverse virtual edge become unfavored | [
"Sets",
"the",
"virtual",
"edge",
"with",
"virtualEdgeId",
"and",
"its",
"reverse",
"edge",
"to",
"unfavored",
"which",
"effectively",
"penalizes",
"both",
"virtual",
"edges",
"towards",
"an",
"adjacent",
"node",
"of",
"virtualNodeId",
".",
"This",
"makes",
"it"... | train | https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/routing/QueryGraph.java#L488-L502 |
aws/aws-sdk-java | jmespath-java/src/main/java/com/amazonaws/jmespath/JmesPathEvaluationVisitor.java | JmesPathEvaluationVisitor.visit | @Override
public JsonNode visit(JmesPathMultiSelectList multiSelectList, JsonNode input) throws InvalidTypeException {
List<JmesPathExpression> expressionsList = multiSelectList.getExpressions();
ArrayNode evaluatedExprList = ObjectMapperSingleton.getObjectMapper().createArrayNode();
for (JmesPathExpression expression : expressionsList) {
evaluatedExprList.add(expression.accept(this, input));
}
return evaluatedExprList;
} | java | @Override
public JsonNode visit(JmesPathMultiSelectList multiSelectList, JsonNode input) throws InvalidTypeException {
List<JmesPathExpression> expressionsList = multiSelectList.getExpressions();
ArrayNode evaluatedExprList = ObjectMapperSingleton.getObjectMapper().createArrayNode();
for (JmesPathExpression expression : expressionsList) {
evaluatedExprList.add(expression.accept(this, input));
}
return evaluatedExprList;
} | [
"@",
"Override",
"public",
"JsonNode",
"visit",
"(",
"JmesPathMultiSelectList",
"multiSelectList",
",",
"JsonNode",
"input",
")",
"throws",
"InvalidTypeException",
"{",
"List",
"<",
"JmesPathExpression",
">",
"expressionsList",
"=",
"multiSelectList",
".",
"getExpressio... | Each expression in the multiselect list will be evaluated
against the JSON document. Each returned element will be the
result of evaluating the expression. A multi-select-list with
N expressions will result in a list of length N. Given a
multiselect expression [expr-1,expr-2,...,expr-n], the evaluated
expression will return [evaluate(expr-1), evaluate(expr-2), ...,evaluate(expr-n)].
@param multiSelectList JmesPath multiselect list type
@param input Input json node against which evaluation is done
@return Result of the multiselect list evaluation
@throws InvalidTypeException | [
"Each",
"expression",
"in",
"the",
"multiselect",
"list",
"will",
"be",
"evaluated",
"against",
"the",
"JSON",
"document",
".",
"Each",
"returned",
"element",
"will",
"be",
"the",
"result",
"of",
"evaluating",
"the",
"expression",
".",
"A",
"multi",
"-",
"se... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/jmespath-java/src/main/java/com/amazonaws/jmespath/JmesPathEvaluationVisitor.java#L324-L332 |
morimekta/utils | io-util/src/main/java/net/morimekta/util/Strings.java | Strings.asString | public static String asString(Map<?, ?> map) {
if (map == null) {
return NULL;
}
StringBuilder builder = new StringBuilder();
builder.append('{');
boolean first = true;
for (Map.Entry<?, ?> entry : map.entrySet()) {
if (first) {
first = false;
} else {
builder.append(',');
}
builder.append(asString(entry.getKey()))
.append(':')
.append(asString(entry.getValue()));
}
builder.append('}');
return builder.toString();
} | java | public static String asString(Map<?, ?> map) {
if (map == null) {
return NULL;
}
StringBuilder builder = new StringBuilder();
builder.append('{');
boolean first = true;
for (Map.Entry<?, ?> entry : map.entrySet()) {
if (first) {
first = false;
} else {
builder.append(',');
}
builder.append(asString(entry.getKey()))
.append(':')
.append(asString(entry.getValue()));
}
builder.append('}');
return builder.toString();
} | [
"public",
"static",
"String",
"asString",
"(",
"Map",
"<",
"?",
",",
"?",
">",
"map",
")",
"{",
"if",
"(",
"map",
"==",
"null",
")",
"{",
"return",
"NULL",
";",
"}",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"builder",
... | Make a minimal printable string value from a typed map.
@param map The map to stringify.
@return The resulting string. | [
"Make",
"a",
"minimal",
"printable",
"string",
"value",
"from",
"a",
"typed",
"map",
"."
] | train | https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/io-util/src/main/java/net/morimekta/util/Strings.java#L608-L627 |
orbisgis/h2gis | h2gis-functions/src/main/java/org/h2gis/functions/io/kml/KMLWrite.java | KMLWrite.writeKML | public static void writeKML(Connection connection, String fileName, String tableReference) throws SQLException, IOException {
KMLDriverFunction kMLDriverFunction = new KMLDriverFunction();
kMLDriverFunction.exportTable(connection, tableReference, URIUtilities.fileFromString(fileName), new EmptyProgressVisitor());
} | java | public static void writeKML(Connection connection, String fileName, String tableReference) throws SQLException, IOException {
KMLDriverFunction kMLDriverFunction = new KMLDriverFunction();
kMLDriverFunction.exportTable(connection, tableReference, URIUtilities.fileFromString(fileName), new EmptyProgressVisitor());
} | [
"public",
"static",
"void",
"writeKML",
"(",
"Connection",
"connection",
",",
"String",
"fileName",
",",
"String",
"tableReference",
")",
"throws",
"SQLException",
",",
"IOException",
"{",
"KMLDriverFunction",
"kMLDriverFunction",
"=",
"new",
"KMLDriverFunction",
"(",... | This method is used to write a spatial table into a KML file
@param connection
@param fileName
@param tableReference
@throws SQLException
@throws IOException | [
"This",
"method",
"is",
"used",
"to",
"write",
"a",
"spatial",
"table",
"into",
"a",
"KML",
"file"
] | train | https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/io/kml/KMLWrite.java#L56-L59 |
OpenLiberty/open-liberty | dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2InboundLink.java | H2InboundLink.createNewInboundLink | public H2StreamProcessor createNewInboundLink(Integer streamID) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "createNewInboundLink entry: stream-id: " + streamID);
}
if ((streamID % 2 == 0) && (streamID != 0)) {
synchronized (streamOpenCloseSync) {
int maxPushStreams = getRemoteConnectionSettings().getMaxConcurrentStreams();
// if there are too many locally-open active streams, don't open a new one
if (maxPushStreams >= 0 && openPushStreams > maxPushStreams) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "createNewInboundLink cannot open a new push stream; maximum number of open push streams reached" + openPushStreams);
}
return null;
}
openPushStreams++;
}
}
H2VirtualConnectionImpl h2VC = new H2VirtualConnectionImpl(initialVC);
// remove the HttpDispatcherLink from the map, so a new one will be created and used by this new H2 stream
h2VC.getStateMap().remove(HttpDispatcherLink.LINK_ID);
H2HttpInboundLinkWrap link = new H2HttpInboundLinkWrap(httpInboundChannel, h2VC, streamID, this);
H2StreamProcessor stream = new H2StreamProcessor(streamID, link, this);
// for now, assume parent stream ID is root, need to change soon
writeQ.addNewNodeToQ(streamID, Node.ROOT_STREAM_ID, Node.DEFAULT_NODE_PRIORITY, false);
streamTable.put(streamID, stream);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "createNewInboundLink exit: returning stream: " + streamID + " " + stream);
}
return stream;
} | java | public H2StreamProcessor createNewInboundLink(Integer streamID) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "createNewInboundLink entry: stream-id: " + streamID);
}
if ((streamID % 2 == 0) && (streamID != 0)) {
synchronized (streamOpenCloseSync) {
int maxPushStreams = getRemoteConnectionSettings().getMaxConcurrentStreams();
// if there are too many locally-open active streams, don't open a new one
if (maxPushStreams >= 0 && openPushStreams > maxPushStreams) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "createNewInboundLink cannot open a new push stream; maximum number of open push streams reached" + openPushStreams);
}
return null;
}
openPushStreams++;
}
}
H2VirtualConnectionImpl h2VC = new H2VirtualConnectionImpl(initialVC);
// remove the HttpDispatcherLink from the map, so a new one will be created and used by this new H2 stream
h2VC.getStateMap().remove(HttpDispatcherLink.LINK_ID);
H2HttpInboundLinkWrap link = new H2HttpInboundLinkWrap(httpInboundChannel, h2VC, streamID, this);
H2StreamProcessor stream = new H2StreamProcessor(streamID, link, this);
// for now, assume parent stream ID is root, need to change soon
writeQ.addNewNodeToQ(streamID, Node.ROOT_STREAM_ID, Node.DEFAULT_NODE_PRIORITY, false);
streamTable.put(streamID, stream);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "createNewInboundLink exit: returning stream: " + streamID + " " + stream);
}
return stream;
} | [
"public",
"H2StreamProcessor",
"createNewInboundLink",
"(",
"Integer",
"streamID",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"Tr",
".",
"debug",
"(",
"tc",
",",
"\"crea... | Create a new stream and add it to this link. If the stream ID is even, check to make sure this link has not exceeded
the maximum number of concurrent streams (as set by the client); if too many streams are open, don't open a new one.
@param streamID
@return null if creating this stream would exceed the maximum number locally-opened streams | [
"Create",
"a",
"new",
"stream",
"and",
"add",
"it",
"to",
"this",
"link",
".",
"If",
"the",
"stream",
"ID",
"is",
"even",
"check",
"to",
"make",
"sure",
"this",
"link",
"has",
"not",
"exceeded",
"the",
"maximum",
"number",
"of",
"concurrent",
"streams",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/H2InboundLink.java#L219-L250 |
ThreeTen/threeten-extra | src/main/java/org/threeten/extra/chrono/CopticDate.java | CopticDate.ofYearDay | static CopticDate ofYearDay(int prolepticYear, int dayOfYear) {
CopticChronology.YEAR_RANGE.checkValidValue(prolepticYear, YEAR);
DAY_OF_YEAR.range().checkValidValue(dayOfYear, DAY_OF_YEAR);
if (dayOfYear == 366 && CopticChronology.INSTANCE.isLeapYear(prolepticYear) == false) {
throw new DateTimeException("Invalid date 'Nasie 6' as '" + prolepticYear + "' is not a leap year");
}
return new CopticDate(prolepticYear, (dayOfYear - 1) / 30 + 1, (dayOfYear - 1) % 30 + 1);
} | java | static CopticDate ofYearDay(int prolepticYear, int dayOfYear) {
CopticChronology.YEAR_RANGE.checkValidValue(prolepticYear, YEAR);
DAY_OF_YEAR.range().checkValidValue(dayOfYear, DAY_OF_YEAR);
if (dayOfYear == 366 && CopticChronology.INSTANCE.isLeapYear(prolepticYear) == false) {
throw new DateTimeException("Invalid date 'Nasie 6' as '" + prolepticYear + "' is not a leap year");
}
return new CopticDate(prolepticYear, (dayOfYear - 1) / 30 + 1, (dayOfYear - 1) % 30 + 1);
} | [
"static",
"CopticDate",
"ofYearDay",
"(",
"int",
"prolepticYear",
",",
"int",
"dayOfYear",
")",
"{",
"CopticChronology",
".",
"YEAR_RANGE",
".",
"checkValidValue",
"(",
"prolepticYear",
",",
"YEAR",
")",
";",
"DAY_OF_YEAR",
".",
"range",
"(",
")",
".",
"checkV... | Obtains a {@code CopticDate} representing a date in the Coptic calendar
system from the proleptic-year and day-of-year fields.
<p>
This returns a {@code CopticDate} with the specified fields.
The day must be valid for the year, otherwise an exception will be thrown.
@param prolepticYear the Coptic proleptic-year
@param dayOfYear the Coptic day-of-year, from 1 to 366
@return the date in Coptic calendar system, not null
@throws DateTimeException if the value of any field is out of range,
or if the day-of-year is invalid for the year | [
"Obtains",
"a",
"{",
"@code",
"CopticDate",
"}",
"representing",
"a",
"date",
"in",
"the",
"Coptic",
"calendar",
"system",
"from",
"the",
"proleptic",
"-",
"year",
"and",
"day",
"-",
"of",
"-",
"year",
"fields",
".",
"<p",
">",
"This",
"returns",
"a",
... | train | https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/chrono/CopticDate.java#L201-L208 |
bazaarvoice/jolt | jolt-core/src/main/java/com/bazaarvoice/jolt/modifier/spec/ModifierSpec.java | ModifierSpec.setData | @SuppressWarnings( "unchecked" )
protected static void setData(Object parent, MatchedElement matchedElement, Object value, OpMode opMode) {
if(parent instanceof Map) {
Map source = (Map) parent;
String key = matchedElement.getRawKey();
if(opMode.isApplicable( source, key )) {
source.put( key, value );
}
}
else if (parent instanceof List && matchedElement instanceof ArrayMatchedElement ) {
List source = (List) parent;
int origSize = ( (ArrayMatchedElement) matchedElement ).getOrigSize();
int reqIndex = ( (ArrayMatchedElement) matchedElement ).getRawIndex();
if(opMode.isApplicable( source, reqIndex, origSize )) {
source.set( reqIndex, value );
}
}
else {
throw new RuntimeException( "Should not come here!" );
}
} | java | @SuppressWarnings( "unchecked" )
protected static void setData(Object parent, MatchedElement matchedElement, Object value, OpMode opMode) {
if(parent instanceof Map) {
Map source = (Map) parent;
String key = matchedElement.getRawKey();
if(opMode.isApplicable( source, key )) {
source.put( key, value );
}
}
else if (parent instanceof List && matchedElement instanceof ArrayMatchedElement ) {
List source = (List) parent;
int origSize = ( (ArrayMatchedElement) matchedElement ).getOrigSize();
int reqIndex = ( (ArrayMatchedElement) matchedElement ).getRawIndex();
if(opMode.isApplicable( source, reqIndex, origSize )) {
source.set( reqIndex, value );
}
}
else {
throw new RuntimeException( "Should not come here!" );
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"static",
"void",
"setData",
"(",
"Object",
"parent",
",",
"MatchedElement",
"matchedElement",
",",
"Object",
"value",
",",
"OpMode",
"opMode",
")",
"{",
"if",
"(",
"parent",
"instanceof",
"Map",
... | Static utility method for facilitating writes on input object
@param parent the source object
@param matchedElement the current spec (leaf) element that was matched with input
@param value to write
@param opMode to determine if write is applicable | [
"Static",
"utility",
"method",
"for",
"facilitating",
"writes",
"on",
"input",
"object"
] | train | https://github.com/bazaarvoice/jolt/blob/4cf866a9f4222142da41b50dbcccce022a956bff/jolt-core/src/main/java/com/bazaarvoice/jolt/modifier/spec/ModifierSpec.java#L127-L147 |
apache/groovy | src/main/java/org/codehaus/groovy/ast/tools/WideningCategories.java | WideningCategories.implementsInterfaceOrSubclassOf | public static boolean implementsInterfaceOrSubclassOf(final ClassNode source, final ClassNode targetType) {
if (source.isDerivedFrom(targetType) || source.implementsInterface(targetType)) return true;
if (targetType instanceof WideningCategories.LowestUpperBoundClassNode) {
WideningCategories.LowestUpperBoundClassNode lub = (WideningCategories.LowestUpperBoundClassNode) targetType;
if (implementsInterfaceOrSubclassOf(source, lub.getSuperClass())) return true;
for (ClassNode classNode : lub.getInterfaces()) {
if (source.implementsInterface(classNode)) return true;
}
}
return false;
} | java | public static boolean implementsInterfaceOrSubclassOf(final ClassNode source, final ClassNode targetType) {
if (source.isDerivedFrom(targetType) || source.implementsInterface(targetType)) return true;
if (targetType instanceof WideningCategories.LowestUpperBoundClassNode) {
WideningCategories.LowestUpperBoundClassNode lub = (WideningCategories.LowestUpperBoundClassNode) targetType;
if (implementsInterfaceOrSubclassOf(source, lub.getSuperClass())) return true;
for (ClassNode classNode : lub.getInterfaces()) {
if (source.implementsInterface(classNode)) return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"implementsInterfaceOrSubclassOf",
"(",
"final",
"ClassNode",
"source",
",",
"final",
"ClassNode",
"targetType",
")",
"{",
"if",
"(",
"source",
".",
"isDerivedFrom",
"(",
"targetType",
")",
"||",
"source",
".",
"implementsInterface",
... | Determines if the source class implements an interface or subclasses the target type.
This method takes the {@link org.codehaus.groovy.ast.tools.WideningCategories.LowestUpperBoundClassNode lowest
upper bound class node} type into account, allowing to remove unnecessary casts.
@param source the type of interest
@param targetType the target type of interest | [
"Determines",
"if",
"the",
"source",
"class",
"implements",
"an",
"interface",
"or",
"subclasses",
"the",
"target",
"type",
".",
"This",
"method",
"takes",
"the",
"{"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/ast/tools/WideningCategories.java#L736-L746 |
OpenLiberty/open-liberty | dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsConfigHelper.java | StatsConfigHelper.getTranslatedStatsName | public static String getTranslatedStatsName(String statsName, String statsType, Locale locale) {
String[] _stats = parseStatsType(statsType);
for (int i = 0; i < _stats.length; i++) {
PmiModuleConfig cfg = getTranslatedStatsConfig(_stats[i], locale);
if (cfg != null) {
NLS aNLS = getNLS(locale, cfg.getResourceBundle(), statsType);
if (aNLS != null) {
String trName;
try {
trName = aNLS.getString(statsName);
} catch (MissingResourceException mre) {
trName = statsName;
}
if (trName != null)
return trName;
}
}
}
return statsName;
} | java | public static String getTranslatedStatsName(String statsName, String statsType, Locale locale) {
String[] _stats = parseStatsType(statsType);
for (int i = 0; i < _stats.length; i++) {
PmiModuleConfig cfg = getTranslatedStatsConfig(_stats[i], locale);
if (cfg != null) {
NLS aNLS = getNLS(locale, cfg.getResourceBundle(), statsType);
if (aNLS != null) {
String trName;
try {
trName = aNLS.getString(statsName);
} catch (MissingResourceException mre) {
trName = statsName;
}
if (trName != null)
return trName;
}
}
}
return statsName;
} | [
"public",
"static",
"String",
"getTranslatedStatsName",
"(",
"String",
"statsName",
",",
"String",
"statsType",
",",
"Locale",
"locale",
")",
"{",
"String",
"[",
"]",
"_stats",
"=",
"parseStatsType",
"(",
"statsType",
")",
";",
"for",
"(",
"int",
"i",
"=",
... | Method to translate the Stats instance/group name in the tree. Used by Admin Console | [
"Method",
"to",
"translate",
"the",
"Stats",
"instance",
"/",
"group",
"name",
"in",
"the",
"tree",
".",
"Used",
"by",
"Admin",
"Console"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/StatsConfigHelper.java#L162-L182 |
aws/aws-sdk-java | aws-java-sdk-iot1clickprojects/src/main/java/com/amazonaws/services/iot1clickprojects/model/ProjectSummary.java | ProjectSummary.withTags | public ProjectSummary withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public ProjectSummary withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"ProjectSummary",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The tags (metadata key/value pairs) associated with the project.
</p>
@param tags
The tags (metadata key/value pairs) associated with the project.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"tags",
"(",
"metadata",
"key",
"/",
"value",
"pairs",
")",
"associated",
"with",
"the",
"project",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-iot1clickprojects/src/main/java/com/amazonaws/services/iot1clickprojects/model/ProjectSummary.java#L264-L267 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/collection/impl/queue/QueueContainer.java | QueueContainer.addAll | public Map<Long, Data> addAll(Collection<Data> dataList) {
Map<Long, Data> map = createHashMap(dataList.size());
List<QueueItem> list = new ArrayList<QueueItem>(dataList.size());
for (Data data : dataList) {
QueueItem item = new QueueItem(this, nextId(), null);
if (!store.isEnabled() || store.getMemoryLimit() > getItemQueue().size()) {
item.setData(data);
}
map.put(item.getItemId(), data);
list.add(item);
}
if (store.isEnabled() && !map.isEmpty()) {
try {
store.storeAll(map);
} catch (Exception e) {
throw new HazelcastException(e);
}
}
if (!list.isEmpty()) {
getItemQueue().addAll(list);
cancelEvictionIfExists();
}
return map;
} | java | public Map<Long, Data> addAll(Collection<Data> dataList) {
Map<Long, Data> map = createHashMap(dataList.size());
List<QueueItem> list = new ArrayList<QueueItem>(dataList.size());
for (Data data : dataList) {
QueueItem item = new QueueItem(this, nextId(), null);
if (!store.isEnabled() || store.getMemoryLimit() > getItemQueue().size()) {
item.setData(data);
}
map.put(item.getItemId(), data);
list.add(item);
}
if (store.isEnabled() && !map.isEmpty()) {
try {
store.storeAll(map);
} catch (Exception e) {
throw new HazelcastException(e);
}
}
if (!list.isEmpty()) {
getItemQueue().addAll(list);
cancelEvictionIfExists();
}
return map;
} | [
"public",
"Map",
"<",
"Long",
",",
"Data",
">",
"addAll",
"(",
"Collection",
"<",
"Data",
">",
"dataList",
")",
"{",
"Map",
"<",
"Long",
",",
"Data",
">",
"map",
"=",
"createHashMap",
"(",
"dataList",
".",
"size",
"(",
")",
")",
";",
"List",
"<",
... | Adds all items from the {@code dataList} to the queue. The data will be stored in the queue store if configured and
enabled. If the store is enabled, only {@link QueueStoreWrapper#getMemoryLimit()} item data will be stored in memory.
Cancels the eviction if one is scheduled.
@param dataList the items to be added to the queue and stored in the queue store
@return map of item ID and items added | [
"Adds",
"all",
"items",
"from",
"the",
"{",
"@code",
"dataList",
"}",
"to",
"the",
"queue",
".",
"The",
"data",
"will",
"be",
"stored",
"in",
"the",
"queue",
"store",
"if",
"configured",
"and",
"enabled",
".",
"If",
"the",
"store",
"is",
"enabled",
"on... | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/collection/impl/queue/QueueContainer.java#L479-L502 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.feature.cmdline/src/com/ibm/ws/kernel/feature/internal/cmdline/ClasspathAction.java | ClasspathAction.createClasspathJar | private void createClasspathJar(File outputFile, String classpath) throws IOException {
FileOutputStream out = new FileOutputStream(outputFile);
try {
Manifest manifest = new Manifest();
Attributes attrs = manifest.getMainAttributes();
attrs.put(Attributes.Name.MANIFEST_VERSION, "1.0");
attrs.put(Attributes.Name.CLASS_PATH, classpath);
new JarOutputStream(out, manifest).close();
} finally {
out.close();
}
} | java | private void createClasspathJar(File outputFile, String classpath) throws IOException {
FileOutputStream out = new FileOutputStream(outputFile);
try {
Manifest manifest = new Manifest();
Attributes attrs = manifest.getMainAttributes();
attrs.put(Attributes.Name.MANIFEST_VERSION, "1.0");
attrs.put(Attributes.Name.CLASS_PATH, classpath);
new JarOutputStream(out, manifest).close();
} finally {
out.close();
}
} | [
"private",
"void",
"createClasspathJar",
"(",
"File",
"outputFile",
",",
"String",
"classpath",
")",
"throws",
"IOException",
"{",
"FileOutputStream",
"out",
"=",
"new",
"FileOutputStream",
"(",
"outputFile",
")",
";",
"try",
"{",
"Manifest",
"manifest",
"=",
"n... | Writes a JAR with a MANIFEST.MF containing the Class-Path string.
@param outputFile the output file to create
@param classpath the Class-Path string
@throws IOException if an error occurs creating the file | [
"Writes",
"a",
"JAR",
"with",
"a",
"MANIFEST",
".",
"MF",
"containing",
"the",
"Class",
"-",
"Path",
"string",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.feature.cmdline/src/com/ibm/ws/kernel/feature/internal/cmdline/ClasspathAction.java#L322-L333 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLSubObjectPropertyOfAxiomImpl_CustomFieldSerializer.java | OWLSubObjectPropertyOfAxiomImpl_CustomFieldSerializer.deserializeInstance | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLSubObjectPropertyOfAxiomImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} | java | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLSubObjectPropertyOfAxiomImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} | [
"@",
"Override",
"public",
"void",
"deserializeInstance",
"(",
"SerializationStreamReader",
"streamReader",
",",
"OWLSubObjectPropertyOfAxiomImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"deserialize",
"(",
"streamReader",
",",
"instance",
")",
";",
"}"... | Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the deserialization operation is not
successful | [
"Deserializes",
"the",
"content",
"of",
"the",
"object",
"from",
"the",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamReader",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLSubObjectPropertyOfAxiomImpl_CustomFieldSerializer.java#L97-L100 |
VoltDB/voltdb | src/frontend/org/voltdb/jdbc/JDBC4Connection.java | JDBC4Connection.prepareCall | @Override
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
{
if (resultSetType == ResultSet.TYPE_SCROLL_INSENSITIVE && resultSetConcurrency == ResultSet.CONCUR_READ_ONLY)
return prepareCall(sql);
checkClosed();
throw SQLError.noSupport();
} | java | @Override
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
{
if (resultSetType == ResultSet.TYPE_SCROLL_INSENSITIVE && resultSetConcurrency == ResultSet.CONCUR_READ_ONLY)
return prepareCall(sql);
checkClosed();
throw SQLError.noSupport();
} | [
"@",
"Override",
"public",
"CallableStatement",
"prepareCall",
"(",
"String",
"sql",
",",
"int",
"resultSetType",
",",
"int",
"resultSetConcurrency",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"resultSetType",
"==",
"ResultSet",
".",
"TYPE_SCROLL_INSENSITIVE",
"... | Creates a CallableStatement object that will generate ResultSet objects with the given type and concurrency. | [
"Creates",
"a",
"CallableStatement",
"object",
"that",
"will",
"generate",
"ResultSet",
"objects",
"with",
"the",
"given",
"type",
"and",
"concurrency",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4Connection.java#L344-L351 |
mangstadt/biweekly | src/main/java/biweekly/component/ICalComponent.java | ICalComponent.setProperty | public <T extends ICalProperty> List<T> setProperty(Class<T> clazz, T property) {
List<ICalProperty> replaced = properties.replace(clazz, property);
return castList(replaced, clazz);
} | java | public <T extends ICalProperty> List<T> setProperty(Class<T> clazz, T property) {
List<ICalProperty> replaced = properties.replace(clazz, property);
return castList(replaced, clazz);
} | [
"public",
"<",
"T",
"extends",
"ICalProperty",
">",
"List",
"<",
"T",
">",
"setProperty",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"T",
"property",
")",
"{",
"List",
"<",
"ICalProperty",
">",
"replaced",
"=",
"properties",
".",
"replace",
"(",
"clazz... | Replaces all existing properties of the given class with a single
property instance. If the property instance is null, then all instances
of that property will be removed.
@param clazz the property class (e.g. "DateStart.class")
@param property the property or null to remove all properties of the
given class
@param <T> the property class
@return the replaced properties (this list is immutable) | [
"Replaces",
"all",
"existing",
"properties",
"of",
"the",
"given",
"class",
"with",
"a",
"single",
"property",
"instance",
".",
"If",
"the",
"property",
"instance",
"is",
"null",
"then",
"all",
"instances",
"of",
"that",
"property",
"will",
"be",
"removed",
... | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/component/ICalComponent.java#L132-L135 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java | DestinationManager.getDestination | public DestinationHandler getDestination(JsDestinationAddress destinationAddr, boolean includeInvisible)
throws SITemporaryDestinationNotFoundException, SIResourceException, SINotPossibleInCurrentConfigurationException
{
return getDestination(destinationAddr.getDestinationName(),
destinationAddr.getBusName(),
includeInvisible,
false);
} | java | public DestinationHandler getDestination(JsDestinationAddress destinationAddr, boolean includeInvisible)
throws SITemporaryDestinationNotFoundException, SIResourceException, SINotPossibleInCurrentConfigurationException
{
return getDestination(destinationAddr.getDestinationName(),
destinationAddr.getBusName(),
includeInvisible,
false);
} | [
"public",
"DestinationHandler",
"getDestination",
"(",
"JsDestinationAddress",
"destinationAddr",
",",
"boolean",
"includeInvisible",
")",
"throws",
"SITemporaryDestinationNotFoundException",
",",
"SIResourceException",
",",
"SINotPossibleInCurrentConfigurationException",
"{",
"ret... | This method provides lookup of a destination by its address.
If the destination is not
found, it throws SIDestinationNotFoundException.
@param destinationAddr
@return Destination
@throws SIDestinationNotFoundException
@throws SIMPNullParameterException
@throws SIMPDestinationCorruptException | [
"This",
"method",
"provides",
"lookup",
"of",
"a",
"destination",
"by",
"its",
"address",
".",
"If",
"the",
"destination",
"is",
"not",
"found",
"it",
"throws",
"SIDestinationNotFoundException",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/DestinationManager.java#L1116-L1124 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/abst/feature/tracker/PointTrackerKltPyramid.java | PointTrackerKltPyramid.addTrack | public PointTrack addTrack( double x , double y ) {
if( !input.isInBounds((int)x,(int)y))
return null;
// grow the number of tracks if needed
if( unused.isEmpty() )
addTrackToUnused();
// TODO make sure the feature is inside the image
PyramidKltFeature t = unused.remove(unused.size() - 1);
t.setPosition((float)x,(float)y);
tracker.setDescription(t);
PointTrack p = (PointTrack)t.cookie;
p.set(x,y);
if( checkValidSpawn(p) ) {
active.add(t);
return p;
}
return null;
} | java | public PointTrack addTrack( double x , double y ) {
if( !input.isInBounds((int)x,(int)y))
return null;
// grow the number of tracks if needed
if( unused.isEmpty() )
addTrackToUnused();
// TODO make sure the feature is inside the image
PyramidKltFeature t = unused.remove(unused.size() - 1);
t.setPosition((float)x,(float)y);
tracker.setDescription(t);
PointTrack p = (PointTrack)t.cookie;
p.set(x,y);
if( checkValidSpawn(p) ) {
active.add(t);
return p;
}
return null;
} | [
"public",
"PointTrack",
"addTrack",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"if",
"(",
"!",
"input",
".",
"isInBounds",
"(",
"(",
"int",
")",
"x",
",",
"(",
"int",
")",
"y",
")",
")",
"return",
"null",
";",
"// grow the number of tracks if ne... | Creates a new feature track at the specified location. Must only be called after
{@link #process(ImageGray)} has been called. It can fail if there
is insufficient texture
@param x x-coordinate
@param y y-coordinate
@return the new track if successful or null if no new track could be created | [
"Creates",
"a",
"new",
"feature",
"track",
"at",
"the",
"specified",
"location",
".",
"Must",
"only",
"be",
"called",
"after",
"{",
"@link",
"#process",
"(",
"ImageGray",
")",
"}",
"has",
"been",
"called",
".",
"It",
"can",
"fail",
"if",
"there",
"is",
... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/abst/feature/tracker/PointTrackerKltPyramid.java#L139-L162 |
strator-dev/greenpepper-open | extensions-external/fit/src/main/java/com/greenpepper/extensions/fit/Fit.java | Fit.isAFitInterpreter | public static boolean isAFitInterpreter(SystemUnderDevelopment sud, String name)
{
try
{
Object target = sud.getFixture(name).getTarget();
if (target instanceof fit.Fixture && !target.getClass().equals(ActionFixture.class))
return true;
}
catch (Throwable t)
{
}
return false;
} | java | public static boolean isAFitInterpreter(SystemUnderDevelopment sud, String name)
{
try
{
Object target = sud.getFixture(name).getTarget();
if (target instanceof fit.Fixture && !target.getClass().equals(ActionFixture.class))
return true;
}
catch (Throwable t)
{
}
return false;
} | [
"public",
"static",
"boolean",
"isAFitInterpreter",
"(",
"SystemUnderDevelopment",
"sud",
",",
"String",
"name",
")",
"{",
"try",
"{",
"Object",
"target",
"=",
"sud",
".",
"getFixture",
"(",
"name",
")",
".",
"getTarget",
"(",
")",
";",
"if",
"(",
"target"... | <p>isAFitInterpreter.</p>
@param sud a {@link com.greenpepper.systemunderdevelopment.SystemUnderDevelopment} object.
@param name a {@link java.lang.String} object.
@return a boolean. | [
"<p",
">",
"isAFitInterpreter",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/strator-dev/greenpepper-open/blob/71fd244b4989e9cd2d07ae62dd954a1f2a269a92/extensions-external/fit/src/main/java/com/greenpepper/extensions/fit/Fit.java#L75-L88 |
GoogleCloudPlatform/bigdata-interop | gcsio/src/main/java/com/google/cloud/hadoop/gcsio/BatchHelper.java | BatchHelper.awaitRequestsCompletion | private void awaitRequestsCompletion() throws IOException {
// Don't wait until all requests will be completed if enough requests are pending for full batch
while (!responseFutures.isEmpty() && pendingRequests.size() < maxRequestsPerBatch) {
try {
responseFutures.remove().get();
} catch (InterruptedException | ExecutionException e) {
if (e.getCause() instanceof IOException) {
throw (IOException) e.getCause();
}
throw new RuntimeException("Failed to execute batch", e);
}
}
} | java | private void awaitRequestsCompletion() throws IOException {
// Don't wait until all requests will be completed if enough requests are pending for full batch
while (!responseFutures.isEmpty() && pendingRequests.size() < maxRequestsPerBatch) {
try {
responseFutures.remove().get();
} catch (InterruptedException | ExecutionException e) {
if (e.getCause() instanceof IOException) {
throw (IOException) e.getCause();
}
throw new RuntimeException("Failed to execute batch", e);
}
}
} | [
"private",
"void",
"awaitRequestsCompletion",
"(",
")",
"throws",
"IOException",
"{",
"// Don't wait until all requests will be completed if enough requests are pending for full batch",
"while",
"(",
"!",
"responseFutures",
".",
"isEmpty",
"(",
")",
"&&",
"pendingRequests",
"."... | Awaits until all sent requests are completed. Should be serialized | [
"Awaits",
"until",
"all",
"sent",
"requests",
"are",
"completed",
".",
"Should",
"be",
"serialized"
] | train | https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/BatchHelper.java#L259-L271 |
lucee/Lucee | core/src/main/java/lucee/intergral/fusiondebug/server/FDStackFrameImpl.java | FDStackFrameImpl.copyValues | private static List copyValues(FDStackFrameImpl frame, List to, Struct from) {
Iterator it = from.entrySet().iterator();
Entry entry;
while (it.hasNext()) {
entry = (Entry) it.next();
to.add(new FDVariable(frame, (String) entry.getKey(), FDCaster.toFDValue(frame, entry.getValue())));
}
return to;
} | java | private static List copyValues(FDStackFrameImpl frame, List to, Struct from) {
Iterator it = from.entrySet().iterator();
Entry entry;
while (it.hasNext()) {
entry = (Entry) it.next();
to.add(new FDVariable(frame, (String) entry.getKey(), FDCaster.toFDValue(frame, entry.getValue())));
}
return to;
} | [
"private",
"static",
"List",
"copyValues",
"(",
"FDStackFrameImpl",
"frame",
",",
"List",
"to",
",",
"Struct",
"from",
")",
"{",
"Iterator",
"it",
"=",
"from",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"Entry",
"entry",
";",
"while",
"... | copy all data from given struct to given list and translate it to a FDValue
@param to list to fill with values
@param from struct to read values from
@return the given list | [
"copy",
"all",
"data",
"from",
"given",
"struct",
"to",
"given",
"list",
"and",
"translate",
"it",
"to",
"a",
"FDValue"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/intergral/fusiondebug/server/FDStackFrameImpl.java#L208-L216 |
stratosphere/stratosphere | stratosphere-runtime/src/main/java/eu/stratosphere/nephele/execution/RuntimeEnvironment.java | RuntimeEnvironment.getExecutingThread | public Thread getExecutingThread() {
synchronized (this) {
if (this.executingThread == null) {
if (this.taskName == null) {
this.executingThread = new Thread(this);
}
else {
this.executingThread = new Thread(this, getTaskNameWithIndex());
}
}
return this.executingThread;
}
} | java | public Thread getExecutingThread() {
synchronized (this) {
if (this.executingThread == null) {
if (this.taskName == null) {
this.executingThread = new Thread(this);
}
else {
this.executingThread = new Thread(this, getTaskNameWithIndex());
}
}
return this.executingThread;
}
} | [
"public",
"Thread",
"getExecutingThread",
"(",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"this",
".",
"executingThread",
"==",
"null",
")",
"{",
"if",
"(",
"this",
".",
"taskName",
"==",
"null",
")",
"{",
"this",
".",
"executingThread",... | Returns the thread which is assigned to execute the user code.
@return the thread which is assigned to execute the user code | [
"Returns",
"the",
"thread",
"which",
"is",
"assigned",
"to",
"execute",
"the",
"user",
"code",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/execution/RuntimeEnvironment.java#L421-L435 |
pressgang-ccms/PressGangCCMSBuilder | src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java | DocBookBuilder.doPopulateDatabasePass | @SuppressWarnings("unchecked")
private void doPopulateDatabasePass(final BuildData buildData) throws BuildProcessingException {
log.info("Doing " + buildData.getBuildLocale() + " Populate Database Pass");
final ContentSpec contentSpec = buildData.getContentSpec();
final Map<String, BaseTopicWrapper<?>> topics = new HashMap<String, BaseTopicWrapper<?>>();
if (buildData.isTranslationBuild()) {
//Translations should reference an existing historical topic with the fixed urls set, so we assume this to be the case
populateTranslatedTopicDatabase(buildData, topics);
} else {
populateDatabaseTopics(buildData, topics);
}
// Check if the app should be shutdown
if (isShuttingDown.get()) {
return;
}
// Add all the levels to the database
DocBookBuildUtilities.addLevelsToDatabase(buildData.getBuildDatabase(), contentSpec.getBaseLevel());
// Check if the app should be shutdown
if (isShuttingDown.get()) {
return;
}
// Process the topics to make sure they are valid
doTopicPass(buildData, topics);
} | java | @SuppressWarnings("unchecked")
private void doPopulateDatabasePass(final BuildData buildData) throws BuildProcessingException {
log.info("Doing " + buildData.getBuildLocale() + " Populate Database Pass");
final ContentSpec contentSpec = buildData.getContentSpec();
final Map<String, BaseTopicWrapper<?>> topics = new HashMap<String, BaseTopicWrapper<?>>();
if (buildData.isTranslationBuild()) {
//Translations should reference an existing historical topic with the fixed urls set, so we assume this to be the case
populateTranslatedTopicDatabase(buildData, topics);
} else {
populateDatabaseTopics(buildData, topics);
}
// Check if the app should be shutdown
if (isShuttingDown.get()) {
return;
}
// Add all the levels to the database
DocBookBuildUtilities.addLevelsToDatabase(buildData.getBuildDatabase(), contentSpec.getBaseLevel());
// Check if the app should be shutdown
if (isShuttingDown.get()) {
return;
}
// Process the topics to make sure they are valid
doTopicPass(buildData, topics);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"void",
"doPopulateDatabasePass",
"(",
"final",
"BuildData",
"buildData",
")",
"throws",
"BuildProcessingException",
"{",
"log",
".",
"info",
"(",
"\"Doing \"",
"+",
"buildData",
".",
"getBuildLocale",
"... | Populates the SpecTopicDatabase with the SpecTopics inside the content specification. It also adds the equivalent real
topics to each SpecTopic.
@param buildData Information and data structures for the build.
@return True if the database was populated successfully otherwise false.
@throws BuildProcessingException Thrown if an unexpected error occurs during building. | [
"Populates",
"the",
"SpecTopicDatabase",
"with",
"the",
"SpecTopics",
"inside",
"the",
"content",
"specification",
".",
"It",
"also",
"adds",
"the",
"equivalent",
"real",
"topics",
"to",
"each",
"SpecTopic",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java#L718-L746 |
chhh/MSFTBX | MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java | JaxbUtils.unmarshal | public static <T> T unmarshal(Class<T> cl, File f) throws JAXBException {
return unmarshal(cl, new StreamSource(f));
} | java | public static <T> T unmarshal(Class<T> cl, File f) throws JAXBException {
return unmarshal(cl, new StreamSource(f));
} | [
"public",
"static",
"<",
"T",
">",
"T",
"unmarshal",
"(",
"Class",
"<",
"T",
">",
"cl",
",",
"File",
"f",
")",
"throws",
"JAXBException",
"{",
"return",
"unmarshal",
"(",
"cl",
",",
"new",
"StreamSource",
"(",
"f",
")",
")",
";",
"}"
] | Convert the contents of a file to an object of a given class.
@param cl Type of object
@param f File to be read
@return Object of the given type | [
"Convert",
"the",
"contents",
"of",
"a",
"file",
"to",
"an",
"object",
"of",
"a",
"given",
"class",
"."
] | train | https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L253-L255 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/override/RawResolvedFeatures.java | RawResolvedFeatures.getResolvedFeatures | static RawResolvedFeatures getResolvedFeatures(JvmDeclaredType type, CommonTypeComputationServices services) {
final List<Adapter> adapterList = type.eAdapters();
RawResolvedFeatures adapter = (RawResolvedFeatures) EcoreUtil.getAdapter(adapterList, RawResolvedFeatures.class);
if (adapter != null) {
return adapter;
}
final RawResolvedFeatures newAdapter = new RawResolvedFeatures(type, services);
requestNotificationOnChange(type, new Runnable() {
@Override
public void run() {
newAdapter.clear();
adapterList.remove(newAdapter);
}
});
adapterList.add(newAdapter);
return newAdapter;
} | java | static RawResolvedFeatures getResolvedFeatures(JvmDeclaredType type, CommonTypeComputationServices services) {
final List<Adapter> adapterList = type.eAdapters();
RawResolvedFeatures adapter = (RawResolvedFeatures) EcoreUtil.getAdapter(adapterList, RawResolvedFeatures.class);
if (adapter != null) {
return adapter;
}
final RawResolvedFeatures newAdapter = new RawResolvedFeatures(type, services);
requestNotificationOnChange(type, new Runnable() {
@Override
public void run() {
newAdapter.clear();
adapterList.remove(newAdapter);
}
});
adapterList.add(newAdapter);
return newAdapter;
} | [
"static",
"RawResolvedFeatures",
"getResolvedFeatures",
"(",
"JvmDeclaredType",
"type",
",",
"CommonTypeComputationServices",
"services",
")",
"{",
"final",
"List",
"<",
"Adapter",
">",
"adapterList",
"=",
"type",
".",
"eAdapters",
"(",
")",
";",
"RawResolvedFeatures"... | Returns an existing instance of {@link RawResolvedFeatures} or creates a new one that
will be cached on the type. It will not add itself as {@link EContentAdapter} but use
the {@link JvmTypeChangeDispatcher} instead. | [
"Returns",
"an",
"existing",
"instance",
"of",
"{"
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/override/RawResolvedFeatures.java#L63-L79 |
powermock/powermock | powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java | PowerMock.createStrictMock | public static <T> T createStrictMock(Class<T> type, ConstructorArgs constructorArgs, Method... methods) {
return doMock(type, false, new StrictMockStrategy(), constructorArgs, methods);
} | java | public static <T> T createStrictMock(Class<T> type, ConstructorArgs constructorArgs, Method... methods) {
return doMock(type, false, new StrictMockStrategy(), constructorArgs, methods);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"createStrictMock",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"ConstructorArgs",
"constructorArgs",
",",
"Method",
"...",
"methods",
")",
"{",
"return",
"doMock",
"(",
"type",
",",
"false",
",",
"new",
"StrictMockStr... | Creates a strict mock object that supports mocking of final and native
methods and invokes a specific constructor.
@param <T> the type of the mock object
@param type the type of the mock object
@param constructorArgs The constructor arguments that will be used to invoke a
special constructor.
@param methods optionally what methods to mock
@return the mock object. | [
"Creates",
"a",
"strict",
"mock",
"object",
"that",
"supports",
"mocking",
"of",
"final",
"and",
"native",
"methods",
"and",
"invokes",
"a",
"specific",
"constructor",
"."
] | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L190-L192 |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/CmsRenderer.java | CmsRenderer.renderDescription | private void renderDescription(CmsTabInfo tabInfo, Panel descriptionParent) {
if (tabInfo.getDescription() != null) {
HTML descriptionLabel = new HTML();
descriptionLabel.addStyleName(I_CmsLayoutBundle.INSTANCE.form().tabDescription());
if (!tabInfo.getDescription().startsWith("<div")) {
// add default styling in case of simple HTML
descriptionLabel.addStyleName(I_CmsLayoutBundle.INSTANCE.form().tabDescriptionPanel());
}
descriptionLabel.setHTML(tabInfo.getDescription());
descriptionParent.add(descriptionLabel);
}
} | java | private void renderDescription(CmsTabInfo tabInfo, Panel descriptionParent) {
if (tabInfo.getDescription() != null) {
HTML descriptionLabel = new HTML();
descriptionLabel.addStyleName(I_CmsLayoutBundle.INSTANCE.form().tabDescription());
if (!tabInfo.getDescription().startsWith("<div")) {
// add default styling in case of simple HTML
descriptionLabel.addStyleName(I_CmsLayoutBundle.INSTANCE.form().tabDescriptionPanel());
}
descriptionLabel.setHTML(tabInfo.getDescription());
descriptionParent.add(descriptionLabel);
}
} | [
"private",
"void",
"renderDescription",
"(",
"CmsTabInfo",
"tabInfo",
",",
"Panel",
"descriptionParent",
")",
"{",
"if",
"(",
"tabInfo",
".",
"getDescription",
"(",
")",
"!=",
"null",
")",
"{",
"HTML",
"descriptionLabel",
"=",
"new",
"HTML",
"(",
")",
";",
... | Renders the tab description in a given panel.<p>
@param tabInfo the tab info object
@param descriptionParent the panel in which to render the tab description | [
"Renders",
"the",
"tab",
"description",
"in",
"a",
"given",
"panel",
".",
"<p",
">",
"@param",
"tabInfo",
"the",
"tab",
"info",
"object"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/CmsRenderer.java#L899-L911 |
mapsforge/mapsforge | mapsforge-core/src/main/java/org/mapsforge/core/model/LineSegment.java | LineSegment.pointAlongLineSegment | public Point pointAlongLineSegment(double distance) {
if (start.x == end.x) {
// we have a vertical line
if (start.y > end.y) {
return new Point(end.x, end.y + distance);
} else {
return new Point(start.x, start.y + distance);
}
} else {
double slope = (end.y - start.y) / (end.x - start.x);
double dx = Math.sqrt((distance * distance) / (1 + (slope * slope)));
if (end.x < start.x) {
dx *= -1;
}
return new Point(start.x + dx, start.y + slope * dx);
}
} | java | public Point pointAlongLineSegment(double distance) {
if (start.x == end.x) {
// we have a vertical line
if (start.y > end.y) {
return new Point(end.x, end.y + distance);
} else {
return new Point(start.x, start.y + distance);
}
} else {
double slope = (end.y - start.y) / (end.x - start.x);
double dx = Math.sqrt((distance * distance) / (1 + (slope * slope)));
if (end.x < start.x) {
dx *= -1;
}
return new Point(start.x + dx, start.y + slope * dx);
}
} | [
"public",
"Point",
"pointAlongLineSegment",
"(",
"double",
"distance",
")",
"{",
"if",
"(",
"start",
".",
"x",
"==",
"end",
".",
"x",
")",
"{",
"// we have a vertical line",
"if",
"(",
"start",
".",
"y",
">",
"end",
".",
"y",
")",
"{",
"return",
"new",... | Computes a Point along the line segment with a given distance to the start Point.
@param distance distance from start point
@return point at given distance from start point | [
"Computes",
"a",
"Point",
"along",
"the",
"line",
"segment",
"with",
"a",
"given",
"distance",
"to",
"the",
"start",
"Point",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/model/LineSegment.java#L197-L213 |
bazaarvoice/ostrich | core/src/main/java/com/bazaarvoice/ostrich/discovery/ConfiguredFixedHostDiscoverySource.java | ConfiguredFixedHostDiscoverySource.serialize | @SuppressWarnings("UnusedParameters")
protected String serialize(String serviceName, String id, Payload payload) {
return String.valueOf(payload);
} | java | @SuppressWarnings("UnusedParameters")
protected String serialize(String serviceName, String id, Payload payload) {
return String.valueOf(payload);
} | [
"@",
"SuppressWarnings",
"(",
"\"UnusedParameters\"",
")",
"protected",
"String",
"serialize",
"(",
"String",
"serviceName",
",",
"String",
"id",
",",
"Payload",
"payload",
")",
"{",
"return",
"String",
".",
"valueOf",
"(",
"payload",
")",
";",
"}"
] | Subclasses may override this to customize the persistent format of the payload. | [
"Subclasses",
"may",
"override",
"this",
"to",
"customize",
"the",
"persistent",
"format",
"of",
"the",
"payload",
"."
] | train | https://github.com/bazaarvoice/ostrich/blob/13591867870ab23445253f11fc872662a8028191/core/src/main/java/com/bazaarvoice/ostrich/discovery/ConfiguredFixedHostDiscoverySource.java#L64-L67 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java | HadoopUtils.setWriterDirOctalPermissions | public static void setWriterDirOctalPermissions(State state, int numBranches, int branchId, String octalPermissions) {
state.setProp(
ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_DIR_PERMISSIONS, numBranches, branchId),
octalPermissions);
} | java | public static void setWriterDirOctalPermissions(State state, int numBranches, int branchId, String octalPermissions) {
state.setProp(
ForkOperatorUtils.getPropertyNameForBranch(ConfigurationKeys.WRITER_DIR_PERMISSIONS, numBranches, branchId),
octalPermissions);
} | [
"public",
"static",
"void",
"setWriterDirOctalPermissions",
"(",
"State",
"state",
",",
"int",
"numBranches",
",",
"int",
"branchId",
",",
"String",
"octalPermissions",
")",
"{",
"state",
".",
"setProp",
"(",
"ForkOperatorUtils",
".",
"getPropertyNameForBranch",
"("... | Given a {@link String} in octal notation, set a key, value pair in the given {@link State} for the writer to
use when creating directories. This method should be used in conjunction with {@link #deserializeWriterDirPermissions(State, int, int)}. | [
"Given",
"a",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/HadoopUtils.java#L876-L880 |
apache/groovy | src/main/java/org/codehaus/groovy/vmplugin/v5/PluginDefaultGroovyMethods.java | PluginDefaultGroovyMethods.putAt | public static void putAt(StringBuilder self, IntRange range, Object value) {
RangeInfo info = subListBorders(self.length(), range);
self.replace(info.from, info.to, value.toString());
} | java | public static void putAt(StringBuilder self, IntRange range, Object value) {
RangeInfo info = subListBorders(self.length(), range);
self.replace(info.from, info.to, value.toString());
} | [
"public",
"static",
"void",
"putAt",
"(",
"StringBuilder",
"self",
",",
"IntRange",
"range",
",",
"Object",
"value",
")",
"{",
"RangeInfo",
"info",
"=",
"subListBorders",
"(",
"self",
".",
"length",
"(",
")",
",",
"range",
")",
";",
"self",
".",
"replace... | Support the range subscript operator for StringBuilder.
Index values are treated as characters within the builder.
@param self a StringBuilder
@param range a Range
@param value the object that's toString() will be inserted | [
"Support",
"the",
"range",
"subscript",
"operator",
"for",
"StringBuilder",
".",
"Index",
"values",
"are",
"treated",
"as",
"characters",
"within",
"the",
"builder",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/vmplugin/v5/PluginDefaultGroovyMethods.java#L118-L121 |
looly/hutool | hutool-log/src/main/java/cn/hutool/log/dialect/jdk/JdkLog.java | JdkLog.logIfEnabled | private void logIfEnabled(Level level, Throwable throwable, String format, Object[] arguments){
this.logIfEnabled(FQCN_SELF, level, throwable, format, arguments);
} | java | private void logIfEnabled(Level level, Throwable throwable, String format, Object[] arguments){
this.logIfEnabled(FQCN_SELF, level, throwable, format, arguments);
} | [
"private",
"void",
"logIfEnabled",
"(",
"Level",
"level",
",",
"Throwable",
"throwable",
",",
"String",
"format",
",",
"Object",
"[",
"]",
"arguments",
")",
"{",
"this",
".",
"logIfEnabled",
"(",
"FQCN_SELF",
",",
"level",
",",
"throwable",
",",
"format",
... | 打印对应等级的日志
@param level 等级
@param throwable 异常对象
@param format 消息模板
@param arguments 参数 | [
"打印对应等级的日志"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-log/src/main/java/cn/hutool/log/dialect/jdk/JdkLog.java#L167-L169 |
Azure/azure-sdk-for-java | cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/CollectionPartitionsInner.java | CollectionPartitionsInner.listMetricsAsync | public Observable<List<PartitionMetricInner>> listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) {
return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter).map(new Func1<ServiceResponse<List<PartitionMetricInner>>, List<PartitionMetricInner>>() {
@Override
public List<PartitionMetricInner> call(ServiceResponse<List<PartitionMetricInner>> response) {
return response.body();
}
});
} | java | public Observable<List<PartitionMetricInner>> listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String filter) {
return listMetricsWithServiceResponseAsync(resourceGroupName, accountName, databaseRid, collectionRid, filter).map(new Func1<ServiceResponse<List<PartitionMetricInner>>, List<PartitionMetricInner>>() {
@Override
public List<PartitionMetricInner> call(ServiceResponse<List<PartitionMetricInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"PartitionMetricInner",
">",
">",
"listMetricsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"databaseRid",
",",
"String",
"collectionRid",
",",
"String",
"filter",
")",
"{",
"retu... | Retrieves the metrics determined by the given filter for the given collection, split by partition.
@param resourceGroupName Name of an Azure resource group.
@param accountName Cosmos DB database account name.
@param databaseRid Cosmos DB database rid.
@param collectionRid Cosmos DB collection rid.
@param filter An OData filter expression that describes a subset of metrics to return. The parameters that can be filtered are name.value (name of the metric, can have an or of multiple names), startTime, endTime, and timeGrain. The supported operator is eq.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<PartitionMetricInner> object | [
"Retrieves",
"the",
"metrics",
"determined",
"by",
"the",
"given",
"filter",
"for",
"the",
"given",
"collection",
"split",
"by",
"partition",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/CollectionPartitionsInner.java#L109-L116 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/DetectorFactory.java | DetectorFactory.getReportedBugPatterns | public Set<BugPattern> getReportedBugPatterns() {
Set<BugPattern> result = new TreeSet<>();
StringTokenizer tok = new StringTokenizer(reports, ",");
while (tok.hasMoreTokens()) {
String type = tok.nextToken();
BugPattern bugPattern = DetectorFactoryCollection.instance().lookupBugPattern(type);
if (bugPattern != null) {
result.add(bugPattern);
}
}
return result;
} | java | public Set<BugPattern> getReportedBugPatterns() {
Set<BugPattern> result = new TreeSet<>();
StringTokenizer tok = new StringTokenizer(reports, ",");
while (tok.hasMoreTokens()) {
String type = tok.nextToken();
BugPattern bugPattern = DetectorFactoryCollection.instance().lookupBugPattern(type);
if (bugPattern != null) {
result.add(bugPattern);
}
}
return result;
} | [
"public",
"Set",
"<",
"BugPattern",
">",
"getReportedBugPatterns",
"(",
")",
"{",
"Set",
"<",
"BugPattern",
">",
"result",
"=",
"new",
"TreeSet",
"<>",
"(",
")",
";",
"StringTokenizer",
"tok",
"=",
"new",
"StringTokenizer",
"(",
"reports",
",",
"\",\"",
")... | Get set of all BugPatterns this detector reports. An empty set means that
we don't know what kind of bug patterns might be reported. | [
"Get",
"set",
"of",
"all",
"BugPatterns",
"this",
"detector",
"reports",
".",
"An",
"empty",
"set",
"means",
"that",
"we",
"don",
"t",
"know",
"what",
"kind",
"of",
"bug",
"patterns",
"might",
"be",
"reported",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/DetectorFactory.java#L345-L356 |
zaproxy/zaproxy | src/org/parosproxy/paros/core/scanner/AbstractPlugin.java | AbstractPlugin.matchBodyPattern | protected boolean matchBodyPattern(HttpMessage msg, Pattern pattern, StringBuilder sb) { // ZAP: Changed the type of the parameter "sb" to StringBuilder.
Matcher matcher = pattern.matcher(msg.getResponseBody().toString());
boolean result = matcher.find();
if (result) {
if (sb != null) {
sb.append(matcher.group());
}
}
return result;
} | java | protected boolean matchBodyPattern(HttpMessage msg, Pattern pattern, StringBuilder sb) { // ZAP: Changed the type of the parameter "sb" to StringBuilder.
Matcher matcher = pattern.matcher(msg.getResponseBody().toString());
boolean result = matcher.find();
if (result) {
if (sb != null) {
sb.append(matcher.group());
}
}
return result;
} | [
"protected",
"boolean",
"matchBodyPattern",
"(",
"HttpMessage",
"msg",
",",
"Pattern",
"pattern",
",",
"StringBuilder",
"sb",
")",
"{",
"// ZAP: Changed the type of the parameter \"sb\" to StringBuilder.\r",
"Matcher",
"matcher",
"=",
"pattern",
".",
"matcher",
"(",
"msg"... | Check if the given pattern can be found in the msg body. If the supplied
StringBuilder is not null, append the result to the StringBuilder.
@param msg the message that will be checked
@param pattern the pattern that will be used
@param sb where the regex match should be appended
@return true if the pattern can be found. | [
"Check",
"if",
"the",
"given",
"pattern",
"can",
"be",
"found",
"in",
"the",
"msg",
"body",
".",
"If",
"the",
"supplied",
"StringBuilder",
"is",
"not",
"null",
"append",
"the",
"result",
"to",
"the",
"StringBuilder",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/core/scanner/AbstractPlugin.java#L730-L739 |
wdullaer/SwipeActionAdapter | library/src/main/java/com/wdullaer/swipeactionadapter/SwipeActionAdapter.java | SwipeActionAdapter.setListView | public SwipeActionAdapter setListView(ListView listView){
this.mListView = listView;
mTouchListener = new SwipeActionTouchListener(listView,this);
this.mListView.setOnTouchListener(mTouchListener);
this.mListView.setOnScrollListener(mTouchListener.makeScrollListener());
this.mListView.setClipChildren(false);
mTouchListener.setFadeOut(mFadeOut);
mTouchListener.setDimBackgrounds(mDimBackgrounds);
mTouchListener.setFixedBackgrounds(mFixedBackgrounds);
mTouchListener.setNormalSwipeFraction(mNormalSwipeFraction);
mTouchListener.setFarSwipeFraction(mFarSwipeFraction);
return this;
} | java | public SwipeActionAdapter setListView(ListView listView){
this.mListView = listView;
mTouchListener = new SwipeActionTouchListener(listView,this);
this.mListView.setOnTouchListener(mTouchListener);
this.mListView.setOnScrollListener(mTouchListener.makeScrollListener());
this.mListView.setClipChildren(false);
mTouchListener.setFadeOut(mFadeOut);
mTouchListener.setDimBackgrounds(mDimBackgrounds);
mTouchListener.setFixedBackgrounds(mFixedBackgrounds);
mTouchListener.setNormalSwipeFraction(mNormalSwipeFraction);
mTouchListener.setFarSwipeFraction(mFarSwipeFraction);
return this;
} | [
"public",
"SwipeActionAdapter",
"setListView",
"(",
"ListView",
"listView",
")",
"{",
"this",
".",
"mListView",
"=",
"listView",
";",
"mTouchListener",
"=",
"new",
"SwipeActionTouchListener",
"(",
"listView",
",",
"this",
")",
";",
"this",
".",
"mListView",
".",... | We need the ListView to be able to modify it's OnTouchListener
@param listView the ListView to which the adapter will be attached
@return A reference to the current instance so that commands can be chained | [
"We",
"need",
"the",
"ListView",
"to",
"be",
"able",
"to",
"modify",
"it",
"s",
"OnTouchListener"
] | train | https://github.com/wdullaer/SwipeActionAdapter/blob/24a7e2ed953ac11ea0d8875d375bba571ffeba55/library/src/main/java/com/wdullaer/swipeactionadapter/SwipeActionAdapter.java#L211-L223 |
truward/utc-time | utc-time-sql/src/main/java/com/truward/time/jdbc/UtcTimeSqlUtil.java | UtcTimeSqlUtil.getUtcTime | @Nonnull
public static UtcTime getUtcTime(@Nonnull ResultSet rs,
@Nonnull String columnName,
@Nullable UtcTime defaultTime) throws SQLException {
final UtcTime result = getNullableUtcTime(rs, columnName, defaultTime);
if (result != null) {
return result;
}
throw new IllegalStateException("Unable to retrieve time from the given resultSet, columnName=" + columnName);
} | java | @Nonnull
public static UtcTime getUtcTime(@Nonnull ResultSet rs,
@Nonnull String columnName,
@Nullable UtcTime defaultTime) throws SQLException {
final UtcTime result = getNullableUtcTime(rs, columnName, defaultTime);
if (result != null) {
return result;
}
throw new IllegalStateException("Unable to retrieve time from the given resultSet, columnName=" + columnName);
} | [
"@",
"Nonnull",
"public",
"static",
"UtcTime",
"getUtcTime",
"(",
"@",
"Nonnull",
"ResultSet",
"rs",
",",
"@",
"Nonnull",
"String",
"columnName",
",",
"@",
"Nullable",
"UtcTime",
"defaultTime",
")",
"throws",
"SQLException",
"{",
"final",
"UtcTime",
"result",
... | Retrieves UTC time from the given {@link java.sql.ResultSet}.
Throws {@link java.lang.IllegalStateException} if time is null.
@param rs Result set, must be in a state, where a value can be retrieved
@param columnName Column name, associated with timestamp value, can hold null value
@param defaultTime Default value, that should be used if returned timestamp is null
@return UtcTime instance
@throws SQLException On SQL error
@throws java.lang.IllegalStateException If retrieved time is null and defaultTime is null | [
"Retrieves",
"UTC",
"time",
"from",
"the",
"given",
"{",
"@link",
"java",
".",
"sql",
".",
"ResultSet",
"}",
".",
"Throws",
"{",
"@link",
"java",
".",
"lang",
".",
"IllegalStateException",
"}",
"if",
"time",
"is",
"null",
"."
] | train | https://github.com/truward/utc-time/blob/a1674770368435484b779f9ab949a1752df77f77/utc-time-sql/src/main/java/com/truward/time/jdbc/UtcTimeSqlUtil.java#L59-L69 |
voldemort/voldemort | src/java/voldemort/client/rebalance/task/RebalanceTask.java | RebalanceTask.taskDone | protected void taskDone(int taskId, int rebalanceAsyncId) {
String durationString = "";
if(taskCompletionTimeMs >= 0) {
long durationMs = System.currentTimeMillis() - taskCompletionTimeMs;
taskCompletionTimeMs = -1;
durationString = " in " + TimeUnit.MILLISECONDS.toSeconds(durationMs) + " seconds.";
}
taskLog("[TaskId : " + taskId + " ] Successfully finished rebalance of "
+ partitionStoreCount
+ " for async operation id " + rebalanceAsyncId + durationString);
progressBar.completeTask(taskId, partitionStoreCount);
} | java | protected void taskDone(int taskId, int rebalanceAsyncId) {
String durationString = "";
if(taskCompletionTimeMs >= 0) {
long durationMs = System.currentTimeMillis() - taskCompletionTimeMs;
taskCompletionTimeMs = -1;
durationString = " in " + TimeUnit.MILLISECONDS.toSeconds(durationMs) + " seconds.";
}
taskLog("[TaskId : " + taskId + " ] Successfully finished rebalance of "
+ partitionStoreCount
+ " for async operation id " + rebalanceAsyncId + durationString);
progressBar.completeTask(taskId, partitionStoreCount);
} | [
"protected",
"void",
"taskDone",
"(",
"int",
"taskId",
",",
"int",
"rebalanceAsyncId",
")",
"{",
"String",
"durationString",
"=",
"\"\"",
";",
"if",
"(",
"taskCompletionTimeMs",
">=",
"0",
")",
"{",
"long",
"durationMs",
"=",
"System",
".",
"currentTimeMillis"... | Helper method to pretty print progress and timing info.
@param rebalanceAsyncId ID of the async rebalancing task | [
"Helper",
"method",
"to",
"pretty",
"print",
"progress",
"and",
"timing",
"info",
"."
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/rebalance/task/RebalanceTask.java#L158-L170 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/ArrayUtil.java | ArrayUtil.writeShort | public static void writeShort(byte b[], int offset, short value) {
b[offset++] = (byte) (value >>> 8);
b[offset] = (byte)value;
} | java | public static void writeShort(byte b[], int offset, short value) {
b[offset++] = (byte) (value >>> 8);
b[offset] = (byte)value;
} | [
"public",
"static",
"void",
"writeShort",
"(",
"byte",
"b",
"[",
"]",
",",
"int",
"offset",
",",
"short",
"value",
")",
"{",
"b",
"[",
"offset",
"++",
"]",
"=",
"(",
"byte",
")",
"(",
"value",
">>>",
"8",
")",
";",
"b",
"[",
"offset",
"]",
"=",... | Serializes a short into a byte array at a specific offset in big-endian order
@param b byte array in which to write a short value.
@param offset offset within byte array to start writing.
@param value short to write to byte array. | [
"Serializes",
"a",
"short",
"into",
"a",
"byte",
"array",
"at",
"a",
"specific",
"offset",
"in",
"big",
"-",
"endian",
"order"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/util/ArrayUtil.java#L134-L137 |
fozziethebeat/S-Space | src/main/java/edu/ucla/sspace/util/TimeSpan.java | TimeSpan.insideRange | public boolean insideRange(Date startDate, Date endDate) {
Calendar c1 = Calendar.getInstance();
Calendar c2 = Calendar.getInstance();
c1.setTime(startDate);
c2.setTime(endDate);
return isInRange(c1, c2);
} | java | public boolean insideRange(Date startDate, Date endDate) {
Calendar c1 = Calendar.getInstance();
Calendar c2 = Calendar.getInstance();
c1.setTime(startDate);
c2.setTime(endDate);
return isInRange(c1, c2);
} | [
"public",
"boolean",
"insideRange",
"(",
"Date",
"startDate",
",",
"Date",
"endDate",
")",
"{",
"Calendar",
"c1",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"Calendar",
"c2",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"c1",
".",
"setTim... | Returns {@code true} if the end date occurs after the start date during
the period of time represented by this time span. | [
"Returns",
"{"
] | train | https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/util/TimeSpan.java#L346-L352 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java | Types.isCastable | public boolean isCastable(Type t, Type s, Warner warn) {
if (t == s)
return true;
if (t.isPrimitive() != s.isPrimitive()) {
t = skipTypeVars(t, false);
return (isConvertible(t, s, warn)
|| (allowObjectToPrimitiveCast &&
s.isPrimitive() &&
isSubtype(boxedClass(s).type, t)));
}
if (warn != warnStack.head) {
try {
warnStack = warnStack.prepend(warn);
checkUnsafeVarargsConversion(t, s, warn);
return isCastable.visit(t,s);
} finally {
warnStack = warnStack.tail;
}
} else {
return isCastable.visit(t,s);
}
} | java | public boolean isCastable(Type t, Type s, Warner warn) {
if (t == s)
return true;
if (t.isPrimitive() != s.isPrimitive()) {
t = skipTypeVars(t, false);
return (isConvertible(t, s, warn)
|| (allowObjectToPrimitiveCast &&
s.isPrimitive() &&
isSubtype(boxedClass(s).type, t)));
}
if (warn != warnStack.head) {
try {
warnStack = warnStack.prepend(warn);
checkUnsafeVarargsConversion(t, s, warn);
return isCastable.visit(t,s);
} finally {
warnStack = warnStack.tail;
}
} else {
return isCastable.visit(t,s);
}
} | [
"public",
"boolean",
"isCastable",
"(",
"Type",
"t",
",",
"Type",
"s",
",",
"Warner",
"warn",
")",
"{",
"if",
"(",
"t",
"==",
"s",
")",
"return",
"true",
";",
"if",
"(",
"t",
".",
"isPrimitive",
"(",
")",
"!=",
"s",
".",
"isPrimitive",
"(",
")",
... | Is t is castable to s?<br>
s is assumed to be an erased type.<br>
(not defined for Method and ForAll types). | [
"Is",
"t",
"is",
"castable",
"to",
"s?<br",
">",
"s",
"is",
"assumed",
"to",
"be",
"an",
"erased",
"type",
".",
"<br",
">",
"(",
"not",
"defined",
"for",
"Method",
"and",
"ForAll",
"types",
")",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L1387-L1408 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/document/json/JsonObject.java | JsonObject.getAndDecryptBoolean | public Boolean getAndDecryptBoolean(String name, String providerName) throws Exception {
return (Boolean) getAndDecrypt(name, providerName);
} | java | public Boolean getAndDecryptBoolean(String name, String providerName) throws Exception {
return (Boolean) getAndDecrypt(name, providerName);
} | [
"public",
"Boolean",
"getAndDecryptBoolean",
"(",
"String",
"name",
",",
"String",
"providerName",
")",
"throws",
"Exception",
"{",
"return",
"(",
"Boolean",
")",
"getAndDecrypt",
"(",
"name",
",",
"providerName",
")",
";",
"}"
] | Retrieves the decrypted value from the field name and casts it to {@link Boolean}.
Note: Use of the Field Level Encryption functionality provided in the
com.couchbase.client.encryption namespace provided by Couchbase is
subject to the Couchbase Inc. Enterprise Subscription License Agreement
at https://www.couchbase.com/ESLA-11132015.
@param name the name of the field.
@param providerName the provider name of the field.
@return the result or null if it does not exist. | [
"Retrieves",
"the",
"decrypted",
"value",
"from",
"the",
"field",
"name",
"and",
"casts",
"it",
"to",
"{",
"@link",
"Boolean",
"}",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/document/json/JsonObject.java#L664-L666 |
Azure/azure-sdk-for-java | authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleAssignmentsInner.java | RoleAssignmentsInner.createById | public RoleAssignmentInner createById(String roleId, RoleAssignmentCreateParameters parameters) {
return createByIdWithServiceResponseAsync(roleId, parameters).toBlocking().single().body();
} | java | public RoleAssignmentInner createById(String roleId, RoleAssignmentCreateParameters parameters) {
return createByIdWithServiceResponseAsync(roleId, parameters).toBlocking().single().body();
} | [
"public",
"RoleAssignmentInner",
"createById",
"(",
"String",
"roleId",
",",
"RoleAssignmentCreateParameters",
"parameters",
")",
"{",
"return",
"createByIdWithServiceResponseAsync",
"(",
"roleId",
",",
"parameters",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(... | Creates a role assignment by ID.
@param roleId The ID of the role assignment to create.
@param parameters Parameters for the role assignment.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the RoleAssignmentInner object if successful. | [
"Creates",
"a",
"role",
"assignment",
"by",
"ID",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleAssignmentsInner.java#L974-L976 |
JodaOrg/joda-time | src/main/java/org/joda/time/IllegalFieldValueException.java | IllegalFieldValueException.createMessage | private static String createMessage(String fieldName, String value) {
StringBuffer buf = new StringBuffer().append("Value ");
if (value == null) {
buf.append("null");
} else {
buf.append('"');
buf.append(value);
buf.append('"');
}
buf.append(" for ").append(fieldName).append(' ').append("is not supported");
return buf.toString();
} | java | private static String createMessage(String fieldName, String value) {
StringBuffer buf = new StringBuffer().append("Value ");
if (value == null) {
buf.append("null");
} else {
buf.append('"');
buf.append(value);
buf.append('"');
}
buf.append(" for ").append(fieldName).append(' ').append("is not supported");
return buf.toString();
} | [
"private",
"static",
"String",
"createMessage",
"(",
"String",
"fieldName",
",",
"String",
"value",
")",
"{",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
")",
".",
"append",
"(",
"\"Value \"",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
... | Creates a message for the exception.
@param fieldName the field name
@param value the value rejected
@return the message | [
"Creates",
"a",
"message",
"for",
"the",
"exception",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/IllegalFieldValueException.java#L73-L87 |
httl/httl | httl/src/main/java/httl/Engine.java | Engine.getProperty | public int getProperty(String key, int defaultValue) {
String value = getProperty(key, String.class);
return StringUtils.isEmpty(value) ? defaultValue : Integer.parseInt(value);
} | java | public int getProperty(String key, int defaultValue) {
String value = getProperty(key, String.class);
return StringUtils.isEmpty(value) ? defaultValue : Integer.parseInt(value);
} | [
"public",
"int",
"getProperty",
"(",
"String",
"key",
",",
"int",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"getProperty",
"(",
"key",
",",
"String",
".",
"class",
")",
";",
"return",
"StringUtils",
".",
"isEmpty",
"(",
"value",
")",
"?",
"defaul... | Get config int value.
@param key - config key
@param defaultValue - default int value
@return config int value
@see #getEngine() | [
"Get",
"config",
"int",
"value",
"."
] | train | https://github.com/httl/httl/blob/e13e00f4ab41252a8f53d6dafd4a6610be9dcaad/httl/src/main/java/httl/Engine.java#L220-L223 |
bazaarvoice/emodb | common/astyanax/src/main/java/com/bazaarvoice/emodb/common/cassandra/cqldriver/AdaptiveResultSet.java | AdaptiveResultSet.executeAdaptiveQuery | public static ResultSet executeAdaptiveQuery(Session session, Statement statement, int fetchSize) {
int remainingAdaptations = MAX_ADAPTATIONS;
while (true) {
try {
statement.setFetchSize(fetchSize);
ResultSet resultSet = session.execute(statement);
return new AdaptiveResultSet(session, resultSet, remainingAdaptations);
} catch (Throwable t) {
if (isAdaptiveException(t) && --remainingAdaptations != 0 && fetchSize > MIN_FETCH_SIZE) {
// Try again with half the fetch size
fetchSize = Math.max(fetchSize / 2, MIN_FETCH_SIZE);
_log.debug("Repeating previous query with fetch size {} due to {}", fetchSize, t.getMessage());
} else {
throw Throwables.propagate(t);
}
}
}
} | java | public static ResultSet executeAdaptiveQuery(Session session, Statement statement, int fetchSize) {
int remainingAdaptations = MAX_ADAPTATIONS;
while (true) {
try {
statement.setFetchSize(fetchSize);
ResultSet resultSet = session.execute(statement);
return new AdaptiveResultSet(session, resultSet, remainingAdaptations);
} catch (Throwable t) {
if (isAdaptiveException(t) && --remainingAdaptations != 0 && fetchSize > MIN_FETCH_SIZE) {
// Try again with half the fetch size
fetchSize = Math.max(fetchSize / 2, MIN_FETCH_SIZE);
_log.debug("Repeating previous query with fetch size {} due to {}", fetchSize, t.getMessage());
} else {
throw Throwables.propagate(t);
}
}
}
} | [
"public",
"static",
"ResultSet",
"executeAdaptiveQuery",
"(",
"Session",
"session",
",",
"Statement",
"statement",
",",
"int",
"fetchSize",
")",
"{",
"int",
"remainingAdaptations",
"=",
"MAX_ADAPTATIONS",
";",
"while",
"(",
"true",
")",
"{",
"try",
"{",
"stateme... | Executes a query sychronously, dynamically adjusting the fetch size down if necessary. | [
"Executes",
"a",
"query",
"sychronously",
"dynamically",
"adjusting",
"the",
"fetch",
"size",
"down",
"if",
"necessary",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/common/astyanax/src/main/java/com/bazaarvoice/emodb/common/cassandra/cqldriver/AdaptiveResultSet.java#L84-L101 |
Teddy-Zhu/SilentGo | utils/src/main/java/com/silentgo/utils/asm/Label.java | Label.addToSubroutine | void addToSubroutine(final long id, final int nbSubroutines) {
if ((status & VISITED) == 0) {
status |= VISITED;
srcAndRefPositions = new int[nbSubroutines / 32 + 1];
}
srcAndRefPositions[(int) (id >>> 32)] |= (int) id;
} | java | void addToSubroutine(final long id, final int nbSubroutines) {
if ((status & VISITED) == 0) {
status |= VISITED;
srcAndRefPositions = new int[nbSubroutines / 32 + 1];
}
srcAndRefPositions[(int) (id >>> 32)] |= (int) id;
} | [
"void",
"addToSubroutine",
"(",
"final",
"long",
"id",
",",
"final",
"int",
"nbSubroutines",
")",
"{",
"if",
"(",
"(",
"status",
"&",
"VISITED",
")",
"==",
"0",
")",
"{",
"status",
"|=",
"VISITED",
";",
"srcAndRefPositions",
"=",
"new",
"int",
"[",
"nb... | Marks this basic block as belonging to the given subroutine.
@param id
a subroutine id.
@param nbSubroutines
the total number of subroutines in the method. | [
"Marks",
"this",
"basic",
"block",
"as",
"belonging",
"to",
"the",
"given",
"subroutine",
"."
] | train | https://github.com/Teddy-Zhu/SilentGo/blob/27f58b0cafe56b2eb9fc6993efa9ca2b529661e1/utils/src/main/java/com/silentgo/utils/asm/Label.java#L477-L483 |
Viascom/groundwork | foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/authorization/DefaultAuthorizationStrategy.java | DefaultAuthorizationStrategy.addAuthorization | @Override
public void addAuthorization(FoxHttpAuthorizationScope foxHttpAuthorizationScope, FoxHttpAuthorization foxHttpAuthorization) {
if (foxHttpAuthorizations.containsKey(foxHttpAuthorizationScope.toString())) {
foxHttpAuthorizations.get(foxHttpAuthorizationScope.toString()).add(foxHttpAuthorization);
} else {
foxHttpAuthorizations.put(foxHttpAuthorizationScope.toString(), new ArrayList<>(Collections.singletonList(foxHttpAuthorization)));
}
} | java | @Override
public void addAuthorization(FoxHttpAuthorizationScope foxHttpAuthorizationScope, FoxHttpAuthorization foxHttpAuthorization) {
if (foxHttpAuthorizations.containsKey(foxHttpAuthorizationScope.toString())) {
foxHttpAuthorizations.get(foxHttpAuthorizationScope.toString()).add(foxHttpAuthorization);
} else {
foxHttpAuthorizations.put(foxHttpAuthorizationScope.toString(), new ArrayList<>(Collections.singletonList(foxHttpAuthorization)));
}
} | [
"@",
"Override",
"public",
"void",
"addAuthorization",
"(",
"FoxHttpAuthorizationScope",
"foxHttpAuthorizationScope",
",",
"FoxHttpAuthorization",
"foxHttpAuthorization",
")",
"{",
"if",
"(",
"foxHttpAuthorizations",
".",
"containsKey",
"(",
"foxHttpAuthorizationScope",
".",
... | Add a new FoxHttpAuthorization to the AuthorizationStrategy
@param foxHttpAuthorizationScope scope in which the authorization is used
@param foxHttpAuthorization authorization itself | [
"Add",
"a",
"new",
"FoxHttpAuthorization",
"to",
"the",
"AuthorizationStrategy"
] | train | https://github.com/Viascom/groundwork/blob/d3f7d0df65e2e75861fc7db938090683f2cdf919/foxhttp/src/main/java/ch/viascom/groundwork/foxhttp/authorization/DefaultAuthorizationStrategy.java#L59-L67 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/LossLayer.java | LossLayer.f1Score | @Override
public double f1Score(INDArray examples, INDArray labels) {
Evaluation eval = new Evaluation();
eval.eval(labels, activate(examples, false, LayerWorkspaceMgr.noWorkspacesImmutable()));
return eval.f1();
} | java | @Override
public double f1Score(INDArray examples, INDArray labels) {
Evaluation eval = new Evaluation();
eval.eval(labels, activate(examples, false, LayerWorkspaceMgr.noWorkspacesImmutable()));
return eval.f1();
} | [
"@",
"Override",
"public",
"double",
"f1Score",
"(",
"INDArray",
"examples",
",",
"INDArray",
"labels",
")",
"{",
"Evaluation",
"eval",
"=",
"new",
"Evaluation",
"(",
")",
";",
"eval",
".",
"eval",
"(",
"labels",
",",
"activate",
"(",
"examples",
",",
"f... | Returns the f1 score for the given examples.
Think of this to be like a percentage right.
The higher the number the more it got right.
This is on a scale from 0 to 1.
@param examples te the examples to classify (one example in each row)
@param labels the true labels
@return the scores for each ndarray | [
"Returns",
"the",
"f1",
"score",
"for",
"the",
"given",
"examples",
".",
"Think",
"of",
"this",
"to",
"be",
"like",
"a",
"percentage",
"right",
".",
"The",
"higher",
"the",
"number",
"the",
"more",
"it",
"got",
"right",
".",
"This",
"is",
"on",
"a",
... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/LossLayer.java#L225-L230 |
respoke/respoke-sdk-android | respokeSDK/src/main/java/com/digium/respokesdk/RespokeEndpoint.java | RespokeEndpoint.sendMessage | public void sendMessage(String message, boolean push, boolean ccSelf, final Respoke.TaskCompletionListener completionListener) {
if ((null != signalingChannel) && (signalingChannel.connected)) {
try {
JSONObject data = new JSONObject();
data.put("to", endpointID);
data.put("message", message);
data.put("push", push);
data.put("ccSelf", ccSelf);
signalingChannel.sendRESTMessage("post", "/v1/messages", data, new RespokeSignalingChannel.RESTListener() {
@Override
public void onSuccess(Object response) {
Respoke.postTaskSuccess(completionListener);
}
@Override
public void onError(final String errorMessage) {
Respoke.postTaskError(completionListener, errorMessage);
}
});
} catch (JSONException e) {
Respoke.postTaskError(completionListener, "Error encoding message");
}
} else {
Respoke.postTaskError(completionListener, "Can't complete request when not connected. Please reconnect!");
}
} | java | public void sendMessage(String message, boolean push, boolean ccSelf, final Respoke.TaskCompletionListener completionListener) {
if ((null != signalingChannel) && (signalingChannel.connected)) {
try {
JSONObject data = new JSONObject();
data.put("to", endpointID);
data.put("message", message);
data.put("push", push);
data.put("ccSelf", ccSelf);
signalingChannel.sendRESTMessage("post", "/v1/messages", data, new RespokeSignalingChannel.RESTListener() {
@Override
public void onSuccess(Object response) {
Respoke.postTaskSuccess(completionListener);
}
@Override
public void onError(final String errorMessage) {
Respoke.postTaskError(completionListener, errorMessage);
}
});
} catch (JSONException e) {
Respoke.postTaskError(completionListener, "Error encoding message");
}
} else {
Respoke.postTaskError(completionListener, "Can't complete request when not connected. Please reconnect!");
}
} | [
"public",
"void",
"sendMessage",
"(",
"String",
"message",
",",
"boolean",
"push",
",",
"boolean",
"ccSelf",
",",
"final",
"Respoke",
".",
"TaskCompletionListener",
"completionListener",
")",
"{",
"if",
"(",
"(",
"null",
"!=",
"signalingChannel",
")",
"&&",
"(... | Send a message to the endpoint through the infrastructure.
@param message The message to send
@param push A flag indicating if a push notification should be sent for this message
@param ccSelf A flag indicating if the message should be copied to other devices the client might be logged into
@param completionListener A listener to receive a notification on the success of the asynchronous operation | [
"Send",
"a",
"message",
"to",
"the",
"endpoint",
"through",
"the",
"infrastructure",
"."
] | train | https://github.com/respoke/respoke-sdk-android/blob/34a15f0558d29b1f1bc8481bbc5c505e855e05ef/respokeSDK/src/main/java/com/digium/respokesdk/RespokeEndpoint.java#L106-L132 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java | StyleUtils.createMarkerOptions | public static MarkerOptions createMarkerOptions(GeoPackage geoPackage, FeatureRow featureRow, float density, IconCache iconCache) {
MarkerOptions markerOptions = new MarkerOptions();
setFeatureStyle(markerOptions, geoPackage, featureRow, density, iconCache);
return markerOptions;
} | java | public static MarkerOptions createMarkerOptions(GeoPackage geoPackage, FeatureRow featureRow, float density, IconCache iconCache) {
MarkerOptions markerOptions = new MarkerOptions();
setFeatureStyle(markerOptions, geoPackage, featureRow, density, iconCache);
return markerOptions;
} | [
"public",
"static",
"MarkerOptions",
"createMarkerOptions",
"(",
"GeoPackage",
"geoPackage",
",",
"FeatureRow",
"featureRow",
",",
"float",
"density",
",",
"IconCache",
"iconCache",
")",
"{",
"MarkerOptions",
"markerOptions",
"=",
"new",
"MarkerOptions",
"(",
")",
"... | Create new marker options populated with the feature row style (icon or style)
@param geoPackage GeoPackage
@param featureRow feature row
@param density display density: {@link android.util.DisplayMetrics#density}
@param iconCache icon cache
@return marker options populated with the feature style | [
"Create",
"new",
"marker",
"options",
"populated",
"with",
"the",
"feature",
"row",
"style",
"(",
"icon",
"or",
"style",
")"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java#L48-L54 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/MappedParametrizedObjectEntry.java | MappedParametrizedObjectEntry.getParameterBoolean | public Boolean getParameterBoolean(String name, Boolean defaultValue)
{
String value = getParameterValue(name, null);
if (value != null)
{
return new Boolean(value);
}
return defaultValue;
} | java | public Boolean getParameterBoolean(String name, Boolean defaultValue)
{
String value = getParameterValue(name, null);
if (value != null)
{
return new Boolean(value);
}
return defaultValue;
} | [
"public",
"Boolean",
"getParameterBoolean",
"(",
"String",
"name",
",",
"Boolean",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"getParameterValue",
"(",
"name",
",",
"null",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"return",
"new",
"Bool... | Parse named parameter as Boolean.
@param name
parameter name
@param defaultValue
default value
@return boolean value | [
"Parse",
"named",
"parameter",
"as",
"Boolean",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/MappedParametrizedObjectEntry.java#L349-L358 |
Samsung/GearVRf | GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptFile.java | GVRScriptFile.invokeFunction | @Override
public boolean invokeFunction(String funcName, Object[] params) {
// Run script if it is dirty. This makes sure the script is run
// on the same thread as the caller (suppose the caller is always
// calling from the same thread).
checkDirty();
// Skip bad functions
if (isBadFunction(funcName)) {
return false;
}
String statement = getInvokeStatementCached(funcName, params);
synchronized (mEngineLock) {
localBindings = mLocalEngine.getBindings(ScriptContext.ENGINE_SCOPE);
if (localBindings == null) {
localBindings = mLocalEngine.createBindings();
mLocalEngine.setBindings(localBindings, ScriptContext.ENGINE_SCOPE);
}
}
fillBindings(localBindings, params);
try {
mLocalEngine.eval(statement);
} catch (ScriptException e) {
// The function is either undefined or throws, avoid invoking it later
addBadFunction(funcName);
mLastError = e.getMessage();
return false;
} finally {
removeBindings(localBindings, params);
}
return true;
} | java | @Override
public boolean invokeFunction(String funcName, Object[] params) {
// Run script if it is dirty. This makes sure the script is run
// on the same thread as the caller (suppose the caller is always
// calling from the same thread).
checkDirty();
// Skip bad functions
if (isBadFunction(funcName)) {
return false;
}
String statement = getInvokeStatementCached(funcName, params);
synchronized (mEngineLock) {
localBindings = mLocalEngine.getBindings(ScriptContext.ENGINE_SCOPE);
if (localBindings == null) {
localBindings = mLocalEngine.createBindings();
mLocalEngine.setBindings(localBindings, ScriptContext.ENGINE_SCOPE);
}
}
fillBindings(localBindings, params);
try {
mLocalEngine.eval(statement);
} catch (ScriptException e) {
// The function is either undefined or throws, avoid invoking it later
addBadFunction(funcName);
mLastError = e.getMessage();
return false;
} finally {
removeBindings(localBindings, params);
}
return true;
} | [
"@",
"Override",
"public",
"boolean",
"invokeFunction",
"(",
"String",
"funcName",
",",
"Object",
"[",
"]",
"params",
")",
"{",
"// Run script if it is dirty. This makes sure the script is run",
"// on the same thread as the caller (suppose the caller is always",
"// calling from t... | Invokes a function defined in the script.
@param funcName
The function name.
@param params
The parameter array.
@return
A boolean value representing whether the function is
executed correctly. If the function cannot be found, or
parameters don't match, {@code false} is returned. | [
"Invokes",
"a",
"function",
"defined",
"in",
"the",
"script",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptFile.java#L172-L208 |
OpenLiberty/open-liberty | dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/CommonMpJwtFat.java | CommonMpJwtFat.buildStringToCheck | public String buildStringToCheck(String claimIdentifier, String key, String value) throws Exception {
String builtString = claimIdentifier.trim();
if (!claimIdentifier.contains(":")) {
builtString = builtString + ":";
}
if (key != null) {
builtString = builtString + " key: " + key + " value:.*" + value;
} else {
builtString = builtString + " " + value.replace("[", "\\[").replace("]", "\\]");
}
return builtString;
} | java | public String buildStringToCheck(String claimIdentifier, String key, String value) throws Exception {
String builtString = claimIdentifier.trim();
if (!claimIdentifier.contains(":")) {
builtString = builtString + ":";
}
if (key != null) {
builtString = builtString + " key: " + key + " value:.*" + value;
} else {
builtString = builtString + " " + value.replace("[", "\\[").replace("]", "\\]");
}
return builtString;
} | [
"public",
"String",
"buildStringToCheck",
"(",
"String",
"claimIdentifier",
",",
"String",
"key",
",",
"String",
"value",
")",
"throws",
"Exception",
"{",
"String",
"builtString",
"=",
"claimIdentifier",
".",
"trim",
"(",
")",
";",
"if",
"(",
"!",
"claimIdenti... | Build the string to search for (the test app should have logged this string if everything is working as it should)
@param claimIdentifier - an identifier logged by the test app - could be the method used to obtain the key
@param key - the key to validate
@param value - the value to validate
@return - returns the string to look for in the output
@throws Exception | [
"Build",
"the",
"string",
"to",
"search",
"for",
"(",
"the",
"test",
"app",
"should",
"have",
"logged",
"this",
"string",
"if",
"everything",
"is",
"working",
"as",
"it",
"should",
")"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.mp.jwt_fat/fat/src/com/ibm/ws/security/mp/jwt/fat/CommonMpJwtFat.java#L279-L292 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainDatagramSocketImpl.java | AbstractPlainDatagramSocketImpl.joinGroup | protected void joinGroup(SocketAddress mcastaddr, NetworkInterface netIf)
throws IOException {
if (mcastaddr == null || !(mcastaddr instanceof InetSocketAddress))
throw new IllegalArgumentException("Unsupported address type");
join(((InetSocketAddress)mcastaddr).getAddress(), netIf);
} | java | protected void joinGroup(SocketAddress mcastaddr, NetworkInterface netIf)
throws IOException {
if (mcastaddr == null || !(mcastaddr instanceof InetSocketAddress))
throw new IllegalArgumentException("Unsupported address type");
join(((InetSocketAddress)mcastaddr).getAddress(), netIf);
} | [
"protected",
"void",
"joinGroup",
"(",
"SocketAddress",
"mcastaddr",
",",
"NetworkInterface",
"netIf",
")",
"throws",
"IOException",
"{",
"if",
"(",
"mcastaddr",
"==",
"null",
"||",
"!",
"(",
"mcastaddr",
"instanceof",
"InetSocketAddress",
")",
")",
"throw",
"ne... | Join the multicast group.
@param mcastaddr multicast address to join.
@param netIf specifies the local interface to receive multicast
datagram packets
@throws IllegalArgumentException if mcastaddr is null or is a
SocketAddress subclass not supported by this socket
@since 1.4 | [
"Join",
"the",
"multicast",
"group",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/AbstractPlainDatagramSocketImpl.java#L199-L204 |
xmlunit/xmlunit | xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/NodeDescriptor.java | NodeDescriptor.appendNodeDetail | public static void appendNodeDetail(StringBuffer buf, NodeDetail nodeDetail) {
appendNodeDetail(buf, nodeDetail.getNode(), true);
buf.append(" at ").append(nodeDetail.getXpathLocation());
} | java | public static void appendNodeDetail(StringBuffer buf, NodeDetail nodeDetail) {
appendNodeDetail(buf, nodeDetail.getNode(), true);
buf.append(" at ").append(nodeDetail.getXpathLocation());
} | [
"public",
"static",
"void",
"appendNodeDetail",
"(",
"StringBuffer",
"buf",
",",
"NodeDetail",
"nodeDetail",
")",
"{",
"appendNodeDetail",
"(",
"buf",
",",
"nodeDetail",
".",
"getNode",
"(",
")",
",",
"true",
")",
";",
"buf",
".",
"append",
"(",
"\" at \"",
... | Convert a Node into a simple String representation
and append to StringBuffer
@param buf
@param nodeDetail | [
"Convert",
"a",
"Node",
"into",
"a",
"simple",
"String",
"representation",
"and",
"append",
"to",
"StringBuffer"
] | train | https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/NodeDescriptor.java#L56-L59 |
aws/aws-sdk-java | aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/UpdateDevEndpointRequest.java | UpdateDevEndpointRequest.withAddArguments | public UpdateDevEndpointRequest withAddArguments(java.util.Map<String, String> addArguments) {
setAddArguments(addArguments);
return this;
} | java | public UpdateDevEndpointRequest withAddArguments(java.util.Map<String, String> addArguments) {
setAddArguments(addArguments);
return this;
} | [
"public",
"UpdateDevEndpointRequest",
"withAddArguments",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"addArguments",
")",
"{",
"setAddArguments",
"(",
"addArguments",
")",
";",
"return",
"this",
";",
"}"
] | <p>
The map of arguments to add the map of arguments used to configure the DevEndpoint.
</p>
@param addArguments
The map of arguments to add the map of arguments used to configure the DevEndpoint.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"The",
"map",
"of",
"arguments",
"to",
"add",
"the",
"map",
"of",
"arguments",
"used",
"to",
"configure",
"the",
"DevEndpoint",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/UpdateDevEndpointRequest.java#L503-L506 |
apache/incubator-gobblin | gobblin-modules/gobblin-kafka-08/src/main/java/org/apache/gobblin/metrics/kafka/KafkaKeyValueProducerPusher.java | KafkaKeyValueProducerPusher.pushMessages | public void pushMessages(List<Pair<K, V>> messages) {
for (Pair<K, V> message: messages) {
this.futures.offer(this.producer.send(new ProducerRecord<>(topic, message.getKey(), message.getValue()), (recordMetadata, e) -> {
if (e != null) {
log.error("Failed to send message to topic {} due to exception: ", topic, e);
}
}));
}
//Once the low watermark of numFuturesToBuffer is hit, start flushing messages from the futures
// buffer. In order to avoid blocking on newest messages added to futures queue, we only invoke future.get() on
// the oldest messages in the futures buffer. The number of messages to flush is same as the number of messages added
// in the current call. Note this does not completely avoid calling future.get() on the newer messages e.g. when
// multiple threads enter the if{} block concurrently, and invoke flush().
if (this.futures.size() >= this.numFuturesToBuffer) {
flush(messages.size());
}
} | java | public void pushMessages(List<Pair<K, V>> messages) {
for (Pair<K, V> message: messages) {
this.futures.offer(this.producer.send(new ProducerRecord<>(topic, message.getKey(), message.getValue()), (recordMetadata, e) -> {
if (e != null) {
log.error("Failed to send message to topic {} due to exception: ", topic, e);
}
}));
}
//Once the low watermark of numFuturesToBuffer is hit, start flushing messages from the futures
// buffer. In order to avoid blocking on newest messages added to futures queue, we only invoke future.get() on
// the oldest messages in the futures buffer. The number of messages to flush is same as the number of messages added
// in the current call. Note this does not completely avoid calling future.get() on the newer messages e.g. when
// multiple threads enter the if{} block concurrently, and invoke flush().
if (this.futures.size() >= this.numFuturesToBuffer) {
flush(messages.size());
}
} | [
"public",
"void",
"pushMessages",
"(",
"List",
"<",
"Pair",
"<",
"K",
",",
"V",
">",
">",
"messages",
")",
"{",
"for",
"(",
"Pair",
"<",
"K",
",",
"V",
">",
"message",
":",
"messages",
")",
"{",
"this",
".",
"futures",
".",
"offer",
"(",
"this",
... | Push all keyed messages to the Kafka topic.
@param messages List of keyed messages to push to Kakfa. | [
"Push",
"all",
"keyed",
"messages",
"to",
"the",
"Kafka",
"topic",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-kafka-08/src/main/java/org/apache/gobblin/metrics/kafka/KafkaKeyValueProducerPusher.java#L99-L116 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AVA.java | AVA.getValueString | public String getValueString() {
try {
String s = value.getAsString();
if (s == null) {
throw new RuntimeException("AVA string is null");
}
return s;
} catch (IOException e) {
// should not occur
throw new RuntimeException("AVA error: " + e, e);
}
} | java | public String getValueString() {
try {
String s = value.getAsString();
if (s == null) {
throw new RuntimeException("AVA string is null");
}
return s;
} catch (IOException e) {
// should not occur
throw new RuntimeException("AVA error: " + e, e);
}
} | [
"public",
"String",
"getValueString",
"(",
")",
"{",
"try",
"{",
"String",
"s",
"=",
"value",
".",
"getAsString",
"(",
")",
";",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"AVA string is null\"",
")",
";",
"}",
"... | Get the value of this AVA as a String.
@exception RuntimeException if we could not obtain the string form
(should not occur) | [
"Get",
"the",
"value",
"of",
"this",
"AVA",
"as",
"a",
"String",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AVA.java#L249-L260 |
grpc/grpc-java | core/src/main/java/io/grpc/internal/Http2Ping.java | Http2Ping.notifyFailed | public static void notifyFailed(PingCallback callback, Executor executor, Throwable cause) {
doExecute(executor, asRunnable(callback, cause));
} | java | public static void notifyFailed(PingCallback callback, Executor executor, Throwable cause) {
doExecute(executor, asRunnable(callback, cause));
} | [
"public",
"static",
"void",
"notifyFailed",
"(",
"PingCallback",
"callback",
",",
"Executor",
"executor",
",",
"Throwable",
"cause",
")",
"{",
"doExecute",
"(",
"executor",
",",
"asRunnable",
"(",
"callback",
",",
"cause",
")",
")",
";",
"}"
] | Notifies the given callback that the ping operation failed.
@param callback the callback
@param executor the executor used to invoke the callback
@param cause the cause of failure | [
"Notifies",
"the",
"given",
"callback",
"that",
"the",
"ping",
"operation",
"failed",
"."
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/Http2Ping.java#L170-L172 |
spring-projects/spring-boot | spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java | Bindable.listOf | public static <E> Bindable<List<E>> listOf(Class<E> elementType) {
return of(ResolvableType.forClassWithGenerics(List.class, elementType));
} | java | public static <E> Bindable<List<E>> listOf(Class<E> elementType) {
return of(ResolvableType.forClassWithGenerics(List.class, elementType));
} | [
"public",
"static",
"<",
"E",
">",
"Bindable",
"<",
"List",
"<",
"E",
">",
">",
"listOf",
"(",
"Class",
"<",
"E",
">",
"elementType",
")",
"{",
"return",
"of",
"(",
"ResolvableType",
".",
"forClassWithGenerics",
"(",
"List",
".",
"class",
",",
"element... | Create a new {@link Bindable} {@link List} of the specified element type.
@param <E> the element type
@param elementType the list element type
@return a {@link Bindable} instance | [
"Create",
"a",
"new",
"{"
] | train | https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java#L213-L215 |
jayantk/jklol | src/com/jayantkrish/jklol/lisp/LispUtil.java | LispUtil.checkState | public static void checkState(boolean condition, String message, Object ... values) {
if (!condition) {
throw new EvalError(String.format(message, values));
}
} | java | public static void checkState(boolean condition, String message, Object ... values) {
if (!condition) {
throw new EvalError(String.format(message, values));
}
} | [
"public",
"static",
"void",
"checkState",
"(",
"boolean",
"condition",
",",
"String",
"message",
",",
"Object",
"...",
"values",
")",
"{",
"if",
"(",
"!",
"condition",
")",
"{",
"throw",
"new",
"EvalError",
"(",
"String",
".",
"format",
"(",
"message",
"... | Identical to Preconditions.checkState but throws an
{@code EvalError} instead of an IllegalArgumentException.
Use this check to verify properties of a Lisp program
execution, i.e., whenever the raised exception should be
catchable by the evaluator of the program.
@param condition
@param message
@param values | [
"Identical",
"to",
"Preconditions",
".",
"checkState",
"but",
"throws",
"an",
"{",
"@code",
"EvalError",
"}",
"instead",
"of",
"an",
"IllegalArgumentException",
".",
"Use",
"this",
"check",
"to",
"verify",
"properties",
"of",
"a",
"Lisp",
"program",
"execution",... | train | https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/lisp/LispUtil.java#L98-L102 |
spring-projects/spring-android | spring-android-rest-template/src/main/java/org/springframework/http/client/HttpComponentsClientHttpRequestFactory.java | HttpComponentsClientHttpRequestFactory.setLegacyConnectionTimeout | @SuppressWarnings("deprecation")
private void setLegacyConnectionTimeout(HttpClient client, int timeout) {
if (org.apache.http.impl.client.AbstractHttpClient.class.isInstance(client)) {
client.getParams().setIntParameter(
org.apache.http.params.CoreConnectionPNames.CONNECTION_TIMEOUT, timeout);
}
} | java | @SuppressWarnings("deprecation")
private void setLegacyConnectionTimeout(HttpClient client, int timeout) {
if (org.apache.http.impl.client.AbstractHttpClient.class.isInstance(client)) {
client.getParams().setIntParameter(
org.apache.http.params.CoreConnectionPNames.CONNECTION_TIMEOUT, timeout);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"private",
"void",
"setLegacyConnectionTimeout",
"(",
"HttpClient",
"client",
",",
"int",
"timeout",
")",
"{",
"if",
"(",
"org",
".",
"apache",
".",
"http",
".",
"impl",
".",
"client",
".",
"AbstractHttpCli... | Apply the specified connection timeout to deprecated {@link HttpClient}
implementations.
<p>
As of HttpClient 4.3, default parameters have to be exposed through a
{@link RequestConfig} instance instead of setting the parameters on the client.
Unfortunately, this behavior is not backward-compatible and older
{@link HttpClient} implementations will ignore the {@link RequestConfig} object set
in the context.
<p>
If the specified client is an older implementation, we set the custom connection
timeout through the deprecated API. Otherwise, we just return as it is set through
{@link RequestConfig} with newer clients.
@param client the client to configure
@param timeout the custom connection timeout | [
"Apply",
"the",
"specified",
"connection",
"timeout",
"to",
"deprecated",
"{"
] | train | https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/client/HttpComponentsClientHttpRequestFactory.java#L137-L143 |
apache/incubator-gobblin | gobblin-utility/src/main/java/org/apache/gobblin/util/PathUtils.java | PathUtils.deleteEmptyParentDirectories | public static void deleteEmptyParentDirectories(FileSystem fs, Path limitPath, Path startPath)
throws IOException {
if (PathUtils.isAncestor(limitPath, startPath) && !PathUtils.getPathWithoutSchemeAndAuthority(limitPath)
.equals(PathUtils.getPathWithoutSchemeAndAuthority(startPath)) && fs.listStatus(startPath).length == 0) {
if (!fs.delete(startPath, false)) {
log.warn("Failed to delete empty directory " + startPath);
} else {
log.info("Deleted empty directory " + startPath);
}
deleteEmptyParentDirectories(fs, limitPath, startPath.getParent());
}
} | java | public static void deleteEmptyParentDirectories(FileSystem fs, Path limitPath, Path startPath)
throws IOException {
if (PathUtils.isAncestor(limitPath, startPath) && !PathUtils.getPathWithoutSchemeAndAuthority(limitPath)
.equals(PathUtils.getPathWithoutSchemeAndAuthority(startPath)) && fs.listStatus(startPath).length == 0) {
if (!fs.delete(startPath, false)) {
log.warn("Failed to delete empty directory " + startPath);
} else {
log.info("Deleted empty directory " + startPath);
}
deleteEmptyParentDirectories(fs, limitPath, startPath.getParent());
}
} | [
"public",
"static",
"void",
"deleteEmptyParentDirectories",
"(",
"FileSystem",
"fs",
",",
"Path",
"limitPath",
",",
"Path",
"startPath",
")",
"throws",
"IOException",
"{",
"if",
"(",
"PathUtils",
".",
"isAncestor",
"(",
"limitPath",
",",
"startPath",
")",
"&&",
... | Deletes empty directories starting with startPath and all ancestors up to but not including limitPath.
@param fs {@link FileSystem} where paths are located.
@param limitPath only {@link Path}s that are strict descendants of this path will be deleted.
@param startPath first {@link Path} to delete. Afterwards empty ancestors will be deleted.
@throws IOException | [
"Deletes",
"empty",
"directories",
"starting",
"with",
"startPath",
"and",
"all",
"ancestors",
"up",
"to",
"but",
"not",
"including",
"limitPath",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/PathUtils.java#L189-L200 |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/JcrSystemViewExporter.java | JcrSystemViewExporter.emitProperty | private void emitProperty( Property property,
ContentHandler contentHandler,
boolean skipBinary ) throws RepositoryException, SAXException {
assert property instanceof AbstractJcrProperty : "Illegal attempt to use " + getClass().getName()
+ " on non-ModeShape property";
AbstractJcrProperty prop = (AbstractJcrProperty)property;
// first set the property sv:name attribute
AttributesImpl propAtts = new AttributesImpl();
propAtts.addAttribute(JcrSvLexicon.NAME.getNamespaceUri(),
JcrSvLexicon.NAME.getLocalName(),
getPrefixedName(JcrSvLexicon.NAME),
PropertyType.nameFromValue(PropertyType.STRING),
prop.getName());
// and it's sv:type attribute
propAtts.addAttribute(JcrSvLexicon.TYPE.getNamespaceUri(),
JcrSvLexicon.TYPE.getLocalName(),
getPrefixedName(JcrSvLexicon.TYPE),
PropertyType.nameFromValue(PropertyType.STRING),
org.modeshape.jcr.api.PropertyType.nameFromValue(prop.getType()));
// and it's sv:multiple attribute
if (prop.isMultiple()) {
propAtts.addAttribute(JcrSvLexicon.TYPE.getNamespaceUri(),
JcrSvLexicon.TYPE.getLocalName(),
getPrefixedName(JcrSvLexicon.MULTIPLE),
PropertyType.nameFromValue(PropertyType.BOOLEAN),
Boolean.TRUE.toString());
}
// output the sv:property element
startElement(contentHandler, JcrSvLexicon.PROPERTY, propAtts);
// then output a sv:value element for each of its values
if (prop instanceof JcrMultiValueProperty) {
Value[] values = prop.getValues();
for (Value value : values) {
emitValue(value, contentHandler, property.getType(), skipBinary);
}
} else {
emitValue(property.getValue(), contentHandler, property.getType(), skipBinary);
}
// end the sv:property element
endElement(contentHandler, JcrSvLexicon.PROPERTY);
} | java | private void emitProperty( Property property,
ContentHandler contentHandler,
boolean skipBinary ) throws RepositoryException, SAXException {
assert property instanceof AbstractJcrProperty : "Illegal attempt to use " + getClass().getName()
+ " on non-ModeShape property";
AbstractJcrProperty prop = (AbstractJcrProperty)property;
// first set the property sv:name attribute
AttributesImpl propAtts = new AttributesImpl();
propAtts.addAttribute(JcrSvLexicon.NAME.getNamespaceUri(),
JcrSvLexicon.NAME.getLocalName(),
getPrefixedName(JcrSvLexicon.NAME),
PropertyType.nameFromValue(PropertyType.STRING),
prop.getName());
// and it's sv:type attribute
propAtts.addAttribute(JcrSvLexicon.TYPE.getNamespaceUri(),
JcrSvLexicon.TYPE.getLocalName(),
getPrefixedName(JcrSvLexicon.TYPE),
PropertyType.nameFromValue(PropertyType.STRING),
org.modeshape.jcr.api.PropertyType.nameFromValue(prop.getType()));
// and it's sv:multiple attribute
if (prop.isMultiple()) {
propAtts.addAttribute(JcrSvLexicon.TYPE.getNamespaceUri(),
JcrSvLexicon.TYPE.getLocalName(),
getPrefixedName(JcrSvLexicon.MULTIPLE),
PropertyType.nameFromValue(PropertyType.BOOLEAN),
Boolean.TRUE.toString());
}
// output the sv:property element
startElement(contentHandler, JcrSvLexicon.PROPERTY, propAtts);
// then output a sv:value element for each of its values
if (prop instanceof JcrMultiValueProperty) {
Value[] values = prop.getValues();
for (Value value : values) {
emitValue(value, contentHandler, property.getType(), skipBinary);
}
} else {
emitValue(property.getValue(), contentHandler, property.getType(), skipBinary);
}
// end the sv:property element
endElement(contentHandler, JcrSvLexicon.PROPERTY);
} | [
"private",
"void",
"emitProperty",
"(",
"Property",
"property",
",",
"ContentHandler",
"contentHandler",
",",
"boolean",
"skipBinary",
")",
"throws",
"RepositoryException",
",",
"SAXException",
"{",
"assert",
"property",
"instanceof",
"AbstractJcrProperty",
":",
"\"Ille... | Fires the appropriate SAX events on the content handler to build the XML elements for the property.
@param property the property to be exported
@param contentHandler the SAX content handler for which SAX events will be invoked as the XML document is created.
@param skipBinary if <code>true</code>, indicates that binary properties should not be exported
@throws SAXException if an exception occurs during generation of the XML document
@throws RepositoryException if an exception occurs accessing the content repository | [
"Fires",
"the",
"appropriate",
"SAX",
"events",
"on",
"the",
"content",
"handler",
"to",
"build",
"the",
"XML",
"elements",
"for",
"the",
"property",
"."
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/JcrSystemViewExporter.java#L197-L244 |
ecclesia/kipeto | kipeto-core/src/main/java/de/ecclesia/kipeto/repository/FileRepositoryStrategy.java | FileRepositoryStrategy.fileForItem | private File fileForItem(String id) {
File subDir = subDirForId(id);
String fileName = id.substring(SUBDIR_POLICY);
return new File(subDir, fileName);
} | java | private File fileForItem(String id) {
File subDir = subDirForId(id);
String fileName = id.substring(SUBDIR_POLICY);
return new File(subDir, fileName);
} | [
"private",
"File",
"fileForItem",
"(",
"String",
"id",
")",
"{",
"File",
"subDir",
"=",
"subDirForId",
"(",
"id",
")",
";",
"String",
"fileName",
"=",
"id",
".",
"substring",
"(",
"SUBDIR_POLICY",
")",
";",
"return",
"new",
"File",
"(",
"subDir",
",",
... | Gibt das mit der Id korrespondierende File-Objekt zurück. (Die Datei muss
nicht existieren)
@param id
@return | [
"Gibt",
"das",
"mit",
"der",
"Id",
"korrespondierende",
"File",
"-",
"Objekt",
"zurück",
".",
"(",
"Die",
"Datei",
"muss",
"nicht",
"existieren",
")"
] | train | https://github.com/ecclesia/kipeto/blob/ea39a10ae4eaa550f71a856ab2f2845270a64913/kipeto-core/src/main/java/de/ecclesia/kipeto/repository/FileRepositoryStrategy.java#L233-L237 |
jboss/jboss-jsf-api_spec | src/main/java/javax/faces/context/PartialResponseWriter.java | PartialResponseWriter.startExtension | public void startExtension(Map<String, String> attributes) throws IOException {
startChangesIfNecessary();
ResponseWriter writer = getWrapped();
writer.startElement("extension", null);
if (attributes != null && !attributes.isEmpty()) {
for (Map.Entry<String, String> entry : attributes.entrySet()) {
writer.writeAttribute(entry.getKey(), entry.getValue(), null);
}
}
} | java | public void startExtension(Map<String, String> attributes) throws IOException {
startChangesIfNecessary();
ResponseWriter writer = getWrapped();
writer.startElement("extension", null);
if (attributes != null && !attributes.isEmpty()) {
for (Map.Entry<String, String> entry : attributes.entrySet()) {
writer.writeAttribute(entry.getKey(), entry.getValue(), null);
}
}
} | [
"public",
"void",
"startExtension",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"throws",
"IOException",
"{",
"startChangesIfNecessary",
"(",
")",
";",
"ResponseWriter",
"writer",
"=",
"getWrapped",
"(",
")",
";",
"writer",
".",
"startEle... | <p class="changed_added_2_0">Write the start of an extension operation.</p>
@param attributes String name/value pairs for extension element attributes
@throws IOException if an input/output error occurs
@since 2.0 | [
"<p",
"class",
"=",
"changed_added_2_0",
">",
"Write",
"the",
"start",
"of",
"an",
"extension",
"operation",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/context/PartialResponseWriter.java#L326-L335 |
alkacon/opencms-core | src/org/opencms/util/CmsFileUtil.java | CmsFileUtil.readFile | public static String readFile(String filename, String encoding) throws IOException {
return new String(readFile(filename), encoding);
} | java | public static String readFile(String filename, String encoding) throws IOException {
return new String(readFile(filename), encoding);
} | [
"public",
"static",
"String",
"readFile",
"(",
"String",
"filename",
",",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"return",
"new",
"String",
"(",
"readFile",
"(",
"filename",
")",
",",
"encoding",
")",
";",
"}"
] | Reads a file from the class loader and converts it to a String with the specified encoding.<p>
@param filename the file to read
@param encoding the encoding to use when converting the file content to a String
@return the read file convered to a String
@throws IOException in case of file access errors | [
"Reads",
"a",
"file",
"from",
"the",
"class",
"loader",
"and",
"converts",
"it",
"to",
"a",
"String",
"with",
"the",
"specified",
"encoding",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsFileUtil.java#L628-L631 |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java | Parameters.assertExactlyOneDefined | public void assertExactlyOneDefined(final String param1, final String param2) {
// Asserting that exactly one is defined is the same as asserting that they do not have the same
// value for definedness.
if (isPresent(param1) == isPresent(param2)) {
throw new ParameterException(
String.format("Exactly one of %s and %s must be defined.", param1, param2));
}
} | java | public void assertExactlyOneDefined(final String param1, final String param2) {
// Asserting that exactly one is defined is the same as asserting that they do not have the same
// value for definedness.
if (isPresent(param1) == isPresent(param2)) {
throw new ParameterException(
String.format("Exactly one of %s and %s must be defined.", param1, param2));
}
} | [
"public",
"void",
"assertExactlyOneDefined",
"(",
"final",
"String",
"param1",
",",
"final",
"String",
"param2",
")",
"{",
"// Asserting that exactly one is defined is the same as asserting that they do not have the same",
"// value for definedness.",
"if",
"(",
"isPresent",
"(",... | Throws a ParameterException unless exactly one parameter is defined. | [
"Throws",
"a",
"ParameterException",
"unless",
"exactly",
"one",
"parameter",
"is",
"defined",
"."
] | train | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java#L1117-L1124 |
r0adkll/PostOffice | library/src/main/java/com/r0adkll/postoffice/styles/EditTextStyle.java | EditTextStyle.applyDesign | @Override
public void applyDesign(Design design, int themeColor) {
Context ctx = mInputField.getContext();
int smallPadId = design.isMaterial() ? R.dimen.default_margin : R.dimen.default_margin_small;
int largePadId = design.isMaterial() ? R.dimen.material_edittext_spacing : R.dimen.default_margin_small;
int padLR = ctx.getResources().getDimensionPixelSize(largePadId);
int padTB = ctx.getResources().getDimensionPixelSize(smallPadId);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.setMargins(padLR, padTB, padLR, padTB);
mInputField.setLayoutParams(params);
if(design.isLight())
mInputField.setTextColor(mInputField.getResources().getColor(R.color.background_material_dark));
else
mInputField.setTextColor(mInputField.getResources().getColor(R.color.background_material_light));
Drawable drawable;
if(design.isMaterial()) {
drawable = mInputField.getResources().getDrawable(R.drawable.edittext_mtrl_alpha);
}else{
drawable = mInputField.getBackground();
}
drawable.setColorFilter(themeColor, PorterDuff.Mode.SRC_ATOP);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
mInputField.setBackground(drawable);
else
mInputField.setBackgroundDrawable(drawable);
} | java | @Override
public void applyDesign(Design design, int themeColor) {
Context ctx = mInputField.getContext();
int smallPadId = design.isMaterial() ? R.dimen.default_margin : R.dimen.default_margin_small;
int largePadId = design.isMaterial() ? R.dimen.material_edittext_spacing : R.dimen.default_margin_small;
int padLR = ctx.getResources().getDimensionPixelSize(largePadId);
int padTB = ctx.getResources().getDimensionPixelSize(smallPadId);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
params.setMargins(padLR, padTB, padLR, padTB);
mInputField.setLayoutParams(params);
if(design.isLight())
mInputField.setTextColor(mInputField.getResources().getColor(R.color.background_material_dark));
else
mInputField.setTextColor(mInputField.getResources().getColor(R.color.background_material_light));
Drawable drawable;
if(design.isMaterial()) {
drawable = mInputField.getResources().getDrawable(R.drawable.edittext_mtrl_alpha);
}else{
drawable = mInputField.getBackground();
}
drawable.setColorFilter(themeColor, PorterDuff.Mode.SRC_ATOP);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
mInputField.setBackground(drawable);
else
mInputField.setBackgroundDrawable(drawable);
} | [
"@",
"Override",
"public",
"void",
"applyDesign",
"(",
"Design",
"design",
",",
"int",
"themeColor",
")",
"{",
"Context",
"ctx",
"=",
"mInputField",
".",
"getContext",
"(",
")",
";",
"int",
"smallPadId",
"=",
"design",
".",
"isMaterial",
"(",
")",
"?",
"... | Apply a design to the style
@param design the design, i.e. Holo, Material, Light, Dark | [
"Apply",
"a",
"design",
"to",
"the",
"style"
] | train | https://github.com/r0adkll/PostOffice/blob/f98e365fd66c004ccce64ee87d9f471b97e4e3c2/library/src/main/java/com/r0adkll/postoffice/styles/EditTextStyle.java#L50-L82 |
forge/core | facets/api/src/main/java/org/jboss/forge/addon/facets/constraints/FacetInspector.java | FacetInspector.getAllRequiredFacets | public static <FACETTYPE extends Facet<?>> Set<Class<FACETTYPE>> getAllRequiredFacets(final Class<?> inspectedType)
{
Set<Class<FACETTYPE>> seen = new LinkedHashSet<Class<FACETTYPE>>();
return getAllRelatedFacets(seen, inspectedType, FacetConstraintType.REQUIRED);
} | java | public static <FACETTYPE extends Facet<?>> Set<Class<FACETTYPE>> getAllRequiredFacets(final Class<?> inspectedType)
{
Set<Class<FACETTYPE>> seen = new LinkedHashSet<Class<FACETTYPE>>();
return getAllRelatedFacets(seen, inspectedType, FacetConstraintType.REQUIRED);
} | [
"public",
"static",
"<",
"FACETTYPE",
"extends",
"Facet",
"<",
"?",
">",
">",
"Set",
"<",
"Class",
"<",
"FACETTYPE",
">",
">",
"getAllRequiredFacets",
"(",
"final",
"Class",
"<",
"?",
">",
"inspectedType",
")",
"{",
"Set",
"<",
"Class",
"<",
"FACETTYPE",... | Inspect the given {@link Class} for all {@link FacetConstraintType#REQUIRED} dependency {@link Facet} types. This
method inspects the entire constraint tree. | [
"Inspect",
"the",
"given",
"{"
] | train | https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/facets/api/src/main/java/org/jboss/forge/addon/facets/constraints/FacetInspector.java#L146-L150 |
stratosphere/stratosphere | stratosphere-core/src/main/java/eu/stratosphere/api/common/operators/SingleInputSemanticProperties.java | SingleInputSemanticProperties.addForwardedField | public void addForwardedField(int sourceField, int destinationField) {
FieldSet fs;
if((fs = this.forwardedFields.get(sourceField)) != null) {
fs.add(destinationField);
} else {
fs = new FieldSet(destinationField);
this.forwardedFields.put(sourceField, fs);
}
} | java | public void addForwardedField(int sourceField, int destinationField) {
FieldSet fs;
if((fs = this.forwardedFields.get(sourceField)) != null) {
fs.add(destinationField);
} else {
fs = new FieldSet(destinationField);
this.forwardedFields.put(sourceField, fs);
}
} | [
"public",
"void",
"addForwardedField",
"(",
"int",
"sourceField",
",",
"int",
"destinationField",
")",
"{",
"FieldSet",
"fs",
";",
"if",
"(",
"(",
"fs",
"=",
"this",
".",
"forwardedFields",
".",
"get",
"(",
"sourceField",
")",
")",
"!=",
"null",
")",
"{"... | Adds, to the existing information, a field that is forwarded directly
from the source record(s) to the destination record(s).
@param sourceField the position in the source record(s)
@param destinationField the position in the destination record(s) | [
"Adds",
"to",
"the",
"existing",
"information",
"a",
"field",
"that",
"is",
"forwarded",
"directly",
"from",
"the",
"source",
"record",
"(",
"s",
")",
"to",
"the",
"destination",
"record",
"(",
"s",
")",
"."
] | train | https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-core/src/main/java/eu/stratosphere/api/common/operators/SingleInputSemanticProperties.java#L51-L59 |
hankcs/HanLP | src/main/java/com/hankcs/hanlp/classification/statistics/ContinuousDistributions.java | ContinuousDistributions.Gcf | protected static double Gcf(double x, double A)
{
// Good for X>A+1
double A0 = 0;
double B0 = 1;
double A1 = 1;
double B1 = x;
double AOLD = 0;
double N = 0;
while (Math.abs((A1 - AOLD) / A1) > .00001)
{
AOLD = A1;
N = N + 1;
A0 = A1 + (N - A) * A0;
B0 = B1 + (N - A) * B0;
A1 = x * A0 + N * A1;
B1 = x * B0 + N * B1;
A0 = A0 / B1;
B0 = B0 / B1;
A1 = A1 / B1;
B1 = 1;
}
double Prob = Math.exp(A * Math.log(x) - x - LogGamma(A)) * A1;
return 1.0 - Prob;
} | java | protected static double Gcf(double x, double A)
{
// Good for X>A+1
double A0 = 0;
double B0 = 1;
double A1 = 1;
double B1 = x;
double AOLD = 0;
double N = 0;
while (Math.abs((A1 - AOLD) / A1) > .00001)
{
AOLD = A1;
N = N + 1;
A0 = A1 + (N - A) * A0;
B0 = B1 + (N - A) * B0;
A1 = x * A0 + N * A1;
B1 = x * B0 + N * B1;
A0 = A0 / B1;
B0 = B0 / B1;
A1 = A1 / B1;
B1 = 1;
}
double Prob = Math.exp(A * Math.log(x) - x - LogGamma(A)) * A1;
return 1.0 - Prob;
} | [
"protected",
"static",
"double",
"Gcf",
"(",
"double",
"x",
",",
"double",
"A",
")",
"{",
"// Good for X>A+1",
"double",
"A0",
"=",
"0",
";",
"double",
"B0",
"=",
"1",
";",
"double",
"A1",
"=",
"1",
";",
"double",
"B1",
"=",
"x",
";",
"double",
"AO... | Internal function used by GammaCdf
@param x
@param A
@return | [
"Internal",
"function",
"used",
"by",
"GammaCdf"
] | train | https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/classification/statistics/ContinuousDistributions.java#L125-L150 |
jpelzer/pelzer-util | src/main/java/com/pelzer/util/l10n/Localizable.java | Localizable.setDefault | public void setDefault(E value, Locale locale) {
set(value, locale);
this.defaultLocale = locale;
} | java | public void setDefault(E value, Locale locale) {
set(value, locale);
this.defaultLocale = locale;
} | [
"public",
"void",
"setDefault",
"(",
"E",
"value",
",",
"Locale",
"locale",
")",
"{",
"set",
"(",
"value",
",",
"locale",
")",
";",
"this",
".",
"defaultLocale",
"=",
"locale",
";",
"}"
] | Overrides the default locale value.
@param value
can be null, and subsequent calls to getDefault will return null
@throws NullPointerException
if locale is null. | [
"Overrides",
"the",
"default",
"locale",
"value",
"."
] | train | https://github.com/jpelzer/pelzer-util/blob/ec14f2573fd977d1442dba5d1507a264f5ea9aa6/src/main/java/com/pelzer/util/l10n/Localizable.java#L93-L96 |
scaleset/scaleset-geo | src/main/java/com/scaleset/geo/math/GoogleMapsTileMath.java | GoogleMapsTileMath.metersToLngLat | public Coordinate metersToLngLat(double mx, double my) {
double lon = (mx / originShift) * 180.0;
double lat = (my / originShift) * 180.0;
lat = 180 / Math.PI * (2 * Math.atan(Math.exp(lat * Math.PI / 180.0)) - Math.PI / 2.0);
return new Coordinate(lon, lat);
} | java | public Coordinate metersToLngLat(double mx, double my) {
double lon = (mx / originShift) * 180.0;
double lat = (my / originShift) * 180.0;
lat = 180 / Math.PI * (2 * Math.atan(Math.exp(lat * Math.PI / 180.0)) - Math.PI / 2.0);
return new Coordinate(lon, lat);
} | [
"public",
"Coordinate",
"metersToLngLat",
"(",
"double",
"mx",
",",
"double",
"my",
")",
"{",
"double",
"lon",
"=",
"(",
"mx",
"/",
"originShift",
")",
"*",
"180.0",
";",
"double",
"lat",
"=",
"(",
"my",
"/",
"originShift",
")",
"*",
"180.0",
";",
"l... | Converts XY point from Spherical Mercator (EPSG:3785) to lat/lon
(EPSG:4326)
@param mx the X coordinate in meters
@param my the Y coordinate in meters
@return The coordinate transformed to EPSG:4326 | [
"Converts",
"XY",
"point",
"from",
"Spherical",
"Mercator",
"(",
"EPSG",
":",
"3785",
")",
"to",
"lat",
"/",
"lon",
"(",
"EPSG",
":",
"4326",
")"
] | train | https://github.com/scaleset/scaleset-geo/blob/5cff2349668037dc287928a6c1a1f67c76d96b02/src/main/java/com/scaleset/geo/math/GoogleMapsTileMath.java#L148-L155 |
googleads/googleads-java-lib | modules/ads_lib_appengine/src/main/java/com/google/api/ads/common/lib/soap/jaxws/JaxWsHandler.java | JaxWsHandler.setEndpointAddress | @Override
public void setEndpointAddress(BindingProvider soapClient, String endpointAddress) {
soapClient.getRequestContext().put(
BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointAddress);
} | java | @Override
public void setEndpointAddress(BindingProvider soapClient, String endpointAddress) {
soapClient.getRequestContext().put(
BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointAddress);
} | [
"@",
"Override",
"public",
"void",
"setEndpointAddress",
"(",
"BindingProvider",
"soapClient",
",",
"String",
"endpointAddress",
")",
"{",
"soapClient",
".",
"getRequestContext",
"(",
")",
".",
"put",
"(",
"BindingProvider",
".",
"ENDPOINT_ADDRESS_PROPERTY",
",",
"e... | Sets the endpoint address of the given SOAP client.
@param soapClient the SOAP client to set the endpoint address for
@param endpointAddress the target endpoint address | [
"Sets",
"the",
"endpoint",
"address",
"of",
"the",
"given",
"SOAP",
"client",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib_appengine/src/main/java/com/google/api/ads/common/lib/soap/jaxws/JaxWsHandler.java#L72-L76 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobInfo.java | BlobInfo.newBuilder | public static Builder newBuilder(BucketInfo bucketInfo, String name) {
return newBuilder(bucketInfo.getName(), name);
} | java | public static Builder newBuilder(BucketInfo bucketInfo, String name) {
return newBuilder(bucketInfo.getName(), name);
} | [
"public",
"static",
"Builder",
"newBuilder",
"(",
"BucketInfo",
"bucketInfo",
",",
"String",
"name",
")",
"{",
"return",
"newBuilder",
"(",
"bucketInfo",
".",
"getName",
"(",
")",
",",
"name",
")",
";",
"}"
] | Returns a {@code BlobInfo} builder where blob identity is set using the provided values. | [
"Returns",
"a",
"{"
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobInfo.java#L1004-L1006 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WSubMenuRenderer.java | WSubMenuRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WSubMenu menu = (WSubMenu) component;
XmlStringBuilder xml = renderContext.getWriter();
xml.appendTagOpen("ui:submenu");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
if (isTree(menu)) {
xml.appendAttribute("open", String.valueOf(isOpen(menu)));
}
xml.appendOptionalAttribute("disabled", menu.isDisabled(), "true");
xml.appendOptionalAttribute("hidden", menu.isHidden(), "true");
if (menu.isTopLevelMenu()) {
xml.appendOptionalAttribute("accessKey", menu.getAccessKeyAsString());
} else {
xml.appendAttribute("nested", "true");
}
xml.appendOptionalAttribute("type", getMenuType(menu));
switch (menu.getMode()) {
case CLIENT:
xml.appendAttribute("mode", "client");
break;
case LAZY:
xml.appendAttribute("mode", "lazy");
break;
case EAGER:
xml.appendAttribute("mode", "eager");
break;
case DYNAMIC:
case SERVER:
// mode server mapped to mode dynamic as per https://github.com/BorderTech/wcomponents/issues/687
xml.appendAttribute("mode", "dynamic");
break;
default:
throw new SystemException("Unknown menu mode: " + menu.getMode());
}
xml.appendClose();
// Paint label
menu.getDecoratedLabel().paint(renderContext);
MenuMode mode = menu.getMode();
// Paint submenu items
xml.appendTagOpen("ui:content");
xml.appendAttribute("id", component.getId() + "-content");
xml.appendClose();
// Render content if not EAGER Mode or is EAGER and is the current AJAX request
if (mode != MenuMode.EAGER || AjaxHelper.isCurrentAjaxTrigger(menu)) {
// Visibility of content set in prepare paint
menu.paintMenuItems(renderContext);
}
xml.appendEndTag("ui:content");
xml.appendEndTag("ui:submenu");
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WSubMenu menu = (WSubMenu) component;
XmlStringBuilder xml = renderContext.getWriter();
xml.appendTagOpen("ui:submenu");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
if (isTree(menu)) {
xml.appendAttribute("open", String.valueOf(isOpen(menu)));
}
xml.appendOptionalAttribute("disabled", menu.isDisabled(), "true");
xml.appendOptionalAttribute("hidden", menu.isHidden(), "true");
if (menu.isTopLevelMenu()) {
xml.appendOptionalAttribute("accessKey", menu.getAccessKeyAsString());
} else {
xml.appendAttribute("nested", "true");
}
xml.appendOptionalAttribute("type", getMenuType(menu));
switch (menu.getMode()) {
case CLIENT:
xml.appendAttribute("mode", "client");
break;
case LAZY:
xml.appendAttribute("mode", "lazy");
break;
case EAGER:
xml.appendAttribute("mode", "eager");
break;
case DYNAMIC:
case SERVER:
// mode server mapped to mode dynamic as per https://github.com/BorderTech/wcomponents/issues/687
xml.appendAttribute("mode", "dynamic");
break;
default:
throw new SystemException("Unknown menu mode: " + menu.getMode());
}
xml.appendClose();
// Paint label
menu.getDecoratedLabel().paint(renderContext);
MenuMode mode = menu.getMode();
// Paint submenu items
xml.appendTagOpen("ui:content");
xml.appendAttribute("id", component.getId() + "-content");
xml.appendClose();
// Render content if not EAGER Mode or is EAGER and is the current AJAX request
if (mode != MenuMode.EAGER || AjaxHelper.isCurrentAjaxTrigger(menu)) {
// Visibility of content set in prepare paint
menu.paintMenuItems(renderContext);
}
xml.appendEndTag("ui:content");
xml.appendEndTag("ui:submenu");
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WSubMenu",
"menu",
"=",
"(",
"WSubMenu",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"=",
"renderContext"... | Paints the given WSubMenu.
@param component the WSubMenu to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"WSubMenu",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WSubMenuRenderer.java#L70-L131 |
Azure/azure-sdk-for-java | streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/StreamingJobsInner.java | StreamingJobsInner.beginStart | public void beginStart(String resourceGroupName, String jobName, StartStreamingJobParameters startJobParameters) {
beginStartWithServiceResponseAsync(resourceGroupName, jobName, startJobParameters).toBlocking().single().body();
} | java | public void beginStart(String resourceGroupName, String jobName, StartStreamingJobParameters startJobParameters) {
beginStartWithServiceResponseAsync(resourceGroupName, jobName, startJobParameters).toBlocking().single().body();
} | [
"public",
"void",
"beginStart",
"(",
"String",
"resourceGroupName",
",",
"String",
"jobName",
",",
"StartStreamingJobParameters",
"startJobParameters",
")",
"{",
"beginStartWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"jobName",
",",
"startJobParameters",
")",
... | Starts a streaming job. Once a job is started it will start processing input events and produce output.
@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 jobName The name of the streaming job.
@param startJobParameters Parameters applicable to a start streaming job operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent | [
"Starts",
"a",
"streaming",
"job",
".",
"Once",
"a",
"job",
"is",
"started",
"it",
"will",
"start",
"processing",
"input",
"events",
"and",
"produce",
"output",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/StreamingJobsInner.java#L1670-L1672 |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DatastoreUtils.java | DatastoreUtils.toEntities | static <E> List<E> toEntities(Class<E> entityClass, Entity[] nativeEntities) {
if (nativeEntities == null || nativeEntities.length == 0) {
return new ArrayList<>();
}
return toEntities(entityClass, Arrays.asList(nativeEntities));
} | java | static <E> List<E> toEntities(Class<E> entityClass, Entity[] nativeEntities) {
if (nativeEntities == null || nativeEntities.length == 0) {
return new ArrayList<>();
}
return toEntities(entityClass, Arrays.asList(nativeEntities));
} | [
"static",
"<",
"E",
">",
"List",
"<",
"E",
">",
"toEntities",
"(",
"Class",
"<",
"E",
">",
"entityClass",
",",
"Entity",
"[",
"]",
"nativeEntities",
")",
"{",
"if",
"(",
"nativeEntities",
"==",
"null",
"||",
"nativeEntities",
".",
"length",
"==",
"0",
... | Converts the given array of native entities to a list of model objects of given type,
<code>entityClass</code>.
@param entityClass
the entity class
@param nativeEntities
native entities to convert
@return the list of model objects | [
"Converts",
"the",
"given",
"array",
"of",
"native",
"entities",
"to",
"a",
"list",
"of",
"model",
"objects",
"of",
"given",
"type",
"<code",
">",
"entityClass<",
"/",
"code",
">",
"."
] | train | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DatastoreUtils.java#L94-L99 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/RouteTablesInner.java | RouteTablesInner.createOrUpdateAsync | public Observable<RouteTableInner> createOrUpdateAsync(String resourceGroupName, String routeTableName, RouteTableInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, routeTableName, parameters).map(new Func1<ServiceResponse<RouteTableInner>, RouteTableInner>() {
@Override
public RouteTableInner call(ServiceResponse<RouteTableInner> response) {
return response.body();
}
});
} | java | public Observable<RouteTableInner> createOrUpdateAsync(String resourceGroupName, String routeTableName, RouteTableInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, routeTableName, parameters).map(new Func1<ServiceResponse<RouteTableInner>, RouteTableInner>() {
@Override
public RouteTableInner call(ServiceResponse<RouteTableInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RouteTableInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"routeTableName",
",",
"RouteTableInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
","... | Create or updates a route table in a specified resource group.
@param resourceGroupName The name of the resource group.
@param routeTableName The name of the route table.
@param parameters Parameters supplied to the create or update route table operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Create",
"or",
"updates",
"a",
"route",
"table",
"in",
"a",
"specified",
"resource",
"group",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/RouteTablesInner.java#L471-L478 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-dns/src/main/java/com/google/cloud/dns/ZoneInfo.java | ZoneInfo.of | public static ZoneInfo of(String name, String dnsName, String description) {
return new BuilderImpl(name).setDnsName(dnsName).setDescription(description).build();
} | java | public static ZoneInfo of(String name, String dnsName, String description) {
return new BuilderImpl(name).setDnsName(dnsName).setDescription(description).build();
} | [
"public",
"static",
"ZoneInfo",
"of",
"(",
"String",
"name",
",",
"String",
"dnsName",
",",
"String",
"description",
")",
"{",
"return",
"new",
"BuilderImpl",
"(",
"name",
")",
".",
"setDnsName",
"(",
"dnsName",
")",
".",
"setDescription",
"(",
"description"... | Returns a ZoneInfo object with assigned {@code name}, {@code dnsName} and {@code description}. | [
"Returns",
"a",
"ZoneInfo",
"object",
"with",
"assigned",
"{"
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dns/src/main/java/com/google/cloud/dns/ZoneInfo.java#L180-L182 |
Azure/azure-sdk-for-java | network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java | NetworkWatchersInner.beginGetAzureReachabilityReport | public AzureReachabilityReportInner beginGetAzureReachabilityReport(String resourceGroupName, String networkWatcherName, AzureReachabilityReportParameters parameters) {
return beginGetAzureReachabilityReportWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().single().body();
} | java | public AzureReachabilityReportInner beginGetAzureReachabilityReport(String resourceGroupName, String networkWatcherName, AzureReachabilityReportParameters parameters) {
return beginGetAzureReachabilityReportWithServiceResponseAsync(resourceGroupName, networkWatcherName, parameters).toBlocking().single().body();
} | [
"public",
"AzureReachabilityReportInner",
"beginGetAzureReachabilityReport",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkWatcherName",
",",
"AzureReachabilityReportParameters",
"parameters",
")",
"{",
"return",
"beginGetAzureReachabilityReportWithServiceResponseAsync",
... | Gets the relative latency score for internet service providers from a specified location to Azure regions.
@param resourceGroupName The name of the network watcher resource group.
@param networkWatcherName The name of the network watcher resource.
@param parameters Parameters that determine Azure reachability report configuration.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the AzureReachabilityReportInner object if successful. | [
"Gets",
"the",
"relative",
"latency",
"score",
"for",
"internet",
"service",
"providers",
"from",
"a",
"specified",
"location",
"to",
"Azure",
"regions",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2017_10_01/src/main/java/com/microsoft/azure/management/network/v2017_10_01/implementation/NetworkWatchersInner.java#L2383-L2385 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java | ImgUtil.scale | public static void scale(InputStream srcStream, OutputStream destStream, int width, int height, Color fixedColor) throws IORuntimeException {
scale(read(srcStream), getImageOutputStream(destStream), width, height, fixedColor);
} | java | public static void scale(InputStream srcStream, OutputStream destStream, int width, int height, Color fixedColor) throws IORuntimeException {
scale(read(srcStream), getImageOutputStream(destStream), width, height, fixedColor);
} | [
"public",
"static",
"void",
"scale",
"(",
"InputStream",
"srcStream",
",",
"OutputStream",
"destStream",
",",
"int",
"width",
",",
"int",
"height",
",",
"Color",
"fixedColor",
")",
"throws",
"IORuntimeException",
"{",
"scale",
"(",
"read",
"(",
"srcStream",
")... | 缩放图像(按高度和宽度缩放)<br>
缩放后默认为jpeg格式,此方法并不关闭流
@param srcStream 源图像流
@param destStream 缩放后的图像目标流
@param width 缩放后的宽度
@param height 缩放后的高度
@param fixedColor 比例不对时补充的颜色,不补充为<code>null</code>
@throws IORuntimeException IO异常 | [
"缩放图像(按高度和宽度缩放)<br",
">",
"缩放后默认为jpeg格式,此方法并不关闭流"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L199-L201 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/Checker.java | Checker.isSpinnerTextSelected | public boolean isSpinnerTextSelected(int spinnerIndex, String text)
{
Spinner spinner = waiter.waitForAndGetView(spinnerIndex, Spinner.class);
TextView textView = (TextView) spinner.getChildAt(0);
if(textView.getText().equals(text))
return true;
else
return false;
} | java | public boolean isSpinnerTextSelected(int spinnerIndex, String text)
{
Spinner spinner = waiter.waitForAndGetView(spinnerIndex, Spinner.class);
TextView textView = (TextView) spinner.getChildAt(0);
if(textView.getText().equals(text))
return true;
else
return false;
} | [
"public",
"boolean",
"isSpinnerTextSelected",
"(",
"int",
"spinnerIndex",
",",
"String",
"text",
")",
"{",
"Spinner",
"spinner",
"=",
"waiter",
".",
"waitForAndGetView",
"(",
"spinnerIndex",
",",
"Spinner",
".",
"class",
")",
";",
"TextView",
"textView",
"=",
... | Checks if a given text is selected in a given {@link Spinner}
@param spinnerIndex the index of the spinner to check. 0 if only one spinner is available
@param text the text that is expected to be selected
@return true if the given text is selected in the given {@code Spinner} and false if it is not | [
"Checks",
"if",
"a",
"given",
"text",
"is",
"selected",
"in",
"a",
"given",
"{"
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Checker.java#L112-L121 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.