repository_name
stringlengths 7
58
| func_path_in_repository
stringlengths 11
204
| func_name
stringlengths 5
103
| whole_func_string
stringlengths 87
3.44k
| language
stringclasses 1
value | func_code_string
stringlengths 87
3.44k
| func_code_tokens
listlengths 21
714
| func_documentation_string
stringlengths 61
1.95k
| func_documentation_tokens
listlengths 1
482
| split_name
stringclasses 1
value | func_code_url
stringlengths 102
309
|
---|---|---|---|---|---|---|---|---|---|---|
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault-cryptography/src/main/java/com/microsoft/azure/keyvault/cryptography/EcKey.java | EcKey.fromJsonWebKey | public static EcKey fromJsonWebKey(JsonWebKey jwk) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeySpecException, NoSuchProviderException {
return fromJsonWebKey(jwk, false, null);
} | java | public static EcKey fromJsonWebKey(JsonWebKey jwk) throws NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeySpecException, NoSuchProviderException {
return fromJsonWebKey(jwk, false, null);
} | [
"public",
"static",
"EcKey",
"fromJsonWebKey",
"(",
"JsonWebKey",
"jwk",
")",
"throws",
"NoSuchAlgorithmException",
",",
"InvalidAlgorithmParameterException",
",",
"InvalidKeySpecException",
",",
"NoSuchProviderException",
"{",
"return",
"fromJsonWebKey",
"(",
"jwk",
",",
"false",
",",
"null",
")",
";",
"}"
] | Converts JSON web key to EC key pair, does not include the private key.
@param jwk
@return EcKey
@throws NoSuchAlgorithmException
@throws InvalidAlgorithmParameterException
@throws InvalidKeySpecException
@throws NoSuchProviderException | [
"Converts",
"JSON",
"web",
"key",
"to",
"EC",
"key",
"pair",
"does",
"not",
"include",
"the",
"private",
"key",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault-cryptography/src/main/java/com/microsoft/azure/keyvault/cryptography/EcKey.java#L197-L199 |
mguymon/model-citizen | core/src/main/java/com/tobedevoured/modelcitizen/ModelFactory.java | ModelFactory.createModel | @SuppressWarnings({"rawtypes", "unchecked"})
public <T> T createModel(T referenceModel, boolean withPolicies) throws CreateModelException {
Erector erector = erectors.get(referenceModel.getClass());
if (erector == null) {
throw new CreateModelException("Unregistered class: " + referenceModel.getClass());
}
return createModel(erector, referenceModel, withPolicies);
} | java | @SuppressWarnings({"rawtypes", "unchecked"})
public <T> T createModel(T referenceModel, boolean withPolicies) throws CreateModelException {
Erector erector = erectors.get(referenceModel.getClass());
if (erector == null) {
throw new CreateModelException("Unregistered class: " + referenceModel.getClass());
}
return createModel(erector, referenceModel, withPolicies);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
",",
"\"unchecked\"",
"}",
")",
"public",
"<",
"T",
">",
"T",
"createModel",
"(",
"T",
"referenceModel",
",",
"boolean",
"withPolicies",
")",
"throws",
"CreateModelException",
"{",
"Erector",
"erector",
"=",
"erectors",
".",
"get",
"(",
"referenceModel",
".",
"getClass",
"(",
")",
")",
";",
"if",
"(",
"erector",
"==",
"null",
")",
"{",
"throw",
"new",
"CreateModelException",
"(",
"\"Unregistered class: \"",
"+",
"referenceModel",
".",
"getClass",
"(",
")",
")",
";",
"}",
"return",
"createModel",
"(",
"erector",
",",
"referenceModel",
",",
"withPolicies",
")",
";",
"}"
] | Create a Model for a registered Blueprint. Values set in the
model will not be overridden by defaults in the Blueprint.
@param <T> model Class
@param referenceModel Object
@param withPolicies boolean if Policies should be applied to the create
@return Model
@throws CreateModelException model failed to create | [
"Create",
"a",
"Model",
"for",
"a",
"registered",
"Blueprint",
".",
"Values",
"set",
"in",
"the",
"model",
"will",
"not",
"be",
"overridden",
"by",
"defaults",
"in",
"the",
"Blueprint",
"."
] | train | https://github.com/mguymon/model-citizen/blob/9078ab4121897a21e598dd4f0efa6996b46e4dea/core/src/main/java/com/tobedevoured/modelcitizen/ModelFactory.java#L497-L506 |
cesarferreira/AndroidQuickUtils | library/src/main/java/quickutils/core/categories/security.java | security.privateBase64Encoder | private static String privateBase64Encoder(String toEncode, int flags) {
byte[] data = null;
try {
data = toEncode.getBytes("UTF-8");
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}
if (flags == -1) {
flags = Base64.DEFAULT;
}
return Base64.encodeToString(data, flags);
} | java | private static String privateBase64Encoder(String toEncode, int flags) {
byte[] data = null;
try {
data = toEncode.getBytes("UTF-8");
} catch (UnsupportedEncodingException e1) {
e1.printStackTrace();
}
if (flags == -1) {
flags = Base64.DEFAULT;
}
return Base64.encodeToString(data, flags);
} | [
"private",
"static",
"String",
"privateBase64Encoder",
"(",
"String",
"toEncode",
",",
"int",
"flags",
")",
"{",
"byte",
"[",
"]",
"data",
"=",
"null",
";",
"try",
"{",
"data",
"=",
"toEncode",
".",
"getBytes",
"(",
"\"UTF-8\"",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e1",
")",
"{",
"e1",
".",
"printStackTrace",
"(",
")",
";",
"}",
"if",
"(",
"flags",
"==",
"-",
"1",
")",
"{",
"flags",
"=",
"Base64",
".",
"DEFAULT",
";",
"}",
"return",
"Base64",
".",
"encodeToString",
"(",
"data",
",",
"flags",
")",
";",
"}"
] | private Encoder in base64
@param toEncode
String to be encoded
@param flags
flags to encode the String
@return encoded String in base64 | [
"private",
"Encoder",
"in",
"base64"
] | train | https://github.com/cesarferreira/AndroidQuickUtils/blob/73a91daedbb9f7be7986ea786fbc441c9e5a881c/library/src/main/java/quickutils/core/categories/security.java#L53-L66 |
lessthanoptimal/ejml | main/ejml-dsparse/src/org/ejml/sparse/csc/CommonOps_DSCC.java | CommonOps_DSCC.sumRows | public static DMatrixRMaj sumRows(DMatrixSparseCSC input , @Nullable DMatrixRMaj output ) {
if( output == null ) {
output = new DMatrixRMaj(input.numRows,1);
} else {
output.reshape(input.numRows,1);
}
Arrays.fill(output.data,0,input.numRows,0);
for (int col = 0; col < input.numCols; col++) {
int idx0 = input.col_idx[col];
int idx1 = input.col_idx[col + 1];
for (int i = idx0; i < idx1; i++) {
output.data[input.nz_rows[i]] += input.nz_values[i];
}
}
return output;
} | java | public static DMatrixRMaj sumRows(DMatrixSparseCSC input , @Nullable DMatrixRMaj output ) {
if( output == null ) {
output = new DMatrixRMaj(input.numRows,1);
} else {
output.reshape(input.numRows,1);
}
Arrays.fill(output.data,0,input.numRows,0);
for (int col = 0; col < input.numCols; col++) {
int idx0 = input.col_idx[col];
int idx1 = input.col_idx[col + 1];
for (int i = idx0; i < idx1; i++) {
output.data[input.nz_rows[i]] += input.nz_values[i];
}
}
return output;
} | [
"public",
"static",
"DMatrixRMaj",
"sumRows",
"(",
"DMatrixSparseCSC",
"input",
",",
"@",
"Nullable",
"DMatrixRMaj",
"output",
")",
"{",
"if",
"(",
"output",
"==",
"null",
")",
"{",
"output",
"=",
"new",
"DMatrixRMaj",
"(",
"input",
".",
"numRows",
",",
"1",
")",
";",
"}",
"else",
"{",
"output",
".",
"reshape",
"(",
"input",
".",
"numRows",
",",
"1",
")",
";",
"}",
"Arrays",
".",
"fill",
"(",
"output",
".",
"data",
",",
"0",
",",
"input",
".",
"numRows",
",",
"0",
")",
";",
"for",
"(",
"int",
"col",
"=",
"0",
";",
"col",
"<",
"input",
".",
"numCols",
";",
"col",
"++",
")",
"{",
"int",
"idx0",
"=",
"input",
".",
"col_idx",
"[",
"col",
"]",
";",
"int",
"idx1",
"=",
"input",
".",
"col_idx",
"[",
"col",
"+",
"1",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"idx0",
";",
"i",
"<",
"idx1",
";",
"i",
"++",
")",
"{",
"output",
".",
"data",
"[",
"input",
".",
"nz_rows",
"[",
"i",
"]",
"]",
"+=",
"input",
".",
"nz_values",
"[",
"i",
"]",
";",
"}",
"}",
"return",
"output",
";",
"}"
] | <p>
Computes the sum of each row in the input matrix and returns the results in a vector:<br>
<br>
b<sub>j</sub> = sum(i=1:n ; a<sub>ji</sub>)
</p>
@param input Input matrix
@param output Optional storage for output. Reshaped into a column vector. Modified.
@return Vector containing the sum of each row | [
"<p",
">",
"Computes",
"the",
"sum",
"of",
"each",
"row",
"in",
"the",
"input",
"matrix",
"and",
"returns",
"the",
"results",
"in",
"a",
"vector",
":",
"<br",
">",
"<br",
">",
"b<sub",
">",
"j<",
"/",
"sub",
">",
"=",
"sum",
"(",
"i",
"=",
"1",
":",
"n",
";",
"a<sub",
">",
"ji<",
"/",
"sub",
">",
")",
"<",
"/",
"p",
">"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/CommonOps_DSCC.java#L1393-L1412 |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadConnection.java | StandardRoadConnection.addConnectedSegment | void addConnectedSegment(RoadPolyline segment, boolean attachToStartPoint) {
if (segment == null) {
return;
}
if (this.connectedSegments.isEmpty()) {
this.connectedSegments.add(new Connection(segment, attachToStartPoint));
} else {
// Compute the angle to the unit vector for the new segment
final double newSegmentAngle = computeAngle(segment, attachToStartPoint);
// Search for the insertion index
final int insertionIndex = searchInsertionIndex(newSegmentAngle, 0, this.connectedSegments.size() - 1);
// Insert
this.connectedSegments.add(insertionIndex, new Connection(segment, attachToStartPoint));
}
fireIteratorUpdate();
} | java | void addConnectedSegment(RoadPolyline segment, boolean attachToStartPoint) {
if (segment == null) {
return;
}
if (this.connectedSegments.isEmpty()) {
this.connectedSegments.add(new Connection(segment, attachToStartPoint));
} else {
// Compute the angle to the unit vector for the new segment
final double newSegmentAngle = computeAngle(segment, attachToStartPoint);
// Search for the insertion index
final int insertionIndex = searchInsertionIndex(newSegmentAngle, 0, this.connectedSegments.size() - 1);
// Insert
this.connectedSegments.add(insertionIndex, new Connection(segment, attachToStartPoint));
}
fireIteratorUpdate();
} | [
"void",
"addConnectedSegment",
"(",
"RoadPolyline",
"segment",
",",
"boolean",
"attachToStartPoint",
")",
"{",
"if",
"(",
"segment",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"this",
".",
"connectedSegments",
".",
"isEmpty",
"(",
")",
")",
"{",
"this",
".",
"connectedSegments",
".",
"add",
"(",
"new",
"Connection",
"(",
"segment",
",",
"attachToStartPoint",
")",
")",
";",
"}",
"else",
"{",
"// Compute the angle to the unit vector for the new segment",
"final",
"double",
"newSegmentAngle",
"=",
"computeAngle",
"(",
"segment",
",",
"attachToStartPoint",
")",
";",
"// Search for the insertion index",
"final",
"int",
"insertionIndex",
"=",
"searchInsertionIndex",
"(",
"newSegmentAngle",
",",
"0",
",",
"this",
".",
"connectedSegments",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"// Insert",
"this",
".",
"connectedSegments",
".",
"add",
"(",
"insertionIndex",
",",
"new",
"Connection",
"(",
"segment",
",",
"attachToStartPoint",
")",
")",
";",
"}",
"fireIteratorUpdate",
"(",
")",
";",
"}"
] | Add a segment to this connection point.
<p>The segments are ordered according to there
geo-localization along a trigonometric cicle.
The first segment has the nearest angle to the
vector (1,0), and the following segments are
ordered according to the positive value of there
angles to this unity vector (counterclockwise order).
@param segment is the segment to add.
@param attachToStartPoint indicates if the segment must be attached by
its start point (if value is <code>true</code>) or by its end point
(if value is <code>false</code>). | [
"Add",
"a",
"segment",
"to",
"this",
"connection",
"point",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadConnection.java#L310-L326 |
jmxtrans/embedded-jmxtrans | src/main/java/org/jmxtrans/embedded/util/Preconditions.java | Preconditions.checkNotEmpty | public static String checkNotEmpty(String reference, @Nullable String message) throws IllegalArgumentException {
if (reference == null || reference.isEmpty()) {
throw new IllegalArgumentException(message == null ? "Null or empty value" : message);
}
return reference;
} | java | public static String checkNotEmpty(String reference, @Nullable String message) throws IllegalArgumentException {
if (reference == null || reference.isEmpty()) {
throw new IllegalArgumentException(message == null ? "Null or empty value" : message);
}
return reference;
} | [
"public",
"static",
"String",
"checkNotEmpty",
"(",
"String",
"reference",
",",
"@",
"Nullable",
"String",
"message",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"reference",
"==",
"null",
"||",
"reference",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
"==",
"null",
"?",
"\"Null or empty value\"",
":",
"message",
")",
";",
"}",
"return",
"reference",
";",
"}"
] | Check the nullity and emptiness of the given <code>reference</code>.
@param reference reference to check
@param message exception message, can be <code>null</code>
@return the given <code>reference</code>
@throws IllegalArgumentException if the given <code>reference</code> is <code>null</code> | [
"Check",
"the",
"nullity",
"and",
"emptiness",
"of",
"the",
"given",
"<code",
">",
"reference<",
"/",
"code",
">",
"."
] | train | https://github.com/jmxtrans/embedded-jmxtrans/blob/17224389e7d8323284cabc2a5167fc03bed6d223/src/main/java/org/jmxtrans/embedded/util/Preconditions.java#L82-L87 |
heroku/heroku.jar | heroku-api/src/main/java/com/heroku/api/HerokuAPI.java | HerokuAPI.createBuild | public Build createBuild(String appName, Build build) {
return connection.execute(new BuildCreate(appName, build), apiKey);
} | java | public Build createBuild(String appName, Build build) {
return connection.execute(new BuildCreate(appName, build), apiKey);
} | [
"public",
"Build",
"createBuild",
"(",
"String",
"appName",
",",
"Build",
"build",
")",
"{",
"return",
"connection",
".",
"execute",
"(",
"new",
"BuildCreate",
"(",
"appName",
",",
"build",
")",
",",
"apiKey",
")",
";",
"}"
] | Creates a build
@param appName See {@link #listApps} for a list of apps that can be used.
@param build the build information | [
"Creates",
"a",
"build"
] | train | https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L441-L443 |
powermock/powermock | powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java | PowerMock.createPartialMockForAllMethodsExcept | public static synchronized <T> T createPartialMockForAllMethodsExcept(Class<T> type, String methodNameToExclude,
Class<?> firstArgumentType, Class<?>... moreTypes) {
/*
* The reason why we've split the first and "additional types" is
* because it should not intervene with the mockAllExcept(type,
* String...methodNames) method.
*/
final Class<?>[] argumentTypes = mergeArgumentTypes(firstArgumentType, moreTypes);
return createMock(type, WhiteboxImpl.getAllMethodsExcept(type, methodNameToExclude, argumentTypes));
} | java | public static synchronized <T> T createPartialMockForAllMethodsExcept(Class<T> type, String methodNameToExclude,
Class<?> firstArgumentType, Class<?>... moreTypes) {
/*
* The reason why we've split the first and "additional types" is
* because it should not intervene with the mockAllExcept(type,
* String...methodNames) method.
*/
final Class<?>[] argumentTypes = mergeArgumentTypes(firstArgumentType, moreTypes);
return createMock(type, WhiteboxImpl.getAllMethodsExcept(type, methodNameToExclude, argumentTypes));
} | [
"public",
"static",
"synchronized",
"<",
"T",
">",
"T",
"createPartialMockForAllMethodsExcept",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"String",
"methodNameToExclude",
",",
"Class",
"<",
"?",
">",
"firstArgumentType",
",",
"Class",
"<",
"?",
">",
"...",
"moreTypes",
")",
"{",
"/*\n * The reason why we've split the first and \"additional types\" is\n * because it should not intervene with the mockAllExcept(type,\n * String...methodNames) method.\n */",
"final",
"Class",
"<",
"?",
">",
"[",
"]",
"argumentTypes",
"=",
"mergeArgumentTypes",
"(",
"firstArgumentType",
",",
"moreTypes",
")",
";",
"return",
"createMock",
"(",
"type",
",",
"WhiteboxImpl",
".",
"getAllMethodsExcept",
"(",
"type",
",",
"methodNameToExclude",
",",
"argumentTypes",
")",
")",
";",
"}"
] | Mock all methods of a class except for a specific one. Use this method
only if you have several overloaded methods.
@param <T> The type of the mock.
@param type The type that'll be used to create a mock instance.
@param methodNameToExclude The name of the method not to mock.
@param firstArgumentType The type of the first parameter of the method not to mock
@param moreTypes Optionally more parameter types that defines the method. Note
that this is only needed to separate overloaded methods.
@return A mock object of type <T>. | [
"Mock",
"all",
"methods",
"of",
"a",
"class",
"except",
"for",
"a",
"specific",
"one",
".",
"Use",
"this",
"method",
"only",
"if",
"you",
"have",
"several",
"overloaded",
"methods",
"."
] | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L396-L406 |
js-lib-com/commons | src/main/java/js/util/Classes.java | Classes.getResourceAsStream | private static InputStream getResourceAsStream(String name, ClassLoader[] classLoaders)
{
// Java standard class loader require resource name to be an absolute path without leading path separator
// at this point <name> argument is guaranteed to not start with leading path separator
for(ClassLoader classLoader : classLoaders) {
InputStream stream = classLoader.getResourceAsStream(name);
if(stream == null) {
// it seems there are class loaders that require leading path separator
// not confirmed rumor but found in similar libraries
stream = classLoader.getResourceAsStream('/' + name);
}
if(stream != null) {
return stream;
}
}
return null;
} | java | private static InputStream getResourceAsStream(String name, ClassLoader[] classLoaders)
{
// Java standard class loader require resource name to be an absolute path without leading path separator
// at this point <name> argument is guaranteed to not start with leading path separator
for(ClassLoader classLoader : classLoaders) {
InputStream stream = classLoader.getResourceAsStream(name);
if(stream == null) {
// it seems there are class loaders that require leading path separator
// not confirmed rumor but found in similar libraries
stream = classLoader.getResourceAsStream('/' + name);
}
if(stream != null) {
return stream;
}
}
return null;
} | [
"private",
"static",
"InputStream",
"getResourceAsStream",
"(",
"String",
"name",
",",
"ClassLoader",
"[",
"]",
"classLoaders",
")",
"{",
"// Java standard class loader require resource name to be an absolute path without leading path separator\r",
"// at this point <name> argument is guaranteed to not start with leading path separator\r",
"for",
"(",
"ClassLoader",
"classLoader",
":",
"classLoaders",
")",
"{",
"InputStream",
"stream",
"=",
"classLoader",
".",
"getResourceAsStream",
"(",
"name",
")",
";",
"if",
"(",
"stream",
"==",
"null",
")",
"{",
"// it seems there are class loaders that require leading path separator\r",
"// not confirmed rumor but found in similar libraries\r",
"stream",
"=",
"classLoader",
".",
"getResourceAsStream",
"(",
"'",
"'",
"+",
"name",
")",
";",
"}",
"if",
"(",
"stream",
"!=",
"null",
")",
"{",
"return",
"stream",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Get named resource input stream from a list of class loaders. Traverses class loaders in given order searching for
requested resource. Return first resource found or null if none found.
@param name resource name with syntax as required by Java ClassLoader,
@param classLoaders target class loaders.
@return found resource as input stream or null. | [
"Get",
"named",
"resource",
"input",
"stream",
"from",
"a",
"list",
"of",
"class",
"loaders",
".",
"Traverses",
"class",
"loaders",
"in",
"given",
"order",
"searching",
"for",
"requested",
"resource",
".",
"Return",
"first",
"resource",
"found",
"or",
"null",
"if",
"none",
"found",
"."
] | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L1061-L1078 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberPlus.java | NumberNumberPlus.plus | public static Number plus(Number left, Number right) {
return NumberMath.add(left, right);
} | java | public static Number plus(Number left, Number right) {
return NumberMath.add(left, right);
} | [
"public",
"static",
"Number",
"plus",
"(",
"Number",
"left",
",",
"Number",
"right",
")",
"{",
"return",
"NumberMath",
".",
"add",
"(",
"left",
",",
"right",
")",
";",
"}"
] | Add two numbers and return the result.
@param left a Number
@param right another Number to add
@return the addition of both Numbers | [
"Add",
"two",
"numbers",
"and",
"return",
"the",
"result",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/dgmimpl/NumberNumberPlus.java#L42-L44 |
GoogleCloudPlatform/appengine-pipelines | java/src/main/java/com/google/appengine/tools/pipeline/Job.java | Job.futureCall | public <T, T1, T2> FutureValue<T> futureCall(Job2<T, T1, T2> jobInstance, Value<? extends T1> v1,
Value<? extends T2> v2, JobSetting... settings) {
return futureCallUnchecked(settings, jobInstance, v1, v2);
} | java | public <T, T1, T2> FutureValue<T> futureCall(Job2<T, T1, T2> jobInstance, Value<? extends T1> v1,
Value<? extends T2> v2, JobSetting... settings) {
return futureCallUnchecked(settings, jobInstance, v1, v2);
} | [
"public",
"<",
"T",
",",
"T1",
",",
"T2",
">",
"FutureValue",
"<",
"T",
">",
"futureCall",
"(",
"Job2",
"<",
"T",
",",
"T1",
",",
"T2",
">",
"jobInstance",
",",
"Value",
"<",
"?",
"extends",
"T1",
">",
"v1",
",",
"Value",
"<",
"?",
"extends",
"T2",
">",
"v2",
",",
"JobSetting",
"...",
"settings",
")",
"{",
"return",
"futureCallUnchecked",
"(",
"settings",
",",
"jobInstance",
",",
"v1",
",",
"v2",
")",
";",
"}"
] | Invoke this method from within the {@code run} method of a <b>generator
job</b> in order to specify a job node in the generated child job graph.
This version of the method is for child jobs that take two arguments.
@param <T> The return type of the child job being specified
@param <T1> The type of the first input to the child job
@param <T2> The type of the second input to the child job
@param jobInstance A user-written job object
@param v1 the first input to the child job
@param v2 the second input to the child job
@param settings Optional one or more {@code JobSetting}
@return a {@code FutureValue} representing an empty value slot that will be
filled by the output of {@code jobInstance} when it finalizes. This
may be passed in to further invocations of {@code futureCall()} in
order to specify a data dependency. | [
"Invoke",
"this",
"method",
"from",
"within",
"the",
"{",
"@code",
"run",
"}",
"method",
"of",
"a",
"<b",
">",
"generator",
"job<",
"/",
"b",
">",
"in",
"order",
"to",
"specify",
"a",
"job",
"node",
"in",
"the",
"generated",
"child",
"job",
"graph",
".",
"This",
"version",
"of",
"the",
"method",
"is",
"for",
"child",
"jobs",
"that",
"take",
"two",
"arguments",
"."
] | train | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/java/src/main/java/com/google/appengine/tools/pipeline/Job.java#L240-L243 |
zalando-nakadi/fahrschein | fahrschein/src/main/java/org/zalando/fahrschein/NakadiClient.java | NakadiClient.subscribe | @Deprecated
public Subscription subscribe(String applicationName, String eventName, String consumerGroup) throws IOException {
return subscription(applicationName, eventName).withConsumerGroup(consumerGroup).subscribe();
} | java | @Deprecated
public Subscription subscribe(String applicationName, String eventName, String consumerGroup) throws IOException {
return subscription(applicationName, eventName).withConsumerGroup(consumerGroup).subscribe();
} | [
"@",
"Deprecated",
"public",
"Subscription",
"subscribe",
"(",
"String",
"applicationName",
",",
"String",
"eventName",
",",
"String",
"consumerGroup",
")",
"throws",
"IOException",
"{",
"return",
"subscription",
"(",
"applicationName",
",",
"eventName",
")",
".",
"withConsumerGroup",
"(",
"consumerGroup",
")",
".",
"subscribe",
"(",
")",
";",
"}"
] | Create a subscription for a single event type.
@deprecated Use the {@link SubscriptionBuilder} and {@link NakadiClient#subscription(String, String)} instead. | [
"Create",
"a",
"subscription",
"for",
"a",
"single",
"event",
"type",
"."
] | train | https://github.com/zalando-nakadi/fahrschein/blob/b55ae0ff79aacb300548a88f3969fd11a0904804/fahrschein/src/main/java/org/zalando/fahrschein/NakadiClient.java#L82-L85 |
EvidentSolutions/dalesbred | dalesbred/src/main/java/org/dalesbred/Database.java | Database.findOptional | public @NotNull <T> Optional<T> findOptional(@NotNull Class<T> cl, @NotNull @SQL String sql, Object... args) {
return findOptional(cl, SqlQuery.query(sql, args));
} | java | public @NotNull <T> Optional<T> findOptional(@NotNull Class<T> cl, @NotNull @SQL String sql, Object... args) {
return findOptional(cl, SqlQuery.query(sql, args));
} | [
"public",
"@",
"NotNull",
"<",
"T",
">",
"Optional",
"<",
"T",
">",
"findOptional",
"(",
"@",
"NotNull",
"Class",
"<",
"T",
">",
"cl",
",",
"@",
"NotNull",
"@",
"SQL",
"String",
"sql",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"findOptional",
"(",
"cl",
",",
"SqlQuery",
".",
"query",
"(",
"sql",
",",
"args",
")",
")",
";",
"}"
] | Finds a unique result from database, converting the database row to given class using default mechanisms.
Returns empty if there are no results or if single null result is returned.
@throws NonUniqueResultException if there are multiple result rows | [
"Finds",
"a",
"unique",
"result",
"from",
"database",
"converting",
"the",
"database",
"row",
"to",
"given",
"class",
"using",
"default",
"mechanisms",
".",
"Returns",
"empty",
"if",
"there",
"are",
"no",
"results",
"or",
"if",
"single",
"null",
"result",
"is",
"returned",
"."
] | train | https://github.com/EvidentSolutions/dalesbred/blob/713f5b6e152d97e1672ca68b9ff9c7c6c288ceb1/dalesbred/src/main/java/org/dalesbred/Database.java#L402-L404 |
bbottema/simple-java-mail | modules/simple-java-mail/src/main/java/org/simplejavamail/converter/internal/mimemessage/MimeMessageHelper.java | MimeMessageHelper.setTexts | static void setTexts(final Email email, final MimeMultipart multipartAlternativeMessages)
throws MessagingException {
if (email.getPlainText() != null) {
final MimeBodyPart messagePart = new MimeBodyPart();
messagePart.setText(email.getPlainText(), CHARACTER_ENCODING);
multipartAlternativeMessages.addBodyPart(messagePart);
}
if (email.getHTMLText() != null) {
final MimeBodyPart messagePartHTML = new MimeBodyPart();
messagePartHTML.setContent(email.getHTMLText(), "text/html; charset=\"" + CHARACTER_ENCODING + "\"");
multipartAlternativeMessages.addBodyPart(messagePartHTML);
}
if (email.getCalendarText() != null && email.getCalendarMethod() != null) {
final MimeBodyPart messagePartCalendar = new MimeBodyPart();
messagePartCalendar.setContent(email.getCalendarText(), "text/calendar; charset=\"" + CHARACTER_ENCODING + "\"; method=\"" + email.getCalendarMethod().toString() + "\"");
multipartAlternativeMessages.addBodyPart(messagePartCalendar);
}
} | java | static void setTexts(final Email email, final MimeMultipart multipartAlternativeMessages)
throws MessagingException {
if (email.getPlainText() != null) {
final MimeBodyPart messagePart = new MimeBodyPart();
messagePart.setText(email.getPlainText(), CHARACTER_ENCODING);
multipartAlternativeMessages.addBodyPart(messagePart);
}
if (email.getHTMLText() != null) {
final MimeBodyPart messagePartHTML = new MimeBodyPart();
messagePartHTML.setContent(email.getHTMLText(), "text/html; charset=\"" + CHARACTER_ENCODING + "\"");
multipartAlternativeMessages.addBodyPart(messagePartHTML);
}
if (email.getCalendarText() != null && email.getCalendarMethod() != null) {
final MimeBodyPart messagePartCalendar = new MimeBodyPart();
messagePartCalendar.setContent(email.getCalendarText(), "text/calendar; charset=\"" + CHARACTER_ENCODING + "\"; method=\"" + email.getCalendarMethod().toString() + "\"");
multipartAlternativeMessages.addBodyPart(messagePartCalendar);
}
} | [
"static",
"void",
"setTexts",
"(",
"final",
"Email",
"email",
",",
"final",
"MimeMultipart",
"multipartAlternativeMessages",
")",
"throws",
"MessagingException",
"{",
"if",
"(",
"email",
".",
"getPlainText",
"(",
")",
"!=",
"null",
")",
"{",
"final",
"MimeBodyPart",
"messagePart",
"=",
"new",
"MimeBodyPart",
"(",
")",
";",
"messagePart",
".",
"setText",
"(",
"email",
".",
"getPlainText",
"(",
")",
",",
"CHARACTER_ENCODING",
")",
";",
"multipartAlternativeMessages",
".",
"addBodyPart",
"(",
"messagePart",
")",
";",
"}",
"if",
"(",
"email",
".",
"getHTMLText",
"(",
")",
"!=",
"null",
")",
"{",
"final",
"MimeBodyPart",
"messagePartHTML",
"=",
"new",
"MimeBodyPart",
"(",
")",
";",
"messagePartHTML",
".",
"setContent",
"(",
"email",
".",
"getHTMLText",
"(",
")",
",",
"\"text/html; charset=\\\"\"",
"+",
"CHARACTER_ENCODING",
"+",
"\"\\\"\"",
")",
";",
"multipartAlternativeMessages",
".",
"addBodyPart",
"(",
"messagePartHTML",
")",
";",
"}",
"if",
"(",
"email",
".",
"getCalendarText",
"(",
")",
"!=",
"null",
"&&",
"email",
".",
"getCalendarMethod",
"(",
")",
"!=",
"null",
")",
"{",
"final",
"MimeBodyPart",
"messagePartCalendar",
"=",
"new",
"MimeBodyPart",
"(",
")",
";",
"messagePartCalendar",
".",
"setContent",
"(",
"email",
".",
"getCalendarText",
"(",
")",
",",
"\"text/calendar; charset=\\\"\"",
"+",
"CHARACTER_ENCODING",
"+",
"\"\\\"; method=\\\"\"",
"+",
"email",
".",
"getCalendarMethod",
"(",
")",
".",
"toString",
"(",
")",
"+",
"\"\\\"\"",
")",
";",
"multipartAlternativeMessages",
".",
"addBodyPart",
"(",
"messagePartCalendar",
")",
";",
"}",
"}"
] | Fills the {@link Message} instance with the content bodies (text, html and calendar).
@param email The message in which the content is defined.
@param multipartAlternativeMessages See {@link MimeMultipart#addBodyPart(BodyPart)}
@throws MessagingException See {@link BodyPart#setText(String)}, {@link BodyPart#setContent(Object, String)} and {@link
MimeMultipart#addBodyPart(BodyPart)}. | [
"Fills",
"the",
"{",
"@link",
"Message",
"}",
"instance",
"with",
"the",
"content",
"bodies",
"(",
"text",
"html",
"and",
"calendar",
")",
"."
] | train | https://github.com/bbottema/simple-java-mail/blob/b03635328aeecd525e35eddfef8f5b9a184559d8/modules/simple-java-mail/src/main/java/org/simplejavamail/converter/internal/mimemessage/MimeMessageHelper.java#L97-L114 |
pressgang-ccms/PressGangCCMSBuilder | src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java | DocBookBuildUtilities.convertDocumentToCDATAFormattedString | public static String convertDocumentToCDATAFormattedString(final Document doc, final XMLFormatProperties xmlFormatProperties) {
return XMLUtilities.wrapStringInCDATA(convertDocumentToFormattedString(doc, xmlFormatProperties));
} | java | public static String convertDocumentToCDATAFormattedString(final Document doc, final XMLFormatProperties xmlFormatProperties) {
return XMLUtilities.wrapStringInCDATA(convertDocumentToFormattedString(doc, xmlFormatProperties));
} | [
"public",
"static",
"String",
"convertDocumentToCDATAFormattedString",
"(",
"final",
"Document",
"doc",
",",
"final",
"XMLFormatProperties",
"xmlFormatProperties",
")",
"{",
"return",
"XMLUtilities",
".",
"wrapStringInCDATA",
"(",
"convertDocumentToFormattedString",
"(",
"doc",
",",
"xmlFormatProperties",
")",
")",
";",
"}"
] | Convert a DOM Document to a Formatted String representation and wrap it in a CDATA element.
@param doc The DOM Document to be converted and formatted.
@param xmlFormatProperties The XML Formatting Properties.
@return The converted XML String representation. | [
"Convert",
"a",
"DOM",
"Document",
"to",
"a",
"Formatted",
"String",
"representation",
"and",
"wrap",
"it",
"in",
"a",
"CDATA",
"element",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java#L474-L476 |
LGoodDatePicker/LGoodDatePicker | Project/src/main/java/com/github/lgooddatepicker/zinternaltools/InternalUtilities.java | InternalUtilities.getMostCommonElementInList | public static <T> T getMostCommonElementInList(List<T> sourceList) {
if (sourceList == null || sourceList.isEmpty()) {
return null;
}
Map<T, Integer> hashMap = new HashMap<T, Integer>();
for (T element : sourceList) {
Integer countOrNull = hashMap.get(element);
int newCount = (countOrNull == null) ? 1 : (countOrNull + 1);
hashMap.put(element, newCount);
}
// Find the largest entry.
// In the event of a tie, the first entry (the first entry in the hash map, not in the list)
// with the maximum count will be returned.
Entry<T, Integer> largestEntry = null;
for (Entry<T, Integer> currentEntry : hashMap.entrySet()) {
if (largestEntry == null || currentEntry.getValue() > largestEntry.getValue()) {
largestEntry = currentEntry;
}
}
T result = (largestEntry == null) ? null : largestEntry.getKey();
return result;
} | java | public static <T> T getMostCommonElementInList(List<T> sourceList) {
if (sourceList == null || sourceList.isEmpty()) {
return null;
}
Map<T, Integer> hashMap = new HashMap<T, Integer>();
for (T element : sourceList) {
Integer countOrNull = hashMap.get(element);
int newCount = (countOrNull == null) ? 1 : (countOrNull + 1);
hashMap.put(element, newCount);
}
// Find the largest entry.
// In the event of a tie, the first entry (the first entry in the hash map, not in the list)
// with the maximum count will be returned.
Entry<T, Integer> largestEntry = null;
for (Entry<T, Integer> currentEntry : hashMap.entrySet()) {
if (largestEntry == null || currentEntry.getValue() > largestEntry.getValue()) {
largestEntry = currentEntry;
}
}
T result = (largestEntry == null) ? null : largestEntry.getKey();
return result;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getMostCommonElementInList",
"(",
"List",
"<",
"T",
">",
"sourceList",
")",
"{",
"if",
"(",
"sourceList",
"==",
"null",
"||",
"sourceList",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"Map",
"<",
"T",
",",
"Integer",
">",
"hashMap",
"=",
"new",
"HashMap",
"<",
"T",
",",
"Integer",
">",
"(",
")",
";",
"for",
"(",
"T",
"element",
":",
"sourceList",
")",
"{",
"Integer",
"countOrNull",
"=",
"hashMap",
".",
"get",
"(",
"element",
")",
";",
"int",
"newCount",
"=",
"(",
"countOrNull",
"==",
"null",
")",
"?",
"1",
":",
"(",
"countOrNull",
"+",
"1",
")",
";",
"hashMap",
".",
"put",
"(",
"element",
",",
"newCount",
")",
";",
"}",
"// Find the largest entry. ",
"// In the event of a tie, the first entry (the first entry in the hash map, not in the list) ",
"// with the maximum count will be returned. ",
"Entry",
"<",
"T",
",",
"Integer",
">",
"largestEntry",
"=",
"null",
";",
"for",
"(",
"Entry",
"<",
"T",
",",
"Integer",
">",
"currentEntry",
":",
"hashMap",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"largestEntry",
"==",
"null",
"||",
"currentEntry",
".",
"getValue",
"(",
")",
">",
"largestEntry",
".",
"getValue",
"(",
")",
")",
"{",
"largestEntry",
"=",
"currentEntry",
";",
"}",
"}",
"T",
"result",
"=",
"(",
"largestEntry",
"==",
"null",
")",
"?",
"null",
":",
"largestEntry",
".",
"getKey",
"(",
")",
";",
"return",
"result",
";",
"}"
] | getMostCommonElementInList, This returns the most common element in the supplied list. In the
event of a tie, any element that is tied as the "largest element" may be returned. If the
list has no elements, or if the list is null, then this will return null. This can also
return null if null happens to be the most common element in the source list. | [
"getMostCommonElementInList",
"This",
"returns",
"the",
"most",
"common",
"element",
"in",
"the",
"supplied",
"list",
".",
"In",
"the",
"event",
"of",
"a",
"tie",
"any",
"element",
"that",
"is",
"tied",
"as",
"the",
"largest",
"element",
"may",
"be",
"returned",
".",
"If",
"the",
"list",
"has",
"no",
"elements",
"or",
"if",
"the",
"list",
"is",
"null",
"then",
"this",
"will",
"return",
"null",
".",
"This",
"can",
"also",
"return",
"null",
"if",
"null",
"happens",
"to",
"be",
"the",
"most",
"common",
"element",
"in",
"the",
"source",
"list",
"."
] | train | https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/zinternaltools/InternalUtilities.java#L100-L121 |
carewebframework/carewebframework-core | org.carewebframework.shell/src/main/java/org/carewebframework/shell/property/PropertyUtil.java | PropertyUtil.findSetter | public static Method findSetter(String methodName, Object instance, Class<?> valueClass) throws NoSuchMethodException {
return findMethod(methodName, instance, valueClass, true);
} | java | public static Method findSetter(String methodName, Object instance, Class<?> valueClass) throws NoSuchMethodException {
return findMethod(methodName, instance, valueClass, true);
} | [
"public",
"static",
"Method",
"findSetter",
"(",
"String",
"methodName",
",",
"Object",
"instance",
",",
"Class",
"<",
"?",
">",
"valueClass",
")",
"throws",
"NoSuchMethodException",
"{",
"return",
"findMethod",
"(",
"methodName",
",",
"instance",
",",
"valueClass",
",",
"true",
")",
";",
"}"
] | Returns the requested setter method from an object instance.
@param methodName Name of the setter method.
@param instance Object instance to search.
@param valueClass The setter parameter type (null if don't care).
@return The setter method.
@throws NoSuchMethodException If method was not found. | [
"Returns",
"the",
"requested",
"setter",
"method",
"from",
"an",
"object",
"instance",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/property/PropertyUtil.java#L46-L48 |
nominanuda/zen-project | zen-rhino/src/main/java/org/mozilla/javascript/HtmlUnitRegExpProxy.java | HtmlUnitRegExpProxy.isEscaped | static boolean isEscaped(final String characters, final int position) {
int p = position;
int nbBackslash = 0;
while (p > 0 && characters.charAt(--p) == '\\') {
nbBackslash++;
}
return (nbBackslash % 2 == 1);
} | java | static boolean isEscaped(final String characters, final int position) {
int p = position;
int nbBackslash = 0;
while (p > 0 && characters.charAt(--p) == '\\') {
nbBackslash++;
}
return (nbBackslash % 2 == 1);
} | [
"static",
"boolean",
"isEscaped",
"(",
"final",
"String",
"characters",
",",
"final",
"int",
"position",
")",
"{",
"int",
"p",
"=",
"position",
";",
"int",
"nbBackslash",
"=",
"0",
";",
"while",
"(",
"p",
">",
"0",
"&&",
"characters",
".",
"charAt",
"(",
"--",
"p",
")",
"==",
"'",
"'",
")",
"{",
"nbBackslash",
"++",
";",
"}",
"return",
"(",
"nbBackslash",
"%",
"2",
"==",
"1",
")",
";",
"}"
] | Indicates if the character at the given position is escaped or not.
@param characters
the characters to consider
@param position
the position
@return <code>true</code> if escaped | [
"Indicates",
"if",
"the",
"character",
"at",
"the",
"given",
"position",
"is",
"escaped",
"or",
"not",
"."
] | train | https://github.com/nominanuda/zen-project/blob/fe48ae8da198eb7066c2b56bf2ffafe4cdfc451d/zen-rhino/src/main/java/org/mozilla/javascript/HtmlUnitRegExpProxy.java#L242-L249 |
Domo42/saga-lib | saga-lib/src/main/java/com/codebullets/sagalib/AbstractSaga.java | AbstractSaga.requestTimeout | protected TimeoutId requestTimeout(final long delay, final TimeUnit unit, @Nullable final Object data) {
return requestTimeout(delay, unit, null, data);
} | java | protected TimeoutId requestTimeout(final long delay, final TimeUnit unit, @Nullable final Object data) {
return requestTimeout(delay, unit, null, data);
} | [
"protected",
"TimeoutId",
"requestTimeout",
"(",
"final",
"long",
"delay",
",",
"final",
"TimeUnit",
"unit",
",",
"@",
"Nullable",
"final",
"Object",
"data",
")",
"{",
"return",
"requestTimeout",
"(",
"delay",
",",
"unit",
",",
"null",
",",
"data",
")",
";",
"}"
] | Requests a timeout event attaching specific timeout data. This data is returned
with the timeout message received. | [
"Requests",
"a",
"timeout",
"event",
"attaching",
"specific",
"timeout",
"data",
".",
"This",
"data",
"is",
"returned",
"with",
"the",
"timeout",
"message",
"received",
"."
] | train | https://github.com/Domo42/saga-lib/blob/c8f232e2a51fcb6a3fe0082cfbf105c1e6bf90ef/saga-lib/src/main/java/com/codebullets/sagalib/AbstractSaga.java#L102-L104 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java | WordVectorSerializer.writeVocabCache | public static void writeVocabCache(@NonNull VocabCache<VocabWord> vocabCache, @NonNull File file)
throws IOException {
try (FileOutputStream fos = new FileOutputStream(file)) {
writeVocabCache(vocabCache, fos);
}
} | java | public static void writeVocabCache(@NonNull VocabCache<VocabWord> vocabCache, @NonNull File file)
throws IOException {
try (FileOutputStream fos = new FileOutputStream(file)) {
writeVocabCache(vocabCache, fos);
}
} | [
"public",
"static",
"void",
"writeVocabCache",
"(",
"@",
"NonNull",
"VocabCache",
"<",
"VocabWord",
">",
"vocabCache",
",",
"@",
"NonNull",
"File",
"file",
")",
"throws",
"IOException",
"{",
"try",
"(",
"FileOutputStream",
"fos",
"=",
"new",
"FileOutputStream",
"(",
"file",
")",
")",
"{",
"writeVocabCache",
"(",
"vocabCache",
",",
"fos",
")",
";",
"}",
"}"
] | This method saves vocab cache to provided File.
Please note: it saves only vocab content, so it's suitable mostly for BagOfWords/TF-IDF vectorizers
@param vocabCache
@param file
@throws UnsupportedEncodingException | [
"This",
"method",
"saves",
"vocab",
"cache",
"to",
"provided",
"File",
".",
"Please",
"note",
":",
"it",
"saves",
"only",
"vocab",
"content",
"so",
"it",
"s",
"suitable",
"mostly",
"for",
"BagOfWords",
"/",
"TF",
"-",
"IDF",
"vectorizers"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java#L2186-L2191 |
Azure/azure-sdk-for-java | notificationhubs/resource-manager/v2014_09_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2014_09_01/implementation/NotificationHubsInner.java | NotificationHubsInner.getPnsCredentialsAsync | public Observable<NotificationHubResourceInner> getPnsCredentialsAsync(String resourceGroupName, String namespaceName, String notificationHubName) {
return getPnsCredentialsWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName).map(new Func1<ServiceResponse<NotificationHubResourceInner>, NotificationHubResourceInner>() {
@Override
public NotificationHubResourceInner call(ServiceResponse<NotificationHubResourceInner> response) {
return response.body();
}
});
} | java | public Observable<NotificationHubResourceInner> getPnsCredentialsAsync(String resourceGroupName, String namespaceName, String notificationHubName) {
return getPnsCredentialsWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName).map(new Func1<ServiceResponse<NotificationHubResourceInner>, NotificationHubResourceInner>() {
@Override
public NotificationHubResourceInner call(ServiceResponse<NotificationHubResourceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"NotificationHubResourceInner",
">",
"getPnsCredentialsAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"namespaceName",
",",
"String",
"notificationHubName",
")",
"{",
"return",
"getPnsCredentialsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"namespaceName",
",",
"notificationHubName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"NotificationHubResourceInner",
">",
",",
"NotificationHubResourceInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"NotificationHubResourceInner",
"call",
"(",
"ServiceResponse",
"<",
"NotificationHubResourceInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Lists the PNS Credentials associated with a notification hub .
@param resourceGroupName The name of the resource group.
@param namespaceName The namespace name.
@param notificationHubName The notification hub name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the NotificationHubResourceInner object | [
"Lists",
"the",
"PNS",
"Credentials",
"associated",
"with",
"a",
"notification",
"hub",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/notificationhubs/resource-manager/v2014_09_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2014_09_01/implementation/NotificationHubsInner.java#L1203-L1210 |
dbracewell/mango | src/main/java/com/davidbracewell/conversion/Val.java | Val.asList | @SuppressWarnings("unchecked")
public <T> List<T> asList(Class<T> itemType) {
return asCollection(List.class, itemType);
} | java | @SuppressWarnings("unchecked")
public <T> List<T> asList(Class<T> itemType) {
return asCollection(List.class, itemType);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"List",
"<",
"T",
">",
"asList",
"(",
"Class",
"<",
"T",
">",
"itemType",
")",
"{",
"return",
"asCollection",
"(",
"List",
".",
"class",
",",
"itemType",
")",
";",
"}"
] | Converts the object to a List
@param <T> the type parameter
@param itemType The class of the item in the List
@return The object as a List | [
"Converts",
"the",
"object",
"to",
"a",
"List"
] | train | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/conversion/Val.java#L730-L733 |
hawkular/hawkular-agent | hawkular-agent-core/src/main/java/org/hawkular/agent/monitor/cmd/AbstractDMRResourcePathCommand.java | AbstractDMRResourcePathCommand.setServerRefreshIndicator | protected void setServerRefreshIndicator(OperationResult<?> opResults, RESP response) {
Optional<String> processState = opResults.getOptionalProcessState();
if (processState.isPresent()) {
try {
response.setServerRefreshIndicator(ServerRefreshIndicator.fromValue(processState.get().toUpperCase()));
} catch (Exception e) {
log.warnf("Cannot set server refresh indicator - process state is invalid", e);
}
}
} | java | protected void setServerRefreshIndicator(OperationResult<?> opResults, RESP response) {
Optional<String> processState = opResults.getOptionalProcessState();
if (processState.isPresent()) {
try {
response.setServerRefreshIndicator(ServerRefreshIndicator.fromValue(processState.get().toUpperCase()));
} catch (Exception e) {
log.warnf("Cannot set server refresh indicator - process state is invalid", e);
}
}
} | [
"protected",
"void",
"setServerRefreshIndicator",
"(",
"OperationResult",
"<",
"?",
">",
"opResults",
",",
"RESP",
"response",
")",
"{",
"Optional",
"<",
"String",
">",
"processState",
"=",
"opResults",
".",
"getOptionalProcessState",
"(",
")",
";",
"if",
"(",
"processState",
".",
"isPresent",
"(",
")",
")",
"{",
"try",
"{",
"response",
".",
"setServerRefreshIndicator",
"(",
"ServerRefreshIndicator",
".",
"fromValue",
"(",
"processState",
".",
"get",
"(",
")",
".",
"toUpperCase",
"(",
")",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"warnf",
"(",
"\"Cannot set server refresh indicator - process state is invalid\"",
",",
"e",
")",
";",
"}",
"}",
"}"
] | Given the results of an operation, this will set the {@link ServerRefreshIndicator}
found in those results in the given response.
@param opResults contains the DMR results
@param response the response message | [
"Given",
"the",
"results",
"of",
"an",
"operation",
"this",
"will",
"set",
"the",
"{",
"@link",
"ServerRefreshIndicator",
"}",
"found",
"in",
"those",
"results",
"in",
"the",
"given",
"response",
"."
] | train | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-agent-core/src/main/java/org/hawkular/agent/monitor/cmd/AbstractDMRResourcePathCommand.java#L171-L180 |
j256/ormlite-core | src/main/java/com/j256/ormlite/stmt/StatementExecutor.java | StatementExecutor.callBatchTasks | public <CT> CT callBatchTasks(ConnectionSource connectionSource, Callable<CT> callable) throws SQLException {
if (connectionSource.isSingleConnection(tableInfo.getTableName())) {
synchronized (this) {
return doCallBatchTasks(connectionSource, callable);
}
} else {
return doCallBatchTasks(connectionSource, callable);
}
} | java | public <CT> CT callBatchTasks(ConnectionSource connectionSource, Callable<CT> callable) throws SQLException {
if (connectionSource.isSingleConnection(tableInfo.getTableName())) {
synchronized (this) {
return doCallBatchTasks(connectionSource, callable);
}
} else {
return doCallBatchTasks(connectionSource, callable);
}
} | [
"public",
"<",
"CT",
">",
"CT",
"callBatchTasks",
"(",
"ConnectionSource",
"connectionSource",
",",
"Callable",
"<",
"CT",
">",
"callable",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"connectionSource",
".",
"isSingleConnection",
"(",
"tableInfo",
".",
"getTableName",
"(",
")",
")",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"return",
"doCallBatchTasks",
"(",
"connectionSource",
",",
"callable",
")",
";",
"}",
"}",
"else",
"{",
"return",
"doCallBatchTasks",
"(",
"connectionSource",
",",
"callable",
")",
";",
"}",
"}"
] | Call batch tasks inside of a connection which may, or may not, have been "saved". | [
"Call",
"batch",
"tasks",
"inside",
"of",
"a",
"connection",
"which",
"may",
"or",
"may",
"not",
"have",
"been",
"saved",
"."
] | train | https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/StatementExecutor.java#L594-L602 |
wso2/transport-http | components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/Util.java | Util.isKeepAlive | public static boolean isKeepAlive(KeepAliveConfig keepAliveConfig, HttpCarbonMessage outboundRequestMsg)
throws ConfigurationException {
switch (keepAliveConfig) {
case AUTO:
return Float.valueOf((String) outboundRequestMsg.getProperty(Constants.HTTP_VERSION)) > Constants.HTTP_1_0;
case ALWAYS:
return true;
case NEVER:
return false;
default:
// The execution will never reach here. In case execution reach here means it should be an invalid value
// for keep-alive configurations.
throw new ConfigurationException("Invalid keep-alive configuration value : "
+ keepAliveConfig.toString());
}
} | java | public static boolean isKeepAlive(KeepAliveConfig keepAliveConfig, HttpCarbonMessage outboundRequestMsg)
throws ConfigurationException {
switch (keepAliveConfig) {
case AUTO:
return Float.valueOf((String) outboundRequestMsg.getProperty(Constants.HTTP_VERSION)) > Constants.HTTP_1_0;
case ALWAYS:
return true;
case NEVER:
return false;
default:
// The execution will never reach here. In case execution reach here means it should be an invalid value
// for keep-alive configurations.
throw new ConfigurationException("Invalid keep-alive configuration value : "
+ keepAliveConfig.toString());
}
} | [
"public",
"static",
"boolean",
"isKeepAlive",
"(",
"KeepAliveConfig",
"keepAliveConfig",
",",
"HttpCarbonMessage",
"outboundRequestMsg",
")",
"throws",
"ConfigurationException",
"{",
"switch",
"(",
"keepAliveConfig",
")",
"{",
"case",
"AUTO",
":",
"return",
"Float",
".",
"valueOf",
"(",
"(",
"String",
")",
"outboundRequestMsg",
".",
"getProperty",
"(",
"Constants",
".",
"HTTP_VERSION",
")",
")",
">",
"Constants",
".",
"HTTP_1_0",
";",
"case",
"ALWAYS",
":",
"return",
"true",
";",
"case",
"NEVER",
":",
"return",
"false",
";",
"default",
":",
"// The execution will never reach here. In case execution reach here means it should be an invalid value",
"// for keep-alive configurations.",
"throw",
"new",
"ConfigurationException",
"(",
"\"Invalid keep-alive configuration value : \"",
"+",
"keepAliveConfig",
".",
"toString",
"(",
")",
")",
";",
"}",
"}"
] | Check whether a connection should alive or not.
@param keepAliveConfig of the connection
@param outboundRequestMsg of this particular transaction
@return true if the connection should be kept alive
@throws ConfigurationException for invalid configurations | [
"Check",
"whether",
"a",
"connection",
"should",
"alive",
"or",
"not",
"."
] | train | https://github.com/wso2/transport-http/blob/c51aa715b473db6c1b82a7d7b22f6e65f74df4c9/components/org.wso2.transport.http.netty/src/main/java/org/wso2/transport/http/netty/contractimpl/common/Util.java#L771-L786 |
HanSolo/SteelSeries-Swing | src/main/java/eu/hansolo/steelseries/gauges/SparkLine.java | SparkLine.calcHiLoValues | private void calcHiLoValues(double y, int index) {
if (y < lo) {
lo = y;
loIndex = index;
}
if (y > hi) {
hi = y;
hiIndex = index;
}
} | java | private void calcHiLoValues(double y, int index) {
if (y < lo) {
lo = y;
loIndex = index;
}
if (y > hi) {
hi = y;
hiIndex = index;
}
} | [
"private",
"void",
"calcHiLoValues",
"(",
"double",
"y",
",",
"int",
"index",
")",
"{",
"if",
"(",
"y",
"<",
"lo",
")",
"{",
"lo",
"=",
"y",
";",
"loIndex",
"=",
"index",
";",
"}",
"if",
"(",
"y",
">",
"hi",
")",
"{",
"hi",
"=",
"y",
";",
"hiIndex",
"=",
"index",
";",
"}",
"}"
] | Calculates the max and min measured values and stores the index of the
related values in in loIndex and hiIndex.
@param y
@param index | [
"Calculates",
"the",
"max",
"and",
"min",
"measured",
"values",
"and",
"stores",
"the",
"index",
"of",
"the",
"related",
"values",
"in",
"in",
"loIndex",
"and",
"hiIndex",
"."
] | train | https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/gauges/SparkLine.java#L1036-L1046 |
facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/TaskInProgress.java | TaskInProgress.getTaskToRun | public Task getTaskToRun(String taskTracker) {
// Create the 'taskid'; do not count the 'killed' tasks against the job!
TaskAttemptID taskid = null;
if (nextTaskId < (MAX_TASK_EXECS + maxTaskAttempts + numKilledTasks)) {
// Make sure that the attempts are unqiue across restarts
int attemptId = job.getNumRestarts() * NUM_ATTEMPTS_PER_RESTART + nextTaskId;
taskid = new TaskAttemptID( id, attemptId);
++nextTaskId;
} else {
LOG.warn("Exceeded limit of " + (MAX_TASK_EXECS + maxTaskAttempts) +
" (plus " + numKilledTasks + " killed)" +
" attempts for the tip '" + getTIPId() + "'");
return null;
}
//keep track of the last time we started an attempt at this TIP
//used to calculate the progress rate of this TIP
setDispatchTime(taskid, JobTracker.getClock().getTime());
if (0 == execStartTime){
// assume task starts running now
execStartTime = JobTracker.getClock().getTime();
}
return addRunningTask(taskid, taskTracker);
} | java | public Task getTaskToRun(String taskTracker) {
// Create the 'taskid'; do not count the 'killed' tasks against the job!
TaskAttemptID taskid = null;
if (nextTaskId < (MAX_TASK_EXECS + maxTaskAttempts + numKilledTasks)) {
// Make sure that the attempts are unqiue across restarts
int attemptId = job.getNumRestarts() * NUM_ATTEMPTS_PER_RESTART + nextTaskId;
taskid = new TaskAttemptID( id, attemptId);
++nextTaskId;
} else {
LOG.warn("Exceeded limit of " + (MAX_TASK_EXECS + maxTaskAttempts) +
" (plus " + numKilledTasks + " killed)" +
" attempts for the tip '" + getTIPId() + "'");
return null;
}
//keep track of the last time we started an attempt at this TIP
//used to calculate the progress rate of this TIP
setDispatchTime(taskid, JobTracker.getClock().getTime());
if (0 == execStartTime){
// assume task starts running now
execStartTime = JobTracker.getClock().getTime();
}
return addRunningTask(taskid, taskTracker);
} | [
"public",
"Task",
"getTaskToRun",
"(",
"String",
"taskTracker",
")",
"{",
"// Create the 'taskid'; do not count the 'killed' tasks against the job!",
"TaskAttemptID",
"taskid",
"=",
"null",
";",
"if",
"(",
"nextTaskId",
"<",
"(",
"MAX_TASK_EXECS",
"+",
"maxTaskAttempts",
"+",
"numKilledTasks",
")",
")",
"{",
"// Make sure that the attempts are unqiue across restarts",
"int",
"attemptId",
"=",
"job",
".",
"getNumRestarts",
"(",
")",
"*",
"NUM_ATTEMPTS_PER_RESTART",
"+",
"nextTaskId",
";",
"taskid",
"=",
"new",
"TaskAttemptID",
"(",
"id",
",",
"attemptId",
")",
";",
"++",
"nextTaskId",
";",
"}",
"else",
"{",
"LOG",
".",
"warn",
"(",
"\"Exceeded limit of \"",
"+",
"(",
"MAX_TASK_EXECS",
"+",
"maxTaskAttempts",
")",
"+",
"\" (plus \"",
"+",
"numKilledTasks",
"+",
"\" killed)\"",
"+",
"\" attempts for the tip '\"",
"+",
"getTIPId",
"(",
")",
"+",
"\"'\"",
")",
";",
"return",
"null",
";",
"}",
"//keep track of the last time we started an attempt at this TIP",
"//used to calculate the progress rate of this TIP",
"setDispatchTime",
"(",
"taskid",
",",
"JobTracker",
".",
"getClock",
"(",
")",
".",
"getTime",
"(",
")",
")",
";",
"if",
"(",
"0",
"==",
"execStartTime",
")",
"{",
"// assume task starts running now",
"execStartTime",
"=",
"JobTracker",
".",
"getClock",
"(",
")",
".",
"getTime",
"(",
")",
";",
"}",
"return",
"addRunningTask",
"(",
"taskid",
",",
"taskTracker",
")",
";",
"}"
] | Return a Task that can be sent to a TaskTracker for execution. | [
"Return",
"a",
"Task",
"that",
"can",
"be",
"sent",
"to",
"a",
"TaskTracker",
"for",
"execution",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskInProgress.java#L1223-L1246 |
Omertron/api-themoviedb | src/main/java/com/omertron/themoviedbapi/methods/TmdbLists.java | TmdbLists.deleteList | public StatusCode deleteList(String sessionId, String listId) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, listId);
parameters.add(Param.SESSION_ID, sessionId);
URL url = new ApiUrl(apiKey, MethodBase.LIST).buildUrl(parameters);
String webpage = httpTools.deleteRequest(url);
try {
return MAPPER.readValue(webpage, StatusCode.class);
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to delete list", url, ex);
}
} | java | public StatusCode deleteList(String sessionId, String listId) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, listId);
parameters.add(Param.SESSION_ID, sessionId);
URL url = new ApiUrl(apiKey, MethodBase.LIST).buildUrl(parameters);
String webpage = httpTools.deleteRequest(url);
try {
return MAPPER.readValue(webpage, StatusCode.class);
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to delete list", url, ex);
}
} | [
"public",
"StatusCode",
"deleteList",
"(",
"String",
"sessionId",
",",
"String",
"listId",
")",
"throws",
"MovieDbException",
"{",
"TmdbParameters",
"parameters",
"=",
"new",
"TmdbParameters",
"(",
")",
";",
"parameters",
".",
"add",
"(",
"Param",
".",
"ID",
",",
"listId",
")",
";",
"parameters",
".",
"add",
"(",
"Param",
".",
"SESSION_ID",
",",
"sessionId",
")",
";",
"URL",
"url",
"=",
"new",
"ApiUrl",
"(",
"apiKey",
",",
"MethodBase",
".",
"LIST",
")",
".",
"buildUrl",
"(",
"parameters",
")",
";",
"String",
"webpage",
"=",
"httpTools",
".",
"deleteRequest",
"(",
"url",
")",
";",
"try",
"{",
"return",
"MAPPER",
".",
"readValue",
"(",
"webpage",
",",
"StatusCode",
".",
"class",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"throw",
"new",
"MovieDbException",
"(",
"ApiExceptionType",
".",
"MAPPING_FAILED",
",",
"\"Failed to delete list\"",
",",
"url",
",",
"ex",
")",
";",
"}",
"}"
] | This method lets users delete a list that they created. A valid session id is required.
@param sessionId
@param listId
@return
@throws MovieDbException | [
"This",
"method",
"lets",
"users",
"delete",
"a",
"list",
"that",
"they",
"created",
".",
"A",
"valid",
"session",
"id",
"is",
"required",
"."
] | train | https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbLists.java#L140-L153 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/trees/TransformingTreebank.java | TransformingTreebank.main | public static void main(String[] args) {
Timing.startTime();
Treebank treebank = new DiskTreebank(new TreeReaderFactory() {
public TreeReader newTreeReader(Reader in) {
return new PennTreeReader(in);
}
});
Treebank treebank2 = new MemoryTreebank(new TreeReaderFactory() {
public TreeReader newTreeReader(Reader in) {
return new PennTreeReader(in);
}
});
treebank.loadPath(args[0]);
treebank2.loadPath(args[0]);
CompositeTreebank c = new CompositeTreebank(treebank, treebank2);
Timing.endTime();
TreeTransformer myTransformer = new MyTreeTransformer();
TreeTransformer myTransformer2 = new MyTreeTransformer2();
TreeTransformer myTransformer3 = new MyTreeTransformer3();
Treebank tf1 = c.transform(myTransformer).transform(myTransformer2).transform(myTransformer3);
Treebank tf2 = new TransformingTreebank(new TransformingTreebank(new TransformingTreebank(c, myTransformer), myTransformer2), myTransformer3);
TreeTransformer[] tta = { myTransformer, myTransformer2, myTransformer3 };
TreeTransformer tt3 = new CompositeTreeTransformer(Arrays.asList(tta));
Treebank tf3 = c.transform(tt3);
System.out.println("-------------------------");
System.out.println("COMPOSITE (DISK THEN MEMORY REPEATED VERSION OF) INPUT TREEBANK");
System.out.println(c);
System.out.println("-------------------------");
System.out.println("SLOWLY TRANSFORMED TREEBANK, USING TransformingTreebank() CONSTRUCTOR");
Treebank tx1 = new TransformingTreebank(c, myTransformer);
System.out.println(tx1);
System.out.println("-----");
Treebank tx2 = new TransformingTreebank(tx1, myTransformer2);
System.out.println(tx2);
System.out.println("-----");
Treebank tx3 = new TransformingTreebank(tx2, myTransformer3);
System.out.println(tx3);
System.out.println("-------------------------");
System.out.println("TRANSFORMED TREEBANK, USING Treebank.transform()");
System.out.println(tf1);
System.out.println("-------------------------");
System.out.println("PRINTING AGAIN TRANSFORMED TREEBANK, USING Treebank.transform()");
System.out.println(tf1);
System.out.println("-------------------------");
System.out.println("TRANSFORMED TREEBANK, USING TransformingTreebank() CONSTRUCTOR");
System.out.println(tf2);
System.out.println("-------------------------");
System.out.println("TRANSFORMED TREEBANK, USING CompositeTreeTransformer");
System.out.println(tf3);
System.out.println("-------------------------");
System.out.println("COMPOSITE (DISK THEN MEMORY REPEATED VERSION OF) INPUT TREEBANK");
System.out.println(c);
System.out.println("-------------------------");
} | java | public static void main(String[] args) {
Timing.startTime();
Treebank treebank = new DiskTreebank(new TreeReaderFactory() {
public TreeReader newTreeReader(Reader in) {
return new PennTreeReader(in);
}
});
Treebank treebank2 = new MemoryTreebank(new TreeReaderFactory() {
public TreeReader newTreeReader(Reader in) {
return new PennTreeReader(in);
}
});
treebank.loadPath(args[0]);
treebank2.loadPath(args[0]);
CompositeTreebank c = new CompositeTreebank(treebank, treebank2);
Timing.endTime();
TreeTransformer myTransformer = new MyTreeTransformer();
TreeTransformer myTransformer2 = new MyTreeTransformer2();
TreeTransformer myTransformer3 = new MyTreeTransformer3();
Treebank tf1 = c.transform(myTransformer).transform(myTransformer2).transform(myTransformer3);
Treebank tf2 = new TransformingTreebank(new TransformingTreebank(new TransformingTreebank(c, myTransformer), myTransformer2), myTransformer3);
TreeTransformer[] tta = { myTransformer, myTransformer2, myTransformer3 };
TreeTransformer tt3 = new CompositeTreeTransformer(Arrays.asList(tta));
Treebank tf3 = c.transform(tt3);
System.out.println("-------------------------");
System.out.println("COMPOSITE (DISK THEN MEMORY REPEATED VERSION OF) INPUT TREEBANK");
System.out.println(c);
System.out.println("-------------------------");
System.out.println("SLOWLY TRANSFORMED TREEBANK, USING TransformingTreebank() CONSTRUCTOR");
Treebank tx1 = new TransformingTreebank(c, myTransformer);
System.out.println(tx1);
System.out.println("-----");
Treebank tx2 = new TransformingTreebank(tx1, myTransformer2);
System.out.println(tx2);
System.out.println("-----");
Treebank tx3 = new TransformingTreebank(tx2, myTransformer3);
System.out.println(tx3);
System.out.println("-------------------------");
System.out.println("TRANSFORMED TREEBANK, USING Treebank.transform()");
System.out.println(tf1);
System.out.println("-------------------------");
System.out.println("PRINTING AGAIN TRANSFORMED TREEBANK, USING Treebank.transform()");
System.out.println(tf1);
System.out.println("-------------------------");
System.out.println("TRANSFORMED TREEBANK, USING TransformingTreebank() CONSTRUCTOR");
System.out.println(tf2);
System.out.println("-------------------------");
System.out.println("TRANSFORMED TREEBANK, USING CompositeTreeTransformer");
System.out.println(tf3);
System.out.println("-------------------------");
System.out.println("COMPOSITE (DISK THEN MEMORY REPEATED VERSION OF) INPUT TREEBANK");
System.out.println(c);
System.out.println("-------------------------");
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"Timing",
".",
"startTime",
"(",
")",
";",
"Treebank",
"treebank",
"=",
"new",
"DiskTreebank",
"(",
"new",
"TreeReaderFactory",
"(",
")",
"{",
"public",
"TreeReader",
"newTreeReader",
"(",
"Reader",
"in",
")",
"{",
"return",
"new",
"PennTreeReader",
"(",
"in",
")",
";",
"}",
"}",
")",
";",
"Treebank",
"treebank2",
"=",
"new",
"MemoryTreebank",
"(",
"new",
"TreeReaderFactory",
"(",
")",
"{",
"public",
"TreeReader",
"newTreeReader",
"(",
"Reader",
"in",
")",
"{",
"return",
"new",
"PennTreeReader",
"(",
"in",
")",
";",
"}",
"}",
")",
";",
"treebank",
".",
"loadPath",
"(",
"args",
"[",
"0",
"]",
")",
";",
"treebank2",
".",
"loadPath",
"(",
"args",
"[",
"0",
"]",
")",
";",
"CompositeTreebank",
"c",
"=",
"new",
"CompositeTreebank",
"(",
"treebank",
",",
"treebank2",
")",
";",
"Timing",
".",
"endTime",
"(",
")",
";",
"TreeTransformer",
"myTransformer",
"=",
"new",
"MyTreeTransformer",
"(",
")",
";",
"TreeTransformer",
"myTransformer2",
"=",
"new",
"MyTreeTransformer2",
"(",
")",
";",
"TreeTransformer",
"myTransformer3",
"=",
"new",
"MyTreeTransformer3",
"(",
")",
";",
"Treebank",
"tf1",
"=",
"c",
".",
"transform",
"(",
"myTransformer",
")",
".",
"transform",
"(",
"myTransformer2",
")",
".",
"transform",
"(",
"myTransformer3",
")",
";",
"Treebank",
"tf2",
"=",
"new",
"TransformingTreebank",
"(",
"new",
"TransformingTreebank",
"(",
"new",
"TransformingTreebank",
"(",
"c",
",",
"myTransformer",
")",
",",
"myTransformer2",
")",
",",
"myTransformer3",
")",
";",
"TreeTransformer",
"[",
"]",
"tta",
"=",
"{",
"myTransformer",
",",
"myTransformer2",
",",
"myTransformer3",
"}",
";",
"TreeTransformer",
"tt3",
"=",
"new",
"CompositeTreeTransformer",
"(",
"Arrays",
".",
"asList",
"(",
"tta",
")",
")",
";",
"Treebank",
"tf3",
"=",
"c",
".",
"transform",
"(",
"tt3",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"-------------------------\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"COMPOSITE (DISK THEN MEMORY REPEATED VERSION OF) INPUT TREEBANK\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"c",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"-------------------------\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"SLOWLY TRANSFORMED TREEBANK, USING TransformingTreebank() CONSTRUCTOR\"",
")",
";",
"Treebank",
"tx1",
"=",
"new",
"TransformingTreebank",
"(",
"c",
",",
"myTransformer",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"tx1",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"-----\"",
")",
";",
"Treebank",
"tx2",
"=",
"new",
"TransformingTreebank",
"(",
"tx1",
",",
"myTransformer2",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"tx2",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"-----\"",
")",
";",
"Treebank",
"tx3",
"=",
"new",
"TransformingTreebank",
"(",
"tx2",
",",
"myTransformer3",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"tx3",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"-------------------------\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"TRANSFORMED TREEBANK, USING Treebank.transform()\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"tf1",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"-------------------------\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"PRINTING AGAIN TRANSFORMED TREEBANK, USING Treebank.transform()\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"tf1",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"-------------------------\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"TRANSFORMED TREEBANK, USING TransformingTreebank() CONSTRUCTOR\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"tf2",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"-------------------------\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"TRANSFORMED TREEBANK, USING CompositeTreeTransformer\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"tf3",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"-------------------------\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"COMPOSITE (DISK THEN MEMORY REPEATED VERSION OF) INPUT TREEBANK\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"c",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"-------------------------\"",
")",
";",
"}"
] | Loads treebank grammar from first argument and prints it.
Just a demonstration of functionality. <br>
<code>usage: java MemoryTreebank treebankFilesPath</code>
@param args array of command-line arguments | [
"Loads",
"treebank",
"grammar",
"from",
"first",
"argument",
"and",
"prints",
"it",
".",
"Just",
"a",
"demonstration",
"of",
"functionality",
".",
"<br",
">",
"<code",
">",
"usage",
":",
"java",
"MemoryTreebank",
"treebankFilesPath<",
"/",
"code",
">"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/TransformingTreebank.java#L127-L181 |
apache/fluo | modules/core/src/main/java/org/apache/fluo/core/impl/FluoConfigurationImpl.java | FluoConfigurationImpl.getTxIfoCacheTimeout | public static long getTxIfoCacheTimeout(FluoConfiguration conf, TimeUnit tu) {
long millis = conf.getLong(TX_INFO_CACHE_TIMEOUT, TX_INFO_CACHE_TIMEOUT_DEFAULT);
if (millis <= 0) {
throw new IllegalArgumentException("Timeout must positive for " + TX_INFO_CACHE_TIMEOUT);
}
return tu.convert(millis, TimeUnit.MILLISECONDS);
} | java | public static long getTxIfoCacheTimeout(FluoConfiguration conf, TimeUnit tu) {
long millis = conf.getLong(TX_INFO_CACHE_TIMEOUT, TX_INFO_CACHE_TIMEOUT_DEFAULT);
if (millis <= 0) {
throw new IllegalArgumentException("Timeout must positive for " + TX_INFO_CACHE_TIMEOUT);
}
return tu.convert(millis, TimeUnit.MILLISECONDS);
} | [
"public",
"static",
"long",
"getTxIfoCacheTimeout",
"(",
"FluoConfiguration",
"conf",
",",
"TimeUnit",
"tu",
")",
"{",
"long",
"millis",
"=",
"conf",
".",
"getLong",
"(",
"TX_INFO_CACHE_TIMEOUT",
",",
"TX_INFO_CACHE_TIMEOUT_DEFAULT",
")",
";",
"if",
"(",
"millis",
"<=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Timeout must positive for \"",
"+",
"TX_INFO_CACHE_TIMEOUT",
")",
";",
"}",
"return",
"tu",
".",
"convert",
"(",
"millis",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
";",
"}"
] | Gets the time before stale entries in the cache are evicted based on age. This method returns a
long representing the time converted from the TimeUnit passed in.
@param conf The FluoConfiguration
@param tu The TimeUnit desired to represent the cache timeout | [
"Gets",
"the",
"time",
"before",
"stale",
"entries",
"in",
"the",
"cache",
"are",
"evicted",
"based",
"on",
"age",
".",
"This",
"method",
"returns",
"a",
"long",
"representing",
"the",
"time",
"converted",
"from",
"the",
"TimeUnit",
"passed",
"in",
"."
] | train | https://github.com/apache/fluo/blob/8e06204d4167651e2d3b5219b8c1397644e6ba6e/modules/core/src/main/java/org/apache/fluo/core/impl/FluoConfigurationImpl.java#L138-L144 |
3pillarlabs/spring-data-simpledb | spring-data-simpledb-impl/src/main/java/org/springframework/data/simpledb/reflection/ReflectionUtils.java | ReflectionUtils.getDeclaredFieldInHierarchy | public static Field getDeclaredFieldInHierarchy(Class<?> clazz, String fieldName) throws NoSuchFieldException {
Field field = null;
for (Class<?> acls = clazz; acls != null; acls = acls.getSuperclass()) {
try {
field = acls.getDeclaredField(fieldName);
break;
} catch (NoSuchFieldException e) {
// ignore
}
}
if (field == null) {
throw new NoSuchFieldException("Could not find field '" + fieldName + "' in class '" + clazz.getName() + "' or its super classes");
}
return field;
} | java | public static Field getDeclaredFieldInHierarchy(Class<?> clazz, String fieldName) throws NoSuchFieldException {
Field field = null;
for (Class<?> acls = clazz; acls != null; acls = acls.getSuperclass()) {
try {
field = acls.getDeclaredField(fieldName);
break;
} catch (NoSuchFieldException e) {
// ignore
}
}
if (field == null) {
throw new NoSuchFieldException("Could not find field '" + fieldName + "' in class '" + clazz.getName() + "' or its super classes");
}
return field;
} | [
"public",
"static",
"Field",
"getDeclaredFieldInHierarchy",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"fieldName",
")",
"throws",
"NoSuchFieldException",
"{",
"Field",
"field",
"=",
"null",
";",
"for",
"(",
"Class",
"<",
"?",
">",
"acls",
"=",
"clazz",
";",
"acls",
"!=",
"null",
";",
"acls",
"=",
"acls",
".",
"getSuperclass",
"(",
")",
")",
"{",
"try",
"{",
"field",
"=",
"acls",
".",
"getDeclaredField",
"(",
"fieldName",
")",
";",
"break",
";",
"}",
"catch",
"(",
"NoSuchFieldException",
"e",
")",
"{",
"// ignore",
"}",
"}",
"if",
"(",
"field",
"==",
"null",
")",
"{",
"throw",
"new",
"NoSuchFieldException",
"(",
"\"Could not find field '\"",
"+",
"fieldName",
"+",
"\"' in class '\"",
"+",
"clazz",
".",
"getName",
"(",
")",
"+",
"\"' or its super classes\"",
")",
";",
"}",
"return",
"field",
";",
"}"
] | Finds a declared field in given <tt>clazz</tt> and continues to search
up the superclass until no more super class is present.
@param clazz
@param fieldName
@return
@throws NoSuchFieldException | [
"Finds",
"a",
"declared",
"field",
"in",
"given",
"<tt",
">",
"clazz<",
"/",
"tt",
">",
"and",
"continues",
"to",
"search",
"up",
"the",
"superclass",
"until",
"no",
"more",
"super",
"class",
"is",
"present",
"."
] | train | https://github.com/3pillarlabs/spring-data-simpledb/blob/f1e0eb4e48ec4674d3966e8f5bc04c95031f93ae/spring-data-simpledb-impl/src/main/java/org/springframework/data/simpledb/reflection/ReflectionUtils.java#L300-L316 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java | ManagedDatabasesInner.updateAsync | public Observable<ManagedDatabaseInner> updateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters) {
return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1<ServiceResponse<ManagedDatabaseInner>, ManagedDatabaseInner>() {
@Override
public ManagedDatabaseInner call(ServiceResponse<ManagedDatabaseInner> response) {
return response.body();
}
});
} | java | public Observable<ManagedDatabaseInner> updateAsync(String resourceGroupName, String managedInstanceName, String databaseName, ManagedDatabaseUpdate parameters) {
return updateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, parameters).map(new Func1<ServiceResponse<ManagedDatabaseInner>, ManagedDatabaseInner>() {
@Override
public ManagedDatabaseInner call(ServiceResponse<ManagedDatabaseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ManagedDatabaseInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"managedInstanceName",
",",
"String",
"databaseName",
",",
"ManagedDatabaseUpdate",
"parameters",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"managedInstanceName",
",",
"databaseName",
",",
"parameters",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"ManagedDatabaseInner",
">",
",",
"ManagedDatabaseInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"ManagedDatabaseInner",
"call",
"(",
"ServiceResponse",
"<",
"ManagedDatabaseInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Updates an existing database.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param managedInstanceName The name of the managed instance.
@param databaseName The name of the database.
@param parameters The requested database resource state.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Updates",
"an",
"existing",
"database",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedDatabasesInner.java#L900-L907 |
FlyingHe/UtilsMaven | src/main/java/com/github/flyinghe/tools/CommonUtils.java | CommonUtils.imgToBase64Str | public static String imgToBase64Str(BufferedImage image, String formatName) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
String base64Str = null;
try {
ImageIO.write(image, formatName == null ? "jpeg" : formatName, baos);
byte[] bytes = baos.toByteArray();
base64Str = CommonUtils.bytesToBase64Str(bytes);
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
CommonUtils.closeIOStream(null, baos);
}
return base64Str;
} | java | public static String imgToBase64Str(BufferedImage image, String formatName) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
String base64Str = null;
try {
ImageIO.write(image, formatName == null ? "jpeg" : formatName, baos);
byte[] bytes = baos.toByteArray();
base64Str = CommonUtils.bytesToBase64Str(bytes);
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
CommonUtils.closeIOStream(null, baos);
}
return base64Str;
} | [
"public",
"static",
"String",
"imgToBase64Str",
"(",
"BufferedImage",
"image",
",",
"String",
"formatName",
")",
"{",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"String",
"base64Str",
"=",
"null",
";",
"try",
"{",
"ImageIO",
".",
"write",
"(",
"image",
",",
"formatName",
"==",
"null",
"?",
"\"jpeg\"",
":",
"formatName",
",",
"baos",
")",
";",
"byte",
"[",
"]",
"bytes",
"=",
"baos",
".",
"toByteArray",
"(",
")",
";",
"base64Str",
"=",
"CommonUtils",
".",
"bytesToBase64Str",
"(",
"bytes",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"finally",
"{",
"CommonUtils",
".",
"closeIOStream",
"(",
"null",
",",
"baos",
")",
";",
"}",
"return",
"base64Str",
";",
"}"
] | 将一张图片转换成指定格式的Base64字符串编码
@param image 指定一张图片
@param formatName 图片格式名,如gif,png,jpg,jpeg等,默认为jpeg
@return 返回编码好的字符串, 失败返回null | [
"将一张图片转换成指定格式的Base64字符串编码"
] | train | https://github.com/FlyingHe/UtilsMaven/blob/d9605b7bfe0c28a05289252e12d163e114080b4a/src/main/java/com/github/flyinghe/tools/CommonUtils.java#L181-L194 |
VoltDB/voltdb | src/frontend/org/voltdb/utils/PersistentBinaryDeque.java | PersistentBinaryDeque.quarantineSegment | private void quarantineSegment(Map.Entry<Long, PBDSegment> prevEntry) throws IOException {
quarantineSegment(prevEntry, prevEntry.getValue(), prevEntry.getValue().getNumEntries());
} | java | private void quarantineSegment(Map.Entry<Long, PBDSegment> prevEntry) throws IOException {
quarantineSegment(prevEntry, prevEntry.getValue(), prevEntry.getValue().getNumEntries());
} | [
"private",
"void",
"quarantineSegment",
"(",
"Map",
".",
"Entry",
"<",
"Long",
",",
"PBDSegment",
">",
"prevEntry",
")",
"throws",
"IOException",
"{",
"quarantineSegment",
"(",
"prevEntry",
",",
"prevEntry",
".",
"getValue",
"(",
")",
",",
"prevEntry",
".",
"getValue",
"(",
")",
".",
"getNumEntries",
"(",
")",
")",
";",
"}"
] | Quarantine a segment which was already added to {@link #m_segments}
@param prevEntry {@link Map.Entry} from {@link #m_segments} to quarantine
@throws IOException | [
"Quarantine",
"a",
"segment",
"which",
"was",
"already",
"added",
"to",
"{",
"@link",
"#m_segments",
"}"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/utils/PersistentBinaryDeque.java#L618-L620 |
datasalt/pangool | core/src/main/java/com/datasalt/pangool/utils/InstancesDistributor.java | InstancesDistributor.loadInstance | public static <T> T loadInstance(Configuration conf, Class<T> objClass, String fileName, boolean callSetConf)
throws IOException {
Path path = InstancesDistributor.locateFileInCache(conf, fileName);
T obj;
ObjectInput in;
if (path == null) {
throw new IOException("Path is null");
}
in = new ObjectInputStream(FileSystem.get(conf).open(path));
try {
obj = objClass.cast(in.readObject());
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
in.close();
if (obj instanceof Configurable && callSetConf) {
((Configurable) obj).setConf(conf);
}
return obj;
} | java | public static <T> T loadInstance(Configuration conf, Class<T> objClass, String fileName, boolean callSetConf)
throws IOException {
Path path = InstancesDistributor.locateFileInCache(conf, fileName);
T obj;
ObjectInput in;
if (path == null) {
throw new IOException("Path is null");
}
in = new ObjectInputStream(FileSystem.get(conf).open(path));
try {
obj = objClass.cast(in.readObject());
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
in.close();
if (obj instanceof Configurable && callSetConf) {
((Configurable) obj).setConf(conf);
}
return obj;
} | [
"public",
"static",
"<",
"T",
">",
"T",
"loadInstance",
"(",
"Configuration",
"conf",
",",
"Class",
"<",
"T",
">",
"objClass",
",",
"String",
"fileName",
",",
"boolean",
"callSetConf",
")",
"throws",
"IOException",
"{",
"Path",
"path",
"=",
"InstancesDistributor",
".",
"locateFileInCache",
"(",
"conf",
",",
"fileName",
")",
";",
"T",
"obj",
";",
"ObjectInput",
"in",
";",
"if",
"(",
"path",
"==",
"null",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Path is null\"",
")",
";",
"}",
"in",
"=",
"new",
"ObjectInputStream",
"(",
"FileSystem",
".",
"get",
"(",
"conf",
")",
".",
"open",
"(",
"path",
")",
")",
";",
"try",
"{",
"obj",
"=",
"objClass",
".",
"cast",
"(",
"in",
".",
"readObject",
"(",
")",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"in",
".",
"close",
"(",
")",
";",
"if",
"(",
"obj",
"instanceof",
"Configurable",
"&&",
"callSetConf",
")",
"{",
"(",
"(",
"Configurable",
")",
"obj",
")",
".",
"setConf",
"(",
"conf",
")",
";",
"}",
"return",
"obj",
";",
"}"
] | Given a Hadoop Configuration property and an Class, this method can
re-instantiate an Object instance that was previously distributed using *
{@link InstancesDistributor#distribute(Object, String, Configuration)}.
@param <T>
The object type.
@param conf
The Hadoop Configuration.
@param objClass
The object type class.
@param fileName
The file name to locate the instance
@param callSetConf
If true, will call setConf() if deserialized instance is
{@link Configurable}
@throws IOException | [
"Given",
"a",
"Hadoop",
"Configuration",
"property",
"and",
"an",
"Class",
"this",
"method",
"can",
"re",
"-",
"instantiate",
"an",
"Object",
"instance",
"that",
"was",
"previously",
"distributed",
"using",
"*",
"{",
"@link",
"InstancesDistributor#distribute",
"(",
"Object",
"String",
"Configuration",
")",
"}",
"."
] | train | https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/utils/InstancesDistributor.java#L117-L138 |
LearnLib/learnlib | algorithms/active/ttt/src/main/java/de/learnlib/algorithms/ttt/base/AbstractTTTLearner.java | AbstractTTTLearner.link | protected static <I, D> void link(AbstractBaseDTNode<I, D> dtNode, TTTState<I, D> state) {
assert dtNode.isLeaf();
dtNode.setData(state);
state.dtLeaf = dtNode;
} | java | protected static <I, D> void link(AbstractBaseDTNode<I, D> dtNode, TTTState<I, D> state) {
assert dtNode.isLeaf();
dtNode.setData(state);
state.dtLeaf = dtNode;
} | [
"protected",
"static",
"<",
"I",
",",
"D",
">",
"void",
"link",
"(",
"AbstractBaseDTNode",
"<",
"I",
",",
"D",
">",
"dtNode",
",",
"TTTState",
"<",
"I",
",",
"D",
">",
"state",
")",
"{",
"assert",
"dtNode",
".",
"isLeaf",
"(",
")",
";",
"dtNode",
".",
"setData",
"(",
"state",
")",
";",
"state",
".",
"dtLeaf",
"=",
"dtNode",
";",
"}"
] | Establish the connection between a node in the discrimination tree and a state of the hypothesis.
@param dtNode
the node in the discrimination tree
@param state
the state in the hypothesis | [
"Establish",
"the",
"connection",
"between",
"a",
"node",
"in",
"the",
"discrimination",
"tree",
"and",
"a",
"state",
"of",
"the",
"hypothesis",
"."
] | train | https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/algorithms/active/ttt/src/main/java/de/learnlib/algorithms/ttt/base/AbstractTTTLearner.java#L135-L140 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/jaxrs/utils/ThreadLocalProxyCopyOnWriteArrayList.java | ThreadLocalProxyCopyOnWriteArrayList.addAll | @Override
public boolean addAll(int index, Collection<? extends E> c) {
Object[] cs = c.toArray();
final ReentrantLock lock = this.lock;
lock.lock();
try {
Object[] elements = getArray();
int len = elements.length;
if (index > len || index < 0)
throw new IndexOutOfBoundsException("Index: " + index +
", Size: " + len);
if (cs.length == 0)
return false;
int numMoved = len - index;
Object[] newElements;
if (numMoved == 0)
newElements = Arrays.copyOf(elements, len + cs.length);
else {
newElements = new Object[len + cs.length];
System.arraycopy(elements, 0, newElements, 0, index);
System.arraycopy(elements, index,
newElements, index + cs.length,
numMoved);
}
System.arraycopy(cs, 0, newElements, index, cs.length);
setArray(newElements);
return true;
} finally {
lock.unlock();
}
} | java | @Override
public boolean addAll(int index, Collection<? extends E> c) {
Object[] cs = c.toArray();
final ReentrantLock lock = this.lock;
lock.lock();
try {
Object[] elements = getArray();
int len = elements.length;
if (index > len || index < 0)
throw new IndexOutOfBoundsException("Index: " + index +
", Size: " + len);
if (cs.length == 0)
return false;
int numMoved = len - index;
Object[] newElements;
if (numMoved == 0)
newElements = Arrays.copyOf(elements, len + cs.length);
else {
newElements = new Object[len + cs.length];
System.arraycopy(elements, 0, newElements, 0, index);
System.arraycopy(elements, index,
newElements, index + cs.length,
numMoved);
}
System.arraycopy(cs, 0, newElements, index, cs.length);
setArray(newElements);
return true;
} finally {
lock.unlock();
}
} | [
"@",
"Override",
"public",
"boolean",
"addAll",
"(",
"int",
"index",
",",
"Collection",
"<",
"?",
"extends",
"E",
">",
"c",
")",
"{",
"Object",
"[",
"]",
"cs",
"=",
"c",
".",
"toArray",
"(",
")",
";",
"final",
"ReentrantLock",
"lock",
"=",
"this",
".",
"lock",
";",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"Object",
"[",
"]",
"elements",
"=",
"getArray",
"(",
")",
";",
"int",
"len",
"=",
"elements",
".",
"length",
";",
"if",
"(",
"index",
">",
"len",
"||",
"index",
"<",
"0",
")",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"Index: \"",
"+",
"index",
"+",
"\", Size: \"",
"+",
"len",
")",
";",
"if",
"(",
"cs",
".",
"length",
"==",
"0",
")",
"return",
"false",
";",
"int",
"numMoved",
"=",
"len",
"-",
"index",
";",
"Object",
"[",
"]",
"newElements",
";",
"if",
"(",
"numMoved",
"==",
"0",
")",
"newElements",
"=",
"Arrays",
".",
"copyOf",
"(",
"elements",
",",
"len",
"+",
"cs",
".",
"length",
")",
";",
"else",
"{",
"newElements",
"=",
"new",
"Object",
"[",
"len",
"+",
"cs",
".",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"elements",
",",
"0",
",",
"newElements",
",",
"0",
",",
"index",
")",
";",
"System",
".",
"arraycopy",
"(",
"elements",
",",
"index",
",",
"newElements",
",",
"index",
"+",
"cs",
".",
"length",
",",
"numMoved",
")",
";",
"}",
"System",
".",
"arraycopy",
"(",
"cs",
",",
"0",
",",
"newElements",
",",
"index",
",",
"cs",
".",
"length",
")",
";",
"setArray",
"(",
"newElements",
")",
";",
"return",
"true",
";",
"}",
"finally",
"{",
"lock",
".",
"unlock",
"(",
")",
";",
"}",
"}"
] | Inserts all of the elements in the specified collection into this
list, starting at the specified position. Shifts the element
currently at that position (if any) and any subsequent elements to
the right (increases their indices). The new elements will appear
in this list in the order that they are returned by the
specified collection's iterator.
@param index index at which to insert the first element
from the specified collection
@param c collection containing elements to be added to this list
@return <tt>true</tt> if this list changed as a result of the call
@throws IndexOutOfBoundsException {@inheritDoc}
@throws NullPointerException if the specified collection is null
@see #add(int,Object) | [
"Inserts",
"all",
"of",
"the",
"elements",
"in",
"the",
"specified",
"collection",
"into",
"this",
"list",
"starting",
"at",
"the",
"specified",
"position",
".",
"Shifts",
"the",
"element",
"currently",
"at",
"that",
"position",
"(",
"if",
"any",
")",
"and",
"any",
"subsequent",
"elements",
"to",
"the",
"right",
"(",
"increases",
"their",
"indices",
")",
".",
"The",
"new",
"elements",
"will",
"appear",
"in",
"this",
"list",
"in",
"the",
"order",
"that",
"they",
"are",
"returned",
"by",
"the",
"specified",
"collection",
"s",
"iterator",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jaxrs.2.0.common/src/org/apache/cxf/jaxrs/utils/ThreadLocalProxyCopyOnWriteArrayList.java#L756-L786 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java | DiagnosticsInner.executeSiteDetectorSlot | public DiagnosticDetectorResponseInner executeSiteDetectorSlot(String resourceGroupName, String siteName, String detectorName, String diagnosticCategory, String slot, DateTime startTime, DateTime endTime, String timeGrain) {
return executeSiteDetectorSlotWithServiceResponseAsync(resourceGroupName, siteName, detectorName, diagnosticCategory, slot, startTime, endTime, timeGrain).toBlocking().single().body();
} | java | public DiagnosticDetectorResponseInner executeSiteDetectorSlot(String resourceGroupName, String siteName, String detectorName, String diagnosticCategory, String slot, DateTime startTime, DateTime endTime, String timeGrain) {
return executeSiteDetectorSlotWithServiceResponseAsync(resourceGroupName, siteName, detectorName, diagnosticCategory, slot, startTime, endTime, timeGrain).toBlocking().single().body();
} | [
"public",
"DiagnosticDetectorResponseInner",
"executeSiteDetectorSlot",
"(",
"String",
"resourceGroupName",
",",
"String",
"siteName",
",",
"String",
"detectorName",
",",
"String",
"diagnosticCategory",
",",
"String",
"slot",
",",
"DateTime",
"startTime",
",",
"DateTime",
"endTime",
",",
"String",
"timeGrain",
")",
"{",
"return",
"executeSiteDetectorSlotWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"siteName",
",",
"detectorName",
",",
"diagnosticCategory",
",",
"slot",
",",
"startTime",
",",
"endTime",
",",
"timeGrain",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Execute Detector.
Execute Detector.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param siteName Site Name
@param detectorName Detector Resource Name
@param diagnosticCategory Category Name
@param slot Slot Name
@param startTime Start Time
@param endTime End Time
@param timeGrain Time Grain
@throws IllegalArgumentException thrown if parameters fail the validation
@throws DefaultErrorResponseException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DiagnosticDetectorResponseInner object if successful. | [
"Execute",
"Detector",
".",
"Execute",
"Detector",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java#L2482-L2484 |
goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/connectionmanager/AbstractConnectionManager.java | AbstractConnectionManager.initialisePool | public void initialisePool()
{
Properties loginProperties = createLoginProperties();
if (logger.isDebugEnabled())
{
logger.debug("about to create pool with user-id : " + this.getJdbcUser());
}
ConnectionFactory connectionFactory = createConnectionFactory(loginProperties);
PoolableObjectFactory objectFactoryForConnectionPool = getObjectFactoryForConnectionPool(connectionFactory, connectionPool);
connectionPool = new ObjectPoolWithThreadAffinity(objectFactoryForConnectionPool, this.getPoolSize(),
this.getMaxWait(), this.getPoolSize(), this.getInitialSize(), true, false, this.timeBetweenEvictionRunsMillis,
this.minEvictableIdleTimeMillis, this.softMinEvictableIdleTimeMillis);
dataSource = createPoolingDataSource(connectionPool);
if (this.getInitialSize() > 0)
{
try // test connection
{
this.getConnection().close();
}
catch (Exception e)
{
logger.error("Error initializing pool " + this, e);
}
}
} | java | public void initialisePool()
{
Properties loginProperties = createLoginProperties();
if (logger.isDebugEnabled())
{
logger.debug("about to create pool with user-id : " + this.getJdbcUser());
}
ConnectionFactory connectionFactory = createConnectionFactory(loginProperties);
PoolableObjectFactory objectFactoryForConnectionPool = getObjectFactoryForConnectionPool(connectionFactory, connectionPool);
connectionPool = new ObjectPoolWithThreadAffinity(objectFactoryForConnectionPool, this.getPoolSize(),
this.getMaxWait(), this.getPoolSize(), this.getInitialSize(), true, false, this.timeBetweenEvictionRunsMillis,
this.minEvictableIdleTimeMillis, this.softMinEvictableIdleTimeMillis);
dataSource = createPoolingDataSource(connectionPool);
if (this.getInitialSize() > 0)
{
try // test connection
{
this.getConnection().close();
}
catch (Exception e)
{
logger.error("Error initializing pool " + this, e);
}
}
} | [
"public",
"void",
"initialisePool",
"(",
")",
"{",
"Properties",
"loginProperties",
"=",
"createLoginProperties",
"(",
")",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"about to create pool with user-id : \"",
"+",
"this",
".",
"getJdbcUser",
"(",
")",
")",
";",
"}",
"ConnectionFactory",
"connectionFactory",
"=",
"createConnectionFactory",
"(",
"loginProperties",
")",
";",
"PoolableObjectFactory",
"objectFactoryForConnectionPool",
"=",
"getObjectFactoryForConnectionPool",
"(",
"connectionFactory",
",",
"connectionPool",
")",
";",
"connectionPool",
"=",
"new",
"ObjectPoolWithThreadAffinity",
"(",
"objectFactoryForConnectionPool",
",",
"this",
".",
"getPoolSize",
"(",
")",
",",
"this",
".",
"getMaxWait",
"(",
")",
",",
"this",
".",
"getPoolSize",
"(",
")",
",",
"this",
".",
"getInitialSize",
"(",
")",
",",
"true",
",",
"false",
",",
"this",
".",
"timeBetweenEvictionRunsMillis",
",",
"this",
".",
"minEvictableIdleTimeMillis",
",",
"this",
".",
"softMinEvictableIdleTimeMillis",
")",
";",
"dataSource",
"=",
"createPoolingDataSource",
"(",
"connectionPool",
")",
";",
"if",
"(",
"this",
".",
"getInitialSize",
"(",
")",
">",
"0",
")",
"{",
"try",
"// test connection\r",
"{",
"this",
".",
"getConnection",
"(",
")",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"\"Error initializing pool \"",
"+",
"this",
",",
"e",
")",
";",
"}",
"}",
"}"
] | This method must be called after all the connection pool properties have been set. | [
"This",
"method",
"must",
"be",
"called",
"after",
"all",
"the",
"connection",
"pool",
"properties",
"have",
"been",
"set",
"."
] | train | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/connectionmanager/AbstractConnectionManager.java#L107-L136 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/util/JavacMessages.java | JavacMessages.getLocalizedString | public String getLocalizedString(String key, Object... args) {
return getLocalizedString(currentLocale, key, args);
} | java | public String getLocalizedString(String key, Object... args) {
return getLocalizedString(currentLocale, key, args);
} | [
"public",
"String",
"getLocalizedString",
"(",
"String",
"key",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"getLocalizedString",
"(",
"currentLocale",
",",
"key",
",",
"args",
")",
";",
"}"
] | Gets the localized string corresponding to a key, formatted with a set of args. | [
"Gets",
"the",
"localized",
"string",
"corresponding",
"to",
"a",
"key",
"formatted",
"with",
"a",
"set",
"of",
"args",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JavacMessages.java#L139-L141 |
EsotericSoftware/kryo | src/com/esotericsoftware/kryo/unsafe/UnsafeOutput.java | UnsafeOutput.writeBytes | public void writeBytes (Object from, long offset, int count) throws KryoException {
int copyCount = Math.min(capacity - position, count);
while (true) {
unsafe.copyMemory(from, offset, buffer, byteArrayBaseOffset + position, copyCount);
position += copyCount;
count -= copyCount;
if (count == 0) break;
offset += copyCount;
copyCount = Math.min(capacity, count);
require(copyCount);
}
} | java | public void writeBytes (Object from, long offset, int count) throws KryoException {
int copyCount = Math.min(capacity - position, count);
while (true) {
unsafe.copyMemory(from, offset, buffer, byteArrayBaseOffset + position, copyCount);
position += copyCount;
count -= copyCount;
if (count == 0) break;
offset += copyCount;
copyCount = Math.min(capacity, count);
require(copyCount);
}
} | [
"public",
"void",
"writeBytes",
"(",
"Object",
"from",
",",
"long",
"offset",
",",
"int",
"count",
")",
"throws",
"KryoException",
"{",
"int",
"copyCount",
"=",
"Math",
".",
"min",
"(",
"capacity",
"-",
"position",
",",
"count",
")",
";",
"while",
"(",
"true",
")",
"{",
"unsafe",
".",
"copyMemory",
"(",
"from",
",",
"offset",
",",
"buffer",
",",
"byteArrayBaseOffset",
"+",
"position",
",",
"copyCount",
")",
";",
"position",
"+=",
"copyCount",
";",
"count",
"-=",
"copyCount",
";",
"if",
"(",
"count",
"==",
"0",
")",
"break",
";",
"offset",
"+=",
"copyCount",
";",
"copyCount",
"=",
"Math",
".",
"min",
"(",
"capacity",
",",
"count",
")",
";",
"require",
"(",
"copyCount",
")",
";",
"}",
"}"
] | Write count bytes to the byte buffer, reading from the given offset inside the in-memory representation of the object. | [
"Write",
"count",
"bytes",
"to",
"the",
"byte",
"buffer",
"reading",
"from",
"the",
"given",
"offset",
"inside",
"the",
"in",
"-",
"memory",
"representation",
"of",
"the",
"object",
"."
] | train | https://github.com/EsotericSoftware/kryo/blob/a8be1ab26f347f299a3c3f7171d6447dd5390845/src/com/esotericsoftware/kryo/unsafe/UnsafeOutput.java#L170-L181 |
google/closure-compiler | src/com/google/javascript/jscomp/AstFactory.java | AstFactory.getVarNameType | private JSType getVarNameType(Scope scope, String name) {
Var var = scope.getVar(name);
JSType type = null;
if (var != null) {
Node nameDefinitionNode = var.getNode();
if (nameDefinitionNode != null) {
type = nameDefinitionNode.getJSType();
}
}
if (type == null) {
// TODO(bradfordcsmith): Consider throwing an error if the type cannot be found.
type = unknownType;
}
return type;
} | java | private JSType getVarNameType(Scope scope, String name) {
Var var = scope.getVar(name);
JSType type = null;
if (var != null) {
Node nameDefinitionNode = var.getNode();
if (nameDefinitionNode != null) {
type = nameDefinitionNode.getJSType();
}
}
if (type == null) {
// TODO(bradfordcsmith): Consider throwing an error if the type cannot be found.
type = unknownType;
}
return type;
} | [
"private",
"JSType",
"getVarNameType",
"(",
"Scope",
"scope",
",",
"String",
"name",
")",
"{",
"Var",
"var",
"=",
"scope",
".",
"getVar",
"(",
"name",
")",
";",
"JSType",
"type",
"=",
"null",
";",
"if",
"(",
"var",
"!=",
"null",
")",
"{",
"Node",
"nameDefinitionNode",
"=",
"var",
".",
"getNode",
"(",
")",
";",
"if",
"(",
"nameDefinitionNode",
"!=",
"null",
")",
"{",
"type",
"=",
"nameDefinitionNode",
".",
"getJSType",
"(",
")",
";",
"}",
"}",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"// TODO(bradfordcsmith): Consider throwing an error if the type cannot be found.",
"type",
"=",
"unknownType",
";",
"}",
"return",
"type",
";",
"}"
] | Look up the correct type for the given name in the given scope.
<p>Returns the unknown type if no type can be found | [
"Look",
"up",
"the",
"correct",
"type",
"for",
"the",
"given",
"name",
"in",
"the",
"given",
"scope",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AstFactory.java#L978-L992 |
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.beginDelete | public void beginDelete(String resourceGroupName, String routeTableName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, routeTableName).toBlocking().single().body();
} | java | public void beginDelete(String resourceGroupName, String routeTableName) {
beginDeleteWithServiceResponseAsync(resourceGroupName, routeTableName).toBlocking().single().body();
} | [
"public",
"void",
"beginDelete",
"(",
"String",
"resourceGroupName",
",",
"String",
"routeTableName",
")",
"{",
"beginDeleteWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"routeTableName",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
"(",
")",
".",
"body",
"(",
")",
";",
"}"
] | Deletes the specified route table.
@param resourceGroupName The name of the resource group.
@param routeTableName The name of the route table.
@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 | [
"Deletes",
"the",
"specified",
"route",
"table",
"."
] | 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#L191-L193 |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/Director.java | Director.uninstallFeaturesByProductId | public void uninstallFeaturesByProductId(String productId, boolean exceptPlatformFeatures) throws InstallException {
String[] productIds = new String[1];
productIds[0] = productId;
uninstallFeaturesByProductId(productIds, exceptPlatformFeatures);
} | java | public void uninstallFeaturesByProductId(String productId, boolean exceptPlatformFeatures) throws InstallException {
String[] productIds = new String[1];
productIds[0] = productId;
uninstallFeaturesByProductId(productIds, exceptPlatformFeatures);
} | [
"public",
"void",
"uninstallFeaturesByProductId",
"(",
"String",
"productId",
",",
"boolean",
"exceptPlatformFeatures",
")",
"throws",
"InstallException",
"{",
"String",
"[",
"]",
"productIds",
"=",
"new",
"String",
"[",
"1",
"]",
";",
"productIds",
"[",
"0",
"]",
"=",
"productId",
";",
"uninstallFeaturesByProductId",
"(",
"productIds",
",",
"exceptPlatformFeatures",
")",
";",
"}"
] | Calls below method to uninstall features by product id
@param productId product id to uninstall
@param exceptPlatformFeatures If platform features should be ignored
@throws InstallException | [
"Calls",
"below",
"method",
"to",
"uninstall",
"features",
"by",
"product",
"id"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/Director.java#L1907-L1911 |
CenturyLinkCloud/mdw | mdw-common/src/com/centurylink/mdw/model/workflow/Process.java | Process.getTransition | public Transition getTransition(Long fromId, Integer eventType, String completionCode) {
Transition ret = null;
for (Transition transition : getTransitions()) {
if (transition.getFromId().equals(fromId)
&& transition.match(eventType, completionCode)) {
if (ret == null) ret = transition;
else {
throw new IllegalStateException("Multiple matching work transitions when one expected:\n"
+ " processId: " + getId() + " fromId: " + fromId + " eventType: "
+ eventType + "compCode: " + completionCode);
}
}
}
return ret;
} | java | public Transition getTransition(Long fromId, Integer eventType, String completionCode) {
Transition ret = null;
for (Transition transition : getTransitions()) {
if (transition.getFromId().equals(fromId)
&& transition.match(eventType, completionCode)) {
if (ret == null) ret = transition;
else {
throw new IllegalStateException("Multiple matching work transitions when one expected:\n"
+ " processId: " + getId() + " fromId: " + fromId + " eventType: "
+ eventType + "compCode: " + completionCode);
}
}
}
return ret;
} | [
"public",
"Transition",
"getTransition",
"(",
"Long",
"fromId",
",",
"Integer",
"eventType",
",",
"String",
"completionCode",
")",
"{",
"Transition",
"ret",
"=",
"null",
";",
"for",
"(",
"Transition",
"transition",
":",
"getTransitions",
"(",
")",
")",
"{",
"if",
"(",
"transition",
".",
"getFromId",
"(",
")",
".",
"equals",
"(",
"fromId",
")",
"&&",
"transition",
".",
"match",
"(",
"eventType",
",",
"completionCode",
")",
")",
"{",
"if",
"(",
"ret",
"==",
"null",
")",
"ret",
"=",
"transition",
";",
"else",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Multiple matching work transitions when one expected:\\n\"",
"+",
"\" processId: \"",
"+",
"getId",
"(",
")",
"+",
"\" fromId: \"",
"+",
"fromId",
"+",
"\" eventType: \"",
"+",
"eventType",
"+",
"\"compCode: \"",
"+",
"completionCode",
")",
";",
"}",
"}",
"}",
"return",
"ret",
";",
"}"
] | Finds one work transition for this process matching the specified parameters
@param fromId
@param eventType
@param completionCode
@return the work transition value object (or null if not found) | [
"Finds",
"one",
"work",
"transition",
"for",
"this",
"process",
"matching",
"the",
"specified",
"parameters"
] | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/model/workflow/Process.java#L313-L327 |
junit-team/junit4 | src/main/java/org/junit/rules/ErrorCollector.java | ErrorCollector.checkThrows | public void checkThrows(Class<? extends Throwable> expectedThrowable, ThrowingRunnable runnable) {
try {
assertThrows(expectedThrowable, runnable);
} catch (AssertionError e) {
addError(e);
}
} | java | public void checkThrows(Class<? extends Throwable> expectedThrowable, ThrowingRunnable runnable) {
try {
assertThrows(expectedThrowable, runnable);
} catch (AssertionError e) {
addError(e);
}
} | [
"public",
"void",
"checkThrows",
"(",
"Class",
"<",
"?",
"extends",
"Throwable",
">",
"expectedThrowable",
",",
"ThrowingRunnable",
"runnable",
")",
"{",
"try",
"{",
"assertThrows",
"(",
"expectedThrowable",
",",
"runnable",
")",
";",
"}",
"catch",
"(",
"AssertionError",
"e",
")",
"{",
"addError",
"(",
"e",
")",
";",
"}",
"}"
] | Adds a failure to the table if {@code runnable} does not throw an
exception of type {@code expectedThrowable} when executed.
Execution continues, but the test will fail at the end if the runnable
does not throw an exception, or if it throws a different exception.
@param expectedThrowable the expected type of the exception
@param runnable a function that is expected to throw an exception when executed
@since 4.13 | [
"Adds",
"a",
"failure",
"to",
"the",
"table",
"if",
"{",
"@code",
"runnable",
"}",
"does",
"not",
"throw",
"an",
"exception",
"of",
"type",
"{",
"@code",
"expectedThrowable",
"}",
"when",
"executed",
".",
"Execution",
"continues",
"but",
"the",
"test",
"will",
"fail",
"at",
"the",
"end",
"if",
"the",
"runnable",
"does",
"not",
"throw",
"an",
"exception",
"or",
"if",
"it",
"throws",
"a",
"different",
"exception",
"."
] | train | https://github.com/junit-team/junit4/blob/d9861ecdb6e487f6c352437ee823879aca3b81d4/src/main/java/org/junit/rules/ErrorCollector.java#L118-L124 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java | NodeIndexer.addLongValue | protected void addLongValue(Document doc, String fieldName, Object internalValue)
{
long longVal = ((Long)internalValue).longValue();
doc.add(createFieldWithoutNorms(fieldName, LongField.longToString(longVal), PropertyType.LONG));
} | java | protected void addLongValue(Document doc, String fieldName, Object internalValue)
{
long longVal = ((Long)internalValue).longValue();
doc.add(createFieldWithoutNorms(fieldName, LongField.longToString(longVal), PropertyType.LONG));
} | [
"protected",
"void",
"addLongValue",
"(",
"Document",
"doc",
",",
"String",
"fieldName",
",",
"Object",
"internalValue",
")",
"{",
"long",
"longVal",
"=",
"(",
"(",
"Long",
")",
"internalValue",
")",
".",
"longValue",
"(",
")",
";",
"doc",
".",
"add",
"(",
"createFieldWithoutNorms",
"(",
"fieldName",
",",
"LongField",
".",
"longToString",
"(",
"longVal",
")",
",",
"PropertyType",
".",
"LONG",
")",
")",
";",
"}"
] | Adds the long value to the document as the named field. The long
value is converted to an indexable string value using the {@link LongField}
class.
@param doc The document to which to add the field
@param fieldName The name of the field to add
@param internalValue The value for the field to add to the document. | [
"Adds",
"the",
"long",
"value",
"to",
"the",
"document",
"as",
"the",
"named",
"field",
".",
"The",
"long",
"value",
"is",
"converted",
"to",
"an",
"indexable",
"string",
"value",
"using",
"the",
"{",
"@link",
"LongField",
"}",
"class",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/NodeIndexer.java#L775-L779 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java | AsynchronousRequest.getWorldInfo | public void getWorldInfo(int[] ids, Callback<List<World>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getWorldsInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | java | public void getWorldInfo(int[] ids, Callback<List<World>> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ids));
gw2API.getWorldsInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback);
} | [
"public",
"void",
"getWorldInfo",
"(",
"int",
"[",
"]",
"ids",
",",
"Callback",
"<",
"List",
"<",
"World",
">",
">",
"callback",
")",
"throws",
"GuildWars2Exception",
",",
"NullPointerException",
"{",
"isParamValid",
"(",
"new",
"ParamChecker",
"(",
"ids",
")",
")",
";",
"gw2API",
".",
"getWorldsInfo",
"(",
"processIds",
"(",
"ids",
")",
",",
"GuildWars2",
".",
"lang",
".",
"getValue",
"(",
")",
")",
".",
"enqueue",
"(",
"callback",
")",
";",
"}"
] | For more info on World API go <a href="https://wiki.guildwars2.com/wiki/API:2/worlds">here</a><br/>
Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions
@param ids list of world id
@param callback callback that is going to be used for {@link Call#enqueue(Callback)}
@throws GuildWars2Exception empty ID list
@throws NullPointerException if given {@link Callback} is empty
@see World world info | [
"For",
"more",
"info",
"on",
"World",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"worlds",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">",
"Give",
"user",
"the",
"access",
"to",
"{",
"@link",
"Callback#onResponse",
"(",
"Call",
"Response",
")",
"}",
"and",
"{",
"@link",
"Callback#onFailure",
"(",
"Call",
"Throwable",
")",
"}",
"methods",
"for",
"custom",
"interactions"
] | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L2553-L2556 |
LearnLib/automatalib | commons/util/src/main/java/net/automatalib/commons/util/comparison/CmpUtil.java | CmpUtil.canonicalCompare | public static <U extends Comparable<? super U>> int canonicalCompare(List<? extends U> o1, List<? extends U> o2) {
int siz1 = o1.size(), siz2 = o2.size();
if (siz1 != siz2) {
return siz1 - siz2;
}
return lexCompare(o1, o2);
} | java | public static <U extends Comparable<? super U>> int canonicalCompare(List<? extends U> o1, List<? extends U> o2) {
int siz1 = o1.size(), siz2 = o2.size();
if (siz1 != siz2) {
return siz1 - siz2;
}
return lexCompare(o1, o2);
} | [
"public",
"static",
"<",
"U",
"extends",
"Comparable",
"<",
"?",
"super",
"U",
">",
">",
"int",
"canonicalCompare",
"(",
"List",
"<",
"?",
"extends",
"U",
">",
"o1",
",",
"List",
"<",
"?",
"extends",
"U",
">",
"o2",
")",
"{",
"int",
"siz1",
"=",
"o1",
".",
"size",
"(",
")",
",",
"siz2",
"=",
"o2",
".",
"size",
"(",
")",
";",
"if",
"(",
"siz1",
"!=",
"siz2",
")",
"{",
"return",
"siz1",
"-",
"siz2",
";",
"}",
"return",
"lexCompare",
"(",
"o1",
",",
"o2",
")",
";",
"}"
] | Compares two {@link List}s of {@link Comparable} elements with respect to canonical ordering.
<p>
In canonical ordering, a sequence {@code o1} is less than a sequence {@code o2} if {@code o1} is shorter than
{@code o2}, or if they have the same length and {@code o1} is lexicographically smaller than {@code o2}.
@param o1
the first list
@param o2
the second list
@return the result of the comparison | [
"Compares",
"two",
"{",
"@link",
"List",
"}",
"s",
"of",
"{",
"@link",
"Comparable",
"}",
"elements",
"with",
"respect",
"to",
"canonical",
"ordering",
".",
"<p",
">",
"In",
"canonical",
"ordering",
"a",
"sequence",
"{",
"@code",
"o1",
"}",
"is",
"less",
"than",
"a",
"sequence",
"{",
"@code",
"o2",
"}",
"if",
"{",
"@code",
"o1",
"}",
"is",
"shorter",
"than",
"{",
"@code",
"o2",
"}",
"or",
"if",
"they",
"have",
"the",
"same",
"length",
"and",
"{",
"@code",
"o1",
"}",
"is",
"lexicographically",
"smaller",
"than",
"{",
"@code",
"o2",
"}",
"."
] | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/commons/util/src/main/java/net/automatalib/commons/util/comparison/CmpUtil.java#L80-L87 |
Jasig/uPortal | uPortal-core/src/main/java/org/apereo/portal/properties/PropertiesManager.java | PropertiesManager.getPropertyAsBoolean | public static boolean getPropertyAsBoolean(final String name, final boolean defaultValue) {
if (PropertiesManager.props == null) loadProps();
boolean returnValue = defaultValue;
try {
returnValue = getPropertyAsBoolean(name);
} catch (MissingPropertyException mpe) {
// do nothing, since we already logged the missing property
}
return returnValue;
} | java | public static boolean getPropertyAsBoolean(final String name, final boolean defaultValue) {
if (PropertiesManager.props == null) loadProps();
boolean returnValue = defaultValue;
try {
returnValue = getPropertyAsBoolean(name);
} catch (MissingPropertyException mpe) {
// do nothing, since we already logged the missing property
}
return returnValue;
} | [
"public",
"static",
"boolean",
"getPropertyAsBoolean",
"(",
"final",
"String",
"name",
",",
"final",
"boolean",
"defaultValue",
")",
"{",
"if",
"(",
"PropertiesManager",
".",
"props",
"==",
"null",
")",
"loadProps",
"(",
")",
";",
"boolean",
"returnValue",
"=",
"defaultValue",
";",
"try",
"{",
"returnValue",
"=",
"getPropertyAsBoolean",
"(",
"name",
")",
";",
"}",
"catch",
"(",
"MissingPropertyException",
"mpe",
")",
"{",
"// do nothing, since we already logged the missing property",
"}",
"return",
"returnValue",
";",
"}"
] | Get a property as a boolean, specifying a default value. If for any reason we are unable to
lookup the desired property, this method returns the supplied default value. This error
handling behavior makes this method suitable for calling from static initializers.
@param name - the name of the property to be accessed
@param defaultValue - default value that will be returned in the event of any error
@return the looked up property value, or the defaultValue if any problem.
@since 2.4 | [
"Get",
"a",
"property",
"as",
"a",
"boolean",
"specifying",
"a",
"default",
"value",
".",
"If",
"for",
"any",
"reason",
"we",
"are",
"unable",
"to",
"lookup",
"the",
"desired",
"property",
"this",
"method",
"returns",
"the",
"supplied",
"default",
"value",
".",
"This",
"error",
"handling",
"behavior",
"makes",
"this",
"method",
"suitable",
"for",
"calling",
"from",
"static",
"initializers",
"."
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-core/src/main/java/org/apereo/portal/properties/PropertiesManager.java#L350-L359 |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/orders/OrderItemUrl.java | OrderItemUrl.updateItemProductPriceUrl | public static MozuUrl updateItemProductPriceUrl(String orderId, String orderItemId, Double price, String responseFields, String updateMode, String version)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/items/{orderItemId}/price/{price}?updatemode={updateMode}&version={version}&responseFields={responseFields}");
formatter.formatUrl("orderId", orderId);
formatter.formatUrl("orderItemId", orderItemId);
formatter.formatUrl("price", price);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("updateMode", updateMode);
formatter.formatUrl("version", version);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl updateItemProductPriceUrl(String orderId, String orderItemId, Double price, String responseFields, String updateMode, String version)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/items/{orderItemId}/price/{price}?updatemode={updateMode}&version={version}&responseFields={responseFields}");
formatter.formatUrl("orderId", orderId);
formatter.formatUrl("orderItemId", orderItemId);
formatter.formatUrl("price", price);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("updateMode", updateMode);
formatter.formatUrl("version", version);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"updateItemProductPriceUrl",
"(",
"String",
"orderId",
",",
"String",
"orderItemId",
",",
"Double",
"price",
",",
"String",
"responseFields",
",",
"String",
"updateMode",
",",
"String",
"version",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/commerce/orders/{orderId}/items/{orderItemId}/price/{price}?updatemode={updateMode}&version={version}&responseFields={responseFields}\"",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"orderId\"",
",",
"orderId",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"orderItemId\"",
",",
"orderItemId",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"price\"",
",",
"price",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"responseFields\"",
",",
"responseFields",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"updateMode\"",
",",
"updateMode",
")",
";",
"formatter",
".",
"formatUrl",
"(",
"\"version\"",
",",
"version",
")",
";",
"return",
"new",
"MozuUrl",
"(",
"formatter",
".",
"getResourceUrl",
"(",
")",
",",
"MozuUrl",
".",
"UrlLocation",
".",
"TENANT_POD",
")",
";",
"}"
] | Get Resource Url for UpdateItemProductPrice
@param orderId Unique identifier of the order.
@param orderItemId Unique identifier of the item to remove from the order.
@param price The override price to specify for this item in the specified order.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@param updateMode Specifies whether to update the original order, update the order in draft mode, or update the order in draft mode and then commit the changes to the original. Draft mode enables users to make incremental order changes before committing the changes to the original order. Valid values are "ApplyToOriginal," "ApplyToDraft," or "ApplyAndCommit."
@param version Determines whether or not to check versioning of items for concurrency purposes.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"UpdateItemProductPrice"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/orders/OrderItemUrl.java#L163-L173 |
webmetrics/browsermob-proxy | src/main/java/org/browsermob/proxy/jetty/util/LineInput.java | LineInput.readLine | public int readLine(byte[] b,int off,int len)
throws IOException
{
len=fillLine(len);
if (len<0)
return -1;
if (len==0)
return 0;
System.arraycopy(_buf,_mark, b, off, len);
_mark=-1;
return len;
} | java | public int readLine(byte[] b,int off,int len)
throws IOException
{
len=fillLine(len);
if (len<0)
return -1;
if (len==0)
return 0;
System.arraycopy(_buf,_mark, b, off, len);
_mark=-1;
return len;
} | [
"public",
"int",
"readLine",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"len",
"=",
"fillLine",
"(",
"len",
")",
";",
"if",
"(",
"len",
"<",
"0",
")",
"return",
"-",
"1",
";",
"if",
"(",
"len",
"==",
"0",
")",
"return",
"0",
";",
"System",
".",
"arraycopy",
"(",
"_buf",
",",
"_mark",
",",
"b",
",",
"off",
",",
"len",
")",
";",
"_mark",
"=",
"-",
"1",
";",
"return",
"len",
";",
"}"
] | Read a line ended by CR, LF or CRLF.
@param b Byte array to place the line into.
@param off Offset into the buffer.
@param len Maximum length of line.
@return The length of the line or -1 for EOF.
@exception IOException | [
"Read",
"a",
"line",
"ended",
"by",
"CR",
"LF",
"or",
"CRLF",
"."
] | train | https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/util/LineInput.java#L251-L265 |
eclipse/xtext-lib | org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/BigIntegerExtensions.java | BigIntegerExtensions.operator_divide | @Inline(value="$1.divide($2)")
@Pure
public static BigInteger operator_divide(BigInteger a, BigInteger b) {
return a.divide(b);
} | java | @Inline(value="$1.divide($2)")
@Pure
public static BigInteger operator_divide(BigInteger a, BigInteger b) {
return a.divide(b);
} | [
"@",
"Inline",
"(",
"value",
"=",
"\"$1.divide($2)\"",
")",
"@",
"Pure",
"public",
"static",
"BigInteger",
"operator_divide",
"(",
"BigInteger",
"a",
",",
"BigInteger",
"b",
")",
"{",
"return",
"a",
".",
"divide",
"(",
"b",
")",
";",
"}"
] | The binary <code>divide</code> operator.
@param a
a BigInteger. May not be <code>null</code>.
@param b
a BigInteger. May not be <code>null</code>.
@return <code>a.divide(b)</code>
@throws NullPointerException
if {@code a} or {@code b} is <code>null</code>. | [
"The",
"binary",
"<code",
">",
"divide<",
"/",
"code",
">",
"operator",
"."
] | train | https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/BigIntegerExtensions.java#L116-L120 |
code4everything/util | src/main/java/com/zhazhapan/util/Checker.java | Checker.checkNull | public static Float checkNull(Float value, Float elseValue) {
return isNull(value) ? elseValue : value;
} | java | public static Float checkNull(Float value, Float elseValue) {
return isNull(value) ? elseValue : value;
} | [
"public",
"static",
"Float",
"checkNull",
"(",
"Float",
"value",
",",
"Float",
"elseValue",
")",
"{",
"return",
"isNull",
"(",
"value",
")",
"?",
"elseValue",
":",
"value",
";",
"}"
] | 检查Float是否为null
@param value 值
@param elseValue 为null返回的值
@return {@link Float}
@since 1.0.8 | [
"检查Float是否为null"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/Checker.java#L1294-L1296 |
dasein-cloud/dasein-cloud-aws | src/main/java/org/dasein/cloud/aws/AWSCloud.java | AWSCloud.getV4Authorization | public String getV4Authorization( String accessKey, String secretKey, String action, String url, String serviceId, Map<String, String> headers, String bodyHash ) throws InternalException {
serviceId = serviceId.toLowerCase();
String regionId = "us-east-1"; // default for IAM
// if( ctx != null && ctx.getRegionId() != null && !ctx.getRegionId().isEmpty() &&
// !serviceId.equalsIgnoreCase(IAMMethod.SERVICE_ID) ) {
// regionId = getContext().getRegionId();
// } else {
String host = url.replaceAll("https?:\\/\\/", "");
if( host.indexOf('/') > 0 ) {
host = host.substring(0, host.indexOf('/', 1));
}
if( !IAMMethod.SERVICE_ID.equalsIgnoreCase(serviceId) ) {
String[] urlParts = host.split("\\.");
// everywhere except s3 and iam this is: service.region.amazonaws.com or service.region.amazonaws.com.cn
if( urlParts.length > 2 ) {
regionId = urlParts[1];
if (regionId.startsWith("s3-")) {
regionId = regionId.substring(3);
}
}
}
String amzDate = extractV4Date(headers);
String credentialScope = getV4CredentialScope(amzDate, regionId, serviceId);
String signedHeaders = getV4SignedHeaders(headers);
String signature = signV4(secretKey, action, url, regionId, serviceId, headers, bodyHash);
return V4_ALGORITHM + " " + "Credential=" + accessKey + "/" + credentialScope + ", " + "SignedHeaders=" + signedHeaders + ", " + "Signature=" + signature;
} | java | public String getV4Authorization( String accessKey, String secretKey, String action, String url, String serviceId, Map<String, String> headers, String bodyHash ) throws InternalException {
serviceId = serviceId.toLowerCase();
String regionId = "us-east-1"; // default for IAM
// if( ctx != null && ctx.getRegionId() != null && !ctx.getRegionId().isEmpty() &&
// !serviceId.equalsIgnoreCase(IAMMethod.SERVICE_ID) ) {
// regionId = getContext().getRegionId();
// } else {
String host = url.replaceAll("https?:\\/\\/", "");
if( host.indexOf('/') > 0 ) {
host = host.substring(0, host.indexOf('/', 1));
}
if( !IAMMethod.SERVICE_ID.equalsIgnoreCase(serviceId) ) {
String[] urlParts = host.split("\\.");
// everywhere except s3 and iam this is: service.region.amazonaws.com or service.region.amazonaws.com.cn
if( urlParts.length > 2 ) {
regionId = urlParts[1];
if (regionId.startsWith("s3-")) {
regionId = regionId.substring(3);
}
}
}
String amzDate = extractV4Date(headers);
String credentialScope = getV4CredentialScope(amzDate, regionId, serviceId);
String signedHeaders = getV4SignedHeaders(headers);
String signature = signV4(secretKey, action, url, regionId, serviceId, headers, bodyHash);
return V4_ALGORITHM + " " + "Credential=" + accessKey + "/" + credentialScope + ", " + "SignedHeaders=" + signedHeaders + ", " + "Signature=" + signature;
} | [
"public",
"String",
"getV4Authorization",
"(",
"String",
"accessKey",
",",
"String",
"secretKey",
",",
"String",
"action",
",",
"String",
"url",
",",
"String",
"serviceId",
",",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
",",
"String",
"bodyHash",
")",
"throws",
"InternalException",
"{",
"serviceId",
"=",
"serviceId",
".",
"toLowerCase",
"(",
")",
";",
"String",
"regionId",
"=",
"\"us-east-1\"",
";",
"// default for IAM",
"// if( ctx != null && ctx.getRegionId() != null && !ctx.getRegionId().isEmpty() &&",
"// !serviceId.equalsIgnoreCase(IAMMethod.SERVICE_ID) ) {",
"// regionId = getContext().getRegionId();",
"// } else {",
"String",
"host",
"=",
"url",
".",
"replaceAll",
"(",
"\"https?:\\\\/\\\\/\"",
",",
"\"\"",
")",
";",
"if",
"(",
"host",
".",
"indexOf",
"(",
"'",
"'",
")",
">",
"0",
")",
"{",
"host",
"=",
"host",
".",
"substring",
"(",
"0",
",",
"host",
".",
"indexOf",
"(",
"'",
"'",
",",
"1",
")",
")",
";",
"}",
"if",
"(",
"!",
"IAMMethod",
".",
"SERVICE_ID",
".",
"equalsIgnoreCase",
"(",
"serviceId",
")",
")",
"{",
"String",
"[",
"]",
"urlParts",
"=",
"host",
".",
"split",
"(",
"\"\\\\.\"",
")",
";",
"// everywhere except s3 and iam this is: service.region.amazonaws.com or service.region.amazonaws.com.cn",
"if",
"(",
"urlParts",
".",
"length",
">",
"2",
")",
"{",
"regionId",
"=",
"urlParts",
"[",
"1",
"]",
";",
"if",
"(",
"regionId",
".",
"startsWith",
"(",
"\"s3-\"",
")",
")",
"{",
"regionId",
"=",
"regionId",
".",
"substring",
"(",
"3",
")",
";",
"}",
"}",
"}",
"String",
"amzDate",
"=",
"extractV4Date",
"(",
"headers",
")",
";",
"String",
"credentialScope",
"=",
"getV4CredentialScope",
"(",
"amzDate",
",",
"regionId",
",",
"serviceId",
")",
";",
"String",
"signedHeaders",
"=",
"getV4SignedHeaders",
"(",
"headers",
")",
";",
"String",
"signature",
"=",
"signV4",
"(",
"secretKey",
",",
"action",
",",
"url",
",",
"regionId",
",",
"serviceId",
",",
"headers",
",",
"bodyHash",
")",
";",
"return",
"V4_ALGORITHM",
"+",
"\" \"",
"+",
"\"Credential=\"",
"+",
"accessKey",
"+",
"\"/\"",
"+",
"credentialScope",
"+",
"\", \"",
"+",
"\"SignedHeaders=\"",
"+",
"signedHeaders",
"+",
"\", \"",
"+",
"\"Signature=\"",
"+",
"signature",
";",
"}"
] | Generates an AWS v4 signature authorization string
@param accessKey Amazon credential
@param secretKey Amazon credential
@param action the HTTP method (GET, POST, etc)
@param url the full URL for the request, including any query parameters
@param serviceId the canonical name of the service targeted in the request (e.g. "glacier")
@param headers map of headers of request. MUST include x-amz-date or date header.
@param bodyHash a hex-encoded sha256 hash of the body of the request
@return a string suitable for including as the HTTP Authorization header
@throws InternalException | [
"Generates",
"an",
"AWS",
"v4",
"signature",
"authorization",
"string"
] | train | https://github.com/dasein-cloud/dasein-cloud-aws/blob/05098574197a1f573f77447cadc39a76bf00b99d/src/main/java/org/dasein/cloud/aws/AWSCloud.java#L1015-L1042 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRSkeletonAnimation.java | GVRSkeletonAnimation.addChannel | public void addChannel(String boneName, GVRAnimationChannel channel)
{
int boneId = mSkeleton.getBoneIndex(boneName);
if (boneId >= 0)
{
mBoneChannels[boneId] = channel;
mSkeleton.setBoneOptions(boneId, GVRSkeleton.BONE_ANIMATE);
Log.d("BONE", "Adding animation channel %d %s ", boneId, boneName);
}
} | java | public void addChannel(String boneName, GVRAnimationChannel channel)
{
int boneId = mSkeleton.getBoneIndex(boneName);
if (boneId >= 0)
{
mBoneChannels[boneId] = channel;
mSkeleton.setBoneOptions(boneId, GVRSkeleton.BONE_ANIMATE);
Log.d("BONE", "Adding animation channel %d %s ", boneId, boneName);
}
} | [
"public",
"void",
"addChannel",
"(",
"String",
"boneName",
",",
"GVRAnimationChannel",
"channel",
")",
"{",
"int",
"boneId",
"=",
"mSkeleton",
".",
"getBoneIndex",
"(",
"boneName",
")",
";",
"if",
"(",
"boneId",
">=",
"0",
")",
"{",
"mBoneChannels",
"[",
"boneId",
"]",
"=",
"channel",
";",
"mSkeleton",
".",
"setBoneOptions",
"(",
"boneId",
",",
"GVRSkeleton",
".",
"BONE_ANIMATE",
")",
";",
"Log",
".",
"d",
"(",
"\"BONE\"",
",",
"\"Adding animation channel %d %s \"",
",",
"boneId",
",",
"boneName",
")",
";",
"}",
"}"
] | Add a channel to the animation to animate the named bone.
@param boneName name of bone to animate.
@param channel The animation channel. | [
"Add",
"a",
"channel",
"to",
"the",
"animation",
"to",
"animate",
"the",
"named",
"bone",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/keyframe/GVRSkeletonAnimation.java#L105-L114 |
sai-pullabhotla/catatumbo | src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java | DefaultDatastoreWriter.updateWithOptimisticLock | public <E> List<E> updateWithOptimisticLock(List<E> entities) {
if (entities == null || entities.isEmpty()) {
return new ArrayList<>();
}
Class<?> entityClass = entities.get(0).getClass();
PropertyMetadata versionMetadata = EntityIntrospector.getVersionMetadata(entityClass);
if (versionMetadata == null) {
return update(entities);
} else {
return updateWithOptimisticLockInternal(entities, versionMetadata);
}
} | java | public <E> List<E> updateWithOptimisticLock(List<E> entities) {
if (entities == null || entities.isEmpty()) {
return new ArrayList<>();
}
Class<?> entityClass = entities.get(0).getClass();
PropertyMetadata versionMetadata = EntityIntrospector.getVersionMetadata(entityClass);
if (versionMetadata == null) {
return update(entities);
} else {
return updateWithOptimisticLockInternal(entities, versionMetadata);
}
} | [
"public",
"<",
"E",
">",
"List",
"<",
"E",
">",
"updateWithOptimisticLock",
"(",
"List",
"<",
"E",
">",
"entities",
")",
"{",
"if",
"(",
"entities",
"==",
"null",
"||",
"entities",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"}",
"Class",
"<",
"?",
">",
"entityClass",
"=",
"entities",
".",
"get",
"(",
"0",
")",
".",
"getClass",
"(",
")",
";",
"PropertyMetadata",
"versionMetadata",
"=",
"EntityIntrospector",
".",
"getVersionMetadata",
"(",
"entityClass",
")",
";",
"if",
"(",
"versionMetadata",
"==",
"null",
")",
"{",
"return",
"update",
"(",
"entities",
")",
";",
"}",
"else",
"{",
"return",
"updateWithOptimisticLockInternal",
"(",
"entities",
",",
"versionMetadata",
")",
";",
"}",
"}"
] | Updates the given list of entities using optimistic locking feature, if the entities are set up
to support optimistic locking. Otherwise, a normal update is performed.
@param entities
the entities to update
@return the updated entities | [
"Updates",
"the",
"given",
"list",
"of",
"entities",
"using",
"optimistic",
"locking",
"feature",
"if",
"the",
"entities",
"are",
"set",
"up",
"to",
"support",
"optimistic",
"locking",
".",
"Otherwise",
"a",
"normal",
"update",
"is",
"performed",
"."
] | train | https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/DefaultDatastoreWriter.java#L235-L246 |
hector-client/hector | core/src/main/java/me/prettyprint/cassandra/service/template/ColumnFamilyTemplate.java | ColumnFamilyTemplate.countColumns | public int countColumns(K key, N start, N end, int max) {
CountQuery<K, N> query = HFactory.createCountQuery(keyspace, keySerializer,
topSerializer);
query.setKey(key);
query.setColumnFamily(columnFamily);
query.setRange(start, end, max);
return query.execute().get();
} | java | public int countColumns(K key, N start, N end, int max) {
CountQuery<K, N> query = HFactory.createCountQuery(keyspace, keySerializer,
topSerializer);
query.setKey(key);
query.setColumnFamily(columnFamily);
query.setRange(start, end, max);
return query.execute().get();
} | [
"public",
"int",
"countColumns",
"(",
"K",
"key",
",",
"N",
"start",
",",
"N",
"end",
",",
"int",
"max",
")",
"{",
"CountQuery",
"<",
"K",
",",
"N",
">",
"query",
"=",
"HFactory",
".",
"createCountQuery",
"(",
"keyspace",
",",
"keySerializer",
",",
"topSerializer",
")",
";",
"query",
".",
"setKey",
"(",
"key",
")",
";",
"query",
".",
"setColumnFamily",
"(",
"columnFamily",
")",
";",
"query",
".",
"setRange",
"(",
"start",
",",
"end",
",",
"max",
")",
";",
"return",
"query",
".",
"execute",
"(",
")",
".",
"get",
"(",
")",
";",
"}"
] | Counts columns in the specified range of a standard column family
@param key
@param start
@param end
@param max
@return | [
"Counts",
"columns",
"in",
"the",
"specified",
"range",
"of",
"a",
"standard",
"column",
"family"
] | train | https://github.com/hector-client/hector/blob/a302e68ca8d91b45d332e8c9afd7d98030b54de1/core/src/main/java/me/prettyprint/cassandra/service/template/ColumnFamilyTemplate.java#L103-L110 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.setCertificateIssuerAsync | public ServiceFuture<IssuerBundle> setCertificateIssuerAsync(String vaultBaseUrl, String issuerName, String provider, final ServiceCallback<IssuerBundle> serviceCallback) {
return ServiceFuture.fromResponse(setCertificateIssuerWithServiceResponseAsync(vaultBaseUrl, issuerName, provider), serviceCallback);
} | java | public ServiceFuture<IssuerBundle> setCertificateIssuerAsync(String vaultBaseUrl, String issuerName, String provider, final ServiceCallback<IssuerBundle> serviceCallback) {
return ServiceFuture.fromResponse(setCertificateIssuerWithServiceResponseAsync(vaultBaseUrl, issuerName, provider), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"IssuerBundle",
">",
"setCertificateIssuerAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"issuerName",
",",
"String",
"provider",
",",
"final",
"ServiceCallback",
"<",
"IssuerBundle",
">",
"serviceCallback",
")",
"{",
"return",
"ServiceFuture",
".",
"fromResponse",
"(",
"setCertificateIssuerWithServiceResponseAsync",
"(",
"vaultBaseUrl",
",",
"issuerName",
",",
"provider",
")",
",",
"serviceCallback",
")",
";",
"}"
] | Sets the specified certificate issuer.
The SetCertificateIssuer operation adds or updates the specified certificate issuer. This operation requires the certificates/setissuers permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param issuerName The name of the issuer.
@param provider The issuer provider.
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Sets",
"the",
"specified",
"certificate",
"issuer",
".",
"The",
"SetCertificateIssuer",
"operation",
"adds",
"or",
"updates",
"the",
"specified",
"certificate",
"issuer",
".",
"This",
"operation",
"requires",
"the",
"certificates",
"/",
"setissuers",
"permission",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L5915-L5917 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/Button.java | Button.addParameter | public void addParameter(String name, Object value, String facet)
throws JspException
{
assert(name != null) : "Parameter 'name' must not be null";
if (_params == null) {
_params = new HashMap();
}
ParamHelper.addParam(_params, name, value);
} | java | public void addParameter(String name, Object value, String facet)
throws JspException
{
assert(name != null) : "Parameter 'name' must not be null";
if (_params == null) {
_params = new HashMap();
}
ParamHelper.addParam(_params, name, value);
} | [
"public",
"void",
"addParameter",
"(",
"String",
"name",
",",
"Object",
"value",
",",
"String",
"facet",
")",
"throws",
"JspException",
"{",
"assert",
"(",
"name",
"!=",
"null",
")",
":",
"\"Parameter 'name' must not be null\"",
";",
"if",
"(",
"_params",
"==",
"null",
")",
"{",
"_params",
"=",
"new",
"HashMap",
"(",
")",
";",
"}",
"ParamHelper",
".",
"addParam",
"(",
"_params",
",",
"name",
",",
"value",
")",
";",
"}"
] | Adds a URL parameter to the generated hyperlink.
@param name the name of the parameter to be added.
@param value the value of the parameter to be added (a String or String[]).
@param facet | [
"Adds",
"a",
"URL",
"parameter",
"to",
"the",
"generated",
"hyperlink",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/Button.java#L281-L290 |
mapsforge/mapsforge | mapsforge-map-android/src/main/java/org/mapsforge/map/android/util/AndroidUtil.java | AndroidUtil.getMinimumCacheSize | public static int getMinimumCacheSize(int tileSize, double overdrawFactor, int width, int height) {
// height * overdrawFactor / tileSize calculates the number of tiles that would cover
// the view port, adding 1 is required since we can have part tiles on either side,
// adding 2 adds another row/column as spare and ensures that we will generally have
// a larger number of tiles in the cache than a TileLayer will render for a view.
// For any size we need a minimum of 4 (as the intersection of 4 tiles can always be in the
// middle of a view.
Dimension dimension = FrameBufferController.calculateFrameBufferDimension(new Dimension(width, height), overdrawFactor);
return Math.max(4, (2 + (dimension.height / tileSize))
* (2 + (dimension.width / tileSize)));
} | java | public static int getMinimumCacheSize(int tileSize, double overdrawFactor, int width, int height) {
// height * overdrawFactor / tileSize calculates the number of tiles that would cover
// the view port, adding 1 is required since we can have part tiles on either side,
// adding 2 adds another row/column as spare and ensures that we will generally have
// a larger number of tiles in the cache than a TileLayer will render for a view.
// For any size we need a minimum of 4 (as the intersection of 4 tiles can always be in the
// middle of a view.
Dimension dimension = FrameBufferController.calculateFrameBufferDimension(new Dimension(width, height), overdrawFactor);
return Math.max(4, (2 + (dimension.height / tileSize))
* (2 + (dimension.width / tileSize)));
} | [
"public",
"static",
"int",
"getMinimumCacheSize",
"(",
"int",
"tileSize",
",",
"double",
"overdrawFactor",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"// height * overdrawFactor / tileSize calculates the number of tiles that would cover",
"// the view port, adding 1 is required since we can have part tiles on either side,",
"// adding 2 adds another row/column as spare and ensures that we will generally have",
"// a larger number of tiles in the cache than a TileLayer will render for a view.",
"// For any size we need a minimum of 4 (as the intersection of 4 tiles can always be in the",
"// middle of a view.",
"Dimension",
"dimension",
"=",
"FrameBufferController",
".",
"calculateFrameBufferDimension",
"(",
"new",
"Dimension",
"(",
"width",
",",
"height",
")",
",",
"overdrawFactor",
")",
";",
"return",
"Math",
".",
"max",
"(",
"4",
",",
"(",
"2",
"+",
"(",
"dimension",
".",
"height",
"/",
"tileSize",
")",
")",
"*",
"(",
"2",
"+",
"(",
"dimension",
".",
"width",
"/",
"tileSize",
")",
")",
")",
";",
"}"
] | Compute the minimum cache size for a view, using the size of the map view.
For the view size we use the frame buffer calculated dimension.
@param tileSize the tile size
@param overdrawFactor the overdraw factor applied to the mapview
@param width the width of the map view
@param height the height of the map view
@return the minimum cache size for the view | [
"Compute",
"the",
"minimum",
"cache",
"size",
"for",
"a",
"view",
"using",
"the",
"size",
"of",
"the",
"map",
"view",
".",
"For",
"the",
"view",
"size",
"we",
"use",
"the",
"frame",
"buffer",
"calculated",
"dimension",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-android/src/main/java/org/mapsforge/map/android/util/AndroidUtil.java#L391-L401 |
passwordmaker/java-passwordmaker-lib | src/main/java/org/daveware/passwordmaker/PasswordMaker.java | PasswordMaker.makePassword | public SecureUTF8String makePassword(final SecureUTF8String masterPassword, final Account account, final String inputText)
throws Exception {
return makePassword(masterPassword, account, inputText, account.getUsername());
} | java | public SecureUTF8String makePassword(final SecureUTF8String masterPassword, final Account account, final String inputText)
throws Exception {
return makePassword(masterPassword, account, inputText, account.getUsername());
} | [
"public",
"SecureUTF8String",
"makePassword",
"(",
"final",
"SecureUTF8String",
"masterPassword",
",",
"final",
"Account",
"account",
",",
"final",
"String",
"inputText",
")",
"throws",
"Exception",
"{",
"return",
"makePassword",
"(",
"masterPassword",
",",
"account",
",",
"inputText",
",",
"account",
".",
"getUsername",
"(",
")",
")",
";",
"}"
] | Generates a hash of the master password with settings from the account.
It will use the username assigned to the account.
@param masterPassword The password to use as a key for the various algorithms.
@param account The account with the specific settings for the hash.
@param inputText The text to use as the input into the password maker algorithm
@return A SecureCharArray with the hashed data.
@throws Exception if something bad happened. | [
"Generates",
"a",
"hash",
"of",
"the",
"master",
"password",
"with",
"settings",
"from",
"the",
"account",
".",
"It",
"will",
"use",
"the",
"username",
"assigned",
"to",
"the",
"account",
"."
] | train | https://github.com/passwordmaker/java-passwordmaker-lib/blob/18c22fca7dd9a47f08161425b85a5bd257afbb2b/src/main/java/org/daveware/passwordmaker/PasswordMaker.java#L377-L381 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationsInner.java | DisasterRecoveryConfigurationsInner.createOrUpdateAsync | public Observable<DisasterRecoveryConfigurationInner> createOrUpdateAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).map(new Func1<ServiceResponse<DisasterRecoveryConfigurationInner>, DisasterRecoveryConfigurationInner>() {
@Override
public DisasterRecoveryConfigurationInner call(ServiceResponse<DisasterRecoveryConfigurationInner> response) {
return response.body();
}
});
} | java | public Observable<DisasterRecoveryConfigurationInner> createOrUpdateAsync(String resourceGroupName, String serverName, String disasterRecoveryConfigurationName) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, disasterRecoveryConfigurationName).map(new Func1<ServiceResponse<DisasterRecoveryConfigurationInner>, DisasterRecoveryConfigurationInner>() {
@Override
public DisasterRecoveryConfigurationInner call(ServiceResponse<DisasterRecoveryConfigurationInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DisasterRecoveryConfigurationInner",
">",
"createOrUpdateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"disasterRecoveryConfigurationName",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"serverName",
",",
"disasterRecoveryConfigurationName",
")",
".",
"map",
"(",
"new",
"Func1",
"<",
"ServiceResponse",
"<",
"DisasterRecoveryConfigurationInner",
">",
",",
"DisasterRecoveryConfigurationInner",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"DisasterRecoveryConfigurationInner",
"call",
"(",
"ServiceResponse",
"<",
"DisasterRecoveryConfigurationInner",
">",
"response",
")",
"{",
"return",
"response",
".",
"body",
"(",
")",
";",
"}",
"}",
")",
";",
"}"
] | Creates or updates a disaster recovery configuration.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param disasterRecoveryConfigurationName The name of the disaster recovery configuration to be created/updated.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Creates",
"or",
"updates",
"a",
"disaster",
"recovery",
"configuration",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DisasterRecoveryConfigurationsInner.java#L398-L405 |
rhuss/jolokia | client/java/src/main/java/org/jolokia/client/request/J4pRequestHandler.java | J4pRequestHandler.getHttpRequest | public <T extends J4pRequest> HttpUriRequest getHttpRequest(List<T> pRequests,Map<J4pQueryParameter,String> pProcessingOptions)
throws UnsupportedEncodingException, URISyntaxException {
JSONArray bulkRequest = new JSONArray();
String queryParams = prepareQueryParameters(pProcessingOptions);
HttpPost postReq = new HttpPost(createRequestURI(j4pServerUrl.getPath(),queryParams));
for (T request : pRequests) {
JSONObject requestContent = getJsonRequestContent(request);
bulkRequest.add(requestContent);
}
postReq.setEntity(new StringEntity(bulkRequest.toJSONString(),"utf-8"));
return postReq;
} | java | public <T extends J4pRequest> HttpUriRequest getHttpRequest(List<T> pRequests,Map<J4pQueryParameter,String> pProcessingOptions)
throws UnsupportedEncodingException, URISyntaxException {
JSONArray bulkRequest = new JSONArray();
String queryParams = prepareQueryParameters(pProcessingOptions);
HttpPost postReq = new HttpPost(createRequestURI(j4pServerUrl.getPath(),queryParams));
for (T request : pRequests) {
JSONObject requestContent = getJsonRequestContent(request);
bulkRequest.add(requestContent);
}
postReq.setEntity(new StringEntity(bulkRequest.toJSONString(),"utf-8"));
return postReq;
} | [
"public",
"<",
"T",
"extends",
"J4pRequest",
">",
"HttpUriRequest",
"getHttpRequest",
"(",
"List",
"<",
"T",
">",
"pRequests",
",",
"Map",
"<",
"J4pQueryParameter",
",",
"String",
">",
"pProcessingOptions",
")",
"throws",
"UnsupportedEncodingException",
",",
"URISyntaxException",
"{",
"JSONArray",
"bulkRequest",
"=",
"new",
"JSONArray",
"(",
")",
";",
"String",
"queryParams",
"=",
"prepareQueryParameters",
"(",
"pProcessingOptions",
")",
";",
"HttpPost",
"postReq",
"=",
"new",
"HttpPost",
"(",
"createRequestURI",
"(",
"j4pServerUrl",
".",
"getPath",
"(",
")",
",",
"queryParams",
")",
")",
";",
"for",
"(",
"T",
"request",
":",
"pRequests",
")",
"{",
"JSONObject",
"requestContent",
"=",
"getJsonRequestContent",
"(",
"request",
")",
";",
"bulkRequest",
".",
"add",
"(",
"requestContent",
")",
";",
"}",
"postReq",
".",
"setEntity",
"(",
"new",
"StringEntity",
"(",
"bulkRequest",
".",
"toJSONString",
"(",
")",
",",
"\"utf-8\"",
")",
")",
";",
"return",
"postReq",
";",
"}"
] | Get an HTTP Request for requesting multiples requests at once
@param pRequests requests to put into a HTTP request
@return HTTP request to send to the server | [
"Get",
"an",
"HTTP",
"Request",
"for",
"requesting",
"multiples",
"requests",
"at",
"once"
] | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/client/java/src/main/java/org/jolokia/client/request/J4pRequestHandler.java#L132-L143 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/Wikipedia.java | Wikipedia.getPages | public Set<Page> getPages(String title) throws WikiApiException {
Set<Integer> ids = new HashSet<Integer>(getPageIdsCaseInsensitive(title));
Set<Page> pages = new HashSet<Page>();
for (Integer id : ids) {
pages.add(new Page(this, id));
}
return pages;
} | java | public Set<Page> getPages(String title) throws WikiApiException {
Set<Integer> ids = new HashSet<Integer>(getPageIdsCaseInsensitive(title));
Set<Page> pages = new HashSet<Page>();
for (Integer id : ids) {
pages.add(new Page(this, id));
}
return pages;
} | [
"public",
"Set",
"<",
"Page",
">",
"getPages",
"(",
"String",
"title",
")",
"throws",
"WikiApiException",
"{",
"Set",
"<",
"Integer",
">",
"ids",
"=",
"new",
"HashSet",
"<",
"Integer",
">",
"(",
"getPageIdsCaseInsensitive",
"(",
"title",
")",
")",
";",
"Set",
"<",
"Page",
">",
"pages",
"=",
"new",
"HashSet",
"<",
"Page",
">",
"(",
")",
";",
"for",
"(",
"Integer",
"id",
":",
"ids",
")",
"{",
"pages",
".",
"add",
"(",
"new",
"Page",
"(",
"this",
",",
"id",
")",
")",
";",
"}",
"return",
"pages",
";",
"}"
] | Get all pages which match all lowercase/uppercase version of the given title.<br>
If the title is a redirect, the corresponding page is returned.<br>
Spaces in the title are converted to underscores, as this is a convention for Wikipedia article titles.
@param title The title of the page.
@return A set of page objects matching this title.
@throws WikiApiException If no page or redirect with this title exists or the title could not be properly parsed. | [
"Get",
"all",
"pages",
"which",
"match",
"all",
"lowercase",
"/",
"uppercase",
"version",
"of",
"the",
"given",
"title",
".",
"<br",
">",
"If",
"the",
"title",
"is",
"a",
"redirect",
"the",
"corresponding",
"page",
"is",
"returned",
".",
"<br",
">",
"Spaces",
"in",
"the",
"title",
"are",
"converted",
"to",
"underscores",
"as",
"this",
"is",
"a",
"convention",
"for",
"Wikipedia",
"article",
"titles",
"."
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.api/src/main/java/de/tudarmstadt/ukp/wikipedia/api/Wikipedia.java#L146-L154 |
apache/groovy | src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | DefaultGroovyMethods.asType | @SuppressWarnings("unchecked")
public static <T> T asType(Object[] ary, Class<T> clazz) {
if (clazz == List.class) {
return (T) new ArrayList(Arrays.asList(ary));
}
if (clazz == Set.class) {
return (T) new HashSet(Arrays.asList(ary));
}
if (clazz == SortedSet.class) {
return (T) new TreeSet(Arrays.asList(ary));
}
return asType((Object) ary, clazz);
} | java | @SuppressWarnings("unchecked")
public static <T> T asType(Object[] ary, Class<T> clazz) {
if (clazz == List.class) {
return (T) new ArrayList(Arrays.asList(ary));
}
if (clazz == Set.class) {
return (T) new HashSet(Arrays.asList(ary));
}
if (clazz == SortedSet.class) {
return (T) new TreeSet(Arrays.asList(ary));
}
return asType((Object) ary, clazz);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"asType",
"(",
"Object",
"[",
"]",
"ary",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"if",
"(",
"clazz",
"==",
"List",
".",
"class",
")",
"{",
"return",
"(",
"T",
")",
"new",
"ArrayList",
"(",
"Arrays",
".",
"asList",
"(",
"ary",
")",
")",
";",
"}",
"if",
"(",
"clazz",
"==",
"Set",
".",
"class",
")",
"{",
"return",
"(",
"T",
")",
"new",
"HashSet",
"(",
"Arrays",
".",
"asList",
"(",
"ary",
")",
")",
";",
"}",
"if",
"(",
"clazz",
"==",
"SortedSet",
".",
"class",
")",
"{",
"return",
"(",
"T",
")",
"new",
"TreeSet",
"(",
"Arrays",
".",
"asList",
"(",
"ary",
")",
")",
";",
"}",
"return",
"asType",
"(",
"(",
"Object",
")",
"ary",
",",
"clazz",
")",
";",
"}"
] | Converts the given array to either a List, Set, or
SortedSet. If the given class is something else, the
call is deferred to {@link #asType(Object,Class)}.
@param ary an array
@param clazz the desired class
@return the object resulting from this type conversion
@see #asType(java.lang.Object, java.lang.Class)
@since 1.5.1 | [
"Converts",
"the",
"given",
"array",
"to",
"either",
"a",
"List",
"Set",
"or",
"SortedSet",
".",
"If",
"the",
"given",
"class",
"is",
"something",
"else",
"the",
"call",
"is",
"deferred",
"to",
"{",
"@link",
"#asType",
"(",
"Object",
"Class",
")",
"}",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L11747-L11760 |
google/closure-compiler | src/com/google/javascript/jscomp/CheckGlobalNames.java | CheckGlobalNames.checkForBadModuleReference | private boolean checkForBadModuleReference(Name name, Ref ref) {
JSModuleGraph moduleGraph = compiler.getModuleGraph();
if (name.getGlobalSets() == 0 || ref.type == Ref.Type.SET_FROM_GLOBAL) {
// Back off if either 1) this name was never set, or 2) this reference /is/ a set.
return false;
}
if (name.getGlobalSets() == 1) {
// there is only one global set - it should be set as name.declaration
// just look at that declaration instead of iterating through every single reference.
Ref declaration = checkNotNull(name.getDeclaration());
return !isSetFromPrecedingModule(ref, declaration, moduleGraph);
}
// there are multiple sets, so check if any of them happens in this module or a module earlier
// in the dependency chain.
for (Ref set : name.getRefs()) {
if (isSetFromPrecedingModule(ref, set, moduleGraph)) {
return false;
}
}
return true;
} | java | private boolean checkForBadModuleReference(Name name, Ref ref) {
JSModuleGraph moduleGraph = compiler.getModuleGraph();
if (name.getGlobalSets() == 0 || ref.type == Ref.Type.SET_FROM_GLOBAL) {
// Back off if either 1) this name was never set, or 2) this reference /is/ a set.
return false;
}
if (name.getGlobalSets() == 1) {
// there is only one global set - it should be set as name.declaration
// just look at that declaration instead of iterating through every single reference.
Ref declaration = checkNotNull(name.getDeclaration());
return !isSetFromPrecedingModule(ref, declaration, moduleGraph);
}
// there are multiple sets, so check if any of them happens in this module or a module earlier
// in the dependency chain.
for (Ref set : name.getRefs()) {
if (isSetFromPrecedingModule(ref, set, moduleGraph)) {
return false;
}
}
return true;
} | [
"private",
"boolean",
"checkForBadModuleReference",
"(",
"Name",
"name",
",",
"Ref",
"ref",
")",
"{",
"JSModuleGraph",
"moduleGraph",
"=",
"compiler",
".",
"getModuleGraph",
"(",
")",
";",
"if",
"(",
"name",
".",
"getGlobalSets",
"(",
")",
"==",
"0",
"||",
"ref",
".",
"type",
"==",
"Ref",
".",
"Type",
".",
"SET_FROM_GLOBAL",
")",
"{",
"// Back off if either 1) this name was never set, or 2) this reference /is/ a set.",
"return",
"false",
";",
"}",
"if",
"(",
"name",
".",
"getGlobalSets",
"(",
")",
"==",
"1",
")",
"{",
"// there is only one global set - it should be set as name.declaration",
"// just look at that declaration instead of iterating through every single reference.",
"Ref",
"declaration",
"=",
"checkNotNull",
"(",
"name",
".",
"getDeclaration",
"(",
")",
")",
";",
"return",
"!",
"isSetFromPrecedingModule",
"(",
"ref",
",",
"declaration",
",",
"moduleGraph",
")",
";",
"}",
"// there are multiple sets, so check if any of them happens in this module or a module earlier",
"// in the dependency chain.",
"for",
"(",
"Ref",
"set",
":",
"name",
".",
"getRefs",
"(",
")",
")",
"{",
"if",
"(",
"isSetFromPrecedingModule",
"(",
"ref",
",",
"set",
",",
"moduleGraph",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | Returns true if this name is potentially referenced before being defined in a different module
<p>For example:
<ul>
<li>Module B depends on Module A. name is set in Module A and referenced in Module B. this is
fine, and this method returns false.
<li>Module A and Module B are unrelated. name is set in Module A and referenced in Module B.
this is an error, and this method returns true.
<li>name is referenced in Module A, and never set globally. This warning is not specific to
modules, so is emitted elsewhere.
</ul> | [
"Returns",
"true",
"if",
"this",
"name",
"is",
"potentially",
"referenced",
"before",
"being",
"defined",
"in",
"a",
"different",
"module"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CheckGlobalNames.java#L229-L249 |
jbundle/webapp | base/src/main/java/org/jbundle/util/webapp/base/BaseWebappServlet.java | BaseWebappServlet.getRequestParam | public String getRequestParam(HttpServletRequest request, String param, String defaultValue)
{
String value = request.getParameter(servicePid + '.' + param);
if ((value == null) && (properties != null))
value = properties.get(servicePid + '.' + param);
if (value == null)
value = request.getParameter(param);
if ((value == null) && (properties != null))
value = properties.get(param);
if (value == null)
value = defaultValue;
return value;
} | java | public String getRequestParam(HttpServletRequest request, String param, String defaultValue)
{
String value = request.getParameter(servicePid + '.' + param);
if ((value == null) && (properties != null))
value = properties.get(servicePid + '.' + param);
if (value == null)
value = request.getParameter(param);
if ((value == null) && (properties != null))
value = properties.get(param);
if (value == null)
value = defaultValue;
return value;
} | [
"public",
"String",
"getRequestParam",
"(",
"HttpServletRequest",
"request",
",",
"String",
"param",
",",
"String",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"request",
".",
"getParameter",
"(",
"servicePid",
"+",
"'",
"'",
"+",
"param",
")",
";",
"if",
"(",
"(",
"value",
"==",
"null",
")",
"&&",
"(",
"properties",
"!=",
"null",
")",
")",
"value",
"=",
"properties",
".",
"get",
"(",
"servicePid",
"+",
"'",
"'",
"+",
"param",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"value",
"=",
"request",
".",
"getParameter",
"(",
"param",
")",
";",
"if",
"(",
"(",
"value",
"==",
"null",
")",
"&&",
"(",
"properties",
"!=",
"null",
")",
")",
"value",
"=",
"properties",
".",
"get",
"(",
"param",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"value",
"=",
"defaultValue",
";",
"return",
"value",
";",
"}"
] | Get this param from the request or from the servlet's properties.
@param request
@param param
@param defaultValue
@return | [
"Get",
"this",
"param",
"from",
"the",
"request",
"or",
"from",
"the",
"servlet",
"s",
"properties",
"."
] | train | https://github.com/jbundle/webapp/blob/af2cf32bd92254073052f1f9b4bcd47c2f76ba7d/base/src/main/java/org/jbundle/util/webapp/base/BaseWebappServlet.java#L124-L136 |
sporniket/core | sporniket-core-io/src/main/java/com/sporniket/libre/io/AbstractTextFileConverter.java | AbstractTextFileConverter.openOutputFile | private void openOutputFile(final String outputFileName) throws IOException
{
myOutputFile = new File(outputFileName);
myOutputStream = new FileOutputStream(myOutputFile);
myStreamWriter = new OutputStreamWriter(myOutputStream, getOutputEncodingCode());
myBufferedWriter = new BufferedWriter(myStreamWriter);
} | java | private void openOutputFile(final String outputFileName) throws IOException
{
myOutputFile = new File(outputFileName);
myOutputStream = new FileOutputStream(myOutputFile);
myStreamWriter = new OutputStreamWriter(myOutputStream, getOutputEncodingCode());
myBufferedWriter = new BufferedWriter(myStreamWriter);
} | [
"private",
"void",
"openOutputFile",
"(",
"final",
"String",
"outputFileName",
")",
"throws",
"IOException",
"{",
"myOutputFile",
"=",
"new",
"File",
"(",
"outputFileName",
")",
";",
"myOutputStream",
"=",
"new",
"FileOutputStream",
"(",
"myOutputFile",
")",
";",
"myStreamWriter",
"=",
"new",
"OutputStreamWriter",
"(",
"myOutputStream",
",",
"getOutputEncodingCode",
"(",
")",
")",
";",
"myBufferedWriter",
"=",
"new",
"BufferedWriter",
"(",
"myStreamWriter",
")",
";",
"}"
] | Prepare the output stream.
@param outputFileName
the file to write into.
@throws IOException
if a problem occurs. | [
"Prepare",
"the",
"output",
"stream",
"."
] | train | https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-io/src/main/java/com/sporniket/libre/io/AbstractTextFileConverter.java#L420-L426 |
nguyenq/tess4j | src/main/java/net/sourceforge/tess4j/util/PdfGsUtilities.java | PdfGsUtilities.convertPdf2Png | public synchronized static File[] convertPdf2Png(File inputPdfFile) throws IOException {
Path path = Files.createTempDirectory("tessimages");
File imageDir = path.toFile();
//get Ghostscript instance
Ghostscript gs = Ghostscript.getInstance();
//prepare Ghostscript interpreter parameters
//refer to Ghostscript documentation for parameter usage
List<String> gsArgs = new ArrayList<String>();
gsArgs.add("-gs");
gsArgs.add("-dNOPAUSE");
gsArgs.add("-dQUIET");
gsArgs.add("-dBATCH");
gsArgs.add("-dSAFER");
gsArgs.add("-sDEVICE=pnggray");
gsArgs.add("-r300");
gsArgs.add("-dGraphicsAlphaBits=4");
gsArgs.add("-dTextAlphaBits=4");
gsArgs.add("-sOutputFile=" + imageDir.getPath() + "/workingimage%04d.png");
gsArgs.add(inputPdfFile.getPath());
//execute and exit interpreter
try {
synchronized (gs) {
gs.initialize(gsArgs.toArray(new String[0]));
gs.exit();
}
} catch (UnsatisfiedLinkError e) {
logger.error(e.getMessage());
throw new RuntimeException(getMessage(e.getMessage()));
} catch (NoClassDefFoundError e) {
logger.error(e.getMessage());
throw new RuntimeException(getMessage(e.getMessage()));
} catch (GhostscriptException e) {
logger.error(e.getMessage());
throw new RuntimeException(e.getMessage());
} finally {
if (imageDir.list().length == 0) {
imageDir.delete();
}
//delete interpreter instance (safer)
try {
Ghostscript.deleteInstance();
} catch (GhostscriptException e) {
//nothing
}
}
// find working files
File[] workingFiles = imageDir.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.toLowerCase().matches("workingimage\\d{4}\\.png$");
}
});
Arrays.sort(workingFiles, new Comparator<File>() {
@Override
public int compare(File f1, File f2) {
return f1.getName().compareTo(f2.getName());
}
});
return workingFiles;
} | java | public synchronized static File[] convertPdf2Png(File inputPdfFile) throws IOException {
Path path = Files.createTempDirectory("tessimages");
File imageDir = path.toFile();
//get Ghostscript instance
Ghostscript gs = Ghostscript.getInstance();
//prepare Ghostscript interpreter parameters
//refer to Ghostscript documentation for parameter usage
List<String> gsArgs = new ArrayList<String>();
gsArgs.add("-gs");
gsArgs.add("-dNOPAUSE");
gsArgs.add("-dQUIET");
gsArgs.add("-dBATCH");
gsArgs.add("-dSAFER");
gsArgs.add("-sDEVICE=pnggray");
gsArgs.add("-r300");
gsArgs.add("-dGraphicsAlphaBits=4");
gsArgs.add("-dTextAlphaBits=4");
gsArgs.add("-sOutputFile=" + imageDir.getPath() + "/workingimage%04d.png");
gsArgs.add(inputPdfFile.getPath());
//execute and exit interpreter
try {
synchronized (gs) {
gs.initialize(gsArgs.toArray(new String[0]));
gs.exit();
}
} catch (UnsatisfiedLinkError e) {
logger.error(e.getMessage());
throw new RuntimeException(getMessage(e.getMessage()));
} catch (NoClassDefFoundError e) {
logger.error(e.getMessage());
throw new RuntimeException(getMessage(e.getMessage()));
} catch (GhostscriptException e) {
logger.error(e.getMessage());
throw new RuntimeException(e.getMessage());
} finally {
if (imageDir.list().length == 0) {
imageDir.delete();
}
//delete interpreter instance (safer)
try {
Ghostscript.deleteInstance();
} catch (GhostscriptException e) {
//nothing
}
}
// find working files
File[] workingFiles = imageDir.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.toLowerCase().matches("workingimage\\d{4}\\.png$");
}
});
Arrays.sort(workingFiles, new Comparator<File>() {
@Override
public int compare(File f1, File f2) {
return f1.getName().compareTo(f2.getName());
}
});
return workingFiles;
} | [
"public",
"synchronized",
"static",
"File",
"[",
"]",
"convertPdf2Png",
"(",
"File",
"inputPdfFile",
")",
"throws",
"IOException",
"{",
"Path",
"path",
"=",
"Files",
".",
"createTempDirectory",
"(",
"\"tessimages\"",
")",
";",
"File",
"imageDir",
"=",
"path",
".",
"toFile",
"(",
")",
";",
"//get Ghostscript instance\r",
"Ghostscript",
"gs",
"=",
"Ghostscript",
".",
"getInstance",
"(",
")",
";",
"//prepare Ghostscript interpreter parameters\r",
"//refer to Ghostscript documentation for parameter usage\r",
"List",
"<",
"String",
">",
"gsArgs",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"gsArgs",
".",
"add",
"(",
"\"-gs\"",
")",
";",
"gsArgs",
".",
"add",
"(",
"\"-dNOPAUSE\"",
")",
";",
"gsArgs",
".",
"add",
"(",
"\"-dQUIET\"",
")",
";",
"gsArgs",
".",
"add",
"(",
"\"-dBATCH\"",
")",
";",
"gsArgs",
".",
"add",
"(",
"\"-dSAFER\"",
")",
";",
"gsArgs",
".",
"add",
"(",
"\"-sDEVICE=pnggray\"",
")",
";",
"gsArgs",
".",
"add",
"(",
"\"-r300\"",
")",
";",
"gsArgs",
".",
"add",
"(",
"\"-dGraphicsAlphaBits=4\"",
")",
";",
"gsArgs",
".",
"add",
"(",
"\"-dTextAlphaBits=4\"",
")",
";",
"gsArgs",
".",
"add",
"(",
"\"-sOutputFile=\"",
"+",
"imageDir",
".",
"getPath",
"(",
")",
"+",
"\"/workingimage%04d.png\"",
")",
";",
"gsArgs",
".",
"add",
"(",
"inputPdfFile",
".",
"getPath",
"(",
")",
")",
";",
"//execute and exit interpreter\r",
"try",
"{",
"synchronized",
"(",
"gs",
")",
"{",
"gs",
".",
"initialize",
"(",
"gsArgs",
".",
"toArray",
"(",
"new",
"String",
"[",
"0",
"]",
")",
")",
";",
"gs",
".",
"exit",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"UnsatisfiedLinkError",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"throw",
"new",
"RuntimeException",
"(",
"getMessage",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
")",
";",
"}",
"catch",
"(",
"NoClassDefFoundError",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"throw",
"new",
"RuntimeException",
"(",
"getMessage",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
")",
";",
"}",
"catch",
"(",
"GhostscriptException",
"e",
")",
"{",
"logger",
".",
"error",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"throw",
"new",
"RuntimeException",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"finally",
"{",
"if",
"(",
"imageDir",
".",
"list",
"(",
")",
".",
"length",
"==",
"0",
")",
"{",
"imageDir",
".",
"delete",
"(",
")",
";",
"}",
"//delete interpreter instance (safer)\r",
"try",
"{",
"Ghostscript",
".",
"deleteInstance",
"(",
")",
";",
"}",
"catch",
"(",
"GhostscriptException",
"e",
")",
"{",
"//nothing\r",
"}",
"}",
"// find working files\r",
"File",
"[",
"]",
"workingFiles",
"=",
"imageDir",
".",
"listFiles",
"(",
"new",
"FilenameFilter",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"accept",
"(",
"File",
"dir",
",",
"String",
"name",
")",
"{",
"return",
"name",
".",
"toLowerCase",
"(",
")",
".",
"matches",
"(",
"\"workingimage\\\\d{4}\\\\.png$\"",
")",
";",
"}",
"}",
")",
";",
"Arrays",
".",
"sort",
"(",
"workingFiles",
",",
"new",
"Comparator",
"<",
"File",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"compare",
"(",
"File",
"f1",
",",
"File",
"f2",
")",
"{",
"return",
"f1",
".",
"getName",
"(",
")",
".",
"compareTo",
"(",
"f2",
".",
"getName",
"(",
")",
")",
";",
"}",
"}",
")",
";",
"return",
"workingFiles",
";",
"}"
] | Converts PDF to PNG format.
@param inputPdfFile input file
@return an array of PNG images
@throws java.io.IOException | [
"Converts",
"PDF",
"to",
"PNG",
"format",
"."
] | train | https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/net/sourceforge/tess4j/util/PdfGsUtilities.java#L80-L147 |
jboss-integration/fuse-bxms-integ | switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/operation/KnowledgeOperations.java | KnowledgeOperations.setFaults | public static void setFaults(Message message, KnowledgeOperation operation, Map<String, Object> contextOverrides) {
setOutputsOrFaults(message, operation.getFaultExpressionMappings(), contextOverrides, FAULT, false);
} | java | public static void setFaults(Message message, KnowledgeOperation operation, Map<String, Object> contextOverrides) {
setOutputsOrFaults(message, operation.getFaultExpressionMappings(), contextOverrides, FAULT, false);
} | [
"public",
"static",
"void",
"setFaults",
"(",
"Message",
"message",
",",
"KnowledgeOperation",
"operation",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"contextOverrides",
")",
"{",
"setOutputsOrFaults",
"(",
"message",
",",
"operation",
".",
"getFaultExpressionMappings",
"(",
")",
",",
"contextOverrides",
",",
"FAULT",
",",
"false",
")",
";",
"}"
] | Sets the faults.
@param message the message
@param operation the operation
@param contextOverrides the context overrides | [
"Sets",
"the",
"faults",
"."
] | train | https://github.com/jboss-integration/fuse-bxms-integ/blob/ca5c012bf867ea15d1250f0991af3cd7e708aaaf/switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/operation/KnowledgeOperations.java#L286-L288 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/PdfSignatureAppearance.java | PdfSignatureAppearance.setCrypto | public void setCrypto(PrivateKey privKey, Certificate[] certChain, CRL[] crlList, PdfName filter) {
this.privKey = privKey;
this.certChain = certChain;
this.crlList = crlList;
this.filter = filter;
} | java | public void setCrypto(PrivateKey privKey, Certificate[] certChain, CRL[] crlList, PdfName filter) {
this.privKey = privKey;
this.certChain = certChain;
this.crlList = crlList;
this.filter = filter;
} | [
"public",
"void",
"setCrypto",
"(",
"PrivateKey",
"privKey",
",",
"Certificate",
"[",
"]",
"certChain",
",",
"CRL",
"[",
"]",
"crlList",
",",
"PdfName",
"filter",
")",
"{",
"this",
".",
"privKey",
"=",
"privKey",
";",
"this",
".",
"certChain",
"=",
"certChain",
";",
"this",
".",
"crlList",
"=",
"crlList",
";",
"this",
".",
"filter",
"=",
"filter",
";",
"}"
] | Sets the cryptographic parameters.
@param privKey the private key
@param certChain the certificate chain
@param crlList the certificate revocation list. It may be <CODE>null</CODE>
@param filter the crytographic filter type. It can be SELF_SIGNED, VERISIGN_SIGNED or WINCER_SIGNED | [
"Sets",
"the",
"cryptographic",
"parameters",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfSignatureAppearance.java#L254-L259 |
VoltDB/voltdb | src/frontend/org/voltdb/iv2/Site.java | Site.handleUndoLog | private static void handleUndoLog(List<UndoAction> undoLog, boolean undo) {
if (undoLog == null) {
return;
}
if (undo) {
undoLog = Lists.reverse(undoLog);
}
for (UndoAction action : undoLog) {
if (undo) {
action.undo();
} else {
action.release();
}
}
if (undo) {
undoLog.clear();
}
} | java | private static void handleUndoLog(List<UndoAction> undoLog, boolean undo) {
if (undoLog == null) {
return;
}
if (undo) {
undoLog = Lists.reverse(undoLog);
}
for (UndoAction action : undoLog) {
if (undo) {
action.undo();
} else {
action.release();
}
}
if (undo) {
undoLog.clear();
}
} | [
"private",
"static",
"void",
"handleUndoLog",
"(",
"List",
"<",
"UndoAction",
">",
"undoLog",
",",
"boolean",
"undo",
")",
"{",
"if",
"(",
"undoLog",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"undo",
")",
"{",
"undoLog",
"=",
"Lists",
".",
"reverse",
"(",
"undoLog",
")",
";",
"}",
"for",
"(",
"UndoAction",
"action",
":",
"undoLog",
")",
"{",
"if",
"(",
"undo",
")",
"{",
"action",
".",
"undo",
"(",
")",
";",
"}",
"else",
"{",
"action",
".",
"release",
"(",
")",
";",
"}",
"}",
"if",
"(",
"undo",
")",
"{",
"undoLog",
".",
"clear",
"(",
")",
";",
"}",
"}"
] | Java level related stuffs that are also needed to roll back
@param undoLog
@param undo | [
"Java",
"level",
"related",
"stuffs",
"that",
"are",
"also",
"needed",
"to",
"roll",
"back"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/iv2/Site.java#L1167-L1185 |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/ColorNames.java | ColorNames.getColorFromName | @Pure
public static int getColorFromName(String colorName, int defaultValue) {
final Integer value = COLOR_MATCHES.get(Strings.nullToEmpty(colorName).toLowerCase());
if (value != null) {
return value.intValue();
}
return defaultValue;
} | java | @Pure
public static int getColorFromName(String colorName, int defaultValue) {
final Integer value = COLOR_MATCHES.get(Strings.nullToEmpty(colorName).toLowerCase());
if (value != null) {
return value.intValue();
}
return defaultValue;
} | [
"@",
"Pure",
"public",
"static",
"int",
"getColorFromName",
"(",
"String",
"colorName",
",",
"int",
"defaultValue",
")",
"{",
"final",
"Integer",
"value",
"=",
"COLOR_MATCHES",
".",
"get",
"(",
"Strings",
".",
"nullToEmpty",
"(",
"colorName",
")",
".",
"toLowerCase",
"(",
")",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"return",
"value",
".",
"intValue",
"(",
")",
";",
"}",
"return",
"defaultValue",
";",
"}"
] | Replies the color value for the given color name.
<p>See the documentation of the {@link #ColorNames} type for obtaining a list of the colors.
@param colorName the color name.
@param defaultValue if the given name does not corresponds to a known color, this value is replied.
@return the color value. | [
"Replies",
"the",
"color",
"value",
"for",
"the",
"given",
"color",
"name",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/ColorNames.java#L541-L548 |
Coveros/selenified | src/main/java/com/coveros/selenified/application/App.java | App.newElement | public Element newElement(Locator type, String locator) {
return new Element(driver, reporter, type, locator);
} | java | public Element newElement(Locator type, String locator) {
return new Element(driver, reporter, type, locator);
} | [
"public",
"Element",
"newElement",
"(",
"Locator",
"type",
",",
"String",
"locator",
")",
"{",
"return",
"new",
"Element",
"(",
"driver",
",",
"reporter",
",",
"type",
",",
"locator",
")",
";",
"}"
] | setups a new element which is located on the page
@param type - the locator type e.g. Locator.id, Locator.xpath
@param locator - the locator string e.g. login, //input[@id='login']
@return Element: a page element to interact with | [
"setups",
"a",
"new",
"element",
"which",
"is",
"located",
"on",
"the",
"page"
] | train | https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/application/App.java#L135-L137 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java | ComputeNodeOperations.deleteComputeNodeUser | public void deleteComputeNodeUser(String poolId, String nodeId, String userName) throws BatchErrorException, IOException {
deleteComputeNodeUser(poolId, nodeId, userName, null);
} | java | public void deleteComputeNodeUser(String poolId, String nodeId, String userName) throws BatchErrorException, IOException {
deleteComputeNodeUser(poolId, nodeId, userName, null);
} | [
"public",
"void",
"deleteComputeNodeUser",
"(",
"String",
"poolId",
",",
"String",
"nodeId",
",",
"String",
"userName",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"deleteComputeNodeUser",
"(",
"poolId",
",",
"nodeId",
",",
"userName",
",",
"null",
")",
";",
"}"
] | Deletes the specified user account from the specified compute node.
@param poolId The ID of the pool that contains the compute node.
@param nodeId The ID of the compute node where the user account will be deleted.
@param userName The name of the user account to be deleted.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Deletes",
"the",
"specified",
"user",
"account",
"from",
"the",
"specified",
"compute",
"node",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java#L113-L115 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/VoiceApi.java | VoiceApi.resumeRecording | public ApiSuccessResponse resumeRecording(String id, ResumeRecordingBody resumeRecordingBody) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = resumeRecordingWithHttpInfo(id, resumeRecordingBody);
return resp.getData();
} | java | public ApiSuccessResponse resumeRecording(String id, ResumeRecordingBody resumeRecordingBody) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = resumeRecordingWithHttpInfo(id, resumeRecordingBody);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"resumeRecording",
"(",
"String",
"id",
",",
"ResumeRecordingBody",
"resumeRecordingBody",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"resumeRecordingWithHttpInfo",
"(",
"id",
",",
"resumeRecordingBody",
")",
";",
"return",
"resp",
".",
"getData",
"(",
")",
";",
"}"
] | Resume recording a call
Resume recording the specified call.
@param id The connection ID of the call. (required)
@param resumeRecordingBody Request parameters. (optional)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Resume",
"recording",
"a",
"call",
"Resume",
"recording",
"the",
"specified",
"call",
"."
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/VoiceApi.java#L3102-L3105 |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/dam/impl/DefaultRenditionHandler.java | DefaultRenditionHandler.addRendition | private void addRendition(Set<RenditionMetadata> candidates, Rendition rendition, MediaArgs mediaArgs) {
// ignore AEM-generated thumbnail renditions unless allowed via mediaargs
if (!mediaArgs.isIncludeAssetThumbnails() && AssetRendition.isThumbnailRendition(rendition)) {
return;
}
// ignore AEM-generated web renditions unless allowed via mediaargs
boolean isIncludeAssetWebRenditions = mediaArgs.isIncludeAssetWebRenditions() != null
? mediaArgs.isIncludeAssetWebRenditions()
: true;
if (!isIncludeAssetWebRenditions && AssetRendition.isWebRendition(rendition)) {
return;
}
RenditionMetadata renditionMetadata = createRenditionMetadata(rendition);
candidates.add(renditionMetadata);
} | java | private void addRendition(Set<RenditionMetadata> candidates, Rendition rendition, MediaArgs mediaArgs) {
// ignore AEM-generated thumbnail renditions unless allowed via mediaargs
if (!mediaArgs.isIncludeAssetThumbnails() && AssetRendition.isThumbnailRendition(rendition)) {
return;
}
// ignore AEM-generated web renditions unless allowed via mediaargs
boolean isIncludeAssetWebRenditions = mediaArgs.isIncludeAssetWebRenditions() != null
? mediaArgs.isIncludeAssetWebRenditions()
: true;
if (!isIncludeAssetWebRenditions && AssetRendition.isWebRendition(rendition)) {
return;
}
RenditionMetadata renditionMetadata = createRenditionMetadata(rendition);
candidates.add(renditionMetadata);
} | [
"private",
"void",
"addRendition",
"(",
"Set",
"<",
"RenditionMetadata",
">",
"candidates",
",",
"Rendition",
"rendition",
",",
"MediaArgs",
"mediaArgs",
")",
"{",
"// ignore AEM-generated thumbnail renditions unless allowed via mediaargs",
"if",
"(",
"!",
"mediaArgs",
".",
"isIncludeAssetThumbnails",
"(",
")",
"&&",
"AssetRendition",
".",
"isThumbnailRendition",
"(",
"rendition",
")",
")",
"{",
"return",
";",
"}",
"// ignore AEM-generated web renditions unless allowed via mediaargs",
"boolean",
"isIncludeAssetWebRenditions",
"=",
"mediaArgs",
".",
"isIncludeAssetWebRenditions",
"(",
")",
"!=",
"null",
"?",
"mediaArgs",
".",
"isIncludeAssetWebRenditions",
"(",
")",
":",
"true",
";",
"if",
"(",
"!",
"isIncludeAssetWebRenditions",
"&&",
"AssetRendition",
".",
"isWebRendition",
"(",
"rendition",
")",
")",
"{",
"return",
";",
"}",
"RenditionMetadata",
"renditionMetadata",
"=",
"createRenditionMetadata",
"(",
"rendition",
")",
";",
"candidates",
".",
"add",
"(",
"renditionMetadata",
")",
";",
"}"
] | adds rendition to the list of candidates, if it should be available for resolving
@param candidates
@param rendition | [
"adds",
"rendition",
"to",
"the",
"list",
"of",
"candidates",
"if",
"it",
"should",
"be",
"available",
"for",
"resolving"
] | train | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/dam/impl/DefaultRenditionHandler.java#L94-L108 |
wwadge/bonecp | bonecp/src/main/java/com/jolbox/bonecp/StatementCache.java | StatementCache.calculateCacheKey | public String calculateCacheKey(String sql, int[] columnIndexes) {
StringBuilder tmp = new StringBuilder(sql.length()+4);
tmp.append(sql);
for (int i=0; i < columnIndexes.length; i++){
tmp.append(columnIndexes[i]);
tmp.append("CI,");
}
return tmp.toString();
} | java | public String calculateCacheKey(String sql, int[] columnIndexes) {
StringBuilder tmp = new StringBuilder(sql.length()+4);
tmp.append(sql);
for (int i=0; i < columnIndexes.length; i++){
tmp.append(columnIndexes[i]);
tmp.append("CI,");
}
return tmp.toString();
} | [
"public",
"String",
"calculateCacheKey",
"(",
"String",
"sql",
",",
"int",
"[",
"]",
"columnIndexes",
")",
"{",
"StringBuilder",
"tmp",
"=",
"new",
"StringBuilder",
"(",
"sql",
".",
"length",
"(",
")",
"+",
"4",
")",
";",
"tmp",
".",
"append",
"(",
"sql",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"columnIndexes",
".",
"length",
";",
"i",
"++",
")",
"{",
"tmp",
".",
"append",
"(",
"columnIndexes",
"[",
"i",
"]",
")",
";",
"tmp",
".",
"append",
"(",
"\"CI,\"",
")",
";",
"}",
"return",
"tmp",
".",
"toString",
"(",
")",
";",
"}"
] | Calculate a cache key.
@param sql to use
@param columnIndexes to use
@return cache key to use. | [
"Calculate",
"a",
"cache",
"key",
"."
] | train | https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/StatementCache.java#L127-L135 |
UrielCh/ovh-java-sdk | ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java | ApiOvhPrice.dedicated_server_antiDDoSPro_commercialRange_GET | public OvhPrice dedicated_server_antiDDoSPro_commercialRange_GET(net.minidev.ovh.api.price.dedicated.server.OvhAntiDDoSProEnum commercialRange) throws IOException {
String qPath = "/price/dedicated/server/antiDDoSPro/{commercialRange}";
StringBuilder sb = path(qPath, commercialRange);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPrice.class);
} | java | public OvhPrice dedicated_server_antiDDoSPro_commercialRange_GET(net.minidev.ovh.api.price.dedicated.server.OvhAntiDDoSProEnum commercialRange) throws IOException {
String qPath = "/price/dedicated/server/antiDDoSPro/{commercialRange}";
StringBuilder sb = path(qPath, commercialRange);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhPrice.class);
} | [
"public",
"OvhPrice",
"dedicated_server_antiDDoSPro_commercialRange_GET",
"(",
"net",
".",
"minidev",
".",
"ovh",
".",
"api",
".",
"price",
".",
"dedicated",
".",
"server",
".",
"OvhAntiDDoSProEnum",
"commercialRange",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/price/dedicated/server/antiDDoSPro/{commercialRange}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"commercialRange",
")",
";",
"String",
"resp",
"=",
"exec",
"(",
"qPath",
",",
"\"GET\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"return",
"convertTo",
"(",
"resp",
",",
"OvhPrice",
".",
"class",
")",
";",
"}"
] | Get price of anti-DDos Pro option
REST: GET /price/dedicated/server/antiDDoSPro/{commercialRange}
@param commercialRange [required] commercial range of your dedicated server | [
"Get",
"price",
"of",
"anti",
"-",
"DDos",
"Pro",
"option"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-price/src/main/java/net/minidev/ovh/api/ApiOvhPrice.java#L102-L107 |
duracloud/duracloud | durastore/src/main/java/org/duracloud/durastore/rest/StoreRest.java | StoreRest.getStores | @GET
public Response getStores() {
String msg = "getting stores.";
try {
return doGetStores(msg);
} catch (StorageException se) {
return responseBad(msg, se);
} catch (Exception e) {
return responseBad(msg, e);
}
} | java | @GET
public Response getStores() {
String msg = "getting stores.";
try {
return doGetStores(msg);
} catch (StorageException se) {
return responseBad(msg, se);
} catch (Exception e) {
return responseBad(msg, e);
}
} | [
"@",
"GET",
"public",
"Response",
"getStores",
"(",
")",
"{",
"String",
"msg",
"=",
"\"getting stores.\"",
";",
"try",
"{",
"return",
"doGetStores",
"(",
"msg",
")",
";",
"}",
"catch",
"(",
"StorageException",
"se",
")",
"{",
"return",
"responseBad",
"(",
"msg",
",",
"se",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"responseBad",
"(",
"msg",
",",
"e",
")",
";",
"}",
"}"
] | Provides a listing of all available storage provider accounts
@return 200 response with XML file listing stores | [
"Provides",
"a",
"listing",
"of",
"all",
"available",
"storage",
"provider",
"accounts"
] | train | https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/durastore/src/main/java/org/duracloud/durastore/rest/StoreRest.java#L49-L61 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/fastpath/Fastpath.java | Fastpath.getOID | public long getOID(String name, FastpathArg[] args) throws SQLException {
long oid = getInteger(name, args);
if (oid < 0) {
oid += NUM_OIDS;
}
return oid;
} | java | public long getOID(String name, FastpathArg[] args) throws SQLException {
long oid = getInteger(name, args);
if (oid < 0) {
oid += NUM_OIDS;
}
return oid;
} | [
"public",
"long",
"getOID",
"(",
"String",
"name",
",",
"FastpathArg",
"[",
"]",
"args",
")",
"throws",
"SQLException",
"{",
"long",
"oid",
"=",
"getInteger",
"(",
"name",
",",
"args",
")",
";",
"if",
"(",
"oid",
"<",
"0",
")",
"{",
"oid",
"+=",
"NUM_OIDS",
";",
"}",
"return",
"oid",
";",
"}"
] | This convenience method assumes that the return value is an oid.
@param name Function name
@param args Function arguments
@return oid of the given call
@throws SQLException if a database-access error occurs or no result | [
"This",
"convenience",
"method",
"assumes",
"that",
"the",
"return",
"value",
"is",
"an",
"oid",
"."
] | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/fastpath/Fastpath.java#L208-L214 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java | Infer.reportBoundError | void reportBoundError(UndetVar uv, InferenceBound ib1, InferenceBound ib2) {
reportInferenceError(
String.format("incompatible.%s.%s.bounds",
StringUtils.toLowerCase(ib1.name()),
StringUtils.toLowerCase(ib2.name())),
uv.qtype,
uv.getBounds(ib1),
uv.getBounds(ib2));
} | java | void reportBoundError(UndetVar uv, InferenceBound ib1, InferenceBound ib2) {
reportInferenceError(
String.format("incompatible.%s.%s.bounds",
StringUtils.toLowerCase(ib1.name()),
StringUtils.toLowerCase(ib2.name())),
uv.qtype,
uv.getBounds(ib1),
uv.getBounds(ib2));
} | [
"void",
"reportBoundError",
"(",
"UndetVar",
"uv",
",",
"InferenceBound",
"ib1",
",",
"InferenceBound",
"ib2",
")",
"{",
"reportInferenceError",
"(",
"String",
".",
"format",
"(",
"\"incompatible.%s.%s.bounds\"",
",",
"StringUtils",
".",
"toLowerCase",
"(",
"ib1",
".",
"name",
"(",
")",
")",
",",
"StringUtils",
".",
"toLowerCase",
"(",
"ib2",
".",
"name",
"(",
")",
")",
")",
",",
"uv",
".",
"qtype",
",",
"uv",
".",
"getBounds",
"(",
"ib1",
")",
",",
"uv",
".",
"getBounds",
"(",
"ib2",
")",
")",
";",
"}"
] | Incorporation error: mismatch between two (or more) bounds of different kinds. | [
"Incorporation",
"error",
":",
"mismatch",
"between",
"two",
"(",
"or",
"more",
")",
"bounds",
"of",
"different",
"kinds",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java#L1290-L1298 |
Azure/azure-sdk-for-java | servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/TokenProvider.java | TokenProvider.createAzureActiveDirectoryTokenProvider | public static TokenProvider createAzureActiveDirectoryTokenProvider(String authorityUrl, String clientId, String clientSecret) throws MalformedURLException
{
AuthenticationContext authContext = createAuthenticationContext(authorityUrl);
return new AzureActiveDirectoryTokenProvider(authContext, new ClientCredential(clientId, clientSecret));
} | java | public static TokenProvider createAzureActiveDirectoryTokenProvider(String authorityUrl, String clientId, String clientSecret) throws MalformedURLException
{
AuthenticationContext authContext = createAuthenticationContext(authorityUrl);
return new AzureActiveDirectoryTokenProvider(authContext, new ClientCredential(clientId, clientSecret));
} | [
"public",
"static",
"TokenProvider",
"createAzureActiveDirectoryTokenProvider",
"(",
"String",
"authorityUrl",
",",
"String",
"clientId",
",",
"String",
"clientSecret",
")",
"throws",
"MalformedURLException",
"{",
"AuthenticationContext",
"authContext",
"=",
"createAuthenticationContext",
"(",
"authorityUrl",
")",
";",
"return",
"new",
"AzureActiveDirectoryTokenProvider",
"(",
"authContext",
",",
"new",
"ClientCredential",
"(",
"clientId",
",",
"clientSecret",
")",
")",
";",
"}"
] | Creates an Azure Active Directory token provider that acquires a token from the given active directory instance using the given clientId and client secret.
This is a utility method.
@param authorityUrl URL of the Azure Active Directory instance
@param clientId client id of the application
@param clientSecret client secret of the application
@return an instance of Azure Active Directory token provider
@throws MalformedURLException if the authority URL is not well formed | [
"Creates",
"an",
"Azure",
"Active",
"Directory",
"token",
"provider",
"that",
"acquires",
"a",
"token",
"from",
"the",
"given",
"active",
"directory",
"instance",
"using",
"the",
"given",
"clientId",
"and",
"client",
"secret",
".",
"This",
"is",
"a",
"utility",
"method",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/security/TokenProvider.java#L75-L79 |
guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/hashing/DataHasher.java | DataHasher.addData | public final DataHasher addData(InputStream inStream, int bufferSize) {
Util.notNull(inStream, "Input stream");
try {
byte[] buffer = new byte[bufferSize];
while (true) {
int bytesRead = inStream.read(buffer);
if (bytesRead == -1) {
return this;
}
addData(buffer, 0, bytesRead);
}
} catch (IOException e) {
throw new HashException("Exception occurred when reading input stream while calculating hash", e);
}
} | java | public final DataHasher addData(InputStream inStream, int bufferSize) {
Util.notNull(inStream, "Input stream");
try {
byte[] buffer = new byte[bufferSize];
while (true) {
int bytesRead = inStream.read(buffer);
if (bytesRead == -1) {
return this;
}
addData(buffer, 0, bytesRead);
}
} catch (IOException e) {
throw new HashException("Exception occurred when reading input stream while calculating hash", e);
}
} | [
"public",
"final",
"DataHasher",
"addData",
"(",
"InputStream",
"inStream",
",",
"int",
"bufferSize",
")",
"{",
"Util",
".",
"notNull",
"(",
"inStream",
",",
"\"Input stream\"",
")",
";",
"try",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"bufferSize",
"]",
";",
"while",
"(",
"true",
")",
"{",
"int",
"bytesRead",
"=",
"inStream",
".",
"read",
"(",
"buffer",
")",
";",
"if",
"(",
"bytesRead",
"==",
"-",
"1",
")",
"{",
"return",
"this",
";",
"}",
"addData",
"(",
"buffer",
",",
"0",
",",
"bytesRead",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"HashException",
"(",
"\"Exception occurred when reading input stream while calculating hash\"",
",",
"e",
")",
";",
"}",
"}"
] | Adds data to the digest using the specified input stream of bytes, starting at an offset of 0.
@param inStream input stream of bytes.
@param bufferSize maximum allowed buffer size for reading data.
@return The same {@link DataHasher} object for chaining calls.
@throws HashException when hash calculation fails.
@throws NullPointerException when input stream is null. | [
"Adds",
"data",
"to",
"the",
"digest",
"using",
"the",
"specified",
"input",
"stream",
"of",
"bytes",
"starting",
"at",
"an",
"offset",
"of",
"0",
"."
] | train | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/hashing/DataHasher.java#L218-L233 |
jmapper-framework/jmapper-core | JMapper Framework/src/main/java/com/googlecode/jmapper/util/ClassesManager.java | ClassesManager.fieldName | public static String fieldName(Class<?> aClass,String regex){
if(isNestedMapping(regex))
return regex;
String result = null;
for(Class<?> clazz: getAllsuperClasses(aClass))
if(!isNull(result = getFieldName(clazz, regex)))
return result;
return result;
} | java | public static String fieldName(Class<?> aClass,String regex){
if(isNestedMapping(regex))
return regex;
String result = null;
for(Class<?> clazz: getAllsuperClasses(aClass))
if(!isNull(result = getFieldName(clazz, regex)))
return result;
return result;
} | [
"public",
"static",
"String",
"fieldName",
"(",
"Class",
"<",
"?",
">",
"aClass",
",",
"String",
"regex",
")",
"{",
"if",
"(",
"isNestedMapping",
"(",
"regex",
")",
")",
"return",
"regex",
";",
"String",
"result",
"=",
"null",
";",
"for",
"(",
"Class",
"<",
"?",
">",
"clazz",
":",
"getAllsuperClasses",
"(",
"aClass",
")",
")",
"if",
"(",
"!",
"isNull",
"(",
"result",
"=",
"getFieldName",
"(",
"clazz",
",",
"regex",
")",
")",
")",
"return",
"result",
";",
"return",
"result",
";",
"}"
] | This method returns the name of the field whose name matches with regex.
@param aClass a class to control
@param regex field name
@return true if exists a field with this name in aClass, false otherwise | [
"This",
"method",
"returns",
"the",
"name",
"of",
"the",
"field",
"whose",
"name",
"matches",
"with",
"regex",
"."
] | train | https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/util/ClassesManager.java#L393-L405 |
bbossgroups/bboss-elasticsearch | bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/RestClientUtil.java | RestClientUtil.mgetDocuments | public <T> List<T> mgetDocuments(String index, Class<T> type, Object... ids) throws ElasticSearchException{
return mgetDocuments( index, _doc,type, ids);
} | java | public <T> List<T> mgetDocuments(String index, Class<T> type, Object... ids) throws ElasticSearchException{
return mgetDocuments( index, _doc,type, ids);
} | [
"public",
"<",
"T",
">",
"List",
"<",
"T",
">",
"mgetDocuments",
"(",
"String",
"index",
",",
"Class",
"<",
"T",
">",
"type",
",",
"Object",
"...",
"ids",
")",
"throws",
"ElasticSearchException",
"{",
"return",
"mgetDocuments",
"(",
"index",
",",
"_doc",
",",
"type",
",",
"ids",
")",
";",
"}"
] | For Elasticsearch 7 and 7+
https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html
@param index _mget
test/_mget
test/type/_mget
test/type/_mget?stored_fields=field1,field2
_mget?routing=key1
@param type
@param ids
@param <T>
@return
@throws ElasticSearchException | [
"For",
"Elasticsearch",
"7",
"and",
"7",
"+",
"https",
":",
"//",
"www",
".",
"elastic",
".",
"co",
"/",
"guide",
"/",
"en",
"/",
"elasticsearch",
"/",
"reference",
"/",
"current",
"/",
"docs",
"-",
"multi",
"-",
"get",
".",
"html"
] | train | https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/RestClientUtil.java#L5085-L5087 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileSystem.java | FileSystem.globPathsLevel | private Path[] globPathsLevel(Path[] parents, String[] filePattern,
int level, boolean[] hasGlob) throws IOException {
if (level == filePattern.length - 1)
return parents;
if (parents == null || parents.length == 0) {
return null;
}
GlobFilter fp = new GlobFilter(filePattern[level]);
if (fp.hasPattern()) {
parents = FileUtil.stat2Paths(listStatus(parents, fp));
hasGlob[0] = true;
} else {
for (int i = 0; i < parents.length; i++) {
parents[i] = new Path(parents[i], filePattern[level]);
}
}
return globPathsLevel(parents, filePattern, level + 1, hasGlob);
} | java | private Path[] globPathsLevel(Path[] parents, String[] filePattern,
int level, boolean[] hasGlob) throws IOException {
if (level == filePattern.length - 1)
return parents;
if (parents == null || parents.length == 0) {
return null;
}
GlobFilter fp = new GlobFilter(filePattern[level]);
if (fp.hasPattern()) {
parents = FileUtil.stat2Paths(listStatus(parents, fp));
hasGlob[0] = true;
} else {
for (int i = 0; i < parents.length; i++) {
parents[i] = new Path(parents[i], filePattern[level]);
}
}
return globPathsLevel(parents, filePattern, level + 1, hasGlob);
} | [
"private",
"Path",
"[",
"]",
"globPathsLevel",
"(",
"Path",
"[",
"]",
"parents",
",",
"String",
"[",
"]",
"filePattern",
",",
"int",
"level",
",",
"boolean",
"[",
"]",
"hasGlob",
")",
"throws",
"IOException",
"{",
"if",
"(",
"level",
"==",
"filePattern",
".",
"length",
"-",
"1",
")",
"return",
"parents",
";",
"if",
"(",
"parents",
"==",
"null",
"||",
"parents",
".",
"length",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"GlobFilter",
"fp",
"=",
"new",
"GlobFilter",
"(",
"filePattern",
"[",
"level",
"]",
")",
";",
"if",
"(",
"fp",
".",
"hasPattern",
"(",
")",
")",
"{",
"parents",
"=",
"FileUtil",
".",
"stat2Paths",
"(",
"listStatus",
"(",
"parents",
",",
"fp",
")",
")",
";",
"hasGlob",
"[",
"0",
"]",
"=",
"true",
";",
"}",
"else",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"parents",
".",
"length",
";",
"i",
"++",
")",
"{",
"parents",
"[",
"i",
"]",
"=",
"new",
"Path",
"(",
"parents",
"[",
"i",
"]",
",",
"filePattern",
"[",
"level",
"]",
")",
";",
"}",
"}",
"return",
"globPathsLevel",
"(",
"parents",
",",
"filePattern",
",",
"level",
"+",
"1",
",",
"hasGlob",
")",
";",
"}"
] | /*
For a path of N components, return a list of paths that match the
components [<code>level</code>, <code>N-1</code>]. | [
"/",
"*",
"For",
"a",
"path",
"of",
"N",
"components",
"return",
"a",
"list",
"of",
"paths",
"that",
"match",
"the",
"components",
"[",
"<code",
">",
"level<",
"/",
"code",
">",
"<code",
">",
"N",
"-",
"1<",
"/",
"code",
">",
"]",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileSystem.java#L1422-L1439 |
micronaut-projects/micronaut-core | inject/src/main/java/io/micronaut/inject/configuration/ConfigurationMetadataBuilder.java | ConfigurationMetadataBuilder.writeAttribute | static void writeAttribute(Writer out, String name, String value) throws IOException {
out.write('"');
out.write(name);
out.write("\":");
out.write(quote(value));
} | java | static void writeAttribute(Writer out, String name, String value) throws IOException {
out.write('"');
out.write(name);
out.write("\":");
out.write(quote(value));
} | [
"static",
"void",
"writeAttribute",
"(",
"Writer",
"out",
",",
"String",
"name",
",",
"String",
"value",
")",
"throws",
"IOException",
"{",
"out",
".",
"write",
"(",
"'",
"'",
")",
";",
"out",
".",
"write",
"(",
"name",
")",
";",
"out",
".",
"write",
"(",
"\"\\\":\"",
")",
";",
"out",
".",
"write",
"(",
"quote",
"(",
"value",
")",
")",
";",
"}"
] | Write a quoted attribute with a value to a writer.
@param out The out writer
@param name The name of the attribute
@param value The value
@throws IOException If an error occurred writing output | [
"Write",
"a",
"quoted",
"attribute",
"with",
"a",
"value",
"to",
"a",
"writer",
"."
] | train | https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/inject/configuration/ConfigurationMetadataBuilder.java#L261-L266 |
Talend/tesb-rt-se | sam/sam-agent/src/main/java/org/talend/esb/sam/agent/flowidprocessor/FlowIdSoapCodec.java | FlowIdSoapCodec.writeFlowId | public static void writeFlowId(Message message, String flowId) {
if (!(message instanceof SoapMessage)) {
return;
}
SoapMessage soapMessage = (SoapMessage)message;
Header hdFlowId = soapMessage.getHeader(FLOW_ID_QNAME);
if (hdFlowId != null) {
LOG.warning("FlowId already existing in soap header, need not to write FlowId header.");
return;
}
try {
soapMessage.getHeaders().add(
new Header(FLOW_ID_QNAME, flowId, new JAXBDataBinding(String.class)));
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Stored flowId '" + flowId + "' in soap header: " + FLOW_ID_QNAME);
}
} catch (JAXBException e) {
LOG.log(Level.SEVERE, "Couldn't create flowId header.", e);
}
} | java | public static void writeFlowId(Message message, String flowId) {
if (!(message instanceof SoapMessage)) {
return;
}
SoapMessage soapMessage = (SoapMessage)message;
Header hdFlowId = soapMessage.getHeader(FLOW_ID_QNAME);
if (hdFlowId != null) {
LOG.warning("FlowId already existing in soap header, need not to write FlowId header.");
return;
}
try {
soapMessage.getHeaders().add(
new Header(FLOW_ID_QNAME, flowId, new JAXBDataBinding(String.class)));
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Stored flowId '" + flowId + "' in soap header: " + FLOW_ID_QNAME);
}
} catch (JAXBException e) {
LOG.log(Level.SEVERE, "Couldn't create flowId header.", e);
}
} | [
"public",
"static",
"void",
"writeFlowId",
"(",
"Message",
"message",
",",
"String",
"flowId",
")",
"{",
"if",
"(",
"!",
"(",
"message",
"instanceof",
"SoapMessage",
")",
")",
"{",
"return",
";",
"}",
"SoapMessage",
"soapMessage",
"=",
"(",
"SoapMessage",
")",
"message",
";",
"Header",
"hdFlowId",
"=",
"soapMessage",
".",
"getHeader",
"(",
"FLOW_ID_QNAME",
")",
";",
"if",
"(",
"hdFlowId",
"!=",
"null",
")",
"{",
"LOG",
".",
"warning",
"(",
"\"FlowId already existing in soap header, need not to write FlowId header.\"",
")",
";",
"return",
";",
"}",
"try",
"{",
"soapMessage",
".",
"getHeaders",
"(",
")",
".",
"add",
"(",
"new",
"Header",
"(",
"FLOW_ID_QNAME",
",",
"flowId",
",",
"new",
"JAXBDataBinding",
"(",
"String",
".",
"class",
")",
")",
")",
";",
"if",
"(",
"LOG",
".",
"isLoggable",
"(",
"Level",
".",
"FINE",
")",
")",
"{",
"LOG",
".",
"fine",
"(",
"\"Stored flowId '\"",
"+",
"flowId",
"+",
"\"' in soap header: \"",
"+",
"FLOW_ID_QNAME",
")",
";",
"}",
"}",
"catch",
"(",
"JAXBException",
"e",
")",
"{",
"LOG",
".",
"log",
"(",
"Level",
".",
"SEVERE",
",",
"\"Couldn't create flowId header.\"",
",",
"e",
")",
";",
"}",
"}"
] | Write flow id to message.
@param message the message
@param flowId the flow id | [
"Write",
"flow",
"id",
"to",
"message",
"."
] | train | https://github.com/Talend/tesb-rt-se/blob/0a151a6d91ffff65ac4b5ee0c5b2c882ac28d886/sam/sam-agent/src/main/java/org/talend/esb/sam/agent/flowidprocessor/FlowIdSoapCodec.java#L81-L102 |
tzaeschke/zoodb | src/org/zoodb/jdo/spi/PersistenceCapableImpl.java | PersistenceCapableImpl.jdoCopyKeyFieldsFromObjectId | @Override
public void jdoCopyKeyFieldsFromObjectId (ObjectIdFieldConsumer fc, Object oid) {
fc.storeIntField (2, ((IntIdentity)oid).getKey());
} | java | @Override
public void jdoCopyKeyFieldsFromObjectId (ObjectIdFieldConsumer fc, Object oid) {
fc.storeIntField (2, ((IntIdentity)oid).getKey());
} | [
"@",
"Override",
"public",
"void",
"jdoCopyKeyFieldsFromObjectId",
"(",
"ObjectIdFieldConsumer",
"fc",
",",
"Object",
"oid",
")",
"{",
"fc",
".",
"storeIntField",
"(",
"2",
",",
"(",
"(",
"IntIdentity",
")",
"oid",
")",
".",
"getKey",
"(",
")",
")",
";",
"}"
] | The generated methods copy key fields from the object id instance to the PersistenceCapable
instance or to the ObjectIdFieldConsumer. | [
"The",
"generated",
"methods",
"copy",
"key",
"fields",
"from",
"the",
"object",
"id",
"instance",
"to",
"the",
"PersistenceCapable",
"instance",
"or",
"to",
"the",
"ObjectIdFieldConsumer",
"."
] | train | https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/jdo/spi/PersistenceCapableImpl.java#L514-L517 |
landawn/AbacusUtil | src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java | PoolablePreparedStatement.setBlob | @Override
public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException {
internalStmt.setBlob(parameterIndex, inputStream, length);
} | java | @Override
public void setBlob(int parameterIndex, InputStream inputStream, long length) throws SQLException {
internalStmt.setBlob(parameterIndex, inputStream, length);
} | [
"@",
"Override",
"public",
"void",
"setBlob",
"(",
"int",
"parameterIndex",
",",
"InputStream",
"inputStream",
",",
"long",
"length",
")",
"throws",
"SQLException",
"{",
"internalStmt",
".",
"setBlob",
"(",
"parameterIndex",
",",
"inputStream",
",",
"length",
")",
";",
"}"
] | Method setBlob.
@param parameterIndex
@param inputStream
@param length
@throws SQLException
@see java.sql.PreparedStatement#setBlob(int, InputStream, long) | [
"Method",
"setBlob",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java#L578-L581 |
pwheel/spring-security-oauth2-client | src/main/java/com/racquettrack/security/oauth/OAuth2AuthenticationFilter.java | OAuth2AuthenticationFilter.attemptAuthentication | @Override
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, IOException, ServletException {
String code = null;
if (LOG.isDebugEnabled()) {
String url = request.getRequestURI();
String queryString = request.getQueryString();
LOG.debug("attemptAuthentication on url {}?{}", url, queryString);
}
// request parameters
final Map<String, String[]> parameters = request.getParameterMap();
LOG.debug("Got Parameters: {}", parameters);
// Check to see if there was an error response from the OAuth Provider
checkForErrors(parameters);
// Check state parameter to avoid cross-site-scripting attacks
checkStateParameter(request.getSession(), parameters);
final String codeValues[] = parameters.get(oAuth2ServiceProperties.getCodeParamName());
if (codeValues != null && codeValues.length > 0) {
code = codeValues[0];
LOG.debug("Got code {}", code);
}
OAuth2AuthenticationToken authRequest = new OAuth2AuthenticationToken(code);
// Allow subclasses to set the "details" property
setDetails(request, authRequest);
return this.getAuthenticationManager().authenticate(authRequest);
} | java | @Override
public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, IOException, ServletException {
String code = null;
if (LOG.isDebugEnabled()) {
String url = request.getRequestURI();
String queryString = request.getQueryString();
LOG.debug("attemptAuthentication on url {}?{}", url, queryString);
}
// request parameters
final Map<String, String[]> parameters = request.getParameterMap();
LOG.debug("Got Parameters: {}", parameters);
// Check to see if there was an error response from the OAuth Provider
checkForErrors(parameters);
// Check state parameter to avoid cross-site-scripting attacks
checkStateParameter(request.getSession(), parameters);
final String codeValues[] = parameters.get(oAuth2ServiceProperties.getCodeParamName());
if (codeValues != null && codeValues.length > 0) {
code = codeValues[0];
LOG.debug("Got code {}", code);
}
OAuth2AuthenticationToken authRequest = new OAuth2AuthenticationToken(code);
// Allow subclasses to set the "details" property
setDetails(request, authRequest);
return this.getAuthenticationManager().authenticate(authRequest);
} | [
"@",
"Override",
"public",
"Authentication",
"attemptAuthentication",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"throws",
"AuthenticationException",
",",
"IOException",
",",
"ServletException",
"{",
"String",
"code",
"=",
"null",
";",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"String",
"url",
"=",
"request",
".",
"getRequestURI",
"(",
")",
";",
"String",
"queryString",
"=",
"request",
".",
"getQueryString",
"(",
")",
";",
"LOG",
".",
"debug",
"(",
"\"attemptAuthentication on url {}?{}\"",
",",
"url",
",",
"queryString",
")",
";",
"}",
"// request parameters",
"final",
"Map",
"<",
"String",
",",
"String",
"[",
"]",
">",
"parameters",
"=",
"request",
".",
"getParameterMap",
"(",
")",
";",
"LOG",
".",
"debug",
"(",
"\"Got Parameters: {}\"",
",",
"parameters",
")",
";",
"// Check to see if there was an error response from the OAuth Provider",
"checkForErrors",
"(",
"parameters",
")",
";",
"// Check state parameter to avoid cross-site-scripting attacks",
"checkStateParameter",
"(",
"request",
".",
"getSession",
"(",
")",
",",
"parameters",
")",
";",
"final",
"String",
"codeValues",
"[",
"]",
"=",
"parameters",
".",
"get",
"(",
"oAuth2ServiceProperties",
".",
"getCodeParamName",
"(",
")",
")",
";",
"if",
"(",
"codeValues",
"!=",
"null",
"&&",
"codeValues",
".",
"length",
">",
"0",
")",
"{",
"code",
"=",
"codeValues",
"[",
"0",
"]",
";",
"LOG",
".",
"debug",
"(",
"\"Got code {}\"",
",",
"code",
")",
";",
"}",
"OAuth2AuthenticationToken",
"authRequest",
"=",
"new",
"OAuth2AuthenticationToken",
"(",
"code",
")",
";",
"// Allow subclasses to set the \"details\" property",
"setDetails",
"(",
"request",
",",
"authRequest",
")",
";",
"return",
"this",
".",
"getAuthenticationManager",
"(",
")",
".",
"authenticate",
"(",
"authRequest",
")",
";",
"}"
] | Performs actual authentication.
<p>
The implementation should do one of the following:
<ol>
<li>Return a populated authentication token for the authenticated user, indicating successful authentication</li>
<li>Return null, indicating that the authentication process is still in progress. Before returning, the
implementation should perform any additional work required to complete the process.</li>
<li>Throw an <tt>AuthenticationException</tt> if the authentication process fails</li>
</ol>
@param request from which to extract parameters and perform the authentication
@param response the response, which may be needed if the implementation has to do a redirect as part of a
multi-stage authentication process (such as OpenID).
@return the authenticated user token, or null if authentication is incomplete.
@throws org.springframework.security.core.AuthenticationException
if authentication fails. | [
"Performs",
"actual",
"authentication",
".",
"<p",
">",
"The",
"implementation",
"should",
"do",
"one",
"of",
"the",
"following",
":",
"<ol",
">",
"<li",
">",
"Return",
"a",
"populated",
"authentication",
"token",
"for",
"the",
"authenticated",
"user",
"indicating",
"successful",
"authentication<",
"/",
"li",
">",
"<li",
">",
"Return",
"null",
"indicating",
"that",
"the",
"authentication",
"process",
"is",
"still",
"in",
"progress",
".",
"Before",
"returning",
"the",
"implementation",
"should",
"perform",
"any",
"additional",
"work",
"required",
"to",
"complete",
"the",
"process",
".",
"<",
"/",
"li",
">",
"<li",
">",
"Throw",
"an",
"<tt",
">",
"AuthenticationException<",
"/",
"tt",
">",
"if",
"the",
"authentication",
"process",
"fails<",
"/",
"li",
">",
"<",
"/",
"ol",
">"
] | train | https://github.com/pwheel/spring-security-oauth2-client/blob/c0258823493e268495c9752c5d752f74c6809c6b/src/main/java/com/racquettrack/security/oauth/OAuth2AuthenticationFilter.java#L64-L97 |
grails/grails-core | grails-core/src/main/groovy/grails/util/GrailsClassUtils.java | GrailsClassUtils.getPropertyValueOfNewInstance | @SuppressWarnings({ "unchecked", "rawtypes" })
public static Object getPropertyValueOfNewInstance(Class clazz, String propertyName, Class<?> propertyType) {
// validate
if (clazz == null || !StringUtils.hasText(propertyName)) {
return null;
}
try {
return getPropertyOrStaticPropertyOrFieldValue(BeanUtils.instantiateClass(clazz), propertyName);
}
catch (BeanInstantiationException e) {
return null;
}
} | java | @SuppressWarnings({ "unchecked", "rawtypes" })
public static Object getPropertyValueOfNewInstance(Class clazz, String propertyName, Class<?> propertyType) {
// validate
if (clazz == null || !StringUtils.hasText(propertyName)) {
return null;
}
try {
return getPropertyOrStaticPropertyOrFieldValue(BeanUtils.instantiateClass(clazz), propertyName);
}
catch (BeanInstantiationException e) {
return null;
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"public",
"static",
"Object",
"getPropertyValueOfNewInstance",
"(",
"Class",
"clazz",
",",
"String",
"propertyName",
",",
"Class",
"<",
"?",
">",
"propertyType",
")",
"{",
"// validate",
"if",
"(",
"clazz",
"==",
"null",
"||",
"!",
"StringUtils",
".",
"hasText",
"(",
"propertyName",
")",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"return",
"getPropertyOrStaticPropertyOrFieldValue",
"(",
"BeanUtils",
".",
"instantiateClass",
"(",
"clazz",
")",
",",
"propertyName",
")",
";",
"}",
"catch",
"(",
"BeanInstantiationException",
"e",
")",
"{",
"return",
"null",
";",
"}",
"}"
] | Returns the value of the specified property and type from an instance of the specified Grails class
@param clazz The name of the class which contains the property
@param propertyName The property name
@param propertyType The property type
@return The value of the property or null if none exists | [
"Returns",
"the",
"value",
"of",
"the",
"specified",
"property",
"and",
"type",
"from",
"an",
"instance",
"of",
"the",
"specified",
"Grails",
"class"
] | train | https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/util/GrailsClassUtils.java#L220-L233 |
mapcode-foundation/mapcode-java | src/main/java/com/mapcode/Mapcode.java | Mapcode.convertStringToAlphabet | @Nonnull
static String convertStringToAlphabet(@Nonnull final String string, @Nullable final Alphabet alphabet) throws IllegalArgumentException {
return (alphabet != null) ? Decoder.encodeUTF16(string.toUpperCase(), alphabet.getNumber()) :
string.toUpperCase();
} | java | @Nonnull
static String convertStringToAlphabet(@Nonnull final String string, @Nullable final Alphabet alphabet) throws IllegalArgumentException {
return (alphabet != null) ? Decoder.encodeUTF16(string.toUpperCase(), alphabet.getNumber()) :
string.toUpperCase();
} | [
"@",
"Nonnull",
"static",
"String",
"convertStringToAlphabet",
"(",
"@",
"Nonnull",
"final",
"String",
"string",
",",
"@",
"Nullable",
"final",
"Alphabet",
"alphabet",
")",
"throws",
"IllegalArgumentException",
"{",
"return",
"(",
"alphabet",
"!=",
"null",
")",
"?",
"Decoder",
".",
"encodeUTF16",
"(",
"string",
".",
"toUpperCase",
"(",
")",
",",
"alphabet",
".",
"getNumber",
"(",
")",
")",
":",
"string",
".",
"toUpperCase",
"(",
")",
";",
"}"
] | Convert a string into the same string using a different (or the same) alphabet.
@param string Any string.
@param alphabet Alphabet to convert to, may contain Unicode characters.
@return Converted mapcode.
@throws IllegalArgumentException Thrown if string has incorrect syntax or if the string cannot be encoded in
the specified alphabet. | [
"Convert",
"a",
"string",
"into",
"the",
"same",
"string",
"using",
"a",
"different",
"(",
"or",
"the",
"same",
")",
"alphabet",
"."
] | train | https://github.com/mapcode-foundation/mapcode-java/blob/f12d4d9fbd460472ac0fff1f702f2ac716bc0ab8/src/main/java/com/mapcode/Mapcode.java#L393-L397 |
googleads/googleads-java-lib | modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/CsvFiles.java | CsvFiles.writeCsv | public static void writeCsv(List<String[]> csvData, String fileName) throws IOException {
Preconditions.checkNotNull(csvData, "Null CSV data");
Preconditions.checkNotNull(fileName, "Null file name");
CSVWriter writer = null;
try {
writer = new CSVWriter(Files.newWriter(new File(fileName), StandardCharsets.UTF_8));
for (String[] line : csvData) {
writer.writeNext(line);
}
} finally {
if (writer != null) {
writer.close();
}
}
} | java | public static void writeCsv(List<String[]> csvData, String fileName) throws IOException {
Preconditions.checkNotNull(csvData, "Null CSV data");
Preconditions.checkNotNull(fileName, "Null file name");
CSVWriter writer = null;
try {
writer = new CSVWriter(Files.newWriter(new File(fileName), StandardCharsets.UTF_8));
for (String[] line : csvData) {
writer.writeNext(line);
}
} finally {
if (writer != null) {
writer.close();
}
}
} | [
"public",
"static",
"void",
"writeCsv",
"(",
"List",
"<",
"String",
"[",
"]",
">",
"csvData",
",",
"String",
"fileName",
")",
"throws",
"IOException",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"csvData",
",",
"\"Null CSV data\"",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"fileName",
",",
"\"Null file name\"",
")",
";",
"CSVWriter",
"writer",
"=",
"null",
";",
"try",
"{",
"writer",
"=",
"new",
"CSVWriter",
"(",
"Files",
".",
"newWriter",
"(",
"new",
"File",
"(",
"fileName",
")",
",",
"StandardCharsets",
".",
"UTF_8",
")",
")",
";",
"for",
"(",
"String",
"[",
"]",
"line",
":",
"csvData",
")",
"{",
"writer",
".",
"writeNext",
"(",
"line",
")",
";",
"}",
"}",
"finally",
"{",
"if",
"(",
"writer",
"!=",
"null",
")",
"{",
"writer",
".",
"close",
"(",
")",
";",
"}",
"}",
"}"
] | Writes the CSV data located in {@code csvData} to the file located at
{@code fileName}.
@param csvData the CSV data including the header
@param fileName the file to write the CSV data to
@throws IOException if there was an error writing to the file
@throws NullPointerException if {@code csvData == null} or {@code fileName == null} | [
"Writes",
"the",
"CSV",
"data",
"located",
"in",
"{",
"@code",
"csvData",
"}",
"to",
"the",
"file",
"located",
"at",
"{",
"@code",
"fileName",
"}",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/CsvFiles.java#L202-L217 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF6.java | CommonOps_DDF6.elementDiv | public static void elementDiv( DMatrix6x6 a , DMatrix6x6 b , DMatrix6x6 c ) {
c.a11 = a.a11/b.a11; c.a12 = a.a12/b.a12; c.a13 = a.a13/b.a13; c.a14 = a.a14/b.a14; c.a15 = a.a15/b.a15; c.a16 = a.a16/b.a16;
c.a21 = a.a21/b.a21; c.a22 = a.a22/b.a22; c.a23 = a.a23/b.a23; c.a24 = a.a24/b.a24; c.a25 = a.a25/b.a25; c.a26 = a.a26/b.a26;
c.a31 = a.a31/b.a31; c.a32 = a.a32/b.a32; c.a33 = a.a33/b.a33; c.a34 = a.a34/b.a34; c.a35 = a.a35/b.a35; c.a36 = a.a36/b.a36;
c.a41 = a.a41/b.a41; c.a42 = a.a42/b.a42; c.a43 = a.a43/b.a43; c.a44 = a.a44/b.a44; c.a45 = a.a45/b.a45; c.a46 = a.a46/b.a46;
c.a51 = a.a51/b.a51; c.a52 = a.a52/b.a52; c.a53 = a.a53/b.a53; c.a54 = a.a54/b.a54; c.a55 = a.a55/b.a55; c.a56 = a.a56/b.a56;
c.a61 = a.a61/b.a61; c.a62 = a.a62/b.a62; c.a63 = a.a63/b.a63; c.a64 = a.a64/b.a64; c.a65 = a.a65/b.a65; c.a66 = a.a66/b.a66;
} | java | public static void elementDiv( DMatrix6x6 a , DMatrix6x6 b , DMatrix6x6 c ) {
c.a11 = a.a11/b.a11; c.a12 = a.a12/b.a12; c.a13 = a.a13/b.a13; c.a14 = a.a14/b.a14; c.a15 = a.a15/b.a15; c.a16 = a.a16/b.a16;
c.a21 = a.a21/b.a21; c.a22 = a.a22/b.a22; c.a23 = a.a23/b.a23; c.a24 = a.a24/b.a24; c.a25 = a.a25/b.a25; c.a26 = a.a26/b.a26;
c.a31 = a.a31/b.a31; c.a32 = a.a32/b.a32; c.a33 = a.a33/b.a33; c.a34 = a.a34/b.a34; c.a35 = a.a35/b.a35; c.a36 = a.a36/b.a36;
c.a41 = a.a41/b.a41; c.a42 = a.a42/b.a42; c.a43 = a.a43/b.a43; c.a44 = a.a44/b.a44; c.a45 = a.a45/b.a45; c.a46 = a.a46/b.a46;
c.a51 = a.a51/b.a51; c.a52 = a.a52/b.a52; c.a53 = a.a53/b.a53; c.a54 = a.a54/b.a54; c.a55 = a.a55/b.a55; c.a56 = a.a56/b.a56;
c.a61 = a.a61/b.a61; c.a62 = a.a62/b.a62; c.a63 = a.a63/b.a63; c.a64 = a.a64/b.a64; c.a65 = a.a65/b.a65; c.a66 = a.a66/b.a66;
} | [
"public",
"static",
"void",
"elementDiv",
"(",
"DMatrix6x6",
"a",
",",
"DMatrix6x6",
"b",
",",
"DMatrix6x6",
"c",
")",
"{",
"c",
".",
"a11",
"=",
"a",
".",
"a11",
"/",
"b",
".",
"a11",
";",
"c",
".",
"a12",
"=",
"a",
".",
"a12",
"/",
"b",
".",
"a12",
";",
"c",
".",
"a13",
"=",
"a",
".",
"a13",
"/",
"b",
".",
"a13",
";",
"c",
".",
"a14",
"=",
"a",
".",
"a14",
"/",
"b",
".",
"a14",
";",
"c",
".",
"a15",
"=",
"a",
".",
"a15",
"/",
"b",
".",
"a15",
";",
"c",
".",
"a16",
"=",
"a",
".",
"a16",
"/",
"b",
".",
"a16",
";",
"c",
".",
"a21",
"=",
"a",
".",
"a21",
"/",
"b",
".",
"a21",
";",
"c",
".",
"a22",
"=",
"a",
".",
"a22",
"/",
"b",
".",
"a22",
";",
"c",
".",
"a23",
"=",
"a",
".",
"a23",
"/",
"b",
".",
"a23",
";",
"c",
".",
"a24",
"=",
"a",
".",
"a24",
"/",
"b",
".",
"a24",
";",
"c",
".",
"a25",
"=",
"a",
".",
"a25",
"/",
"b",
".",
"a25",
";",
"c",
".",
"a26",
"=",
"a",
".",
"a26",
"/",
"b",
".",
"a26",
";",
"c",
".",
"a31",
"=",
"a",
".",
"a31",
"/",
"b",
".",
"a31",
";",
"c",
".",
"a32",
"=",
"a",
".",
"a32",
"/",
"b",
".",
"a32",
";",
"c",
".",
"a33",
"=",
"a",
".",
"a33",
"/",
"b",
".",
"a33",
";",
"c",
".",
"a34",
"=",
"a",
".",
"a34",
"/",
"b",
".",
"a34",
";",
"c",
".",
"a35",
"=",
"a",
".",
"a35",
"/",
"b",
".",
"a35",
";",
"c",
".",
"a36",
"=",
"a",
".",
"a36",
"/",
"b",
".",
"a36",
";",
"c",
".",
"a41",
"=",
"a",
".",
"a41",
"/",
"b",
".",
"a41",
";",
"c",
".",
"a42",
"=",
"a",
".",
"a42",
"/",
"b",
".",
"a42",
";",
"c",
".",
"a43",
"=",
"a",
".",
"a43",
"/",
"b",
".",
"a43",
";",
"c",
".",
"a44",
"=",
"a",
".",
"a44",
"/",
"b",
".",
"a44",
";",
"c",
".",
"a45",
"=",
"a",
".",
"a45",
"/",
"b",
".",
"a45",
";",
"c",
".",
"a46",
"=",
"a",
".",
"a46",
"/",
"b",
".",
"a46",
";",
"c",
".",
"a51",
"=",
"a",
".",
"a51",
"/",
"b",
".",
"a51",
";",
"c",
".",
"a52",
"=",
"a",
".",
"a52",
"/",
"b",
".",
"a52",
";",
"c",
".",
"a53",
"=",
"a",
".",
"a53",
"/",
"b",
".",
"a53",
";",
"c",
".",
"a54",
"=",
"a",
".",
"a54",
"/",
"b",
".",
"a54",
";",
"c",
".",
"a55",
"=",
"a",
".",
"a55",
"/",
"b",
".",
"a55",
";",
"c",
".",
"a56",
"=",
"a",
".",
"a56",
"/",
"b",
".",
"a56",
";",
"c",
".",
"a61",
"=",
"a",
".",
"a61",
"/",
"b",
".",
"a61",
";",
"c",
".",
"a62",
"=",
"a",
".",
"a62",
"/",
"b",
".",
"a62",
";",
"c",
".",
"a63",
"=",
"a",
".",
"a63",
"/",
"b",
".",
"a63",
";",
"c",
".",
"a64",
"=",
"a",
".",
"a64",
"/",
"b",
".",
"a64",
";",
"c",
".",
"a65",
"=",
"a",
".",
"a65",
"/",
"b",
".",
"a65",
";",
"c",
".",
"a66",
"=",
"a",
".",
"a66",
"/",
"b",
".",
"a66",
";",
"}"
] | <p>Performs an element by element division operation:<br>
<br>
c<sub>ij</sub> = a<sub>ij</sub> / b<sub>ij</sub> <br>
</p>
@param a The left matrix in the division operation. Not modified.
@param b The right matrix in the division operation. Not modified.
@param c Where the results of the operation are stored. Modified. | [
"<p",
">",
"Performs",
"an",
"element",
"by",
"element",
"division",
"operation",
":",
"<br",
">",
"<br",
">",
"c<sub",
">",
"ij<",
"/",
"sub",
">",
"=",
"a<sub",
">",
"ij<",
"/",
"sub",
">",
"/",
"b<sub",
">",
"ij<",
"/",
"sub",
">",
"<br",
">",
"<",
"/",
"p",
">"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF6.java#L1883-L1890 |
Netflix/conductor | mysql-persistence/src/main/java/com/netflix/conductor/dao/mysql/MySQLMetadataDAO.java | MySQLMetadataDAO.getEventHandler | private EventHandler getEventHandler(Connection connection, String name) {
final String READ_ONE_EVENT_HANDLER_QUERY = "SELECT json_data FROM meta_event_handler WHERE name = ?";
return query(connection, READ_ONE_EVENT_HANDLER_QUERY,
q -> q.addParameter(name).executeAndFetchFirst(EventHandler.class));
} | java | private EventHandler getEventHandler(Connection connection, String name) {
final String READ_ONE_EVENT_HANDLER_QUERY = "SELECT json_data FROM meta_event_handler WHERE name = ?";
return query(connection, READ_ONE_EVENT_HANDLER_QUERY,
q -> q.addParameter(name).executeAndFetchFirst(EventHandler.class));
} | [
"private",
"EventHandler",
"getEventHandler",
"(",
"Connection",
"connection",
",",
"String",
"name",
")",
"{",
"final",
"String",
"READ_ONE_EVENT_HANDLER_QUERY",
"=",
"\"SELECT json_data FROM meta_event_handler WHERE name = ?\"",
";",
"return",
"query",
"(",
"connection",
",",
"READ_ONE_EVENT_HANDLER_QUERY",
",",
"q",
"->",
"q",
".",
"addParameter",
"(",
"name",
")",
".",
"executeAndFetchFirst",
"(",
"EventHandler",
".",
"class",
")",
")",
";",
"}"
] | Retrieve a {@link EventHandler} by {@literal name}.
@param connection The {@link Connection} to use for queries.
@param name The {@code EventHandler} name to look for.
@return {@literal null} if nothing is found, otherwise the {@code EventHandler}. | [
"Retrieve",
"a",
"{",
"@link",
"EventHandler",
"}",
"by",
"{",
"@literal",
"name",
"}",
"."
] | train | https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/mysql-persistence/src/main/java/com/netflix/conductor/dao/mysql/MySQLMetadataDAO.java#L292-L297 |
kuali/kc-s2sgen | coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRBudget10V1_1Generator.java | RRBudget10V1_1Generator.setOthersForOtherDirectCosts | private void setOthersForOtherDirectCosts(OtherDirectCosts otherDirectCosts, BudgetPeriodDto periodInfo) {
if (periodInfo != null && periodInfo.getOtherDirectCosts() != null) {
for (OtherDirectCostInfoDto otherDirectCostInfo : periodInfo.getOtherDirectCosts()) {
gov.grants.apply.forms.rrBudget10V11.BudgetYearDataType.OtherDirectCosts.Other other = otherDirectCosts.addNewOther();
if (otherDirectCostInfo.getOtherCosts() != null
&& otherDirectCostInfo.getOtherCosts().size() > 0) {
other
.setCost(new BigDecimal(otherDirectCostInfo
.getOtherCosts().get(0).get(
CostConstants.KEY_COST)));
}
other.setDescription(OTHERCOST_DESCRIPTION);
}
}
} | java | private void setOthersForOtherDirectCosts(OtherDirectCosts otherDirectCosts, BudgetPeriodDto periodInfo) {
if (periodInfo != null && periodInfo.getOtherDirectCosts() != null) {
for (OtherDirectCostInfoDto otherDirectCostInfo : periodInfo.getOtherDirectCosts()) {
gov.grants.apply.forms.rrBudget10V11.BudgetYearDataType.OtherDirectCosts.Other other = otherDirectCosts.addNewOther();
if (otherDirectCostInfo.getOtherCosts() != null
&& otherDirectCostInfo.getOtherCosts().size() > 0) {
other
.setCost(new BigDecimal(otherDirectCostInfo
.getOtherCosts().get(0).get(
CostConstants.KEY_COST)));
}
other.setDescription(OTHERCOST_DESCRIPTION);
}
}
} | [
"private",
"void",
"setOthersForOtherDirectCosts",
"(",
"OtherDirectCosts",
"otherDirectCosts",
",",
"BudgetPeriodDto",
"periodInfo",
")",
"{",
"if",
"(",
"periodInfo",
"!=",
"null",
"&&",
"periodInfo",
".",
"getOtherDirectCosts",
"(",
")",
"!=",
"null",
")",
"{",
"for",
"(",
"OtherDirectCostInfoDto",
"otherDirectCostInfo",
":",
"periodInfo",
".",
"getOtherDirectCosts",
"(",
")",
")",
"{",
"gov",
".",
"grants",
".",
"apply",
".",
"forms",
".",
"rrBudget10V11",
".",
"BudgetYearDataType",
".",
"OtherDirectCosts",
".",
"Other",
"other",
"=",
"otherDirectCosts",
".",
"addNewOther",
"(",
")",
";",
"if",
"(",
"otherDirectCostInfo",
".",
"getOtherCosts",
"(",
")",
"!=",
"null",
"&&",
"otherDirectCostInfo",
".",
"getOtherCosts",
"(",
")",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"other",
".",
"setCost",
"(",
"new",
"BigDecimal",
"(",
"otherDirectCostInfo",
".",
"getOtherCosts",
"(",
")",
".",
"get",
"(",
"0",
")",
".",
"get",
"(",
"CostConstants",
".",
"KEY_COST",
")",
")",
")",
";",
"}",
"other",
".",
"setDescription",
"(",
"OTHERCOST_DESCRIPTION",
")",
";",
"}",
"}",
"}"
] | This method is to set Other type description and total cost
OtherDirectCosts details in BudgetYearDataType based on BudgetPeriodInfo
for the RRBudget10.
@param otherDirectCosts otherDirectCosts xmlObject
@param periodInfo
(BudgetPeriodInfo) budget period entry. | [
"This",
"method",
"is",
"to",
"set",
"Other",
"type",
"description",
"and",
"total",
"cost",
"OtherDirectCosts",
"details",
"in",
"BudgetYearDataType",
"based",
"on",
"BudgetPeriodInfo",
"for",
"the",
"RRBudget10",
"."
] | train | https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRBudget10V1_1Generator.java#L463-L477 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.project_serviceName_user_userId_DELETE | public void project_serviceName_user_userId_DELETE(String serviceName, Long userId) throws IOException {
String qPath = "/cloud/project/{serviceName}/user/{userId}";
StringBuilder sb = path(qPath, serviceName, userId);
exec(qPath, "DELETE", sb.toString(), null);
} | java | public void project_serviceName_user_userId_DELETE(String serviceName, Long userId) throws IOException {
String qPath = "/cloud/project/{serviceName}/user/{userId}";
StringBuilder sb = path(qPath, serviceName, userId);
exec(qPath, "DELETE", sb.toString(), null);
} | [
"public",
"void",
"project_serviceName_user_userId_DELETE",
"(",
"String",
"serviceName",
",",
"Long",
"userId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/project/{serviceName}/user/{userId}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"serviceName",
",",
"userId",
")",
";",
"exec",
"(",
"qPath",
",",
"\"DELETE\"",
",",
"sb",
".",
"toString",
"(",
")",
",",
"null",
")",
";",
"}"
] | Delete user
REST: DELETE /cloud/project/{serviceName}/user/{userId}
@param serviceName [required] Service name
@param userId [required] User id | [
"Delete",
"user"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L432-L436 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.