repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
Harium/keel | src/main/java/com/harium/keel/catalano/core/ArraysUtil.java | ArraysUtil.Concatenate | public static int[] Concatenate(int[] array, int[] array2) {
int[] all = new int[array.length + array2.length];
int idx = 0;
//First array
for (int i = 0; i < array.length; i++)
all[idx++] = array[i];
//Second array
for (int i = 0; i < array2.length; i++)
... | java | public static int[] Concatenate(int[] array, int[] array2) {
int[] all = new int[array.length + array2.length];
int idx = 0;
//First array
for (int i = 0; i < array.length; i++)
all[idx++] = array[i];
//Second array
for (int i = 0; i < array2.length; i++)
... | [
"public",
"static",
"int",
"[",
"]",
"Concatenate",
"(",
"int",
"[",
"]",
"array",
",",
"int",
"[",
"]",
"array2",
")",
"{",
"int",
"[",
"]",
"all",
"=",
"new",
"int",
"[",
"array",
".",
"length",
"+",
"array2",
".",
"length",
"]",
";",
"int",
... | Concatenate the arrays.
@param array First array.
@param array2 Second array.
@return Concatenate between first and second array. | [
"Concatenate",
"the",
"arrays",
"."
] | 0369ae674f9e664bccc5f9e161ae7e7a3b949a1e | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/core/ArraysUtil.java#L126-L139 | train |
Harium/keel | src/main/java/com/harium/keel/catalano/core/ArraysUtil.java | ArraysUtil.ConcatenateInt | public static int[] ConcatenateInt(List<int[]> arrays) {
int size = 0;
for (int i = 0; i < arrays.size(); i++) {
size += arrays.get(i).length;
}
int[] all = new int[size];
int idx = 0;
for (int i = 0; i < arrays.size(); i++) {
int[] v = arrays.g... | java | public static int[] ConcatenateInt(List<int[]> arrays) {
int size = 0;
for (int i = 0; i < arrays.size(); i++) {
size += arrays.get(i).length;
}
int[] all = new int[size];
int idx = 0;
for (int i = 0; i < arrays.size(); i++) {
int[] v = arrays.g... | [
"public",
"static",
"int",
"[",
"]",
"ConcatenateInt",
"(",
"List",
"<",
"int",
"[",
"]",
">",
"arrays",
")",
"{",
"int",
"size",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"arrays",
".",
"size",
"(",
")",
";",
"i",
"++",... | Concatenate all the arrays in the list into a vector.
@param arrays List of arrays.
@return Vector. | [
"Concatenate",
"all",
"the",
"arrays",
"in",
"the",
"list",
"into",
"a",
"vector",
"."
] | 0369ae674f9e664bccc5f9e161ae7e7a3b949a1e | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/core/ArraysUtil.java#L191-L209 | train |
Harium/keel | src/main/java/com/harium/keel/catalano/core/ArraysUtil.java | ArraysUtil.asArray | public static <T extends Number> int[] asArray(final T... array) {
int[] b = new int[array.length];
for (int i = 0; i < b.length; i++) {
b[i] = array[i].intValue();
}
return b;
} | java | public static <T extends Number> int[] asArray(final T... array) {
int[] b = new int[array.length];
for (int i = 0; i < b.length; i++) {
b[i] = array[i].intValue();
}
return b;
} | [
"public",
"static",
"<",
"T",
"extends",
"Number",
">",
"int",
"[",
"]",
"asArray",
"(",
"final",
"T",
"...",
"array",
")",
"{",
"int",
"[",
"]",
"b",
"=",
"new",
"int",
"[",
"array",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
... | Convert any number class to array of integer.
@param <T> Type.
@param array Array.
@return Integer array. | [
"Convert",
"any",
"number",
"class",
"to",
"array",
"of",
"integer",
"."
] | 0369ae674f9e664bccc5f9e161ae7e7a3b949a1e | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/core/ArraysUtil.java#L270-L276 | train |
Harium/keel | src/main/java/com/harium/keel/catalano/core/ArraysUtil.java | ArraysUtil.Shuffle | public static void Shuffle(double[] array, long seed) {
Random random = new Random();
if (seed != 0) random.setSeed(seed);
for (int i = array.length - 1; i > 0; i--) {
int index = random.nextInt(i + 1);
double temp = array[index];
array[index] = array[i];
... | java | public static void Shuffle(double[] array, long seed) {
Random random = new Random();
if (seed != 0) random.setSeed(seed);
for (int i = array.length - 1; i > 0; i--) {
int index = random.nextInt(i + 1);
double temp = array[index];
array[index] = array[i];
... | [
"public",
"static",
"void",
"Shuffle",
"(",
"double",
"[",
"]",
"array",
",",
"long",
"seed",
")",
"{",
"Random",
"random",
"=",
"new",
"Random",
"(",
")",
";",
"if",
"(",
"seed",
"!=",
"0",
")",
"random",
".",
"setSeed",
"(",
"seed",
")",
";",
"... | Shuffle an array.
@param array Array.
@param seed Random seed. | [
"Shuffle",
"an",
"array",
"."
] | 0369ae674f9e664bccc5f9e161ae7e7a3b949a1e | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/core/ArraysUtil.java#L293-L303 | train |
Harium/keel | src/main/java/com/harium/keel/catalano/core/ArraysUtil.java | ArraysUtil.toFloat | public static float[] toFloat(int[] array) {
float[] n = new float[array.length];
for (int i = 0; i < array.length; i++) {
n[i] = (float) array[i];
}
return n;
} | java | public static float[] toFloat(int[] array) {
float[] n = new float[array.length];
for (int i = 0; i < array.length; i++) {
n[i] = (float) array[i];
}
return n;
} | [
"public",
"static",
"float",
"[",
"]",
"toFloat",
"(",
"int",
"[",
"]",
"array",
")",
"{",
"float",
"[",
"]",
"n",
"=",
"new",
"float",
"[",
"array",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"len... | 1-D Integer array to float array.
@param array Integer array.
@return Float array. | [
"1",
"-",
"D",
"Integer",
"array",
"to",
"float",
"array",
"."
] | 0369ae674f9e664bccc5f9e161ae7e7a3b949a1e | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/core/ArraysUtil.java#L393-L399 | train |
Harium/keel | src/main/java/com/harium/keel/catalano/core/ArraysUtil.java | ArraysUtil.toFloat | public static float[][] toFloat(int[][] array) {
float[][] n = new float[array.length][array[0].length];
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[0].length; j++) {
n[i][j] = (float) array[i][j];
}
}
return n;
} | java | public static float[][] toFloat(int[][] array) {
float[][] n = new float[array.length][array[0].length];
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[0].length; j++) {
n[i][j] = (float) array[i][j];
}
}
return n;
} | [
"public",
"static",
"float",
"[",
"]",
"[",
"]",
"toFloat",
"(",
"int",
"[",
"]",
"[",
"]",
"array",
")",
"{",
"float",
"[",
"]",
"[",
"]",
"n",
"=",
"new",
"float",
"[",
"array",
".",
"length",
"]",
"[",
"array",
"[",
"0",
"]",
".",
"length"... | 2-D Integer array to float array.
@param array Integer array.
@return Float array. | [
"2",
"-",
"D",
"Integer",
"array",
"to",
"float",
"array",
"."
] | 0369ae674f9e664bccc5f9e161ae7e7a3b949a1e | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/core/ArraysUtil.java#L407-L415 | train |
Harium/keel | src/main/java/com/harium/keel/catalano/core/ArraysUtil.java | ArraysUtil.toInt | public static int[] toInt(double[] array) {
int[] n = new int[array.length];
for (int i = 0; i < array.length; i++) {
n[i] = (int) array[i];
}
return n;
} | java | public static int[] toInt(double[] array) {
int[] n = new int[array.length];
for (int i = 0; i < array.length; i++) {
n[i] = (int) array[i];
}
return n;
} | [
"public",
"static",
"int",
"[",
"]",
"toInt",
"(",
"double",
"[",
"]",
"array",
")",
"{",
"int",
"[",
"]",
"n",
"=",
"new",
"int",
"[",
"array",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",... | 1-D Double array to integer array.
@param array Double array.
@return Integer array. | [
"1",
"-",
"D",
"Double",
"array",
"to",
"integer",
"array",
"."
] | 0369ae674f9e664bccc5f9e161ae7e7a3b949a1e | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/core/ArraysUtil.java#L453-L459 | train |
Harium/keel | src/main/java/com/harium/keel/catalano/core/ArraysUtil.java | ArraysUtil.toInt | public static int[][] toInt(double[][] array) {
int[][] n = new int[array.length][array[0].length];
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[0].length; j++) {
n[i][j] = (int) array[i][j];
}
}
return n;
} | java | public static int[][] toInt(double[][] array) {
int[][] n = new int[array.length][array[0].length];
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[0].length; j++) {
n[i][j] = (int) array[i][j];
}
}
return n;
} | [
"public",
"static",
"int",
"[",
"]",
"[",
"]",
"toInt",
"(",
"double",
"[",
"]",
"[",
"]",
"array",
")",
"{",
"int",
"[",
"]",
"[",
"]",
"n",
"=",
"new",
"int",
"[",
"array",
".",
"length",
"]",
"[",
"array",
"[",
"0",
"]",
".",
"length",
"... | 2-D Double array to integer array.
@param array Double array.
@return Integer array. | [
"2",
"-",
"D",
"Double",
"array",
"to",
"integer",
"array",
"."
] | 0369ae674f9e664bccc5f9e161ae7e7a3b949a1e | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/core/ArraysUtil.java#L467-L475 | train |
Harium/keel | src/main/java/com/harium/keel/catalano/core/ArraysUtil.java | ArraysUtil.toDouble | public static double[] toDouble(int[] array) {
double[] n = new double[array.length];
for (int i = 0; i < array.length; i++) {
n[i] = (double) array[i];
}
return n;
} | java | public static double[] toDouble(int[] array) {
double[] n = new double[array.length];
for (int i = 0; i < array.length; i++) {
n[i] = (double) array[i];
}
return n;
} | [
"public",
"static",
"double",
"[",
"]",
"toDouble",
"(",
"int",
"[",
"]",
"array",
")",
"{",
"double",
"[",
"]",
"n",
"=",
"new",
"double",
"[",
"array",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
... | 1-D Integer array to double array.
@param array Integer array.
@return Double array. | [
"1",
"-",
"D",
"Integer",
"array",
"to",
"double",
"array",
"."
] | 0369ae674f9e664bccc5f9e161ae7e7a3b949a1e | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/core/ArraysUtil.java#L513-L519 | train |
Harium/keel | src/main/java/com/harium/keel/catalano/core/ArraysUtil.java | ArraysUtil.toDouble | public static double[][] toDouble(int[][] array) {
double[][] n = new double[array.length][array[0].length];
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[0].length; j++) {
n[i][j] = (double) array[i][j];
}
}
return n;
} | java | public static double[][] toDouble(int[][] array) {
double[][] n = new double[array.length][array[0].length];
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[0].length; j++) {
n[i][j] = (double) array[i][j];
}
}
return n;
} | [
"public",
"static",
"double",
"[",
"]",
"[",
"]",
"toDouble",
"(",
"int",
"[",
"]",
"[",
"]",
"array",
")",
"{",
"double",
"[",
"]",
"[",
"]",
"n",
"=",
"new",
"double",
"[",
"array",
".",
"length",
"]",
"[",
"array",
"[",
"0",
"]",
".",
"len... | 2-D Integer array to double array.
@param array Integer array.
@return Double array. | [
"2",
"-",
"D",
"Integer",
"array",
"to",
"double",
"array",
"."
] | 0369ae674f9e664bccc5f9e161ae7e7a3b949a1e | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/core/ArraysUtil.java#L527-L535 | train |
artikcloud/artikcloud-java | src/main/java/cloud/artik/api/TokensApi.java | TokensApi.tokenInfoWithHttpInfo | public ApiResponse<TokenInfoSuccessResponse> tokenInfoWithHttpInfo() throws ApiException {
com.squareup.okhttp.Call call = tokenInfoValidateBeforeCall(null, null);
Type localVarReturnType = new TypeToken<TokenInfoSuccessResponse>(){}.getType();
return apiClient.execute(call, localVarReturnType);... | java | public ApiResponse<TokenInfoSuccessResponse> tokenInfoWithHttpInfo() throws ApiException {
com.squareup.okhttp.Call call = tokenInfoValidateBeforeCall(null, null);
Type localVarReturnType = new TypeToken<TokenInfoSuccessResponse>(){}.getType();
return apiClient.execute(call, localVarReturnType);... | [
"public",
"ApiResponse",
"<",
"TokenInfoSuccessResponse",
">",
"tokenInfoWithHttpInfo",
"(",
")",
"throws",
"ApiException",
"{",
"com",
".",
"squareup",
".",
"okhttp",
".",
"Call",
"call",
"=",
"tokenInfoValidateBeforeCall",
"(",
"null",
",",
"null",
")",
";",
"... | Token Info
Returns the Token Information
@return ApiResponse<TokenInfoSuccessResponse>
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Token",
"Info",
"Returns",
"the",
"Token",
"Information"
] | 412f447573e7796ab4f685c0bdd5eb76185a365c | https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/TokensApi.java#L379-L383 | train |
Harium/keel | src/main/java/com/harium/keel/catalano/math/function/Normal.java | Normal.HighAccuracyFunction | public static double HighAccuracyFunction(double x) {
if (x < -8 || x > 8)
return 0;
double sum = x;
double term = 0;
double nextTerm = x;
double pwr = x * x;
double i = 1;
// Iterate until adding next terms doesn't produce
// any change wit... | java | public static double HighAccuracyFunction(double x) {
if (x < -8 || x > 8)
return 0;
double sum = x;
double term = 0;
double nextTerm = x;
double pwr = x * x;
double i = 1;
// Iterate until adding next terms doesn't produce
// any change wit... | [
"public",
"static",
"double",
"HighAccuracyFunction",
"(",
"double",
"x",
")",
"{",
"if",
"(",
"x",
"<",
"-",
"8",
"||",
"x",
">",
"8",
")",
"return",
"0",
";",
"double",
"sum",
"=",
"x",
";",
"double",
"term",
"=",
"0",
";",
"double",
"nextTerm",
... | High-accuracy Normal cumulative distribution function.
@param x Value.
@return Result. | [
"High",
"-",
"accuracy",
"Normal",
"cumulative",
"distribution",
"function",
"."
] | 0369ae674f9e664bccc5f9e161ae7e7a3b949a1e | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/function/Normal.java#L193-L217 | train |
Harium/keel | src/main/java/com/harium/keel/catalano/math/function/Normal.java | Normal.HighAccuracyComplemented | public static double HighAccuracyComplemented(double x) {
double[] R =
{
1.25331413731550025, 0.421369229288054473, 0.236652382913560671,
0.162377660896867462, 0.123131963257932296, 0.0990285964717319214,
0.08276628650136917... | java | public static double HighAccuracyComplemented(double x) {
double[] R =
{
1.25331413731550025, 0.421369229288054473, 0.236652382913560671,
0.162377660896867462, 0.123131963257932296, 0.0990285964717319214,
0.08276628650136917... | [
"public",
"static",
"double",
"HighAccuracyComplemented",
"(",
"double",
"x",
")",
"{",
"double",
"[",
"]",
"R",
"=",
"{",
"1.25331413731550025",
",",
"0.421369229288054473",
",",
"0.236652382913560671",
",",
"0.162377660896867462",
",",
"0.123131963257932296",
",",
... | High-accuracy Complementary normal distribution function.
@param x Value.
@return Result. | [
"High",
"-",
"accuracy",
"Complementary",
"normal",
"distribution",
"function",
"."
] | 0369ae674f9e664bccc5f9e161ae7e7a3b949a1e | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/function/Normal.java#L225-L260 | train |
vnesek/nmote-iim4j | src/main/java/com/nmote/iim4j/srs/SubjectReference.java | SubjectReference.toIPTC | public String toIPTC(SubjectReferenceSystem srs) {
StringBuffer b = new StringBuffer();
b.append("IPTC:");
b.append(getNumber());
b.append(":");
if (getNumber().endsWith("000000")) {
b.append(toIPTCHelper(srs.getName(this)));
b.append("::");
} else if (getNumber().endsWith("000")) {
b.appe... | java | public String toIPTC(SubjectReferenceSystem srs) {
StringBuffer b = new StringBuffer();
b.append("IPTC:");
b.append(getNumber());
b.append(":");
if (getNumber().endsWith("000000")) {
b.append(toIPTCHelper(srs.getName(this)));
b.append("::");
} else if (getNumber().endsWith("000")) {
b.appe... | [
"public",
"String",
"toIPTC",
"(",
"SubjectReferenceSystem",
"srs",
")",
"{",
"StringBuffer",
"b",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"b",
".",
"append",
"(",
"\"IPTC:\"",
")",
";",
"b",
".",
"append",
"(",
"getNumber",
"(",
")",
")",
";",
"b",... | Formats an IPTC string for this reference using information obtained from
Subject Reference System.
@param srs
reference subject reference system
@return IPTC formatted reference | [
"Formats",
"an",
"IPTC",
"string",
"for",
"this",
"reference",
"using",
"information",
"obtained",
"from",
"Subject",
"Reference",
"System",
"."
] | ec55b02fc644cd722e93051ac0bdb96b00cb42a8 | https://github.com/vnesek/nmote-iim4j/blob/ec55b02fc644cd722e93051ac0bdb96b00cb42a8/src/main/java/com/nmote/iim4j/srs/SubjectReference.java#L86-L107 | train |
vnesek/nmote-iim4j | src/main/java/com/nmote/iim4j/IIMDataSetInfoFactory.java | IIMDataSetInfoFactory.create | public DataSetInfo create(int dataSet) throws InvalidDataSetException {
DataSetInfo info = dataSets.get(createKey(dataSet));
if (info == null) {
int recordNumber = (dataSet >> 8) & 0xFF;
int dataSetNumber = dataSet & 0xFF;
throw new UnsupportedDataSetException(recordNumber + ":" + dataSetNumber);
... | java | public DataSetInfo create(int dataSet) throws InvalidDataSetException {
DataSetInfo info = dataSets.get(createKey(dataSet));
if (info == null) {
int recordNumber = (dataSet >> 8) & 0xFF;
int dataSetNumber = dataSet & 0xFF;
throw new UnsupportedDataSetException(recordNumber + ":" + dataSetNumber);
... | [
"public",
"DataSetInfo",
"create",
"(",
"int",
"dataSet",
")",
"throws",
"InvalidDataSetException",
"{",
"DataSetInfo",
"info",
"=",
"dataSets",
".",
"get",
"(",
"createKey",
"(",
"dataSet",
")",
")",
";",
"if",
"(",
"info",
"==",
"null",
")",
"{",
"int",
... | Creates and caches dataset info object. Subsequent invocations will
return same instance.
@see IIM#DS(int, int)
@param dataSet
dataset record number
@return dataset info instace | [
"Creates",
"and",
"caches",
"dataset",
"info",
"object",
".",
"Subsequent",
"invocations",
"will",
"return",
"same",
"instance",
"."
] | ec55b02fc644cd722e93051ac0bdb96b00cb42a8 | https://github.com/vnesek/nmote-iim4j/blob/ec55b02fc644cd722e93051ac0bdb96b00cb42a8/src/main/java/com/nmote/iim4j/IIMDataSetInfoFactory.java#L83-L92 | train |
Harium/keel | src/main/java/com/harium/keel/catalano/math/function/PerlinNoise.java | PerlinNoise.Function1D | public double Function1D(double x) {
double frequency = initFrequency;
double amplitude = initAmplitude;
double sum = 0;
// octaves
for (int i = 0; i < octaves; i++) {
sum += SmoothedNoise(x * frequency) * amplitude;
frequency *= 2;
amplitude... | java | public double Function1D(double x) {
double frequency = initFrequency;
double amplitude = initAmplitude;
double sum = 0;
// octaves
for (int i = 0; i < octaves; i++) {
sum += SmoothedNoise(x * frequency) * amplitude;
frequency *= 2;
amplitude... | [
"public",
"double",
"Function1D",
"(",
"double",
"x",
")",
"{",
"double",
"frequency",
"=",
"initFrequency",
";",
"double",
"amplitude",
"=",
"initAmplitude",
";",
"double",
"sum",
"=",
"0",
";",
"// octaves",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
... | 1-D Perlin noise function.
@param x X Value.
@return Returns function's value at point x. | [
"1",
"-",
"D",
"Perlin",
"noise",
"function",
"."
] | 0369ae674f9e664bccc5f9e161ae7e7a3b949a1e | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/function/PerlinNoise.java#L148-L161 | train |
Harium/keel | src/main/java/com/harium/keel/catalano/math/function/PerlinNoise.java | PerlinNoise.Function2D | public double Function2D(double x, double y) {
double frequency = initFrequency;
double amplitude = initAmplitude;
double sum = 0;
// octaves
for (int i = 0; i < octaves; i++) {
sum += SmoothedNoise(x * frequency, y * frequency) * amplitude;
frequency *=... | java | public double Function2D(double x, double y) {
double frequency = initFrequency;
double amplitude = initAmplitude;
double sum = 0;
// octaves
for (int i = 0; i < octaves; i++) {
sum += SmoothedNoise(x * frequency, y * frequency) * amplitude;
frequency *=... | [
"public",
"double",
"Function2D",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"double",
"frequency",
"=",
"initFrequency",
";",
"double",
"amplitude",
"=",
"initAmplitude",
";",
"double",
"sum",
"=",
"0",
";",
"// octaves",
"for",
"(",
"int",
"i",
... | 2-D Perlin noise function.
@param x X Value.
@param y Y Value.
@return Returns function's value at point xy. | [
"2",
"-",
"D",
"Perlin",
"noise",
"function",
"."
] | 0369ae674f9e664bccc5f9e161ae7e7a3b949a1e | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/function/PerlinNoise.java#L170-L183 | train |
Harium/keel | src/main/java/com/harium/keel/catalano/math/function/PerlinNoise.java | PerlinNoise.Noise | private double Noise(int x, int y) {
int n = x + y * 57;
n = (n << 13) ^ n;
return (1.0 - ((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0);
} | java | private double Noise(int x, int y) {
int n = x + y * 57;
n = (n << 13) ^ n;
return (1.0 - ((n * (n * n * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0);
} | [
"private",
"double",
"Noise",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"int",
"n",
"=",
"x",
"+",
"y",
"*",
"57",
";",
"n",
"=",
"(",
"n",
"<<",
"13",
")",
"^",
"n",
";",
"return",
"(",
"1.0",
"-",
"(",
"(",
"n",
"*",
"(",
"n",
"*",
... | Ordinary noise function.
@param x X Value.
@param y Y Value.
@return | [
"Ordinary",
"noise",
"function",
"."
] | 0369ae674f9e664bccc5f9e161ae7e7a3b949a1e | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/function/PerlinNoise.java#L204-L209 | train |
Harium/keel | src/main/java/com/harium/keel/catalano/math/function/PerlinNoise.java | PerlinNoise.CosineInterpolate | private double CosineInterpolate(double x1, double x2, double a) {
double f = (1 - Math.cos(a * Math.PI)) * 0.5;
return x1 * (1 - f) + x2 * f;
} | java | private double CosineInterpolate(double x1, double x2, double a) {
double f = (1 - Math.cos(a * Math.PI)) * 0.5;
return x1 * (1 - f) + x2 * f;
} | [
"private",
"double",
"CosineInterpolate",
"(",
"double",
"x1",
",",
"double",
"x2",
",",
"double",
"a",
")",
"{",
"double",
"f",
"=",
"(",
"1",
"-",
"Math",
".",
"cos",
"(",
"a",
"*",
"Math",
".",
"PI",
")",
")",
"*",
"0.5",
";",
"return",
"x1",
... | Cosine interpolation.
@param x1 X1 Value.
@param x2 X2 Value.
@param a Value.
@return Value. | [
"Cosine",
"interpolation",
"."
] | 0369ae674f9e664bccc5f9e161ae7e7a3b949a1e | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/function/PerlinNoise.java#L258-L262 | train |
skuzzle/jeve | jeve/src/main/java/de/skuzzle/jeve/FailureCollector.java | FailureCollector.getFailedInvocations | public List<FailedEventInvocation> getFailedInvocations() {
synchronized (this.mutex) {
if (this.failedEvents == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(this.failedEvents);
}
} | java | public List<FailedEventInvocation> getFailedInvocations() {
synchronized (this.mutex) {
if (this.failedEvents == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(this.failedEvents);
}
} | [
"public",
"List",
"<",
"FailedEventInvocation",
">",
"getFailedInvocations",
"(",
")",
"{",
"synchronized",
"(",
"this",
".",
"mutex",
")",
"{",
"if",
"(",
"this",
".",
"failedEvents",
"==",
"null",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
... | Gets the list of failed invocations that has been collected by this collector.
@return The failed invocations. | [
"Gets",
"the",
"list",
"of",
"failed",
"invocations",
"that",
"has",
"been",
"collected",
"by",
"this",
"collector",
"."
] | 42cc18947c9c8596c34410336e4e375e9fcd7c47 | https://github.com/skuzzle/jeve/blob/42cc18947c9c8596c34410336e4e375e9fcd7c47/jeve/src/main/java/de/skuzzle/jeve/FailureCollector.java#L77-L84 | train |
skuzzle/jeve | jeve/src/main/java/de/skuzzle/jeve/SequentialEvent.java | SequentialEvent.getPrevented | public Set<Class<?>> getPrevented() {
if (this.prevent == null) {
return Collections.emptySet();
}
return Collections.unmodifiableSet(this.prevent);
} | java | public Set<Class<?>> getPrevented() {
if (this.prevent == null) {
return Collections.emptySet();
}
return Collections.unmodifiableSet(this.prevent);
} | [
"public",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"getPrevented",
"(",
")",
"{",
"if",
"(",
"this",
".",
"prevent",
"==",
"null",
")",
"{",
"return",
"Collections",
".",
"emptySet",
"(",
")",
";",
"}",
"return",
"Collections",
".",
"unmodifiableSet",
... | Gets the listener classes to which dispatching should be prevented while
this event is being dispatched.
@return The listener classes marked to prevent.
@see #preventCascade(Class) | [
"Gets",
"the",
"listener",
"classes",
"to",
"which",
"dispatching",
"should",
"be",
"prevented",
"while",
"this",
"event",
"is",
"being",
"dispatched",
"."
] | 42cc18947c9c8596c34410336e4e375e9fcd7c47 | https://github.com/skuzzle/jeve/blob/42cc18947c9c8596c34410336e4e375e9fcd7c47/jeve/src/main/java/de/skuzzle/jeve/SequentialEvent.java#L182-L187 | train |
Harium/keel | src/main/java/com/harium/keel/catalano/math/function/Gabor.java | Gabor.Function1D | public static double Function1D(double x, double mean, double amplitude, double position, double width, double phase, double frequency) {
double envelope = mean + amplitude * Math.exp(-Math.pow((x - position), 2) / Math.pow((2 * width), 2));
double carry = Math.cos(2 * Math.PI * frequency * (x - positio... | java | public static double Function1D(double x, double mean, double amplitude, double position, double width, double phase, double frequency) {
double envelope = mean + amplitude * Math.exp(-Math.pow((x - position), 2) / Math.pow((2 * width), 2));
double carry = Math.cos(2 * Math.PI * frequency * (x - positio... | [
"public",
"static",
"double",
"Function1D",
"(",
"double",
"x",
",",
"double",
"mean",
",",
"double",
"amplitude",
",",
"double",
"position",
",",
"double",
"width",
",",
"double",
"phase",
",",
"double",
"frequency",
")",
"{",
"double",
"envelope",
"=",
"... | 1-D Gabor function.
@param x Value.
@param mean Mean.
@param amplitude Amplitude.
@param position Position.
@param width Width.
@param phase Phase.
@param frequency Frequency.
@return Gabor response. | [
"1",
"-",
"D",
"Gabor",
"function",
"."
] | 0369ae674f9e664bccc5f9e161ae7e7a3b949a1e | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/function/Gabor.java#L78-L82 | train |
Harium/keel | src/main/java/com/harium/keel/catalano/math/function/Gabor.java | Gabor.Function2D | public static ComplexNumber Function2D(int x, int y, double wavelength, double orientation, double phaseOffset, double gaussVariance, double aspectRatio) {
double X = x * Math.cos(orientation) + y * Math.sin(orientation);
double Y = -x * Math.sin(orientation) + y * Math.cos(orientation);
doubl... | java | public static ComplexNumber Function2D(int x, int y, double wavelength, double orientation, double phaseOffset, double gaussVariance, double aspectRatio) {
double X = x * Math.cos(orientation) + y * Math.sin(orientation);
double Y = -x * Math.sin(orientation) + y * Math.cos(orientation);
doubl... | [
"public",
"static",
"ComplexNumber",
"Function2D",
"(",
"int",
"x",
",",
"int",
"y",
",",
"double",
"wavelength",
",",
"double",
"orientation",
",",
"double",
"phaseOffset",
",",
"double",
"gaussVariance",
",",
"double",
"aspectRatio",
")",
"{",
"double",
"X",... | 2-D Complex Gabor function.
@param x X axis coordinate.
@param y Y axis coordinate.
@param wavelength Wavelength.
@param orientation Orientation.
@param phaseOffset Phase offset.
@param gaussVariance Gaussian variance.
@param aspectRatio Aspect ratio.
@return Gabor response. | [
"2",
"-",
"D",
"Complex",
"Gabor",
"function",
"."
] | 0369ae674f9e664bccc5f9e161ae7e7a3b949a1e | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/function/Gabor.java#L96-L106 | train |
jclawson/hazeltask | hazeltask-core/src/main/java/com/hazeltask/executor/local/LocalTaskExecutorService.java | LocalTaskExecutorService.getOldestTaskCreatedTime | public Long getOldestTaskCreatedTime(){
Timer.Context ctx = getOldestTaskTimeTimer.time();
try {
long oldest = Long.MAX_VALUE;
/*
* I am asking this question first, because if I ask it after I could
* miss the oldest time if the oldest is polled and worked on
... | java | public Long getOldestTaskCreatedTime(){
Timer.Context ctx = getOldestTaskTimeTimer.time();
try {
long oldest = Long.MAX_VALUE;
/*
* I am asking this question first, because if I ask it after I could
* miss the oldest time if the oldest is polled and worked on
... | [
"public",
"Long",
"getOldestTaskCreatedTime",
"(",
")",
"{",
"Timer",
".",
"Context",
"ctx",
"=",
"getOldestTaskTimeTimer",
".",
"time",
"(",
")",
";",
"try",
"{",
"long",
"oldest",
"=",
"Long",
".",
"MAX_VALUE",
";",
"/*\n \t * I am asking this question fi... | We want to get the best result possible as this value
is used to determine what work needs to be recovered.
@return | [
"We",
"want",
"to",
"get",
"the",
"best",
"result",
"possible",
"as",
"this",
"value",
"is",
"used",
"to",
"determine",
"what",
"work",
"needs",
"to",
"be",
"recovered",
"."
] | 801162bc54c5f1d5744a28a2844b24289d9495d7 | https://github.com/jclawson/hazeltask/blob/801162bc54c5f1d5744a28a2844b24289d9495d7/hazeltask-core/src/main/java/com/hazeltask/executor/local/LocalTaskExecutorService.java#L180-L203 | train |
jclawson/hazeltask | hazeltask-core/src/main/java/com/hazeltask/executor/local/LocalTaskExecutorService.java | LocalTaskExecutorService.shutdownNow | @SuppressWarnings({ "unchecked", "rawtypes" })
public List<HazeltaskTask<G>> shutdownNow() {
return (List<HazeltaskTask<G>>) (List) localExecutorPool.shutdownNow();
} | java | @SuppressWarnings({ "unchecked", "rawtypes" })
public List<HazeltaskTask<G>> shutdownNow() {
return (List<HazeltaskTask<G>>) (List) localExecutorPool.shutdownNow();
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"public",
"List",
"<",
"HazeltaskTask",
"<",
"G",
">",
">",
"shutdownNow",
"(",
")",
"{",
"return",
"(",
"List",
"<",
"HazeltaskTask",
"<",
"G",
">",
">",
")",
"(",
"Lis... | SuppressWarnings I really want to return HazeltaskTasks instead of Runnable | [
"SuppressWarnings",
"I",
"really",
"want",
"to",
"return",
"HazeltaskTasks",
"instead",
"of",
"Runnable"
] | 801162bc54c5f1d5744a28a2844b24289d9495d7 | https://github.com/jclawson/hazeltask/blob/801162bc54c5f1d5744a28a2844b24289d9495d7/hazeltask-core/src/main/java/com/hazeltask/executor/local/LocalTaskExecutorService.java#L307-L310 | train |
jclawson/hazeltask | hazeltask-core/src/main/java/com/hazeltask/executor/metrics/ExecutorMetrics.java | ExecutorMetrics.registerCollectionSizeGauge | public void registerCollectionSizeGauge(
CollectionSizeGauge collectionSizeGauge) {
String name = createMetricName(LocalTaskExecutorService.class,
"queue-size");
metrics.register(name, collectionSizeGauge);
} | java | public void registerCollectionSizeGauge(
CollectionSizeGauge collectionSizeGauge) {
String name = createMetricName(LocalTaskExecutorService.class,
"queue-size");
metrics.register(name, collectionSizeGauge);
} | [
"public",
"void",
"registerCollectionSizeGauge",
"(",
"CollectionSizeGauge",
"collectionSizeGauge",
")",
"{",
"String",
"name",
"=",
"createMetricName",
"(",
"LocalTaskExecutorService",
".",
"class",
",",
"\"queue-size\"",
")",
";",
"metrics",
".",
"register",
"(",
"n... | Calling this twice will not actually overwrite the gauge
@param collectionSizeGauge | [
"Calling",
"this",
"twice",
"will",
"not",
"actually",
"overwrite",
"the",
"gauge"
] | 801162bc54c5f1d5744a28a2844b24289d9495d7 | https://github.com/jclawson/hazeltask/blob/801162bc54c5f1d5744a28a2844b24289d9495d7/hazeltask-core/src/main/java/com/hazeltask/executor/metrics/ExecutorMetrics.java#L238-L243 | train |
jclawson/hazeltask | hazeltask-core/src/main/java/com/hazeltask/config/ExecutorLoadBalancingConfig.java | ExecutorLoadBalancingConfig.useLoadBalancedEnumOrdinalPrioritizer | public ExecutorLoadBalancingConfig<GROUP> useLoadBalancedEnumOrdinalPrioritizer(Class<GROUP> groupClass) {
if(!groupClass.isEnum()) {
throw new IllegalArgumentException("The group class "+groupClass+" is not an enum");
}
groupPrioritizer = new LoadBalancedPriorityPrioritizer<GROUP>(n... | java | public ExecutorLoadBalancingConfig<GROUP> useLoadBalancedEnumOrdinalPrioritizer(Class<GROUP> groupClass) {
if(!groupClass.isEnum()) {
throw new IllegalArgumentException("The group class "+groupClass+" is not an enum");
}
groupPrioritizer = new LoadBalancedPriorityPrioritizer<GROUP>(n... | [
"public",
"ExecutorLoadBalancingConfig",
"<",
"GROUP",
">",
"useLoadBalancedEnumOrdinalPrioritizer",
"(",
"Class",
"<",
"GROUP",
">",
"groupClass",
")",
"{",
"if",
"(",
"!",
"groupClass",
".",
"isEnum",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException... | If you have priorities based on enums, this is the recommended prioritizer to use as it will prevent
starvation of low priority items
@param groupClass
@return | [
"If",
"you",
"have",
"priorities",
"based",
"on",
"enums",
"this",
"is",
"the",
"recommended",
"prioritizer",
"to",
"use",
"as",
"it",
"will",
"prevent",
"starvation",
"of",
"low",
"priority",
"items"
] | 801162bc54c5f1d5744a28a2844b24289d9495d7 | https://github.com/jclawson/hazeltask/blob/801162bc54c5f1d5744a28a2844b24289d9495d7/hazeltask-core/src/main/java/com/hazeltask/config/ExecutorLoadBalancingConfig.java#L53-L59 | train |
jclawson/hazeltask | hazeltask-core/src/main/java/com/hazeltask/config/defaults/ExecutorConfigs.java | ExecutorConfigs.basicGroupable | public static <GROUP extends Serializable> ExecutorConfig<GROUP> basicGroupable() {
return new ExecutorConfig<GROUP>()
.withTaskIdAdapter((TaskIdAdapter<Groupable<GROUP>, GROUP, ?>) new DefaultGroupableTaskIdAdapter<GROUP>());
} | java | public static <GROUP extends Serializable> ExecutorConfig<GROUP> basicGroupable() {
return new ExecutorConfig<GROUP>()
.withTaskIdAdapter((TaskIdAdapter<Groupable<GROUP>, GROUP, ?>) new DefaultGroupableTaskIdAdapter<GROUP>());
} | [
"public",
"static",
"<",
"GROUP",
"extends",
"Serializable",
">",
"ExecutorConfig",
"<",
"GROUP",
">",
"basicGroupable",
"(",
")",
"{",
"return",
"new",
"ExecutorConfig",
"<",
"GROUP",
">",
"(",
")",
".",
"withTaskIdAdapter",
"(",
"(",
"TaskIdAdapter",
"<",
... | This configuration requires that all your tasks you submit to the system implement
the Groupable interface. By default, it will round robin tasks from each group
Tasks will be tracked internally in the system by randomly generated UUIDs
@return | [
"This",
"configuration",
"requires",
"that",
"all",
"your",
"tasks",
"you",
"submit",
"to",
"the",
"system",
"implement",
"the",
"Groupable",
"interface",
".",
"By",
"default",
"it",
"will",
"round",
"robin",
"tasks",
"from",
"each",
"group"
] | 801162bc54c5f1d5744a28a2844b24289d9495d7 | https://github.com/jclawson/hazeltask/blob/801162bc54c5f1d5744a28a2844b24289d9495d7/hazeltask-core/src/main/java/com/hazeltask/config/defaults/ExecutorConfigs.java#L49-L52 | train |
jclawson/hazeltask | hazeltask-core/src/main/java/com/hazeltask/clusterop/ShutdownOp.java | ShutdownOp.call | public Collection<HazeltaskTask<GROUP>> call() throws Exception {
try {
if(isShutdownNow)
return this.getDistributedExecutorService().shutdownNowWithHazeltask();
else
this.getDistributedExecutorService().shutdown();
} catch(IllegalStateException e)... | java | public Collection<HazeltaskTask<GROUP>> call() throws Exception {
try {
if(isShutdownNow)
return this.getDistributedExecutorService().shutdownNowWithHazeltask();
else
this.getDistributedExecutorService().shutdown();
} catch(IllegalStateException e)... | [
"public",
"Collection",
"<",
"HazeltaskTask",
"<",
"GROUP",
">",
">",
"call",
"(",
")",
"throws",
"Exception",
"{",
"try",
"{",
"if",
"(",
"isShutdownNow",
")",
"return",
"this",
".",
"getDistributedExecutorService",
"(",
")",
".",
"shutdownNowWithHazeltask",
... | I promise that this is always a collection of HazeltaskTasks | [
"I",
"promise",
"that",
"this",
"is",
"always",
"a",
"collection",
"of",
"HazeltaskTasks"
] | 801162bc54c5f1d5744a28a2844b24289d9495d7 | https://github.com/jclawson/hazeltask/blob/801162bc54c5f1d5744a28a2844b24289d9495d7/hazeltask-core/src/main/java/com/hazeltask/clusterop/ShutdownOp.java#L29-L38 | train |
jclawson/hazeltask | hazeltask-core/src/main/java/com/hazeltask/hazelcast/MemberTasks.java | MemberTasks.executeOptimistic | public static <T> Collection<MemberResponse<T>> executeOptimistic(IExecutorService execSvc, Set<Member> members, Callable<T> callable) {
return executeOptimistic(execSvc, members, callable, 60, TimeUnit.SECONDS);
} | java | public static <T> Collection<MemberResponse<T>> executeOptimistic(IExecutorService execSvc, Set<Member> members, Callable<T> callable) {
return executeOptimistic(execSvc, members, callable, 60, TimeUnit.SECONDS);
} | [
"public",
"static",
"<",
"T",
">",
"Collection",
"<",
"MemberResponse",
"<",
"T",
">",
">",
"executeOptimistic",
"(",
"IExecutorService",
"execSvc",
",",
"Set",
"<",
"Member",
">",
"members",
",",
"Callable",
"<",
"T",
">",
"callable",
")",
"{",
"return",
... | Will wait a maximum of 1 minute for each node to response with their result. If an error occurs on any
member, we will always attempt to continue execution and collect as many results as possible.
@param execSvc
@param members
@param callable
@return | [
"Will",
"wait",
"a",
"maximum",
"of",
"1",
"minute",
"for",
"each",
"node",
"to",
"response",
"with",
"their",
"result",
".",
"If",
"an",
"error",
"occurs",
"on",
"any",
"member",
"we",
"will",
"always",
"attempt",
"to",
"continue",
"execution",
"and",
"... | 801162bc54c5f1d5744a28a2844b24289d9495d7 | https://github.com/jclawson/hazeltask/blob/801162bc54c5f1d5744a28a2844b24289d9495d7/hazeltask-core/src/main/java/com/hazeltask/hazelcast/MemberTasks.java#L53-L55 | train |
jclawson/hazeltask | hazeltask-core/src/main/java/com/hazeltask/hazelcast/MemberTasks.java | MemberTasks.executeOptimistic | public static <T> Collection<MemberResponse<T>> executeOptimistic(IExecutorService execSvc, Set<Member> members, Callable<T> callable, long maxWaitTime, TimeUnit unit) {
Collection<MemberResponse<T>> result = new ArrayList<MemberResponse<T>>(members.size());
Map<Member, Future<T>> resultFutures = execSv... | java | public static <T> Collection<MemberResponse<T>> executeOptimistic(IExecutorService execSvc, Set<Member> members, Callable<T> callable, long maxWaitTime, TimeUnit unit) {
Collection<MemberResponse<T>> result = new ArrayList<MemberResponse<T>>(members.size());
Map<Member, Future<T>> resultFutures = execSv... | [
"public",
"static",
"<",
"T",
">",
"Collection",
"<",
"MemberResponse",
"<",
"T",
">",
">",
"executeOptimistic",
"(",
"IExecutorService",
"execSvc",
",",
"Set",
"<",
"Member",
">",
"members",
",",
"Callable",
"<",
"T",
">",
"callable",
",",
"long",
"maxWai... | We will always try to gather as many results as possible and never throw an exception.
TODO: Make MemberResponse hold an exception that we can populate if something bad happens so we always
get to return something for a member in order to indicate a failure. Getting the result when there
is an error should throw an e... | [
"We",
"will",
"always",
"try",
"to",
"gather",
"as",
"many",
"results",
"as",
"possible",
"and",
"never",
"throw",
"an",
"exception",
"."
] | 801162bc54c5f1d5744a28a2844b24289d9495d7 | https://github.com/jclawson/hazeltask/blob/801162bc54c5f1d5744a28a2844b24289d9495d7/hazeltask-core/src/main/java/com/hazeltask/hazelcast/MemberTasks.java#L71-L107 | train |
jclawson/hazeltask | hazeltask-core/src/main/java/com/hazeltask/executor/DistributedFutureTracker.java | DistributedFutureTracker.createFuture | @SuppressWarnings("unchecked")
public <T> DistributedFuture<GROUP, T> createFuture(HazeltaskTask<GROUP> task) {
DistributedFuture<GROUP, T> future = new DistributedFuture<GROUP, T>(topologyService, task.getGroup(), task.getId());
this.futures.put(task.getId(), (DistributedFuture<GROUP, Serializable>... | java | @SuppressWarnings("unchecked")
public <T> DistributedFuture<GROUP, T> createFuture(HazeltaskTask<GROUP> task) {
DistributedFuture<GROUP, T> future = new DistributedFuture<GROUP, T>(topologyService, task.getGroup(), task.getId());
this.futures.put(task.getId(), (DistributedFuture<GROUP, Serializable>... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"DistributedFuture",
"<",
"GROUP",
",",
"T",
">",
"createFuture",
"(",
"HazeltaskTask",
"<",
"GROUP",
">",
"task",
")",
"{",
"DistributedFuture",
"<",
"GROUP",
",",
"T",
">",
"fut... | It is required that T be Serializable | [
"It",
"is",
"required",
"that",
"T",
"be",
"Serializable"
] | 801162bc54c5f1d5744a28a2844b24289d9495d7 | https://github.com/jclawson/hazeltask/blob/801162bc54c5f1d5744a28a2844b24289d9495d7/hazeltask-core/src/main/java/com/hazeltask/executor/DistributedFutureTracker.java#L70-L75 | train |
jclawson/hazeltask | hazeltask-core/src/main/java/com/hazeltask/executor/DistributedFutureTracker.java | DistributedFutureTracker.errorFuture | public void errorFuture(UUID taskId, Exception e) {
DistributedFuture<GROUP, Serializable> future = remove(taskId);
if(future != null) {
future.setException(e);
}
} | java | public void errorFuture(UUID taskId, Exception e) {
DistributedFuture<GROUP, Serializable> future = remove(taskId);
if(future != null) {
future.setException(e);
}
} | [
"public",
"void",
"errorFuture",
"(",
"UUID",
"taskId",
",",
"Exception",
"e",
")",
"{",
"DistributedFuture",
"<",
"GROUP",
",",
"Serializable",
">",
"future",
"=",
"remove",
"(",
"taskId",
")",
";",
"if",
"(",
"future",
"!=",
"null",
")",
"{",
"future",... | handles when a member leaves and hazelcast partition data is lost. We want
to find the Futures that are waiting on lost data and error them | [
"handles",
"when",
"a",
"member",
"leaves",
"and",
"hazelcast",
"partition",
"data",
"is",
"lost",
".",
"We",
"want",
"to",
"find",
"the",
"Futures",
"that",
"are",
"waiting",
"on",
"lost",
"data",
"and",
"error",
"them"
] | 801162bc54c5f1d5744a28a2844b24289d9495d7 | https://github.com/jclawson/hazeltask/blob/801162bc54c5f1d5744a28a2844b24289d9495d7/hazeltask-core/src/main/java/com/hazeltask/executor/DistributedFutureTracker.java#L116-L121 | train |
jclawson/hazeltask | hazeltask-core/src/main/java/com/hazeltask/core/concurrent/BackoffTimer.java | BackoffTimer.schedule | public void schedule(BackoffTask task, long initialDelay, long fixedDelay) {
synchronized (queue) {
start();
queue.put(new DelayedTimerTask(task, initialDelay, fixedDelay));
}
} | java | public void schedule(BackoffTask task, long initialDelay, long fixedDelay) {
synchronized (queue) {
start();
queue.put(new DelayedTimerTask(task, initialDelay, fixedDelay));
}
} | [
"public",
"void",
"schedule",
"(",
"BackoffTask",
"task",
",",
"long",
"initialDelay",
",",
"long",
"fixedDelay",
")",
"{",
"synchronized",
"(",
"queue",
")",
"{",
"start",
"(",
")",
";",
"queue",
".",
"put",
"(",
"new",
"DelayedTimerTask",
"(",
"task",
... | Schedules the task with a fixed delay period and an initialDelay period. This functions
like the normal java Timer.
@param task
@param initialDelay
@param fixedDelay | [
"Schedules",
"the",
"task",
"with",
"a",
"fixed",
"delay",
"period",
"and",
"an",
"initialDelay",
"period",
".",
"This",
"functions",
"like",
"the",
"normal",
"java",
"Timer",
"."
] | 801162bc54c5f1d5744a28a2844b24289d9495d7 | https://github.com/jclawson/hazeltask/blob/801162bc54c5f1d5744a28a2844b24289d9495d7/hazeltask-core/src/main/java/com/hazeltask/core/concurrent/BackoffTimer.java#L109-L114 | train |
jclawson/hazeltask | hazeltask-core/src/main/java/com/hazeltask/executor/HazelcastExecutorTopologyService.java | HazelcastExecutorTopologyService.addPendingTaskAsync | public Future<HazeltaskTask<GROUP>> addPendingTaskAsync(HazeltaskTask<GROUP> task) {
return pendingTask.putAsync(task.getId(), task);
} | java | public Future<HazeltaskTask<GROUP>> addPendingTaskAsync(HazeltaskTask<GROUP> task) {
return pendingTask.putAsync(task.getId(), task);
} | [
"public",
"Future",
"<",
"HazeltaskTask",
"<",
"GROUP",
">",
">",
"addPendingTaskAsync",
"(",
"HazeltaskTask",
"<",
"GROUP",
">",
"task",
")",
"{",
"return",
"pendingTask",
".",
"putAsync",
"(",
"task",
".",
"getId",
"(",
")",
",",
"task",
")",
";",
"}"
... | Asynchronously put the work into the pending map so we can work on submitting it to the worker
if we wanted. Could possibly cause duplicate work if we execute the work, then add to the map.
@param task
@return | [
"Asynchronously",
"put",
"the",
"work",
"into",
"the",
"pending",
"map",
"so",
"we",
"can",
"work",
"on",
"submitting",
"it",
"to",
"the",
"worker",
"if",
"we",
"wanted",
".",
"Could",
"possibly",
"cause",
"duplicate",
"work",
"if",
"we",
"execute",
"the",... | 801162bc54c5f1d5744a28a2844b24289d9495d7 | https://github.com/jclawson/hazeltask/blob/801162bc54c5f1d5744a28a2844b24289d9495d7/hazeltask-core/src/main/java/com/hazeltask/executor/HazelcastExecutorTopologyService.java#L154-L156 | train |
phax/ph-xmldsig | src/main/java/com/helger/xmldsig/XMLDSigCreator.java | XMLDSigCreator.applyXMLDSigAsFirstChild | public void applyXMLDSigAsFirstChild (@Nonnull final PrivateKey aPrivateKey,
@Nonnull final X509Certificate aCertificate,
@Nonnull final Document aDocument) throws Exception
{
ValueEnforcer.notNull (aPrivateKey, "privateKey");
Val... | java | public void applyXMLDSigAsFirstChild (@Nonnull final PrivateKey aPrivateKey,
@Nonnull final X509Certificate aCertificate,
@Nonnull final Document aDocument) throws Exception
{
ValueEnforcer.notNull (aPrivateKey, "privateKey");
Val... | [
"public",
"void",
"applyXMLDSigAsFirstChild",
"(",
"@",
"Nonnull",
"final",
"PrivateKey",
"aPrivateKey",
",",
"@",
"Nonnull",
"final",
"X509Certificate",
"aCertificate",
",",
"@",
"Nonnull",
"final",
"Document",
"aDocument",
")",
"throws",
"Exception",
"{",
"ValueEn... | Apply an XMLDSig onto the passed document.
@param aPrivateKey
The private key used for signing. May not be <code>null</code>.
@param aCertificate
The certificate to be used. May not be <code>null</code>.
@param aDocument
The document to be signed. The signature will always be the first
child element of the document el... | [
"Apply",
"an",
"XMLDSig",
"onto",
"the",
"passed",
"document",
"."
] | c00677fe3dac5aef0f3039b08a03e90052473952 | https://github.com/phax/ph-xmldsig/blob/c00677fe3dac5aef0f3039b08a03e90052473952/src/main/java/com/helger/xmldsig/XMLDSigCreator.java#L257-L289 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyMapUtils.java | MyMapUtils.rankMapOnIntegerValue | public static <K> Map<K, Integer> rankMapOnIntegerValue(Map<K, Integer> inputMap) {
Map<K, Integer> newMap = new TreeMap<K, Integer>(new IntegerValueComparator(inputMap));
newMap.putAll(inputMap);
Map<K, Integer> linkedMap = new LinkedHashMap<K, Integer>(newMap);
return linkedMap;
} | java | public static <K> Map<K, Integer> rankMapOnIntegerValue(Map<K, Integer> inputMap) {
Map<K, Integer> newMap = new TreeMap<K, Integer>(new IntegerValueComparator(inputMap));
newMap.putAll(inputMap);
Map<K, Integer> linkedMap = new LinkedHashMap<K, Integer>(newMap);
return linkedMap;
} | [
"public",
"static",
"<",
"K",
">",
"Map",
"<",
"K",
",",
"Integer",
">",
"rankMapOnIntegerValue",
"(",
"Map",
"<",
"K",
",",
"Integer",
">",
"inputMap",
")",
"{",
"Map",
"<",
"K",
",",
"Integer",
">",
"newMap",
"=",
"new",
"TreeMap",
"<",
"K",
",",... | Ranks a map based on integer values
@param inputMap Input
@return The ranked map | [
"Ranks",
"a",
"map",
"based",
"on",
"integer",
"values"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyMapUtils.java#L36-L42 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java | ZWaveController.handleIncomingMessage | private void handleIncomingMessage(SerialMessage incomingMessage) {
logger.debug("Incoming message to process");
logger.debug(incomingMessage.toString());
switch (incomingMessage.getMessageType()) {
case Request:
handleIncomingRequestMessage(incomingMessage);
break;
case Response:
handleIn... | java | private void handleIncomingMessage(SerialMessage incomingMessage) {
logger.debug("Incoming message to process");
logger.debug(incomingMessage.toString());
switch (incomingMessage.getMessageType()) {
case Request:
handleIncomingRequestMessage(incomingMessage);
break;
case Response:
handleIn... | [
"private",
"void",
"handleIncomingMessage",
"(",
"SerialMessage",
"incomingMessage",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Incoming message to process\"",
")",
";",
"logger",
".",
"debug",
"(",
"incomingMessage",
".",
"toString",
"(",
")",
")",
";",
"switch",
... | Handles incoming Serial Messages. Serial messages can either be messages
that are a response to our own requests, or the stick asking us information.
@param incomingMessage the incoming message to process. | [
"Handles",
"incoming",
"Serial",
"Messages",
".",
"Serial",
"messages",
"can",
"either",
"be",
"messages",
"that",
"are",
"a",
"response",
"to",
"our",
"own",
"requests",
"or",
"the",
"stick",
"asking",
"us",
"information",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L182-L197 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java | ZWaveController.handleIncomingRequestMessage | private void handleIncomingRequestMessage(SerialMessage incomingMessage) {
logger.debug("Message type = REQUEST");
switch (incomingMessage.getMessageClass()) {
case ApplicationCommandHandler:
handleApplicationCommandRequest(incomingMessage);
break;
case SendData:
handleSendDataRequest(incomingMess... | java | private void handleIncomingRequestMessage(SerialMessage incomingMessage) {
logger.debug("Message type = REQUEST");
switch (incomingMessage.getMessageClass()) {
case ApplicationCommandHandler:
handleApplicationCommandRequest(incomingMessage);
break;
case SendData:
handleSendDataRequest(incomingMess... | [
"private",
"void",
"handleIncomingRequestMessage",
"(",
"SerialMessage",
"incomingMessage",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Message type = REQUEST\"",
")",
";",
"switch",
"(",
"incomingMessage",
".",
"getMessageClass",
"(",
")",
")",
"{",
"case",
"Applicat... | Handles an incoming request message.
An incoming request message is a message initiated by a node or the controller.
@param incomingMessage the incoming message to process. | [
"Handles",
"an",
"incoming",
"request",
"message",
".",
"An",
"incoming",
"request",
"message",
"is",
"a",
"message",
"initiated",
"by",
"a",
"node",
"or",
"the",
"controller",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L204-L222 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java | ZWaveController.handleApplicationCommandRequest | private void handleApplicationCommandRequest(SerialMessage incomingMessage) {
logger.trace("Handle Message Application Command Request");
int nodeId = incomingMessage.getMessagePayloadByte(1);
logger.debug("Application Command Request from Node " + nodeId);
ZWaveNode node = getNode(nodeId);
if (node == nul... | java | private void handleApplicationCommandRequest(SerialMessage incomingMessage) {
logger.trace("Handle Message Application Command Request");
int nodeId = incomingMessage.getMessagePayloadByte(1);
logger.debug("Application Command Request from Node " + nodeId);
ZWaveNode node = getNode(nodeId);
if (node == nul... | [
"private",
"void",
"handleApplicationCommandRequest",
"(",
"SerialMessage",
"incomingMessage",
")",
"{",
"logger",
".",
"trace",
"(",
"\"Handle Message Application Command Request\"",
")",
";",
"int",
"nodeId",
"=",
"incomingMessage",
".",
"getMessagePayloadByte",
"(",
"1... | Handles incoming Application Command Request.
@param incomingMessage the request message to process. | [
"Handles",
"incoming",
"Application",
"Command",
"Request",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L228-L266 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java | ZWaveController.handleSendDataRequest | private void handleSendDataRequest(SerialMessage incomingMessage) {
logger.trace("Handle Message Send Data Request");
int callbackId = incomingMessage.getMessagePayloadByte(0);
TransmissionState status = TransmissionState.getTransmissionState(incomingMessage.getMessagePayloadByte(1));
SerialMessage originalM... | java | private void handleSendDataRequest(SerialMessage incomingMessage) {
logger.trace("Handle Message Send Data Request");
int callbackId = incomingMessage.getMessagePayloadByte(0);
TransmissionState status = TransmissionState.getTransmissionState(incomingMessage.getMessagePayloadByte(1));
SerialMessage originalM... | [
"private",
"void",
"handleSendDataRequest",
"(",
"SerialMessage",
"incomingMessage",
")",
"{",
"logger",
".",
"trace",
"(",
"\"Handle Message Send Data Request\"",
")",
";",
"int",
"callbackId",
"=",
"incomingMessage",
".",
"getMessagePayloadByte",
"(",
"0",
")",
";",... | Handles incoming Send Data Request. Send Data request are used
to acknowledge or cancel failed messages.
@param incomingMessage the request message to process. | [
"Handles",
"incoming",
"Send",
"Data",
"Request",
".",
"Send",
"Data",
"request",
"are",
"used",
"to",
"acknowledge",
"or",
"cancel",
"failed",
"messages",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L273-L320 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java | ZWaveController.handleFailedSendDataRequest | private void handleFailedSendDataRequest(SerialMessage originalMessage) {
ZWaveNode node = this.getNode(originalMessage.getMessageNode());
if (node.getNodeStage() == NodeStage.NODEBUILDINFO_DEAD)
return;
if (!node.isListening() && originalMessage.getPriority() != SerialMessage.SerialMessagePriority.Low) ... | java | private void handleFailedSendDataRequest(SerialMessage originalMessage) {
ZWaveNode node = this.getNode(originalMessage.getMessageNode());
if (node.getNodeStage() == NodeStage.NODEBUILDINFO_DEAD)
return;
if (!node.isListening() && originalMessage.getPriority() != SerialMessage.SerialMessagePriority.Low) ... | [
"private",
"void",
"handleFailedSendDataRequest",
"(",
"SerialMessage",
"originalMessage",
")",
"{",
"ZWaveNode",
"node",
"=",
"this",
".",
"getNode",
"(",
"originalMessage",
".",
"getMessageNode",
"(",
")",
")",
";",
"if",
"(",
"node",
".",
"getNodeStage",
"(",... | Handles a failed SendData request. This can either be because of the stick actively reporting it
or because of a time-out of the transaction in the send thread.
@param originalMessage the original message that was sent | [
"Handles",
"a",
"failed",
"SendData",
"request",
".",
"This",
"can",
"either",
"be",
"because",
"of",
"the",
"stick",
"actively",
"reporting",
"it",
"or",
"because",
"of",
"a",
"time",
"-",
"out",
"of",
"the",
"transaction",
"in",
"the",
"send",
"thread",
... | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L327-L348 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java | ZWaveController.handleApplicationUpdateRequest | private void handleApplicationUpdateRequest(SerialMessage incomingMessage) {
logger.trace("Handle Message Application Update Request");
int nodeId = incomingMessage.getMessagePayloadByte(1);
logger.trace("Application Update Request from Node " + nodeId);
UpdateState updateState = UpdateState.getUpdateState(i... | java | private void handleApplicationUpdateRequest(SerialMessage incomingMessage) {
logger.trace("Handle Message Application Update Request");
int nodeId = incomingMessage.getMessagePayloadByte(1);
logger.trace("Application Update Request from Node " + nodeId);
UpdateState updateState = UpdateState.getUpdateState(i... | [
"private",
"void",
"handleApplicationUpdateRequest",
"(",
"SerialMessage",
"incomingMessage",
")",
"{",
"logger",
".",
"trace",
"(",
"\"Handle Message Application Update Request\"",
")",
";",
"int",
"nodeId",
"=",
"incomingMessage",
".",
"getMessagePayloadByte",
"(",
"1",... | Handles incoming Application Update Request.
@param incomingMessage the request message to process. | [
"Handles",
"incoming",
"Application",
"Update",
"Request",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L354-L412 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java | ZWaveController.handleGetVersionResponse | private void handleGetVersionResponse(SerialMessage incomingMessage) {
this.ZWaveLibraryType = incomingMessage.getMessagePayloadByte(12);
this.zWaveVersion = new String(ArrayUtils.subarray(incomingMessage.getMessagePayload(), 0, 11));
logger.debug(String.format("Got MessageGetVersion response. Version = %s, Libra... | java | private void handleGetVersionResponse(SerialMessage incomingMessage) {
this.ZWaveLibraryType = incomingMessage.getMessagePayloadByte(12);
this.zWaveVersion = new String(ArrayUtils.subarray(incomingMessage.getMessagePayload(), 0, 11));
logger.debug(String.format("Got MessageGetVersion response. Version = %s, Libra... | [
"private",
"void",
"handleGetVersionResponse",
"(",
"SerialMessage",
"incomingMessage",
")",
"{",
"this",
".",
"ZWaveLibraryType",
"=",
"incomingMessage",
".",
"getMessagePayloadByte",
"(",
"12",
")",
";",
"this",
".",
"zWaveVersion",
"=",
"new",
"String",
"(",
"A... | Handles the response of the getVersion request.
@param incomingMessage the response message to process. | [
"Handles",
"the",
"response",
"of",
"the",
"getVersion",
"request",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L480-L484 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java | ZWaveController.handleSerialApiGetInitDataResponse | private void handleSerialApiGetInitDataResponse(
SerialMessage incomingMessage) {
logger.debug(String.format("Got MessageSerialApiGetInitData response."));
this.isConnected = true;
int nodeBytes = incomingMessage.getMessagePayloadByte(2);
if (nodeBytes != NODE_BYTES) {
logger.error("Invalid number of n... | java | private void handleSerialApiGetInitDataResponse(
SerialMessage incomingMessage) {
logger.debug(String.format("Got MessageSerialApiGetInitData response."));
this.isConnected = true;
int nodeBytes = incomingMessage.getMessagePayloadByte(2);
if (nodeBytes != NODE_BYTES) {
logger.error("Invalid number of n... | [
"private",
"void",
"handleSerialApiGetInitDataResponse",
"(",
"SerialMessage",
"incomingMessage",
")",
"{",
"logger",
".",
"debug",
"(",
"String",
".",
"format",
"(",
"\"Got MessageSerialApiGetInitData response.\"",
")",
")",
";",
"this",
".",
"isConnected",
"=",
"tru... | Handles the response of the SerialApiGetInitData request.
@param incomingMlivessage the response message to process. | [
"Handles",
"the",
"response",
"of",
"the",
"SerialApiGetInitData",
"request",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L490-L525 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java | ZWaveController.handleMemoryGetId | private void handleMemoryGetId(SerialMessage incomingMessage) {
this.homeId = ((incomingMessage.getMessagePayloadByte(0)) << 24) |
((incomingMessage.getMessagePayloadByte(1)) << 16) |
((incomingMessage.getMessagePayloadByte(2)) << 8) |
(incomingMessage.getMessagePayloadByte(3));
this.ownNodeId = inco... | java | private void handleMemoryGetId(SerialMessage incomingMessage) {
this.homeId = ((incomingMessage.getMessagePayloadByte(0)) << 24) |
((incomingMessage.getMessagePayloadByte(1)) << 16) |
((incomingMessage.getMessagePayloadByte(2)) << 8) |
(incomingMessage.getMessagePayloadByte(3));
this.ownNodeId = inco... | [
"private",
"void",
"handleMemoryGetId",
"(",
"SerialMessage",
"incomingMessage",
")",
"{",
"this",
".",
"homeId",
"=",
"(",
"(",
"incomingMessage",
".",
"getMessagePayloadByte",
"(",
"0",
")",
")",
"<<",
"24",
")",
"|",
"(",
"(",
"incomingMessage",
".",
"get... | Handles the response of the MemoryGetId request.
The MemoryGetId function gets the home and node id from the controller memory.
@param incomingMessage the response message to process. | [
"Handles",
"the",
"response",
"of",
"the",
"MemoryGetId",
"request",
".",
"The",
"MemoryGetId",
"function",
"gets",
"the",
"home",
"and",
"node",
"id",
"from",
"the",
"controller",
"memory",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L532-L539 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java | ZWaveController.handleSerialAPIGetCapabilitiesResponse | private void handleSerialAPIGetCapabilitiesResponse(SerialMessage incomingMessage) {
logger.trace("Handle Message Serial API Get Capabilities");
this.serialAPIVersion = String.format("%d.%d", incomingMessage.getMessagePayloadByte(0), incomingMessage.getMessagePayloadByte(1));
this.manufactureId = ((incomingMessa... | java | private void handleSerialAPIGetCapabilitiesResponse(SerialMessage incomingMessage) {
logger.trace("Handle Message Serial API Get Capabilities");
this.serialAPIVersion = String.format("%d.%d", incomingMessage.getMessagePayloadByte(0), incomingMessage.getMessagePayloadByte(1));
this.manufactureId = ((incomingMessa... | [
"private",
"void",
"handleSerialAPIGetCapabilitiesResponse",
"(",
"SerialMessage",
"incomingMessage",
")",
"{",
"logger",
".",
"trace",
"(",
"\"Handle Message Serial API Get Capabilities\"",
")",
";",
"this",
".",
"serialAPIVersion",
"=",
"String",
".",
"format",
"(",
"... | Handles the response of the SerialAPIGetCapabilities request.
@param incomingMessage the response message to process. | [
"Handles",
"the",
"response",
"of",
"the",
"SerialAPIGetCapabilities",
"request",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L615-L630 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java | ZWaveController.handleSendDataResponse | private void handleSendDataResponse(SerialMessage incomingMessage) {
logger.trace("Handle Message Send Data Response");
if(incomingMessage.getMessageBuffer()[2] != 0x00)
logger.debug("Sent Data successfully placed on stack.");
else
logger.error("Sent Data was not placed on stack due to error.");
} | java | private void handleSendDataResponse(SerialMessage incomingMessage) {
logger.trace("Handle Message Send Data Response");
if(incomingMessage.getMessageBuffer()[2] != 0x00)
logger.debug("Sent Data successfully placed on stack.");
else
logger.error("Sent Data was not placed on stack due to error.");
} | [
"private",
"void",
"handleSendDataResponse",
"(",
"SerialMessage",
"incomingMessage",
")",
"{",
"logger",
".",
"trace",
"(",
"\"Handle Message Send Data Response\"",
")",
";",
"if",
"(",
"incomingMessage",
".",
"getMessageBuffer",
"(",
")",
"[",
"2",
"]",
"!=",
"0... | Handles the response of the SendData request.
@param incomingMessage the response message to process. | [
"Handles",
"the",
"response",
"of",
"the",
"SendData",
"request",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L636-L642 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java | ZWaveController.handleRequestNodeInfoResponse | private void handleRequestNodeInfoResponse(SerialMessage incomingMessage) {
logger.trace("Handle RequestNodeInfo Response");
if(incomingMessage.getMessageBuffer()[2] != 0x00)
logger.debug("Request node info successfully placed on stack.");
else
logger.error("Request node info not placed on stack due to erro... | java | private void handleRequestNodeInfoResponse(SerialMessage incomingMessage) {
logger.trace("Handle RequestNodeInfo Response");
if(incomingMessage.getMessageBuffer()[2] != 0x00)
logger.debug("Request node info successfully placed on stack.");
else
logger.error("Request node info not placed on stack due to erro... | [
"private",
"void",
"handleRequestNodeInfoResponse",
"(",
"SerialMessage",
"incomingMessage",
")",
"{",
"logger",
".",
"trace",
"(",
"\"Handle RequestNodeInfo Response\"",
")",
";",
"if",
"(",
"incomingMessage",
".",
"getMessageBuffer",
"(",
")",
"[",
"2",
"]",
"!=",... | Handles the response of the Request node request.
@param incomingMessage the response message to process. | [
"Handles",
"the",
"response",
"of",
"the",
"Request",
"node",
"request",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L648-L654 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java | ZWaveController.connect | public void connect(final String serialPortName)
throws SerialInterfaceException {
logger.info("Connecting to serial port {}", serialPortName);
try {
CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(serialPortName);
CommPort commPort = portIdentifier.open("org.openhab.binding.zwave"... | java | public void connect(final String serialPortName)
throws SerialInterfaceException {
logger.info("Connecting to serial port {}", serialPortName);
try {
CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(serialPortName);
CommPort commPort = portIdentifier.open("org.openhab.binding.zwave"... | [
"public",
"void",
"connect",
"(",
"final",
"String",
"serialPortName",
")",
"throws",
"SerialInterfaceException",
"{",
"logger",
".",
"info",
"(",
"\"Connecting to serial port {}\"",
",",
"serialPortName",
")",
";",
"try",
"{",
"CommPortIdentifier",
"portIdentifier",
... | Connects to the comm port and starts send and receive threads.
@param serialPortName the port name to open
@throws SerialInterfaceException when a connection error occurs. | [
"Connects",
"to",
"the",
"comm",
"port",
"and",
"starts",
"send",
"and",
"receive",
"threads",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L663-L689 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java | ZWaveController.close | public void close() {
if (watchdog != null) {
watchdog.cancel();
watchdog = null;
}
disconnect();
// clear nodes collection and send queue
for (Object listener : this.zwaveEventListeners.toArray()) {
if (!(listener instanceof ZWaveNode))
continue;
this.zwaveEventListeners.remove(list... | java | public void close() {
if (watchdog != null) {
watchdog.cancel();
watchdog = null;
}
disconnect();
// clear nodes collection and send queue
for (Object listener : this.zwaveEventListeners.toArray()) {
if (!(listener instanceof ZWaveNode))
continue;
this.zwaveEventListeners.remove(list... | [
"public",
"void",
"close",
"(",
")",
"{",
"if",
"(",
"watchdog",
"!=",
"null",
")",
"{",
"watchdog",
".",
"cancel",
"(",
")",
";",
"watchdog",
"=",
"null",
";",
"}",
"disconnect",
"(",
")",
";",
"// clear nodes collection and send queue",
"for",
"(",
"Ob... | Closes the connection to the Z-Wave controller. | [
"Closes",
"the",
"connection",
"to",
"the",
"Z",
"-",
"Wave",
"controller",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L694-L714 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java | ZWaveController.disconnect | public void disconnect() {
if (sendThread != null) {
sendThread.interrupt();
try {
sendThread.join();
} catch (InterruptedException e) {
}
sendThread = null;
}
if (receiveThread != null) {
receiveThread.interrupt();
try {
receiveThread.join();
} catch (InterruptedException e) {
... | java | public void disconnect() {
if (sendThread != null) {
sendThread.interrupt();
try {
sendThread.join();
} catch (InterruptedException e) {
}
sendThread = null;
}
if (receiveThread != null) {
receiveThread.interrupt();
try {
receiveThread.join();
} catch (InterruptedException e) {
... | [
"public",
"void",
"disconnect",
"(",
")",
"{",
"if",
"(",
"sendThread",
"!=",
"null",
")",
"{",
"sendThread",
".",
"interrupt",
"(",
")",
";",
"try",
"{",
"sendThread",
".",
"join",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
... | Disconnects from the serial interface and stops
send and receive threads. | [
"Disconnects",
"from",
"the",
"serial",
"interface",
"and",
"stops",
"send",
"and",
"receive",
"threads",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L720-L747 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java | ZWaveController.enqueue | public void enqueue(SerialMessage serialMessage) {
this.sendQueue.add(serialMessage);
logger.debug("Enqueueing message. Queue length = {}", this.sendQueue.size());
} | java | public void enqueue(SerialMessage serialMessage) {
this.sendQueue.add(serialMessage);
logger.debug("Enqueueing message. Queue length = {}", this.sendQueue.size());
} | [
"public",
"void",
"enqueue",
"(",
"SerialMessage",
"serialMessage",
")",
"{",
"this",
".",
"sendQueue",
".",
"add",
"(",
"serialMessage",
")",
";",
"logger",
".",
"debug",
"(",
"\"Enqueueing message. Queue length = {}\"",
",",
"this",
".",
"sendQueue",
".",
"siz... | Enqueues a message for sending on the send thread.
@param serialMessage the serial message to enqueue. | [
"Enqueues",
"a",
"message",
"for",
"sending",
"on",
"the",
"send",
"thread",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L753-L756 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java | ZWaveController.notifyEventListeners | public void notifyEventListeners(ZWaveEvent event) {
logger.debug("Notifying event listeners");
for (ZWaveEventListener listener : this.zwaveEventListeners) {
logger.trace("Notifying {}", listener.toString());
listener.ZWaveIncomingEvent(event);
}
} | java | public void notifyEventListeners(ZWaveEvent event) {
logger.debug("Notifying event listeners");
for (ZWaveEventListener listener : this.zwaveEventListeners) {
logger.trace("Notifying {}", listener.toString());
listener.ZWaveIncomingEvent(event);
}
} | [
"public",
"void",
"notifyEventListeners",
"(",
"ZWaveEvent",
"event",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Notifying event listeners\"",
")",
";",
"for",
"(",
"ZWaveEventListener",
"listener",
":",
"this",
".",
"zwaveEventListeners",
")",
"{",
"logger",
".",
... | Notify our own event listeners of a Z-Wave event.
@param event the event to send. | [
"Notify",
"our",
"own",
"event",
"listeners",
"of",
"a",
"Z",
"-",
"Wave",
"event",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L762-L768 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java | ZWaveController.initialize | public void initialize() {
this.enqueue(new SerialMessage(SerialMessage.SerialMessageClass.GetVersion, SerialMessage.SerialMessageType.Request, SerialMessage.SerialMessageClass.GetVersion, SerialMessage.SerialMessagePriority.High));
this.enqueue(new SerialMessage(SerialMessage.SerialMessageClass.MemoryGetId, Serial... | java | public void initialize() {
this.enqueue(new SerialMessage(SerialMessage.SerialMessageClass.GetVersion, SerialMessage.SerialMessageType.Request, SerialMessage.SerialMessageClass.GetVersion, SerialMessage.SerialMessagePriority.High));
this.enqueue(new SerialMessage(SerialMessage.SerialMessageClass.MemoryGetId, Serial... | [
"public",
"void",
"initialize",
"(",
")",
"{",
"this",
".",
"enqueue",
"(",
"new",
"SerialMessage",
"(",
"SerialMessage",
".",
"SerialMessageClass",
".",
"GetVersion",
",",
"SerialMessage",
".",
"SerialMessageType",
".",
"Request",
",",
"SerialMessage",
".",
"Se... | Initializes communication with the Z-Wave controller stick. | [
"Initializes",
"communication",
"with",
"the",
"Z",
"-",
"Wave",
"controller",
"stick",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L773-L777 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java | ZWaveController.identifyNode | public void identifyNode(int nodeId) throws SerialInterfaceException {
SerialMessage newMessage = new SerialMessage(nodeId, SerialMessage.SerialMessageClass.IdentifyNode, SerialMessage.SerialMessageType.Request, SerialMessage.SerialMessageClass.IdentifyNode, SerialMessage.SerialMessagePriority.High);
byte[] newP... | java | public void identifyNode(int nodeId) throws SerialInterfaceException {
SerialMessage newMessage = new SerialMessage(nodeId, SerialMessage.SerialMessageClass.IdentifyNode, SerialMessage.SerialMessageType.Request, SerialMessage.SerialMessageClass.IdentifyNode, SerialMessage.SerialMessagePriority.High);
byte[] newP... | [
"public",
"void",
"identifyNode",
"(",
"int",
"nodeId",
")",
"throws",
"SerialInterfaceException",
"{",
"SerialMessage",
"newMessage",
"=",
"new",
"SerialMessage",
"(",
"nodeId",
",",
"SerialMessage",
".",
"SerialMessageClass",
".",
"IdentifyNode",
",",
"SerialMessage... | Send Identify Node message to the controller.
@param nodeId the nodeId of the node to identify
@throws SerialInterfaceException when timing out or getting an invalid response. | [
"Send",
"Identify",
"Node",
"message",
"to",
"the",
"controller",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L784-L789 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java | ZWaveController.requestNodeInfo | public void requestNodeInfo(int nodeId) {
SerialMessage newMessage = new SerialMessage(nodeId, SerialMessage.SerialMessageClass.RequestNodeInfo, SerialMessage.SerialMessageType.Request, SerialMessage.SerialMessageClass.ApplicationUpdate, SerialMessage.SerialMessagePriority.High);
byte[] newPayload = { (byte) nod... | java | public void requestNodeInfo(int nodeId) {
SerialMessage newMessage = new SerialMessage(nodeId, SerialMessage.SerialMessageClass.RequestNodeInfo, SerialMessage.SerialMessageType.Request, SerialMessage.SerialMessageClass.ApplicationUpdate, SerialMessage.SerialMessagePriority.High);
byte[] newPayload = { (byte) nod... | [
"public",
"void",
"requestNodeInfo",
"(",
"int",
"nodeId",
")",
"{",
"SerialMessage",
"newMessage",
"=",
"new",
"SerialMessage",
"(",
"nodeId",
",",
"SerialMessage",
".",
"SerialMessageClass",
".",
"RequestNodeInfo",
",",
"SerialMessage",
".",
"SerialMessageType",
"... | Send Request Node info message to the controller.
@param nodeId the nodeId of the node to identify
@throws SerialInterfaceException when timing out or getting an invalid response. | [
"Send",
"Request",
"Node",
"info",
"message",
"to",
"the",
"controller",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L796-L801 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java | ZWaveController.sendData | public void sendData(SerialMessage serialMessage)
{
if (serialMessage.getMessageClass() != SerialMessage.SerialMessageClass.SendData) {
logger.error(String.format("Invalid message class %s (0x%02X) for sendData", serialMessage.getMessageClass().getLabel(), serialMessage.getMessageClass().getKey()));
r... | java | public void sendData(SerialMessage serialMessage)
{
if (serialMessage.getMessageClass() != SerialMessage.SerialMessageClass.SendData) {
logger.error(String.format("Invalid message class %s (0x%02X) for sendData", serialMessage.getMessageClass().getLabel(), serialMessage.getMessageClass().getKey()));
r... | [
"public",
"void",
"sendData",
"(",
"SerialMessage",
"serialMessage",
")",
"{",
"if",
"(",
"serialMessage",
".",
"getMessageClass",
"(",
")",
"!=",
"SerialMessage",
".",
"SerialMessageClass",
".",
"SendData",
")",
"{",
"logger",
".",
"error",
"(",
"String",
"."... | Transmits the SerialMessage to a single Z-Wave Node.
Sets the transmission options as well.
@param serialMessage the Serial message to send. | [
"Transmits",
"the",
"SerialMessage",
"to",
"a",
"single",
"Z",
"-",
"Wave",
"Node",
".",
"Sets",
"the",
"transmission",
"options",
"as",
"well",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L959-L992 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java | ZWaveController.sendValue | public void sendValue(int nodeId, int endpoint, int value) {
ZWaveNode node = this.getNode(nodeId);
ZWaveSetCommands zwaveCommandClass = null;
SerialMessage serialMessage = null;
for (ZWaveCommandClass.CommandClass commandClass : new ZWaveCommandClass.CommandClass[] { ZWaveCommandClass.CommandClass.SWITCH_MU... | java | public void sendValue(int nodeId, int endpoint, int value) {
ZWaveNode node = this.getNode(nodeId);
ZWaveSetCommands zwaveCommandClass = null;
SerialMessage serialMessage = null;
for (ZWaveCommandClass.CommandClass commandClass : new ZWaveCommandClass.CommandClass[] { ZWaveCommandClass.CommandClass.SWITCH_MU... | [
"public",
"void",
"sendValue",
"(",
"int",
"nodeId",
",",
"int",
"endpoint",
",",
"int",
"value",
")",
"{",
"ZWaveNode",
"node",
"=",
"this",
".",
"getNode",
"(",
"nodeId",
")",
";",
"ZWaveSetCommands",
"zwaveCommandClass",
"=",
"null",
";",
"SerialMessage",... | Send value to node.
@param nodeId the node Id to send the value to.
@param endpoint the endpoint to send the value to.
@param value the value to send | [
"Send",
"value",
"to",
"node",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveController.java#L1000-L1024 | train |
ow2-chameleon/fuchsia | core/src/main/java/org/ow2/chameleon/fuchsia/core/component/DefaultImportationLinker.java | DefaultImportationLinker.processProperties | private void processProperties() {
state = true;
try {
importerServiceFilter = getFilter(importerServiceFilterProperty);
} catch (InvalidFilterException invalidFilterException) {
LOG.debug("The value of the Property " + FILTER_IMPORTERSERVICE_PROPERTY + " is invalid,"
... | java | private void processProperties() {
state = true;
try {
importerServiceFilter = getFilter(importerServiceFilterProperty);
} catch (InvalidFilterException invalidFilterException) {
LOG.debug("The value of the Property " + FILTER_IMPORTERSERVICE_PROPERTY + " is invalid,"
... | [
"private",
"void",
"processProperties",
"(",
")",
"{",
"state",
"=",
"true",
";",
"try",
"{",
"importerServiceFilter",
"=",
"getFilter",
"(",
"importerServiceFilterProperty",
")",
";",
"}",
"catch",
"(",
"InvalidFilterException",
"invalidFilterException",
")",
"{",
... | Get the filters ImporterServiceFilter and ImportDeclarationFilter from the properties, stop the instance if one of.
them is invalid. | [
"Get",
"the",
"filters",
"ImporterServiceFilter",
"and",
"ImportDeclarationFilter",
"from",
"the",
"properties",
"stop",
"the",
"instance",
"if",
"one",
"of",
".",
"them",
"is",
"invalid",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/core/src/main/java/org/ow2/chameleon/fuchsia/core/component/DefaultImportationLinker.java#L114-L133 | train |
ow2-chameleon/fuchsia | core/src/main/java/org/ow2/chameleon/fuchsia/core/component/DefaultImportationLinker.java | DefaultImportationLinker.modifiedImporterService | @Modified(id = "importerServices")
void modifiedImporterService(ServiceReference<ImporterService> serviceReference) {
try {
importersManager.modified(serviceReference);
} catch (InvalidFilterException invalidFilterException) {
LOG.error("The ServiceProperty \"" + TARGET_FILTE... | java | @Modified(id = "importerServices")
void modifiedImporterService(ServiceReference<ImporterService> serviceReference) {
try {
importersManager.modified(serviceReference);
} catch (InvalidFilterException invalidFilterException) {
LOG.error("The ServiceProperty \"" + TARGET_FILTE... | [
"@",
"Modified",
"(",
"id",
"=",
"\"importerServices\"",
")",
"void",
"modifiedImporterService",
"(",
"ServiceReference",
"<",
"ImporterService",
">",
"serviceReference",
")",
"{",
"try",
"{",
"importersManager",
".",
"modified",
"(",
"serviceReference",
")",
";",
... | Update the Target Filter of the ImporterService.
Apply the induce modifications on the links of the ImporterService
@param serviceReference | [
"Update",
"the",
"Target",
"Filter",
"of",
"the",
"ImporterService",
".",
"Apply",
"the",
"induce",
"modifications",
"on",
"the",
"links",
"of",
"the",
"ImporterService"
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/core/src/main/java/org/ow2/chameleon/fuchsia/core/component/DefaultImportationLinker.java#L185-L203 | train |
ow2-chameleon/fuchsia | exporters/json-rpc/src/main/java/org/ow2/chameleon/fuchsia/exporter/jsonrpc/JSONRPCExporter.java | JSONRPCExporter.unregisterAllServlets | private void unregisterAllServlets() {
for (String endpoint : registeredServlets) {
registeredServlets.remove(endpoint);
web.unregister(endpoint);
LOG.info("endpoint {} unregistered", endpoint);
}
} | java | private void unregisterAllServlets() {
for (String endpoint : registeredServlets) {
registeredServlets.remove(endpoint);
web.unregister(endpoint);
LOG.info("endpoint {} unregistered", endpoint);
}
} | [
"private",
"void",
"unregisterAllServlets",
"(",
")",
"{",
"for",
"(",
"String",
"endpoint",
":",
"registeredServlets",
")",
"{",
"registeredServlets",
".",
"remove",
"(",
"endpoint",
")",
";",
"web",
".",
"unregister",
"(",
"endpoint",
")",
";",
"LOG",
".",... | Unregister all servlets registered by this exporter. | [
"Unregister",
"all",
"servlets",
"registered",
"by",
"this",
"exporter",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/exporters/json-rpc/src/main/java/org/ow2/chameleon/fuchsia/exporter/jsonrpc/JSONRPCExporter.java#L161-L169 | train |
thorstenwagner/TraJ | src/main/java/de/biomedical_imaging/traJ/drift/StaticDriftCalculator.java | StaticDriftCalculator.calculateDrift | public double[] calculateDrift(ArrayList<T> tracks){
double[] result = new double[3];
double sumX =0;
double sumY = 0;
double sumZ = 0;
int N=0;
for(int i = 0; i < tracks.size(); i++){
T t = tracks.get(i);
TrajectoryValidIndexTimelagIterator it = new TrajectoryValidIndexTimelagIterator(t,1);
/... | java | public double[] calculateDrift(ArrayList<T> tracks){
double[] result = new double[3];
double sumX =0;
double sumY = 0;
double sumZ = 0;
int N=0;
for(int i = 0; i < tracks.size(); i++){
T t = tracks.get(i);
TrajectoryValidIndexTimelagIterator it = new TrajectoryValidIndexTimelagIterator(t,1);
/... | [
"public",
"double",
"[",
"]",
"calculateDrift",
"(",
"ArrayList",
"<",
"T",
">",
"tracks",
")",
"{",
"double",
"[",
"]",
"result",
"=",
"new",
"double",
"[",
"3",
"]",
";",
"double",
"sumX",
"=",
"0",
";",
"double",
"sumY",
"=",
"0",
";",
"double",... | Calculates the static drift. Static means, that the drift does not change direction or intensity over time.
@param tracks Tracks which seems to exhibit a local drift
@return The static drift over all trajectories | [
"Calculates",
"the",
"static",
"drift",
".",
"Static",
"means",
"that",
"the",
"drift",
"does",
"not",
"change",
"direction",
"or",
"intensity",
"over",
"time",
"."
] | 505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb | https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/drift/StaticDriftCalculator.java#L40-L64 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveEndpoint.java | ZWaveEndpoint.addCommandClass | public void addCommandClass(ZWaveCommandClass commandClass) {
ZWaveCommandClass.CommandClass key = commandClass.getCommandClass();
if (!supportedCommandClasses.containsKey(key)) {
supportedCommandClasses.put(key, commandClass);
}
} | java | public void addCommandClass(ZWaveCommandClass commandClass) {
ZWaveCommandClass.CommandClass key = commandClass.getCommandClass();
if (!supportedCommandClasses.containsKey(key)) {
supportedCommandClasses.put(key, commandClass);
}
} | [
"public",
"void",
"addCommandClass",
"(",
"ZWaveCommandClass",
"commandClass",
")",
"{",
"ZWaveCommandClass",
".",
"CommandClass",
"key",
"=",
"commandClass",
".",
"getCommandClass",
"(",
")",
";",
"if",
"(",
"!",
"supportedCommandClasses",
".",
"containsKey",
"(",
... | Adds a command class to the list of supported command classes by this
endpoint. Does nothing if command class is already added.
@param commandClass the command class instance to add. | [
"Adds",
"a",
"command",
"class",
"to",
"the",
"list",
"of",
"supported",
"command",
"classes",
"by",
"this",
"endpoint",
".",
"Does",
"nothing",
"if",
"command",
"class",
"is",
"already",
"added",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/protocol/ZWaveEndpoint.java#L112-L117 | train |
ow2-chameleon/fuchsia | core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/LinkerManagement.java | LinkerManagement.canBeLinked | public boolean canBeLinked(D declaration, ServiceReference<S> declarationBinderRef) {
// Evaluate the target filter of the ImporterService on the Declaration
Filter filter = bindersManager.getTargetFilter(declarationBinderRef);
return filter.matches(declaration.getMetadata());
} | java | public boolean canBeLinked(D declaration, ServiceReference<S> declarationBinderRef) {
// Evaluate the target filter of the ImporterService on the Declaration
Filter filter = bindersManager.getTargetFilter(declarationBinderRef);
return filter.matches(declaration.getMetadata());
} | [
"public",
"boolean",
"canBeLinked",
"(",
"D",
"declaration",
",",
"ServiceReference",
"<",
"S",
">",
"declarationBinderRef",
")",
"{",
"// Evaluate the target filter of the ImporterService on the Declaration",
"Filter",
"filter",
"=",
"bindersManager",
".",
"getTargetFilter",... | Return true if the Declaration can be linked to the ImporterService.
@param declaration The Declaration
@param declarationBinderRef The ServiceReference<ImporterService> of the ImporterService
@return true if the Declaration can be linked to the ImporterService | [
"Return",
"true",
"if",
"the",
"Declaration",
"can",
"be",
"linked",
"to",
"the",
"ImporterService",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/LinkerManagement.java#L53-L57 | train |
ow2-chameleon/fuchsia | core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/LinkerManagement.java | LinkerManagement.link | public boolean link(D declaration, ServiceReference<S> declarationBinderRef) {
S declarationBinder = bindersManager.getDeclarationBinder(declarationBinderRef);
LOG.debug(declaration + " match the filter of " + declarationBinder + " : bind them together");
declaration.bind(declarationBinderRef);
... | java | public boolean link(D declaration, ServiceReference<S> declarationBinderRef) {
S declarationBinder = bindersManager.getDeclarationBinder(declarationBinderRef);
LOG.debug(declaration + " match the filter of " + declarationBinder + " : bind them together");
declaration.bind(declarationBinderRef);
... | [
"public",
"boolean",
"link",
"(",
"D",
"declaration",
",",
"ServiceReference",
"<",
"S",
">",
"declarationBinderRef",
")",
"{",
"S",
"declarationBinder",
"=",
"bindersManager",
".",
"getDeclarationBinder",
"(",
"declarationBinderRef",
")",
";",
"LOG",
".",
"debug"... | Try to link the declaration with the importerService referenced by the ServiceReference,.
return true if they have been link together, false otherwise.
@param declaration The Declaration
@param declarationBinderRef The ServiceReference<S> of S
@return true if they have been link together, false otherwise. | [
"Try",
"to",
"link",
"the",
"declaration",
"with",
"the",
"importerService",
"referenced",
"by",
"the",
"ServiceReference",
".",
"return",
"true",
"if",
"they",
"have",
"been",
"link",
"together",
"false",
"otherwise",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/LinkerManagement.java#L67-L80 | train |
ow2-chameleon/fuchsia | core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/LinkerManagement.java | LinkerManagement.unlink | public boolean unlink(D declaration, ServiceReference<S> declarationBinderRef) {
S declarationBinder = bindersManager.getDeclarationBinder(declarationBinderRef);
try {
declarationBinder.removeDeclaration(declaration);
} catch (BinderException e) {
LOG.debug(declarationBin... | java | public boolean unlink(D declaration, ServiceReference<S> declarationBinderRef) {
S declarationBinder = bindersManager.getDeclarationBinder(declarationBinderRef);
try {
declarationBinder.removeDeclaration(declaration);
} catch (BinderException e) {
LOG.debug(declarationBin... | [
"public",
"boolean",
"unlink",
"(",
"D",
"declaration",
",",
"ServiceReference",
"<",
"S",
">",
"declarationBinderRef",
")",
"{",
"S",
"declarationBinder",
"=",
"bindersManager",
".",
"getDeclarationBinder",
"(",
"declarationBinderRef",
")",
";",
"try",
"{",
"decl... | Try to unlink the declaration from the importerService referenced by the ServiceReference,.
return true if they have been cleanly unlink, false otherwise.
@param declaration The Declaration
@param declarationBinderRef The ServiceReference of the ImporterService
@return true if they have been cleanly unlink, f... | [
"Try",
"to",
"unlink",
"the",
"declaration",
"from",
"the",
"importerService",
"referenced",
"by",
"the",
"ServiceReference",
".",
"return",
"true",
"if",
"they",
"have",
"been",
"cleanly",
"unlink",
"false",
"otherwise",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/LinkerManagement.java#L90-L103 | train |
before/quality-check | modules/quality-immutable-object/src/main/java/net/sf/qualitycheck/immutableobject/domain/Package.java | Package.removeLastDot | private static String removeLastDot(final String pkgName) {
return pkgName.charAt(pkgName.length() - 1) == Characters.DOT ? pkgName.substring(0, pkgName.length() - 1) : pkgName;
} | java | private static String removeLastDot(final String pkgName) {
return pkgName.charAt(pkgName.length() - 1) == Characters.DOT ? pkgName.substring(0, pkgName.length() - 1) : pkgName;
} | [
"private",
"static",
"String",
"removeLastDot",
"(",
"final",
"String",
"pkgName",
")",
"{",
"return",
"pkgName",
".",
"charAt",
"(",
"pkgName",
".",
"length",
"(",
")",
"-",
"1",
")",
"==",
"Characters",
".",
"DOT",
"?",
"pkgName",
".",
"substring",
"("... | Filters a dot at the end of the passed package name if present.
@param pkgName
a package name
@return a filtered package name | [
"Filters",
"a",
"dot",
"at",
"the",
"end",
"of",
"the",
"passed",
"package",
"name",
"if",
"present",
"."
] | a75c32c39434ddb1f89bece57acae0536724c15a | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-immutable-object/src/main/java/net/sf/qualitycheck/immutableobject/domain/Package.java#L51-L53 | train |
before/quality-check | modules/quality-immutable-object/src/main/java/net/sf/qualitycheck/immutableobject/util/SourceCodeFormatter.java | SourceCodeFormatter.findDefaultProperties | @Nonnull
private static Properties findDefaultProperties() {
final InputStream in = SourceCodeFormatter.class.getClassLoader().getResourceAsStream(DEFAULT_PROPERTIES_PATH);
final Properties p = new Properties();
try {
p.load(in);
} catch (final IOException e) {
throw new RuntimeException(String.format("C... | java | @Nonnull
private static Properties findDefaultProperties() {
final InputStream in = SourceCodeFormatter.class.getClassLoader().getResourceAsStream(DEFAULT_PROPERTIES_PATH);
final Properties p = new Properties();
try {
p.load(in);
} catch (final IOException e) {
throw new RuntimeException(String.format("C... | [
"@",
"Nonnull",
"private",
"static",
"Properties",
"findDefaultProperties",
"(",
")",
"{",
"final",
"InputStream",
"in",
"=",
"SourceCodeFormatter",
".",
"class",
".",
"getClassLoader",
"(",
")",
".",
"getResourceAsStream",
"(",
"DEFAULT_PROPERTIES_PATH",
")",
";",
... | Gets the default options to be passed when no custom properties are given.
@return properties with formatter options | [
"Gets",
"the",
"default",
"options",
"to",
"be",
"passed",
"when",
"no",
"custom",
"properties",
"are",
"given",
"."
] | a75c32c39434ddb1f89bece57acae0536724c15a | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-immutable-object/src/main/java/net/sf/qualitycheck/immutableobject/util/SourceCodeFormatter.java#L146-L156 | train |
before/quality-check | modules/quality-immutable-object/src/main/java/net/sf/qualitycheck/immutableobject/util/SourceCodeFormatter.java | SourceCodeFormatter.format | public static String format(final String code, final Properties options, final LineEnding lineEnding) {
Check.notEmpty(code, "code");
Check.notEmpty(options, "options");
Check.notNull(lineEnding, "lineEnding");
final CodeFormatter formatter = ToolFactory.createCodeFormatter(options);
final String lineSeparat... | java | public static String format(final String code, final Properties options, final LineEnding lineEnding) {
Check.notEmpty(code, "code");
Check.notEmpty(options, "options");
Check.notNull(lineEnding, "lineEnding");
final CodeFormatter formatter = ToolFactory.createCodeFormatter(options);
final String lineSeparat... | [
"public",
"static",
"String",
"format",
"(",
"final",
"String",
"code",
",",
"final",
"Properties",
"options",
",",
"final",
"LineEnding",
"lineEnding",
")",
"{",
"Check",
".",
"notEmpty",
"(",
"code",
",",
"\"code\"",
")",
";",
"Check",
".",
"notEmpty",
"... | Pretty prints the given source code.
@param code
source code to format
@param options
formatter options
@param lineEnding
desired line ending
@return formatted source code | [
"Pretty",
"prints",
"the",
"given",
"source",
"code",
"."
] | a75c32c39434ddb1f89bece57acae0536724c15a | https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-immutable-object/src/main/java/net/sf/qualitycheck/immutableobject/util/SourceCodeFormatter.java#L180-L208 | train |
ow2-chameleon/fuchsia | core/src/main/java/org/ow2/chameleon/fuchsia/core/component/DefaultExportationLinker.java | DefaultExportationLinker.processProperties | private void processProperties() {
state = true;
try {
exporterServiceFilter = getFilter(exporterServiceFilterProperty);
} catch (InvalidFilterException invalidFilterException) {
LOG.debug("The value of the Property " + FILTER_EXPORTERSERVICE_PROPERTY + " is invalid,"
... | java | private void processProperties() {
state = true;
try {
exporterServiceFilter = getFilter(exporterServiceFilterProperty);
} catch (InvalidFilterException invalidFilterException) {
LOG.debug("The value of the Property " + FILTER_EXPORTERSERVICE_PROPERTY + " is invalid,"
... | [
"private",
"void",
"processProperties",
"(",
")",
"{",
"state",
"=",
"true",
";",
"try",
"{",
"exporterServiceFilter",
"=",
"getFilter",
"(",
"exporterServiceFilterProperty",
")",
";",
"}",
"catch",
"(",
"InvalidFilterException",
"invalidFilterException",
")",
"{",
... | Get the filters ExporterServiceFilter and ExportDeclarationFilter from the properties, stop the instance if one of.
them is invalid. | [
"Get",
"the",
"filters",
"ExporterServiceFilter",
"and",
"ExportDeclarationFilter",
"from",
"the",
"properties",
"stop",
"the",
"instance",
"if",
"one",
"of",
".",
"them",
"is",
"invalid",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/core/src/main/java/org/ow2/chameleon/fuchsia/core/component/DefaultExportationLinker.java#L114-L133 | train |
ow2-chameleon/fuchsia | core/src/main/java/org/ow2/chameleon/fuchsia/core/component/DefaultExportationLinker.java | DefaultExportationLinker.modifiedExporterService | @Modified(id = "exporterServices")
void modifiedExporterService(ServiceReference<ExporterService> serviceReference) {
try {
exportersManager.modified(serviceReference);
} catch (InvalidFilterException invalidFilterException) {
LOG.error("The ServiceProperty \"" + TARGET_FILTE... | java | @Modified(id = "exporterServices")
void modifiedExporterService(ServiceReference<ExporterService> serviceReference) {
try {
exportersManager.modified(serviceReference);
} catch (InvalidFilterException invalidFilterException) {
LOG.error("The ServiceProperty \"" + TARGET_FILTE... | [
"@",
"Modified",
"(",
"id",
"=",
"\"exporterServices\"",
")",
"void",
"modifiedExporterService",
"(",
"ServiceReference",
"<",
"ExporterService",
">",
"serviceReference",
")",
"{",
"try",
"{",
"exportersManager",
".",
"modified",
"(",
"serviceReference",
")",
";",
... | Update the Target Filter of the ExporterService.
Apply the induce modifications on the links of the ExporterService
@param serviceReference | [
"Update",
"the",
"Target",
"Filter",
"of",
"the",
"ExporterService",
".",
"Apply",
"the",
"induce",
"modifications",
"on",
"the",
"links",
"of",
"the",
"ExporterService"
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/core/src/main/java/org/ow2/chameleon/fuchsia/core/component/DefaultExportationLinker.java#L185-L203 | train |
ow2-chameleon/fuchsia | bases/knx/calimero/src/main/java/tuwien/auto/calimero/datapoint/StateDP.java | StateDP.checkGAs | private void checkGAs(List l)
{
for (final Iterator i = l.iterator(); i.hasNext();)
if (!(i.next() instanceof GroupAddress))
throw new KNXIllegalArgumentException("not a group address list");
} | java | private void checkGAs(List l)
{
for (final Iterator i = l.iterator(); i.hasNext();)
if (!(i.next() instanceof GroupAddress))
throw new KNXIllegalArgumentException("not a group address list");
} | [
"private",
"void",
"checkGAs",
"(",
"List",
"l",
")",
"{",
"for",
"(",
"final",
"Iterator",
"i",
"=",
"l",
".",
"iterator",
"(",
")",
";",
"i",
".",
"hasNext",
"(",
")",
";",
")",
"if",
"(",
"!",
"(",
"i",
".",
"next",
"(",
")",
"instanceof",
... | iteration not synchronized | [
"iteration",
"not",
"synchronized"
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/datapoint/StateDP.java#L363-L368 | train |
thorstenwagner/TraJ | src/main/java/de/biomedical_imaging/traJ/simulation/SimulationUtil.java | SimulationUtil.addPositionNoise | public static Trajectory addPositionNoise(Trajectory t, double sd){
CentralRandomNumberGenerator r = CentralRandomNumberGenerator.getInstance();
Trajectory newt = new Trajectory(t.getDimension());
for(int i = 0; i < t.size(); i++){
newt.add(t.get(i));
for(int j = 1; j <= t.getDimension(); j++){
switc... | java | public static Trajectory addPositionNoise(Trajectory t, double sd){
CentralRandomNumberGenerator r = CentralRandomNumberGenerator.getInstance();
Trajectory newt = new Trajectory(t.getDimension());
for(int i = 0; i < t.size(); i++){
newt.add(t.get(i));
for(int j = 1; j <= t.getDimension(); j++){
switc... | [
"public",
"static",
"Trajectory",
"addPositionNoise",
"(",
"Trajectory",
"t",
",",
"double",
"sd",
")",
"{",
"CentralRandomNumberGenerator",
"r",
"=",
"CentralRandomNumberGenerator",
".",
"getInstance",
"(",
")",
";",
"Trajectory",
"newt",
"=",
"new",
"Trajectory",
... | Adds position noise to the trajectories
@param t
@param sd
@return trajectory with position noise | [
"Adds",
"position",
"noise",
"to",
"the",
"trajectories"
] | 505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb | https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/simulation/SimulationUtil.java#L45-L70 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveWakeUpCommandClass.java | ZWaveWakeUpCommandClass.getNoMoreInformationMessage | public SerialMessage getNoMoreInformationMessage() {
logger.debug("Creating new message for application command WAKE_UP_NO_MORE_INFORMATION for node {}", this.getNode().getNodeId());
SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessage.SerialMessageClass.SendData, SerialMessage.Seria... | java | public SerialMessage getNoMoreInformationMessage() {
logger.debug("Creating new message for application command WAKE_UP_NO_MORE_INFORMATION for node {}", this.getNode().getNodeId());
SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessage.SerialMessageClass.SendData, SerialMessage.Seria... | [
"public",
"SerialMessage",
"getNoMoreInformationMessage",
"(",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Creating new message for application command WAKE_UP_NO_MORE_INFORMATION for node {}\"",
",",
"this",
".",
"getNode",
"(",
")",
".",
"getNodeId",
"(",
")",
")",
";",
... | Gets a SerialMessage with the WAKE_UP_NO_MORE_INFORMATION command.
@return the serial message | [
"Gets",
"a",
"SerialMessage",
"with",
"the",
"WAKE_UP_NO_MORE_INFORMATION",
"command",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveWakeUpCommandClass.java#L225-L235 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveWakeUpCommandClass.java | ZWaveWakeUpCommandClass.putInWakeUpQueue | public void putInWakeUpQueue(SerialMessage serialMessage) {
if (this.wakeUpQueue.contains(serialMessage)) {
logger.debug("Message already on the wake-up queue for node {}. Discarding.", this.getNode().getNodeId());
return;
}
logger.debug("Putting message in wakeup queue for node {}.", this.getNode... | java | public void putInWakeUpQueue(SerialMessage serialMessage) {
if (this.wakeUpQueue.contains(serialMessage)) {
logger.debug("Message already on the wake-up queue for node {}. Discarding.", this.getNode().getNodeId());
return;
}
logger.debug("Putting message in wakeup queue for node {}.", this.getNode... | [
"public",
"void",
"putInWakeUpQueue",
"(",
"SerialMessage",
"serialMessage",
")",
"{",
"if",
"(",
"this",
".",
"wakeUpQueue",
".",
"contains",
"(",
"serialMessage",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Message already on the wake-up queue for node {}. Discar... | Puts a message in the wake-up queue of this node to send the message on wake-up.
@param serialMessage the message to put in the wake-up queue. | [
"Puts",
"a",
"message",
"in",
"the",
"wake",
"-",
"up",
"queue",
"of",
"this",
"node",
"to",
"send",
"the",
"message",
"on",
"wake",
"-",
"up",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveWakeUpCommandClass.java#L241-L249 | train |
ow2-chameleon/fuchsia | bases/protobuffer/cxf-protobuf/src/main/java/com/google/code/cxf/protobuf/SimpleRpcDispatcher.java | SimpleRpcDispatcher.resolveTargetMethod | protected Method resolveTargetMethod(Message message,
FieldDescriptor payloadField) {
Method targetMethod = fieldToMethod.get(payloadField);
if (targetMethod == null) {
// look up and cache target method; this block is called only once
//... | java | protected Method resolveTargetMethod(Message message,
FieldDescriptor payloadField) {
Method targetMethod = fieldToMethod.get(payloadField);
if (targetMethod == null) {
// look up and cache target method; this block is called only once
//... | [
"protected",
"Method",
"resolveTargetMethod",
"(",
"Message",
"message",
",",
"FieldDescriptor",
"payloadField",
")",
"{",
"Method",
"targetMethod",
"=",
"fieldToMethod",
".",
"get",
"(",
"payloadField",
")",
";",
"if",
"(",
"targetMethod",
"==",
"null",
")",
"{... | Find out which method to call on the service bean. | [
"Find",
"out",
"which",
"method",
"to",
"call",
"on",
"the",
"service",
"bean",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/protobuffer/cxf-protobuf/src/main/java/com/google/code/cxf/protobuf/SimpleRpcDispatcher.java#L106-L140 | train |
ow2-chameleon/fuchsia | bases/protobuffer/cxf-protobuf/src/main/java/com/google/code/cxf/protobuf/SimpleRpcDispatcher.java | SimpleRpcDispatcher.resolvePayloadField | protected FieldDescriptor resolvePayloadField(Message message) {
for (FieldDescriptor field : message.getDescriptorForType().getFields()) {
if (message.hasField(field)) {
return field;
}
}
throw new RuntimeException("No payload found in message " + messag... | java | protected FieldDescriptor resolvePayloadField(Message message) {
for (FieldDescriptor field : message.getDescriptorForType().getFields()) {
if (message.hasField(field)) {
return field;
}
}
throw new RuntimeException("No payload found in message " + messag... | [
"protected",
"FieldDescriptor",
"resolvePayloadField",
"(",
"Message",
"message",
")",
"{",
"for",
"(",
"FieldDescriptor",
"field",
":",
"message",
".",
"getDescriptorForType",
"(",
")",
".",
"getFields",
"(",
")",
")",
"{",
"if",
"(",
"message",
".",
"hasFiel... | Find out which field in the incoming message contains the payload that is.
delivered to the service method. | [
"Find",
"out",
"which",
"field",
"in",
"the",
"incoming",
"message",
"contains",
"the",
"payload",
"that",
"is",
".",
"delivered",
"to",
"the",
"service",
"method",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/protobuffer/cxf-protobuf/src/main/java/com/google/code/cxf/protobuf/SimpleRpcDispatcher.java#L146-L154 | train |
ow2-chameleon/fuchsia | core/src/main/java/org/ow2/chameleon/fuchsia/core/declaration/Status.java | Status.from | public static Status from(Set<ServiceReference> serviceReferencesBound, Set<ServiceReference> serviceReferencesHandled) {
if (serviceReferencesBound == null && serviceReferencesHandled == null) {
throw new IllegalArgumentException("Cannot create a status with serviceReferencesBound == null" +
... | java | public static Status from(Set<ServiceReference> serviceReferencesBound, Set<ServiceReference> serviceReferencesHandled) {
if (serviceReferencesBound == null && serviceReferencesHandled == null) {
throw new IllegalArgumentException("Cannot create a status with serviceReferencesBound == null" +
... | [
"public",
"static",
"Status",
"from",
"(",
"Set",
"<",
"ServiceReference",
">",
"serviceReferencesBound",
",",
"Set",
"<",
"ServiceReference",
">",
"serviceReferencesHandled",
")",
"{",
"if",
"(",
"serviceReferencesBound",
"==",
"null",
"&&",
"serviceReferencesHandled... | Creates a status instance from the given serviceReferences.
The given list is copied to a new set made immutable.
@param serviceReferencesBound the set of ServiceReference which are bound to the declaration.
@param serviceReferencesHandled the set of ServiceReference which are handling the declaration.
@return the n... | [
"Creates",
"a",
"status",
"instance",
"from",
"the",
"given",
"serviceReferences",
".",
"The",
"given",
"list",
"is",
"copied",
"to",
"a",
"new",
"set",
"made",
"immutable",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/core/src/main/java/org/ow2/chameleon/fuchsia/core/declaration/Status.java#L72-L82 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveBasicCommandClass.java | ZWaveBasicCommandClass.getValueMessage | public SerialMessage getValueMessage() {
logger.debug("Creating new message for application command BASIC_GET for node {}", this.getNode().getNodeId());
SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData, SerialMessageType.Request, SerialMessageClass.ApplicationComman... | java | public SerialMessage getValueMessage() {
logger.debug("Creating new message for application command BASIC_GET for node {}", this.getNode().getNodeId());
SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData, SerialMessageType.Request, SerialMessageClass.ApplicationComman... | [
"public",
"SerialMessage",
"getValueMessage",
"(",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Creating new message for application command BASIC_GET for node {}\"",
",",
"this",
".",
"getNode",
"(",
")",
".",
"getNodeId",
"(",
")",
")",
";",
"SerialMessage",
"result",
... | Gets a SerialMessage with the BASIC GET command
@return the serial message | [
"Gets",
"a",
"SerialMessage",
"with",
"the",
"BASIC",
"GET",
"command"
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveBasicCommandClass.java#L154-L163 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveBasicCommandClass.java | ZWaveBasicCommandClass.setValueMessage | public SerialMessage setValueMessage(int level) {
logger.debug("Creating new message for application command BASIC_SET for node {}", this.getNode().getNodeId());
SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData, SerialMessageType.Request, SerialMessageClass.SendData... | java | public SerialMessage setValueMessage(int level) {
logger.debug("Creating new message for application command BASIC_SET for node {}", this.getNode().getNodeId());
SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData, SerialMessageType.Request, SerialMessageClass.SendData... | [
"public",
"SerialMessage",
"setValueMessage",
"(",
"int",
"level",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Creating new message for application command BASIC_SET for node {}\"",
",",
"this",
".",
"getNode",
"(",
")",
".",
"getNodeId",
"(",
")",
")",
";",
"SerialMe... | Gets a SerialMessage with the BASIC SET command
@param the level to set.
@return the serial message | [
"Gets",
"a",
"SerialMessage",
"with",
"the",
"BASIC",
"SET",
"command"
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveBasicCommandClass.java#L170-L181 | train |
ow2-chameleon/fuchsia | bases/push/hub/src/main/java/org/ow2/chameleon/fuchsia/push/base/hub/impl/HubImpl.java | HubImpl.subscriptionRequestReceived | public void subscriptionRequestReceived(SubscriptionRequest sr) throws SubscriptionException {
LOG.info("Subscriber -> (Hub), new subscription request received.", sr.getCallback());
try {
verifySubscriberRequestedSubscription(sr);
if ("subscribe".equals(sr.getMode())) {
... | java | public void subscriptionRequestReceived(SubscriptionRequest sr) throws SubscriptionException {
LOG.info("Subscriber -> (Hub), new subscription request received.", sr.getCallback());
try {
verifySubscriberRequestedSubscription(sr);
if ("subscribe".equals(sr.getMode())) {
... | [
"public",
"void",
"subscriptionRequestReceived",
"(",
"SubscriptionRequest",
"sr",
")",
"throws",
"SubscriptionException",
"{",
"LOG",
".",
"info",
"(",
"\"Subscriber -> (Hub), new subscription request received.\"",
",",
"sr",
".",
"getCallback",
"(",
")",
")",
";",
"tr... | Input method, called by a Subscriber indicating its intent into receive notification about a given topic.
@param sr DTO containing the info given by the protocol | [
"Input",
"method",
"called",
"by",
"a",
"Subscriber",
"indicating",
"its",
"intent",
"into",
"receive",
"notification",
"about",
"a",
"given",
"topic",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/push/hub/src/main/java/org/ow2/chameleon/fuchsia/push/base/hub/impl/HubImpl.java#L105-L125 | train |
ow2-chameleon/fuchsia | bases/push/hub/src/main/java/org/ow2/chameleon/fuchsia/push/base/hub/impl/HubImpl.java | HubImpl.verifySubscriberRequestedSubscription | public Boolean verifySubscriberRequestedSubscription(SubscriptionRequest sr) throws SubscriptionOriginVerificationException {
LOG.info("(Hub) -> Subscriber, sending notification to verify the origin of the subscription {}.", sr.getCallback());
SubscriptionConfirmationRequest sc = new SubscriptionConfi... | java | public Boolean verifySubscriberRequestedSubscription(SubscriptionRequest sr) throws SubscriptionOriginVerificationException {
LOG.info("(Hub) -> Subscriber, sending notification to verify the origin of the subscription {}.", sr.getCallback());
SubscriptionConfirmationRequest sc = new SubscriptionConfi... | [
"public",
"Boolean",
"verifySubscriberRequestedSubscription",
"(",
"SubscriptionRequest",
"sr",
")",
"throws",
"SubscriptionOriginVerificationException",
"{",
"LOG",
".",
"info",
"(",
"\"(Hub) -> Subscriber, sending notification to verify the origin of the subscription {}.\"",
",",
"... | Output method that sends a subscription confirmation for the subscriber to avoid DoS attacks, or false subscription.
@param sr
@return True case the subscription was confirmed, or False otherwise
@throws org.ow2.chameleon.fuchsia.push.base.hub.exception.SubscriptionOriginVerificationException | [
"Output",
"method",
"that",
"sends",
"a",
"subscription",
"confirmation",
"for",
"the",
"subscriber",
"to",
"avoid",
"DoS",
"attacks",
"or",
"false",
"subscription",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/push/hub/src/main/java/org/ow2/chameleon/fuchsia/push/base/hub/impl/HubImpl.java#L134-L165 | train |
ow2-chameleon/fuchsia | bases/push/hub/src/main/java/org/ow2/chameleon/fuchsia/push/base/hub/impl/HubImpl.java | HubImpl.notifySubscriberCallback | public void notifySubscriberCallback(ContentNotification cn) {
String content = fetchContentFromPublisher(cn);
distributeContentToSubscribers(content, cn.getUrl());
} | java | public void notifySubscriberCallback(ContentNotification cn) {
String content = fetchContentFromPublisher(cn);
distributeContentToSubscribers(content, cn.getUrl());
} | [
"public",
"void",
"notifySubscriberCallback",
"(",
"ContentNotification",
"cn",
")",
"{",
"String",
"content",
"=",
"fetchContentFromPublisher",
"(",
"cn",
")",
";",
"distributeContentToSubscribers",
"(",
"content",
",",
"cn",
".",
"getUrl",
"(",
")",
")",
";",
... | Output method responsible for sending the updated content to the Subscribers.
@param cn | [
"Output",
"method",
"responsible",
"for",
"sending",
"the",
"updated",
"content",
"to",
"the",
"Subscribers",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/push/hub/src/main/java/org/ow2/chameleon/fuchsia/push/base/hub/impl/HubImpl.java#L172-L176 | train |
thorstenwagner/TraJ | src/main/java/de/biomedical_imaging/traj/math/TrajectorySplineFit.java | TrajectorySplineFit.minDistancePointSpline | public Point2D.Double minDistancePointSpline(Point2D.Double p, int nPointsPerSegment){
double minDistance = Double.MAX_VALUE;
Point2D.Double minDistancePoint = null;
int numberOfSplines = spline.getN();
double[] knots = spline.getKnots();
for(int i = 0; i < numberOfSplines; i++){
double x... | java | public Point2D.Double minDistancePointSpline(Point2D.Double p, int nPointsPerSegment){
double minDistance = Double.MAX_VALUE;
Point2D.Double minDistancePoint = null;
int numberOfSplines = spline.getN();
double[] knots = spline.getKnots();
for(int i = 0; i < numberOfSplines; i++){
double x... | [
"public",
"Point2D",
".",
"Double",
"minDistancePointSpline",
"(",
"Point2D",
".",
"Double",
"p",
",",
"int",
"nPointsPerSegment",
")",
"{",
"double",
"minDistance",
"=",
"Double",
".",
"MAX_VALUE",
";",
"Point2D",
".",
"Double",
"minDistancePoint",
"=",
"null",... | Finds to a given point p the point on the spline with minimum distance.
@param p Point where the nearest distance is searched for
@param nPointsPerSegment Number of interpolation points between two support points
@return Point spline which has the minimum distance to p | [
"Finds",
"to",
"a",
"given",
"point",
"p",
"the",
"point",
"on",
"the",
"spline",
"with",
"minimum",
"distance",
"."
] | 505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb | https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traj/math/TrajectorySplineFit.java#L538-L560 | train |
thorstenwagner/TraJ | src/main/java/de/biomedical_imaging/traj/math/TrajectorySplineFit.java | TrajectorySplineFit.showTrajectoryAndSpline | public void showTrajectoryAndSpline(){
if(t.getDimension()==2){
double[] xData = new double[rotatedTrajectory.size()];
double[] yData = new double[rotatedTrajectory.size()];
for(int i = 0; i < rotatedTrajectory.size(); i++){
xData[i] = rotatedTrajectory.get(i).x;
yData[i] = rotatedTra... | java | public void showTrajectoryAndSpline(){
if(t.getDimension()==2){
double[] xData = new double[rotatedTrajectory.size()];
double[] yData = new double[rotatedTrajectory.size()];
for(int i = 0; i < rotatedTrajectory.size(); i++){
xData[i] = rotatedTrajectory.get(i).x;
yData[i] = rotatedTra... | [
"public",
"void",
"showTrajectoryAndSpline",
"(",
")",
"{",
"if",
"(",
"t",
".",
"getDimension",
"(",
")",
"==",
"2",
")",
"{",
"double",
"[",
"]",
"xData",
"=",
"new",
"double",
"[",
"rotatedTrajectory",
".",
"size",
"(",
")",
"]",
";",
"double",
"[... | Plots the rotated trajectory, spline and support points. | [
"Plots",
"the",
"rotated",
"trajectory",
"spline",
"and",
"support",
"points",
"."
] | 505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb | https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traj/math/TrajectorySplineFit.java#L604-L658 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyListUtils.java | MyListUtils.getSet | public static <T> Set<T> getSet(Collection<T> collection) {
Set<T> set = new LinkedHashSet<T>();
set.addAll(collection);
return set;
} | java | public static <T> Set<T> getSet(Collection<T> collection) {
Set<T> set = new LinkedHashSet<T>();
set.addAll(collection);
return set;
} | [
"public",
"static",
"<",
"T",
">",
"Set",
"<",
"T",
">",
"getSet",
"(",
"Collection",
"<",
"T",
">",
"collection",
")",
"{",
"Set",
"<",
"T",
">",
"set",
"=",
"new",
"LinkedHashSet",
"<",
"T",
">",
"(",
")",
";",
"set",
".",
"addAll",
"(",
"col... | Convert Collection to Set
@param collection Collection
@return Set | [
"Convert",
"Collection",
"to",
"Set"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyListUtils.java#L37-L42 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyListUtils.java | MyListUtils.join | public static <T> String join(Collection<T> col, String delim) {
StringBuilder sb = new StringBuilder();
Iterator<T> iter = col.iterator();
if (iter.hasNext())
sb.append(iter.next().toString());
while (iter.hasNext()) {
sb.append(delim);
sb.append(iter.next().toString());
}
ret... | java | public static <T> String join(Collection<T> col, String delim) {
StringBuilder sb = new StringBuilder();
Iterator<T> iter = col.iterator();
if (iter.hasNext())
sb.append(iter.next().toString());
while (iter.hasNext()) {
sb.append(delim);
sb.append(iter.next().toString());
}
ret... | [
"public",
"static",
"<",
"T",
">",
"String",
"join",
"(",
"Collection",
"<",
"T",
">",
"col",
",",
"String",
"delim",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"Iterator",
"<",
"T",
">",
"iter",
"=",
"col",
".",
"... | Joins a collection in a string using a delimiter
@param col Collection
@param delim Delimiter
@return String | [
"Joins",
"a",
"collection",
"in",
"a",
"string",
"using",
"a",
"delimiter"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyListUtils.java#L50-L60 | train |
ow2-chameleon/fuchsia | importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveVersionCommandClass.java | ZWaveVersionCommandClass.checkVersion | public void checkVersion(ZWaveCommandClass commandClass) {
ZWaveVersionCommandClass versionCommandClass = (ZWaveVersionCommandClass)this.getNode().getCommandClass(CommandClass.VERSION);
if (versionCommandClass == null) {
logger.error(String.format("Version command class not supported on node %d," +
... | java | public void checkVersion(ZWaveCommandClass commandClass) {
ZWaveVersionCommandClass versionCommandClass = (ZWaveVersionCommandClass)this.getNode().getCommandClass(CommandClass.VERSION);
if (versionCommandClass == null) {
logger.error(String.format("Version command class not supported on node %d," +
... | [
"public",
"void",
"checkVersion",
"(",
"ZWaveCommandClass",
"commandClass",
")",
"{",
"ZWaveVersionCommandClass",
"versionCommandClass",
"=",
"(",
"ZWaveVersionCommandClass",
")",
"this",
".",
"getNode",
"(",
")",
".",
"getCommandClass",
"(",
"CommandClass",
".",
"VER... | Check the version of a command class by sending a VERSION_COMMAND_CLASS_GET message to the node.
@param commandClass the command class to check the version for. | [
"Check",
"the",
"version",
"of",
"a",
"command",
"class",
"by",
"sending",
"a",
"VERSION_COMMAND_CLASS_GET",
"message",
"to",
"the",
"node",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/importers/zwave/src/main/java/org/ow2/chameleon/fuchsia/importer/zwave/internal/commandclass/ZWaveVersionCommandClass.java#L209-L222 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyHTTPUtils.java | MyHTTPUtils.getContent | public static String getContent(String stringUrl) throws IOException {
InputStream stream = getContentStream(stringUrl);
return MyStreamUtils.readContent(stream);
} | java | public static String getContent(String stringUrl) throws IOException {
InputStream stream = getContentStream(stringUrl);
return MyStreamUtils.readContent(stream);
} | [
"public",
"static",
"String",
"getContent",
"(",
"String",
"stringUrl",
")",
"throws",
"IOException",
"{",
"InputStream",
"stream",
"=",
"getContentStream",
"(",
"stringUrl",
")",
";",
"return",
"MyStreamUtils",
".",
"readContent",
"(",
"stream",
")",
";",
"}"
] | Get content for URL only
@param stringUrl URL to get content
@return the content
@throws IOException I/O error happened | [
"Get",
"content",
"for",
"URL",
"only"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyHTTPUtils.java#L49-L52 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyHTTPUtils.java | MyHTTPUtils.getContentStream | public static InputStream getContentStream(String stringUrl) throws MalformedURLException, IOException {
URL url = new URL(stringUrl);
URLConnection urlConnection = url.openConnection();
InputStream is = urlConnection.getInputStream();
if ("gzip".equals(urlConnection.ge... | java | public static InputStream getContentStream(String stringUrl) throws MalformedURLException, IOException {
URL url = new URL(stringUrl);
URLConnection urlConnection = url.openConnection();
InputStream is = urlConnection.getInputStream();
if ("gzip".equals(urlConnection.ge... | [
"public",
"static",
"InputStream",
"getContentStream",
"(",
"String",
"stringUrl",
")",
"throws",
"MalformedURLException",
",",
"IOException",
"{",
"URL",
"url",
"=",
"new",
"URL",
"(",
"stringUrl",
")",
";",
"URLConnection",
"urlConnection",
"=",
"url",
".",
"o... | Get stream for URL only
@param stringUrl URL to get content
@return the input stream
@throws IOException I/O error happened | [
"Get",
"stream",
"for",
"URL",
"only"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyHTTPUtils.java#L61-L72 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyHTTPUtils.java | MyHTTPUtils.getResponseHeaders | public static Map<String, List<String>> getResponseHeaders(String stringUrl) throws IOException {
return getResponseHeaders(stringUrl, true);
} | java | public static Map<String, List<String>> getResponseHeaders(String stringUrl) throws IOException {
return getResponseHeaders(stringUrl, true);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"getResponseHeaders",
"(",
"String",
"stringUrl",
")",
"throws",
"IOException",
"{",
"return",
"getResponseHeaders",
"(",
"stringUrl",
",",
"true",
")",
";",
"}"
] | Get the response headers for URL
@param stringUrl URL to use
@return headers HTTP Headers
@throws IOException I/O error happened | [
"Get",
"the",
"response",
"headers",
"for",
"URL"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyHTTPUtils.java#L185-L187 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyHTTPUtils.java | MyHTTPUtils.getResponseHeaders | public static Map<String, List<String>> getResponseHeaders(String stringUrl,
boolean followRedirects) throws IOException {
URL url = new URL(stringUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setInstanceFollowRedirects(followRedirects);
InputStream is = conn.g... | java | public static Map<String, List<String>> getResponseHeaders(String stringUrl,
boolean followRedirects) throws IOException {
URL url = new URL(stringUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setInstanceFollowRedirects(followRedirects);
InputStream is = conn.g... | [
"public",
"static",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"getResponseHeaders",
"(",
"String",
"stringUrl",
",",
"boolean",
"followRedirects",
")",
"throws",
"IOException",
"{",
"URL",
"url",
"=",
"new",
"URL",
"(",
"stringUrl",
")",
... | Get the response headers for URL, following redirects
@param stringUrl URL to use
@param followRedirects whether to follow redirects
@return headers HTTP Headers
@throws IOException I/O error happened | [
"Get",
"the",
"response",
"headers",
"for",
"URL",
"following",
"redirects"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyHTTPUtils.java#L197-L214 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyHTTPUtils.java | MyHTTPUtils.downloadUrl | public static void downloadUrl(String stringUrl, Map<String, String> parameters, File fileToSave)
throws IOException {
URL url = new URL(stringUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setFollowRedirects(true);
if (parameters != null) {
for (Entry<Str... | java | public static void downloadUrl(String stringUrl, Map<String, String> parameters, File fileToSave)
throws IOException {
URL url = new URL(stringUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setFollowRedirects(true);
if (parameters != null) {
for (Entry<Str... | [
"public",
"static",
"void",
"downloadUrl",
"(",
"String",
"stringUrl",
",",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
",",
"File",
"fileToSave",
")",
"throws",
"IOException",
"{",
"URL",
"url",
"=",
"new",
"URL",
"(",
"stringUrl",
")",
";",
... | Download a specified URL to a file
@param stringUrl URL to use
@param parameters HTTP Headers
@param fileToSave File to save content
@throws IOException I/O error happened | [
"Download",
"a",
"specified",
"URL",
"to",
"a",
"file"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyHTTPUtils.java#L224-L266 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyHTTPUtils.java | MyHTTPUtils.getContentBytes | public static byte[] getContentBytes(String stringUrl) throws IOException {
URL url = new URL(stringUrl);
byte[] data = MyStreamUtils.readContentBytes(url.openStream());
return data;
} | java | public static byte[] getContentBytes(String stringUrl) throws IOException {
URL url = new URL(stringUrl);
byte[] data = MyStreamUtils.readContentBytes(url.openStream());
return data;
} | [
"public",
"static",
"byte",
"[",
"]",
"getContentBytes",
"(",
"String",
"stringUrl",
")",
"throws",
"IOException",
"{",
"URL",
"url",
"=",
"new",
"URL",
"(",
"stringUrl",
")",
";",
"byte",
"[",
"]",
"data",
"=",
"MyStreamUtils",
".",
"readContentBytes",
"(... | Return the content from an URL in byte array
@param stringUrl URL to get
@return byte array
@throws IOException I/O error happened | [
"Return",
"the",
"content",
"from",
"an",
"URL",
"in",
"byte",
"array"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyHTTPUtils.java#L275-L279 | train |
brunocvcunha/inutils4j | src/main/java/org/brunocvcunha/inutils4j/MyHTTPUtils.java | MyHTTPUtils.httpRequest | public static String httpRequest(String stringUrl, String method, Map<String, String> parameters,
String input, String charset) throws IOException {
URL url = new URL(stringUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod(method... | java | public static String httpRequest(String stringUrl, String method, Map<String, String> parameters,
String input, String charset) throws IOException {
URL url = new URL(stringUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod(method... | [
"public",
"static",
"String",
"httpRequest",
"(",
"String",
"stringUrl",
",",
"String",
"method",
",",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
",",
"String",
"input",
",",
"String",
"charset",
")",
"throws",
"IOException",
"{",
"URL",
"url",
... | Execute a HTTP request
@param stringUrl URL
@param method Method to use
@param parameters Params
@param input Input / Payload
@param charset Input Charset
@return response
@throws IOException | [
"Execute",
"a",
"HTTP",
"request"
] | 223c4443c2cee662576ce644e552588fa114aa94 | https://github.com/brunocvcunha/inutils4j/blob/223c4443c2cee662576ce644e552588fa114aa94/src/main/java/org/brunocvcunha/inutils4j/MyHTTPUtils.java#L293-L319 | train |
ow2-chameleon/fuchsia | core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/LinkerDeclarationsManager.java | LinkerDeclarationsManager.add | public void add(ServiceReference<D> declarationSRef) {
D declaration = getDeclaration(declarationSRef);
boolean matchFilter = declarationFilter.matches(declaration.getMetadata());
declarations.put(declarationSRef, matchFilter);
} | java | public void add(ServiceReference<D> declarationSRef) {
D declaration = getDeclaration(declarationSRef);
boolean matchFilter = declarationFilter.matches(declaration.getMetadata());
declarations.put(declarationSRef, matchFilter);
} | [
"public",
"void",
"add",
"(",
"ServiceReference",
"<",
"D",
">",
"declarationSRef",
")",
"{",
"D",
"declaration",
"=",
"getDeclaration",
"(",
"declarationSRef",
")",
";",
"boolean",
"matchFilter",
"=",
"declarationFilter",
".",
"matches",
"(",
"declaration",
"."... | Add the declarationSRef to the DeclarationsManager.
Calculate the matching of the Declaration with the DeclarationFilter of the
Linker.
@param declarationSRef the ServiceReference<D> of the Declaration | [
"Add",
"the",
"declarationSRef",
"to",
"the",
"DeclarationsManager",
".",
"Calculate",
"the",
"matching",
"of",
"the",
"Declaration",
"with",
"the",
"DeclarationFilter",
"of",
"the",
"Linker",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/LinkerDeclarationsManager.java#L60-L64 | train |
ow2-chameleon/fuchsia | core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/LinkerDeclarationsManager.java | LinkerDeclarationsManager.createLinks | public void createLinks(ServiceReference<D> declarationSRef) {
D declaration = getDeclaration(declarationSRef);
for (ServiceReference<S> serviceReference : linkerManagement.getMatchedBinderServiceRef()) {
if (linkerManagement.canBeLinked(declaration, serviceReference)) {
link... | java | public void createLinks(ServiceReference<D> declarationSRef) {
D declaration = getDeclaration(declarationSRef);
for (ServiceReference<S> serviceReference : linkerManagement.getMatchedBinderServiceRef()) {
if (linkerManagement.canBeLinked(declaration, serviceReference)) {
link... | [
"public",
"void",
"createLinks",
"(",
"ServiceReference",
"<",
"D",
">",
"declarationSRef",
")",
"{",
"D",
"declaration",
"=",
"getDeclaration",
"(",
"declarationSRef",
")",
";",
"for",
"(",
"ServiceReference",
"<",
"S",
">",
"serviceReference",
":",
"linkerMana... | Create all the links possible between the Declaration and all the ImporterService matching the.
ImporterServiceFilter of the Linker.
@param declarationSRef the ServiceReference<Declaration> of the Declaration | [
"Create",
"all",
"the",
"links",
"possible",
"between",
"the",
"Declaration",
"and",
"all",
"the",
"ImporterService",
"matching",
"the",
".",
"ImporterServiceFilter",
"of",
"the",
"Linker",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/LinkerDeclarationsManager.java#L114-L121 | train |
ow2-chameleon/fuchsia | core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/LinkerDeclarationsManager.java | LinkerDeclarationsManager.removeLinks | public void removeLinks(ServiceReference<D> declarationSRef) {
D declaration = getDeclaration(declarationSRef);
for (ServiceReference serviceReference : declaration.getStatus().getServiceReferencesBounded()) {
// FIXME : In case of multiples Linker, we will remove the link of all the Service... | java | public void removeLinks(ServiceReference<D> declarationSRef) {
D declaration = getDeclaration(declarationSRef);
for (ServiceReference serviceReference : declaration.getStatus().getServiceReferencesBounded()) {
// FIXME : In case of multiples Linker, we will remove the link of all the Service... | [
"public",
"void",
"removeLinks",
"(",
"ServiceReference",
"<",
"D",
">",
"declarationSRef",
")",
"{",
"D",
"declaration",
"=",
"getDeclaration",
"(",
"declarationSRef",
")",
";",
"for",
"(",
"ServiceReference",
"serviceReference",
":",
"declaration",
".",
"getStat... | Remove all the existing links of the Declaration.
@param declarationSRef the ServiceReference<Declaration> of the Declaration | [
"Remove",
"all",
"the",
"existing",
"links",
"of",
"the",
"Declaration",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/LinkerDeclarationsManager.java#L128-L135 | train |
ow2-chameleon/fuchsia | core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/LinkerDeclarationsManager.java | LinkerDeclarationsManager.getMatchedDeclaration | public Set<D> getMatchedDeclaration() {
Set<D> bindedSet = new HashSet<D>();
for (Map.Entry<ServiceReference<D>, Boolean> e : declarations.entrySet()) {
if (e.getValue()) {
bindedSet.add(getDeclaration(e.getKey()));
}
}
return bindedSet;
} | java | public Set<D> getMatchedDeclaration() {
Set<D> bindedSet = new HashSet<D>();
for (Map.Entry<ServiceReference<D>, Boolean> e : declarations.entrySet()) {
if (e.getValue()) {
bindedSet.add(getDeclaration(e.getKey()));
}
}
return bindedSet;
} | [
"public",
"Set",
"<",
"D",
">",
"getMatchedDeclaration",
"(",
")",
"{",
"Set",
"<",
"D",
">",
"bindedSet",
"=",
"new",
"HashSet",
"<",
"D",
">",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"ServiceReference",
"<",
"D",
">",
",",
"Boolean",... | Return a set of all the Declaration matching the DeclarationFilter of the.
Linker.
@return a set of all the Declaration matching the DeclarationFilter of the
Linker. | [
"Return",
"a",
"set",
"of",
"all",
"the",
"Declaration",
"matching",
"the",
"DeclarationFilter",
"of",
"the",
".",
"Linker",
"."
] | 4e9318eadbdeb945e529789f573b45386e619bed | https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/core/src/main/java/org/ow2/chameleon/fuchsia/core/component/manager/LinkerDeclarationsManager.java#L144-L152 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.