hexsha
stringlengths
40
40
repo
stringlengths
6
126
path
stringlengths
6
1.02k
license
sequence
language
stringclasses
1 value
identifier
stringlengths
1
220
return_type
stringlengths
1
110
original_string
stringlengths
39
223k
original_docstring
stringlengths
16
34.8k
docstring
stringlengths
11
3.41k
docstring_tokens
sequence
code
stringlengths
26
223k
code_tokens
sequence
short_docstring
stringlengths
0
3.02k
short_docstring_tokens
sequence
comment
sequence
parameters
list
docstring_params
dict
input_ids
sequence
attention_mask
sequence
labels
sequence
49cf45a595245cf86ade32fd50cbd661ed596c33
Tenshiorg/Extensions-Lib
extensionsLib/src/main/java/io/github/shadow578/tenshi/extensionslib/lang/LanguageUtil.java
[ "Apache-2.0" ]
Java
join
String
@NonNull public static String join(@NonNull String delimiter, @NonNull String... sx) { // use concat if delimiter is empty if (nullOrEmpty(delimiter)) return concat(sx); // join strings StringBuilder sb = new StringBuilder(); for (String s : sx) sb.append(s).append(delimiter); //remove last delimiter sb.setLength(sb.length() - delimiter.length()); return sb.toString(); }
/** * join multiple strings with delimiter * * @param delimiter the delimiter to put between the strings * @param sx the strings to join * @return the joined string */
join multiple strings with delimiter @param delimiter the delimiter to put between the strings @param sx the strings to join @return the joined string
[ "join", "multiple", "strings", "with", "delimiter", "@param", "delimiter", "the", "delimiter", "to", "put", "between", "the", "strings", "@param", "sx", "the", "strings", "to", "join", "@return", "the", "joined", "string" ]
@NonNull public static String join(@NonNull String delimiter, @NonNull String... sx) { if (nullOrEmpty(delimiter)) return concat(sx); StringBuilder sb = new StringBuilder(); for (String s : sx) sb.append(s).append(delimiter); sb.setLength(sb.length() - delimiter.length()); return sb.toString(); }
[ "@", "NonNull", "public", "static", "String", "join", "(", "@", "NonNull", "String", "delimiter", ",", "@", "NonNull", "String", "...", "sx", ")", "{", "if", "(", "nullOrEmpty", "(", "delimiter", ")", ")", "return", "concat", "(", "sx", ")", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "String", "s", ":", "sx", ")", "sb", ".", "append", "(", "s", ")", ".", "append", "(", "delimiter", ")", ";", "sb", ".", "setLength", "(", "sb", ".", "length", "(", ")", "-", "delimiter", ".", "length", "(", ")", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
join multiple strings with delimiter @param delimiter the delimiter to put between the strings @param sx the strings to join @return the joined string
[ "join", "multiple", "strings", "with", "delimiter", "@param", "delimiter", "the", "delimiter", "to", "put", "between", "the", "strings", "@param", "sx", "the", "strings", "to", "join", "@return", "the", "joined", "string" ]
[ "// use concat if delimiter is empty", "// join strings", "//remove last delimiter" ]
[ { "param": "delimiter", "type": "String" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "delimiter", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 8921, 203, 565, 1071, 760, 514, 1233, 26964, 8921, 514, 5654, 16, 632, 8921, 514, 2777, 13280, 13, 288, 203, 3639, 368, 999, 3835, 309, 5654, 353, 1008, 203, 3639, 309, 261, 2011, 12763, 12, 15751, 3719, 203, 5411, 327, 3835, 12, 30319, 1769, 203, 203, 3639, 368, 1233, 2064, 203, 3639, 3225, 2393, 273, 394, 3225, 5621, 203, 3639, 364, 261, 780, 272, 294, 13280, 13, 203, 5411, 2393, 18, 6923, 12, 87, 2934, 6923, 12, 15751, 1769, 203, 203, 3639, 368, 4479, 1142, 5654, 203, 3639, 2393, 18, 542, 1782, 12, 18366, 18, 2469, 1435, 300, 5654, 18, 2469, 10663, 203, 3639, 327, 2393, 18, 10492, 5621, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 1233, 3229, 2064, 598, 5654, 203, 377, 380, 203, 377, 380, 632, 891, 5654, 326, 5654, 358, 1378, 3086, 326, 2064, 203, 377, 380, 632, 891, 13280, 3639, 326, 2064, 358, 1233, 203, 377, 380, 632, 2463, 326, 12114, 533, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
49cf45a595245cf86ade32fd50cbd661ed596c33
Tenshiorg/Extensions-Lib
extensionsLib/src/main/java/io/github/shadow578/tenshi/extensionslib/lang/LanguageUtil.java
[ "Apache-2.0" ]
Java
foreach
null
public static <T> void foreach(@Nullable Collection<T> list, @NonNull Consumer<T> func) { if (isNull(list) || list.isEmpty()) return; for (T t : list) func.invoke(t); }
/** * run a foreach loop if the list is not null or empty * * @param list the list to loop over * @param func the loop body * @param <T> the type of the list */
run a foreach loop if the list is not null or empty @param list the list to loop over @param func the loop body @param the type of the list
[ "run", "a", "foreach", "loop", "if", "the", "list", "is", "not", "null", "or", "empty", "@param", "list", "the", "list", "to", "loop", "over", "@param", "func", "the", "loop", "body", "@param", "the", "type", "of", "the", "list" ]
public static <T> void foreach(@Nullable Collection<T> list, @NonNull Consumer<T> func) { if (isNull(list) || list.isEmpty()) return; for (T t : list) func.invoke(t); }
[ "public", "static", "<", "T", ">", "void", "foreach", "(", "@", "Nullable", "Collection", "<", "T", ">", "list", ",", "@", "NonNull", "Consumer", "<", "T", ">", "func", ")", "{", "if", "(", "isNull", "(", "list", ")", "||", "list", ".", "isEmpty", "(", ")", ")", "return", ";", "for", "(", "T", "t", ":", "list", ")", "func", ".", "invoke", "(", "t", ")", ";", "}" ]
run a foreach loop if the list is not null or empty @param list the list to loop over @param func the loop body @param <T> the type of the list
[ "run", "a", "foreach", "loop", "if", "the", "list", "is", "not", "null", "or", "empty", "@param", "list", "the", "list", "to", "loop", "over", "@param", "func", "the", "loop", "body", "@param", "<T", ">", "the", "type", "of", "the", "list" ]
[]
[ { "param": "list", "type": "Collection<T>" }, { "param": "func", "type": "Consumer<T>" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "list", "type": "Collection<T>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "func", "type": "Consumer<T>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 760, 411, 56, 34, 918, 936, 26964, 13349, 2200, 32, 56, 34, 666, 16, 632, 8921, 9326, 32, 56, 34, 1326, 13, 288, 203, 3639, 309, 261, 291, 2041, 12, 1098, 13, 747, 666, 18, 291, 1921, 10756, 203, 5411, 327, 31, 203, 3639, 364, 261, 56, 268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 56, 34, 225, 326, 618, 434, 326, 666, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
49cf45a595245cf86ade32fd50cbd661ed596c33
Tenshiorg/Extensions-Lib
extensionsLib/src/main/java/io/github/shadow578/tenshi/extensionslib/lang/LanguageUtil.java
[ "Apache-2.0" ]
Java
foreach
null
public static <T> void foreach(@Nullable Collection<T> list, @NonNull BiConsumer<T, Integer> func) { if (isNull(list) || list.isEmpty()) return; int i = 0; for (T t : list) func.invoke(t, i++); }
/** * run a foreach loop if the list is not null or empty * * @param list the list to loop over * @param func the loop body * @param <T> the type of the list */
run a foreach loop if the list is not null or empty @param list the list to loop over @param func the loop body @param the type of the list
[ "run", "a", "foreach", "loop", "if", "the", "list", "is", "not", "null", "or", "empty", "@param", "list", "the", "list", "to", "loop", "over", "@param", "func", "the", "loop", "body", "@param", "the", "type", "of", "the", "list" ]
public static <T> void foreach(@Nullable Collection<T> list, @NonNull BiConsumer<T, Integer> func) { if (isNull(list) || list.isEmpty()) return; int i = 0; for (T t : list) func.invoke(t, i++); }
[ "public", "static", "<", "T", ">", "void", "foreach", "(", "@", "Nullable", "Collection", "<", "T", ">", "list", ",", "@", "NonNull", "BiConsumer", "<", "T", ",", "Integer", ">", "func", ")", "{", "if", "(", "isNull", "(", "list", ")", "||", "list", ".", "isEmpty", "(", ")", ")", "return", ";", "int", "i", "=", "0", ";", "for", "(", "T", "t", ":", "list", ")", "func", ".", "invoke", "(", "t", ",", "i", "++", ")", ";", "}" ]
run a foreach loop if the list is not null or empty @param list the list to loop over @param func the loop body @param <T> the type of the list
[ "run", "a", "foreach", "loop", "if", "the", "list", "is", "not", "null", "or", "empty", "@param", "list", "the", "list", "to", "loop", "over", "@param", "func", "the", "loop", "body", "@param", "<T", ">", "the", "type", "of", "the", "list" ]
[]
[ { "param": "list", "type": "Collection<T>" }, { "param": "func", "type": "BiConsumer<T, Integer>" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "list", "type": "Collection<T>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "func", "type": "BiConsumer<T, Integer>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 760, 411, 56, 34, 918, 936, 26964, 13349, 2200, 32, 56, 34, 666, 16, 632, 8921, 16682, 5869, 32, 56, 16, 2144, 34, 1326, 13, 288, 203, 3639, 309, 261, 291, 2041, 12, 1098, 13, 747, 666, 18, 291, 1921, 10756, 203, 5411, 327, 31, 203, 203, 3639, 509, 277, 273, 374, 31, 203, 3639, 364, 261, 56, 268, 294, 666, 13, 203, 5411, 1326, 18, 14407, 12, 88, 16, 277, 9904, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 1086, 279, 936, 2798, 309, 326, 666, 353, 486, 446, 578, 1008, 203, 377, 380, 203, 377, 380, 632, 891, 666, 326, 666, 358, 2798, 1879, 203, 377, 380, 632, 891, 1326, 326, 2798, 1417, 203, 377, 380, 632, 891, 411, 56, 34, 225, 326, 618, 434, 326, 666, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
49cf45a595245cf86ade32fd50cbd661ed596c33
Tenshiorg/Extensions-Lib
extensionsLib/src/main/java/io/github/shadow578/tenshi/extensionslib/lang/LanguageUtil.java
[ "Apache-2.0" ]
Java
where
null
@NonNull public static <T> List<T> where(@Nullable Collection<T> list, @NonNull Function<Boolean, T> filter) { if (isNull(list) || list.isEmpty()) return new ArrayList<>(); // copy the list final ArrayList<T> filteredList = new ArrayList<>(list); // iterate over list final Iterator<T> i = filteredList.iterator(); while (i.hasNext()) { if (!filter.invoke(i.next())) i.remove(); } return filteredList; }
/** * filter the entries of a collection. the original collections is not modified * * @param list the collection to filter * @param filter the filter function * @param <T> list type * @return the filtered list. this may be empty, but never null */
filter the entries of a collection. the original collections is not modified @param list the collection to filter @param filter the filter function @param list type @return the filtered list. this may be empty, but never null
[ "filter", "the", "entries", "of", "a", "collection", ".", "the", "original", "collections", "is", "not", "modified", "@param", "list", "the", "collection", "to", "filter", "@param", "filter", "the", "filter", "function", "@param", "list", "type", "@return", "the", "filtered", "list", ".", "this", "may", "be", "empty", "but", "never", "null" ]
@NonNull public static <T> List<T> where(@Nullable Collection<T> list, @NonNull Function<Boolean, T> filter) { if (isNull(list) || list.isEmpty()) return new ArrayList<>(); final ArrayList<T> filteredList = new ArrayList<>(list); final Iterator<T> i = filteredList.iterator(); while (i.hasNext()) { if (!filter.invoke(i.next())) i.remove(); } return filteredList; }
[ "@", "NonNull", "public", "static", "<", "T", ">", "List", "<", "T", ">", "where", "(", "@", "Nullable", "Collection", "<", "T", ">", "list", ",", "@", "NonNull", "Function", "<", "Boolean", ",", "T", ">", "filter", ")", "{", "if", "(", "isNull", "(", "list", ")", "||", "list", ".", "isEmpty", "(", ")", ")", "return", "new", "ArrayList", "<", ">", "(", ")", ";", "final", "ArrayList", "<", "T", ">", "filteredList", "=", "new", "ArrayList", "<", ">", "(", "list", ")", ";", "final", "Iterator", "<", "T", ">", "i", "=", "filteredList", ".", "iterator", "(", ")", ";", "while", "(", "i", ".", "hasNext", "(", ")", ")", "{", "if", "(", "!", "filter", ".", "invoke", "(", "i", ".", "next", "(", ")", ")", ")", "i", ".", "remove", "(", ")", ";", "}", "return", "filteredList", ";", "}" ]
filter the entries of a collection.
[ "filter", "the", "entries", "of", "a", "collection", "." ]
[ "// copy the list", "// iterate over list" ]
[ { "param": "list", "type": "Collection<T>" }, { "param": "filter", "type": "Function<Boolean, T>" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "list", "type": "Collection<T>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "filter", "type": "Function<Boolean, T>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 8921, 203, 565, 1071, 760, 411, 56, 34, 987, 32, 56, 34, 1625, 26964, 13349, 2200, 32, 56, 34, 666, 16, 632, 8921, 4284, 32, 5507, 16, 399, 34, 1034, 13, 288, 203, 3639, 309, 261, 291, 2041, 12, 1098, 13, 747, 666, 18, 291, 1921, 10756, 203, 5411, 327, 394, 2407, 29667, 5621, 203, 203, 3639, 368, 1610, 326, 666, 203, 3639, 727, 2407, 32, 56, 34, 5105, 682, 273, 394, 2407, 29667, 12, 1098, 1769, 203, 203, 3639, 368, 7401, 1879, 666, 203, 3639, 727, 4498, 32, 56, 34, 277, 273, 5105, 682, 18, 9838, 5621, 203, 3639, 1323, 261, 77, 18, 5332, 2134, 10756, 288, 203, 5411, 309, 16051, 2188, 18, 14407, 12, 77, 18, 4285, 1435, 3719, 203, 7734, 277, 18, 4479, 5621, 203, 3639, 289, 203, 203, 3639, 327, 5105, 682, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 1034, 326, 3222, 434, 279, 1849, 18, 326, 2282, 6980, 353, 486, 4358, 203, 377, 380, 203, 377, 380, 632, 891, 666, 282, 326, 1849, 358, 1034, 203, 377, 380, 632, 891, 1034, 326, 1034, 445, 203, 377, 380, 632, 891, 411, 56, 34, 565, 666, 618, 203, 377, 380, 632, 2463, 326, 5105, 666, 18, 333, 2026, 506, 1008, 16, 1496, 5903, 446, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
49cf45a595245cf86ade32fd50cbd661ed596c33
Tenshiorg/Extensions-Lib
extensionsLib/src/main/java/io/github/shadow578/tenshi/extensionslib/lang/LanguageUtil.java
[ "Apache-2.0" ]
Java
repeat
null
@NonNull public static <T> Collection<T> repeat(int start, int end, @NonNull Function<T, Integer> func) { if (start > end) throw new IllegalArgumentException("start has to be smaller than end!"); ArrayList<T> results = new ArrayList<>(); for (int i = start; i <= end; i++) results.add(func.invoke(i)); return results; }
/** * repeat a function call count times and return the results as a collection * * @param start the start value (inclusive) * @param end the end value (inclusive) * @param func the function to repeat. takes the current iteration as parameter * @param <T> the return type of the function to repeat * @return a collection of all values the function returned. may have null values, depending on your function */
repeat a function call count times and return the results as a collection @param start the start value (inclusive) @param end the end value (inclusive) @param func the function to repeat. takes the current iteration as parameter @param the return type of the function to repeat @return a collection of all values the function returned. may have null values, depending on your function
[ "repeat", "a", "function", "call", "count", "times", "and", "return", "the", "results", "as", "a", "collection", "@param", "start", "the", "start", "value", "(", "inclusive", ")", "@param", "end", "the", "end", "value", "(", "inclusive", ")", "@param", "func", "the", "function", "to", "repeat", ".", "takes", "the", "current", "iteration", "as", "parameter", "@param", "the", "return", "type", "of", "the", "function", "to", "repeat", "@return", "a", "collection", "of", "all", "values", "the", "function", "returned", ".", "may", "have", "null", "values", "depending", "on", "your", "function" ]
@NonNull public static <T> Collection<T> repeat(int start, int end, @NonNull Function<T, Integer> func) { if (start > end) throw new IllegalArgumentException("start has to be smaller than end!"); ArrayList<T> results = new ArrayList<>(); for (int i = start; i <= end; i++) results.add(func.invoke(i)); return results; }
[ "@", "NonNull", "public", "static", "<", "T", ">", "Collection", "<", "T", ">", "repeat", "(", "int", "start", ",", "int", "end", ",", "@", "NonNull", "Function", "<", "T", ",", "Integer", ">", "func", ")", "{", "if", "(", "start", ">", "end", ")", "throw", "new", "IllegalArgumentException", "(", "\"start has to be smaller than end!\"", ")", ";", "ArrayList", "<", "T", ">", "results", "=", "new", "ArrayList", "<", ">", "(", ")", ";", "for", "(", "int", "i", "=", "start", ";", "i", "<=", "end", ";", "i", "++", ")", "results", ".", "add", "(", "func", ".", "invoke", "(", "i", ")", ")", ";", "return", "results", ";", "}" ]
repeat a function call count times and return the results as a collection @param start the start value (inclusive) @param end the end value (inclusive) @param func the function to repeat.
[ "repeat", "a", "function", "call", "count", "times", "and", "return", "the", "results", "as", "a", "collection", "@param", "start", "the", "start", "value", "(", "inclusive", ")", "@param", "end", "the", "end", "value", "(", "inclusive", ")", "@param", "func", "the", "function", "to", "repeat", "." ]
[]
[ { "param": "start", "type": "int" }, { "param": "end", "type": "int" }, { "param": "func", "type": "Function<T, Integer>" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "start", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "end", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "func", "type": "Function<T, Integer>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 8921, 203, 565, 1071, 760, 411, 56, 34, 2200, 32, 56, 34, 7666, 12, 474, 787, 16, 509, 679, 16, 632, 8921, 4284, 32, 56, 16, 2144, 34, 1326, 13, 288, 203, 3639, 309, 261, 1937, 405, 679, 13, 203, 5411, 604, 394, 2754, 2932, 1937, 711, 358, 506, 10648, 2353, 679, 4442, 1769, 203, 203, 3639, 2407, 32, 56, 34, 1686, 273, 394, 2407, 29667, 5621, 203, 3639, 364, 261, 474, 277, 273, 787, 31, 277, 1648, 679, 31, 277, 27245, 203, 5411, 1686, 18, 1289, 12, 644, 18, 14407, 12, 77, 10019, 203, 3639, 327, 1686, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 7666, 279, 445, 745, 1056, 4124, 471, 327, 326, 1686, 487, 279, 1849, 203, 377, 380, 203, 377, 380, 632, 891, 787, 326, 787, 460, 261, 267, 9173, 13, 203, 377, 380, 632, 891, 679, 282, 326, 679, 460, 261, 267, 9173, 13, 203, 377, 380, 632, 891, 1326, 225, 326, 445, 358, 7666, 18, 5530, 326, 783, 6532, 487, 1569, 203, 377, 380, 632, 891, 411, 56, 34, 282, 326, 327, 618, 434, 326, 445, 358, 7666, 203, 377, 380, 632, 2463, 279, 1849, 434, 777, 924, 326, 445, 2106, 18, 2026, 1240, 446, 924, 16, 8353, 603, 3433, 445, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
49cf45a595245cf86ade32fd50cbd661ed596c33
Tenshiorg/Extensions-Lib
extensionsLib/src/main/java/io/github/shadow578/tenshi/extensionslib/lang/LanguageUtil.java
[ "Apache-2.0" ]
Java
cast
T
@Nullable @SuppressWarnings("unchecked") public static <T> T cast(@Nullable Object o) { // if o is null, we cannot cast if (isNull(o)) return null; // do cast try { return (T) o; } catch (ClassCastException e) { return null; } }
/** * safely cast the object * * @param o the object to cast * @param <T> the type to cast to * @return the casted object, or null if the cast failed */
safely cast the object @param o the object to cast @param the type to cast to @return the casted object, or null if the cast failed
[ "safely", "cast", "the", "object", "@param", "o", "the", "object", "to", "cast", "@param", "the", "type", "to", "cast", "to", "@return", "the", "casted", "object", "or", "null", "if", "the", "cast", "failed" ]
@Nullable @SuppressWarnings("unchecked") public static <T> T cast(@Nullable Object o) { if (isNull(o)) return null; try { return (T) o; } catch (ClassCastException e) { return null; } }
[ "@", "Nullable", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "cast", "(", "@", "Nullable", "Object", "o", ")", "{", "if", "(", "isNull", "(", "o", ")", ")", "return", "null", ";", "try", "{", "return", "(", "T", ")", "o", ";", "}", "catch", "(", "ClassCastException", "e", ")", "{", "return", "null", ";", "}", "}" ]
safely cast the object @param o the object to cast @param <T> the type to cast to @return the casted object, or null if the cast failed
[ "safely", "cast", "the", "object", "@param", "o", "the", "object", "to", "cast", "@param", "<T", ">", "the", "type", "to", "cast", "to", "@return", "the", "casted", "object", "or", "null", "if", "the", "cast", "failed" ]
[ "// if o is null, we cannot cast", "// do cast" ]
[ { "param": "o", "type": "Object" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "o", "type": "Object", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 13349, 203, 565, 632, 29282, 4312, 2932, 5847, 7923, 203, 565, 1071, 760, 411, 56, 34, 399, 4812, 26964, 13349, 1033, 320, 13, 288, 203, 3639, 368, 309, 320, 353, 446, 16, 732, 2780, 4812, 203, 3639, 309, 261, 291, 2041, 12, 83, 3719, 203, 5411, 327, 446, 31, 203, 203, 3639, 368, 741, 4812, 203, 3639, 775, 288, 203, 5411, 327, 261, 56, 13, 320, 31, 203, 3639, 289, 1044, 261, 797, 22768, 425, 13, 288, 203, 5411, 327, 446, 31, 203, 3639, 289, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 15303, 4812, 326, 733, 203, 377, 380, 203, 377, 380, 632, 891, 320, 282, 326, 733, 358, 4812, 203, 377, 380, 632, 891, 411, 56, 34, 326, 618, 358, 4812, 358, 203, 377, 380, 632, 2463, 326, 28192, 733, 16, 578, 446, 309, 326, 4812, 2535, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
49cf45a595245cf86ade32fd50cbd661ed596c33
Tenshiorg/Extensions-Lib
extensionsLib/src/main/java/io/github/shadow578/tenshi/extensionslib/lang/LanguageUtil.java
[ "Apache-2.0" ]
Java
cast
T
@NonNull @SuppressWarnings("unchecked") public static <T> T cast(@Nullable Object o, @NonNull T def) { // if o is null, we cannot cast if (isNull(o)) return def; // do cast try { return (T) o; } catch (ClassCastException e) { return def; } }
/** * safely cast the object, with default in case the cast fails * * @param o the object to cast * @param <T> the type to cast to * @return the casted object, or def if the cast failed */
safely cast the object, with default in case the cast fails @param o the object to cast @param the type to cast to @return the casted object, or def if the cast failed
[ "safely", "cast", "the", "object", "with", "default", "in", "case", "the", "cast", "fails", "@param", "o", "the", "object", "to", "cast", "@param", "the", "type", "to", "cast", "to", "@return", "the", "casted", "object", "or", "def", "if", "the", "cast", "failed" ]
@NonNull @SuppressWarnings("unchecked") public static <T> T cast(@Nullable Object o, @NonNull T def) { if (isNull(o)) return def; try { return (T) o; } catch (ClassCastException e) { return def; } }
[ "@", "NonNull", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "T", "cast", "(", "@", "Nullable", "Object", "o", ",", "@", "NonNull", "T", "def", ")", "{", "if", "(", "isNull", "(", "o", ")", ")", "return", "def", ";", "try", "{", "return", "(", "T", ")", "o", ";", "}", "catch", "(", "ClassCastException", "e", ")", "{", "return", "def", ";", "}", "}" ]
safely cast the object, with default in case the cast fails @param o the object to cast @param <T> the type to cast to @return the casted object, or def if the cast failed
[ "safely", "cast", "the", "object", "with", "default", "in", "case", "the", "cast", "fails", "@param", "o", "the", "object", "to", "cast", "@param", "<T", ">", "the", "type", "to", "cast", "to", "@return", "the", "casted", "object", "or", "def", "if", "the", "cast", "failed" ]
[ "// if o is null, we cannot cast", "// do cast" ]
[ { "param": "o", "type": "Object" }, { "param": "def", "type": "T" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "o", "type": "Object", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "def", "type": "T", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 8921, 203, 565, 632, 29282, 4312, 2932, 5847, 7923, 203, 565, 1071, 760, 411, 56, 34, 399, 4812, 26964, 13349, 1033, 320, 16, 632, 8921, 399, 1652, 13, 288, 203, 3639, 368, 309, 320, 353, 446, 16, 732, 2780, 4812, 203, 3639, 309, 261, 291, 2041, 12, 83, 3719, 203, 5411, 327, 1652, 31, 203, 203, 3639, 368, 741, 4812, 203, 3639, 775, 288, 203, 5411, 327, 261, 56, 13, 320, 31, 203, 3639, 289, 1044, 261, 797, 22768, 425, 13, 288, 203, 5411, 327, 1652, 31, 203, 3639, 289, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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 203, 377, 380, 632, 891, 411, 56, 34, 326, 618, 358, 4812, 358, 203, 377, 380, 632, 2463, 326, 28192, 733, 16, 578, 1652, 309, 326, 4812, 2535, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
49cf45a595245cf86ade32fd50cbd661ed596c33
Tenshiorg/Extensions-Lib
extensionsLib/src/main/java/io/github/shadow578/tenshi/extensionslib/lang/LanguageUtil.java
[ "Apache-2.0" ]
Java
async
null
public static <Rt> void async(@NonNull Action<Rt> action, @NonNull Consumer<Rt> callback) { backgroundExecutor.execute(() -> { final Rt r = action.invoke(); mainThreadHandler.post(() -> callback.invoke(r)); }); }
/** * run a action async and post the result to a callback in the main thread. * * @param action the action to execute * @param callback the callback to post the result to. Result may be null * @param <Rt> action return type */
run a action async and post the result to a callback in the main thread. @param action the action to execute @param callback the callback to post the result to. Result may be null @param
[ "run", "a", "action", "async", "and", "post", "the", "result", "to", "a", "callback", "in", "the", "main", "thread", ".", "@param", "action", "the", "action", "to", "execute", "@param", "callback", "the", "callback", "to", "post", "the", "result", "to", ".", "Result", "may", "be", "null", "@param" ]
public static <Rt> void async(@NonNull Action<Rt> action, @NonNull Consumer<Rt> callback) { backgroundExecutor.execute(() -> { final Rt r = action.invoke(); mainThreadHandler.post(() -> callback.invoke(r)); }); }
[ "public", "static", "<", "Rt", ">", "void", "async", "(", "@", "NonNull", "Action", "<", "Rt", ">", "action", ",", "@", "NonNull", "Consumer", "<", "Rt", ">", "callback", ")", "{", "backgroundExecutor", ".", "execute", "(", "(", ")", "->", "{", "final", "Rt", "r", "=", "action", ".", "invoke", "(", ")", ";", "mainThreadHandler", ".", "post", "(", "(", ")", "->", "callback", ".", "invoke", "(", "r", ")", ")", ";", "}", ")", ";", "}" ]
run a action async and post the result to a callback in the main thread.
[ "run", "a", "action", "async", "and", "post", "the", "result", "to", "a", "callback", "in", "the", "main", "thread", "." ]
[]
[ { "param": "action", "type": "Action<Rt>" }, { "param": "callback", "type": "Consumer<Rt>" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "action", "type": "Action<Rt>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "callback", "type": "Consumer<Rt>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 760, 411, 54, 88, 34, 918, 4326, 26964, 8921, 4382, 32, 54, 88, 34, 1301, 16, 632, 8921, 9326, 32, 54, 88, 34, 1348, 13, 288, 203, 3639, 5412, 6325, 18, 8837, 12, 1435, 317, 288, 203, 5411, 727, 534, 88, 436, 273, 1301, 18, 14407, 5621, 203, 5411, 2774, 3830, 1503, 18, 2767, 12, 1435, 203, 10792, 317, 1348, 18, 14407, 12, 86, 10019, 203, 3639, 15549, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 1086, 279, 1301, 4326, 471, 1603, 326, 563, 358, 279, 1348, 316, 326, 2774, 2650, 18, 203, 377, 380, 203, 377, 380, 632, 891, 1301, 282, 326, 1301, 358, 1836, 203, 377, 380, 632, 891, 1348, 326, 1348, 358, 1603, 326, 563, 358, 18, 3438, 2026, 506, 446, 203, 377, 380, 632, 891, 411, 54, 88, 34, 377, 1301, 327, 618, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
7f35264c37ac121a6e0516fecce029a01479a168
Tenshiorg/Extensions-Lib
extensionsLib/src/main/java/io/github/shadow578/tenshi/extensionslib/content/util/ActivityAdapterActivity.java
[ "Apache-2.0" ]
Java
loadAdapterParams
null
@SuppressWarnings({"unused", "RedundantSuppression"}) protected boolean loadAdapterParams() { // ensure we have a intent final Intent i = getIntent(); if (isNull(i)) return false; // load data malID = i.getIntExtra(EXTRA_MAL_ID, -1); enTitle = i.getStringExtra(EXTRA_ANIME_TITLE_EN); jpTitle = i.getStringExtra(EXTRA_ANIME_TITLE_JP); episode = i.getIntExtra(EXTRA_TARGET_EPISODE, -1); persistentStorage = i.getStringExtra(EXTRA_PERSISTENT_STORAGE); uniqueName = i.getStringExtra(EXTRA_UNIQUE_NAME); // persistent storage is optional, but cannot be null persistentStorage = elvis(persistentStorage, ""); return !nullOrEmpty(uniqueName); }
/** * load the call parameter fields from the intent extras. * call this in {@link #onCreate(Bundle)}, and finish if returns false * <p> * loads: * {@link #malID} * {@link #enTitle} * {@link #jpTitle} * {@link #episode} * {@link #persistentStorage} * * @return was the load successful? if false, do not continue */
load the call parameter fields from the intent extras. @return was the load successful. if false, do not continue
[ "load", "the", "call", "parameter", "fields", "from", "the", "intent", "extras", ".", "@return", "was", "the", "load", "successful", ".", "if", "false", "do", "not", "continue" ]
@SuppressWarnings({"unused", "RedundantSuppression"}) protected boolean loadAdapterParams() { final Intent i = getIntent(); if (isNull(i)) return false; malID = i.getIntExtra(EXTRA_MAL_ID, -1); enTitle = i.getStringExtra(EXTRA_ANIME_TITLE_EN); jpTitle = i.getStringExtra(EXTRA_ANIME_TITLE_JP); episode = i.getIntExtra(EXTRA_TARGET_EPISODE, -1); persistentStorage = i.getStringExtra(EXTRA_PERSISTENT_STORAGE); uniqueName = i.getStringExtra(EXTRA_UNIQUE_NAME); persistentStorage = elvis(persistentStorage, ""); return !nullOrEmpty(uniqueName); }
[ "@", "SuppressWarnings", "(", "{", "\"unused\"", ",", "\"RedundantSuppression\"", "}", ")", "protected", "boolean", "loadAdapterParams", "(", ")", "{", "final", "Intent", "i", "=", "getIntent", "(", ")", ";", "if", "(", "isNull", "(", "i", ")", ")", "return", "false", ";", "malID", "=", "i", ".", "getIntExtra", "(", "EXTRA_MAL_ID", ",", "-", "1", ")", ";", "enTitle", "=", "i", ".", "getStringExtra", "(", "EXTRA_ANIME_TITLE_EN", ")", ";", "jpTitle", "=", "i", ".", "getStringExtra", "(", "EXTRA_ANIME_TITLE_JP", ")", ";", "episode", "=", "i", ".", "getIntExtra", "(", "EXTRA_TARGET_EPISODE", ",", "-", "1", ")", ";", "persistentStorage", "=", "i", ".", "getStringExtra", "(", "EXTRA_PERSISTENT_STORAGE", ")", ";", "uniqueName", "=", "i", ".", "getStringExtra", "(", "EXTRA_UNIQUE_NAME", ")", ";", "persistentStorage", "=", "elvis", "(", "persistentStorage", ",", "\"\"", ")", ";", "return", "!", "nullOrEmpty", "(", "uniqueName", ")", ";", "}" ]
load the call parameter fields from the intent extras.
[ "load", "the", "call", "parameter", "fields", "from", "the", "intent", "extras", "." ]
[ "// ensure we have a intent", "// load data", "// persistent storage is optional, but cannot be null" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 29282, 4312, 12590, 6, 14375, 3113, 315, 3715, 15362, 3088, 1337, 6, 6792, 203, 565, 4750, 1250, 1262, 4216, 1370, 1435, 288, 203, 3639, 368, 3387, 732, 1240, 279, 10376, 203, 3639, 727, 15251, 277, 273, 8145, 319, 5621, 203, 3639, 309, 261, 291, 2041, 12, 77, 3719, 203, 5411, 327, 629, 31, 203, 203, 3639, 368, 1262, 501, 203, 3639, 27431, 734, 273, 277, 18, 588, 1702, 7800, 12, 22639, 67, 49, 1013, 67, 734, 16, 300, 21, 1769, 203, 3639, 570, 4247, 273, 277, 18, 588, 780, 7800, 12, 22639, 67, 1258, 3114, 67, 14123, 67, 1157, 1769, 203, 3639, 18182, 4247, 273, 277, 18, 588, 780, 7800, 12, 22639, 67, 1258, 3114, 67, 14123, 67, 29532, 1769, 203, 3639, 17054, 273, 277, 18, 588, 1702, 7800, 12, 22639, 67, 16374, 67, 41, 1102, 55, 2712, 16, 300, 21, 1769, 203, 3639, 9195, 3245, 273, 277, 18, 588, 780, 7800, 12, 22639, 67, 3194, 28175, 67, 19009, 1769, 203, 3639, 3089, 461, 273, 277, 18, 588, 780, 7800, 12, 22639, 67, 16879, 67, 1985, 1769, 203, 203, 3639, 368, 9195,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 1262, 326, 745, 1569, 1466, 628, 326, 10376, 11875, 18, 203, 377, 380, 745, 333, 316, 8901, 1232, 468, 265, 1684, 12, 3405, 13, 5779, 471, 4076, 309, 1135, 629, 203, 377, 380, 411, 84, 34, 203, 377, 380, 6277, 30, 203, 377, 380, 8901, 1232, 468, 81, 287, 734, 97, 203, 377, 380, 8901, 1232, 468, 275, 4247, 97, 203, 377, 380, 8901, 1232, 468, 21797, 4247, 97, 203, 377, 380, 8901, 1232, 468, 29687, 97, 203, 377, 380, 8901, 1232, 468, 19393, 3245, 97, 203, 377, 380, 203, 377, 380, 632, 2463, 1703, 326, 1262, 6873, 35, 309, 629, 16, 741, 486, 1324, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
7f35264c37ac121a6e0516fecce029a01479a168
Tenshiorg/Extensions-Lib
extensionsLib/src/main/java/io/github/shadow578/tenshi/extensionslib/content/util/ActivityAdapterActivity.java
[ "Apache-2.0" ]
Java
invokeCallback
null
protected void invokeCallback(@Nullable String streamUrl, @NonNull String persStorage) { final Intent i = new Intent(this, getServiceClass()); i.setAction(ActivityAdapterService.ACTION_NOTIFY_RESULT); i.putExtra(ActivityAdapterService.EXTRA_RESULT_STREAM_URL, streamUrl); i.putExtra(ActivityAdapterService.EXTRA_RESULT_PERSISTENT_STORAGE, persStorage); i.putExtra(ActivityAdapterService.EXTRA_RESULT_UNIQUE_NAME, uniqueName); startService(i); }
/** * invoke the callback of the content adapter * after this, the activity should call finish() * * @param streamUrl the stream url for the callback * @param persStorage persistent storage for the callback */
invoke the callback of the content adapter after this, the activity should call finish() @param streamUrl the stream url for the callback @param persStorage persistent storage for the callback
[ "invoke", "the", "callback", "of", "the", "content", "adapter", "after", "this", "the", "activity", "should", "call", "finish", "()", "@param", "streamUrl", "the", "stream", "url", "for", "the", "callback", "@param", "persStorage", "persistent", "storage", "for", "the", "callback" ]
protected void invokeCallback(@Nullable String streamUrl, @NonNull String persStorage) { final Intent i = new Intent(this, getServiceClass()); i.setAction(ActivityAdapterService.ACTION_NOTIFY_RESULT); i.putExtra(ActivityAdapterService.EXTRA_RESULT_STREAM_URL, streamUrl); i.putExtra(ActivityAdapterService.EXTRA_RESULT_PERSISTENT_STORAGE, persStorage); i.putExtra(ActivityAdapterService.EXTRA_RESULT_UNIQUE_NAME, uniqueName); startService(i); }
[ "protected", "void", "invokeCallback", "(", "@", "Nullable", "String", "streamUrl", ",", "@", "NonNull", "String", "persStorage", ")", "{", "final", "Intent", "i", "=", "new", "Intent", "(", "this", ",", "getServiceClass", "(", ")", ")", ";", "i", ".", "setAction", "(", "ActivityAdapterService", ".", "ACTION_NOTIFY_RESULT", ")", ";", "i", ".", "putExtra", "(", "ActivityAdapterService", ".", "EXTRA_RESULT_STREAM_URL", ",", "streamUrl", ")", ";", "i", ".", "putExtra", "(", "ActivityAdapterService", ".", "EXTRA_RESULT_PERSISTENT_STORAGE", ",", "persStorage", ")", ";", "i", ".", "putExtra", "(", "ActivityAdapterService", ".", "EXTRA_RESULT_UNIQUE_NAME", ",", "uniqueName", ")", ";", "startService", "(", "i", ")", ";", "}" ]
invoke the callback of the content adapter after this, the activity should call finish()
[ "invoke", "the", "callback", "of", "the", "content", "adapter", "after", "this", "the", "activity", "should", "call", "finish", "()" ]
[]
[ { "param": "streamUrl", "type": "String" }, { "param": "persStorage", "type": "String" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "streamUrl", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "persStorage", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 4750, 918, 4356, 2428, 26964, 13349, 514, 1407, 1489, 16, 632, 8921, 514, 13508, 3245, 13, 288, 203, 3639, 727, 15251, 277, 273, 394, 15251, 12, 2211, 16, 6373, 797, 10663, 203, 3639, 277, 18, 542, 1803, 12, 6193, 4216, 1179, 18, 12249, 67, 4400, 12096, 67, 12289, 1769, 203, 3639, 277, 18, 458, 7800, 12, 6193, 4216, 1179, 18, 22639, 67, 12289, 67, 13693, 67, 1785, 16, 1407, 1489, 1769, 203, 3639, 277, 18, 458, 7800, 12, 6193, 4216, 1179, 18, 22639, 67, 12289, 67, 3194, 28175, 67, 19009, 16, 13508, 3245, 1769, 203, 3639, 277, 18, 458, 7800, 12, 6193, 4216, 1179, 18, 22639, 67, 12289, 67, 16879, 67, 1985, 16, 3089, 461, 1769, 203, 3639, 787, 1179, 12, 77, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 4356, 326, 1348, 434, 326, 913, 4516, 203, 377, 380, 1839, 333, 16, 326, 5728, 1410, 745, 4076, 1435, 203, 377, 380, 203, 377, 380, 632, 891, 1407, 1489, 282, 326, 1407, 880, 364, 326, 1348, 203, 377, 380, 632, 891, 13508, 3245, 9195, 2502, 364, 326, 1348, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
2da8ad2a52bd0b6d007b810b07ca84d013262c4c
hansemannn/titanium-drag-and-drop
android/src/ti/draganddrop/TitaniumDragAndDropModule.java
[ "MIT" ]
Java
onDrawShadow
null
@Override public void onDrawShadow(Canvas canvas) { // Draws the ColorDrawable in the Canvas passed in from the system. shadow.draw(canvas); }
// from the dimensions passed in onProvideShadowMetrics().
from the dimensions passed in onProvideShadowMetrics().
[ "from", "the", "dimensions", "passed", "in", "onProvideShadowMetrics", "()", "." ]
@Override public void onDrawShadow(Canvas canvas) { shadow.draw(canvas); }
[ "@", "Override", "public", "void", "onDrawShadow", "(", "Canvas", "canvas", ")", "{", "shadow", ".", "draw", "(", "canvas", ")", ";", "}" ]
from the dimensions passed in onProvideShadowMetrics().
[ "from", "the", "dimensions", "passed", "in", "onProvideShadowMetrics", "()", "." ]
[ "// Draws the ColorDrawable in the Canvas passed in from the system." ]
[ { "param": "canvas", "type": "Canvas" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "canvas", "type": "Canvas", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 202, 202, 482, 918, 603, 6493, 12957, 12, 12971, 5953, 13, 288, 203, 1082, 202, 759, 10184, 87, 326, 5563, 16149, 316, 326, 20966, 2275, 316, 628, 326, 2619, 18, 203, 1082, 202, 19119, 18, 9446, 12, 15424, 1769, 203, 202, 202, 97, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 759, 628, 326, 5769, 2275, 316, 603, 20632, 12957, 5653, 7675, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
a197fbc633fa351f6210be1900ba38cfb18d4042
Hurence/historian
historian-server/src/main/java/com/hurence/webapiservice/timeseries/extractor/AbstractTimeSeriesExtracter.java
[ "Apache-2.0" ]
Java
samplePointsInBufferAndCalculAggregThenReset
null
protected void samplePointsInBufferAndCalculAggregThenReset() { if (LOGGER.isTraceEnabled()) { LOGGER.trace("sample measures in buffer has been called with chunks : {}", chunks.stream().map(Chunk::toString).collect(Collectors.joining("\n"))); } samplePointsFromChunksAndCalculAggreg(from, to, chunks); chunks.clear(); totalPointCounter +=pointCounter; pointCounter = 0; }
/** * Extract/Sample measures from the list of chunks in buffer using a strategy. Add them into sampled measures then reset buffer */
Extract/Sample measures from the list of chunks in buffer using a strategy. Add them into sampled measures then reset buffer
[ "Extract", "/", "Sample", "measures", "from", "the", "list", "of", "chunks", "in", "buffer", "using", "a", "strategy", ".", "Add", "them", "into", "sampled", "measures", "then", "reset", "buffer" ]
protected void samplePointsInBufferAndCalculAggregThenReset() { if (LOGGER.isTraceEnabled()) { LOGGER.trace("sample measures in buffer has been called with chunks : {}", chunks.stream().map(Chunk::toString).collect(Collectors.joining("\n"))); } samplePointsFromChunksAndCalculAggreg(from, to, chunks); chunks.clear(); totalPointCounter +=pointCounter; pointCounter = 0; }
[ "protected", "void", "samplePointsInBufferAndCalculAggregThenReset", "(", ")", "{", "if", "(", "LOGGER", ".", "isTraceEnabled", "(", ")", ")", "{", "LOGGER", ".", "trace", "(", "\"sample measures in buffer has been called with chunks : {}\"", ",", "chunks", ".", "stream", "(", ")", ".", "map", "(", "Chunk", "::", "toString", ")", ".", "collect", "(", "Collectors", ".", "joining", "(", "\"\\n\"", ")", ")", ")", ";", "}", "samplePointsFromChunksAndCalculAggreg", "(", "from", ",", "to", ",", "chunks", ")", ";", "chunks", ".", "clear", "(", ")", ";", "totalPointCounter", "+=", "pointCounter", ";", "pointCounter", "=", "0", ";", "}" ]
Extract/Sample measures from the list of chunks in buffer using a strategy.
[ "Extract", "/", "Sample", "measures", "from", "the", "list", "of", "chunks", "in", "buffer", "using", "a", "strategy", "." ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 4750, 918, 3296, 5636, 382, 1892, 1876, 4844, 6078, 20112, 7013, 1435, 288, 203, 3639, 309, 261, 8757, 18, 291, 3448, 1526, 10756, 288, 203, 5411, 4145, 18, 5129, 2932, 6358, 22692, 316, 1613, 711, 2118, 2566, 598, 6055, 294, 3728, 16, 203, 10792, 6055, 18, 3256, 7675, 1458, 12, 5579, 2866, 10492, 2934, 14676, 12, 10808, 1383, 18, 5701, 310, 31458, 82, 6, 3719, 1769, 203, 3639, 289, 203, 3639, 3296, 5636, 1265, 14975, 1876, 4844, 6078, 12, 2080, 16, 358, 16, 6055, 1769, 203, 3639, 6055, 18, 8507, 5621, 203, 3639, 2078, 2148, 4789, 1011, 1153, 4789, 31, 203, 3639, 1634, 4789, 273, 374, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 1508, 2715, 1613, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
35cd19001ded9b9951812c1b0b381dbaf247c677
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/sampling/AbstractFirstItemSampler.java
[ "Apache-2.0" ]
Java
sample
null
@Override public List<SAMPLED> sample(List<SAMPLED> toBeSampled) { return group(toBeSampled) .map(bucket -> bucket.get(0)) .collect(Collectors.toList()); }
/** * divide the points sequence into equally sized buckets * and select the first point of each bucket * * @param toBeSampled the input list * @return */
divide the points sequence into equally sized buckets and select the first point of each bucket @param toBeSampled the input list @return
[ "divide", "the", "points", "sequence", "into", "equally", "sized", "buckets", "and", "select", "the", "first", "point", "of", "each", "bucket", "@param", "toBeSampled", "the", "input", "list", "@return" ]
@Override public List<SAMPLED> sample(List<SAMPLED> toBeSampled) { return group(toBeSampled) .map(bucket -> bucket.get(0)) .collect(Collectors.toList()); }
[ "@", "Override", "public", "List", "<", "SAMPLED", ">", "sample", "(", "List", "<", "SAMPLED", ">", "toBeSampled", ")", "{", "return", "group", "(", "toBeSampled", ")", ".", "map", "(", "bucket", "->", "bucket", ".", "get", "(", "0", ")", ")", ".", "collect", "(", "Collectors", ".", "toList", "(", ")", ")", ";", "}" ]
divide the points sequence into equally sized buckets and select the first point of each bucket
[ "divide", "the", "points", "sequence", "into", "equally", "sized", "buckets", "and", "select", "the", "first", "point", "of", "each", "bucket" ]
[]
[ { "param": "toBeSampled", "type": "List<SAMPLED>" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "toBeSampled", "type": "List<SAMPLED>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 565, 1071, 987, 32, 55, 8900, 6687, 34, 3296, 12, 682, 32, 55, 8900, 6687, 34, 21333, 55, 14814, 13, 288, 203, 3639, 327, 1041, 12, 869, 1919, 55, 14814, 13, 203, 7734, 263, 1458, 12, 7242, 317, 2783, 18, 588, 12, 20, 3719, 203, 7734, 263, 14676, 12, 10808, 1383, 18, 869, 682, 10663, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 12326, 326, 3143, 3102, 1368, 1298, 1230, 26046, 9169, 203, 377, 380, 471, 2027, 326, 1122, 1634, 434, 1517, 2783, 203, 377, 380, 203, 377, 380, 632, 891, 21333, 55, 14814, 326, 810, 666, 203, 377, 380, 632, 2463, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
7858f6e07d222fa11bc7bc466b70e2ab9ec2e625
Hurence/historian
historian-server/src/main/java/com/hurence/webapiservice/historian/handler/GetTimeSeriesHandler.java
[ "Apache-2.0" ]
Java
updateTags
null
private List<MetricRequest> updateTags(List<MetricRequest> requests, Request request) { List<MetricRequest> resultRequests = new ArrayList<>(); requests.forEach(req -> { // if (req.getTags() == null || req.getTags().isEmpty()) { try { // build Solr Query facet on metric_key final String queryString = String.format("name:\"%s\" AND %s:[* TO %d] AND %s:[%d TO *]", req.getName(), SOLR_COLUMN_START, request.getTo(), SOLR_COLUMN_END, request.getFrom()); final SolrQuery query = new SolrQuery() .setQuery(queryString) .setRows(0) .setFacet(true) .setFacetMinCount(1) .setFacetLimit(5000) .addFacetField(SOLR_COLUMN_METRIC_KEY); final QueryResponse response = solrHistorianConf.client .query(solrHistorianConf.chunkCollection, query); // parse solr doc results to get all tags JsonArray data = new JsonArray(); FacetField facetField = response.getFacetField(SOLR_COLUMN_METRIC_KEY); if (facetField == null || facetField.getValues() == null) { LOGGER.warn("unable to retrieve any metric_key from facet : {}", query.toQueryString()); } else { facetField.getValues().forEach(value -> { String name = value.getName(); long count = value.getCount(); try { Chunk.MetricKey metricKey = Chunk.MetricKey.parse(name); if(req.getTags().isEmpty() || !Collections.disjoint(metricKey.getTags().keySet(), req.getTags().keySet() )) { MetricRequest newReq = new MetricRequest(metricKey.getName(), metricKey.getTags(), req.getQualityConfig()); resultRequests.add(newReq); } } catch (Exception e) { LOGGER.debug("error parsing metric key, {}", name); } }); } LOGGER.debug("done computing MetricRequests"); } catch (IOException | SolrServerException e) { LOGGER.error("unexpected exception", e); } /* }else{ resultRequests.add(req); }*/ }); return resultRequests; }
/** * will issue a solr facet query on metric_key to identify different tags and chunk sizes */
will issue a solr facet query on metric_key to identify different tags and chunk sizes
[ "will", "issue", "a", "solr", "facet", "query", "on", "metric_key", "to", "identify", "different", "tags", "and", "chunk", "sizes" ]
private List<MetricRequest> updateTags(List<MetricRequest> requests, Request request) { List<MetricRequest> resultRequests = new ArrayList<>(); requests.forEach(req -> { try { final String queryString = String.format("name:\"%s\" AND %s:[* TO %d] AND %s:[%d TO *]", req.getName(), SOLR_COLUMN_START, request.getTo(), SOLR_COLUMN_END, request.getFrom()); final SolrQuery query = new SolrQuery() .setQuery(queryString) .setRows(0) .setFacet(true) .setFacetMinCount(1) .setFacetLimit(5000) .addFacetField(SOLR_COLUMN_METRIC_KEY); final QueryResponse response = solrHistorianConf.client .query(solrHistorianConf.chunkCollection, query); JsonArray data = new JsonArray(); FacetField facetField = response.getFacetField(SOLR_COLUMN_METRIC_KEY); if (facetField == null || facetField.getValues() == null) { LOGGER.warn("unable to retrieve any metric_key from facet : {}", query.toQueryString()); } else { facetField.getValues().forEach(value -> { String name = value.getName(); long count = value.getCount(); try { Chunk.MetricKey metricKey = Chunk.MetricKey.parse(name); if(req.getTags().isEmpty() || !Collections.disjoint(metricKey.getTags().keySet(), req.getTags().keySet() )) { MetricRequest newReq = new MetricRequest(metricKey.getName(), metricKey.getTags(), req.getQualityConfig()); resultRequests.add(newReq); } } catch (Exception e) { LOGGER.debug("error parsing metric key, {}", name); } }); } LOGGER.debug("done computing MetricRequests"); } catch (IOException | SolrServerException e) { LOGGER.error("unexpected exception", e); } /* }else{ resultRequests.add(req); }*/ }); return resultRequests; }
[ "private", "List", "<", "MetricRequest", ">", "updateTags", "(", "List", "<", "MetricRequest", ">", "requests", ",", "Request", "request", ")", "{", "List", "<", "MetricRequest", ">", "resultRequests", "=", "new", "ArrayList", "<", ">", "(", ")", ";", "requests", ".", "forEach", "(", "req", "->", "{", "try", "{", "final", "String", "queryString", "=", "String", ".", "format", "(", "\"name:\\\"%s\\\" AND %s:[* TO %d] AND %s:[%d TO *]\"", ",", "req", ".", "getName", "(", ")", ",", "SOLR_COLUMN_START", ",", "request", ".", "getTo", "(", ")", ",", "SOLR_COLUMN_END", ",", "request", ".", "getFrom", "(", ")", ")", ";", "final", "SolrQuery", "query", "=", "new", "SolrQuery", "(", ")", ".", "setQuery", "(", "queryString", ")", ".", "setRows", "(", "0", ")", ".", "setFacet", "(", "true", ")", ".", "setFacetMinCount", "(", "1", ")", ".", "setFacetLimit", "(", "5000", ")", ".", "addFacetField", "(", "SOLR_COLUMN_METRIC_KEY", ")", ";", "final", "QueryResponse", "response", "=", "solrHistorianConf", ".", "client", ".", "query", "(", "solrHistorianConf", ".", "chunkCollection", ",", "query", ")", ";", "JsonArray", "data", "=", "new", "JsonArray", "(", ")", ";", "FacetField", "facetField", "=", "response", ".", "getFacetField", "(", "SOLR_COLUMN_METRIC_KEY", ")", ";", "if", "(", "facetField", "==", "null", "||", "facetField", ".", "getValues", "(", ")", "==", "null", ")", "{", "LOGGER", ".", "warn", "(", "\"unable to retrieve any metric_key from facet : {}\"", ",", "query", ".", "toQueryString", "(", ")", ")", ";", "}", "else", "{", "facetField", ".", "getValues", "(", ")", ".", "forEach", "(", "value", "->", "{", "String", "name", "=", "value", ".", "getName", "(", ")", ";", "long", "count", "=", "value", ".", "getCount", "(", ")", ";", "try", "{", "Chunk", ".", "MetricKey", "metricKey", "=", "Chunk", ".", "MetricKey", ".", "parse", "(", "name", ")", ";", "if", "(", "req", ".", "getTags", "(", ")", ".", "isEmpty", "(", ")", "||", "!", "Collections", ".", "disjoint", "(", "metricKey", ".", "getTags", "(", ")", ".", "keySet", "(", ")", ",", "req", ".", "getTags", "(", ")", ".", "keySet", "(", ")", ")", ")", "{", "MetricRequest", "newReq", "=", "new", "MetricRequest", "(", "metricKey", ".", "getName", "(", ")", ",", "metricKey", ".", "getTags", "(", ")", ",", "req", ".", "getQualityConfig", "(", ")", ")", ";", "resultRequests", ".", "add", "(", "newReq", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "LOGGER", ".", "debug", "(", "\"error parsing metric key, {}\"", ",", "name", ")", ";", "}", "}", ")", ";", "}", "LOGGER", ".", "debug", "(", "\"done computing MetricRequests\"", ")", ";", "}", "catch", "(", "IOException", "|", "SolrServerException", "e", ")", "{", "LOGGER", ".", "error", "(", "\"unexpected exception\"", ",", "e", ")", ";", "}", "/* }else{\n resultRequests.add(req);\n }*/", "}", ")", ";", "return", "resultRequests", ";", "}" ]
will issue a solr facet query on metric_key to identify different tags and chunk sizes
[ "will", "issue", "a", "solr", "facet", "query", "on", "metric_key", "to", "identify", "different", "tags", "and", "chunk", "sizes" ]
[ "// if (req.getTags() == null || req.getTags().isEmpty()) {", "// build Solr Query facet on metric_key", "// parse solr doc results to get all tags" ]
[ { "param": "requests", "type": "List<MetricRequest>" }, { "param": "request", "type": "Request" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "requests", "type": "List<MetricRequest>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "request", "type": "Request", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 3238, 987, 32, 5396, 691, 34, 1089, 3453, 12, 682, 32, 5396, 691, 34, 3285, 16, 1567, 590, 13, 288, 203, 203, 3639, 987, 32, 5396, 691, 34, 563, 6421, 273, 394, 2407, 29667, 5621, 203, 203, 3639, 3285, 18, 1884, 3442, 12, 3658, 317, 288, 203, 203, 1850, 368, 225, 309, 261, 3658, 18, 588, 3453, 1435, 422, 446, 747, 1111, 18, 588, 3453, 7675, 291, 1921, 10756, 288, 203, 203, 7734, 775, 288, 203, 203, 203, 10792, 368, 1361, 19026, 2770, 11082, 603, 3999, 67, 856, 203, 10792, 727, 514, 11337, 273, 514, 18, 2139, 2932, 529, 30, 2412, 9, 87, 2412, 4116, 738, 87, 30, 63, 14, 8493, 738, 72, 65, 4116, 738, 87, 30, 14451, 72, 8493, 380, 65, 3113, 203, 18701, 1111, 18, 17994, 9334, 203, 18701, 27175, 54, 67, 11009, 67, 7570, 16, 203, 18701, 590, 18, 588, 774, 9334, 203, 18701, 27175, 54, 67, 11009, 67, 4415, 16, 203, 18701, 590, 18, 588, 1265, 10663, 203, 203, 10792, 727, 19026, 1138, 843, 273, 394, 19026, 1138, 1435, 203, 18701, 263, 542, 1138, 12, 2271, 780, 13, 203, 18701, 263, 542, 4300, 12, 20, 13, 203, 18701, 263, 542, 11137, 12, 3767, 13, 203, 18701, 263, 542, 11137, 2930, 1380, 12, 21, 13, 203, 18701, 263, 542, 11137, 3039, 12, 25, 3784, 13, 203, 18701, 263, 1289, 11137, 974, 12, 19815, 54, 67, 11009, 67, 23081, 39, 67, 3297, 1769, 203, 203, 10792, 727, 2770, 1064, 766, 273, 15575, 8648, 280, 2779, 3976, 18, 2625, 203, 18701, 263, 2271, 12, 22495, 8648, 280, 2779, 3976, 18, 6551, 2532, 16, 843, 1769, 203, 203, 10792, 368, 1109, 15575, 997, 1686, 358, 336, 777, 2342, 203, 10792, 25109, 501, 273, 394, 25109, 5621, 203, 10792, 31872, 974, 11082, 974, 273, 766, 18, 588, 11137, 974, 12, 19815, 54, 67, 11009, 67, 23081, 39, 67, 3297, 1769, 203, 10792, 309, 261, 21568, 974, 422, 446, 747, 11082, 974, 18, 588, 1972, 1435, 422, 446, 13, 288, 203, 13491, 4145, 18, 8935, 2932, 18828, 358, 4614, 1281, 3999, 67, 856, 628, 11082, 294, 3728, 16, 843, 18, 869, 15276, 10663, 203, 10792, 289, 469, 288, 203, 13491, 11082, 974, 18, 588, 1972, 7675, 1884, 3442, 12, 1132, 317, 288, 203, 18701, 514, 508, 273, 460, 18, 17994, 5621, 203, 18701, 1525, 1056, 273, 460, 18, 588, 1380, 5621, 203, 18701, 775, 288, 203, 27573, 13021, 18, 5396, 653, 3999, 653, 273, 13021, 18, 5396, 653, 18, 2670, 12, 529, 1769, 203, 27573, 309, 12, 3658, 18, 588, 3453, 7675, 291, 1921, 1435, 747, 401, 15150, 18, 2251, 16452, 12, 6899, 653, 18, 588, 3453, 7675, 856, 694, 9334, 1111, 18, 588, 3453, 7675, 856, 694, 1435, 8623, 203, 27573, 288, 203, 4766, 565, 7279, 691, 394, 6113, 273, 394, 7279, 691, 12, 6899, 653, 18, 17994, 9334, 3999, 653, 18, 588, 3453, 9334, 1111, 18, 588, 14846, 809, 10663, 203, 4766, 565, 563, 6421, 18, 1289, 12, 2704, 6113, 1769, 203, 27573, 289, 203, 203, 18701, 289, 1044, 261, 503, 425, 13, 288, 203, 2 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
[ 1, 26873, 203, 377, 380, 903, 5672, 279, 15575, 11082, 843, 603, 3999, 67, 856, 358, 9786, 3775, 2342, 471, 2441, 8453, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
7858f6e07d222fa11bc7bc466b70e2ab9ec2e625
Hurence/historian
historian-server/src/main/java/com/hurence/webapiservice/historian/handler/GetTimeSeriesHandler.java
[ "Apache-2.0" ]
Java
findNeededTagsName
null
public static List<String> findNeededTagsName(List<MetricRequest> requests) { Set<String> tagsSet = new HashSet<>(); requests.forEach(metricRequest -> { tagsSet.addAll(metricRequest.getTags().keySet()); }); return new ArrayList<>(tagsSet); }
/** * return all tags name needed for querying metrics. * * @param requests * @return */
return all tags name needed for querying metrics. @param requests @return
[ "return", "all", "tags", "name", "needed", "for", "querying", "metrics", ".", "@param", "requests", "@return" ]
public static List<String> findNeededTagsName(List<MetricRequest> requests) { Set<String> tagsSet = new HashSet<>(); requests.forEach(metricRequest -> { tagsSet.addAll(metricRequest.getTags().keySet()); }); return new ArrayList<>(tagsSet); }
[ "public", "static", "List", "<", "String", ">", "findNeededTagsName", "(", "List", "<", "MetricRequest", ">", "requests", ")", "{", "Set", "<", "String", ">", "tagsSet", "=", "new", "HashSet", "<", ">", "(", ")", ";", "requests", ".", "forEach", "(", "metricRequest", "->", "{", "tagsSet", ".", "addAll", "(", "metricRequest", ".", "getTags", "(", ")", ".", "keySet", "(", ")", ")", ";", "}", ")", ";", "return", "new", "ArrayList", "<", ">", "(", "tagsSet", ")", ";", "}" ]
return all tags name needed for querying metrics.
[ "return", "all", "tags", "name", "needed", "for", "querying", "metrics", "." ]
[]
[ { "param": "requests", "type": "List<MetricRequest>" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "requests", "type": "List<MetricRequest>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 760, 987, 32, 780, 34, 1104, 11449, 3453, 461, 12, 682, 32, 5396, 691, 34, 3285, 13, 288, 203, 3639, 1000, 32, 780, 34, 2342, 694, 273, 394, 6847, 29667, 5621, 203, 3639, 3285, 18, 1884, 3442, 12, 6899, 691, 317, 288, 203, 5411, 2342, 694, 18, 1289, 1595, 12, 6899, 691, 18, 588, 3453, 7675, 856, 694, 10663, 203, 3639, 15549, 203, 3639, 327, 394, 2407, 29667, 12, 4156, 694, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 327, 777, 2342, 508, 3577, 364, 23936, 4309, 18, 203, 377, 380, 203, 377, 380, 632, 891, 3285, 203, 377, 380, 632, 2463, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
7858f6e07d222fa11bc7bc466b70e2ab9ec2e625
Hurence/historian
historian-server/src/main/java/com/hurence/webapiservice/historian/handler/GetTimeSeriesHandler.java
[ "Apache-2.0" ]
Java
isTupleMatchingMetricRequest
null
private boolean isTupleMatchingMetricRequest(MetricRequest request, Tuple tuple) { if (!request.getName().equals(tuple.fields.get(SOLR_COLUMN_NAME))) { return false; } else { for (Map.Entry<String, String> entry : request.getTags().entrySet()) { if (!tuple.fields.get(entry.getKey()).toString().equals(entry.getValue())) return false; } return true; } }
/** * return true if the tuple (one document response from solr) match the query for MetricRequest * * @param request the asked query. This is a combinaison of "name" and tags. * @param tuple the count of chunks and measures for all chunk matching the query. * There is a tuple for each combinaison of name/tag found. * <p> * for example something like that (each line is a tuple except the header) * <pre> * name | usine | sensor | count(*) | sum(chunk_count) * temp_a | usine_1 | sensor_1 | 100 | 1000 * temp_a | usine_1 | sensor_2 | 10 | 100 * temp_b | usine_1 | null | 100 | 1000 * </pre> * @return */
return true if the tuple (one document response from solr) match the query for MetricRequest @param request the asked query. This is a combinaison of "name" and tags. @param tuple the count of chunks and measures for all chunk matching the query. There is a tuple for each combinaison of name/tag found.
[ "return", "true", "if", "the", "tuple", "(", "one", "document", "response", "from", "solr", ")", "match", "the", "query", "for", "MetricRequest", "@param", "request", "the", "asked", "query", ".", "This", "is", "a", "combinaison", "of", "\"", "name", "\"", "and", "tags", ".", "@param", "tuple", "the", "count", "of", "chunks", "and", "measures", "for", "all", "chunk", "matching", "the", "query", ".", "There", "is", "a", "tuple", "for", "each", "combinaison", "of", "name", "/", "tag", "found", "." ]
private boolean isTupleMatchingMetricRequest(MetricRequest request, Tuple tuple) { if (!request.getName().equals(tuple.fields.get(SOLR_COLUMN_NAME))) { return false; } else { for (Map.Entry<String, String> entry : request.getTags().entrySet()) { if (!tuple.fields.get(entry.getKey()).toString().equals(entry.getValue())) return false; } return true; } }
[ "private", "boolean", "isTupleMatchingMetricRequest", "(", "MetricRequest", "request", ",", "Tuple", "tuple", ")", "{", "if", "(", "!", "request", ".", "getName", "(", ")", ".", "equals", "(", "tuple", ".", "fields", ".", "get", "(", "SOLR_COLUMN_NAME", ")", ")", ")", "{", "return", "false", ";", "}", "else", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", ":", "request", ".", "getTags", "(", ")", ".", "entrySet", "(", ")", ")", "{", "if", "(", "!", "tuple", ".", "fields", ".", "get", "(", "entry", ".", "getKey", "(", ")", ")", ".", "toString", "(", ")", ".", "equals", "(", "entry", ".", "getValue", "(", ")", ")", ")", "return", "false", ";", "}", "return", "true", ";", "}", "}" ]
return true if the tuple (one document response from solr) match the query for MetricRequest @param request the asked query.
[ "return", "true", "if", "the", "tuple", "(", "one", "document", "response", "from", "solr", ")", "match", "the", "query", "for", "MetricRequest", "@param", "request", "the", "asked", "query", "." ]
[]
[ { "param": "request", "type": "MetricRequest" }, { "param": "tuple", "type": "Tuple" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": "MetricRequest", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "tuple", "type": "Tuple", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 3238, 1250, 353, 9038, 9517, 5396, 691, 12, 5396, 691, 590, 16, 7257, 3193, 13, 288, 203, 3639, 309, 16051, 2293, 18, 17994, 7675, 14963, 12, 8052, 18, 2821, 18, 588, 12, 19815, 54, 67, 11009, 67, 1985, 20349, 288, 203, 5411, 327, 629, 31, 203, 3639, 289, 469, 288, 203, 5411, 364, 261, 863, 18, 1622, 32, 780, 16, 514, 34, 1241, 294, 590, 18, 588, 3453, 7675, 4099, 694, 10756, 288, 203, 7734, 309, 16051, 8052, 18, 2821, 18, 588, 12, 4099, 18, 588, 653, 1435, 2934, 10492, 7675, 14963, 12, 4099, 18, 24805, 1435, 3719, 203, 10792, 327, 629, 31, 203, 5411, 289, 203, 5411, 327, 638, 31, 203, 3639, 289, 203, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 327, 638, 309, 326, 3193, 261, 476, 1668, 766, 628, 15575, 13, 845, 326, 843, 364, 7279, 691, 203, 377, 380, 203, 377, 380, 632, 891, 590, 326, 19279, 843, 18, 1220, 353, 279, 3894, 15314, 4530, 434, 315, 529, 6, 471, 2342, 18, 203, 377, 380, 632, 891, 3193, 282, 326, 1056, 434, 6055, 471, 22692, 364, 777, 2441, 3607, 326, 843, 18, 203, 377, 380, 7734, 6149, 353, 279, 3193, 364, 1517, 3894, 15314, 4530, 434, 508, 19, 2692, 1392, 18, 203, 377, 380, 7734, 411, 84, 34, 203, 377, 380, 7734, 364, 3454, 5943, 3007, 716, 261, 13798, 980, 353, 279, 3193, 1335, 326, 1446, 13, 203, 377, 380, 7734, 411, 1484, 34, 203, 377, 380, 28524, 4766, 3639, 2 ]
7858f6e07d222fa11bc7bc466b70e2ab9ec2e625
Hurence/historian
historian-server/src/main/java/com/hurence/webapiservice/historian/handler/GetTimeSeriesHandler.java
[ "Apache-2.0" ]
Java
isQueryMode2ConsideringNotQueryMode1
null
private boolean isQueryMode2ConsideringNotQueryMode1(Request request, MetricsSizeInfo metricsInfo) { if (!request.getUseQuality()) { return metricsInfo.getTotalNumberOfChunks() < solrHistorianConf.limitNumberOfChunks; } else { return metricsInfo.getTotalNumberOfChunksWithCorrectQuality() < solrHistorianConf.limitNumberOfChunks; } }
/** * We suppose that we already know that this is not QUERY MODE 1 * * @param metricsInfo * @return true if we should use query mode 2 (sampling with pre agg) */
We suppose that we already know that this is not QUERY MODE 1 @param metricsInfo @return true if we should use query mode 2 (sampling with pre agg)
[ "We", "suppose", "that", "we", "already", "know", "that", "this", "is", "not", "QUERY", "MODE", "1", "@param", "metricsInfo", "@return", "true", "if", "we", "should", "use", "query", "mode", "2", "(", "sampling", "with", "pre", "agg", ")" ]
private boolean isQueryMode2ConsideringNotQueryMode1(Request request, MetricsSizeInfo metricsInfo) { if (!request.getUseQuality()) { return metricsInfo.getTotalNumberOfChunks() < solrHistorianConf.limitNumberOfChunks; } else { return metricsInfo.getTotalNumberOfChunksWithCorrectQuality() < solrHistorianConf.limitNumberOfChunks; } }
[ "private", "boolean", "isQueryMode2ConsideringNotQueryMode1", "(", "Request", "request", ",", "MetricsSizeInfo", "metricsInfo", ")", "{", "if", "(", "!", "request", ".", "getUseQuality", "(", ")", ")", "{", "return", "metricsInfo", ".", "getTotalNumberOfChunks", "(", ")", "<", "solrHistorianConf", ".", "limitNumberOfChunks", ";", "}", "else", "{", "return", "metricsInfo", ".", "getTotalNumberOfChunksWithCorrectQuality", "(", ")", "<", "solrHistorianConf", ".", "limitNumberOfChunks", ";", "}", "}" ]
We suppose that we already know that this is not QUERY MODE 1 @param metricsInfo @return true if we should use query mode 2 (sampling with pre agg)
[ "We", "suppose", "that", "we", "already", "know", "that", "this", "is", "not", "QUERY", "MODE", "1", "@param", "metricsInfo", "@return", "true", "if", "we", "should", "use", "query", "mode", "2", "(", "sampling", "with", "pre", "agg", ")" ]
[]
[ { "param": "request", "type": "Request" }, { "param": "metricsInfo", "type": "MetricsSizeInfo" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": "Request", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "metricsInfo", "type": "MetricsSizeInfo", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 3238, 1250, 353, 1138, 2309, 22, 9054, 3585, 310, 1248, 1138, 2309, 21, 12, 691, 590, 16, 10845, 1225, 966, 4309, 966, 13, 288, 203, 3639, 309, 16051, 2293, 18, 588, 3727, 14846, 10756, 288, 203, 5411, 327, 4309, 966, 18, 588, 5269, 9226, 14975, 1435, 411, 15575, 8648, 280, 2779, 3976, 18, 3595, 9226, 14975, 31, 203, 3639, 289, 469, 288, 203, 5411, 327, 4309, 966, 18, 588, 5269, 9226, 14975, 1190, 16147, 14846, 1435, 411, 15575, 8648, 280, 2779, 3976, 18, 3595, 9226, 14975, 31, 203, 3639, 289, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 1660, 1169, 4150, 716, 732, 1818, 5055, 716, 333, 353, 486, 17089, 11741, 404, 203, 377, 380, 203, 377, 380, 632, 891, 4309, 966, 203, 377, 380, 632, 2463, 638, 309, 732, 1410, 999, 843, 1965, 576, 261, 23002, 598, 675, 10421, 13, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
7858f6e07d222fa11bc7bc466b70e2ab9ec2e625
Hurence/historian
historian-server/src/main/java/com/hurence/webapiservice/historian/handler/GetTimeSeriesHandler.java
[ "Apache-2.0" ]
Java
isQueryMode1
null
private boolean isQueryMode1(Request request, MetricsSizeInfo metricsInfo) { boolean isQueryMode1; if (!request.getUseQuality()) { isQueryMode1 = metricsInfo.getTotalNumberOfPoints() < solrHistorianConf.limitNumberOfPoint || metricsInfo.getTotalNumberOfPoints() <= getSamplingConf(request).getMaxPoint() || metricsInfo.getTotalNumberOfChunks() < getSamplingConf(request).getMaxPoint(); if (LOGGER.isDebugEnabled() && isQueryMode1) { String queryModeMsg = "QUERY MODE 1 because : \n"; if (metricsInfo.getTotalNumberOfPoints() < solrHistorianConf.limitNumberOfPoint) { queryModeMsg += "metricsInfo.getTotalNumberOfPoints() < solrHistorianConf.limitNumberOfPoint\n"; } if (metricsInfo.getTotalNumberOfPoints() <= getSamplingConf(request).getMaxPoint()) { queryModeMsg += "metricsInfo.getTotalNumberOfPoints() <= getSamplingConf(request).getMaxPoint()\n"; } if (metricsInfo.getTotalNumberOfChunks() < getSamplingConf(request).getMaxPoint()) { queryModeMsg += "metricsInfo.getTotalNumberOfChunks() < getSamplingConf(request).getMaxPoint()\n"; } LOGGER.debug(queryModeMsg); } } else { isQueryMode1 = metricsInfo.getTotalNumberOfPointsWithCorrectQuality() < solrHistorianConf.limitNumberOfPoint || metricsInfo.getTotalNumberOfPointsWithCorrectQuality() <= getSamplingConf(request).getMaxPoint() || metricsInfo.getTotalNumberOfChunksWithCorrectQuality() < getSamplingConf(request).getMaxPoint(); if (LOGGER.isDebugEnabled() && isQueryMode1) { String queryModeMsg = "QUERY MODE 1 because : \n"; if (metricsInfo.getTotalNumberOfPointsWithCorrectQuality() < solrHistorianConf.limitNumberOfPoint) { queryModeMsg += "metricsInfo.getTotalNumberOfPointsWithCorrectQuality() < solrHistorianConf.limitNumberOfPoint\n"; } if (metricsInfo.getTotalNumberOfPointsWithCorrectQuality() <= getSamplingConf(request).getMaxPoint()) { queryModeMsg += "metricsInfo.getTotalNumberOfPointsWithCorrectQuality() <= getSamplingConf(request).getMaxPoint()\n"; } if (metricsInfo.getTotalNumberOfChunksWithCorrectQuality() < getSamplingConf(request).getMaxPoint()) { queryModeMsg += "metricsInfo.getTotalNumberOfChunksWithCorrectQuality() < getSamplingConf(request).getMaxPoint()\n"; } LOGGER.debug(queryModeMsg); } } return isQueryMode1; }
/** * @param metricsInfo * @return true if we should use query mode 1 not using pre agg and decompressing all chunks. */
@param metricsInfo @return true if we should use query mode 1 not using pre agg and decompressing all chunks.
[ "@param", "metricsInfo", "@return", "true", "if", "we", "should", "use", "query", "mode", "1", "not", "using", "pre", "agg", "and", "decompressing", "all", "chunks", "." ]
private boolean isQueryMode1(Request request, MetricsSizeInfo metricsInfo) { boolean isQueryMode1; if (!request.getUseQuality()) { isQueryMode1 = metricsInfo.getTotalNumberOfPoints() < solrHistorianConf.limitNumberOfPoint || metricsInfo.getTotalNumberOfPoints() <= getSamplingConf(request).getMaxPoint() || metricsInfo.getTotalNumberOfChunks() < getSamplingConf(request).getMaxPoint(); if (LOGGER.isDebugEnabled() && isQueryMode1) { String queryModeMsg = "QUERY MODE 1 because : \n"; if (metricsInfo.getTotalNumberOfPoints() < solrHistorianConf.limitNumberOfPoint) { queryModeMsg += "metricsInfo.getTotalNumberOfPoints() < solrHistorianConf.limitNumberOfPoint\n"; } if (metricsInfo.getTotalNumberOfPoints() <= getSamplingConf(request).getMaxPoint()) { queryModeMsg += "metricsInfo.getTotalNumberOfPoints() <= getSamplingConf(request).getMaxPoint()\n"; } if (metricsInfo.getTotalNumberOfChunks() < getSamplingConf(request).getMaxPoint()) { queryModeMsg += "metricsInfo.getTotalNumberOfChunks() < getSamplingConf(request).getMaxPoint()\n"; } LOGGER.debug(queryModeMsg); } } else { isQueryMode1 = metricsInfo.getTotalNumberOfPointsWithCorrectQuality() < solrHistorianConf.limitNumberOfPoint || metricsInfo.getTotalNumberOfPointsWithCorrectQuality() <= getSamplingConf(request).getMaxPoint() || metricsInfo.getTotalNumberOfChunksWithCorrectQuality() < getSamplingConf(request).getMaxPoint(); if (LOGGER.isDebugEnabled() && isQueryMode1) { String queryModeMsg = "QUERY MODE 1 because : \n"; if (metricsInfo.getTotalNumberOfPointsWithCorrectQuality() < solrHistorianConf.limitNumberOfPoint) { queryModeMsg += "metricsInfo.getTotalNumberOfPointsWithCorrectQuality() < solrHistorianConf.limitNumberOfPoint\n"; } if (metricsInfo.getTotalNumberOfPointsWithCorrectQuality() <= getSamplingConf(request).getMaxPoint()) { queryModeMsg += "metricsInfo.getTotalNumberOfPointsWithCorrectQuality() <= getSamplingConf(request).getMaxPoint()\n"; } if (metricsInfo.getTotalNumberOfChunksWithCorrectQuality() < getSamplingConf(request).getMaxPoint()) { queryModeMsg += "metricsInfo.getTotalNumberOfChunksWithCorrectQuality() < getSamplingConf(request).getMaxPoint()\n"; } LOGGER.debug(queryModeMsg); } } return isQueryMode1; }
[ "private", "boolean", "isQueryMode1", "(", "Request", "request", ",", "MetricsSizeInfo", "metricsInfo", ")", "{", "boolean", "isQueryMode1", ";", "if", "(", "!", "request", ".", "getUseQuality", "(", ")", ")", "{", "isQueryMode1", "=", "metricsInfo", ".", "getTotalNumberOfPoints", "(", ")", "<", "solrHistorianConf", ".", "limitNumberOfPoint", "||", "metricsInfo", ".", "getTotalNumberOfPoints", "(", ")", "<=", "getSamplingConf", "(", "request", ")", ".", "getMaxPoint", "(", ")", "||", "metricsInfo", ".", "getTotalNumberOfChunks", "(", ")", "<", "getSamplingConf", "(", "request", ")", ".", "getMaxPoint", "(", ")", ";", "if", "(", "LOGGER", ".", "isDebugEnabled", "(", ")", "&&", "isQueryMode1", ")", "{", "String", "queryModeMsg", "=", "\"QUERY MODE 1 because : \\n\"", ";", "if", "(", "metricsInfo", ".", "getTotalNumberOfPoints", "(", ")", "<", "solrHistorianConf", ".", "limitNumberOfPoint", ")", "{", "queryModeMsg", "+=", "\"metricsInfo.getTotalNumberOfPoints() < solrHistorianConf.limitNumberOfPoint\\n\"", ";", "}", "if", "(", "metricsInfo", ".", "getTotalNumberOfPoints", "(", ")", "<=", "getSamplingConf", "(", "request", ")", ".", "getMaxPoint", "(", ")", ")", "{", "queryModeMsg", "+=", "\"metricsInfo.getTotalNumberOfPoints() <= getSamplingConf(request).getMaxPoint()\\n\"", ";", "}", "if", "(", "metricsInfo", ".", "getTotalNumberOfChunks", "(", ")", "<", "getSamplingConf", "(", "request", ")", ".", "getMaxPoint", "(", ")", ")", "{", "queryModeMsg", "+=", "\"metricsInfo.getTotalNumberOfChunks() < getSamplingConf(request).getMaxPoint()\\n\"", ";", "}", "LOGGER", ".", "debug", "(", "queryModeMsg", ")", ";", "}", "}", "else", "{", "isQueryMode1", "=", "metricsInfo", ".", "getTotalNumberOfPointsWithCorrectQuality", "(", ")", "<", "solrHistorianConf", ".", "limitNumberOfPoint", "||", "metricsInfo", ".", "getTotalNumberOfPointsWithCorrectQuality", "(", ")", "<=", "getSamplingConf", "(", "request", ")", ".", "getMaxPoint", "(", ")", "||", "metricsInfo", ".", "getTotalNumberOfChunksWithCorrectQuality", "(", ")", "<", "getSamplingConf", "(", "request", ")", ".", "getMaxPoint", "(", ")", ";", "if", "(", "LOGGER", ".", "isDebugEnabled", "(", ")", "&&", "isQueryMode1", ")", "{", "String", "queryModeMsg", "=", "\"QUERY MODE 1 because : \\n\"", ";", "if", "(", "metricsInfo", ".", "getTotalNumberOfPointsWithCorrectQuality", "(", ")", "<", "solrHistorianConf", ".", "limitNumberOfPoint", ")", "{", "queryModeMsg", "+=", "\"metricsInfo.getTotalNumberOfPointsWithCorrectQuality() < solrHistorianConf.limitNumberOfPoint\\n\"", ";", "}", "if", "(", "metricsInfo", ".", "getTotalNumberOfPointsWithCorrectQuality", "(", ")", "<=", "getSamplingConf", "(", "request", ")", ".", "getMaxPoint", "(", ")", ")", "{", "queryModeMsg", "+=", "\"metricsInfo.getTotalNumberOfPointsWithCorrectQuality() <= getSamplingConf(request).getMaxPoint()\\n\"", ";", "}", "if", "(", "metricsInfo", ".", "getTotalNumberOfChunksWithCorrectQuality", "(", ")", "<", "getSamplingConf", "(", "request", ")", ".", "getMaxPoint", "(", ")", ")", "{", "queryModeMsg", "+=", "\"metricsInfo.getTotalNumberOfChunksWithCorrectQuality() < getSamplingConf(request).getMaxPoint()\\n\"", ";", "}", "LOGGER", ".", "debug", "(", "queryModeMsg", ")", ";", "}", "}", "return", "isQueryMode1", ";", "}" ]
@param metricsInfo @return true if we should use query mode 1 not using pre agg and decompressing all chunks.
[ "@param", "metricsInfo", "@return", "true", "if", "we", "should", "use", "query", "mode", "1", "not", "using", "pre", "agg", "and", "decompressing", "all", "chunks", "." ]
[]
[ { "param": "request", "type": "Request" }, { "param": "metricsInfo", "type": "MetricsSizeInfo" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "request", "type": "Request", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "metricsInfo", "type": "MetricsSizeInfo", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 3238, 1250, 353, 1138, 2309, 21, 12, 691, 590, 16, 10845, 1225, 966, 4309, 966, 13, 288, 203, 3639, 1250, 353, 1138, 2309, 21, 31, 203, 3639, 309, 16051, 2293, 18, 588, 3727, 14846, 10756, 288, 203, 5411, 353, 1138, 2309, 21, 273, 4309, 966, 18, 588, 5269, 9226, 5636, 1435, 411, 15575, 8648, 280, 2779, 3976, 18, 3595, 9226, 2148, 747, 203, 10792, 4309, 966, 18, 588, 5269, 9226, 5636, 1435, 1648, 1322, 7639, 3976, 12, 2293, 2934, 588, 2747, 2148, 1435, 747, 203, 10792, 4309, 966, 18, 588, 5269, 9226, 14975, 1435, 411, 1322, 7639, 3976, 12, 2293, 2934, 588, 2747, 2148, 5621, 203, 5411, 309, 261, 8757, 18, 291, 2829, 1526, 1435, 597, 353, 1138, 2309, 21, 13, 288, 203, 7734, 514, 843, 2309, 3332, 273, 315, 10753, 11741, 404, 2724, 294, 521, 82, 14432, 203, 7734, 309, 261, 9597, 966, 18, 588, 5269, 9226, 5636, 1435, 411, 15575, 8648, 280, 2779, 3976, 18, 3595, 9226, 2148, 13, 288, 203, 10792, 843, 2309, 3332, 1011, 315, 9597, 966, 18, 588, 5269, 9226, 5636, 1435, 411, 15575, 8648, 280, 2779, 3976, 18, 3595, 9226, 2148, 64, 82, 14432, 203, 7734, 289, 203, 7734, 309, 261, 9597, 966, 18, 588, 5269, 9226, 5636, 1435, 1648, 1322, 7639, 3976, 12, 2293, 2934, 588, 2747, 2148, 10756, 288, 203, 10792, 843, 2309, 3332, 1011, 315, 9597, 966, 18, 588, 5269, 9226, 5636, 1435, 1648, 1322, 7639, 3976, 12, 2293, 2934, 588, 2747, 2148, 1435, 64, 82, 14432, 203, 7734, 289, 203, 7734, 309, 261, 9597, 966, 18, 588, 5269, 9226, 14975, 1435, 411, 1322, 7639, 3976, 12, 2293, 2934, 588, 2747, 2148, 10756, 288, 203, 10792, 843, 2309, 3332, 1011, 315, 9597, 966, 18, 588, 5269, 9226, 14975, 1435, 411, 1322, 7639, 3976, 12, 2293, 2934, 588, 2747, 2148, 1435, 64, 82, 14432, 203, 7734, 289, 203, 7734, 4145, 18, 4148, 12, 2271, 2309, 3332, 1769, 203, 5411, 289, 203, 3639, 289, 469, 288, 203, 5411, 353, 1138, 2309, 21, 273, 4309, 966, 18, 588, 5269, 9226, 5636, 1190, 16147, 14846, 1435, 411, 15575, 8648, 280, 2779, 3976, 18, 3595, 9226, 2148, 747, 203, 10792, 4309, 966, 18, 588, 5269, 9226, 5636, 1190, 16147, 14846, 1435, 1648, 1322, 7639, 3976, 12, 2293, 2934, 588, 2747, 2148, 1435, 747, 203, 10792, 4309, 966, 18, 588, 5269, 9226, 14975, 1190, 16147, 14846, 1435, 411, 1322, 7639, 3976, 12, 2293, 2934, 588, 2747, 2148, 5621, 203, 5411, 309, 261, 8757, 18, 291, 2829, 1526, 1435, 597, 353, 1138, 2309, 21, 13, 288, 203, 7734, 514, 843, 2309, 3332, 273, 315, 10753, 11741, 404, 2724, 294, 521, 82, 14432, 203, 7734, 309, 261, 9597, 966, 18, 588, 5269, 9226, 5636, 1190, 16147, 14846, 1435, 411, 15575, 8648, 280, 2779, 3976, 18, 3595, 9226, 2148, 13, 288, 203, 10792, 843, 2309, 3332, 1011, 315, 9597, 966, 18, 588, 5269, 9226, 5636, 1190, 16147, 14846, 1435, 411, 15575, 8648, 280, 2779, 3976, 18, 3595, 9226, 2148, 64, 82, 14432, 203, 7734, 289, 203, 7734, 309, 261, 9597, 966, 18, 588, 5269, 9226, 5636, 2 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
[ 1, 26873, 203, 377, 380, 632, 891, 4309, 966, 203, 377, 380, 632, 2463, 638, 309, 732, 1410, 999, 843, 1965, 404, 486, 1450, 675, 10421, 471, 16824, 310, 777, 6055, 18, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
2874cfd1d22412c73f7014f138dd20b90580c298
Hurence/historian
historian-server/src/main/java/com/hurence/webapiservice/http/api/ingestion/util/CsvConvertorUtil.java
[ "Apache-2.0" ]
Java
ConvertCsvFileToJson
null
public static void ConvertCsvFileToJson(CsvFileConvertor convertor, CsvFilesConvertorConf csvFilesConvertorConf) throws IOException { String fileName = convertor.file.uploadedFileName(); MappingIterator<Map> rows = getMappingIteratorFromFile(fileName); List<LineWithDateInfo> linesWithDateInfo = ReturnLineWithDateInfoList(rows, csvFilesConvertorConf); if (linesWithDateInfo.size() > csvFilesConvertorConf.getMaxNumberOfLignes()) { throw new IOException(String.valueOf(linesWithDateInfo.size())); } DataConverter dataConverter = new DataConverter(csvFilesConvertorConf); convertor.fileInArray = dataConverter.toGroupedByMetricDataPoints(linesWithDateInfo); }
/** * @param convertor CsvFileConvertor * * convert the csv file to json , and putting the json in convertor.fileInArray * * @return void */
@param convertor CsvFileConvertor convert the csv file to json , and putting the json in convertor.fileInArray @return void
[ "@param", "convertor", "CsvFileConvertor", "convert", "the", "csv", "file", "to", "json", "and", "putting", "the", "json", "in", "convertor", ".", "fileInArray", "@return", "void" ]
public static void ConvertCsvFileToJson(CsvFileConvertor convertor, CsvFilesConvertorConf csvFilesConvertorConf) throws IOException { String fileName = convertor.file.uploadedFileName(); MappingIterator<Map> rows = getMappingIteratorFromFile(fileName); List<LineWithDateInfo> linesWithDateInfo = ReturnLineWithDateInfoList(rows, csvFilesConvertorConf); if (linesWithDateInfo.size() > csvFilesConvertorConf.getMaxNumberOfLignes()) { throw new IOException(String.valueOf(linesWithDateInfo.size())); } DataConverter dataConverter = new DataConverter(csvFilesConvertorConf); convertor.fileInArray = dataConverter.toGroupedByMetricDataPoints(linesWithDateInfo); }
[ "public", "static", "void", "ConvertCsvFileToJson", "(", "CsvFileConvertor", "convertor", ",", "CsvFilesConvertorConf", "csvFilesConvertorConf", ")", "throws", "IOException", "{", "String", "fileName", "=", "convertor", ".", "file", ".", "uploadedFileName", "(", ")", ";", "MappingIterator", "<", "Map", ">", "rows", "=", "getMappingIteratorFromFile", "(", "fileName", ")", ";", "List", "<", "LineWithDateInfo", ">", "linesWithDateInfo", "=", "ReturnLineWithDateInfoList", "(", "rows", ",", "csvFilesConvertorConf", ")", ";", "if", "(", "linesWithDateInfo", ".", "size", "(", ")", ">", "csvFilesConvertorConf", ".", "getMaxNumberOfLignes", "(", ")", ")", "{", "throw", "new", "IOException", "(", "String", ".", "valueOf", "(", "linesWithDateInfo", ".", "size", "(", ")", ")", ")", ";", "}", "DataConverter", "dataConverter", "=", "new", "DataConverter", "(", "csvFilesConvertorConf", ")", ";", "convertor", ".", "fileInArray", "=", "dataConverter", ".", "toGroupedByMetricDataPoints", "(", "linesWithDateInfo", ")", ";", "}" ]
@param convertor CsvFileConvertor convert the csv file to json , and putting the json in convertor.fileInArray
[ "@param", "convertor", "CsvFileConvertor", "convert", "the", "csv", "file", "to", "json", "and", "putting", "the", "json", "in", "convertor", ".", "fileInArray" ]
[]
[ { "param": "convertor", "type": "CsvFileConvertor" }, { "param": "csvFilesConvertorConf", "type": "CsvFilesConvertorConf" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "convertor", "type": "CsvFileConvertor", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "csvFilesConvertorConf", "type": "CsvFilesConvertorConf", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 760, 918, 4037, 16759, 812, 774, 3185, 12, 16759, 812, 2723, 280, 1765, 280, 16, 21532, 2697, 2723, 280, 3976, 6101, 2697, 2723, 280, 3976, 13, 1216, 1860, 288, 203, 3639, 514, 3968, 273, 1765, 280, 18, 768, 18, 23249, 4771, 5621, 203, 3639, 9408, 3198, 32, 863, 34, 2595, 273, 22575, 3198, 13087, 12, 17812, 1769, 203, 3639, 987, 32, 1670, 1190, 1626, 966, 34, 2362, 1190, 1626, 966, 273, 2000, 1670, 1190, 1626, 17914, 12, 3870, 16, 6101, 2697, 2723, 280, 3976, 1769, 203, 3639, 309, 261, 3548, 1190, 1626, 966, 18, 1467, 1435, 405, 6101, 2697, 2723, 280, 3976, 18, 588, 2747, 9226, 48, 724, 281, 10756, 288, 203, 5411, 604, 394, 1860, 12, 780, 18, 1132, 951, 12, 3548, 1190, 1626, 966, 18, 1467, 1435, 10019, 203, 3639, 289, 203, 3639, 1910, 5072, 501, 5072, 273, 394, 1910, 5072, 12, 6715, 2697, 2723, 280, 3976, 1769, 203, 3639, 1765, 280, 18, 768, 382, 1076, 273, 501, 5072, 18, 869, 1114, 18696, 28858, 5636, 12, 3548, 1190, 1626, 966, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 632, 891, 1765, 280, 3639, 21532, 812, 2723, 280, 203, 377, 380, 203, 377, 380, 1765, 326, 6101, 585, 358, 1163, 269, 471, 29379, 326, 1163, 316, 1765, 280, 18, 768, 382, 1076, 203, 377, 380, 203, 377, 380, 632, 2463, 918, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
2874cfd1d22412c73f7014f138dd20b90580c298
Hurence/historian
historian-server/src/main/java/com/hurence/webapiservice/http/api/ingestion/util/CsvConvertorUtil.java
[ "Apache-2.0" ]
Java
ReturnLineWithDateInfoList
null
private static List<LineWithDateInfo> ReturnLineWithDateInfoList(MappingIterator<Map> rows, CsvFilesConvertorConf csvFilesConvertorConf) throws IOException { List<Map> listFromRows = rows.readAll(); // here just checking the attributes : verifyAttributes(listFromRows, csvFilesConvertorConf); List<LineWithDateInfo> linesWithDateInfos = new LinkedList<>(); listFromRows.forEach(i -> { try { // if date is generated from timestamp successfully String date = generateDateFromTime(i.get(csvFilesConvertorConf.getTimestamp()), csvFilesConvertorConf); linesWithDateInfos.add(new LineWithDateInfo(i,date)); }catch (Exception e) { // otherwise put null as date LOGGER.debug("error in parsing date", e); linesWithDateInfos.add(new LineWithDateInfo(i,null)); } }); return linesWithDateInfos; }
/** * @param rows MappingIterator<Map> * @param csvFilesConvertorConf CsvFilesConvertorConf * * return a list of LineWithDateInfo * for each row construct a LineWithDateInfo object, if there is no date use null. * * @return List<LineWithDateInfo> */
return a list of LineWithDateInfo for each row construct a LineWithDateInfo object, if there is no date use null. @return List
[ "return", "a", "list", "of", "LineWithDateInfo", "for", "each", "row", "construct", "a", "LineWithDateInfo", "object", "if", "there", "is", "no", "date", "use", "null", ".", "@return", "List" ]
private static List<LineWithDateInfo> ReturnLineWithDateInfoList(MappingIterator<Map> rows, CsvFilesConvertorConf csvFilesConvertorConf) throws IOException { List<Map> listFromRows = rows.readAll(); verifyAttributes(listFromRows, csvFilesConvertorConf); List<LineWithDateInfo> linesWithDateInfos = new LinkedList<>(); listFromRows.forEach(i -> { try { String date = generateDateFromTime(i.get(csvFilesConvertorConf.getTimestamp()), csvFilesConvertorConf); linesWithDateInfos.add(new LineWithDateInfo(i,date)); }catch (Exception e) { LOGGER.debug("error in parsing date", e); linesWithDateInfos.add(new LineWithDateInfo(i,null)); } }); return linesWithDateInfos; }
[ "private", "static", "List", "<", "LineWithDateInfo", ">", "ReturnLineWithDateInfoList", "(", "MappingIterator", "<", "Map", ">", "rows", ",", "CsvFilesConvertorConf", "csvFilesConvertorConf", ")", "throws", "IOException", "{", "List", "<", "Map", ">", "listFromRows", "=", "rows", ".", "readAll", "(", ")", ";", "verifyAttributes", "(", "listFromRows", ",", "csvFilesConvertorConf", ")", ";", "List", "<", "LineWithDateInfo", ">", "linesWithDateInfos", "=", "new", "LinkedList", "<", ">", "(", ")", ";", "listFromRows", ".", "forEach", "(", "i", "->", "{", "try", "{", "String", "date", "=", "generateDateFromTime", "(", "i", ".", "get", "(", "csvFilesConvertorConf", ".", "getTimestamp", "(", ")", ")", ",", "csvFilesConvertorConf", ")", ";", "linesWithDateInfos", ".", "add", "(", "new", "LineWithDateInfo", "(", "i", ",", "date", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "LOGGER", ".", "debug", "(", "\"error in parsing date\"", ",", "e", ")", ";", "linesWithDateInfos", ".", "add", "(", "new", "LineWithDateInfo", "(", "i", ",", "null", ")", ")", ";", "}", "}", ")", ";", "return", "linesWithDateInfos", ";", "}" ]
@param rows MappingIterator<Map> @param csvFilesConvertorConf CsvFilesConvertorConf
[ "@param", "rows", "MappingIterator<Map", ">", "@param", "csvFilesConvertorConf", "CsvFilesConvertorConf" ]
[ "// here just checking the attributes :", "// if date is generated from timestamp successfully", "// otherwise put null as date" ]
[ { "param": "rows", "type": "MappingIterator<Map>" }, { "param": "csvFilesConvertorConf", "type": "CsvFilesConvertorConf" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "rows", "type": "MappingIterator<Map>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "csvFilesConvertorConf", "type": "CsvFilesConvertorConf", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 3238, 760, 987, 32, 1670, 1190, 1626, 966, 34, 2000, 1670, 1190, 1626, 17914, 12, 3233, 3198, 32, 863, 34, 2595, 16, 203, 4766, 19694, 21532, 2697, 2723, 280, 3976, 6101, 2697, 2723, 280, 3976, 13, 1216, 1860, 288, 203, 3639, 987, 32, 863, 34, 666, 1265, 4300, 273, 2595, 18, 896, 1595, 5621, 203, 203, 3639, 368, 2674, 2537, 6728, 326, 1677, 294, 203, 3639, 3929, 2498, 12, 1098, 1265, 4300, 16, 6101, 2697, 2723, 280, 3976, 1769, 203, 203, 3639, 987, 32, 1670, 1190, 1626, 966, 34, 2362, 1190, 1626, 7655, 273, 394, 10688, 29667, 5621, 203, 3639, 666, 1265, 4300, 18, 1884, 3442, 12, 77, 317, 288, 203, 5411, 775, 288, 203, 7734, 368, 309, 1509, 353, 4374, 628, 2858, 4985, 203, 7734, 514, 1509, 273, 2103, 1626, 1265, 950, 12, 77, 18, 588, 12, 6715, 2697, 2723, 280, 3976, 18, 588, 4921, 1435, 3631, 6101, 2697, 2723, 280, 3976, 1769, 203, 7734, 2362, 1190, 1626, 7655, 18, 1289, 12, 2704, 5377, 1190, 1626, 966, 12, 77, 16, 712, 10019, 203, 5411, 289, 14683, 261, 503, 425, 13, 288, 203, 7734, 368, 3541, 1378, 446, 487, 1509, 203, 7734, 4145, 18, 4148, 2932, 1636, 316, 5811, 1509, 3113, 425, 1769, 203, 7734, 2362, 1190, 1626, 7655, 18, 1289, 12, 2704, 5377, 1190, 1626, 966, 12, 77, 16, 2011, 10019, 203, 5411, 289, 203, 3639, 15549, 203, 3639, 327, 225, 2362, 1190, 1626, 7655, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 632, 891, 2595, 10402, 9408, 3198, 32, 863, 34, 203, 377, 380, 632, 891, 6101, 2697, 2723, 280, 3976, 225, 21532, 2697, 2723, 280, 3976, 203, 377, 380, 203, 377, 380, 327, 279, 666, 434, 225, 5377, 1190, 1626, 966, 203, 377, 380, 364, 1517, 1027, 4872, 279, 5377, 1190, 1626, 966, 733, 16, 309, 1915, 353, 1158, 1509, 999, 446, 18, 203, 377, 380, 203, 377, 380, 632, 2463, 987, 32, 1670, 1190, 1626, 966, 34, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
2874cfd1d22412c73f7014f138dd20b90580c298
Hurence/historian
historian-server/src/main/java/com/hurence/webapiservice/http/api/ingestion/util/CsvConvertorUtil.java
[ "Apache-2.0" ]
Java
verifyAttributes
null
private static void verifyAttributes(List<Map> listFromRows, CsvFilesConvertorConf csvFilesConvertorConf) { listFromRows.forEach(i -> { Set<String> keySet = i.keySet(); if ( (csvFilesConvertorConf.getName() != null) && (!keySet.contains(csvFilesConvertorConf.getName()))) throw new NoSuchElementException("error in the attributes : the attribute name :"+ csvFilesConvertorConf.getName() + " don't exist in the csv, you can use the attribute " +CUSTOM_NAME); if (!keySet.contains(csvFilesConvertorConf.getTimestamp())) throw new NoSuchElementException("error in the attributes"); if (!keySet.contains(csvFilesConvertorConf.getValue())) throw new NoSuchElementException("error in the attributes"); if (csvFilesConvertorConf.getQuality() != null && (!keySet.contains(csvFilesConvertorConf.getQuality()))) throw new NoSuchElementException("error in the attributes"); }); }
/** * @param listFromRows List<Map> * @param csvFilesConvertorConf CsvFilesConvertorConf * * verify if this list from the csv file have the same column as the attributes in input : * name, timestamp, value, and all the tags. * */
verify if this list from the csv file have the same column as the attributes in input : name, timestamp, value, and all the tags.
[ "verify", "if", "this", "list", "from", "the", "csv", "file", "have", "the", "same", "column", "as", "the", "attributes", "in", "input", ":", "name", "timestamp", "value", "and", "all", "the", "tags", "." ]
private static void verifyAttributes(List<Map> listFromRows, CsvFilesConvertorConf csvFilesConvertorConf) { listFromRows.forEach(i -> { Set<String> keySet = i.keySet(); if ( (csvFilesConvertorConf.getName() != null) && (!keySet.contains(csvFilesConvertorConf.getName()))) throw new NoSuchElementException("error in the attributes : the attribute name :"+ csvFilesConvertorConf.getName() + " don't exist in the csv, you can use the attribute " +CUSTOM_NAME); if (!keySet.contains(csvFilesConvertorConf.getTimestamp())) throw new NoSuchElementException("error in the attributes"); if (!keySet.contains(csvFilesConvertorConf.getValue())) throw new NoSuchElementException("error in the attributes"); if (csvFilesConvertorConf.getQuality() != null && (!keySet.contains(csvFilesConvertorConf.getQuality()))) throw new NoSuchElementException("error in the attributes"); }); }
[ "private", "static", "void", "verifyAttributes", "(", "List", "<", "Map", ">", "listFromRows", ",", "CsvFilesConvertorConf", "csvFilesConvertorConf", ")", "{", "listFromRows", ".", "forEach", "(", "i", "->", "{", "Set", "<", "String", ">", "keySet", "=", "i", ".", "keySet", "(", ")", ";", "if", "(", "(", "csvFilesConvertorConf", ".", "getName", "(", ")", "!=", "null", ")", "&&", "(", "!", "keySet", ".", "contains", "(", "csvFilesConvertorConf", ".", "getName", "(", ")", ")", ")", ")", "throw", "new", "NoSuchElementException", "(", "\"error in the attributes : the attribute name :\"", "+", "csvFilesConvertorConf", ".", "getName", "(", ")", "+", "\" don't exist in the csv, you can use the attribute \"", "+", "CUSTOM_NAME", ")", ";", "if", "(", "!", "keySet", ".", "contains", "(", "csvFilesConvertorConf", ".", "getTimestamp", "(", ")", ")", ")", "throw", "new", "NoSuchElementException", "(", "\"error in the attributes\"", ")", ";", "if", "(", "!", "keySet", ".", "contains", "(", "csvFilesConvertorConf", ".", "getValue", "(", ")", ")", ")", "throw", "new", "NoSuchElementException", "(", "\"error in the attributes\"", ")", ";", "if", "(", "csvFilesConvertorConf", ".", "getQuality", "(", ")", "!=", "null", "&&", "(", "!", "keySet", ".", "contains", "(", "csvFilesConvertorConf", ".", "getQuality", "(", ")", ")", ")", ")", "throw", "new", "NoSuchElementException", "(", "\"error in the attributes\"", ")", ";", "}", ")", ";", "}" ]
@param listFromRows List<Map> @param csvFilesConvertorConf CsvFilesConvertorConf
[ "@param", "listFromRows", "List<Map", ">", "@param", "csvFilesConvertorConf", "CsvFilesConvertorConf" ]
[]
[ { "param": "listFromRows", "type": "List<Map>" }, { "param": "csvFilesConvertorConf", "type": "CsvFilesConvertorConf" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "listFromRows", "type": "List<Map>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "csvFilesConvertorConf", "type": "CsvFilesConvertorConf", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 3238, 760, 918, 3929, 2498, 12, 682, 32, 863, 34, 666, 1265, 4300, 16, 21532, 2697, 2723, 280, 3976, 6101, 2697, 2723, 280, 3976, 13, 288, 203, 3639, 666, 1265, 4300, 18, 1884, 3442, 12, 77, 317, 225, 288, 203, 5411, 1000, 32, 780, 34, 7685, 273, 277, 18, 856, 694, 5621, 203, 5411, 309, 261, 261, 6715, 2697, 2723, 280, 3976, 18, 17994, 1435, 480, 446, 13, 597, 16051, 856, 694, 18, 12298, 12, 6715, 2697, 2723, 280, 3976, 18, 17994, 1435, 20349, 203, 7734, 604, 394, 23104, 2932, 1636, 316, 326, 1677, 294, 326, 1566, 508, 20514, 15, 6101, 2697, 2723, 280, 3976, 18, 17994, 1435, 203, 4766, 7734, 397, 315, 2727, 1404, 1005, 316, 326, 6101, 16, 1846, 848, 999, 326, 1566, 315, 397, 15136, 67, 1985, 1769, 203, 5411, 309, 16051, 856, 694, 18, 12298, 12, 6715, 2697, 2723, 280, 3976, 18, 588, 4921, 1435, 3719, 203, 7734, 604, 394, 23104, 2932, 1636, 316, 326, 1677, 8863, 203, 5411, 309, 16051, 856, 694, 18, 12298, 12, 6715, 2697, 2723, 280, 3976, 18, 24805, 1435, 3719, 203, 7734, 604, 394, 23104, 2932, 1636, 316, 326, 1677, 8863, 203, 5411, 309, 261, 6715, 2697, 2723, 280, 3976, 18, 588, 14846, 1435, 480, 446, 597, 16051, 856, 694, 18, 12298, 12, 6715, 2697, 2723, 280, 3976, 18, 588, 14846, 1435, 20349, 203, 7734, 604, 394, 23104, 2932, 1636, 316, 326, 1677, 8863, 203, 3639, 15549, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 632, 891, 666, 1265, 4300, 6647, 987, 32, 863, 34, 203, 377, 380, 632, 891, 6101, 2697, 2723, 280, 3976, 225, 21532, 2697, 2723, 280, 3976, 203, 377, 380, 203, 377, 380, 3929, 309, 333, 666, 628, 326, 6101, 585, 1240, 326, 1967, 1057, 487, 326, 1677, 316, 810, 294, 203, 377, 380, 1171, 9079, 508, 16, 2858, 16, 460, 16, 471, 777, 326, 2342, 18, 203, 377, 380, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
0a0f3109d38cb8d830ad2be35a0b12254ec87a64
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/functions/transformation/NonNegativeDerivative.java
[ "Apache-2.0" ]
Java
execute
null
@Override public void execute(MetricTimeSeries timeSeries, FunctionValueMap functionValueMap) { //we need a sorted time series timeSeries.sort(); long[] times = timeSeries.getTimestampsAsArray(); double[] values = timeSeries.getValuesAsArray(); //Clear the time series timeSeries.clear(); for (int i = 1; i < values.length - 1; i++) { long yT1 = times[i + 1]; long yT0 = times[i - 1]; double xT1 = values[i + 1]; double xT0 = values[i - 1]; double derivativeValue = DerivativeUtil.derivative(xT1, xT0, yT1, yT0); if (derivativeValue >= 0) { //We use the average time of long derivativeTime = yT1 + (yT1 - yT0) / 2; timeSeries.add(derivativeTime, derivativeValue); } } functionValueMap.add(this); }
/** * Calculates the derivative of the time series * * @param timeSeries the time series that is transformed */
Calculates the derivative of the time series @param timeSeries the time series that is transformed
[ "Calculates", "the", "derivative", "of", "the", "time", "series", "@param", "timeSeries", "the", "time", "series", "that", "is", "transformed" ]
@Override public void execute(MetricTimeSeries timeSeries, FunctionValueMap functionValueMap) { timeSeries.sort(); long[] times = timeSeries.getTimestampsAsArray(); double[] values = timeSeries.getValuesAsArray(); timeSeries.clear(); for (int i = 1; i < values.length - 1; i++) { long yT1 = times[i + 1]; long yT0 = times[i - 1]; double xT1 = values[i + 1]; double xT0 = values[i - 1]; double derivativeValue = DerivativeUtil.derivative(xT1, xT0, yT1, yT0); if (derivativeValue >= 0) { long derivativeTime = yT1 + (yT1 - yT0) / 2; timeSeries.add(derivativeTime, derivativeValue); } } functionValueMap.add(this); }
[ "@", "Override", "public", "void", "execute", "(", "MetricTimeSeries", "timeSeries", ",", "FunctionValueMap", "functionValueMap", ")", "{", "timeSeries", ".", "sort", "(", ")", ";", "long", "[", "]", "times", "=", "timeSeries", ".", "getTimestampsAsArray", "(", ")", ";", "double", "[", "]", "values", "=", "timeSeries", ".", "getValuesAsArray", "(", ")", ";", "timeSeries", ".", "clear", "(", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "values", ".", "length", "-", "1", ";", "i", "++", ")", "{", "long", "yT1", "=", "times", "[", "i", "+", "1", "]", ";", "long", "yT0", "=", "times", "[", "i", "-", "1", "]", ";", "double", "xT1", "=", "values", "[", "i", "+", "1", "]", ";", "double", "xT0", "=", "values", "[", "i", "-", "1", "]", ";", "double", "derivativeValue", "=", "DerivativeUtil", ".", "derivative", "(", "xT1", ",", "xT0", ",", "yT1", ",", "yT0", ")", ";", "if", "(", "derivativeValue", ">=", "0", ")", "{", "long", "derivativeTime", "=", "yT1", "+", "(", "yT1", "-", "yT0", ")", "/", "2", ";", "timeSeries", ".", "add", "(", "derivativeTime", ",", "derivativeValue", ")", ";", "}", "}", "functionValueMap", ".", "add", "(", "this", ")", ";", "}" ]
Calculates the derivative of the time series @param timeSeries the time series that is transformed
[ "Calculates", "the", "derivative", "of", "the", "time", "series", "@param", "timeSeries", "the", "time", "series", "that", "is", "transformed" ]
[ "//we need a sorted time series", "//Clear the time series", "//We use the average time of" ]
[ { "param": "timeSeries", "type": "MetricTimeSeries" }, { "param": "functionValueMap", "type": "FunctionValueMap" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "timeSeries", "type": "MetricTimeSeries", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "functionValueMap", "type": "FunctionValueMap", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 565, 1071, 918, 1836, 12, 5396, 28486, 813, 6485, 16, 4284, 26795, 445, 26795, 13, 288, 203, 3639, 368, 1814, 1608, 279, 3115, 813, 4166, 203, 3639, 813, 6485, 18, 3804, 5621, 203, 203, 3639, 1525, 8526, 4124, 273, 813, 6485, 18, 588, 23761, 19196, 5621, 203, 3639, 1645, 8526, 924, 273, 813, 6485, 18, 588, 1972, 19196, 5621, 203, 203, 3639, 368, 9094, 326, 813, 4166, 203, 3639, 813, 6485, 18, 8507, 5621, 203, 203, 3639, 364, 261, 474, 277, 273, 404, 31, 277, 411, 924, 18, 2469, 300, 404, 31, 277, 27245, 288, 203, 203, 5411, 1525, 677, 56, 21, 273, 4124, 63, 77, 397, 404, 15533, 203, 5411, 1525, 677, 56, 20, 273, 4124, 63, 77, 300, 404, 15533, 203, 203, 5411, 1645, 619, 56, 21, 273, 924, 63, 77, 397, 404, 15533, 203, 5411, 1645, 619, 56, 20, 273, 924, 63, 77, 300, 404, 15533, 203, 203, 5411, 1645, 16417, 620, 273, 14969, 427, 1535, 1304, 18, 20615, 1535, 12, 92, 56, 21, 16, 619, 56, 20, 16, 677, 56, 21, 16, 677, 56, 20, 1769, 203, 203, 5411, 309, 261, 20615, 1535, 620, 1545, 374, 13, 288, 203, 7734, 368, 3218, 999, 326, 8164, 813, 434, 203, 7734, 1525, 16417, 950, 273, 677, 56, 21, 397, 261, 93, 56, 21, 300, 677, 56, 20, 13, 342, 576, 31, 203, 7734, 813, 6485, 18, 1289, 12, 20615, 1535, 950, 16, 16417, 620, 1769, 203, 5411, 289, 203, 3639, 289, 203, 3639, 445, 26795, 18, 1289, 12, 2211, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 434, 326, 813, 4166, 203, 377, 380, 203, 377, 380, 632, 891, 813, 6485, 326, 813, 4166, 716, 353, 10220, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
c928857bc92ffbccdf349f2eef803ed724fb63b1
Hurence/historian
historian-timeseries/src/main/java/com/hurence/forecasting/ArimaMeasureForecaster.java
[ "Apache-2.0" ]
Java
forecast
null
@Override public List<Measure> forecast(List<Measure> inputData, int numPoints) { double[] dataArray = measureToDouble(inputData); verifier(); ForecastResult forecastResult = Arima.forecast_arima(dataArray, numPoints, new ArimaParams(p, d, q, P, D, Q, m)); double[] forecastData = forecastResult.getForecast(); long lastTimestamp = inputData.get(inputData.size()-1).getTimestamp(); long preTimestamp = inputData.get(inputData.size()-2).getTimestamp(); long interval = lastTimestamp - preTimestamp; ArrayList<Measure> forecasted = new ArrayList<Measure>(); for (int i = 0; i < forecastData.length; i++) { forecasted.add(Measure.fromValue(lastTimestamp + interval * (i+1), forecastData[i])); } return forecasted; }
/** * Forecast the number of points we want of a time series * * @param inputData the series which we want to predict the next points * @param numPoints number of points to forecast * @return a list of measure with their timestamp and their forecasted values * @throws IOException */
Forecast the number of points we want of a time series @param inputData the series which we want to predict the next points @param numPoints number of points to forecast @return a list of measure with their timestamp and their forecasted values @throws IOException
[ "Forecast", "the", "number", "of", "points", "we", "want", "of", "a", "time", "series", "@param", "inputData", "the", "series", "which", "we", "want", "to", "predict", "the", "next", "points", "@param", "numPoints", "number", "of", "points", "to", "forecast", "@return", "a", "list", "of", "measure", "with", "their", "timestamp", "and", "their", "forecasted", "values", "@throws", "IOException" ]
@Override public List<Measure> forecast(List<Measure> inputData, int numPoints) { double[] dataArray = measureToDouble(inputData); verifier(); ForecastResult forecastResult = Arima.forecast_arima(dataArray, numPoints, new ArimaParams(p, d, q, P, D, Q, m)); double[] forecastData = forecastResult.getForecast(); long lastTimestamp = inputData.get(inputData.size()-1).getTimestamp(); long preTimestamp = inputData.get(inputData.size()-2).getTimestamp(); long interval = lastTimestamp - preTimestamp; ArrayList<Measure> forecasted = new ArrayList<Measure>(); for (int i = 0; i < forecastData.length; i++) { forecasted.add(Measure.fromValue(lastTimestamp + interval * (i+1), forecastData[i])); } return forecasted; }
[ "@", "Override", "public", "List", "<", "Measure", ">", "forecast", "(", "List", "<", "Measure", ">", "inputData", ",", "int", "numPoints", ")", "{", "double", "[", "]", "dataArray", "=", "measureToDouble", "(", "inputData", ")", ";", "verifier", "(", ")", ";", "ForecastResult", "forecastResult", "=", "Arima", ".", "forecast_arima", "(", "dataArray", ",", "numPoints", ",", "new", "ArimaParams", "(", "p", ",", "d", ",", "q", ",", "P", ",", "D", ",", "Q", ",", "m", ")", ")", ";", "double", "[", "]", "forecastData", "=", "forecastResult", ".", "getForecast", "(", ")", ";", "long", "lastTimestamp", "=", "inputData", ".", "get", "(", "inputData", ".", "size", "(", ")", "-", "1", ")", ".", "getTimestamp", "(", ")", ";", "long", "preTimestamp", "=", "inputData", ".", "get", "(", "inputData", ".", "size", "(", ")", "-", "2", ")", ".", "getTimestamp", "(", ")", ";", "long", "interval", "=", "lastTimestamp", "-", "preTimestamp", ";", "ArrayList", "<", "Measure", ">", "forecasted", "=", "new", "ArrayList", "<", "Measure", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "forecastData", ".", "length", ";", "i", "++", ")", "{", "forecasted", ".", "add", "(", "Measure", ".", "fromValue", "(", "lastTimestamp", "+", "interval", "*", "(", "i", "+", "1", ")", ",", "forecastData", "[", "i", "]", ")", ")", ";", "}", "return", "forecasted", ";", "}" ]
Forecast the number of points we want of a time series @param inputData the series which we want to predict the next points @param numPoints number of points to forecast @return a list of measure with their timestamp and their forecasted values @throws IOException
[ "Forecast", "the", "number", "of", "points", "we", "want", "of", "a", "time", "series", "@param", "inputData", "the", "series", "which", "we", "want", "to", "predict", "the", "next", "points", "@param", "numPoints", "number", "of", "points", "to", "forecast", "@return", "a", "list", "of", "measure", "with", "their", "timestamp", "and", "their", "forecasted", "values", "@throws", "IOException" ]
[]
[ { "param": "inputData", "type": "List<Measure>" }, { "param": "numPoints", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "inputData", "type": "List<Measure>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "numPoints", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 565, 1071, 987, 32, 7197, 34, 18763, 12, 682, 32, 7197, 34, 24149, 16, 509, 818, 5636, 13, 288, 203, 3639, 1645, 8526, 30541, 273, 6649, 774, 5265, 12, 2630, 751, 1769, 203, 3639, 20130, 5621, 203, 3639, 17605, 4155, 1253, 18763, 1253, 273, 1201, 13888, 18, 1405, 4155, 67, 297, 13888, 12, 892, 1076, 16, 818, 5636, 16, 394, 1201, 13888, 1370, 12, 84, 16, 302, 16, 1043, 16, 453, 16, 463, 16, 2238, 16, 312, 10019, 203, 3639, 1645, 8526, 18763, 751, 273, 18763, 1253, 18, 588, 13573, 4155, 5621, 203, 203, 3639, 1525, 1142, 4921, 273, 24149, 18, 588, 12, 2630, 751, 18, 1467, 1435, 17, 21, 2934, 588, 4921, 5621, 203, 3639, 1525, 675, 4921, 273, 24149, 18, 588, 12, 2630, 751, 18, 1467, 1435, 17, 22, 2934, 588, 4921, 5621, 203, 3639, 1525, 3673, 273, 1142, 4921, 300, 675, 4921, 31, 203, 203, 3639, 2407, 32, 7197, 34, 18763, 329, 273, 394, 2407, 32, 7197, 34, 5621, 203, 3639, 364, 261, 474, 277, 273, 374, 31, 277, 411, 18763, 751, 18, 2469, 31, 277, 27245, 288, 203, 5411, 18763, 329, 18, 1289, 12, 7197, 18, 2080, 620, 12, 2722, 4921, 397, 3673, 380, 261, 77, 15, 21, 3631, 18763, 751, 63, 77, 5717, 1769, 203, 3639, 289, 203, 3639, 327, 18763, 329, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 17605, 4155, 326, 1300, 434, 3143, 732, 2545, 434, 279, 813, 4166, 203, 377, 380, 203, 377, 380, 632, 891, 24149, 326, 4166, 1492, 732, 2545, 358, 7810, 326, 1024, 3143, 203, 377, 380, 632, 891, 818, 5636, 1300, 434, 3143, 358, 18763, 203, 377, 380, 632, 2463, 279, 666, 434, 6649, 598, 3675, 2858, 471, 3675, 18763, 329, 924, 203, 377, 380, 632, 15069, 1860, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
c928857bc92ffbccdf349f2eef803ed724fb63b1
Hurence/historian
historian-timeseries/src/main/java/com/hurence/forecasting/ArimaMeasureForecaster.java
[ "Apache-2.0" ]
Java
fit
null
@Override public void fit(List<Measure> trainingData, List<Measure> validatingData) { List<Integer> order = Arrays.asList(0, 0, 0, 0, 0, 0); double[] train = measureToDouble(trainingData); double[] valid = measureToDouble(validatingData); double minMse = 99999999; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { for (int k = 0; k < 10; k++) { ForecastResult forecastResult = null; if (i == 0 && k == 0) { forecastResult = Arima.forecast_arima(train, valid.length, new ArimaParams(1, j, k, P, D, Q, 1+k+1)); } else { forecastResult = Arima.forecast_arima(train, valid.length, new ArimaParams(i, j, k, P, D, Q, i+k+1)); } double[] forecastData = forecastResult.getForecast(); double mse = rootMeanSquaredError(valid, forecastData); if (mse < minMse) { minMse = mse; order.set(0, i); order.set(1, j); order.set(2, k); } } } } p = order.get(0); d = order.get(1); q = order.get(2); P = order.get(3); D = order.get(4); Q = order.get(5); m = p + q + P + Q + 1; }
/** * Find the ARIMA's parameters * * @param trainingData the given elements to train the model * @param validatingData the elements to compare with the forecasted values */
Find the ARIMA's parameters @param trainingData the given elements to train the model @param validatingData the elements to compare with the forecasted values
[ "Find", "the", "ARIMA", "'", "s", "parameters", "@param", "trainingData", "the", "given", "elements", "to", "train", "the", "model", "@param", "validatingData", "the", "elements", "to", "compare", "with", "the", "forecasted", "values" ]
@Override public void fit(List<Measure> trainingData, List<Measure> validatingData) { List<Integer> order = Arrays.asList(0, 0, 0, 0, 0, 0); double[] train = measureToDouble(trainingData); double[] valid = measureToDouble(validatingData); double minMse = 99999999; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { for (int k = 0; k < 10; k++) { ForecastResult forecastResult = null; if (i == 0 && k == 0) { forecastResult = Arima.forecast_arima(train, valid.length, new ArimaParams(1, j, k, P, D, Q, 1+k+1)); } else { forecastResult = Arima.forecast_arima(train, valid.length, new ArimaParams(i, j, k, P, D, Q, i+k+1)); } double[] forecastData = forecastResult.getForecast(); double mse = rootMeanSquaredError(valid, forecastData); if (mse < minMse) { minMse = mse; order.set(0, i); order.set(1, j); order.set(2, k); } } } } p = order.get(0); d = order.get(1); q = order.get(2); P = order.get(3); D = order.get(4); Q = order.get(5); m = p + q + P + Q + 1; }
[ "@", "Override", "public", "void", "fit", "(", "List", "<", "Measure", ">", "trainingData", ",", "List", "<", "Measure", ">", "validatingData", ")", "{", "List", "<", "Integer", ">", "order", "=", "Arrays", ".", "asList", "(", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ")", ";", "double", "[", "]", "train", "=", "measureToDouble", "(", "trainingData", ")", ";", "double", "[", "]", "valid", "=", "measureToDouble", "(", "validatingData", ")", ";", "double", "minMse", "=", "99999999", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "10", ";", "i", "++", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "10", ";", "j", "++", ")", "{", "for", "(", "int", "k", "=", "0", ";", "k", "<", "10", ";", "k", "++", ")", "{", "ForecastResult", "forecastResult", "=", "null", ";", "if", "(", "i", "==", "0", "&&", "k", "==", "0", ")", "{", "forecastResult", "=", "Arima", ".", "forecast_arima", "(", "train", ",", "valid", ".", "length", ",", "new", "ArimaParams", "(", "1", ",", "j", ",", "k", ",", "P", ",", "D", ",", "Q", ",", "1", "+", "k", "+", "1", ")", ")", ";", "}", "else", "{", "forecastResult", "=", "Arima", ".", "forecast_arima", "(", "train", ",", "valid", ".", "length", ",", "new", "ArimaParams", "(", "i", ",", "j", ",", "k", ",", "P", ",", "D", ",", "Q", ",", "i", "+", "k", "+", "1", ")", ")", ";", "}", "double", "[", "]", "forecastData", "=", "forecastResult", ".", "getForecast", "(", ")", ";", "double", "mse", "=", "rootMeanSquaredError", "(", "valid", ",", "forecastData", ")", ";", "if", "(", "mse", "<", "minMse", ")", "{", "minMse", "=", "mse", ";", "order", ".", "set", "(", "0", ",", "i", ")", ";", "order", ".", "set", "(", "1", ",", "j", ")", ";", "order", ".", "set", "(", "2", ",", "k", ")", ";", "}", "}", "}", "}", "p", "=", "order", ".", "get", "(", "0", ")", ";", "d", "=", "order", ".", "get", "(", "1", ")", ";", "q", "=", "order", ".", "get", "(", "2", ")", ";", "P", "=", "order", ".", "get", "(", "3", ")", ";", "D", "=", "order", ".", "get", "(", "4", ")", ";", "Q", "=", "order", ".", "get", "(", "5", ")", ";", "m", "=", "p", "+", "q", "+", "P", "+", "Q", "+", "1", ";", "}" ]
Find the ARIMA's parameters @param trainingData the given elements to train the model @param validatingData the elements to compare with the forecasted values
[ "Find", "the", "ARIMA", "'", "s", "parameters", "@param", "trainingData", "the", "given", "elements", "to", "train", "the", "model", "@param", "validatingData", "the", "elements", "to", "compare", "with", "the", "forecasted", "values" ]
[]
[ { "param": "trainingData", "type": "List<Measure>" }, { "param": "validatingData", "type": "List<Measure>" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "trainingData", "type": "List<Measure>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "validatingData", "type": "List<Measure>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 565, 1071, 918, 4845, 12, 682, 32, 7197, 34, 8277, 751, 16, 987, 32, 7197, 34, 18075, 751, 13, 288, 203, 3639, 987, 32, 4522, 34, 1353, 273, 5647, 18, 345, 682, 12, 20, 16, 374, 16, 374, 16, 374, 16, 374, 16, 374, 1769, 203, 3639, 1645, 8526, 4691, 273, 6649, 774, 5265, 12, 17584, 751, 1769, 203, 3639, 1645, 8526, 923, 273, 6649, 774, 5265, 12, 877, 1776, 751, 1769, 203, 3639, 1645, 1131, 49, 307, 273, 23841, 11984, 31, 203, 3639, 364, 261, 474, 277, 273, 374, 31, 277, 411, 1728, 31, 277, 27245, 288, 203, 5411, 364, 261, 474, 525, 273, 374, 31, 525, 411, 1728, 31, 525, 27245, 288, 203, 7734, 364, 261, 474, 417, 273, 374, 31, 417, 411, 1728, 31, 417, 27245, 288, 203, 10792, 17605, 4155, 1253, 18763, 1253, 273, 446, 31, 203, 10792, 309, 261, 77, 422, 374, 597, 417, 422, 374, 13, 288, 203, 13491, 18763, 1253, 273, 1201, 13888, 18, 1405, 4155, 67, 297, 13888, 12, 9754, 16, 923, 18, 2469, 16, 394, 1201, 13888, 1370, 12, 21, 16, 525, 16, 417, 16, 453, 16, 463, 16, 2238, 16, 404, 15, 79, 15, 21, 10019, 203, 10792, 289, 469, 288, 203, 13491, 18763, 1253, 273, 1201, 13888, 18, 1405, 4155, 67, 297, 13888, 12, 9754, 16, 923, 18, 2469, 16, 394, 1201, 13888, 1370, 12, 77, 16, 525, 16, 417, 16, 453, 16, 463, 16, 2238, 16, 277, 15, 79, 15, 21, 10019, 203, 10792, 289, 203, 10792, 1645, 8526, 18763, 751, 273, 18763, 1253, 18, 588, 13573, 4155, 5621, 203, 10792, 1645, 18689, 273, 1365, 15312, 20888, 668, 12, 877, 16, 18763, 751, 1769, 203, 10792, 309, 261, 81, 307, 411, 1131, 49, 307, 13, 288, 203, 13491, 1131, 49, 307, 273, 18689, 31, 203, 13491, 1353, 18, 542, 12, 20, 16, 277, 1769, 203, 13491, 1353, 18, 542, 12, 21, 16, 525, 1769, 203, 13491, 1353, 18, 542, 12, 22, 16, 417, 1769, 203, 10792, 289, 203, 7734, 289, 203, 5411, 289, 203, 3639, 289, 203, 3639, 293, 273, 1353, 18, 588, 12, 20, 1769, 203, 3639, 302, 273, 1353, 18, 588, 12, 21, 1769, 203, 3639, 1043, 273, 1353, 18, 588, 12, 22, 1769, 203, 3639, 453, 273, 1353, 18, 588, 12, 23, 1769, 203, 3639, 463, 273, 1353, 18, 588, 12, 24, 1769, 203, 3639, 2238, 273, 1353, 18, 588, 12, 25, 1769, 203, 3639, 312, 273, 293, 397, 1043, 397, 453, 397, 2238, 397, 404, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 4163, 326, 432, 2259, 5535, 1807, 1472, 203, 377, 380, 203, 377, 380, 632, 891, 8277, 751, 326, 864, 2186, 358, 4691, 326, 938, 203, 377, 380, 632, 891, 18075, 751, 326, 2186, 358, 3400, 598, 326, 18763, 329, 924, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
c928857bc92ffbccdf349f2eef803ed724fb63b1
Hurence/historian
historian-timeseries/src/main/java/com/hurence/forecasting/ArimaMeasureForecaster.java
[ "Apache-2.0" ]
Java
rootMeanSquaredError
null
public double rootMeanSquaredError (double[] measured, double[] forecasted) { double mse = 0; for (int i=0;i<forecasted.length;i++) { mse += Math.pow(measured[i] - forecasted[i], 2); } return Math.sqrt(mse / forecasted.length); }
/** * Compute the Root Mean Squared of 2 lists of double value * * @param measured data * @param forecasted data * @return RMS */
Compute the Root Mean Squared of 2 lists of double value @param measured data @param forecasted data @return RMS
[ "Compute", "the", "Root", "Mean", "Squared", "of", "2", "lists", "of", "double", "value", "@param", "measured", "data", "@param", "forecasted", "data", "@return", "RMS" ]
public double rootMeanSquaredError (double[] measured, double[] forecasted) { double mse = 0; for (int i=0;i<forecasted.length;i++) { mse += Math.pow(measured[i] - forecasted[i], 2); } return Math.sqrt(mse / forecasted.length); }
[ "public", "double", "rootMeanSquaredError", "(", "double", "[", "]", "measured", ",", "double", "[", "]", "forecasted", ")", "{", "double", "mse", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "forecasted", ".", "length", ";", "i", "++", ")", "{", "mse", "+=", "Math", ".", "pow", "(", "measured", "[", "i", "]", "-", "forecasted", "[", "i", "]", ",", "2", ")", ";", "}", "return", "Math", ".", "sqrt", "(", "mse", "/", "forecasted", ".", "length", ")", ";", "}" ]
Compute the Root Mean Squared of 2 lists of double value @param measured data @param forecasted data @return RMS
[ "Compute", "the", "Root", "Mean", "Squared", "of", "2", "lists", "of", "double", "value", "@param", "measured", "data", "@param", "forecasted", "data", "@return", "RMS" ]
[]
[ { "param": "measured", "type": "double[]" }, { "param": "forecasted", "type": "double[]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "measured", "type": "double[]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "forecasted", "type": "double[]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 1645, 1365, 15312, 20888, 668, 261, 9056, 8526, 22221, 16, 1645, 8526, 18763, 329, 13, 288, 203, 3639, 1645, 18689, 273, 374, 31, 203, 3639, 364, 261, 474, 277, 33, 20, 31, 77, 32, 1405, 4155, 329, 18, 2469, 31, 77, 27245, 288, 203, 5411, 18689, 1011, 2361, 18, 23509, 12, 21992, 2862, 63, 77, 65, 300, 18763, 329, 63, 77, 6487, 576, 1769, 203, 3639, 289, 203, 3639, 327, 2361, 18, 24492, 12, 81, 307, 342, 18763, 329, 18, 2469, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 8155, 326, 7450, 21979, 348, 11903, 434, 576, 6035, 434, 1645, 460, 203, 377, 380, 203, 377, 380, 632, 891, 22221, 501, 203, 377, 380, 632, 891, 18763, 329, 501, 203, 377, 380, 632, 2463, 534, 3537, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
c928857bc92ffbccdf349f2eef803ed724fb63b1
Hurence/historian
historian-timeseries/src/main/java/com/hurence/forecasting/ArimaMeasureForecaster.java
[ "Apache-2.0" ]
Java
measureToDouble
null
public double[] measureToDouble(List<Measure> inputData) { double[] result = new double[inputData.size()]; for (int i = 0; i < result.length; i++) { result[i] = inputData.get(i).getValue(); } return result; }
/** * Transform a List<Measure> into a List<Double> * * @param inputData is a list of Measure * @return a list of double */
Transform a List into a List @param inputData is a list of Measure @return a list of double
[ "Transform", "a", "List", "into", "a", "List", "@param", "inputData", "is", "a", "list", "of", "Measure", "@return", "a", "list", "of", "double" ]
public double[] measureToDouble(List<Measure> inputData) { double[] result = new double[inputData.size()]; for (int i = 0; i < result.length; i++) { result[i] = inputData.get(i).getValue(); } return result; }
[ "public", "double", "[", "]", "measureToDouble", "(", "List", "<", "Measure", ">", "inputData", ")", "{", "double", "[", "]", "result", "=", "new", "double", "[", "inputData", ".", "size", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "result", ".", "length", ";", "i", "++", ")", "{", "result", "[", "i", "]", "=", "inputData", ".", "get", "(", "i", ")", ".", "getValue", "(", ")", ";", "}", "return", "result", ";", "}" ]
Transform a List<Measure> into a List<Double> @param inputData is a list of Measure @return a list of double
[ "Transform", "a", "List<Measure", ">", "into", "a", "List<Double", ">", "@param", "inputData", "is", "a", "list", "of", "Measure", "@return", "a", "list", "of", "double" ]
[]
[ { "param": "inputData", "type": "List<Measure>" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "inputData", "type": "List<Measure>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 1645, 8526, 6649, 774, 5265, 12, 682, 32, 7197, 34, 24149, 13, 288, 203, 3639, 1645, 8526, 563, 273, 394, 1645, 63, 2630, 751, 18, 1467, 1435, 15533, 203, 3639, 364, 261, 474, 277, 273, 374, 31, 277, 411, 563, 18, 2469, 31, 277, 27245, 288, 203, 5411, 563, 63, 77, 65, 273, 24149, 18, 588, 12, 77, 2934, 24805, 5621, 203, 3639, 289, 203, 3639, 327, 563, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 11514, 279, 987, 32, 7197, 34, 1368, 279, 987, 32, 5265, 34, 203, 377, 380, 203, 377, 380, 632, 891, 24149, 353, 279, 666, 434, 13544, 203, 377, 380, 632, 2463, 279, 666, 434, 1645, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
c928857bc92ffbccdf349f2eef803ed724fb63b1
Hurence/historian
historian-timeseries/src/main/java/com/hurence/forecasting/ArimaMeasureForecaster.java
[ "Apache-2.0" ]
Java
verifier
null
public void verifier() { if (p == 0 && q == 0) { p=1; } }
/** * Verification of ARIMA's parameters (p and q must not = 0 at same time) */
Verification of ARIMA's parameters (p and q must not = 0 at same time)
[ "Verification", "of", "ARIMA", "'", "s", "parameters", "(", "p", "and", "q", "must", "not", "=", "0", "at", "same", "time", ")" ]
public void verifier() { if (p == 0 && q == 0) { p=1; } }
[ "public", "void", "verifier", "(", ")", "{", "if", "(", "p", "==", "0", "&&", "q", "==", "0", ")", "{", "p", "=", "1", ";", "}", "}" ]
Verification of ARIMA's parameters (p and q must not = 0 at same time)
[ "Verification", "of", "ARIMA", "'", "s", "parameters", "(", "p", "and", "q", "must", "not", "=", "0", "at", "same", "time", ")" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 918, 20130, 1435, 288, 203, 3639, 309, 261, 84, 422, 374, 597, 1043, 422, 374, 13, 288, 203, 5411, 293, 33, 21, 31, 203, 3639, 289, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 26961, 434, 432, 2259, 5535, 1807, 1472, 261, 84, 471, 1043, 1297, 486, 273, 374, 622, 1967, 813, 13, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
1eb6226ff5078bfa935d00048560c67cde6a060d
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/compaction/protobuf/PointsCompressorWithQuality.java
[ "Apache-2.0" ]
Java
to
null
public byte[] to(final Iterator<Measure> metricDataPoints, float diffAcceptedForQuality, long ddcThreshold) { if (shoudBeReset) { resetProps(); } int index = 0; while (metricDataPoints.hasNext()) { Measure p = metricDataPoints.next(); if (p == null) { LOGGER.debug("Skipping 'null' point."); continue; } point.clear(); long currentTimestamp = p.getTimestamp(); if (previousDate == -1) { lastStoredDate = currentTimestamp; } //Add value or index, if the value already exists setValueOrRefIndexOnPoint(valueIndex, index, p.getValue(), point); //setQualityIfNeeded float qualityOfPoint = getQualityOfPoint(p); addQualityToPointsIfNeeded(index, qualityOfPoint, diffAcceptedForQuality); long delta = calculDelta(currentTimestamp); boolean isAlmostEquals = almostEquals(delta, ddcThreshold); long drift = 0; if (isAlmostEquals) { drift = calculateDrift(currentTimestamp);; if (noDrift(drift, ddcThreshold, numberOfPointSinceLastDelta) && drift >= 0) { numberOfPointSinceLastDelta += 1; } else { saveTimestampOffsetForPoint(p, delta); } } else { saveTimestampOffsetForPoint(p, delta); } points.addP(point.build()); //set current as former previous date previousDate = currentTimestamp; previousDelta = delta; previousDrift = drift; index++; } return points.build().toByteArray(); }
/** * Converts the given iterator of our point class to protocol buffers and compresses (gzip) it. * * @param metricDataPoints - the list with points (expected te be already sorted !) * @return the serialized points as byte[] */
Converts the given iterator of our point class to protocol buffers and compresses (gzip) it. @param metricDataPoints - the list with points (expected te be already sorted !) @return the serialized points as byte[]
[ "Converts", "the", "given", "iterator", "of", "our", "point", "class", "to", "protocol", "buffers", "and", "compresses", "(", "gzip", ")", "it", ".", "@param", "metricDataPoints", "-", "the", "list", "with", "points", "(", "expected", "te", "be", "already", "sorted", "!", ")", "@return", "the", "serialized", "points", "as", "byte", "[]" ]
public byte[] to(final Iterator<Measure> metricDataPoints, float diffAcceptedForQuality, long ddcThreshold) { if (shoudBeReset) { resetProps(); } int index = 0; while (metricDataPoints.hasNext()) { Measure p = metricDataPoints.next(); if (p == null) { LOGGER.debug("Skipping 'null' point."); continue; } point.clear(); long currentTimestamp = p.getTimestamp(); if (previousDate == -1) { lastStoredDate = currentTimestamp; } setValueOrRefIndexOnPoint(valueIndex, index, p.getValue(), point); float qualityOfPoint = getQualityOfPoint(p); addQualityToPointsIfNeeded(index, qualityOfPoint, diffAcceptedForQuality); long delta = calculDelta(currentTimestamp); boolean isAlmostEquals = almostEquals(delta, ddcThreshold); long drift = 0; if (isAlmostEquals) { drift = calculateDrift(currentTimestamp);; if (noDrift(drift, ddcThreshold, numberOfPointSinceLastDelta) && drift >= 0) { numberOfPointSinceLastDelta += 1; } else { saveTimestampOffsetForPoint(p, delta); } } else { saveTimestampOffsetForPoint(p, delta); } points.addP(point.build()); previousDate = currentTimestamp; previousDelta = delta; previousDrift = drift; index++; } return points.build().toByteArray(); }
[ "public", "byte", "[", "]", "to", "(", "final", "Iterator", "<", "Measure", ">", "metricDataPoints", ",", "float", "diffAcceptedForQuality", ",", "long", "ddcThreshold", ")", "{", "if", "(", "shoudBeReset", ")", "{", "resetProps", "(", ")", ";", "}", "int", "index", "=", "0", ";", "while", "(", "metricDataPoints", ".", "hasNext", "(", ")", ")", "{", "Measure", "p", "=", "metricDataPoints", ".", "next", "(", ")", ";", "if", "(", "p", "==", "null", ")", "{", "LOGGER", ".", "debug", "(", "\"Skipping 'null' point.\"", ")", ";", "continue", ";", "}", "point", ".", "clear", "(", ")", ";", "long", "currentTimestamp", "=", "p", ".", "getTimestamp", "(", ")", ";", "if", "(", "previousDate", "==", "-", "1", ")", "{", "lastStoredDate", "=", "currentTimestamp", ";", "}", "setValueOrRefIndexOnPoint", "(", "valueIndex", ",", "index", ",", "p", ".", "getValue", "(", ")", ",", "point", ")", ";", "float", "qualityOfPoint", "=", "getQualityOfPoint", "(", "p", ")", ";", "addQualityToPointsIfNeeded", "(", "index", ",", "qualityOfPoint", ",", "diffAcceptedForQuality", ")", ";", "long", "delta", "=", "calculDelta", "(", "currentTimestamp", ")", ";", "boolean", "isAlmostEquals", "=", "almostEquals", "(", "delta", ",", "ddcThreshold", ")", ";", "long", "drift", "=", "0", ";", "if", "(", "isAlmostEquals", ")", "{", "drift", "=", "calculateDrift", "(", "currentTimestamp", ")", ";", ";", "if", "(", "noDrift", "(", "drift", ",", "ddcThreshold", ",", "numberOfPointSinceLastDelta", ")", "&&", "drift", ">=", "0", ")", "{", "numberOfPointSinceLastDelta", "+=", "1", ";", "}", "else", "{", "saveTimestampOffsetForPoint", "(", "p", ",", "delta", ")", ";", "}", "}", "else", "{", "saveTimestampOffsetForPoint", "(", "p", ",", "delta", ")", ";", "}", "points", ".", "addP", "(", "point", ".", "build", "(", ")", ")", ";", "previousDate", "=", "currentTimestamp", ";", "previousDelta", "=", "delta", ";", "previousDrift", "=", "drift", ";", "index", "++", ";", "}", "return", "points", ".", "build", "(", ")", ".", "toByteArray", "(", ")", ";", "}" ]
Converts the given iterator of our point class to protocol buffers and compresses (gzip) it.
[ "Converts", "the", "given", "iterator", "of", "our", "point", "class", "to", "protocol", "buffers", "and", "compresses", "(", "gzip", ")", "it", "." ]
[ "//Add value or index, if the value already exists", "//setQualityIfNeeded", "//set current as former previous date" ]
[ { "param": "metricDataPoints", "type": "Iterator<Measure>" }, { "param": "diffAcceptedForQuality", "type": "float" }, { "param": "ddcThreshold", "type": "long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "metricDataPoints", "type": "Iterator<Measure>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "diffAcceptedForQuality", "type": "float", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ddcThreshold", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 1160, 8526, 358, 12, 6385, 4498, 32, 7197, 34, 3999, 751, 5636, 16, 1431, 3122, 18047, 1290, 14846, 16, 1525, 6957, 71, 7614, 13, 288, 203, 3639, 309, 261, 674, 83, 1100, 1919, 7013, 13, 288, 203, 5411, 2715, 5047, 5621, 203, 3639, 289, 203, 3639, 509, 770, 273, 374, 31, 203, 3639, 1323, 261, 6899, 751, 5636, 18, 5332, 2134, 10756, 288, 203, 5411, 13544, 293, 273, 3999, 751, 5636, 18, 4285, 5621, 203, 5411, 309, 261, 84, 422, 446, 13, 288, 203, 7734, 4145, 18, 4148, 2932, 16877, 296, 2011, 11, 1634, 1199, 1769, 203, 7734, 1324, 31, 203, 5411, 289, 203, 5411, 1634, 18, 8507, 5621, 203, 5411, 1525, 783, 4921, 273, 293, 18, 588, 4921, 5621, 203, 5411, 309, 261, 11515, 1626, 422, 300, 21, 13, 288, 203, 7734, 1142, 18005, 1626, 273, 783, 4921, 31, 203, 5411, 289, 203, 5411, 368, 986, 460, 578, 770, 16, 309, 326, 460, 1818, 1704, 203, 5411, 5524, 1162, 1957, 1016, 1398, 2148, 12, 1132, 1016, 16, 770, 16, 293, 18, 24805, 9334, 1634, 1769, 203, 5411, 368, 542, 14846, 18299, 203, 5411, 1431, 9312, 951, 2148, 273, 336, 14846, 951, 2148, 12, 84, 1769, 203, 5411, 527, 14846, 774, 5636, 18299, 12, 1615, 16, 9312, 951, 2148, 16, 3122, 18047, 1290, 14846, 1769, 203, 203, 203, 5411, 1525, 3622, 273, 3026, 9242, 12, 2972, 4921, 1769, 203, 203, 5411, 1250, 353, 1067, 10329, 8867, 273, 23889, 8867, 12, 9878, 16, 6957, 71, 7614, 1769, 203, 5411, 1525, 25217, 273, 374, 31, 203, 5411, 309, 261, 291, 1067, 10329, 8867, 13, 288, 203, 7734, 25217, 273, 4604, 27885, 12, 2972, 4921, 1769, 31, 203, 7734, 309, 261, 2135, 27885, 12, 3069, 2136, 16, 6957, 71, 7614, 16, 7922, 2148, 9673, 3024, 9242, 13, 597, 25217, 1545, 374, 13, 288, 203, 10792, 7922, 2148, 9673, 3024, 9242, 1011, 404, 31, 203, 7734, 289, 469, 288, 203, 10792, 1923, 4921, 2335, 1290, 2148, 12, 84, 16, 3622, 1769, 203, 7734, 289, 203, 5411, 289, 469, 288, 203, 7734, 1923, 4921, 2335, 1290, 2148, 12, 84, 16, 3622, 1769, 203, 5411, 289, 203, 5411, 3143, 18, 1289, 52, 12, 1153, 18, 3510, 10663, 203, 5411, 368, 542, 783, 487, 27313, 2416, 1509, 203, 5411, 2416, 1626, 273, 783, 4921, 31, 203, 5411, 2416, 9242, 273, 3622, 31, 203, 5411, 2416, 27885, 273, 25217, 31, 203, 5411, 770, 9904, 31, 203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632, 2463, 326, 5343, 3143, 487, 1160, 8526, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
1eb6226ff5078bfa935d00048560c67cde6a060d
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/compaction/protobuf/PointsCompressorWithQuality.java
[ "Apache-2.0" ]
Java
almostEquals
null
private boolean almostEquals(long offset, long ddcThreshold) { //check the deltas long diff = Math.abs(offset - previousDelta); return (diff <= ddcThreshold); }
/** * Check if two deltas are almost equals. * <p> * abs(offset - previousOffset) <= aberration * </p> * * @param offset the current offset * @param ddcThreshold the threshold for equality * @return true if set offsets are equals using the threshold */
Check if two deltas are almost equals. abs(offset - previousOffset) <= aberration @param offset the current offset @param ddcThreshold the threshold for equality @return true if set offsets are equals using the threshold
[ "Check", "if", "two", "deltas", "are", "almost", "equals", ".", "abs", "(", "offset", "-", "previousOffset", ")", "<", "=", "aberration", "@param", "offset", "the", "current", "offset", "@param", "ddcThreshold", "the", "threshold", "for", "equality", "@return", "true", "if", "set", "offsets", "are", "equals", "using", "the", "threshold" ]
private boolean almostEquals(long offset, long ddcThreshold) { long diff = Math.abs(offset - previousDelta); return (diff <= ddcThreshold); }
[ "private", "boolean", "almostEquals", "(", "long", "offset", ",", "long", "ddcThreshold", ")", "{", "long", "diff", "=", "Math", ".", "abs", "(", "offset", "-", "previousDelta", ")", ";", "return", "(", "diff", "<=", "ddcThreshold", ")", ";", "}" ]
Check if two deltas are almost equals.
[ "Check", "if", "two", "deltas", "are", "almost", "equals", "." ]
[ "//check the deltas" ]
[ { "param": "offset", "type": "long" }, { "param": "ddcThreshold", "type": "long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "offset", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ddcThreshold", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 3238, 1250, 23889, 8867, 12, 5748, 1384, 16, 1525, 6957, 71, 7614, 13, 288, 203, 3639, 368, 1893, 326, 20113, 203, 3639, 1525, 3122, 273, 2361, 18, 5113, 12, 3348, 300, 2416, 9242, 1769, 203, 3639, 327, 261, 5413, 1648, 6957, 71, 7614, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 2073, 309, 2795, 20113, 854, 23889, 1606, 18, 203, 377, 380, 411, 84, 34, 203, 377, 380, 2417, 12, 3348, 300, 2416, 2335, 13, 1648, 1223, 370, 367, 203, 377, 380, 7765, 84, 34, 203, 377, 380, 203, 377, 380, 632, 891, 1384, 540, 326, 783, 1384, 203, 377, 380, 632, 891, 6957, 71, 7614, 282, 326, 5573, 364, 14958, 203, 377, 380, 632, 2463, 638, 309, 444, 8738, 854, 1606, 1450, 326, 5573, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
264e78c80b852e1bfef3d1b446ad33fbb0d4ab4a
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/functions/aggregation/StdDev.java
[ "Apache-2.0" ]
Java
execute
null
@Override public void execute(MetricTimeSeries timeSeries, FunctionValueMap functionValueMap) { //If it is empty, we return NaN if (timeSeries.size() <= 0) { functionValueMap.add(this, Double.NaN); return; } //Else calculate the analysis value functionValueMap.add(this, com.hurence.timeseries.functions.math.StdDev.dev(timeSeries.getValues())); }
/** * Calculates the standard deviation of the first time series. * * @param timeSeries the time series * @return the percentile or 0 if the list is empty */
Calculates the standard deviation of the first time series. @param timeSeries the time series @return the percentile or 0 if the list is empty
[ "Calculates", "the", "standard", "deviation", "of", "the", "first", "time", "series", ".", "@param", "timeSeries", "the", "time", "series", "@return", "the", "percentile", "or", "0", "if", "the", "list", "is", "empty" ]
@Override public void execute(MetricTimeSeries timeSeries, FunctionValueMap functionValueMap) { if (timeSeries.size() <= 0) { functionValueMap.add(this, Double.NaN); return; } functionValueMap.add(this, com.hurence.timeseries.functions.math.StdDev.dev(timeSeries.getValues())); }
[ "@", "Override", "public", "void", "execute", "(", "MetricTimeSeries", "timeSeries", ",", "FunctionValueMap", "functionValueMap", ")", "{", "if", "(", "timeSeries", ".", "size", "(", ")", "<=", "0", ")", "{", "functionValueMap", ".", "add", "(", "this", ",", "Double", ".", "NaN", ")", ";", "return", ";", "}", "functionValueMap", ".", "add", "(", "this", ",", "com", ".", "hurence", ".", "timeseries", ".", "functions", ".", "math", ".", "StdDev", ".", "dev", "(", "timeSeries", ".", "getValues", "(", ")", ")", ")", ";", "}" ]
Calculates the standard deviation of the first time series.
[ "Calculates", "the", "standard", "deviation", "of", "the", "first", "time", "series", "." ]
[ "//If it is empty, we return NaN", "//Else calculate the analysis value" ]
[ { "param": "timeSeries", "type": "MetricTimeSeries" }, { "param": "functionValueMap", "type": "FunctionValueMap" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "timeSeries", "type": "MetricTimeSeries", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "functionValueMap", "type": "FunctionValueMap", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 565, 1071, 918, 1836, 12, 5396, 28486, 813, 6485, 16, 4284, 26795, 445, 26795, 13, 288, 203, 3639, 368, 2047, 518, 353, 1008, 16, 732, 327, 10180, 203, 3639, 309, 261, 957, 6485, 18, 1467, 1435, 1648, 374, 13, 288, 203, 5411, 445, 26795, 18, 1289, 12, 2211, 16, 3698, 18, 21172, 1769, 203, 5411, 327, 31, 203, 3639, 289, 203, 3639, 368, 12427, 4604, 326, 6285, 460, 203, 3639, 445, 26795, 18, 1289, 12, 2211, 16, 532, 18, 76, 25267, 18, 28494, 18, 10722, 18, 15949, 18, 10436, 8870, 18, 5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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 26128, 326, 4529, 17585, 434, 326, 1122, 813, 4166, 18, 203, 377, 380, 203, 377, 380, 632, 891, 813, 6485, 326, 813, 4166, 203, 377, 380, 632, 2463, 326, 17279, 578, 374, 309, 326, 666, 353, 1008, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
a1f504aca20150703c00b2822f56c13ecfbfad99
Hurence/historian
historian-server/src/main/java/com/hurence/webapiservice/http/api/grafana/promql/router/GrafanaPromQLDatasourcePluginApiImpl.java
[ "Apache-2.0" ]
Java
rules
null
@Override public void rules(RoutingContext context) { JsonObject response = new JsonObject() .put(STATUS, SUCCESS) .put(DATA, ""); context.response() .setStatusCode(HttpResponseStatus.OK.code()) .end(response.encode()); }
/** * The /rules API endpoint returns a list of alerting and recording rules that are currently loaded. * In addition it returns the currently active alerts fired by the Prometheus instance of each alerting rule. * * * <pre> * GET /api/v1/rules * </pre> * <p> * URL query parameters: - type=alert|record: return only the alerting rules (e.g. type=alert) or * the recording rules (e.g. type=record). When the parameter is absent or empty, no filtering is done. * * * <pre> * $ curl http://localhost:9090/api/v1/rules * * { * "data": { * "groups": [ * { * "rules": [ * { * "alerts": [ * { * "activeAt": "2018-07-04T20:27:12.60602144+02:00", * "annotations": { * "summary": "High request latency" * }, * "labels": { * "alertname": "HighRequestLatency", * "severity": "page" * }, * "state": "firing", * "value": "1e+00" * } * ], * "annotations": { * "summary": "High request latency" * }, * "duration": 600, * "health": "ok", * "labels": { * "severity": "page" * }, * "name": "HighRequestLatency", * "query": "job:request_latency_seconds:mean5m{job=\"myjob\"} > 0.5", * "type": "alerting" * }, * { * "health": "ok", * "name": "job:http_inprogress_requests:sum", * "query": "sum by (job) (http_inprogress_requests)", * "type": "recording" * } * ], * "file": "/rules.yaml", * "interval": 60, * "name": "example" * } * ] * }, * "status": "success" * } * </pre> * * @param context */
The /rules API endpoint returns a list of alerting and recording rules that are currently loaded. In addition it returns the currently active alerts fired by the Prometheus instance of each alerting rule. GET /api/v1/rules URL query parameters: - type=alert|record: return only the alerting rules or the recording rules . When the parameter is absent or empty, no filtering is done. @param context
[ "The", "/", "rules", "API", "endpoint", "returns", "a", "list", "of", "alerting", "and", "recording", "rules", "that", "are", "currently", "loaded", ".", "In", "addition", "it", "returns", "the", "currently", "active", "alerts", "fired", "by", "the", "Prometheus", "instance", "of", "each", "alerting", "rule", ".", "GET", "/", "api", "/", "v1", "/", "rules", "URL", "query", "parameters", ":", "-", "type", "=", "alert|record", ":", "return", "only", "the", "alerting", "rules", "or", "the", "recording", "rules", ".", "When", "the", "parameter", "is", "absent", "or", "empty", "no", "filtering", "is", "done", ".", "@param", "context" ]
@Override public void rules(RoutingContext context) { JsonObject response = new JsonObject() .put(STATUS, SUCCESS) .put(DATA, ""); context.response() .setStatusCode(HttpResponseStatus.OK.code()) .end(response.encode()); }
[ "@", "Override", "public", "void", "rules", "(", "RoutingContext", "context", ")", "{", "JsonObject", "response", "=", "new", "JsonObject", "(", ")", ".", "put", "(", "STATUS", ",", "SUCCESS", ")", ".", "put", "(", "DATA", ",", "\"\"", ")", ";", "context", ".", "response", "(", ")", ".", "setStatusCode", "(", "HttpResponseStatus", ".", "OK", ".", "code", "(", ")", ")", ".", "end", "(", "response", ".", "encode", "(", ")", ")", ";", "}" ]
The /rules API endpoint returns a list of alerting and recording rules that are currently loaded.
[ "The", "/", "rules", "API", "endpoint", "returns", "a", "list", "of", "alerting", "and", "recording", "rules", "that", "are", "currently", "loaded", "." ]
[]
[ { "param": "context", "type": "RoutingContext" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "context", "type": "RoutingContext", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 565, 1071, 918, 2931, 12, 13966, 1042, 819, 13, 288, 203, 203, 3639, 11596, 766, 273, 394, 11596, 1435, 203, 7734, 263, 458, 12, 8608, 16, 16561, 13, 203, 7734, 263, 458, 12, 4883, 16, 1408, 1769, 203, 203, 3639, 819, 18, 2740, 1435, 203, 7734, 263, 542, 14041, 12, 19520, 1482,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203, 377, 380, 203, 377, 380, 203, 377, 380, 411, 1484, 34, 203, 377, 380, 377, 4978, 342, 2425, 19, 90, 21, 19, 7482, 203, 377, 380, 7765, 1484, 34, 203, 377, 380, 411, 84, 34, 203, 377, 380, 1976, 843, 1472, 30, 300, 618, 33, 11798, 96, 3366, 30, 327, 1338, 326, 6881, 310, 2931, 261, 73, 18, 75, 18, 618, 33, 11798, 13, 578, 203, 377, 380, 326, 14949, 2931, 261, 73, 18, 75, 18, 618, 33, 3366, 2 ]
9081aeeb7694e96ee9157514ff006a0f812a9410
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/query/QueryFunctions.java
[ "Apache-2.0" ]
Java
merge
null
public void merge(QueryFunctions functions) { aggregations.addAll(functions.aggregations); transformations.addAll(functions.transformations); analyses.addAll(functions.analyses); encodings.addAll(functions.encodings); }
/** * @param functions the other query functions */
@param functions the other query functions
[ "@param", "functions", "the", "other", "query", "functions" ]
public void merge(QueryFunctions functions) { aggregations.addAll(functions.aggregations); transformations.addAll(functions.transformations); analyses.addAll(functions.analyses); encodings.addAll(functions.encodings); }
[ "public", "void", "merge", "(", "QueryFunctions", "functions", ")", "{", "aggregations", ".", "addAll", "(", "functions", ".", "aggregations", ")", ";", "transformations", ".", "addAll", "(", "functions", ".", "transformations", ")", ";", "analyses", ".", "addAll", "(", "functions", ".", "analyses", ")", ";", "encodings", ".", "addAll", "(", "functions", ".", "encodings", ")", ";", "}" ]
@param functions the other query functions
[ "@param", "functions", "the", "other", "query", "functions" ]
[]
[ { "param": "functions", "type": "QueryFunctions" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "functions", "type": "QueryFunctions", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 918, 2691, 12, 1138, 7503, 4186, 13, 288, 203, 3639, 25809, 18, 1289, 1595, 12, 10722, 18, 10751, 1012, 1769, 203, 3639, 19245, 18, 1289, 1595, 12, 10722, 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, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
4d8d89d660d4d376ea9fea96979598328e6ce978
Hurence/historian
historian-server/src/integration-test/java/com/hurence/webapiservice/http/api/ingestion/ImportCsvEndPointIT.java
[ "Apache-2.0" ]
Java
testIdemPotence
null
@Test @Timeout(value = 5, timeUnit = TimeUnit.SECONDS) public void testIdemPotence(Vertx vertx, VertxTestContext testContext) { String pathCsvFile = AssertResponseGivenRequestHelper.class.getResource("/http/ingestion/csv/onemetric-3points/csvfiles/datapoints.csv").getFile(); MultipartForm multipartForm = MultipartForm.create() .textFileUpload("my_csv_file", "datapoints.csv", pathCsvFile, "text/csv"); List<RequestResponseConfI<?>> confs = Arrays.asList( new MultipartRequestResponseConf<JsonObject>(IMPORT_CSV_ENDPOINT, multipartForm, "/http/ingestion/csv/onemetric-3points/testImport/expectedResponse.json", CREATED, StatusMessages.CREATED, BodyCodec.jsonObject(), vertx), new MultipartRequestResponseConf<JsonObject>(IMPORT_CSV_ENDPOINT, multipartForm, "/http/ingestion/csv/onemetric-3points/testImport/expectedResponse.json", CREATED, StatusMessages.CREATED, BodyCodec.jsonObject(), vertx), new RequestResponseConf<>(HURENCE_DATASOURCE_GRAFANA_QUERY_API_ENDPOINT, "/http/ingestion/csv/onemetric-3points/testQuery/request.json", "/http/ingestion/csv/onemetric-3points/testQuery/expectedResponse.json", OK, StatusMessages.OK, BodyCodec.jsonArray(), vertx) ); AssertResponseGivenRequestHelper .assertRequestGiveResponseFromFileAndFinishTest(webClient, testContext, confs); }
/* Import should be idem potent. This can be easily done by setting the id of the chunk as a hash of all parameters. */
Import should be idem potent. This can be easily done by setting the id of the chunk as a hash of all parameters.
[ "Import", "should", "be", "idem", "potent", ".", "This", "can", "be", "easily", "done", "by", "setting", "the", "id", "of", "the", "chunk", "as", "a", "hash", "of", "all", "parameters", "." ]
@Test @Timeout(value = 5, timeUnit = TimeUnit.SECONDS) public void testIdemPotence(Vertx vertx, VertxTestContext testContext) { String pathCsvFile = AssertResponseGivenRequestHelper.class.getResource("/http/ingestion/csv/onemetric-3points/csvfiles/datapoints.csv").getFile(); MultipartForm multipartForm = MultipartForm.create() .textFileUpload("my_csv_file", "datapoints.csv", pathCsvFile, "text/csv"); List<RequestResponseConfI<?>> confs = Arrays.asList( new MultipartRequestResponseConf<JsonObject>(IMPORT_CSV_ENDPOINT, multipartForm, "/http/ingestion/csv/onemetric-3points/testImport/expectedResponse.json", CREATED, StatusMessages.CREATED, BodyCodec.jsonObject(), vertx), new MultipartRequestResponseConf<JsonObject>(IMPORT_CSV_ENDPOINT, multipartForm, "/http/ingestion/csv/onemetric-3points/testImport/expectedResponse.json", CREATED, StatusMessages.CREATED, BodyCodec.jsonObject(), vertx), new RequestResponseConf<>(HURENCE_DATASOURCE_GRAFANA_QUERY_API_ENDPOINT, "/http/ingestion/csv/onemetric-3points/testQuery/request.json", "/http/ingestion/csv/onemetric-3points/testQuery/expectedResponse.json", OK, StatusMessages.OK, BodyCodec.jsonArray(), vertx) ); AssertResponseGivenRequestHelper .assertRequestGiveResponseFromFileAndFinishTest(webClient, testContext, confs); }
[ "@", "Test", "@", "Timeout", "(", "value", "=", "5", ",", "timeUnit", "=", "TimeUnit", ".", "SECONDS", ")", "public", "void", "testIdemPotence", "(", "Vertx", "vertx", ",", "VertxTestContext", "testContext", ")", "{", "String", "pathCsvFile", "=", "AssertResponseGivenRequestHelper", ".", "class", ".", "getResource", "(", "\"/http/ingestion/csv/onemetric-3points/csvfiles/datapoints.csv\"", ")", ".", "getFile", "(", ")", ";", "MultipartForm", "multipartForm", "=", "MultipartForm", ".", "create", "(", ")", ".", "textFileUpload", "(", "\"my_csv_file\"", ",", "\"datapoints.csv\"", ",", "pathCsvFile", ",", "\"text/csv\"", ")", ";", "List", "<", "RequestResponseConfI", "<", "?", ">", ">", "confs", "=", "Arrays", ".", "asList", "(", "new", "MultipartRequestResponseConf", "<", "JsonObject", ">", "(", "IMPORT_CSV_ENDPOINT", ",", "multipartForm", ",", "\"/http/ingestion/csv/onemetric-3points/testImport/expectedResponse.json\"", ",", "CREATED", ",", "StatusMessages", ".", "CREATED", ",", "BodyCodec", ".", "jsonObject", "(", ")", ",", "vertx", ")", ",", "new", "MultipartRequestResponseConf", "<", "JsonObject", ">", "(", "IMPORT_CSV_ENDPOINT", ",", "multipartForm", ",", "\"/http/ingestion/csv/onemetric-3points/testImport/expectedResponse.json\"", ",", "CREATED", ",", "StatusMessages", ".", "CREATED", ",", "BodyCodec", ".", "jsonObject", "(", ")", ",", "vertx", ")", ",", "new", "RequestResponseConf", "<", ">", "(", "HURENCE_DATASOURCE_GRAFANA_QUERY_API_ENDPOINT", ",", "\"/http/ingestion/csv/onemetric-3points/testQuery/request.json\"", ",", "\"/http/ingestion/csv/onemetric-3points/testQuery/expectedResponse.json\"", ",", "OK", ",", "StatusMessages", ".", "OK", ",", "BodyCodec", ".", "jsonArray", "(", ")", ",", "vertx", ")", ")", ";", "AssertResponseGivenRequestHelper", ".", "assertRequestGiveResponseFromFileAndFinishTest", "(", "webClient", ",", "testContext", ",", "confs", ")", ";", "}" ]
Import should be idem potent.
[ "Import", "should", "be", "idem", "potent", "." ]
[]
[ { "param": "vertx", "type": "Vertx" }, { "param": "testContext", "type": "VertxTestContext" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "vertx", "type": "Vertx", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "testContext", "type": "VertxTestContext", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 4709, 203, 565, 632, 2694, 12, 1132, 273, 1381, 16, 23874, 273, 9206, 18, 11609, 13, 203, 565, 1071, 918, 1842, 45, 19117, 18411, 802, 12, 3945, 978, 1924, 978, 16, 6160, 978, 4709, 1042, 1842, 1042, 13, 288, 203, 3639, 514, 589, 16759, 812, 273, 5452, 1064, 6083, 691, 2276, 18, 1106, 18, 588, 1420, 2932, 19, 2505, 19, 310, 6868, 19, 6715, 19, 265, 351, 1591, 17, 23, 4139, 19, 6715, 2354, 19, 892, 4139, 18, 6715, 20387, 29925, 5621, 203, 3639, 19919, 1204, 10263, 1204, 273, 19919, 1204, 18, 2640, 1435, 203, 7734, 263, 955, 812, 4777, 2932, 4811, 67, 6715, 67, 768, 3113, 315, 892, 4139, 18, 6715, 3113, 589, 16759, 812, 16, 315, 955, 19, 6715, 8863, 203, 3639, 987, 32, 691, 1064, 3976, 45, 12880, 9778, 2195, 87, 273, 5647, 18, 345, 682, 12, 203, 7734, 394, 19919, 691, 1064, 3976, 32, 23857, 34, 12, 20445, 67, 16570, 67, 18506, 16, 203, 13491, 10263, 1204, 16, 203, 13491, 2206, 2505, 19, 310, 6868, 19, 6715, 19, 265, 351, 1591, 17, 23, 4139, 19, 3813, 5010, 19, 3825, 1064, 18, 1977, 3113, 203, 13491, 21397, 16, 2685, 5058, 18, 18546, 16, 203, 13491, 5652, 11008, 18, 1977, 921, 9334, 1924, 978, 3631, 203, 7734, 394, 19919, 691, 1064, 3976, 32, 23857, 34, 12, 20445, 67, 16570, 67, 18506, 16, 203, 13491, 10263, 1204, 16, 203, 13491, 2206, 2505, 19, 310, 6868, 19, 6715, 19, 265, 351, 1591, 17, 23, 4139, 19, 3813, 5010, 19, 3825, 1064, 18, 1977, 3113, 203, 13491, 21397, 16, 2685, 5058, 18, 18546, 16, 203, 13491, 5652, 11008, 18, 1977, 921, 9334, 1924, 978, 3631, 203, 7734, 394, 1567, 1064, 3976, 29667, 12, 44, 4830, 50, 1441, 67, 11102, 3033, 51, 5727, 67, 24554, 42, 1258, 37, 67, 10753, 67, 2557, 67, 18506, 16, 203, 13491, 2206, 2505, 19, 310, 6868, 19, 6715, 19, 265, 351, 1591, 17, 23, 4139, 19, 3813, 1138, 19, 2293, 18, 1977, 3113, 203, 13491, 2206, 2505, 19, 310, 6868, 19, 6715, 19, 265, 351, 1591, 17, 23, 4139, 19, 3813, 1138, 19, 3825, 1064, 18, 1977, 3113, 203, 13491, 7791, 16, 2685, 5058, 18, 3141, 16, 203, 13491, 5652, 11008, 18, 1977, 1076, 9334, 1924, 978, 13, 203, 3639, 11272, 203, 3639, 5452, 1064, 6083, 691, 2276, 203, 7734, 263, 11231, 691, 43, 688, 1064, 13087, 1876, 11641, 4709, 12, 4875, 1227, 16, 1842, 1042, 16, 2195, 87, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 20308, 203, 3639, 6164, 1410, 506, 10572, 81, 5974, 319, 18, 1220, 848, 506, 17997, 2731, 635, 3637, 326, 612, 434, 326, 2441, 487, 279, 1651, 434, 777, 1472, 18, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
ed8b259edded013165dd27186def69089af919e6
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/functions/aggregation/Integral.java
[ "Apache-2.0" ]
Java
execute
null
@Override public void execute(MetricTimeSeries timeSeries, FunctionValueMap functionValueMap) { if (timeSeries.isEmpty()) { functionValueMap.add(this, Double.NaN); return; } SimpsonIntegrator simpsonIntegrator = new SimpsonIntegrator(); double integral = simpsonIntegrator.integrate(Integer.MAX_VALUE, x -> timeSeries.getValue((int) x), 0, timeSeries.size() - 1); functionValueMap.add(this, integral); }
/** * Calculates the integral of the given time series using the simpson integrator of commons math lib * * @param timeSeries the time series as argument for the chronix function * @param functionValueMap the analysis and values result map */
Calculates the integral of the given time series using the simpson integrator of commons math lib @param timeSeries the time series as argument for the chronix function @param functionValueMap the analysis and values result map
[ "Calculates", "the", "integral", "of", "the", "given", "time", "series", "using", "the", "simpson", "integrator", "of", "commons", "math", "lib", "@param", "timeSeries", "the", "time", "series", "as", "argument", "for", "the", "chronix", "function", "@param", "functionValueMap", "the", "analysis", "and", "values", "result", "map" ]
@Override public void execute(MetricTimeSeries timeSeries, FunctionValueMap functionValueMap) { if (timeSeries.isEmpty()) { functionValueMap.add(this, Double.NaN); return; } SimpsonIntegrator simpsonIntegrator = new SimpsonIntegrator(); double integral = simpsonIntegrator.integrate(Integer.MAX_VALUE, x -> timeSeries.getValue((int) x), 0, timeSeries.size() - 1); functionValueMap.add(this, integral); }
[ "@", "Override", "public", "void", "execute", "(", "MetricTimeSeries", "timeSeries", ",", "FunctionValueMap", "functionValueMap", ")", "{", "if", "(", "timeSeries", ".", "isEmpty", "(", ")", ")", "{", "functionValueMap", ".", "add", "(", "this", ",", "Double", ".", "NaN", ")", ";", "return", ";", "}", "SimpsonIntegrator", "simpsonIntegrator", "=", "new", "SimpsonIntegrator", "(", ")", ";", "double", "integral", "=", "simpsonIntegrator", ".", "integrate", "(", "Integer", ".", "MAX_VALUE", ",", "x", "->", "timeSeries", ".", "getValue", "(", "(", "int", ")", "x", ")", ",", "0", ",", "timeSeries", ".", "size", "(", ")", "-", "1", ")", ";", "functionValueMap", ".", "add", "(", "this", ",", "integral", ")", ";", "}" ]
Calculates the integral of the given time series using the simpson integrator of commons math lib @param timeSeries the time series as argument for the chronix function @param functionValueMap the analysis and values result map
[ "Calculates", "the", "integral", "of", "the", "given", "time", "series", "using", "the", "simpson", "integrator", "of", "commons", "math", "lib", "@param", "timeSeries", "the", "time", "series", "as", "argument", "for", "the", "chronix", "function", "@param", "functionValueMap", "the", "analysis", "and", "values", "result", "map" ]
[]
[ { "param": "timeSeries", "type": "MetricTimeSeries" }, { "param": "functionValueMap", "type": "FunctionValueMap" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "timeSeries", "type": "MetricTimeSeries", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "functionValueMap", "type": "FunctionValueMap", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 565, 1071, 918, 1836, 12, 5396, 28486, 813, 6485, 16, 4284, 26795, 445, 26795, 13, 288, 203, 203, 3639, 309, 261, 957, 6485, 18, 291, 1921, 10756, 288, 203, 5411, 445, 26795, 18, 1289, 12, 2211, 16, 3698, 18, 21172, 1769, 203, 5411, 327, 31, 203, 3639, 289, 203, 203, 3639, 9587, 84, 816, 11476, 639, 3142, 84, 816, 11476, 639, 273, 394, 9587, 84, 816, 11476, 639, 5621, 203, 3639, 1645, 21423, 273, 3142, 84, 816, 11476, 639, 18, 14970, 5141, 12, 4522, 18, 6694, 67, 4051, 16, 619, 317, 813, 6485, 18, 24805, 12443, 474, 13, 619, 3631, 374, 16, 813, 6485, 18, 1467, 1435, 300, 404, 1769, 203, 203, 3639, 445, 26795, 18, 1289, 12, 2211, 16, 21423, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 26128, 326, 21423, 434, 326, 864, 813, 4166, 1450, 326, 3142, 84, 816, 11301, 639, 434, 24021, 4233, 2561, 203, 377, 380, 203, 377, 380, 632, 891, 813, 6485, 4202, 326, 813, 4166, 487, 1237, 364, 326, 12227, 697, 445, 203, 377, 380, 632, 891, 445, 26795, 326, 6285, 471, 924, 563, 852, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
22eefc6d94069b986a903d28b32ccae24c5d4806
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/functions/analyse/Frequency.java
[ "Apache-2.0" ]
Java
execute
null
@Override public void execute(MetricTimeSeries timeSeries, FunctionValueMap functionValueMap) { LongList timestamps = timeSeries.getTimestamps(); final List<Long> currentWindow = new ArrayList<>(); final List<Integer> windowCount = new ArrayList<>(); //start and end of the window long windowStart = timestamps.get(0); //calculate the end long windowEnd = Instant.ofEpochMilli(windowStart).plus(windowSize, ChronoUnit.MINUTES).toEpochMilli(); for (int i = 1; i < timeSeries.size(); i++) { long current = timestamps.get(i); //Add the occurrence of the current window. if (current > windowStart - 1 && current < (windowEnd)) { currentWindow.add(current); } else { //We reached the end. Lets add it to the window count windowCount.add(currentWindow.size()); windowStart = current; windowEnd = Instant.ofEpochMilli(windowStart).plus(windowSize, ChronoUnit.MINUTES).toEpochMilli(); currentWindow.clear(); } } //we are done, add the last window windowCount.add(currentWindow.size()); //check deltas for (int i = 1; i < windowCount.size(); i++) { int former = windowCount.get(i - 1); int current = windowCount.get(i); //The threshold int result = current - former; if (result >= windowThreshold) { //add the time series as there are more points per window than the threshold functionValueMap.add(this, true, null); return; } } //Nothing bad found functionValueMap.add(this, false, null); }
/** * The frequency detector splits a time series into windows, counts the data points, and checks if the delta * between two windows is above a predefined threshold. * <p> * The frequency detector splits a time series using the constructor argument. * * @param functionValueMap * @return true if the time series has a pair of windows 1 and 2 where 2 has th */
The frequency detector splits a time series into windows, counts the data points, and checks if the delta between two windows is above a predefined threshold. The frequency detector splits a time series using the constructor argument. @param functionValueMap @return true if the time series has a pair of windows 1 and 2 where 2 has th
[ "The", "frequency", "detector", "splits", "a", "time", "series", "into", "windows", "counts", "the", "data", "points", "and", "checks", "if", "the", "delta", "between", "two", "windows", "is", "above", "a", "predefined", "threshold", ".", "The", "frequency", "detector", "splits", "a", "time", "series", "using", "the", "constructor", "argument", ".", "@param", "functionValueMap", "@return", "true", "if", "the", "time", "series", "has", "a", "pair", "of", "windows", "1", "and", "2", "where", "2", "has", "th" ]
@Override public void execute(MetricTimeSeries timeSeries, FunctionValueMap functionValueMap) { LongList timestamps = timeSeries.getTimestamps(); final List<Long> currentWindow = new ArrayList<>(); final List<Integer> windowCount = new ArrayList<>(); long windowStart = timestamps.get(0); long windowEnd = Instant.ofEpochMilli(windowStart).plus(windowSize, ChronoUnit.MINUTES).toEpochMilli(); for (int i = 1; i < timeSeries.size(); i++) { long current = timestamps.get(i); if (current > windowStart - 1 && current < (windowEnd)) { currentWindow.add(current); } else { windowCount.add(currentWindow.size()); windowStart = current; windowEnd = Instant.ofEpochMilli(windowStart).plus(windowSize, ChronoUnit.MINUTES).toEpochMilli(); currentWindow.clear(); } } windowCount.add(currentWindow.size()); for (int i = 1; i < windowCount.size(); i++) { int former = windowCount.get(i - 1); int current = windowCount.get(i); int result = current - former; if (result >= windowThreshold) { functionValueMap.add(this, true, null); return; } } functionValueMap.add(this, false, null); }
[ "@", "Override", "public", "void", "execute", "(", "MetricTimeSeries", "timeSeries", ",", "FunctionValueMap", "functionValueMap", ")", "{", "LongList", "timestamps", "=", "timeSeries", ".", "getTimestamps", "(", ")", ";", "final", "List", "<", "Long", ">", "currentWindow", "=", "new", "ArrayList", "<", ">", "(", ")", ";", "final", "List", "<", "Integer", ">", "windowCount", "=", "new", "ArrayList", "<", ">", "(", ")", ";", "long", "windowStart", "=", "timestamps", ".", "get", "(", "0", ")", ";", "long", "windowEnd", "=", "Instant", ".", "ofEpochMilli", "(", "windowStart", ")", ".", "plus", "(", "windowSize", ",", "ChronoUnit", ".", "MINUTES", ")", ".", "toEpochMilli", "(", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "timeSeries", ".", "size", "(", ")", ";", "i", "++", ")", "{", "long", "current", "=", "timestamps", ".", "get", "(", "i", ")", ";", "if", "(", "current", ">", "windowStart", "-", "1", "&&", "current", "<", "(", "windowEnd", ")", ")", "{", "currentWindow", ".", "add", "(", "current", ")", ";", "}", "else", "{", "windowCount", ".", "add", "(", "currentWindow", ".", "size", "(", ")", ")", ";", "windowStart", "=", "current", ";", "windowEnd", "=", "Instant", ".", "ofEpochMilli", "(", "windowStart", ")", ".", "plus", "(", "windowSize", ",", "ChronoUnit", ".", "MINUTES", ")", ".", "toEpochMilli", "(", ")", ";", "currentWindow", ".", "clear", "(", ")", ";", "}", "}", "windowCount", ".", "add", "(", "currentWindow", ".", "size", "(", ")", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "windowCount", ".", "size", "(", ")", ";", "i", "++", ")", "{", "int", "former", "=", "windowCount", ".", "get", "(", "i", "-", "1", ")", ";", "int", "current", "=", "windowCount", ".", "get", "(", "i", ")", ";", "int", "result", "=", "current", "-", "former", ";", "if", "(", "result", ">=", "windowThreshold", ")", "{", "functionValueMap", ".", "add", "(", "this", ",", "true", ",", "null", ")", ";", "return", ";", "}", "}", "functionValueMap", ".", "add", "(", "this", ",", "false", ",", "null", ")", ";", "}" ]
The frequency detector splits a time series into windows, counts the data points, and checks if the delta between two windows is above a predefined threshold.
[ "The", "frequency", "detector", "splits", "a", "time", "series", "into", "windows", "counts", "the", "data", "points", "and", "checks", "if", "the", "delta", "between", "two", "windows", "is", "above", "a", "predefined", "threshold", "." ]
[ "//start and end of the window", "//calculate the end", "//Add the occurrence of the current window.", "//We reached the end. Lets add it to the window count", "//we are done, add the last window", "//check deltas", "//The threshold", "//add the time series as there are more points per window than the threshold", "//Nothing bad found" ]
[ { "param": "timeSeries", "type": "MetricTimeSeries" }, { "param": "functionValueMap", "type": "FunctionValueMap" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "timeSeries", "type": "MetricTimeSeries", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "functionValueMap", "type": "FunctionValueMap", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 565, 1071, 918, 1836, 12, 5396, 28486, 813, 6485, 16, 4284, 26795, 445, 26795, 13, 288, 203, 203, 3639, 3407, 682, 11267, 273, 813, 6485, 18, 588, 23761, 5621, 203, 203, 3639, 727, 987, 32, 3708, 34, 783, 3829, 273, 394, 2407, 29667, 5621, 203, 3639, 727, 987, 32, 4522, 34, 2742, 1380, 273, 394, 2407, 29667, 5621, 203, 203, 3639, 368, 1937, 471, 679, 434, 326, 2742, 203, 3639, 1525, 2742, 1685, 273, 11267, 18, 588, 12, 20, 1769, 203, 3639, 368, 11162, 326, 679, 203, 3639, 1525, 2742, 1638, 273, 11190, 18, 792, 14638, 30388, 12, 5668, 1685, 2934, 10103, 12, 5668, 1225, 16, 16636, 2802, 18, 6236, 24080, 2934, 869, 14638, 30388, 5621, 203, 203, 3639, 364, 261, 474, 277, 273, 404, 31, 277, 411, 813, 6485, 18, 1467, 5621, 277, 27245, 288, 203, 5411, 1525, 783, 273, 11267, 18, 588, 12, 77, 1769, 203, 5411, 368, 986, 326, 13083, 434, 326, 783, 2742, 18, 203, 5411, 309, 261, 2972, 405, 2742, 1685, 300, 404, 597, 783, 411, 261, 5668, 1638, 3719, 288, 203, 7734, 783, 3829, 18, 1289, 12, 2972, 1769, 203, 5411, 289, 469, 288, 203, 7734, 368, 3218, 8675, 326, 679, 18, 511, 2413, 527, 518, 358, 326, 2742, 1056, 203, 7734, 2742, 1380, 18, 1289, 12, 2972, 3829, 18, 1467, 10663, 203, 7734, 2742, 1685, 273, 783, 31, 203, 7734, 2742, 1638, 273, 11190, 18, 792, 14638, 30388, 12, 5668, 1685, 2934, 10103, 12, 5668, 1225, 16, 16636, 2802, 18, 6236, 24080, 2934, 869, 14638, 30388, 5621, 203, 7734, 783, 3829, 18, 8507, 5621, 203, 5411, 289, 203, 3639, 289, 203, 3639, 368, 1814, 854, 2731, 16, 527, 326, 1142, 2742, 203, 3639, 2742, 1380, 18, 1289, 12, 2972, 3829, 18, 1467, 10663, 203, 203, 3639, 368, 1893, 20113, 203, 3639, 364, 261, 474, 277, 273, 404, 31, 277, 411, 2742, 1380, 18, 1467, 5621, 277, 27245, 288, 203, 203, 5411, 509, 27313, 273, 2742, 1380, 18, 588, 12, 77, 300, 404, 1769, 203, 5411, 509, 783, 273, 2742, 1380, 18, 588, 12, 77, 1769, 203, 203, 5411, 368, 1986, 5573, 203, 5411, 509, 563, 273, 783, 300, 27313, 31, 203, 5411, 309, 261, 2088, 1545, 2742, 7614, 13, 288, 203, 7734, 368, 1289, 326, 813, 4166, 487, 1915, 854, 1898, 3143, 1534, 2742, 2353, 326, 5573, 203, 7734, 445, 26795, 18, 1289, 12, 2211, 16, 638, 16, 446, 1769, 203, 7734, 327, 31, 203, 5411, 289, 203, 3639, 289, 203, 3639, 368, 23814, 5570, 1392, 203, 3639, 445, 26795, 18, 1289, 12, 2211, 16, 629, 16,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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 1021, 8670, 13826, 11019, 279, 813, 4166, 1368, 9965, 16, 6880, 326, 501, 3143, 16, 471, 4271, 309, 326, 3622, 203, 377, 380, 3086, 2795, 9965, 353, 5721, 279, 19555, 5573, 18, 203, 377, 380, 411, 84, 34, 203, 377, 380, 1021, 8670, 13826, 11019, 279, 813, 4166, 1450, 326, 3885, 1237, 18, 203, 377, 380, 203, 377, 380, 632, 891, 445, 26795, 203, 377, 380, 632, 2463, 638, 309, 326, 813, 4166, 711, 279, 3082, 434, 9965, 404, 471, 576, 1625, 576, 711, 286, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
2a650e3544ed8394e9c753418b9458f173d6e213
Hurence/historian
historian-scraper/src/main/java/com/hurence/historian/scraper/walkers/PrometheusMetricsWalker.java
[ "Apache-2.0" ]
Java
buildLabelListString
String
default String buildLabelListString(Map<String, String> labels, String prefix, String suffix) { if (prefix == null) { prefix = ""; } if (suffix == null) { suffix = ""; } if (labels == null) { return String.format("%s%s", prefix, suffix); } StringBuilder str = new StringBuilder(""); for (Map.Entry<String, String> pair : labels.entrySet()) { if (str.length() > 0) { str.append(","); } str.append(pair.getKey()).append("=").append(pair.getValue()); } return String.format("%s%s%s", prefix, str, suffix); }
/** * Convienence method that takes the given label list and returns a string in the form of * "labelName1=labelValue1,labelName2=labelValue2,..." * * @param labels the label list * @param prefix if not null, these characters will prefix the label list * @param suffix if not null, these characters will suffix the label list * @return the string form of the labels, optionally prefixed and suffixed */
Convienence method that takes the given label list and returns a string in the form of "labelName1=labelValue1,labelName2=labelValue2,..." @param labels the label list @param prefix if not null, these characters will prefix the label list @param suffix if not null, these characters will suffix the label list @return the string form of the labels, optionally prefixed and suffixed
[ "Convienence", "method", "that", "takes", "the", "given", "label", "list", "and", "returns", "a", "string", "in", "the", "form", "of", "\"", "labelName1", "=", "labelValue1", "labelName2", "=", "labelValue2", "...", "\"", "@param", "labels", "the", "label", "list", "@param", "prefix", "if", "not", "null", "these", "characters", "will", "prefix", "the", "label", "list", "@param", "suffix", "if", "not", "null", "these", "characters", "will", "suffix", "the", "label", "list", "@return", "the", "string", "form", "of", "the", "labels", "optionally", "prefixed", "and", "suffixed" ]
default String buildLabelListString(Map<String, String> labels, String prefix, String suffix) { if (prefix == null) { prefix = ""; } if (suffix == null) { suffix = ""; } if (labels == null) { return String.format("%s%s", prefix, suffix); } StringBuilder str = new StringBuilder(""); for (Map.Entry<String, String> pair : labels.entrySet()) { if (str.length() > 0) { str.append(","); } str.append(pair.getKey()).append("=").append(pair.getValue()); } return String.format("%s%s%s", prefix, str, suffix); }
[ "default", "String", "buildLabelListString", "(", "Map", "<", "String", ",", "String", ">", "labels", ",", "String", "prefix", ",", "String", "suffix", ")", "{", "if", "(", "prefix", "==", "null", ")", "{", "prefix", "=", "\"\"", ";", "}", "if", "(", "suffix", "==", "null", ")", "{", "suffix", "=", "\"\"", ";", "}", "if", "(", "labels", "==", "null", ")", "{", "return", "String", ".", "format", "(", "\"%s%s\"", ",", "prefix", ",", "suffix", ")", ";", "}", "StringBuilder", "str", "=", "new", "StringBuilder", "(", "\"\"", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "pair", ":", "labels", ".", "entrySet", "(", ")", ")", "{", "if", "(", "str", ".", "length", "(", ")", ">", "0", ")", "{", "str", ".", "append", "(", "\",\"", ")", ";", "}", "str", ".", "append", "(", "pair", ".", "getKey", "(", ")", ")", ".", "append", "(", "\"=\"", ")", ".", "append", "(", "pair", ".", "getValue", "(", ")", ")", ";", "}", "return", "String", ".", "format", "(", "\"%s%s%s\"", ",", "prefix", ",", "str", ",", "suffix", ")", ";", "}" ]
Convienence method that takes the given label list and returns a string in the form of "labelName1=labelValue1,labelName2=labelValue2,..."
[ "Convienence", "method", "that", "takes", "the", "given", "label", "list", "and", "returns", "a", "string", "in", "the", "form", "of", "\"", "labelName1", "=", "labelValue1", "labelName2", "=", "labelValue2", "...", "\"" ]
[]
[ { "param": "labels", "type": "Map<String, String>" }, { "param": "prefix", "type": "String" }, { "param": "suffix", "type": "String" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "labels", "type": "Map<String, String>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "prefix", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "suffix", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 805, 514, 1361, 2224, 682, 780, 12, 863, 32, 780, 16, 514, 34, 3249, 16, 514, 1633, 16, 514, 3758, 13, 288, 203, 3639, 309, 261, 3239, 422, 446, 13, 288, 203, 5411, 1633, 273, 1408, 31, 203, 3639, 289, 203, 3639, 309, 261, 8477, 422, 446, 13, 288, 203, 5411, 3758, 273, 1408, 31, 203, 3639, 289, 203, 3639, 309, 261, 5336, 422, 446, 13, 288, 203, 5411, 327, 514, 18, 2139, 27188, 87, 9, 87, 3113, 1633, 16, 3758, 1769, 203, 3639, 289, 203, 203, 3639, 3225, 609, 273, 394, 3225, 2932, 8863, 203, 3639, 364, 261, 863, 18, 1622, 32, 780, 16, 514, 34, 3082, 294, 3249, 18, 4099, 694, 10756, 288, 203, 5411, 309, 261, 701, 18, 2469, 1435, 405, 374, 13, 288, 203, 7734, 609, 18, 6923, 2932, 16, 8863, 203, 5411, 289, 203, 5411, 609, 18, 6923, 12, 6017, 18, 588, 653, 1435, 2934, 6923, 2932, 1546, 2934, 6923, 12, 6017, 18, 24805, 10663, 203, 3639, 289, 203, 3639, 327, 514, 18, 2139, 27188, 87, 9, 87, 9, 87, 3113, 1633, 16, 609, 16, 3758, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 735, 522, 275, 802, 707, 716, 5530, 326, 864, 1433, 666, 471, 1135, 279, 533, 316, 326, 646, 434, 203, 377, 380, 315, 1925, 461, 21, 33, 1925, 620, 21, 16, 1925, 461, 22, 33, 1925, 620, 22, 16, 7070, 203, 377, 380, 203, 377, 380, 632, 891, 3249, 326, 1433, 666, 203, 377, 380, 632, 891, 1633, 309, 486, 446, 16, 4259, 3949, 903, 1633, 326, 1433, 666, 203, 377, 380, 632, 891, 3758, 309, 486, 446, 16, 4259, 3949, 903, 3758, 326, 1433, 666, 203, 377, 380, 632, 2463, 326, 533, 646, 434, 326, 3249, 16, 8771, 12829, 471, 3758, 329, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
0e41a765a1b40c5118115a2184009f1754702c37
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/sax/SaxConverter.java
[ "Apache-2.0" ]
Java
run
String
public String run(List<Double> points) { double[] valuePoints = points.stream().mapToDouble(x -> x).toArray(); try { char[] saxString = SaxConverter.saxProcessor .ts2string(valuePoints, paaSize, SaxConverter.normalAlphabet.getCuts(alphabetSize), nThreshold); return new String(saxString); } catch (net.seninp.jmotif.sax.SAXException e) { logger.warn("Error while trying to calculate sax string for chunk", e.getMessage()); return e.getMessage(); } }
/** * convert a list of values into a SAX string * @param points * @return */
convert a list of values into a SAX string @param points @return
[ "convert", "a", "list", "of", "values", "into", "a", "SAX", "string", "@param", "points", "@return" ]
public String run(List<Double> points) { double[] valuePoints = points.stream().mapToDouble(x -> x).toArray(); try { char[] saxString = SaxConverter.saxProcessor .ts2string(valuePoints, paaSize, SaxConverter.normalAlphabet.getCuts(alphabetSize), nThreshold); return new String(saxString); } catch (net.seninp.jmotif.sax.SAXException e) { logger.warn("Error while trying to calculate sax string for chunk", e.getMessage()); return e.getMessage(); } }
[ "public", "String", "run", "(", "List", "<", "Double", ">", "points", ")", "{", "double", "[", "]", "valuePoints", "=", "points", ".", "stream", "(", ")", ".", "mapToDouble", "(", "x", "->", "x", ")", ".", "toArray", "(", ")", ";", "try", "{", "char", "[", "]", "saxString", "=", "SaxConverter", ".", "saxProcessor", ".", "ts2string", "(", "valuePoints", ",", "paaSize", ",", "SaxConverter", ".", "normalAlphabet", ".", "getCuts", "(", "alphabetSize", ")", ",", "nThreshold", ")", ";", "return", "new", "String", "(", "saxString", ")", ";", "}", "catch", "(", "net", ".", "seninp", ".", "jmotif", ".", "sax", ".", "SAXException", "e", ")", "{", "logger", ".", "warn", "(", "\"Error while trying to calculate sax string for chunk\"", ",", "e", ".", "getMessage", "(", ")", ")", ";", "return", "e", ".", "getMessage", "(", ")", ";", "}", "}" ]
convert a list of values into a SAX string @param points @return
[ "convert", "a", "list", "of", "values", "into", "a", "SAX", "string", "@param", "points", "@return" ]
[]
[ { "param": "points", "type": "List<Double>" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "points", "type": "List<Double>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 514, 1086, 12, 682, 32, 5265, 34, 3143, 13, 288, 203, 203, 3639, 1645, 8526, 460, 5636, 273, 3143, 18, 3256, 7675, 1458, 774, 5265, 12, 92, 317, 619, 2934, 31447, 5621, 203, 3639, 775, 288, 203, 203, 5411, 1149, 8526, 20319, 780, 273, 348, 651, 5072, 18, 87, 651, 5164, 203, 10792, 263, 3428, 22, 1080, 12, 1132, 5636, 16, 203, 18701, 6790, 69, 1225, 16, 203, 18701, 348, 651, 5072, 18, 6130, 27316, 18, 588, 39, 12940, 12, 287, 8907, 1225, 3631, 290, 7614, 1769, 203, 203, 5411, 327, 394, 514, 12, 87, 651, 780, 1769, 203, 203, 3639, 289, 1044, 261, 2758, 18, 87, 275, 31647, 18, 78, 18313, 430, 18, 87, 651, 18, 55, 2501, 503, 425, 13, 288, 203, 5411, 1194, 18, 8935, 2932, 668, 1323, 8374, 358, 4604, 20319, 533, 364, 2441, 3113, 425, 18, 24906, 10663, 203, 5411, 327, 425, 18, 24906, 5621, 203, 3639, 289, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 1765, 279, 666, 434, 924, 1368, 279, 10168, 533, 203, 377, 380, 632, 891, 3143, 203, 377, 380, 632, 2463, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
46c598c0f9b69d2ae643b5a10d1b05a76e176bbc
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/functions/analyse/Outlier.java
[ "Apache-2.0" ]
Java
execute
null
@Override public void execute(MetricTimeSeries timeSeries, FunctionValueMap functionValueMap) { if (timeSeries.isEmpty()) { functionValueMap.add(this, false, null); return; } DoubleList points = timeSeries.getValues(); //Calculate the percentiles double q1 = Percentile.evaluate(points, .25); double q3 = Percentile.evaluate(points, .75); //Calculate the threshold double threshold = (q3 - q1) * 1.5 + q3; //filter the values, if one outlier is found, we can return for (int i = 0; i < points.size(); i++) { double point = points.get(i); if (point > threshold) { functionValueMap.add(this, true, null); return; } } functionValueMap.add(this, false, null); }
/** * Detects outliers using the default box plot implementation. * An outlier every value that is above (q3-q1)*1.5*q3 where qN is the nth percentile * * @param functionValueMap */
Detects outliers using the default box plot implementation. An outlier every value that is above (q3-q1)*1.5*q3 where qN is the nth percentile
[ "Detects", "outliers", "using", "the", "default", "box", "plot", "implementation", ".", "An", "outlier", "every", "value", "that", "is", "above", "(", "q3", "-", "q1", ")", "*", "1", ".", "5", "*", "q3", "where", "qN", "is", "the", "nth", "percentile" ]
@Override public void execute(MetricTimeSeries timeSeries, FunctionValueMap functionValueMap) { if (timeSeries.isEmpty()) { functionValueMap.add(this, false, null); return; } DoubleList points = timeSeries.getValues(); double q1 = Percentile.evaluate(points, .25); double q3 = Percentile.evaluate(points, .75); double threshold = (q3 - q1) * 1.5 + q3; for (int i = 0; i < points.size(); i++) { double point = points.get(i); if (point > threshold) { functionValueMap.add(this, true, null); return; } } functionValueMap.add(this, false, null); }
[ "@", "Override", "public", "void", "execute", "(", "MetricTimeSeries", "timeSeries", ",", "FunctionValueMap", "functionValueMap", ")", "{", "if", "(", "timeSeries", ".", "isEmpty", "(", ")", ")", "{", "functionValueMap", ".", "add", "(", "this", ",", "false", ",", "null", ")", ";", "return", ";", "}", "DoubleList", "points", "=", "timeSeries", ".", "getValues", "(", ")", ";", "double", "q1", "=", "Percentile", ".", "evaluate", "(", "points", ",", ".25", ")", ";", "double", "q3", "=", "Percentile", ".", "evaluate", "(", "points", ",", ".75", ")", ";", "double", "threshold", "=", "(", "q3", "-", "q1", ")", "*", "1.5", "+", "q3", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "points", ".", "size", "(", ")", ";", "i", "++", ")", "{", "double", "point", "=", "points", ".", "get", "(", "i", ")", ";", "if", "(", "point", ">", "threshold", ")", "{", "functionValueMap", ".", "add", "(", "this", ",", "true", ",", "null", ")", ";", "return", ";", "}", "}", "functionValueMap", ".", "add", "(", "this", ",", "false", ",", "null", ")", ";", "}" ]
Detects outliers using the default box plot implementation.
[ "Detects", "outliers", "using", "the", "default", "box", "plot", "implementation", "." ]
[ "//Calculate the percentiles", "//Calculate the threshold", "//filter the values, if one outlier is found, we can return" ]
[ { "param": "timeSeries", "type": "MetricTimeSeries" }, { "param": "functionValueMap", "type": "FunctionValueMap" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "timeSeries", "type": "MetricTimeSeries", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "functionValueMap", "type": "FunctionValueMap", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 565, 1071, 918, 1836, 12, 5396, 28486, 813, 6485, 16, 4284, 26795, 445, 26795, 13, 288, 203, 203, 3639, 309, 261, 957, 6485, 18, 291, 1921, 10756, 288, 203, 5411, 445, 26795, 18, 1289, 12, 2211, 16, 629, 16, 446, 1769, 203, 5411, 327, 31, 203, 3639, 289, 203, 203, 3639, 3698, 682, 3143, 273, 813, 6485, 18, 588, 1972, 5621, 203, 3639, 368, 8695, 326, 5551, 1449, 203, 3639, 1645, 1043, 21, 273, 21198, 398, 18, 21024, 12, 4139, 16, 263, 2947, 1769, 203, 3639, 1645, 1043, 23, 273, 21198, 398, 18, 21024, 12, 4139, 16, 263, 5877, 1769, 203, 3639, 368, 8695, 326, 5573, 203, 3639, 1645, 5573, 273, 261, 85, 23, 300, 1043, 21, 13, 380, 404, 18, 25, 397, 1043, 23, 31, 203, 3639, 368, 2188, 326, 924, 16, 309, 1245, 596, 9800, 353, 1392, 16, 732, 848, 327, 203, 3639, 364, 261, 474, 277, 273, 374, 31, 277, 411, 3143, 18, 1467, 5621, 277, 27245, 288, 203, 5411, 1645, 1634, 273, 3143, 18, 588, 12, 77, 1769, 203, 5411, 309, 261, 1153, 405, 5573, 13, 288, 203, 7734, 445, 26795, 18, 1289, 12, 2211, 16, 638, 16, 446, 1769, 203, 7734, 327, 31, 203, 5411, 289, 203, 3639, 289, 203, 3639, 445, 26795, 18, 1289, 12, 2211, 16, 629, 16, 446, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 203, 377, 380, 203, 377, 380, 632, 891, 445, 26795, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
162896208d782cc59de491b5aae88a3689746e4a
Hurence/historian
historian-server/src/main/java/com/hurence/webapiservice/http/api/analytics/AnalyticsApiImpl.java
[ "Apache-2.0" ]
Java
clustering
null
@Override @Experimental public void clustering(RoutingContext context) { final long start = System.currentTimeMillis(); // parse request final ClusteringRequest request; try { JsonObject requestBody = context.getBodyAsJson(); request = ClusteringRequest.fromJson(requestBody); } catch (Exception ex) { LOGGER.error("error parsing request", ex); context.response().setStatusCode(BAD_REQUEST); context.response().setStatusMessage(StatusMessages.BAD_REQUEST); context.response().putHeader("Content-Type", "application/json"); context.response().end(ErrorMsgHelper.createMsgError("Error parsing request !", ex)); return; } // get the chunks corresponding to request params service.rxGetTimeSeriesChunk(request.toParams()) .doOnError(ex -> { LOGGER.error("Unexpected error : ", ex); context.response().setStatusCode(500); context.response().putHeader("Content-Type", "text/plain"); context.response().end(ex.getMessage()); }) .doOnSuccess(response -> { // convert the json response into ChunkClusterable objects List<ChunkClusterable> chunkWrappers = response.getJsonArray("chunks").stream() .map(metric -> { JsonObject el = (JsonObject) metric; Map<String, String> tags = new HashMap<String, String>() {{ put(SOLR_COLUMN_NAME, el.getString(SOLR_COLUMN_NAME)); put(SOLR_COLUMN_METRIC_KEY, el.getString(SOLR_COLUMN_METRIC_KEY)); put(SOLR_COLUMN_AVG, String.valueOf(el.getDouble(SOLR_COLUMN_AVG))); }}; if (el.getDouble("chunk_avg") != 0 /*&& el.getString(CHUNK_SAX).length() == 20*/) return new ChunkWrapper( el.getString(SOLR_COLUMN_ID), el.getString(SOLR_COLUMN_SAX), tags); else return null; }) .filter(Objects::nonNull) .collect(Collectors.toList()); if (chunkWrappers.size() != 0) { // proceed to clustering ChunksClustering clustering = KMeansChunksClustering.builder() .k(request.getK()) .maxIterations(request.getMaxIterations()) .distance(KMeansChunksClustering.Distance.DEFAULT) .build(); clustering.cluster(chunkWrappers); } // build Json response Map<String, JsonObject> clustersJson = new HashMap<>(); chunkWrappers.forEach(chunkClusterable -> { String clusterId = chunkClusterable.getTags().get("sax_cluster"); // create a json cluster object if needed if (!clustersJson.containsKey(clusterId)) { clustersJson.put(clusterId, new JsonObject() .put("sax_cluster", clusterId) .put("cluster_size", 0) .put("chunks", new JsonArray())); } // add point to the cluster JsonObject jsonClusterObject = clustersJson.get(clusterId); jsonClusterObject.getJsonArray("chunks") .add(new JsonObject() .put(SOLR_COLUMN_ID, chunkClusterable.getId()) .put(SOLR_COLUMN_SAX, chunkClusterable.getSax()) .put(SOLR_COLUMN_METRIC_KEY, chunkClusterable.getTags().get(SOLR_COLUMN_METRIC_KEY)) .put(SOLR_COLUMN_AVG, chunkClusterable.getTags().get(SOLR_COLUMN_AVG)) ); // update size of the cluster jsonClusterObject.put("cluster_size", jsonClusterObject.getJsonArray("chunks").size()); }); JsonArray clusters = new JsonArray(); clustersJson.values().forEach(clusters::add); JsonObject finalResponse = new JsonObject() .put("clustering.algo", "kmeans") .put("k", request.getK()) .put("day", request.getDay()) .put("maxIterations", request.getMaxIterations()) .put("elapsed_time", System.currentTimeMillis() - start) .put("clusters", clusters); // send back the http response context.response().setStatusCode(OK); context.response().putHeader("Content-Type", "application/json"); context.response().end(finalResponse.encodePrettily()); }).subscribe(); }
/** * Build a cluster list of chunks based on sax strings * <p> * curl --location --request GET 'localhost:8080/api/historian/v0/analytics/clustering' \ * --header 'Content-Type: application/json' \ * --data-raw '{ * "names": ["ack"], * "day": "2019-11-28", * "k": 5 * }' * <p> * return * <p> * { * "clustering.algo": "kmeans", * "k": 5, * "day": "2019-11-28", * "maxIterations": 100, * "elapsed_time": 358, * "clusters": [ * { * "sax_cluster": "0", * "cluster_size": 1, * "chunks": [ * { * "id": "5ba8f698c82ed652b034d22f04db844ea43531536d19150ccc0071e482791bf4", * "chunk_sax": "dddddgdddddddddddddd", * "metric_key": "ack|crit$null|metric_id$621ba06c-d980-4b9f-9018-8688ff17f252|warn$null", * "chunk_avg": "7.352941176470604E-4" * } * ] * }, * ... * ] * } * * @param context the current vert.x RoutingContext */
@param context the current vert.x RoutingContext
[ "@param", "context", "the", "current", "vert", ".", "x", "RoutingContext" ]
@Override @Experimental public void clustering(RoutingContext context) { final long start = System.currentTimeMillis(); final ClusteringRequest request; try { JsonObject requestBody = context.getBodyAsJson(); request = ClusteringRequest.fromJson(requestBody); } catch (Exception ex) { LOGGER.error("error parsing request", ex); context.response().setStatusCode(BAD_REQUEST); context.response().setStatusMessage(StatusMessages.BAD_REQUEST); context.response().putHeader("Content-Type", "application/json"); context.response().end(ErrorMsgHelper.createMsgError("Error parsing request !", ex)); return; } service.rxGetTimeSeriesChunk(request.toParams()) .doOnError(ex -> { LOGGER.error("Unexpected error : ", ex); context.response().setStatusCode(500); context.response().putHeader("Content-Type", "text/plain"); context.response().end(ex.getMessage()); }) .doOnSuccess(response -> { List<ChunkClusterable> chunkWrappers = response.getJsonArray("chunks").stream() .map(metric -> { JsonObject el = (JsonObject) metric; Map<String, String> tags = new HashMap<String, String>() {{ put(SOLR_COLUMN_NAME, el.getString(SOLR_COLUMN_NAME)); put(SOLR_COLUMN_METRIC_KEY, el.getString(SOLR_COLUMN_METRIC_KEY)); put(SOLR_COLUMN_AVG, String.valueOf(el.getDouble(SOLR_COLUMN_AVG))); }}; if (el.getDouble("chunk_avg") != 0 /*&& el.getString(CHUNK_SAX).length() == 20*/) return new ChunkWrapper( el.getString(SOLR_COLUMN_ID), el.getString(SOLR_COLUMN_SAX), tags); else return null; }) .filter(Objects::nonNull) .collect(Collectors.toList()); if (chunkWrappers.size() != 0) { ChunksClustering clustering = KMeansChunksClustering.builder() .k(request.getK()) .maxIterations(request.getMaxIterations()) .distance(KMeansChunksClustering.Distance.DEFAULT) .build(); clustering.cluster(chunkWrappers); } Map<String, JsonObject> clustersJson = new HashMap<>(); chunkWrappers.forEach(chunkClusterable -> { String clusterId = chunkClusterable.getTags().get("sax_cluster"); if (!clustersJson.containsKey(clusterId)) { clustersJson.put(clusterId, new JsonObject() .put("sax_cluster", clusterId) .put("cluster_size", 0) .put("chunks", new JsonArray())); } JsonObject jsonClusterObject = clustersJson.get(clusterId); jsonClusterObject.getJsonArray("chunks") .add(new JsonObject() .put(SOLR_COLUMN_ID, chunkClusterable.getId()) .put(SOLR_COLUMN_SAX, chunkClusterable.getSax()) .put(SOLR_COLUMN_METRIC_KEY, chunkClusterable.getTags().get(SOLR_COLUMN_METRIC_KEY)) .put(SOLR_COLUMN_AVG, chunkClusterable.getTags().get(SOLR_COLUMN_AVG)) ); jsonClusterObject.put("cluster_size", jsonClusterObject.getJsonArray("chunks").size()); }); JsonArray clusters = new JsonArray(); clustersJson.values().forEach(clusters::add); JsonObject finalResponse = new JsonObject() .put("clustering.algo", "kmeans") .put("k", request.getK()) .put("day", request.getDay()) .put("maxIterations", request.getMaxIterations()) .put("elapsed_time", System.currentTimeMillis() - start) .put("clusters", clusters); context.response().setStatusCode(OK); context.response().putHeader("Content-Type", "application/json"); context.response().end(finalResponse.encodePrettily()); }).subscribe(); }
[ "@", "Override", "@", "Experimental", "public", "void", "clustering", "(", "RoutingContext", "context", ")", "{", "final", "long", "start", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "final", "ClusteringRequest", "request", ";", "try", "{", "JsonObject", "requestBody", "=", "context", ".", "getBodyAsJson", "(", ")", ";", "request", "=", "ClusteringRequest", ".", "fromJson", "(", "requestBody", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "LOGGER", ".", "error", "(", "\"error parsing request\"", ",", "ex", ")", ";", "context", ".", "response", "(", ")", ".", "setStatusCode", "(", "BAD_REQUEST", ")", ";", "context", ".", "response", "(", ")", ".", "setStatusMessage", "(", "StatusMessages", ".", "BAD_REQUEST", ")", ";", "context", ".", "response", "(", ")", ".", "putHeader", "(", "\"Content-Type\"", ",", "\"application/json\"", ")", ";", "context", ".", "response", "(", ")", ".", "end", "(", "ErrorMsgHelper", ".", "createMsgError", "(", "\"Error parsing request !\"", ",", "ex", ")", ")", ";", "return", ";", "}", "service", ".", "rxGetTimeSeriesChunk", "(", "request", ".", "toParams", "(", ")", ")", ".", "doOnError", "(", "ex", "->", "{", "LOGGER", ".", "error", "(", "\"Unexpected error : \"", ",", "ex", ")", ";", "context", ".", "response", "(", ")", ".", "setStatusCode", "(", "500", ")", ";", "context", ".", "response", "(", ")", ".", "putHeader", "(", "\"Content-Type\"", ",", "\"text/plain\"", ")", ";", "context", ".", "response", "(", ")", ".", "end", "(", "ex", ".", "getMessage", "(", ")", ")", ";", "}", ")", ".", "doOnSuccess", "(", "response", "->", "{", "List", "<", "ChunkClusterable", ">", "chunkWrappers", "=", "response", ".", "getJsonArray", "(", "\"chunks\"", ")", ".", "stream", "(", ")", ".", "map", "(", "metric", "->", "{", "JsonObject", "el", "=", "(", "JsonObject", ")", "metric", ";", "Map", "<", "String", ",", "String", ">", "tags", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", "{", "{", "put", "(", "SOLR_COLUMN_NAME", ",", "el", ".", "getString", "(", "SOLR_COLUMN_NAME", ")", ")", ";", "put", "(", "SOLR_COLUMN_METRIC_KEY", ",", "el", ".", "getString", "(", "SOLR_COLUMN_METRIC_KEY", ")", ")", ";", "put", "(", "SOLR_COLUMN_AVG", ",", "String", ".", "valueOf", "(", "el", ".", "getDouble", "(", "SOLR_COLUMN_AVG", ")", ")", ")", ";", "}", "}", ";", "if", "(", "el", ".", "getDouble", "(", "\"chunk_avg\"", ")", "!=", "0", "/*&& el.getString(CHUNK_SAX).length() == 20*/", ")", "return", "new", "ChunkWrapper", "(", "el", ".", "getString", "(", "SOLR_COLUMN_ID", ")", ",", "el", ".", "getString", "(", "SOLR_COLUMN_SAX", ")", ",", "tags", ")", ";", "else", "return", "null", ";", "}", ")", ".", "filter", "(", "Objects", "::", "nonNull", ")", ".", "collect", "(", "Collectors", ".", "toList", "(", ")", ")", ";", "if", "(", "chunkWrappers", ".", "size", "(", ")", "!=", "0", ")", "{", "ChunksClustering", "clustering", "=", "KMeansChunksClustering", ".", "builder", "(", ")", ".", "k", "(", "request", ".", "getK", "(", ")", ")", ".", "maxIterations", "(", "request", ".", "getMaxIterations", "(", ")", ")", ".", "distance", "(", "KMeansChunksClustering", ".", "Distance", ".", "DEFAULT", ")", ".", "build", "(", ")", ";", "clustering", ".", "cluster", "(", "chunkWrappers", ")", ";", "}", "Map", "<", "String", ",", "JsonObject", ">", "clustersJson", "=", "new", "HashMap", "<", ">", "(", ")", ";", "chunkWrappers", ".", "forEach", "(", "chunkClusterable", "->", "{", "String", "clusterId", "=", "chunkClusterable", ".", "getTags", "(", ")", ".", "get", "(", "\"sax_cluster\"", ")", ";", "if", "(", "!", "clustersJson", ".", "containsKey", "(", "clusterId", ")", ")", "{", "clustersJson", ".", "put", "(", "clusterId", ",", "new", "JsonObject", "(", ")", ".", "put", "(", "\"sax_cluster\"", ",", "clusterId", ")", ".", "put", "(", "\"cluster_size\"", ",", "0", ")", ".", "put", "(", "\"chunks\"", ",", "new", "JsonArray", "(", ")", ")", ")", ";", "}", "JsonObject", "jsonClusterObject", "=", "clustersJson", ".", "get", "(", "clusterId", ")", ";", "jsonClusterObject", ".", "getJsonArray", "(", "\"chunks\"", ")", ".", "add", "(", "new", "JsonObject", "(", ")", ".", "put", "(", "SOLR_COLUMN_ID", ",", "chunkClusterable", ".", "getId", "(", ")", ")", ".", "put", "(", "SOLR_COLUMN_SAX", ",", "chunkClusterable", ".", "getSax", "(", ")", ")", ".", "put", "(", "SOLR_COLUMN_METRIC_KEY", ",", "chunkClusterable", ".", "getTags", "(", ")", ".", "get", "(", "SOLR_COLUMN_METRIC_KEY", ")", ")", ".", "put", "(", "SOLR_COLUMN_AVG", ",", "chunkClusterable", ".", "getTags", "(", ")", ".", "get", "(", "SOLR_COLUMN_AVG", ")", ")", ")", ";", "jsonClusterObject", ".", "put", "(", "\"cluster_size\"", ",", "jsonClusterObject", ".", "getJsonArray", "(", "\"chunks\"", ")", ".", "size", "(", ")", ")", ";", "}", ")", ";", "JsonArray", "clusters", "=", "new", "JsonArray", "(", ")", ";", "clustersJson", ".", "values", "(", ")", ".", "forEach", "(", "clusters", "::", "add", ")", ";", "JsonObject", "finalResponse", "=", "new", "JsonObject", "(", ")", ".", "put", "(", "\"clustering.algo\"", ",", "\"kmeans\"", ")", ".", "put", "(", "\"k\"", ",", "request", ".", "getK", "(", ")", ")", ".", "put", "(", "\"day\"", ",", "request", ".", "getDay", "(", ")", ")", ".", "put", "(", "\"maxIterations\"", ",", "request", ".", "getMaxIterations", "(", ")", ")", ".", "put", "(", "\"elapsed_time\"", ",", "System", ".", "currentTimeMillis", "(", ")", "-", "start", ")", ".", "put", "(", "\"clusters\"", ",", "clusters", ")", ";", "context", ".", "response", "(", ")", ".", "setStatusCode", "(", "OK", ")", ";", "context", ".", "response", "(", ")", ".", "putHeader", "(", "\"Content-Type\"", ",", "\"application/json\"", ")", ";", "context", ".", "response", "(", ")", ".", "end", "(", "finalResponse", ".", "encodePrettily", "(", ")", ")", ";", "}", ")", ".", "subscribe", "(", ")", ";", "}" ]
Build a cluster list of chunks based on sax strings <p> curl --location --request GET 'localhost:8080/api/historian/v0/analytics/clustering' \ --header 'Content-Type: application/json' \ --data-raw '{ "names": ["ack"], "day": "2019-11-28", "k": 5 }' <p> return <p> { "clustering.algo": "kmeans", "k": 5, "day": "2019-11-28", "maxIterations": 100, "elapsed_time": 358, "clusters": [ { "sax_cluster": "0", "cluster_size": 1, "chunks": [ { "id": "5ba8f698c82ed652b034d22f04db844ea43531536d19150ccc0071e482791bf4", "chunk_sax": "dddddgdddddddddddddd", "metric_key": "ack|crit$null|metric_id$621ba06c-d980-4b9f-9018-8688ff17f252|warn$null", "chunk_avg": "7.352941176470604E-4" } ] }, ... ] }
[ "Build", "a", "cluster", "list", "of", "chunks", "based", "on", "sax", "strings", "<p", ">", "curl", "--", "location", "--", "request", "GET", "'", "localhost", ":", "8080", "/", "api", "/", "historian", "/", "v0", "/", "analytics", "/", "clustering", "'", "\\", "--", "header", "'", "Content", "-", "Type", ":", "application", "/", "json", "'", "\\", "--", "data", "-", "raw", "'", "{", "\"", "names", "\"", ":", "[", "\"", "ack", "\"", "]", "\"", "day", "\"", ":", "\"", "2019", "-", "11", "-", "28", "\"", "\"", "k", "\"", ":", "5", "}", "'", "<p", ">", "return", "<p", ">", "{", "\"", "clustering", ".", "algo", "\"", ":", "\"", "kmeans", "\"", "\"", "k", "\"", ":", "5", "\"", "day", "\"", ":", "\"", "2019", "-", "11", "-", "28", "\"", "\"", "maxIterations", "\"", ":", "100", "\"", "elapsed_time", "\"", ":", "358", "\"", "clusters", "\"", ":", "[", "{", "\"", "sax_cluster", "\"", ":", "\"", "0", "\"", "\"", "cluster_size", "\"", ":", "1", "\"", "chunks", "\"", ":", "[", "{", "\"", "id", "\"", ":", "\"", "5ba8f698c82ed652b034d22f04db844ea43531536d19150ccc0071e482791bf4", "\"", "\"", "chunk_sax", "\"", ":", "\"", "dddddgdddddddddddddd", "\"", "\"", "metric_key", "\"", ":", "\"", "ack|crit$null|metric_id$621ba06c", "-", "d980", "-", "4b9f", "-", "9018", "-", "8688ff17f252|warn$null", "\"", "\"", "chunk_avg", "\"", ":", "\"", "7", ".", "352941176470604E", "-", "4", "\"", "}", "]", "}", "...", "]", "}" ]
[ "// parse request", "// get the chunks corresponding to request params", "// convert the json response into ChunkClusterable objects", "// proceed to clustering", "// build Json response", "// create a json cluster object if needed", "// add point to the cluster", "// update size of the cluster", "// send back the http response" ]
[ { "param": "context", "type": "RoutingContext" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "context", "type": "RoutingContext", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 565, 632, 22338, 287, 203, 565, 1071, 918, 18743, 12, 13966, 1042, 819, 13, 288, 203, 203, 3639, 727, 1525, 787, 273, 2332, 18, 2972, 28512, 5621, 203, 203, 3639, 368, 1109, 590, 203, 3639, 727, 29103, 691, 590, 31, 203, 3639, 775, 288, 203, 5411, 11596, 20740, 273, 819, 18, 588, 2250, 1463, 3185, 5621, 203, 5411, 590, 273, 29103, 691, 18, 2080, 3185, 12, 2293, 2250, 1769, 203, 3639, 289, 1044, 261, 503, 431, 13, 288, 203, 5411, 4145, 18, 1636, 2932, 1636, 5811, 590, 3113, 431, 1769, 203, 5411, 819, 18, 2740, 7675, 542, 14041, 12, 16234, 67, 5519, 1769, 203, 5411, 819, 18, 2740, 7675, 542, 1482, 1079, 12, 1482, 5058, 18, 16234, 67, 5519, 1769, 203, 5411, 819, 18, 2740, 7675, 458, 1864, 2932, 1350, 17, 559, 3113, 315, 3685, 19, 1977, 8863, 203, 5411, 819, 18, 2740, 7675, 409, 12, 668, 3332, 2276, 18, 2640, 3332, 668, 2932, 668, 5811, 590, 401, 3113, 431, 10019, 203, 5411, 327, 31, 203, 3639, 289, 203, 203, 3639, 368, 336, 326, 6055, 4656, 358, 590, 859, 203, 3639, 1156, 18, 20122, 967, 28486, 5579, 12, 2293, 18, 869, 1370, 10756, 203, 7734, 263, 2896, 11427, 12, 338, 317, 288, 203, 10792, 4145, 18, 1636, 2932, 7762, 555, 294, 3104, 431, 1769, 203, 10792, 819, 18, 2740, 7675, 542, 14041, 12, 12483, 1769, 203, 10792, 819, 18, 2740, 7675, 458, 1864, 2932, 1350, 17, 559, 3113, 315, 955, 19, 7446, 8863, 203, 10792, 819, 18, 2740, 7675, 409, 12, 338, 18, 24906, 10663, 203, 7734, 289, 13, 203, 7734, 263, 2896, 1398, 4510, 12, 2740, 317, 288, 203, 203, 10792, 368, 1765, 326, 1163, 766, 1368, 13021, 3629, 429, 2184, 203, 10792, 987, 32, 5579, 3629, 429, 34, 2441, 24114, 273, 766, 18, 588, 3185, 1076, 2932, 14691, 20387, 3256, 1435, 203, 18701, 263, 1458, 12, 6899, 317, 288, 203, 27573, 11596, 415, 273, 261, 23857, 13, 3999, 31, 203, 203, 27573, 1635, 32, 780, 16, 514, 34, 2342, 273, 394, 4317, 32, 780, 16, 514, 34, 1435, 10179, 203, 4766, 565, 1378, 12, 19815, 54, 67, 11009, 67, 1985, 16, 415, 18, 588, 780, 12, 19815, 54, 67, 11009, 67, 1985, 10019, 203, 4766, 565, 1378, 12, 19815, 54, 67, 11009, 67, 23081, 39, 67, 3297, 16, 415, 18, 588, 780, 12, 19815, 54, 67, 11009, 67, 23081, 39, 67, 3297, 10019, 203, 4766, 565, 1378, 12, 19815, 54, 67, 11009, 67, 5856, 43, 16, 514, 18, 1132, 951, 12, 292, 18, 588, 5265, 12, 19815, 54, 67, 11009, 67, 5856, 43, 3719, 1769, 203, 27573, 10523, 31, 203, 203, 27573, 309, 261, 292, 18, 588, 5265, 2932, 6551, 67, 14141, 7923, 480, 374, 1748, 10, 10, 415, 18, 588, 780, 12, 26464, 67, 55, 2501, 2934, 2469, 1435, 422, 4200, 5549, 13, 203, 4766, 565, 327, 394, 13021, 3611, 12, 203, 4766, 5411, 415, 18, 588, 780, 12, 19815, 54, 67, 11009, 67, 734, 3631, 203, 4766, 5411, 415, 18, 588, 780, 12, 19815, 54, 67, 11009, 67, 55, 2 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
[ 1, 26873, 203, 377, 380, 3998, 279, 2855, 666, 434, 6055, 2511, 603, 20319, 2064, 203, 377, 380, 411, 84, 34, 203, 377, 380, 3363, 1493, 3562, 1493, 2293, 4978, 296, 13014, 30, 3672, 3672, 19, 2425, 19, 11488, 280, 2779, 19, 90, 20, 19, 18466, 19, 7967, 310, 11, 521, 203, 377, 380, 1493, 3374, 296, 1350, 17, 559, 30, 2521, 19, 1977, 11, 521, 203, 377, 380, 1493, 892, 17, 1899, 2292, 203, 377, 380, 315, 1973, 6877, 8247, 484, 6, 6487, 203, 377, 380, 315, 2881, 6877, 315, 6734, 29, 17, 2499, 17, 6030, 3113, 203, 377, 380, 315, 79, 6877, 1381, 203, 377, 380, 27770, 203, 377, 380, 411, 84, 34, 203, 377, 380, 327, 203, 377, 380, 411, 84, 34, 203, 377, 2 ]
fb2a430933d4c9bd4cff0eef263b04bca54cdb51
Hurence/historian
historian-server/src/main/java/com/hurence/webapiservice/timeseries/aggs/AbstractAggsCalculator.java
[ "Apache-2.0" ]
Java
calculNeededAggSet
null
private Set<AGG> calculNeededAggSet() { Set<AGG> neededAggSet = new HashSet<>(askedAggSet); if (neededAggSet.remove(AVG)){ neededAggSet.add(SUM); neededAggSet.add(COUNT); } return neededAggSet; }
/** * * @return list of aggs needed to be calculated. Indeed some aggs can be calculated using others. */
@return list of aggs needed to be calculated. Indeed some aggs can be calculated using others.
[ "@return", "list", "of", "aggs", "needed", "to", "be", "calculated", ".", "Indeed", "some", "aggs", "can", "be", "calculated", "using", "others", "." ]
private Set<AGG> calculNeededAggSet() { Set<AGG> neededAggSet = new HashSet<>(askedAggSet); if (neededAggSet.remove(AVG)){ neededAggSet.add(SUM); neededAggSet.add(COUNT); } return neededAggSet; }
[ "private", "Set", "<", "AGG", ">", "calculNeededAggSet", "(", ")", "{", "Set", "<", "AGG", ">", "neededAggSet", "=", "new", "HashSet", "<", ">", "(", "askedAggSet", ")", ";", "if", "(", "neededAggSet", ".", "remove", "(", "AVG", ")", ")", "{", "neededAggSet", ".", "add", "(", "SUM", ")", ";", "neededAggSet", ".", "add", "(", "COUNT", ")", ";", "}", "return", "neededAggSet", ";", "}" ]
@return list of aggs needed to be calculated.
[ "@return", "list", "of", "aggs", "needed", "to", "be", "calculated", "." ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 3238, 1000, 32, 1781, 43, 34, 3026, 11449, 17139, 694, 1435, 288, 203, 3639, 1000, 32, 1781, 43, 34, 3577, 17139, 694, 273, 394, 6847, 29667, 12, 835, 329, 17139, 694, 1769, 203, 3639, 309, 261, 17471, 17139, 694, 18, 4479, 12, 5856, 43, 3719, 95, 203, 5411, 3577, 17139, 694, 18, 1289, 12, 14020, 1769, 203, 5411, 3577, 17139, 694, 18, 1289, 12, 7240, 1769, 203, 3639, 289, 203, 3639, 327, 3577, 17139, 694, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 203, 377, 380, 632, 2463, 666, 434, 1737, 564, 3577, 358, 506, 8894, 18, 657, 323, 329, 2690, 1737, 564, 848, 506, 8894, 1450, 10654, 18, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
fb2a430933d4c9bd4cff0eef263b04bca54cdb51
Hurence/historian
historian-server/src/main/java/com/hurence/webapiservice/timeseries/aggs/AbstractAggsCalculator.java
[ "Apache-2.0" ]
Java
updateAggs
null
@Override public void updateAggs(List<T> elementsToAgg) { if (!elementsToAgg.isEmpty()) neededAggSet.forEach(agg -> { switch (agg) { case SUM: calculateSum(elementsToAgg); break; case MIN: calculateMin(elementsToAgg); break; case MAX: calculateMax(elementsToAgg); break; case COUNT: calculateCount(elementsToAgg); break; default: throw new IllegalStateException("Unsupported aggregation: " + agg); } }); }
/** * update aggs values for whose that are cumulative (ie not avg) * @param elementsToAgg */
update aggs values for whose that are cumulative @param elementsToAgg
[ "update", "aggs", "values", "for", "whose", "that", "are", "cumulative", "@param", "elementsToAgg" ]
@Override public void updateAggs(List<T> elementsToAgg) { if (!elementsToAgg.isEmpty()) neededAggSet.forEach(agg -> { switch (agg) { case SUM: calculateSum(elementsToAgg); break; case MIN: calculateMin(elementsToAgg); break; case MAX: calculateMax(elementsToAgg); break; case COUNT: calculateCount(elementsToAgg); break; default: throw new IllegalStateException("Unsupported aggregation: " + agg); } }); }
[ "@", "Override", "public", "void", "updateAggs", "(", "List", "<", "T", ">", "elementsToAgg", ")", "{", "if", "(", "!", "elementsToAgg", ".", "isEmpty", "(", ")", ")", "neededAggSet", ".", "forEach", "(", "agg", "->", "{", "switch", "(", "agg", ")", "{", "case", "SUM", ":", "calculateSum", "(", "elementsToAgg", ")", ";", "break", ";", "case", "MIN", ":", "calculateMin", "(", "elementsToAgg", ")", ";", "break", ";", "case", "MAX", ":", "calculateMax", "(", "elementsToAgg", ")", ";", "break", ";", "case", "COUNT", ":", "calculateCount", "(", "elementsToAgg", ")", ";", "break", ";", "default", ":", "throw", "new", "IllegalStateException", "(", "\"Unsupported aggregation: \"", "+", "agg", ")", ";", "}", "}", ")", ";", "}" ]
update aggs values for whose that are cumulative (ie not avg) @param elementsToAgg
[ "update", "aggs", "values", "for", "whose", "that", "are", "cumulative", "(", "ie", "not", "avg", ")", "@param", "elementsToAgg" ]
[]
[ { "param": "elementsToAgg", "type": "List<T>" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "elementsToAgg", "type": "List<T>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 565, 1071, 918, 1089, 2577, 564, 12, 682, 32, 56, 34, 2186, 774, 17139, 13, 288, 203, 3639, 309, 16051, 6274, 774, 17139, 18, 291, 1921, 10756, 203, 5411, 3577, 17139, 694, 18, 1884, 3442, 12, 17535, 317, 288, 203, 7734, 1620, 261, 17535, 13, 288, 203, 10792, 648, 22595, 30, 203, 13491, 4604, 3495, 12, 6274, 774, 17139, 1769, 203, 13491, 898, 31, 203, 10792, 648, 6989, 30, 203, 13491, 4604, 2930, 12, 6274, 774, 17139, 1769, 203, 13491, 898, 31, 203, 10792, 648, 4552, 30, 203, 13491, 4604, 2747, 12, 6274, 774, 17139, 1769, 203, 13491, 898, 31, 203, 10792, 648, 12666, 30, 203, 13491, 4604, 1380, 12, 6274, 774, 17139, 1769, 203, 13491, 898, 31, 203, 10792, 805, 30, 203, 13491, 604, 394, 5477, 2932, 8544, 10163, 30, 315, 397, 10421, 1769, 203, 7734, 289, 203, 5411, 15549, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 1089, 1737, 564, 924, 364, 8272, 716, 854, 15582, 261, 1385, 486, 11152, 13, 203, 377, 380, 632, 891, 2186, 774, 17139, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
a72a973e0db4916c8aa1cff6a3b2ab5e2a928f48
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/compaction/protobuf/ProtoBufTimeSeriesCurrentSerializer.java
[ "Apache-2.0" ]
Java
from
null
public static TreeSet<Measure> from(final InputStream decompressedBytes, long timeSeriesStart, long timeSeriesEnd , long from, long to, byte[] chunkOfPoints) throws IOException, IllegalArgumentException { try { return ProtoBufTimeSeriesWithQualitySerializer.from(decompressedBytes, timeSeriesStart, timeSeriesEnd, from, to); } catch (IllegalArgumentException ex) { LOGGER.trace("could not uncompress using algo with quality will try with old algorithm"); /*decompressedBytes.reset();*/ InputStream newDecompressedBytes = Compression.decompressToStream(chunkOfPoints); return ProtoBufTimeSeriesSerializer.from(newDecompressedBytes, timeSeriesStart, timeSeriesEnd, from, to); } }
/** * return the uncompressed points (compressed byte array) * The quality value in compressedByte is supposed to be -1 if there no quality. This * is safe because we expect quality to be a float between 0 and 1 if it is present. * * @param decompressedBytes the compressed bytes holding the data points * @param timeSeriesStart the start of the time series * @param timeSeriesEnd the end of the time series * @param from including points from * @param to including points to */
return the uncompressed points (compressed byte array) The quality value in compressedByte is supposed to be -1 if there no quality. This is safe because we expect quality to be a float between 0 and 1 if it is present.
[ "return", "the", "uncompressed", "points", "(", "compressed", "byte", "array", ")", "The", "quality", "value", "in", "compressedByte", "is", "supposed", "to", "be", "-", "1", "if", "there", "no", "quality", ".", "This", "is", "safe", "because", "we", "expect", "quality", "to", "be", "a", "float", "between", "0", "and", "1", "if", "it", "is", "present", "." ]
public static TreeSet<Measure> from(final InputStream decompressedBytes, long timeSeriesStart, long timeSeriesEnd , long from, long to, byte[] chunkOfPoints) throws IOException, IllegalArgumentException { try { return ProtoBufTimeSeriesWithQualitySerializer.from(decompressedBytes, timeSeriesStart, timeSeriesEnd, from, to); } catch (IllegalArgumentException ex) { LOGGER.trace("could not uncompress using algo with quality will try with old algorithm"); /*decompressedBytes.reset();*/ InputStream newDecompressedBytes = Compression.decompressToStream(chunkOfPoints); return ProtoBufTimeSeriesSerializer.from(newDecompressedBytes, timeSeriesStart, timeSeriesEnd, from, to); } }
[ "public", "static", "TreeSet", "<", "Measure", ">", "from", "(", "final", "InputStream", "decompressedBytes", ",", "long", "timeSeriesStart", ",", "long", "timeSeriesEnd", ",", "long", "from", ",", "long", "to", ",", "byte", "[", "]", "chunkOfPoints", ")", "throws", "IOException", ",", "IllegalArgumentException", "{", "try", "{", "return", "ProtoBufTimeSeriesWithQualitySerializer", ".", "from", "(", "decompressedBytes", ",", "timeSeriesStart", ",", "timeSeriesEnd", ",", "from", ",", "to", ")", ";", "}", "catch", "(", "IllegalArgumentException", "ex", ")", "{", "LOGGER", ".", "trace", "(", "\"could not uncompress using algo with quality will try with old algorithm\"", ")", ";", "/*decompressedBytes.reset();*/", "InputStream", "newDecompressedBytes", "=", "Compression", ".", "decompressToStream", "(", "chunkOfPoints", ")", ";", "return", "ProtoBufTimeSeriesSerializer", ".", "from", "(", "newDecompressedBytes", ",", "timeSeriesStart", ",", "timeSeriesEnd", ",", "from", ",", "to", ")", ";", "}", "}" ]
return the uncompressed points (compressed byte array) The quality value in compressedByte is supposed to be -1 if there no quality.
[ "return", "the", "uncompressed", "points", "(", "compressed", "byte", "array", ")", "The", "quality", "value", "in", "compressedByte", "is", "supposed", "to", "be", "-", "1", "if", "there", "no", "quality", "." ]
[]
[ { "param": "decompressedBytes", "type": "InputStream" }, { "param": "timeSeriesStart", "type": "long" }, { "param": "timeSeriesEnd", "type": "long" }, { "param": "from", "type": "long" }, { "param": "to", "type": "long" }, { "param": "chunkOfPoints", "type": "byte[]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "decompressedBytes", "type": "InputStream", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "timeSeriesStart", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "timeSeriesEnd", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "from", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "to", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "chunkOfPoints", "type": "byte[]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 760, 19461, 32, 7197, 34, 628, 12, 6385, 5037, 443, 15385, 2160, 16, 1525, 813, 6485, 1685, 16, 1525, 813, 6485, 1638, 203, 5411, 269, 1525, 628, 16, 1525, 358, 16, 1160, 8526, 2441, 951, 5636, 13, 1216, 1860, 16, 2754, 288, 203, 3639, 775, 288, 203, 5411, 327, 7440, 5503, 28486, 1190, 14846, 6306, 18, 2080, 12, 323, 15385, 2160, 16, 813, 6485, 1685, 16, 813, 6485, 1638, 16, 628, 16, 358, 1769, 203, 3639, 289, 1044, 261, 31237, 431, 13, 288, 203, 5411, 4145, 18, 5129, 2932, 15195, 486, 12704, 1028, 1450, 13901, 598, 9312, 903, 775, 598, 1592, 4886, 8863, 203, 5411, 1748, 323, 15385, 2160, 18, 6208, 5621, 5549, 203, 5411, 5037, 394, 17731, 10906, 2160, 273, 21139, 18, 323, 14706, 774, 1228, 12, 6551, 951, 5636, 1769, 203, 5411, 327, 7440, 5503, 28486, 6306, 18, 2080, 12, 2704, 17731, 10906, 2160, 16, 813, 6485, 1685, 16, 813, 6485, 1638, 16, 628, 16, 358, 1769, 203, 3639, 289, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 327, 326, 20560, 3143, 261, 15385, 1160, 526, 13, 203, 377, 380, 1021, 9312, 460, 316, 8968, 3216, 353, 18405, 358, 506, 300, 21, 309, 1915, 1158, 9312, 18, 1220, 203, 377, 380, 353, 4183, 2724, 732, 4489, 9312, 358, 506, 279, 1431, 3086, 374, 471, 404, 309, 518, 353, 3430, 18, 203, 377, 380, 203, 377, 380, 632, 891, 443, 15385, 2160, 326, 8968, 1731, 19918, 326, 501, 3143, 203, 377, 380, 632, 891, 813, 6485, 1685, 282, 326, 787, 434, 326, 813, 4166, 203, 377, 380, 632, 891, 813, 6485, 1638, 377, 326, 679, 434, 326, 813, 4166, 203, 377, 380, 632, 891, 628, 2868, 6508, 3143, 628, 203, 377, 380, 632, 891, 358, 7734, 6508, 3143, 358, 203, 377, 2 ]
2edd96c609ae9317785194b6806ff9f1e5cb67da
Hurence/historian
historian-scraper/src/main/java/com/hurence/historian/scraper/PrometheusScraper.java
[ "Apache-2.0" ]
Java
scrape
null
public List<MetricFamily> scrape() throws IOException { CollectorPrometheusMetricsWalker collector = new CollectorPrometheusMetricsWalker(); scrape(collector); return collector.getAllMetricFamilies(); }
/** * This will collect all metric data from the endpoint and * return the entire list of all metric families found there. * @return all metric data found at the endpoint * @throws IOException if failed to scrape data */
This will collect all metric data from the endpoint and return the entire list of all metric families found there. @return all metric data found at the endpoint @throws IOException if failed to scrape data
[ "This", "will", "collect", "all", "metric", "data", "from", "the", "endpoint", "and", "return", "the", "entire", "list", "of", "all", "metric", "families", "found", "there", ".", "@return", "all", "metric", "data", "found", "at", "the", "endpoint", "@throws", "IOException", "if", "failed", "to", "scrape", "data" ]
public List<MetricFamily> scrape() throws IOException { CollectorPrometheusMetricsWalker collector = new CollectorPrometheusMetricsWalker(); scrape(collector); return collector.getAllMetricFamilies(); }
[ "public", "List", "<", "MetricFamily", ">", "scrape", "(", ")", "throws", "IOException", "{", "CollectorPrometheusMetricsWalker", "collector", "=", "new", "CollectorPrometheusMetricsWalker", "(", ")", ";", "scrape", "(", "collector", ")", ";", "return", "collector", ".", "getAllMetricFamilies", "(", ")", ";", "}" ]
This will collect all metric data from the endpoint and return the entire list of all metric families found there.
[ "This", "will", "collect", "all", "metric", "data", "from", "the", "endpoint", "and", "return", "the", "entire", "list", "of", "all", "metric", "families", "found", "there", "." ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 987, 32, 5396, 9203, 34, 888, 25360, 1435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, 203, 377, 380, 1220, 903, 3274, 777, 3999, 501, 628, 326, 2494, 471, 203, 377, 380, 327, 326, 7278, 666, 434, 777, 3999, 25914, 1392, 1915, 18, 203, 377, 380, 632, 2463, 777, 3999, 501, 1392, 622, 326, 2494, 203, 377, 380, 632, 15069, 1860, 309, 2535, 358, 888, 25360, 501, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
2edd96c609ae9317785194b6806ff9f1e5cb67da
Hurence/historian
historian-scraper/src/main/java/com/hurence/historian/scraper/PrometheusScraper.java
[ "Apache-2.0" ]
Java
openConnection
OpenConnectionDetails
protected OpenConnectionDetails openConnection(URL endpointUrl) throws IOException { URLConnection conn = endpointUrl.openConnection(); conn.setRequestProperty("Accept", getBinaryFormatContentType()); InputStream stream = conn.getInputStream(); String contentType = conn.getContentType(); return new OpenConnectionDetails(stream, contentType); }
/** * This provides a hook for subclasses to be able to connect to the Prometheus endpoint * and tell us what the content type is and to give us the actual stream to the data. * * This is useful in case callers need to connect securely to the Prometheus endpoint. * Subclasses need to open the secure connection with their specific secure credentials * and other security details and return the input stream to the data (as well as its content type). * * If subclasses return a null content type in the returned object the data format passed to this * object's constructor will be assumed as the data format in the input stream. * * The default implementation is to simply open an unsecured connection to the URL. * * @param url the Prometheus endpoint * @return connection details for the Prometheus endpoint * * @throws IOException if the connection could not be opened */
This provides a hook for subclasses to be able to connect to the Prometheus endpoint and tell us what the content type is and to give us the actual stream to the data. This is useful in case callers need to connect securely to the Prometheus endpoint. Subclasses need to open the secure connection with their specific secure credentials and other security details and return the input stream to the data (as well as its content type). If subclasses return a null content type in the returned object the data format passed to this object's constructor will be assumed as the data format in the input stream. The default implementation is to simply open an unsecured connection to the URL. @param url the Prometheus endpoint @return connection details for the Prometheus endpoint @throws IOException if the connection could not be opened
[ "This", "provides", "a", "hook", "for", "subclasses", "to", "be", "able", "to", "connect", "to", "the", "Prometheus", "endpoint", "and", "tell", "us", "what", "the", "content", "type", "is", "and", "to", "give", "us", "the", "actual", "stream", "to", "the", "data", ".", "This", "is", "useful", "in", "case", "callers", "need", "to", "connect", "securely", "to", "the", "Prometheus", "endpoint", ".", "Subclasses", "need", "to", "open", "the", "secure", "connection", "with", "their", "specific", "secure", "credentials", "and", "other", "security", "details", "and", "return", "the", "input", "stream", "to", "the", "data", "(", "as", "well", "as", "its", "content", "type", ")", ".", "If", "subclasses", "return", "a", "null", "content", "type", "in", "the", "returned", "object", "the", "data", "format", "passed", "to", "this", "object", "'", "s", "constructor", "will", "be", "assumed", "as", "the", "data", "format", "in", "the", "input", "stream", ".", "The", "default", "implementation", "is", "to", "simply", "open", "an", "unsecured", "connection", "to", "the", "URL", ".", "@param", "url", "the", "Prometheus", "endpoint", "@return", "connection", "details", "for", "the", "Prometheus", "endpoint", "@throws", "IOException", "if", "the", "connection", "could", "not", "be", "opened" ]
protected OpenConnectionDetails openConnection(URL endpointUrl) throws IOException { URLConnection conn = endpointUrl.openConnection(); conn.setRequestProperty("Accept", getBinaryFormatContentType()); InputStream stream = conn.getInputStream(); String contentType = conn.getContentType(); return new OpenConnectionDetails(stream, contentType); }
[ "protected", "OpenConnectionDetails", "openConnection", "(", "URL", "endpointUrl", ")", "throws", "IOException", "{", "URLConnection", "conn", "=", "endpointUrl", ".", "openConnection", "(", ")", ";", "conn", ".", "setRequestProperty", "(", "\"Accept\"", ",", "getBinaryFormatContentType", "(", ")", ")", ";", "InputStream", "stream", "=", "conn", ".", "getInputStream", "(", ")", ";", "String", "contentType", "=", "conn", ".", "getContentType", "(", ")", ";", "return", "new", "OpenConnectionDetails", "(", "stream", ",", "contentType", ")", ";", "}" ]
This provides a hook for subclasses to be able to connect to the Prometheus endpoint and tell us what the content type is and to give us the actual stream to the data.
[ "This", "provides", "a", "hook", "for", "subclasses", "to", "be", "able", "to", "connect", "to", "the", "Prometheus", "endpoint", "and", "tell", "us", "what", "the", "content", "type", "is", "and", "to", "give", "us", "the", "actual", "stream", "to", "the", "data", "." ]
[]
[ { "param": "endpointUrl", "type": "URL" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "endpointUrl", "type": "URL", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 4750, 3502, 1952, 3790, 24982, 12, 1785, 2494, 1489, 13, 1216, 1860, 288, 203, 3639, 1976, 1952, 1487, 273, 2494, 1489, 18, 3190, 1952, 5621, 203, 3639, 1487, 18, 542, 691, 1396, 2932, 5933, 3113, 27149, 1630, 8046, 10663, 203, 3639, 5037, 1407, 273, 1487, 18, 588, 4348, 5621, 203, 3639, 514, 5064, 273, 1487, 18, 588, 8046, 5621, 203, 3639, 327, 394, 3502, 1952, 3790, 12, 3256, 16, 5064, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 1220, 8121, 279, 3953, 364, 15320, 358, 506, 7752, 358, 3077, 358, 326, 17552, 10537, 2494, 203, 377, 380, 471, 9276, 584, 4121, 326, 913, 618, 353, 471, 358, 8492, 584, 326, 3214, 1407, 358, 326, 501, 18, 203, 377, 380, 203, 377, 380, 1220, 353, 5301, 316, 648, 19932, 1608, 358, 3077, 8177, 715, 358, 326, 17552, 10537, 2494, 18, 203, 377, 380, 2592, 4701, 1608, 358, 1696, 326, 8177, 1459, 598, 3675, 2923, 8177, 4448, 203, 377, 380, 471, 1308, 4373, 3189, 471, 327, 326, 810, 1407, 358, 326, 501, 261, 345, 5492, 487, 2097, 913, 618, 2934, 203, 377, 380, 203, 377, 380, 971, 15320, 327, 279, 446, 913, 618, 316, 326, 2106, 733, 326, 501, 740, 2275, 358, 2 ]
45567e54751340eeadd3f0074b875486fc9a669d
Hurence/historian
logisland-timeseries/src/main/java/com/hurence/logisland/record/TimeSeriesRecord.java
[ "Apache-2.0" ]
Java
computeAndSetMetrics
null
public void computeAndSetMetrics(String[] metric) { // init metric functions TypeFunctions functions = QueryEvaluator.extractFunctions(metric); final List<ChronixTransformation> transformations = functions.getTypeFunctions(new MetricType()).getTransformations(); final List<ChronixAggregation> aggregations = functions.getTypeFunctions(new MetricType()).getAggregations(); final List<ChronixAnalysis> analyses = functions.getTypeFunctions(new MetricType()).getAnalyses(); final List<ChronixEncoding> encodings = functions.getTypeFunctions(new MetricType()).getEncodings(); FunctionValueMap functionValueMap = new FunctionValueMap(aggregations.size(), analyses.size(), transformations.size(), encodings.size()); MetricTimeSeries timeSeries = this.getTimeSeries(); functionValueMap.resetValues(); transformations.forEach(transfo -> transfo.execute(timeSeries, functionValueMap)); analyses.forEach(analyse -> analyse.execute(timeSeries, functionValueMap)); aggregations.forEach(aggregation -> aggregation.execute(timeSeries, functionValueMap)); encodings.forEach(encoding -> encoding.execute(timeSeries, functionValueMap)); for (int i = 0; i < functionValueMap.sizeOfAggregations(); i++) { String name = functionValueMap.getAggregation(i).getQueryName(); double value = functionValueMap.getAggregationValue(i); this.setField("chunk_" + name, FieldType.DOUBLE, value); } for (int i = 0; i < functionValueMap.sizeOfAnalyses(); i++) { String name = functionValueMap.getAnalysis(i).getQueryName(); boolean value = functionValueMap.getAnalysisValue(i); this.setField("chunk_" + name, FieldType.BOOLEAN, value); } for (int i = 0; i < functionValueMap.sizeOfEncodings(); i++) { String name = functionValueMap.getEncoding(i).getQueryName(); String value = functionValueMap.getEncodingValue(i); this.setField("chunk_" + name, FieldType.STRING, value); } }
/** * Converts a list of records to a timeseries chunk * * @return */
Converts a list of records to a timeseries chunk @return
[ "Converts", "a", "list", "of", "records", "to", "a", "timeseries", "chunk", "@return" ]
public void computeAndSetMetrics(String[] metric) { TypeFunctions functions = QueryEvaluator.extractFunctions(metric); final List<ChronixTransformation> transformations = functions.getTypeFunctions(new MetricType()).getTransformations(); final List<ChronixAggregation> aggregations = functions.getTypeFunctions(new MetricType()).getAggregations(); final List<ChronixAnalysis> analyses = functions.getTypeFunctions(new MetricType()).getAnalyses(); final List<ChronixEncoding> encodings = functions.getTypeFunctions(new MetricType()).getEncodings(); FunctionValueMap functionValueMap = new FunctionValueMap(aggregations.size(), analyses.size(), transformations.size(), encodings.size()); MetricTimeSeries timeSeries = this.getTimeSeries(); functionValueMap.resetValues(); transformations.forEach(transfo -> transfo.execute(timeSeries, functionValueMap)); analyses.forEach(analyse -> analyse.execute(timeSeries, functionValueMap)); aggregations.forEach(aggregation -> aggregation.execute(timeSeries, functionValueMap)); encodings.forEach(encoding -> encoding.execute(timeSeries, functionValueMap)); for (int i = 0; i < functionValueMap.sizeOfAggregations(); i++) { String name = functionValueMap.getAggregation(i).getQueryName(); double value = functionValueMap.getAggregationValue(i); this.setField("chunk_" + name, FieldType.DOUBLE, value); } for (int i = 0; i < functionValueMap.sizeOfAnalyses(); i++) { String name = functionValueMap.getAnalysis(i).getQueryName(); boolean value = functionValueMap.getAnalysisValue(i); this.setField("chunk_" + name, FieldType.BOOLEAN, value); } for (int i = 0; i < functionValueMap.sizeOfEncodings(); i++) { String name = functionValueMap.getEncoding(i).getQueryName(); String value = functionValueMap.getEncodingValue(i); this.setField("chunk_" + name, FieldType.STRING, value); } }
[ "public", "void", "computeAndSetMetrics", "(", "String", "[", "]", "metric", ")", "{", "TypeFunctions", "functions", "=", "QueryEvaluator", ".", "extractFunctions", "(", "metric", ")", ";", "final", "List", "<", "ChronixTransformation", ">", "transformations", "=", "functions", ".", "getTypeFunctions", "(", "new", "MetricType", "(", ")", ")", ".", "getTransformations", "(", ")", ";", "final", "List", "<", "ChronixAggregation", ">", "aggregations", "=", "functions", ".", "getTypeFunctions", "(", "new", "MetricType", "(", ")", ")", ".", "getAggregations", "(", ")", ";", "final", "List", "<", "ChronixAnalysis", ">", "analyses", "=", "functions", ".", "getTypeFunctions", "(", "new", "MetricType", "(", ")", ")", ".", "getAnalyses", "(", ")", ";", "final", "List", "<", "ChronixEncoding", ">", "encodings", "=", "functions", ".", "getTypeFunctions", "(", "new", "MetricType", "(", ")", ")", ".", "getEncodings", "(", ")", ";", "FunctionValueMap", "functionValueMap", "=", "new", "FunctionValueMap", "(", "aggregations", ".", "size", "(", ")", ",", "analyses", ".", "size", "(", ")", ",", "transformations", ".", "size", "(", ")", ",", "encodings", ".", "size", "(", ")", ")", ";", "MetricTimeSeries", "timeSeries", "=", "this", ".", "getTimeSeries", "(", ")", ";", "functionValueMap", ".", "resetValues", "(", ")", ";", "transformations", ".", "forEach", "(", "transfo", "->", "transfo", ".", "execute", "(", "timeSeries", ",", "functionValueMap", ")", ")", ";", "analyses", ".", "forEach", "(", "analyse", "->", "analyse", ".", "execute", "(", "timeSeries", ",", "functionValueMap", ")", ")", ";", "aggregations", ".", "forEach", "(", "aggregation", "->", "aggregation", ".", "execute", "(", "timeSeries", ",", "functionValueMap", ")", ")", ";", "encodings", ".", "forEach", "(", "encoding", "->", "encoding", ".", "execute", "(", "timeSeries", ",", "functionValueMap", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "functionValueMap", ".", "sizeOfAggregations", "(", ")", ";", "i", "++", ")", "{", "String", "name", "=", "functionValueMap", ".", "getAggregation", "(", "i", ")", ".", "getQueryName", "(", ")", ";", "double", "value", "=", "functionValueMap", ".", "getAggregationValue", "(", "i", ")", ";", "this", ".", "setField", "(", "\"chunk_\"", "+", "name", ",", "FieldType", ".", "DOUBLE", ",", "value", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "functionValueMap", ".", "sizeOfAnalyses", "(", ")", ";", "i", "++", ")", "{", "String", "name", "=", "functionValueMap", ".", "getAnalysis", "(", "i", ")", ".", "getQueryName", "(", ")", ";", "boolean", "value", "=", "functionValueMap", ".", "getAnalysisValue", "(", "i", ")", ";", "this", ".", "setField", "(", "\"chunk_\"", "+", "name", ",", "FieldType", ".", "BOOLEAN", ",", "value", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "functionValueMap", ".", "sizeOfEncodings", "(", ")", ";", "i", "++", ")", "{", "String", "name", "=", "functionValueMap", ".", "getEncoding", "(", "i", ")", ".", "getQueryName", "(", ")", ";", "String", "value", "=", "functionValueMap", ".", "getEncodingValue", "(", "i", ")", ";", "this", ".", "setField", "(", "\"chunk_\"", "+", "name", ",", "FieldType", ".", "STRING", ",", "value", ")", ";", "}", "}" ]
Converts a list of records to a timeseries chunk @return
[ "Converts", "a", "list", "of", "records", "to", "a", "timeseries", "chunk", "@return" ]
[ "// init metric functions" ]
[ { "param": "metric", "type": "String[]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "metric", "type": "String[]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 918, 3671, 13152, 5653, 12, 780, 8526, 3999, 13, 288, 203, 3639, 368, 1208, 3999, 4186, 203, 3639, 1412, 7503, 4186, 273, 2770, 15876, 18, 8004, 7503, 12, 6899, 1769, 203, 3639, 727, 987, 32, 20235, 697, 15292, 34, 19245, 273, 4186, 18, 588, 559, 7503, 12, 2704, 7279, 559, 1435, 2934, 588, 4059, 1012, 5621, 203, 3639, 727, 987, 32, 20235, 697, 12089, 34, 25809, 273, 4186, 18, 588, 559, 7503, 12, 2704, 7279, 559, 1435, 2934, 588, 6078, 1012, 5621, 203, 3639, 727, 987, 32, 20235, 697, 9418, 34, 22813, 273, 4186, 18, 588, 559, 7503, 12, 2704, 7279, 559, 1435, 2934, 588, 979, 23723, 5621, 203, 3639, 727, 987, 32, 20235, 697, 4705, 34, 24118, 273, 4186, 18, 588, 559, 7503, 12, 2704, 7279, 559, 1435, 2934, 588, 25100, 899, 5621, 203, 3639, 4284, 26795, 445, 26795, 273, 394, 4284, 26795, 12, 10751, 1012, 18, 1467, 9334, 22813, 18, 1467, 9334, 19245, 18, 1467, 9334, 24118, 18, 1467, 10663, 203, 203, 3639, 7279, 28486, 813, 6485, 273, 333, 18, 588, 28486, 5621, 203, 3639, 445, 26795, 18, 6208, 1972, 5621, 203, 203, 3639, 19245, 18, 1884, 3442, 12, 2338, 617, 317, 906, 617, 18, 8837, 12, 957, 6485, 16, 445, 26795, 10019, 203, 3639, 22813, 18, 1884, 3442, 12, 304, 3450, 307, 317, 31087, 18, 8837, 12, 957, 6485, 16, 445, 26795, 10019, 203, 3639, 25809, 18, 1884, 3442, 12, 22082, 317, 10163, 18, 8837, 12, 957, 6485, 16, 445, 26795, 10019, 203, 3639, 24118, 18, 1884, 3442, 12, 5999, 317, 2688, 18, 8837, 12, 957, 6485, 16, 445, 26795, 10019, 203, 203, 3639, 364, 261, 474, 277, 273, 374, 31, 277, 411, 445, 26795, 18, 1467, 951, 6078, 1012, 5621, 277, 27245, 288, 203, 5411, 514, 508, 273, 445, 26795, 18, 588, 12089, 12, 77, 2934, 588, 1138, 461, 5621, 203, 5411, 1645, 460, 273, 445, 26795, 18, 588, 12089, 620, 12, 77, 1769, 203, 5411, 333, 18, 542, 974, 2932, 6551, 9548, 397, 508, 16, 16602, 18, 17088, 16, 460, 1769, 203, 3639, 289, 203, 203, 3639, 364, 261, 474, 277, 273, 374, 31, 277, 411, 445, 26795, 18, 1467, 951, 979, 23723, 5621, 277, 27245, 288, 203, 5411, 514, 508, 273, 445, 26795, 18, 588, 9418, 12, 77, 2934, 588, 1138, 461, 5621, 203, 5411, 1250, 460, 273, 445, 26795, 18, 588, 9418, 620, 12, 77, 1769, 203, 5411, 333, 18, 542, 974, 2932, 6551, 9548, 397, 508, 16, 16602, 18, 17900, 16, 460, 1769, 203, 3639, 289, 203, 203, 3639, 364, 261, 474, 277, 273, 374, 31, 277, 411, 445, 26795, 18, 1467, 951, 25100, 899, 5621, 277, 27245, 288, 203, 5411, 514, 508, 273, 445, 26795, 18, 588, 4705, 12, 77, 2934, 588, 1138, 461, 5621, 203, 5411, 514, 460, 273, 445, 26795, 18, 588, 4705, 620, 12, 77, 1769, 203, 5411, 333, 18, 542, 974, 2932, 6551, 9548, 397, 508, 16, 16602, 18, 5804, 16, 460, 1769, 203, 3639, 289, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 20377, 279, 666, 434, 3853, 358, 279, 18677, 2441, 203, 377, 380, 203, 377, 380, 632, 2463, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
f0a05564663b1b1f3ba51496df3b51cdaaaa604b
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/compaction/protobuf/PointsUnCompressorWithQuality.java
[ "Apache-2.0" ]
Java
from
null
public TreeSet<Measure> from(final InputStream decompressedBytes, long timeSeriesStart, long timeSeriesEnd, long from, long to) throws IOException, IllegalArgumentException { LOGGER.debug("from - timeSeriesStart={} timeSeriesEnd={} to={} from={}", timeSeriesStart, timeSeriesEnd, to, from); if (from == -1 || to == -1) { throw new IllegalArgumentException("FROM or TO have to be >= 0"); } //if to is left of the time series, we have no Points to return if (to < timeSeriesStart) { LOGGER.debug("error to={} is lower than timeSeriesStart={}", to, timeSeriesStart); return new TreeSet<>(); } //if from is greater to, we have nothing to return if (from > to) { LOGGER.debug("error from={} is greater than to={}", from, to); return new TreeSet<>(); } //if from is right of the time series we have nothing to return if (from > timeSeriesEnd) { LOGGER.debug("error from={} is greater than timeSeriesEnd={}", from, timeSeriesEnd); return new TreeSet<>(); } try { ChunkProtocolBuffers.Chunk protocolBufferPoints = ChunkProtocolBuffers.Chunk.parseFrom(decompressedBytes); List<ChunkProtocolBuffers.Point> pList = protocolBufferPoints.getPList(); List<ChunkProtocolBuffers.Quality> qList = protocolBufferPoints.getQList(); ListIterator<ChunkProtocolBuffers.Quality> qListIterator = qList.listIterator(); if (!qListIterator.hasNext()) { //Then this means this is an old version without quality throw new IllegalArgumentException("qList should not be empty. Bad or icompatible compressedBytes !"); } TreeSet<Measure> measures = new TreeSet<>(); int size = pList.size(); currentQuality = getQuality(qList, qListIterator.next()); Optional<Integer> indexForNextQuality = findIndexForNextQuality(qListIterator); calculatedPointDate = timeSeriesStart; setLastOffsetAccordingToDdcThreshold(protocolBufferPoints); for (int i = 0; i < size; i++) { ChunkProtocolBuffers.Point p = pList.get(i); //Decode the time for Point that is not the first if (i > 0) { lastOffSet = getOffset(p).orElse(lastOffSet); calculatedPointDate += lastOffSet; } if (indexForNextQuality.isPresent() && indexForNextQuality.get() == i) { currentQuality = getQuality(qList, qListIterator.next()); indexForNextQuality = findIndexForNextQuality(qListIterator); } //only add the Point if it is within the date if (calculatedPointDate >= from) { //Check if the Point refers to an index if (calculatedPointDate > to) { LOGGER.debug("remaining {} Points are skipped after t={}", size - i, calculatedPointDate); return measures; } double value = getValue(pList, p); if (currentQuality == -1f) { measures.add(Measure.fromValue(calculatedPointDate, value)); } else { measures.add(Measure.fromValueAndQuality(calculatedPointDate, value, currentQuality)); } } else { LOGGER.debug("not adding Point at t={}", calculatedPointDate); } } return measures; } catch (IOException e) { LOGGER.info("Could not decode protocol buffers Points"); throw e; } }
/** * return the uncompressed Points (compressed byte array) * The quality value in compressedByte is supposed to be -1 if there no quality. This * is safe because we expect quality to be a float between 0 and 1 if it is present. * * @param decompressedBytes the compressed bytes holding the data Points * @param timeSeriesStart the start of the time series * @param timeSeriesEnd the end of the time series * @param from including Points from * @param to including Points to */
return the uncompressed Points (compressed byte array) The quality value in compressedByte is supposed to be -1 if there no quality. This is safe because we expect quality to be a float between 0 and 1 if it is present.
[ "return", "the", "uncompressed", "Points", "(", "compressed", "byte", "array", ")", "The", "quality", "value", "in", "compressedByte", "is", "supposed", "to", "be", "-", "1", "if", "there", "no", "quality", ".", "This", "is", "safe", "because", "we", "expect", "quality", "to", "be", "a", "float", "between", "0", "and", "1", "if", "it", "is", "present", "." ]
public TreeSet<Measure> from(final InputStream decompressedBytes, long timeSeriesStart, long timeSeriesEnd, long from, long to) throws IOException, IllegalArgumentException { LOGGER.debug("from - timeSeriesStart={} timeSeriesEnd={} to={} from={}", timeSeriesStart, timeSeriesEnd, to, from); if (from == -1 || to == -1) { throw new IllegalArgumentException("FROM or TO have to be >= 0"); } if (to < timeSeriesStart) { LOGGER.debug("error to={} is lower than timeSeriesStart={}", to, timeSeriesStart); return new TreeSet<>(); } if (from > to) { LOGGER.debug("error from={} is greater than to={}", from, to); return new TreeSet<>(); } if (from > timeSeriesEnd) { LOGGER.debug("error from={} is greater than timeSeriesEnd={}", from, timeSeriesEnd); return new TreeSet<>(); } try { ChunkProtocolBuffers.Chunk protocolBufferPoints = ChunkProtocolBuffers.Chunk.parseFrom(decompressedBytes); List<ChunkProtocolBuffers.Point> pList = protocolBufferPoints.getPList(); List<ChunkProtocolBuffers.Quality> qList = protocolBufferPoints.getQList(); ListIterator<ChunkProtocolBuffers.Quality> qListIterator = qList.listIterator(); if (!qListIterator.hasNext()) { throw new IllegalArgumentException("qList should not be empty. Bad or icompatible compressedBytes !"); } TreeSet<Measure> measures = new TreeSet<>(); int size = pList.size(); currentQuality = getQuality(qList, qListIterator.next()); Optional<Integer> indexForNextQuality = findIndexForNextQuality(qListIterator); calculatedPointDate = timeSeriesStart; setLastOffsetAccordingToDdcThreshold(protocolBufferPoints); for (int i = 0; i < size; i++) { ChunkProtocolBuffers.Point p = pList.get(i); if (i > 0) { lastOffSet = getOffset(p).orElse(lastOffSet); calculatedPointDate += lastOffSet; } if (indexForNextQuality.isPresent() && indexForNextQuality.get() == i) { currentQuality = getQuality(qList, qListIterator.next()); indexForNextQuality = findIndexForNextQuality(qListIterator); } if (calculatedPointDate >= from) { if (calculatedPointDate > to) { LOGGER.debug("remaining {} Points are skipped after t={}", size - i, calculatedPointDate); return measures; } double value = getValue(pList, p); if (currentQuality == -1f) { measures.add(Measure.fromValue(calculatedPointDate, value)); } else { measures.add(Measure.fromValueAndQuality(calculatedPointDate, value, currentQuality)); } } else { LOGGER.debug("not adding Point at t={}", calculatedPointDate); } } return measures; } catch (IOException e) { LOGGER.info("Could not decode protocol buffers Points"); throw e; } }
[ "public", "TreeSet", "<", "Measure", ">", "from", "(", "final", "InputStream", "decompressedBytes", ",", "long", "timeSeriesStart", ",", "long", "timeSeriesEnd", ",", "long", "from", ",", "long", "to", ")", "throws", "IOException", ",", "IllegalArgumentException", "{", "LOGGER", ".", "debug", "(", "\"from - timeSeriesStart={} timeSeriesEnd={} to={} from={}\"", ",", "timeSeriesStart", ",", "timeSeriesEnd", ",", "to", ",", "from", ")", ";", "if", "(", "from", "==", "-", "1", "||", "to", "==", "-", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"FROM or TO have to be >= 0\"", ")", ";", "}", "if", "(", "to", "<", "timeSeriesStart", ")", "{", "LOGGER", ".", "debug", "(", "\"error to={} is lower than timeSeriesStart={}\"", ",", "to", ",", "timeSeriesStart", ")", ";", "return", "new", "TreeSet", "<", ">", "(", ")", ";", "}", "if", "(", "from", ">", "to", ")", "{", "LOGGER", ".", "debug", "(", "\"error from={} is greater than to={}\"", ",", "from", ",", "to", ")", ";", "return", "new", "TreeSet", "<", ">", "(", ")", ";", "}", "if", "(", "from", ">", "timeSeriesEnd", ")", "{", "LOGGER", ".", "debug", "(", "\"error from={} is greater than timeSeriesEnd={}\"", ",", "from", ",", "timeSeriesEnd", ")", ";", "return", "new", "TreeSet", "<", ">", "(", ")", ";", "}", "try", "{", "ChunkProtocolBuffers", ".", "Chunk", "protocolBufferPoints", "=", "ChunkProtocolBuffers", ".", "Chunk", ".", "parseFrom", "(", "decompressedBytes", ")", ";", "List", "<", "ChunkProtocolBuffers", ".", "Point", ">", "pList", "=", "protocolBufferPoints", ".", "getPList", "(", ")", ";", "List", "<", "ChunkProtocolBuffers", ".", "Quality", ">", "qList", "=", "protocolBufferPoints", ".", "getQList", "(", ")", ";", "ListIterator", "<", "ChunkProtocolBuffers", ".", "Quality", ">", "qListIterator", "=", "qList", ".", "listIterator", "(", ")", ";", "if", "(", "!", "qListIterator", ".", "hasNext", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"qList should not be empty. Bad or icompatible compressedBytes !\"", ")", ";", "}", "TreeSet", "<", "Measure", ">", "measures", "=", "new", "TreeSet", "<", ">", "(", ")", ";", "int", "size", "=", "pList", ".", "size", "(", ")", ";", "currentQuality", "=", "getQuality", "(", "qList", ",", "qListIterator", ".", "next", "(", ")", ")", ";", "Optional", "<", "Integer", ">", "indexForNextQuality", "=", "findIndexForNextQuality", "(", "qListIterator", ")", ";", "calculatedPointDate", "=", "timeSeriesStart", ";", "setLastOffsetAccordingToDdcThreshold", "(", "protocolBufferPoints", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "ChunkProtocolBuffers", ".", "Point", "p", "=", "pList", ".", "get", "(", "i", ")", ";", "if", "(", "i", ">", "0", ")", "{", "lastOffSet", "=", "getOffset", "(", "p", ")", ".", "orElse", "(", "lastOffSet", ")", ";", "calculatedPointDate", "+=", "lastOffSet", ";", "}", "if", "(", "indexForNextQuality", ".", "isPresent", "(", ")", "&&", "indexForNextQuality", ".", "get", "(", ")", "==", "i", ")", "{", "currentQuality", "=", "getQuality", "(", "qList", ",", "qListIterator", ".", "next", "(", ")", ")", ";", "indexForNextQuality", "=", "findIndexForNextQuality", "(", "qListIterator", ")", ";", "}", "if", "(", "calculatedPointDate", ">=", "from", ")", "{", "if", "(", "calculatedPointDate", ">", "to", ")", "{", "LOGGER", ".", "debug", "(", "\"remaining {} Points are skipped after t={}\"", ",", "size", "-", "i", ",", "calculatedPointDate", ")", ";", "return", "measures", ";", "}", "double", "value", "=", "getValue", "(", "pList", ",", "p", ")", ";", "if", "(", "currentQuality", "==", "-", "1f", ")", "{", "measures", ".", "add", "(", "Measure", ".", "fromValue", "(", "calculatedPointDate", ",", "value", ")", ")", ";", "}", "else", "{", "measures", ".", "add", "(", "Measure", ".", "fromValueAndQuality", "(", "calculatedPointDate", ",", "value", ",", "currentQuality", ")", ")", ";", "}", "}", "else", "{", "LOGGER", ".", "debug", "(", "\"not adding Point at t={}\"", ",", "calculatedPointDate", ")", ";", "}", "}", "return", "measures", ";", "}", "catch", "(", "IOException", "e", ")", "{", "LOGGER", ".", "info", "(", "\"Could not decode protocol buffers Points\"", ")", ";", "throw", "e", ";", "}", "}" ]
return the uncompressed Points (compressed byte array) The quality value in compressedByte is supposed to be -1 if there no quality.
[ "return", "the", "uncompressed", "Points", "(", "compressed", "byte", "array", ")", "The", "quality", "value", "in", "compressedByte", "is", "supposed", "to", "be", "-", "1", "if", "there", "no", "quality", "." ]
[ "//if to is left of the time series, we have no Points to return", "//if from is greater to, we have nothing to return", "//if from is right of the time series we have nothing to return", "//Then this means this is an old version without quality", "//Decode the time for Point that is not the first", "//only add the Point if it is within the date", "//Check if the Point refers to an index" ]
[ { "param": "decompressedBytes", "type": "InputStream" }, { "param": "timeSeriesStart", "type": "long" }, { "param": "timeSeriesEnd", "type": "long" }, { "param": "from", "type": "long" }, { "param": "to", "type": "long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "decompressedBytes", "type": "InputStream", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "timeSeriesStart", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "timeSeriesEnd", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "from", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "to", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 19461, 32, 7197, 34, 628, 12, 6385, 5037, 443, 15385, 2160, 16, 1525, 813, 6485, 1685, 16, 1525, 813, 6485, 1638, 16, 1525, 628, 16, 1525, 358, 13, 1216, 1860, 16, 2754, 288, 203, 3639, 4145, 18, 4148, 2932, 2080, 300, 813, 6485, 1685, 12938, 813, 6485, 1638, 12938, 358, 12938, 628, 18046, 16, 813, 6485, 1685, 16, 813, 6485, 1638, 16, 358, 16, 628, 1769, 203, 3639, 309, 261, 2080, 422, 300, 21, 747, 358, 422, 300, 21, 13, 288, 203, 5411, 604, 394, 2754, 2932, 11249, 578, 8493, 1240, 358, 506, 1545, 374, 8863, 203, 3639, 289, 203, 203, 3639, 368, 430, 358, 353, 2002, 434, 326, 813, 4166, 16, 732, 1240, 1158, 22464, 358, 327, 203, 3639, 309, 261, 869, 411, 813, 6485, 1685, 13, 288, 203, 5411, 4145, 18, 4148, 2932, 1636, 358, 12938, 353, 2612, 2353, 813, 6485, 1685, 18046, 16, 358, 16, 813, 6485, 1685, 1769, 203, 5411, 327, 394, 19461, 29667, 5621, 203, 3639, 289, 203, 3639, 368, 430, 628, 353, 6802, 225, 358, 16, 732, 1240, 5083, 358, 327, 203, 3639, 309, 261, 2080, 405, 358, 13, 288, 203, 5411, 4145, 18, 4148, 2932, 1636, 628, 12938, 353, 6802, 2353, 358, 18046, 16, 628, 16, 358, 1769, 203, 5411, 327, 394, 19461, 29667, 5621, 203, 3639, 289, 203, 203, 3639, 368, 430, 628, 353, 2145, 434, 326, 813, 4166, 732, 1240, 5083, 358, 327, 203, 3639, 309, 261, 2080, 405, 813, 6485, 1638, 13, 288, 203, 5411, 4145, 18, 4148, 2932, 1636, 628, 12938, 353, 6802, 2353, 813, 6485, 1638, 18046, 16, 628, 16, 813, 6485, 1638, 1769, 203, 5411, 327, 394, 19461, 29667, 5621, 203, 3639, 289, 203, 203, 3639, 775, 288, 203, 5411, 13021, 5752, 13699, 18, 5579, 1771, 1892, 5636, 273, 13021, 5752, 13699, 18, 5579, 18, 2670, 1265, 12, 323, 15385, 2160, 1769, 203, 203, 5411, 987, 32, 5579, 5752, 13699, 18, 2148, 34, 293, 682, 273, 1771, 1892, 5636, 18, 588, 52, 682, 5621, 203, 5411, 987, 32, 5579, 5752, 13699, 18, 14846, 34, 1043, 682, 273, 1771, 1892, 5636, 18, 588, 53, 682, 5621, 203, 5411, 987, 3198, 32, 5579, 5752, 13699, 18, 14846, 34, 1043, 682, 3198, 273, 1043, 682, 18, 1098, 3198, 5621, 203, 5411, 309, 16051, 85, 682, 3198, 18, 5332, 2134, 10756, 288, 203, 7734, 368, 20112, 333, 4696, 333, 353, 392, 1592, 1177, 2887, 9312, 203, 7734, 604, 394, 2754, 2932, 85, 682, 1410, 486, 506, 1008, 18, 6107, 578, 277, 10943, 8968, 2160, 401, 8863, 203, 5411, 289, 203, 5411, 19461, 32, 7197, 34, 22692, 273, 394, 19461, 29667, 5621, 203, 5411, 509, 963, 273, 293, 682, 18, 1467, 5621, 203, 5411, 783, 14846, 273, 336, 14846, 12, 85, 682, 16, 1043, 682, 3198, 18, 4285, 10663, 203, 5411, 4055, 32, 4522, 34, 770, 1290, 2134, 14846, 273, 1104, 1016, 1290, 2134, 14846, 12, 85, 682, 3198, 1769, 203, 5411, 8894, 2148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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
[ 1, 26873, 203, 377, 380, 327, 326, 20560, 22464, 261, 15385, 1160, 526, 13, 203, 377, 380, 1021, 9312, 460, 316, 8968, 3216, 353, 18405, 358, 506, 300, 21, 309, 1915, 1158, 9312, 18, 1220, 203, 377, 380, 353, 4183, 2724, 732, 4489, 9312, 358, 506, 279, 1431, 3086, 374, 471, 404, 309, 518, 353, 3430, 18, 203, 377, 380, 203, 377, 380, 632, 891, 443, 15385, 2160, 326, 8968, 1731, 19918, 326, 501, 22464, 203, 377, 380, 632, 891, 813, 6485, 1685, 282, 326, 787, 434, 326, 813, 4166, 203, 377, 380, 632, 891, 813, 6485, 1638, 377, 326, 679, 434, 326, 813, 4166, 203, 377, 380, 632, 891, 628, 2868, 6508, 22464, 628, 203, 377, 380, 632, 891, 358, 7734, 6508, 22464, 358, 203, 377, 2 ]
adadb8aea571ab50a6917d8a943dd5f63b13c5c6
Hurence/historian
historian-resources/src/main/java/com/hurence/historian/date/util/CalendarUtil.java
[ "Apache-2.0" ]
Java
isValidDate
null
public static boolean isValidDate( int year, int month, int day, int hour, int minute, int second) { try { getValidCalendar(year, month, day, hour, minute, second); return true; } catch (IllegalArgumentException e) { return false; } }
/** * Checks whether the given day, month, year, hour, minute and second combination is a valid * date or not. * @param year The year part of the date. * @param month The month part of the date. * @param day The day part of the date. * @param hour The hour part of the date. * @param minute The minute part of the date. * @param second The second part of the date. * @return True if the given day, month, year, hour, minute and second combination is a valid * date. */
Checks whether the given day, month, year, hour, minute and second combination is a valid date or not. @param year The year part of the date. @param month The month part of the date. @param day The day part of the date. @param hour The hour part of the date. @param minute The minute part of the date. @param second The second part of the date. @return True if the given day, month, year, hour, minute and second combination is a valid date.
[ "Checks", "whether", "the", "given", "day", "month", "year", "hour", "minute", "and", "second", "combination", "is", "a", "valid", "date", "or", "not", ".", "@param", "year", "The", "year", "part", "of", "the", "date", ".", "@param", "month", "The", "month", "part", "of", "the", "date", ".", "@param", "day", "The", "day", "part", "of", "the", "date", ".", "@param", "hour", "The", "hour", "part", "of", "the", "date", ".", "@param", "minute", "The", "minute", "part", "of", "the", "date", ".", "@param", "second", "The", "second", "part", "of", "the", "date", ".", "@return", "True", "if", "the", "given", "day", "month", "year", "hour", "minute", "and", "second", "combination", "is", "a", "valid", "date", "." ]
public static boolean isValidDate( int year, int month, int day, int hour, int minute, int second) { try { getValidCalendar(year, month, day, hour, minute, second); return true; } catch (IllegalArgumentException e) { return false; } }
[ "public", "static", "boolean", "isValidDate", "(", "int", "year", ",", "int", "month", ",", "int", "day", ",", "int", "hour", ",", "int", "minute", ",", "int", "second", ")", "{", "try", "{", "getValidCalendar", "(", "year", ",", "month", ",", "day", ",", "hour", ",", "minute", ",", "second", ")", ";", "return", "true", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "return", "false", ";", "}", "}" ]
Checks whether the given day, month, year, hour, minute and second combination is a valid date or not.
[ "Checks", "whether", "the", "given", "day", "month", "year", "hour", "minute", "and", "second", "combination", "is", "a", "valid", "date", "or", "not", "." ]
[]
[ { "param": "year", "type": "int" }, { "param": "month", "type": "int" }, { "param": "day", "type": "int" }, { "param": "hour", "type": "int" }, { "param": "minute", "type": "int" }, { "param": "second", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "year", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "month", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "day", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "hour", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "minute", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "second", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 760, 1250, 4908, 1626, 12, 203, 5411, 509, 3286, 16, 509, 3138, 16, 509, 2548, 16, 509, 6126, 16, 509, 8044, 16, 509, 2205, 13, 203, 565, 288, 203, 3639, 775, 288, 203, 5411, 22574, 7335, 12, 6874, 16, 3138, 16, 2548, 16, 6126, 16, 8044, 16, 2205, 1769, 203, 5411, 327, 638, 31, 203, 3639, 289, 1044, 261, 31237, 425, 13, 288, 203, 5411, 327, 629, 31, 203, 3639, 289, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 13074, 2856, 326, 864, 2548, 16, 3138, 16, 3286, 16, 6126, 16, 8044, 471, 2205, 10702, 353, 279, 923, 203, 377, 380, 1509, 578, 486, 18, 203, 377, 380, 632, 891, 3286, 1021, 3286, 1087, 434, 326, 1509, 18, 203, 377, 380, 632, 891, 3138, 1021, 3138, 1087, 434, 326, 1509, 18, 203, 377, 380, 632, 891, 2548, 1021, 2548, 1087, 434, 326, 1509, 18, 203, 377, 380, 632, 891, 6126, 1021, 6126, 1087, 434, 326, 1509, 18, 203, 377, 380, 632, 891, 8044, 1021, 8044, 1087, 434, 326, 1509, 18, 203, 377, 380, 632, 891, 2205, 1021, 2205, 1087, 434, 326, 1509, 18, 203, 377, 380, 632, 2463, 1053, 309, 326, 864, 2548, 16, 3138, 16, 3286, 16, 6126, 16, 8044, 2 ]
adadb8aea571ab50a6917d8a943dd5f63b13c5c6
Hurence/historian
historian-resources/src/main/java/com/hurence/historian/date/util/CalendarUtil.java
[ "Apache-2.0" ]
Java
elapsedTime
null
public static int[] elapsedTime(Calendar before, Calendar after) { int[] elapsedTime = new int[6]; Calendar clone = (Calendar) before.clone(); // Otherwise changes are been reflected. elapsedTime[0] = elapsedYears(clone, after); addYears(clone, elapsedTime[0]); elapsedTime[1] = elapsedMonths(clone, after); addMonths(clone, elapsedTime[1]); elapsedTime[2] = elapsedDays(clone, after); addDays(clone, elapsedTime[2]); elapsedTime[3] = elapsedHours(clone, after); addHours(clone, elapsedTime[3]); elapsedTime[4] = elapsedMinutes(clone, after); addMinutes(clone, elapsedTime[4]); elapsedTime[5] = elapsedSeconds(clone, after); return elapsedTime; }
/** * Calculate the total of elapsed time from years up to seconds between the two given calendars. * It returns an int array with the elapsed years, months, days, hours, minutes and seconds * respectively. * @param before The first calendar with expected date before the second calendar. * @param after The second calendar with expected date after the first calendar. * @return The elapsed time between the two given calendars in years, months, days, hours, * minutes and seconds. * @throws IllegalArgumentException If the first calendar is dated after the second calendar. */
Calculate the total of elapsed time from years up to seconds between the two given calendars. It returns an int array with the elapsed years, months, days, hours, minutes and seconds respectively. @param before The first calendar with expected date before the second calendar. @param after The second calendar with expected date after the first calendar. @return The elapsed time between the two given calendars in years, months, days, hours, minutes and seconds. @throws IllegalArgumentException If the first calendar is dated after the second calendar.
[ "Calculate", "the", "total", "of", "elapsed", "time", "from", "years", "up", "to", "seconds", "between", "the", "two", "given", "calendars", ".", "It", "returns", "an", "int", "array", "with", "the", "elapsed", "years", "months", "days", "hours", "minutes", "and", "seconds", "respectively", ".", "@param", "before", "The", "first", "calendar", "with", "expected", "date", "before", "the", "second", "calendar", ".", "@param", "after", "The", "second", "calendar", "with", "expected", "date", "after", "the", "first", "calendar", ".", "@return", "The", "elapsed", "time", "between", "the", "two", "given", "calendars", "in", "years", "months", "days", "hours", "minutes", "and", "seconds", ".", "@throws", "IllegalArgumentException", "If", "the", "first", "calendar", "is", "dated", "after", "the", "second", "calendar", "." ]
public static int[] elapsedTime(Calendar before, Calendar after) { int[] elapsedTime = new int[6]; Calendar clone = (Calendar) before.clone(); elapsedTime[0] = elapsedYears(clone, after); addYears(clone, elapsedTime[0]); elapsedTime[1] = elapsedMonths(clone, after); addMonths(clone, elapsedTime[1]); elapsedTime[2] = elapsedDays(clone, after); addDays(clone, elapsedTime[2]); elapsedTime[3] = elapsedHours(clone, after); addHours(clone, elapsedTime[3]); elapsedTime[4] = elapsedMinutes(clone, after); addMinutes(clone, elapsedTime[4]); elapsedTime[5] = elapsedSeconds(clone, after); return elapsedTime; }
[ "public", "static", "int", "[", "]", "elapsedTime", "(", "Calendar", "before", ",", "Calendar", "after", ")", "{", "int", "[", "]", "elapsedTime", "=", "new", "int", "[", "6", "]", ";", "Calendar", "clone", "=", "(", "Calendar", ")", "before", ".", "clone", "(", ")", ";", "elapsedTime", "[", "0", "]", "=", "elapsedYears", "(", "clone", ",", "after", ")", ";", "addYears", "(", "clone", ",", "elapsedTime", "[", "0", "]", ")", ";", "elapsedTime", "[", "1", "]", "=", "elapsedMonths", "(", "clone", ",", "after", ")", ";", "addMonths", "(", "clone", ",", "elapsedTime", "[", "1", "]", ")", ";", "elapsedTime", "[", "2", "]", "=", "elapsedDays", "(", "clone", ",", "after", ")", ";", "addDays", "(", "clone", ",", "elapsedTime", "[", "2", "]", ")", ";", "elapsedTime", "[", "3", "]", "=", "elapsedHours", "(", "clone", ",", "after", ")", ";", "addHours", "(", "clone", ",", "elapsedTime", "[", "3", "]", ")", ";", "elapsedTime", "[", "4", "]", "=", "elapsedMinutes", "(", "clone", ",", "after", ")", ";", "addMinutes", "(", "clone", ",", "elapsedTime", "[", "4", "]", ")", ";", "elapsedTime", "[", "5", "]", "=", "elapsedSeconds", "(", "clone", ",", "after", ")", ";", "return", "elapsedTime", ";", "}" ]
Calculate the total of elapsed time from years up to seconds between the two given calendars.
[ "Calculate", "the", "total", "of", "elapsed", "time", "from", "years", "up", "to", "seconds", "between", "the", "two", "given", "calendars", "." ]
[ "// Otherwise changes are been reflected." ]
[ { "param": "before", "type": "Calendar" }, { "param": "after", "type": "Calendar" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "before", "type": "Calendar", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "after", "type": "Calendar", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 760, 509, 8526, 9613, 950, 12, 7335, 1865, 16, 5542, 1839, 13, 288, 203, 3639, 509, 8526, 9613, 950, 273, 394, 509, 63, 26, 15533, 203, 3639, 5542, 3236, 273, 261, 7335, 13, 1865, 18, 14056, 5621, 368, 5272, 3478, 854, 2118, 21591, 18, 203, 203, 3639, 9613, 950, 63, 20, 65, 273, 9613, 21945, 12, 14056, 16, 1839, 1769, 203, 3639, 527, 21945, 12, 14056, 16, 9613, 950, 63, 20, 19226, 203, 203, 3639, 9613, 950, 63, 21, 65, 273, 9613, 19749, 12, 14056, 16, 1839, 1769, 203, 3639, 527, 19749, 12, 14056, 16, 9613, 950, 63, 21, 19226, 203, 203, 3639, 9613, 950, 63, 22, 65, 273, 9613, 9384, 12, 14056, 16, 1839, 1769, 203, 3639, 527, 9384, 12, 14056, 16, 9613, 950, 63, 22, 19226, 203, 203, 3639, 9613, 950, 63, 23, 65, 273, 9613, 14910, 12, 14056, 16, 1839, 1769, 203, 3639, 527, 14910, 12, 14056, 16, 9613, 950, 63, 23, 19226, 203, 203, 3639, 9613, 950, 63, 24, 65, 273, 9613, 13050, 12, 14056, 16, 1839, 1769, 203, 3639, 527, 13050, 12, 14056, 16, 9613, 950, 63, 24, 19226, 203, 203, 3639, 9613, 950, 63, 25, 65, 273, 9613, 6762, 12, 14056, 16, 1839, 1769, 203, 203, 3639, 327, 9613, 950, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 9029, 326, 2078, 434, 9613, 813, 628, 11387, 731, 358, 3974, 3086, 326, 2795, 864, 5686, 87, 18, 203, 377, 380, 2597, 1135, 392, 509, 526, 598, 326, 9613, 11387, 16, 8846, 16, 4681, 16, 7507, 16, 6824, 471, 3974, 203, 377, 380, 19629, 18, 203, 377, 380, 632, 891, 1865, 1021, 1122, 5686, 598, 2665, 1509, 1865, 326, 2205, 5686, 18, 203, 377, 380, 632, 891, 1839, 1021, 2205, 5686, 598, 2665, 1509, 1839, 326, 1122, 5686, 18, 203, 377, 380, 632, 2463, 1021, 9613, 813, 3086, 326, 2795, 864, 5686, 87, 316, 11387, 16, 8846, 16, 4681, 16, 7507, 16, 203, 377, 380, 6824, 471, 3974, 18, 203, 377, 380, 632, 15069, 2754, 971, 326, 1122, 5686, 353, 302, 690, 2 ]
adadb8aea571ab50a6917d8a943dd5f63b13c5c6
Hurence/historian
historian-resources/src/main/java/com/hurence/historian/date/util/CalendarUtil.java
[ "Apache-2.0" ]
Java
elapsed
null
private static int elapsed(Calendar before, Calendar after, int field) { checkBeforeAfter(before, after); Calendar clone = (Calendar) before.clone(); // Otherwise changes are been reflected. int elapsed = -1; while (!clone.after(after)) { clone.add(field, 1); elapsed++; } return elapsed; }
/** * Retrieve the amount of elapsed time between the two given calendars based on the given * calendar field as definied in the Calendar constants, e.g. <tt>Calendar.MONTH</tt>. * @param before The first calendar with expected date before the second calendar. * @param after The second calendar with expected date after the first calendar. * @param field The calendar field as definied in the Calendar constants. * @return The amount of elapsed time between the two given calendars based on the given * calendar field. * @throws IllegalArgumentException If the first calendar is dated after the second calendar. */
Retrieve the amount of elapsed time between the two given calendars based on the given calendar field as definied in the Calendar constants, e.g.
[ "Retrieve", "the", "amount", "of", "elapsed", "time", "between", "the", "two", "given", "calendars", "based", "on", "the", "given", "calendar", "field", "as", "definied", "in", "the", "Calendar", "constants", "e", ".", "g", "." ]
private static int elapsed(Calendar before, Calendar after, int field) { checkBeforeAfter(before, after); Calendar clone = (Calendar) before.clone(); int elapsed = -1; while (!clone.after(after)) { clone.add(field, 1); elapsed++; } return elapsed; }
[ "private", "static", "int", "elapsed", "(", "Calendar", "before", ",", "Calendar", "after", ",", "int", "field", ")", "{", "checkBeforeAfter", "(", "before", ",", "after", ")", ";", "Calendar", "clone", "=", "(", "Calendar", ")", "before", ".", "clone", "(", ")", ";", "int", "elapsed", "=", "-", "1", ";", "while", "(", "!", "clone", ".", "after", "(", "after", ")", ")", "{", "clone", ".", "add", "(", "field", ",", "1", ")", ";", "elapsed", "++", ";", "}", "return", "elapsed", ";", "}" ]
Retrieve the amount of elapsed time between the two given calendars based on the given calendar field as definied in the Calendar constants, e.g.
[ "Retrieve", "the", "amount", "of", "elapsed", "time", "between", "the", "two", "given", "calendars", "based", "on", "the", "given", "calendar", "field", "as", "definied", "in", "the", "Calendar", "constants", "e", ".", "g", "." ]
[ "// Otherwise changes are been reflected." ]
[ { "param": "before", "type": "Calendar" }, { "param": "after", "type": "Calendar" }, { "param": "field", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "before", "type": "Calendar", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "after", "type": "Calendar", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "field", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 3238, 760, 509, 9613, 12, 7335, 1865, 16, 5542, 1839, 16, 509, 652, 13, 288, 203, 3639, 866, 4649, 4436, 12, 5771, 16, 1839, 1769, 203, 3639, 5542, 3236, 273, 261, 7335, 13, 1865, 18, 14056, 5621, 368, 5272, 3478, 854, 2118, 21591, 18, 203, 3639, 509, 9613, 273, 300, 21, 31, 203, 3639, 1323, 16051, 14056, 18, 5205, 12, 5205, 3719, 288, 203, 5411, 3236, 18, 1289, 12, 1518, 16, 404, 1769, 203, 5411, 9613, 9904, 31, 203, 3639, 289, 203, 3639, 327, 9613, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 10708, 326, 3844, 434, 9613, 813, 3086, 326, 2795, 864, 5686, 87, 2511, 603, 326, 864, 203, 377, 380, 5686, 652, 487, 2217, 2092, 316, 326, 5542, 6810, 16, 425, 18, 75, 18, 411, 748, 34, 7335, 18, 13942, 1757, 748, 18652, 203, 377, 380, 632, 891, 1865, 1021, 1122, 5686, 598, 2665, 1509, 1865, 326, 2205, 5686, 18, 203, 377, 380, 632, 891, 1839, 1021, 2205, 5686, 598, 2665, 1509, 1839, 326, 1122, 5686, 18, 203, 377, 380, 632, 891, 652, 1021, 5686, 652, 487, 2217, 2092, 316, 326, 5542, 6810, 18, 203, 377, 380, 632, 2463, 1021, 3844, 434, 9613, 813, 3086, 326, 2795, 864, 5686, 87, 2511, 603, 326, 864, 203, 377, 380, 5686, 652, 18, 203, 377, 380, 2 ]
adadb8aea571ab50a6917d8a943dd5f63b13c5c6
Hurence/historian
historian-resources/src/main/java/com/hurence/historian/date/util/CalendarUtil.java
[ "Apache-2.0" ]
Java
elapsedMillis
null
private static long elapsedMillis(Calendar before, Calendar after, int factor) { checkBeforeAfter(before, after); if (factor < 1) { throw new IllegalArgumentException( "Division factor '" + factor + "' should not be less than 1."); } return (after.getTimeInMillis() - before.getTimeInMillis()) / factor; }
/** * Retrieve the amount of elapsed milliseconds between the two given calendars and directly * divide the outcome by the given factor. E.g.: if the division factor is 1, then you will get * the elapsed milliseconds unchanged; if the division factor is 1000, then the elapsed * milliseconds will be divided by 1000, resulting in the amount of elapsed seconds. * @param before The first calendar with expected date before the second calendar. * @param after The second calendar with expected date after the first calendar. * @param factor The division factor which to divide the milliseconds with, expected to be at * least 1. * @return The amount of elapsed milliseconds between the two given calendars, divided by the * given factor. * @throws IllegalArgumentException If the first calendar is dated after the second calendar or * if the division factor is less than 1. */
Retrieve the amount of elapsed milliseconds between the two given calendars and directly divide the outcome by the given factor. E.g.: if the division factor is 1, then you will get the elapsed milliseconds unchanged; if the division factor is 1000, then the elapsed milliseconds will be divided by 1000, resulting in the amount of elapsed seconds. @param before The first calendar with expected date before the second calendar. @param after The second calendar with expected date after the first calendar. @param factor The division factor which to divide the milliseconds with, expected to be at least 1. @return The amount of elapsed milliseconds between the two given calendars, divided by the given factor. @throws IllegalArgumentException If the first calendar is dated after the second calendar or if the division factor is less than 1.
[ "Retrieve", "the", "amount", "of", "elapsed", "milliseconds", "between", "the", "two", "given", "calendars", "and", "directly", "divide", "the", "outcome", "by", "the", "given", "factor", ".", "E", ".", "g", ".", ":", "if", "the", "division", "factor", "is", "1", "then", "you", "will", "get", "the", "elapsed", "milliseconds", "unchanged", ";", "if", "the", "division", "factor", "is", "1000", "then", "the", "elapsed", "milliseconds", "will", "be", "divided", "by", "1000", "resulting", "in", "the", "amount", "of", "elapsed", "seconds", ".", "@param", "before", "The", "first", "calendar", "with", "expected", "date", "before", "the", "second", "calendar", ".", "@param", "after", "The", "second", "calendar", "with", "expected", "date", "after", "the", "first", "calendar", ".", "@param", "factor", "The", "division", "factor", "which", "to", "divide", "the", "milliseconds", "with", "expected", "to", "be", "at", "least", "1", ".", "@return", "The", "amount", "of", "elapsed", "milliseconds", "between", "the", "two", "given", "calendars", "divided", "by", "the", "given", "factor", ".", "@throws", "IllegalArgumentException", "If", "the", "first", "calendar", "is", "dated", "after", "the", "second", "calendar", "or", "if", "the", "division", "factor", "is", "less", "than", "1", "." ]
private static long elapsedMillis(Calendar before, Calendar after, int factor) { checkBeforeAfter(before, after); if (factor < 1) { throw new IllegalArgumentException( "Division factor '" + factor + "' should not be less than 1."); } return (after.getTimeInMillis() - before.getTimeInMillis()) / factor; }
[ "private", "static", "long", "elapsedMillis", "(", "Calendar", "before", ",", "Calendar", "after", ",", "int", "factor", ")", "{", "checkBeforeAfter", "(", "before", ",", "after", ")", ";", "if", "(", "factor", "<", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Division factor '\"", "+", "factor", "+", "\"' should not be less than 1.\"", ")", ";", "}", "return", "(", "after", ".", "getTimeInMillis", "(", ")", "-", "before", ".", "getTimeInMillis", "(", ")", ")", "/", "factor", ";", "}" ]
Retrieve the amount of elapsed milliseconds between the two given calendars and directly divide the outcome by the given factor.
[ "Retrieve", "the", "amount", "of", "elapsed", "milliseconds", "between", "the", "two", "given", "calendars", "and", "directly", "divide", "the", "outcome", "by", "the", "given", "factor", "." ]
[]
[ { "param": "before", "type": "Calendar" }, { "param": "after", "type": "Calendar" }, { "param": "factor", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "before", "type": "Calendar", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "after", "type": "Calendar", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "factor", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 3238, 760, 1525, 9613, 4814, 12, 7335, 1865, 16, 5542, 1839, 16, 509, 5578, 13, 288, 203, 3639, 866, 4649, 4436, 12, 5771, 16, 1839, 1769, 203, 3639, 309, 261, 6812, 411, 404, 13, 288, 203, 5411, 604, 394, 2754, 12, 203, 10792, 315, 28223, 5578, 2119, 397, 5578, 397, 2491, 1410, 486, 506, 5242, 2353, 404, 1199, 1769, 203, 3639, 289, 203, 3639, 327, 261, 5205, 18, 588, 950, 16620, 1435, 300, 1865, 18, 588, 950, 16620, 10756, 342, 5578, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 10708, 326, 3844, 434, 9613, 10993, 3086, 326, 2795, 864, 5686, 87, 471, 5122, 203, 377, 380, 12326, 326, 12884, 635, 326, 864, 5578, 18, 512, 18, 75, 29710, 309, 326, 16536, 5578, 353, 404, 16, 1508, 1846, 903, 336, 203, 377, 380, 326, 9613, 10993, 14827, 31, 309, 326, 16536, 5578, 353, 4336, 16, 1508, 326, 9613, 203, 377, 380, 10993, 903, 506, 26057, 635, 4336, 16, 8156, 316, 326, 3844, 434, 9613, 3974, 18, 203, 377, 380, 632, 891, 1865, 1021, 1122, 5686, 598, 2665, 1509, 1865, 326, 2205, 5686, 18, 203, 377, 380, 632, 891, 1839, 1021, 2205, 5686, 598, 2665, 1509, 1839, 326, 1122, 5686, 18, 203, 377, 380, 632, 891, 5578, 1021, 16536, 5578, 1492, 358, 12326, 2 ]
adadb8aea571ab50a6917d8a943dd5f63b13c5c6
Hurence/historian
historian-resources/src/main/java/com/hurence/historian/date/util/CalendarUtil.java
[ "Apache-2.0" ]
Java
checkBeforeAfter
null
private static void checkBeforeAfter(Calendar before, Calendar after) { if (before.after(after)) { throw new IllegalArgumentException( "The first calendar should be dated before the second calendar."); } }
/** * Check if the first calendar is actually dated before the second calendar. * @param before The first calendar with expected date before the second calendar. * @param after The second calendar with expected date after the first calendar. * @throws IllegalArgumentException If the first calendar is dated after the second calendar. */
Check if the first calendar is actually dated before the second calendar. @param before The first calendar with expected date before the second calendar. @param after The second calendar with expected date after the first calendar. @throws IllegalArgumentException If the first calendar is dated after the second calendar.
[ "Check", "if", "the", "first", "calendar", "is", "actually", "dated", "before", "the", "second", "calendar", ".", "@param", "before", "The", "first", "calendar", "with", "expected", "date", "before", "the", "second", "calendar", ".", "@param", "after", "The", "second", "calendar", "with", "expected", "date", "after", "the", "first", "calendar", ".", "@throws", "IllegalArgumentException", "If", "the", "first", "calendar", "is", "dated", "after", "the", "second", "calendar", "." ]
private static void checkBeforeAfter(Calendar before, Calendar after) { if (before.after(after)) { throw new IllegalArgumentException( "The first calendar should be dated before the second calendar."); } }
[ "private", "static", "void", "checkBeforeAfter", "(", "Calendar", "before", ",", "Calendar", "after", ")", "{", "if", "(", "before", ".", "after", "(", "after", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The first calendar should be dated before the second calendar.\"", ")", ";", "}", "}" ]
Check if the first calendar is actually dated before the second calendar.
[ "Check", "if", "the", "first", "calendar", "is", "actually", "dated", "before", "the", "second", "calendar", "." ]
[]
[ { "param": "before", "type": "Calendar" }, { "param": "after", "type": "Calendar" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "before", "type": "Calendar", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "after", "type": "Calendar", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 3238, 760, 918, 866, 4649, 4436, 12, 7335, 1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 377, 380, 2073, 309, 326, 1122, 5686, 353, 6013, 302, 690, 1865, 326, 2205, 5686, 18, 203, 377, 380, 632, 891, 1865, 1021, 1122, 5686, 598, 2665, 1509, 1865, 326, 2205, 5686, 18, 203, 377, 380, 632, 891, 1839, 1021, 2205, 5686, 598, 2665, 1509, 1839, 326, 1122, 5686, 18, 203, 377, 380, 632, 15069, 2754, 971, 326, 1122, 5686, 353, 302, 690, 1839, 326, 2205, 5686, 18, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
97f36300e9f2193933f42359bf1ed84310b9d94e
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/functions/aggregation/First.java
[ "Apache-2.0" ]
Java
execute
null
@Override public void execute(MetricTimeSeries timeSeries, FunctionValueMap functionValueMap) { //If it is empty, we return NaN if (timeSeries.size() <= 0) { functionValueMap.add(this, Double.NaN); return; } //we need to sort the time series timeSeries.sort(); functionValueMap.add(this, timeSeries.getValue(0)); }
/** * Gets the first value in the time series. * It first orders the time series. * * @param timeSeries the time series * @return the average or 0 if the list is empty */
Gets the first value in the time series. It first orders the time series. @param timeSeries the time series @return the average or 0 if the list is empty
[ "Gets", "the", "first", "value", "in", "the", "time", "series", ".", "It", "first", "orders", "the", "time", "series", ".", "@param", "timeSeries", "the", "time", "series", "@return", "the", "average", "or", "0", "if", "the", "list", "is", "empty" ]
@Override public void execute(MetricTimeSeries timeSeries, FunctionValueMap functionValueMap) { if (timeSeries.size() <= 0) { functionValueMap.add(this, Double.NaN); return; } timeSeries.sort(); functionValueMap.add(this, timeSeries.getValue(0)); }
[ "@", "Override", "public", "void", "execute", "(", "MetricTimeSeries", "timeSeries", ",", "FunctionValueMap", "functionValueMap", ")", "{", "if", "(", "timeSeries", ".", "size", "(", ")", "<=", "0", ")", "{", "functionValueMap", ".", "add", "(", "this", ",", "Double", ".", "NaN", ")", ";", "return", ";", "}", "timeSeries", ".", "sort", "(", ")", ";", "functionValueMap", ".", "add", "(", "this", ",", "timeSeries", ".", "getValue", "(", "0", ")", ")", ";", "}" ]
Gets the first value in the time series.
[ "Gets", "the", "first", "value", "in", "the", "time", "series", "." ]
[ "//If it is empty, we return NaN", "//we need to sort the time series" ]
[ { "param": "timeSeries", "type": "MetricTimeSeries" }, { "param": "functionValueMap", "type": "FunctionValueMap" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "timeSeries", "type": "MetricTimeSeries", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "functionValueMap", "type": "FunctionValueMap", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 565, 1071, 918, 1836, 12, 5396, 28486, 813, 6485, 16, 4284, 26795, 445, 26795, 13, 288, 203, 3639, 368, 2047, 518, 353, 1008, 16, 732, 327, 10180, 203, 3639, 309, 261, 957, 6485, 18, 1467, 1435, 1648, 374, 13, 288, 203, 5411, 445, 26795, 18, 1289, 12, 2211, 16, 3698, 18, 21172, 1769, 203, 5411, 327, 31, 203, 3639, 289, 203, 203, 3639, 368, 1814, 1608, 358, 1524, 326, 813, 4166, 203, 3639, 813, 6485, 18, 3804, 5621, 203, 3639, 445, 26795, 18, 1289, 12, 2211, 16, 813, 6485, 18, 24805, 12, 20, 10019, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 11881, 326, 1122, 460, 316, 326, 813, 4166, 18, 203, 377, 380, 2597, 1122, 11077, 326, 813, 4166, 18, 203, 377, 380, 203, 377, 380, 632, 891, 813, 6485, 326, 813, 4166, 203, 377, 380, 632, 2463, 326, 8164, 578, 374, 309, 326, 666, 353, 1008, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
dac69413f085278b4957dd1a24ce6c83bbfaf03a
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/functions/aggregation/Percentile.java
[ "Apache-2.0" ]
Java
execute
null
@Override public void execute(MetricTimeSeries timeSeries, FunctionValueMap functionValueMap) { //If it is empty, we return NaN if (timeSeries.size() <= 0) { functionValueMap.add(this, Double.NaN); return; } //Else calculate the analysis value functionValueMap.add(this, com.hurence.timeseries.functions.math.Percentile.evaluate(timeSeries.getValues(), percentile)); }
/** * Calculates the percentile of the first time series. * * @param timeSeries the time series * @return the percentile or 0 if the list is empty */
Calculates the percentile of the first time series. @param timeSeries the time series @return the percentile or 0 if the list is empty
[ "Calculates", "the", "percentile", "of", "the", "first", "time", "series", ".", "@param", "timeSeries", "the", "time", "series", "@return", "the", "percentile", "or", "0", "if", "the", "list", "is", "empty" ]
@Override public void execute(MetricTimeSeries timeSeries, FunctionValueMap functionValueMap) { if (timeSeries.size() <= 0) { functionValueMap.add(this, Double.NaN); return; } functionValueMap.add(this, com.hurence.timeseries.functions.math.Percentile.evaluate(timeSeries.getValues(), percentile)); }
[ "@", "Override", "public", "void", "execute", "(", "MetricTimeSeries", "timeSeries", ",", "FunctionValueMap", "functionValueMap", ")", "{", "if", "(", "timeSeries", ".", "size", "(", ")", "<=", "0", ")", "{", "functionValueMap", ".", "add", "(", "this", ",", "Double", ".", "NaN", ")", ";", "return", ";", "}", "functionValueMap", ".", "add", "(", "this", ",", "com", ".", "hurence", ".", "timeseries", ".", "functions", ".", "math", ".", "Percentile", ".", "evaluate", "(", "timeSeries", ".", "getValues", "(", ")", ",", "percentile", ")", ")", ";", "}" ]
Calculates the percentile of the first time series.
[ "Calculates", "the", "percentile", "of", "the", "first", "time", "series", "." ]
[ "//If it is empty, we return NaN", "//Else calculate the analysis value" ]
[ { "param": "timeSeries", "type": "MetricTimeSeries" }, { "param": "functionValueMap", "type": "FunctionValueMap" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "timeSeries", "type": "MetricTimeSeries", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "functionValueMap", "type": "FunctionValueMap", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 565, 1071, 918, 1836, 12, 5396, 28486, 813, 6485, 16, 4284, 26795, 445, 26795, 13, 288, 203, 3639, 368, 2047, 518, 353, 1008, 16, 732, 327, 10180, 203, 3639, 309, 261, 957, 6485, 18, 1467, 1435, 1648, 374, 13, 288, 203, 5411, 445, 26795, 18, 1289, 12, 2211, 16, 3698, 18, 21172, 1769, 203, 5411, 327, 31, 203, 3639, 289, 203, 203, 3639, 368, 12427, 4604, 326, 6285, 460, 203, 3639, 445, 26795, 18, 1289, 12, 2211, 16, 532, 18, 76, 25267, 18, 28494, 18, 10722, 18, 15949, 18, 8410, 398, 18, 21024, 12, 957, 6485, 18, 588, 1972, 9334, 17279, 10019, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 26128, 326, 17279, 434, 326, 1122, 813, 4166, 18, 203, 377, 380, 203, 377, 380, 632, 891, 813, 6485, 326, 813, 4166, 203, 377, 380, 632, 2463, 326, 17279, 578, 374, 309, 326, 666, 353, 1008, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
4f1be986e24285243c421e25f1a2d50148cfb7e0
Hurence/historian
historian-server/src/main/java/com/hurence/webapiservice/http/api/grafana/promql/converter/PromQLSynonymLookup.java
[ "Apache-2.0" ]
Java
enable
null
public static void enable() { originalSynonymMap.clear(); synonymsNamesTagsMap.clear(); originalNameSynonymNameMap.clear(); isEnabled = true; LOGGER.debug("NameLookup is enabled"); }
/** * clear the maps and enable the lookup */
clear the maps and enable the lookup
[ "clear", "the", "maps", "and", "enable", "the", "lookup" ]
public static void enable() { originalSynonymMap.clear(); synonymsNamesTagsMap.clear(); originalNameSynonymNameMap.clear(); isEnabled = true; LOGGER.debug("NameLookup is enabled"); }
[ "public", "static", "void", "enable", "(", ")", "{", "originalSynonymMap", ".", "clear", "(", ")", ";", "synonymsNamesTagsMap", ".", "clear", "(", ")", ";", "originalNameSynonymNameMap", ".", "clear", "(", ")", ";", "isEnabled", "=", "true", ";", "LOGGER", ".", "debug", "(", "\"NameLookup is enabled\"", ")", ";", "}" ]
clear the maps and enable the lookup
[ "clear", "the", "maps", "and", "enable", "the", "lookup" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 760, 918, 4237, 1435, 288, 203, 3639, 2282, 10503, 6435, 863, 18, 8507, 5621, 203, 3639, 27260, 1557, 3453, 863, 18, 8507, 5621, 203, 3639, 2282, 461, 10503, 6435, 461, 863, 18, 8507, 5621, 203, 3639, 12047, 273, 638, 31, 203, 3639, 4145, 18, 4148, 2932, 461, 6609, 353, 3696, 8863, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 2424, 326, 7565, 471, 4237, 326, 3689, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
4f1be986e24285243c421e25f1a2d50148cfb7e0
Hurence/historian
historian-server/src/main/java/com/hurence/webapiservice/http/api/grafana/promql/converter/PromQLSynonymLookup.java
[ "Apache-2.0" ]
Java
loadCacheFromFile
null
public static void loadCacheFromFile(String tagsFilePath, char columnSeparator) throws IOException { if (isEnabled) { File file = new File(tagsFilePath); CsvMapper csvMapper = new CsvMapper(); // load tags synonyms from file MappingIterator<NameSynonym> tags = csvMapper .readerWithSchemaFor(NameSynonym.class) .with(CsvSchema.emptySchema() .withHeader() .withColumnSeparator(columnSeparator)) .readValues(file); // push them into the cache tags.readAll().forEach(nameSynonym -> { if (nameSynonym != null && nameSynonym.name != null && nameSynonym.synonym != null) put(nameSynonym.name, nameSynonym.synonym); }); LOGGER.info("successfully loaded data from file {}", tagsFilePath); } else { LOGGER.debug("NameLookup is disabled : data not loaded from file {}", tagsFilePath); } }
/** * Load a lookup cache from a CSV file. * * the file must contain 2 columns name,synonym * * T123.P34_PV.F_CV;Temperature{unit="T123", location="plant_34", type="Mesure_PV"} * T123.P34_SP.F_CV;Temperature{unit="T123", location="plant_34", type="Consigne_SP"} * T123.P34_OP.F_CV;Temperature{unit="T123", location="plant_34", type="Pour_Cent_OP"} * * @param tagsFilePath the path of the CSV file * @param columnSeparator the separator * @throws IOException */
Load a lookup cache from a CSV file. the file must contain 2 columns name,synonym @param tagsFilePath the path of the CSV file @param columnSeparator the separator @throws IOException
[ "Load", "a", "lookup", "cache", "from", "a", "CSV", "file", ".", "the", "file", "must", "contain", "2", "columns", "name", "synonym", "@param", "tagsFilePath", "the", "path", "of", "the", "CSV", "file", "@param", "columnSeparator", "the", "separator", "@throws", "IOException" ]
public static void loadCacheFromFile(String tagsFilePath, char columnSeparator) throws IOException { if (isEnabled) { File file = new File(tagsFilePath); CsvMapper csvMapper = new CsvMapper(); MappingIterator<NameSynonym> tags = csvMapper .readerWithSchemaFor(NameSynonym.class) .with(CsvSchema.emptySchema() .withHeader() .withColumnSeparator(columnSeparator)) .readValues(file); tags.readAll().forEach(nameSynonym -> { if (nameSynonym != null && nameSynonym.name != null && nameSynonym.synonym != null) put(nameSynonym.name, nameSynonym.synonym); }); LOGGER.info("successfully loaded data from file {}", tagsFilePath); } else { LOGGER.debug("NameLookup is disabled : data not loaded from file {}", tagsFilePath); } }
[ "public", "static", "void", "loadCacheFromFile", "(", "String", "tagsFilePath", ",", "char", "columnSeparator", ")", "throws", "IOException", "{", "if", "(", "isEnabled", ")", "{", "File", "file", "=", "new", "File", "(", "tagsFilePath", ")", ";", "CsvMapper", "csvMapper", "=", "new", "CsvMapper", "(", ")", ";", "MappingIterator", "<", "NameSynonym", ">", "tags", "=", "csvMapper", ".", "readerWithSchemaFor", "(", "NameSynonym", ".", "class", ")", ".", "with", "(", "CsvSchema", ".", "emptySchema", "(", ")", ".", "withHeader", "(", ")", ".", "withColumnSeparator", "(", "columnSeparator", ")", ")", ".", "readValues", "(", "file", ")", ";", "tags", ".", "readAll", "(", ")", ".", "forEach", "(", "nameSynonym", "->", "{", "if", "(", "nameSynonym", "!=", "null", "&&", "nameSynonym", ".", "name", "!=", "null", "&&", "nameSynonym", ".", "synonym", "!=", "null", ")", "put", "(", "nameSynonym", ".", "name", ",", "nameSynonym", ".", "synonym", ")", ";", "}", ")", ";", "LOGGER", ".", "info", "(", "\"successfully loaded data from file {}\"", ",", "tagsFilePath", ")", ";", "}", "else", "{", "LOGGER", ".", "debug", "(", "\"NameLookup is disabled : data not loaded from file {}\"", ",", "tagsFilePath", ")", ";", "}", "}" ]
Load a lookup cache from a CSV file.
[ "Load", "a", "lookup", "cache", "from", "a", "CSV", "file", "." ]
[ "// load tags synonyms from file", "// push them into the cache" ]
[ { "param": "tagsFilePath", "type": "String" }, { "param": "columnSeparator", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "tagsFilePath", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "columnSeparator", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 760, 918, 1262, 1649, 13087, 12, 780, 2342, 5598, 16, 1149, 1057, 6581, 13, 1216, 1860, 288, 203, 3639, 309, 261, 291, 1526, 13, 288, 203, 5411, 1387, 585, 273, 394, 1387, 12, 4156, 5598, 1769, 203, 5411, 21532, 4597, 6101, 4597, 273, 394, 21532, 4597, 5621, 203, 203, 5411, 368, 1262, 2342, 27260, 628, 585, 203, 5411, 9408, 3198, 32, 461, 10503, 6435, 34, 2342, 273, 6101, 4597, 203, 10792, 263, 10530, 1190, 3078, 1290, 12, 461, 10503, 6435, 18, 1106, 13, 203, 10792, 263, 1918, 12, 16759, 3078, 18, 5531, 3078, 1435, 203, 18701, 263, 1918, 1864, 1435, 203, 18701, 263, 1918, 1494, 6581, 12, 2827, 6581, 3719, 203, 10792, 263, 896, 1972, 12, 768, 1769, 203, 203, 5411, 368, 1817, 2182, 1368, 326, 1247, 203, 5411, 2342, 18, 896, 1595, 7675, 1884, 3442, 12, 529, 10503, 6435, 317, 288, 203, 7734, 309, 261, 529, 10503, 6435, 480, 446, 597, 508, 10503, 6435, 18, 529, 480, 446, 597, 508, 10503, 6435, 18, 11982, 6435, 480, 446, 13, 203, 10792, 1378, 12, 529, 10503, 6435, 18, 529, 16, 508, 10503, 6435, 18, 11982, 6435, 1769, 203, 5411, 15549, 203, 203, 5411, 4145, 18, 1376, 2932, 4768, 4095, 4203, 501, 628, 585, 3728, 16, 2342, 5598, 1769, 203, 3639, 289, 469, 288, 203, 5411, 4145, 18, 4148, 2932, 461, 6609, 353, 5673, 294, 501, 486, 4203, 628, 585, 3728, 16, 2342, 5598, 1769, 203, 3639, 289, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 4444, 279, 3689, 1247, 628, 279, 10381, 585, 18, 203, 377, 380, 7010, 377, 380, 326, 585, 1297, 912, 576, 2168, 508, 16, 11982, 6435, 203, 377, 380, 7010, 377, 380, 399, 12936, 18, 52, 5026, 67, 30201, 18, 42, 67, 22007, 31, 1837, 9289, 95, 4873, 1546, 56, 12936, 3113, 2117, 1546, 412, 970, 67, 5026, 3113, 618, 1546, 49, 281, 594, 67, 30201, 6, 97, 203, 377, 380, 399, 12936, 18, 52, 5026, 67, 3118, 18, 42, 67, 22007, 31, 1837, 9289, 95, 4873, 1546, 56, 12936, 3113, 2117, 1546, 412, 970, 67, 5026, 3113, 618, 1546, 442, 2977, 73, 67, 3118, 6, 97, 203, 377, 380, 399, 12936, 18, 52, 5026, 67, 3665, 18, 42, 67, 22007, 31, 1837, 2 ]
dcc592348b3d4e9e3f307d05bf8fe714caf88adb
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/functions/aggregation/Range.java
[ "Apache-2.0" ]
Java
execute
null
@Override public void execute(MetricTimeSeries timeSeries, FunctionValueMap functionValueMap) { //If it is empty, we return NaN if (timeSeries.size() <= 0) { functionValueMap.add(this, Double.NaN); return; } //the values to iterate double[] values = timeSeries.getValuesAsArray(); //Initialize the values with the first element double min = values[0]; double max = values[0]; for (int i = 1; i < values.length; i++) { double current = values[i]; //check for min if (current < min) { min = current; } //check of max if (current > max) { max = current; } } //return the absolute difference functionValueMap.add(this, Math.abs(max - min)); }
/** * Gets difference between the maximum and the minimum value. * It is always a positive value. * * @param timeSeries the time series * @return the average or 0 if the list is empty */
Gets difference between the maximum and the minimum value. It is always a positive value. @param timeSeries the time series @return the average or 0 if the list is empty
[ "Gets", "difference", "between", "the", "maximum", "and", "the", "minimum", "value", ".", "It", "is", "always", "a", "positive", "value", ".", "@param", "timeSeries", "the", "time", "series", "@return", "the", "average", "or", "0", "if", "the", "list", "is", "empty" ]
@Override public void execute(MetricTimeSeries timeSeries, FunctionValueMap functionValueMap) { if (timeSeries.size() <= 0) { functionValueMap.add(this, Double.NaN); return; } double[] values = timeSeries.getValuesAsArray(); double min = values[0]; double max = values[0]; for (int i = 1; i < values.length; i++) { double current = values[i]; if (current < min) { min = current; } if (current > max) { max = current; } } functionValueMap.add(this, Math.abs(max - min)); }
[ "@", "Override", "public", "void", "execute", "(", "MetricTimeSeries", "timeSeries", ",", "FunctionValueMap", "functionValueMap", ")", "{", "if", "(", "timeSeries", ".", "size", "(", ")", "<=", "0", ")", "{", "functionValueMap", ".", "add", "(", "this", ",", "Double", ".", "NaN", ")", ";", "return", ";", "}", "double", "[", "]", "values", "=", "timeSeries", ".", "getValuesAsArray", "(", ")", ";", "double", "min", "=", "values", "[", "0", "]", ";", "double", "max", "=", "values", "[", "0", "]", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "values", ".", "length", ";", "i", "++", ")", "{", "double", "current", "=", "values", "[", "i", "]", ";", "if", "(", "current", "<", "min", ")", "{", "min", "=", "current", ";", "}", "if", "(", "current", ">", "max", ")", "{", "max", "=", "current", ";", "}", "}", "functionValueMap", ".", "add", "(", "this", ",", "Math", ".", "abs", "(", "max", "-", "min", ")", ")", ";", "}" ]
Gets difference between the maximum and the minimum value.
[ "Gets", "difference", "between", "the", "maximum", "and", "the", "minimum", "value", "." ]
[ "//If it is empty, we return NaN", "//the values to iterate", "//Initialize the values with the first element", "//check for min", "//check of max", "//return the absolute difference" ]
[ { "param": "timeSeries", "type": "MetricTimeSeries" }, { "param": "functionValueMap", "type": "FunctionValueMap" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "timeSeries", "type": "MetricTimeSeries", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "functionValueMap", "type": "FunctionValueMap", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 565, 1071, 918, 1836, 12, 5396, 28486, 813, 6485, 16, 4284, 26795, 445, 26795, 13, 288, 203, 3639, 368, 2047, 518, 353, 1008, 16, 732, 327, 10180, 203, 3639, 309, 261, 957, 6485, 18, 1467, 1435, 1648, 374, 13, 288, 203, 5411, 445, 26795, 18, 1289, 12, 2211, 16, 3698, 18, 21172, 1769, 203, 5411, 327, 31, 203, 3639, 289, 203, 203, 3639, 368, 5787, 924, 358, 7401, 203, 3639, 1645, 8526, 924, 273, 813, 6485, 18, 588, 1972, 19196, 5621, 203, 3639, 368, 7520, 326, 924, 598, 326, 1122, 930, 203, 3639, 1645, 1131, 273, 924, 63, 20, 15533, 203, 3639, 1645, 943, 273, 924, 63, 20, 15533, 203, 203, 3639, 364, 261, 474, 277, 273, 404, 31, 277, 411, 924, 18, 2469, 31, 277, 27245, 288, 203, 5411, 1645, 783, 273, 924, 63, 77, 15533, 203, 203, 5411, 368, 1893, 364, 1131, 203, 5411, 309, 261, 2972, 411, 1131, 13, 288, 203, 7734, 1131, 273, 783, 31, 203, 5411, 289, 203, 5411, 368, 1893, 434, 943, 203, 5411, 309, 261, 2972, 405, 943, 13, 288, 203, 7734, 943, 273, 783, 31, 203, 5411, 289, 203, 3639, 289, 203, 3639, 368, 2463, 326, 4967, 7114, 203, 3639, 445, 26795, 18, 1289, 12, 2211, 16, 2361, 18, 5113, 12, 1896, 300, 1131, 10019, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 11881, 7114, 3086, 326, 4207, 471, 326, 5224, 460, 18, 203, 377, 380, 2597, 353, 3712, 279, 6895, 460, 18, 203, 377, 380, 203, 377, 380, 632, 891, 813, 6485, 326, 813, 4166, 203, 377, 380, 632, 2463, 326, 8164, 578, 374, 309, 326, 666, 353, 1008, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
ff1b88a8da69b4e55067c7f875f5f2b5c6eebf55
Hurence/historian
historian-server/src/main/java/com/hurence/webapiservice/http/api/grafana/GrafanaSimpleJsonPluginApiImpl.java
[ "Apache-2.0" ]
Java
search
null
@Override public void search(RoutingContext context) { final SearchRequestParam request; try { JsonObject requestBody = context.getBodyAsJson(); /* When declaring QueryRequestParser as a static variable, There is a problem parsing parallel requests at initialization (did not successfully reproduced this in a unit test).//TODO */ request = new SearchRequestParser("target", "limit").parseRequest(requestBody); } catch (Exception ex) { LOGGER.error("error parsing request", ex); context.response().setStatusCode(BAD_REQUEST); context.response().setStatusMessage(StatusMessages.BAD_REQUEST); context.response().putHeader("Content-Type", "application/json"); context.response().end(ErrorMsgHelper.createMsgError("Error parsing request !", ex)); return; } final JsonObject getMetricsParam = buildGetMetricsParam(request); service.rxGetMetricsName(getMetricsParam) .doOnError(ex -> { LOGGER.error("Unexpected error : ", ex); context.response().setStatusCode(500); context.response().putHeader("Content-Type", "application/json"); context.response().end(ex.getMessage()); }) .doOnSuccess(metricResponse -> { JsonArray array = metricResponse.getJsonArray(HistorianServiceFields.METRICS); context.response().setStatusCode(200); context.response().putHeader("Content-Type", "application/json"); context.response().end(array.encode()); }).subscribe(); }
/** * used by the find metric options on the query tab in panels. * In our case we will return each different '{@value HistorianServiceFields#METRIC}' value in historian. * @param context * * Expected request exemple : * <pre> * { target: 'upper_50' } * </pre> * response Exemple : * <pre> * ["upper_25","upper_50","upper_75","upper_90","upper_95"] * </pre> * * @see <a href="https://grafana.com/grafana/plugins/grafana-simple-json-datasource."> * https://grafana.com/grafana/plugins/grafana-simple-json-datasource. * </a> */
used by the find metric options on the query tab in panels. In our case we will return each different ' HistorianServiceFields#METRIC' value in historian. @param context
[ "used", "by", "the", "find", "metric", "options", "on", "the", "query", "tab", "in", "panels", ".", "In", "our", "case", "we", "will", "return", "each", "different", "'", "HistorianServiceFields#METRIC", "'", "value", "in", "historian", ".", "@param", "context" ]
@Override public void search(RoutingContext context) { final SearchRequestParam request; try { JsonObject requestBody = context.getBodyAsJson(); /* When declaring QueryRequestParser as a static variable, There is a problem parsing parallel requests at initialization (did not successfully reproduced this in a unit test).//TODO */ request = new SearchRequestParser("target", "limit").parseRequest(requestBody); } catch (Exception ex) { LOGGER.error("error parsing request", ex); context.response().setStatusCode(BAD_REQUEST); context.response().setStatusMessage(StatusMessages.BAD_REQUEST); context.response().putHeader("Content-Type", "application/json"); context.response().end(ErrorMsgHelper.createMsgError("Error parsing request !", ex)); return; } final JsonObject getMetricsParam = buildGetMetricsParam(request); service.rxGetMetricsName(getMetricsParam) .doOnError(ex -> { LOGGER.error("Unexpected error : ", ex); context.response().setStatusCode(500); context.response().putHeader("Content-Type", "application/json"); context.response().end(ex.getMessage()); }) .doOnSuccess(metricResponse -> { JsonArray array = metricResponse.getJsonArray(HistorianServiceFields.METRICS); context.response().setStatusCode(200); context.response().putHeader("Content-Type", "application/json"); context.response().end(array.encode()); }).subscribe(); }
[ "@", "Override", "public", "void", "search", "(", "RoutingContext", "context", ")", "{", "final", "SearchRequestParam", "request", ";", "try", "{", "JsonObject", "requestBody", "=", "context", ".", "getBodyAsJson", "(", ")", ";", "/*\n When declaring QueryRequestParser as a static variable, There is a problem parsing parallel requests\n at initialization (did not successfully reproduced this in a unit test).//TODO\n */", "request", "=", "new", "SearchRequestParser", "(", "\"target\"", ",", "\"limit\"", ")", ".", "parseRequest", "(", "requestBody", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "LOGGER", ".", "error", "(", "\"error parsing request\"", ",", "ex", ")", ";", "context", ".", "response", "(", ")", ".", "setStatusCode", "(", "BAD_REQUEST", ")", ";", "context", ".", "response", "(", ")", ".", "setStatusMessage", "(", "StatusMessages", ".", "BAD_REQUEST", ")", ";", "context", ".", "response", "(", ")", ".", "putHeader", "(", "\"Content-Type\"", ",", "\"application/json\"", ")", ";", "context", ".", "response", "(", ")", ".", "end", "(", "ErrorMsgHelper", ".", "createMsgError", "(", "\"Error parsing request !\"", ",", "ex", ")", ")", ";", "return", ";", "}", "final", "JsonObject", "getMetricsParam", "=", "buildGetMetricsParam", "(", "request", ")", ";", "service", ".", "rxGetMetricsName", "(", "getMetricsParam", ")", ".", "doOnError", "(", "ex", "->", "{", "LOGGER", ".", "error", "(", "\"Unexpected error : \"", ",", "ex", ")", ";", "context", ".", "response", "(", ")", ".", "setStatusCode", "(", "500", ")", ";", "context", ".", "response", "(", ")", ".", "putHeader", "(", "\"Content-Type\"", ",", "\"application/json\"", ")", ";", "context", ".", "response", "(", ")", ".", "end", "(", "ex", ".", "getMessage", "(", ")", ")", ";", "}", ")", ".", "doOnSuccess", "(", "metricResponse", "->", "{", "JsonArray", "array", "=", "metricResponse", ".", "getJsonArray", "(", "HistorianServiceFields", ".", "METRICS", ")", ";", "context", ".", "response", "(", ")", ".", "setStatusCode", "(", "200", ")", ";", "context", ".", "response", "(", ")", ".", "putHeader", "(", "\"Content-Type\"", ",", "\"application/json\"", ")", ";", "context", ".", "response", "(", ")", ".", "end", "(", "array", ".", "encode", "(", ")", ")", ";", "}", ")", ".", "subscribe", "(", ")", ";", "}" ]
used by the find metric options on the query tab in panels.
[ "used", "by", "the", "find", "metric", "options", "on", "the", "query", "tab", "in", "panels", "." ]
[]
[ { "param": "context", "type": "RoutingContext" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "context", "type": "RoutingContext", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 565, 1071, 918, 1623, 12, 13966, 1042, 819, 13, 288, 203, 3639, 727, 5167, 691, 786, 590, 31, 203, 3639, 775, 288, 203, 5411, 11596, 20740, 273, 819, 18, 588, 2250, 1463, 3185, 5621, 203, 5411, 1748, 203, 7734, 5203, 20845, 2770, 691, 2678, 487, 279, 760, 2190, 16, 6149, 353, 279, 6199, 5811, 7230, 3285, 203, 7734, 622, 10313, 261, 14044, 486, 4985, 283, 11776, 3263, 333, 316, 279, 2836, 1842, 2934, 759, 6241, 203, 2398, 1195, 203, 5411, 590, 273, 394, 5167, 691, 2678, 2932, 3299, 3113, 315, 3595, 20387, 2670, 691, 12, 2293, 2250, 1769, 203, 3639, 289, 1044, 261, 503, 431, 13, 288, 203, 5411, 4145, 18, 1636, 2932, 1636, 5811, 590, 3113, 431, 1769, 203, 5411, 819, 18, 2740, 7675, 542, 14041, 12, 16234, 67, 5519, 1769, 203, 5411, 819, 18, 2740, 7675, 542, 1482, 1079, 12, 1482, 5058, 18, 16234, 67, 5519, 1769, 203, 5411, 819, 18, 2740, 7675, 458, 1864, 2932, 1350, 17, 559, 3113, 315, 3685, 19, 1977, 8863, 203, 5411, 819, 18, 2740, 7675, 409, 12, 668, 3332, 2276, 18, 2640, 3332, 668, 2932, 668, 5811, 590, 401, 3113, 431, 10019, 203, 5411, 327, 31, 203, 3639, 289, 203, 3639, 727, 11596, 2108, 2682, 786, 273, 1361, 967, 5653, 786, 12, 2293, 1769, 203, 203, 3639, 1156, 18, 20122, 967, 5653, 461, 12, 588, 5653, 786, 13, 203, 7734, 263, 2896, 11427, 12, 338, 317, 288, 203, 10792, 4145, 18, 1636, 2932, 7762, 555, 294, 3104, 431, 1769, 203, 10792, 819, 18, 2740, 7675, 542, 14041, 12, 12483, 1769, 203, 10792, 819, 18, 2740, 7675, 458, 1864, 2932, 1350, 17, 559, 3113, 315, 3685, 19, 1977, 8863, 203, 10792, 819, 18, 2740, 7675, 409, 12, 338, 18, 24906, 10663, 203, 7734, 289, 13, 203, 7734, 263, 2896, 1398, 4510, 12, 6899, 1064, 317, 288, 203, 10792, 25109, 526, 273, 3999, 1064, 18, 588, 3185, 1076, 12, 8648, 280, 2779, 1179, 2314, 18, 23081, 4596, 1769, 203, 10792, 819, 18, 2740, 7675, 542, 14041, 12, 6976, 1769, 203, 10792, 819, 18, 2740, 7675, 458, 1864, 2932, 1350, 17, 559, 3113, 315, 3685, 19, 1977, 8863, 203, 10792, 819, 18,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, 316, 20582, 18, 203, 377, 380, 225, 657, 3134, 648, 732, 903, 327, 1517, 3775, 2292, 36, 1132, 13244, 280, 2779, 1179, 2314, 7, 23081, 39, 1713, 460, 316, 5356, 280, 2779, 18, 203, 377, 380, 632, 891, 819, 203, 377, 380, 203, 377, 380, 13219, 590, 431, 351, 1802, 294, 203, 377, 380, 411, 1484, 34, 203, 377, 380, 1377, 288, 1018, 30, 296, 5797, 67, 3361, 11, 289, 203, 377, 380, 7765, 1484, 34, 203, 377, 380, 766, 1312, 351, 1802, 294, 203, 377, 380, 411, 1484, 34, 203, 377, 380, 377, 8247, 5797, 67, 2947, 15937, 5797, 67, 3361, 15937, 5797, 67, 5877, 15937, 5797, 67, 9349, 15937, 2 ]
ff1b88a8da69b4e55067c7f875f5f2b5c6eebf55
Hurence/historian
historian-server/src/main/java/com/hurence/webapiservice/http/api/grafana/GrafanaSimpleJsonPluginApiImpl.java
[ "Apache-2.0" ]
Java
tagKeys
null
@Override public void tagKeys(RoutingContext context) { context.response().setStatusCode(200); context.response().putHeader("Content-Type", "application/json"); context.response().end(new JsonArray() .add(new JsonObject().put("type", "string").put("text", ALGO_TAG_KEY)) .add(new JsonObject().put("type", "int").put("text", BUCKET_SIZE_TAG_KEY)) .encode() ); }
/** * return every custom key parameters that can be used to query data. * @param context */
return every custom key parameters that can be used to query data. @param context
[ "return", "every", "custom", "key", "parameters", "that", "can", "be", "used", "to", "query", "data", ".", "@param", "context" ]
@Override public void tagKeys(RoutingContext context) { context.response().setStatusCode(200); context.response().putHeader("Content-Type", "application/json"); context.response().end(new JsonArray() .add(new JsonObject().put("type", "string").put("text", ALGO_TAG_KEY)) .add(new JsonObject().put("type", "int").put("text", BUCKET_SIZE_TAG_KEY)) .encode() ); }
[ "@", "Override", "public", "void", "tagKeys", "(", "RoutingContext", "context", ")", "{", "context", ".", "response", "(", ")", ".", "setStatusCode", "(", "200", ")", ";", "context", ".", "response", "(", ")", ".", "putHeader", "(", "\"Content-Type\"", ",", "\"application/json\"", ")", ";", "context", ".", "response", "(", ")", ".", "end", "(", "new", "JsonArray", "(", ")", ".", "add", "(", "new", "JsonObject", "(", ")", ".", "put", "(", "\"type\"", ",", "\"string\"", ")", ".", "put", "(", "\"text\"", ",", "ALGO_TAG_KEY", ")", ")", ".", "add", "(", "new", "JsonObject", "(", ")", ".", "put", "(", "\"type\"", ",", "\"int\"", ")", ".", "put", "(", "\"text\"", ",", "BUCKET_SIZE_TAG_KEY", ")", ")", ".", "encode", "(", ")", ")", ";", "}" ]
return every custom key parameters that can be used to query data.
[ "return", "every", "custom", "key", "parameters", "that", "can", "be", "used", "to", "query", "data", "." ]
[]
[ { "param": "context", "type": "RoutingContext" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "context", "type": "RoutingContext", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 565, 1071, 918, 1047, 2396, 12, 13966, 1042, 819, 13, 288, 203, 3639, 819, 18, 2740, 7675, 542, 14041, 12, 6976, 1769, 203, 3639, 819, 18, 2740, 7675, 458, 1864, 2932, 1350, 17, 559, 3113, 315, 3685, 19, 1977, 8863, 203, 3639, 819, 18, 2740, 7675, 409, 12, 2704, 25109, 1435, 203, 7734, 263, 1289, 12, 2704, 11596, 7675, 458, 2932, 723, 3113, 315, 1080, 20387, 458, 2932, 955, 3113, 7981, 16387, 67, 7927, 67, 3297, 3719, 203, 7734, 263, 1289, 12, 2704, 11596, 7675, 458, 2932, 723, 3113, 315, 474, 20387, 458, 2932, 955, 3113, 10937, 14984, 67, 4574, 67, 7927, 67, 3297, 3719, 203, 7734, 263, 3015, 1435, 203, 3639, 11272, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 327, 3614, 1679, 498, 1472, 716, 848, 506, 1399, 358, 843, 501, 18, 203, 377, 380, 632, 891, 819, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
ff1b88a8da69b4e55067c7f875f5f2b5c6eebf55
Hurence/historian
historian-server/src/main/java/com/hurence/webapiservice/http/api/grafana/GrafanaSimpleJsonPluginApiImpl.java
[ "Apache-2.0" ]
Java
tagValues
null
@Override public void tagValues(RoutingContext context) { final String keyValue; try { keyValue = parseTagValuesRequest(context); } catch (IllegalArgumentException ex) { LOGGER.error("error parsing request", ex); context.response().setStatusCode(BAD_REQUEST); context.response().setStatusMessage(StatusMessages.BAD_REQUEST); context.response().putHeader("Content-Type", "application/json"); context.response().end(ErrorMsgHelper.createMsgError("Error parsing request !", ex)); return; } final JsonArray response; switch (keyValue) { case ALGO_TAG_KEY: response = getTagValuesOfAlgo(); break; case BUCKET_SIZE_TAG_KEY: //TODO verify how to handle integer type response = new JsonArray() .add(new JsonObject().put("text", "50")) .add(new JsonObject().put("text", "100")) .add(new JsonObject().put("text", "250")) .add(new JsonObject().put("text", "500")); break; default: LOGGER.warn("there is no tag with this key !"); context.response().setStatusCode(NOT_FOUND); context.response().setStatusMessage(StatusMessages.BAD_REQUEST); context.response().putHeader("Content-Type", "application/json"); context.response().end("there is no tag with this key !"); return; } context.response().setStatusCode(200); context.response().putHeader("Content-Type", "application/json"); context.response().end(response.encode()); }
/** * return every custom value parameters given a key that can be used to query data. * @param context */
return every custom value parameters given a key that can be used to query data. @param context
[ "return", "every", "custom", "value", "parameters", "given", "a", "key", "that", "can", "be", "used", "to", "query", "data", ".", "@param", "context" ]
@Override public void tagValues(RoutingContext context) { final String keyValue; try { keyValue = parseTagValuesRequest(context); } catch (IllegalArgumentException ex) { LOGGER.error("error parsing request", ex); context.response().setStatusCode(BAD_REQUEST); context.response().setStatusMessage(StatusMessages.BAD_REQUEST); context.response().putHeader("Content-Type", "application/json"); context.response().end(ErrorMsgHelper.createMsgError("Error parsing request !", ex)); return; } final JsonArray response; switch (keyValue) { case ALGO_TAG_KEY: response = getTagValuesOfAlgo(); break; case BUCKET_SIZE_TAG_KEY: response = new JsonArray() .add(new JsonObject().put("text", "50")) .add(new JsonObject().put("text", "100")) .add(new JsonObject().put("text", "250")) .add(new JsonObject().put("text", "500")); break; default: LOGGER.warn("there is no tag with this key !"); context.response().setStatusCode(NOT_FOUND); context.response().setStatusMessage(StatusMessages.BAD_REQUEST); context.response().putHeader("Content-Type", "application/json"); context.response().end("there is no tag with this key !"); return; } context.response().setStatusCode(200); context.response().putHeader("Content-Type", "application/json"); context.response().end(response.encode()); }
[ "@", "Override", "public", "void", "tagValues", "(", "RoutingContext", "context", ")", "{", "final", "String", "keyValue", ";", "try", "{", "keyValue", "=", "parseTagValuesRequest", "(", "context", ")", ";", "}", "catch", "(", "IllegalArgumentException", "ex", ")", "{", "LOGGER", ".", "error", "(", "\"error parsing request\"", ",", "ex", ")", ";", "context", ".", "response", "(", ")", ".", "setStatusCode", "(", "BAD_REQUEST", ")", ";", "context", ".", "response", "(", ")", ".", "setStatusMessage", "(", "StatusMessages", ".", "BAD_REQUEST", ")", ";", "context", ".", "response", "(", ")", ".", "putHeader", "(", "\"Content-Type\"", ",", "\"application/json\"", ")", ";", "context", ".", "response", "(", ")", ".", "end", "(", "ErrorMsgHelper", ".", "createMsgError", "(", "\"Error parsing request !\"", ",", "ex", ")", ")", ";", "return", ";", "}", "final", "JsonArray", "response", ";", "switch", "(", "keyValue", ")", "{", "case", "ALGO_TAG_KEY", ":", "response", "=", "getTagValuesOfAlgo", "(", ")", ";", "break", ";", "case", "BUCKET_SIZE_TAG_KEY", ":", "response", "=", "new", "JsonArray", "(", ")", ".", "add", "(", "new", "JsonObject", "(", ")", ".", "put", "(", "\"text\"", ",", "\"50\"", ")", ")", ".", "add", "(", "new", "JsonObject", "(", ")", ".", "put", "(", "\"text\"", ",", "\"100\"", ")", ")", ".", "add", "(", "new", "JsonObject", "(", ")", ".", "put", "(", "\"text\"", ",", "\"250\"", ")", ")", ".", "add", "(", "new", "JsonObject", "(", ")", ".", "put", "(", "\"text\"", ",", "\"500\"", ")", ")", ";", "break", ";", "default", ":", "LOGGER", ".", "warn", "(", "\"there is no tag with this key !\"", ")", ";", "context", ".", "response", "(", ")", ".", "setStatusCode", "(", "NOT_FOUND", ")", ";", "context", ".", "response", "(", ")", ".", "setStatusMessage", "(", "StatusMessages", ".", "BAD_REQUEST", ")", ";", "context", ".", "response", "(", ")", ".", "putHeader", "(", "\"Content-Type\"", ",", "\"application/json\"", ")", ";", "context", ".", "response", "(", ")", ".", "end", "(", "\"there is no tag with this key !\"", ")", ";", "return", ";", "}", "context", ".", "response", "(", ")", ".", "setStatusCode", "(", "200", ")", ";", "context", ".", "response", "(", ")", ".", "putHeader", "(", "\"Content-Type\"", ",", "\"application/json\"", ")", ";", "context", ".", "response", "(", ")", ".", "end", "(", "response", ".", "encode", "(", ")", ")", ";", "}" ]
return every custom value parameters given a key that can be used to query data.
[ "return", "every", "custom", "value", "parameters", "given", "a", "key", "that", "can", "be", "used", "to", "query", "data", "." ]
[ "//TODO verify how to handle integer type" ]
[ { "param": "context", "type": "RoutingContext" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "context", "type": "RoutingContext", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 565, 1071, 918, 1047, 1972, 12, 13966, 1042, 819, 13, 288, 203, 3639, 727, 514, 15082, 31, 203, 3639, 775, 288, 203, 5411, 15082, 273, 1109, 1805, 1972, 691, 12, 2472, 1769, 203, 3639, 289, 1044, 261, 31237, 431, 13, 288, 203, 5411, 4145, 18, 1636, 2932, 1636, 5811, 590, 3113, 431, 1769, 203, 5411, 819, 18, 2740, 7675, 542, 14041, 12, 16234, 67, 5519, 1769, 203, 5411, 819, 18, 2740, 7675, 542, 1482, 1079, 12, 1482, 5058, 18, 16234, 67, 5519, 1769, 203, 5411, 819, 18, 2740, 7675, 458, 1864, 2932, 1350, 17, 559, 3113, 315, 3685, 19, 1977, 8863, 203, 5411, 819, 18, 2740, 7675, 409, 12, 668, 3332, 2276, 18, 2640, 3332, 668, 2932, 668, 5811, 590, 401, 3113, 431, 10019, 203, 5411, 327, 31, 203, 3639, 289, 203, 3639, 727, 25109, 766, 31, 203, 3639, 1620, 261, 856, 620, 13, 288, 203, 5411, 648, 7981, 16387, 67, 7927, 67, 3297, 30, 203, 7734, 766, 273, 11362, 1972, 951, 22430, 5621, 203, 7734, 898, 31, 203, 5411, 648, 10937, 14984, 67, 4574, 67, 7927, 67, 3297, 30, 203, 7734, 368, 6241, 3929, 3661, 358, 1640, 3571, 618, 203, 7734, 766, 273, 394, 25109, 1435, 203, 13491, 263, 1289, 12, 2704, 11596, 7675, 458, 2932, 955, 3113, 315, 3361, 6, 3719, 203, 13491, 263, 1289, 12, 2704, 11596, 7675, 458, 2932, 955, 3113, 315, 6625, 6, 3719, 203, 13491, 263, 1289, 12, 2704, 11596, 7675, 458, 2932, 955, 3113, 315, 26520, 6, 3719, 203, 13491, 263, 1289, 12, 2704, 11596, 7675, 458, 2932, 955, 3113, 315, 12483, 7923, 1769, 203, 7734, 898, 31, 203, 5411, 805, 30, 203, 7734, 4145, 18, 8935, 2932, 18664, 353, 1158, 1047, 598, 333, 498, 401, 8863, 203, 7734, 819, 18, 2740, 7675, 542, 14041, 12, 4400, 67, 9294, 1769, 203, 7734, 819, 18, 2740, 7675, 542, 1482, 1079, 12, 1482, 5058, 18, 16234, 67, 5519, 1769, 203, 7734, 819, 18, 2740, 7675, 458, 1864, 2932, 1350, 17, 559, 3113, 315, 3685, 19, 1977, 8863, 203, 7734, 819, 18, 2740, 7675, 409, 2932, 18664, 353, 1158, 1047, 598, 333, 498, 401, 8863, 203, 7734, 327, 31, 203, 3639, 289, 203, 3639, 819, 18, 2740, 7675, 542, 14041, 12, 6976, 1769, 203, 3639, 819, 18, 2740, 7675, 458, 1864, 2932, 1350, 17, 559, 3113, 315, 3685, 19, 1977, 8863, 203, 3639, 819, 18, 2740, 7675, 409, 12, 2740, 18, 3015, 10663, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 327, 3614, 1679, 460, 1472, 864, 279, 498, 716, 848, 506, 1399, 358, 843, 501, 18, 203, 377, 380, 632, 891, 819, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
1309cbf05a0dd2162aa988996197a9704be70c0c
Hurence/historian
historian-scraper/src/main/java/com/hurence/historian/scraper/PrometheusMetricsProcessor.java
[ "Apache-2.0" ]
Java
walk
null
public void walk() { // tell the walker we are starting walker.walkStart(); int totalMetrics = 0; int familyIndex = 0; try { PrometheusMetricDataParser<T> parser = createPrometheusMetricDataParser(); T metricFamily = parser.parse(); // prime the pump while (metricFamily != null) { com.hurence.historian.scraper.types.MetricFamily convertedMetricFamily = convert(metricFamily); // let the walker know we are traversing a new family of metrics walker.walkMetricFamily(convertedMetricFamily, familyIndex++); // walk through each metric in the family int metricIndex = 0; for (com.hurence.historian.scraper.types.Metric metric : convertedMetricFamily.getMetrics()) { switch (convertedMetricFamily.getType()) { case COUNTER: walker.walkCounterMetric(convertedMetricFamily, (Counter) metric, metricIndex); break; case GAUGE: walker.walkGaugeMetric(convertedMetricFamily, (Gauge) metric, metricIndex); break; case SUMMARY: walker.walkSummaryMetric(convertedMetricFamily, ((com.hurence.historian.scraper.types.Summary) metric), metricIndex); break; case HISTOGRAM: walker.walkHistogramMetric(convertedMetricFamily, ((com.hurence.historian.scraper.types.Histogram) metric), metricIndex); break; } metricIndex++; } // finished processing the metrics for the current family totalMetrics += convertedMetricFamily.getMetrics().size(); // go to the next metric family metricFamily = parser.parse(); } } catch (Exception e) { log.debug("Error while processing binary data"); } // tell the walker we have finished walker.walkFinish(familyIndex, totalMetrics); }
/** * This will iterate over a set of metrics that are produced by the * {@link #createPrometheusMetricDataParser() parser} and will notify the {@link #getWalker() walker} * of each metric found. */
This will iterate over a set of metrics that are produced by the #createPrometheusMetricDataParser() parser and will notify the #getWalker() walker of each metric found.
[ "This", "will", "iterate", "over", "a", "set", "of", "metrics", "that", "are", "produced", "by", "the", "#createPrometheusMetricDataParser", "()", "parser", "and", "will", "notify", "the", "#getWalker", "()", "walker", "of", "each", "metric", "found", "." ]
public void walk() { walker.walkStart(); int totalMetrics = 0; int familyIndex = 0; try { PrometheusMetricDataParser<T> parser = createPrometheusMetricDataParser(); T metricFamily = parser.parse(); while (metricFamily != null) { com.hurence.historian.scraper.types.MetricFamily convertedMetricFamily = convert(metricFamily); walker.walkMetricFamily(convertedMetricFamily, familyIndex++); int metricIndex = 0; for (com.hurence.historian.scraper.types.Metric metric : convertedMetricFamily.getMetrics()) { switch (convertedMetricFamily.getType()) { case COUNTER: walker.walkCounterMetric(convertedMetricFamily, (Counter) metric, metricIndex); break; case GAUGE: walker.walkGaugeMetric(convertedMetricFamily, (Gauge) metric, metricIndex); break; case SUMMARY: walker.walkSummaryMetric(convertedMetricFamily, ((com.hurence.historian.scraper.types.Summary) metric), metricIndex); break; case HISTOGRAM: walker.walkHistogramMetric(convertedMetricFamily, ((com.hurence.historian.scraper.types.Histogram) metric), metricIndex); break; } metricIndex++; } totalMetrics += convertedMetricFamily.getMetrics().size(); metricFamily = parser.parse(); } } catch (Exception e) { log.debug("Error while processing binary data"); } walker.walkFinish(familyIndex, totalMetrics); }
[ "public", "void", "walk", "(", ")", "{", "walker", ".", "walkStart", "(", ")", ";", "int", "totalMetrics", "=", "0", ";", "int", "familyIndex", "=", "0", ";", "try", "{", "PrometheusMetricDataParser", "<", "T", ">", "parser", "=", "createPrometheusMetricDataParser", "(", ")", ";", "T", "metricFamily", "=", "parser", ".", "parse", "(", ")", ";", "while", "(", "metricFamily", "!=", "null", ")", "{", "com", ".", "hurence", ".", "historian", ".", "scraper", ".", "types", ".", "MetricFamily", "convertedMetricFamily", "=", "convert", "(", "metricFamily", ")", ";", "walker", ".", "walkMetricFamily", "(", "convertedMetricFamily", ",", "familyIndex", "++", ")", ";", "int", "metricIndex", "=", "0", ";", "for", "(", "com", ".", "hurence", ".", "historian", ".", "scraper", ".", "types", ".", "Metric", "metric", ":", "convertedMetricFamily", ".", "getMetrics", "(", ")", ")", "{", "switch", "(", "convertedMetricFamily", ".", "getType", "(", ")", ")", "{", "case", "COUNTER", ":", "walker", ".", "walkCounterMetric", "(", "convertedMetricFamily", ",", "(", "Counter", ")", "metric", ",", "metricIndex", ")", ";", "break", ";", "case", "GAUGE", ":", "walker", ".", "walkGaugeMetric", "(", "convertedMetricFamily", ",", "(", "Gauge", ")", "metric", ",", "metricIndex", ")", ";", "break", ";", "case", "SUMMARY", ":", "walker", ".", "walkSummaryMetric", "(", "convertedMetricFamily", ",", "(", "(", "com", ".", "hurence", ".", "historian", ".", "scraper", ".", "types", ".", "Summary", ")", "metric", ")", ",", "metricIndex", ")", ";", "break", ";", "case", "HISTOGRAM", ":", "walker", ".", "walkHistogramMetric", "(", "convertedMetricFamily", ",", "(", "(", "com", ".", "hurence", ".", "historian", ".", "scraper", ".", "types", ".", "Histogram", ")", "metric", ")", ",", "metricIndex", ")", ";", "break", ";", "}", "metricIndex", "++", ";", "}", "totalMetrics", "+=", "convertedMetricFamily", ".", "getMetrics", "(", ")", ".", "size", "(", ")", ";", "metricFamily", "=", "parser", ".", "parse", "(", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "debug", "(", "\"Error while processing binary data\"", ")", ";", "}", "walker", ".", "walkFinish", "(", "familyIndex", ",", "totalMetrics", ")", ";", "}" ]
This will iterate over a set of metrics that are produced by the {@link #createPrometheusMetricDataParser() parser} and will notify the {@link #getWalker() walker} of each metric found.
[ "This", "will", "iterate", "over", "a", "set", "of", "metrics", "that", "are", "produced", "by", "the", "{", "@link", "#createPrometheusMetricDataParser", "()", "parser", "}", "and", "will", "notify", "the", "{", "@link", "#getWalker", "()", "walker", "}", "of", "each", "metric", "found", "." ]
[ "// tell the walker we are starting", "// prime the pump", "// let the walker know we are traversing a new family of metrics", "// walk through each metric in the family", "// finished processing the metrics for the current family", "// go to the next metric family", "// tell the walker we have finished" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 918, 5442, 1435, 288, 203, 3639, 368, 9276, 326, 14810, 732, 854, 5023, 203, 3639, 14810, 18, 11348, 1685, 5621, 203, 203, 3639, 509, 2078, 5653, 273, 374, 31, 203, 3639, 509, 6755, 1016, 273, 374, 31, 203, 203, 3639, 775, 288, 203, 5411, 17552, 10537, 28858, 2678, 32, 56, 34, 2082, 273, 752, 13224, 10537, 28858, 2678, 5621, 203, 5411, 399, 3999, 9203, 273, 2082, 18, 2670, 5621, 368, 17014, 326, 293, 2801, 203, 203, 5411, 1323, 261, 6899, 9203, 480, 446, 13, 288, 203, 7734, 532, 18, 76, 25267, 18, 11488, 280, 2779, 18, 1017, 20321, 18, 2352, 18, 5396, 9203, 5970, 5396, 9203, 273, 1765, 12, 6899, 9203, 1769, 203, 203, 7734, 368, 2231, 326, 14810, 5055, 732, 854, 10704, 310, 279, 394, 6755, 434, 4309, 203, 7734, 14810, 18, 11348, 5396, 9203, 12, 6283, 329, 5396, 9203, 16, 6755, 1016, 9904, 1769, 203, 203, 7734, 368, 5442, 3059, 1517, 3999, 316, 326, 6755, 203, 7734, 509, 3999, 1016, 273, 374, 31, 203, 203, 7734, 364, 261, 832, 18, 76, 25267, 18, 11488, 280, 2779, 18, 1017, 20321, 18, 2352, 18, 5396, 3999, 294, 5970, 5396, 9203, 18, 588, 5653, 10756, 288, 203, 10792, 1620, 261, 6283, 329, 5396, 9203, 18, 588, 559, 10756, 288, 203, 13491, 648, 12666, 654, 30, 203, 18701, 14810, 18, 11348, 4789, 5396, 12, 6283, 329, 5396, 9203, 16, 261, 4789, 13, 3999, 16, 3999, 1016, 1769, 203, 18701, 898, 31, 203, 203, 13491, 648, 30435, 30, 203, 18701, 14810, 18, 11348, 18941, 5396, 12, 6283, 329, 5396, 9203, 16, 261, 18941, 13, 3999, 16, 3999, 1016, 1769, 203, 18701, 898, 31, 203, 203, 13491, 648, 22595, 11293, 30, 203, 18701, 14810, 18, 11348, 4733, 5396, 12, 6283, 329, 5396, 9203, 16, 203, 4766, 565, 14015, 832, 18, 76, 25267, 18, 11488, 280, 2779, 18, 1017, 20321, 18, 2352, 18, 4733, 13, 3999, 3631, 3999, 1016, 1769, 203, 18701, 898, 31, 203, 203, 13491, 648, 670, 5511, 51, 15370, 30, 203, 18701, 14810, 18, 11348, 12874, 5396, 12, 6283, 329, 5396, 9203, 16, 203, 4766, 565, 14015, 832, 18, 76, 25267, 18, 11488, 280, 2779, 18, 1017, 20321, 18, 2352, 18, 12874, 13, 3999, 3631, 3999, 1016, 1769, 203, 18701, 898, 31, 203, 10792, 289, 203, 203, 10792, 3999, 1016, 9904, 31, 203, 7734, 289, 203, 203, 7734, 368, 6708, 4929, 326, 4309, 364, 326, 783, 6755, 203, 7734, 2078, 5653, 1011, 5970, 5396, 9203, 18, 588, 5653, 7675, 1467, 5621, 203, 203, 7734, 368, 1960, 358, 326, 1024, 3999, 6755, 203, 7734, 3999, 9203, 273, 2082, 18, 2670, 5621, 203, 5411, 289, 203, 3639, 289, 1044, 261, 503, 425, 13, 288, 203, 5411, 613, 18, 4148, 2932, 668, 1323, 4929, 3112, 501, 8863, 203, 3639, 289, 203, 203, 3639, 368, 9276, 326, 14810, 732, 1240, 6708, 203, 3639, 14810, 18, 11348, 11641, 12, 9309, 1016, 16, 2078, 5653, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 1220, 903, 7401, 1879, 279, 444, 434, 4309, 716, 854, 14929, 635, 326, 203, 377, 380, 8901, 1232, 468, 2640, 13224, 10537, 28858, 2678, 1435, 2082, 97, 471, 903, 5066, 326, 8901, 1232, 468, 588, 16246, 1435, 14810, 97, 203, 377, 380, 434, 1517, 3999, 1392, 18, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
0ef80fef7a093752c3cf36f86469a46376697e67
Hurence/historian
historian-resources/src/main/java/com/hurence/historian/date/util/DateUtil.java
[ "Apache-2.0" ]
Java
parse
Date
public static Date parse(String dateString, String dateFormat) throws ParseException { SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormat); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); simpleDateFormat.setLenient(false); // Don't automatically convert invalid date. return simpleDateFormat.parse(dateString); }
/** * Validate the actual date of the given date string based on the given date format pattern and * return a date instance based on the given date string. * @param dateString The date string. * @param dateFormat The date format pattern which should respect the SimpleDateFormat rules. * @return The parsed date object. * @throws ParseException If the given date string or its actual date is invalid based on the * given date format pattern. * @see SimpleDateFormat */
Validate the actual date of the given date string based on the given date format pattern and return a date instance based on the given date string. @param dateString The date string. @param dateFormat The date format pattern which should respect the SimpleDateFormat rules. @return The parsed date object. @throws ParseException If the given date string or its actual date is invalid based on the given date format pattern.
[ "Validate", "the", "actual", "date", "of", "the", "given", "date", "string", "based", "on", "the", "given", "date", "format", "pattern", "and", "return", "a", "date", "instance", "based", "on", "the", "given", "date", "string", ".", "@param", "dateString", "The", "date", "string", ".", "@param", "dateFormat", "The", "date", "format", "pattern", "which", "should", "respect", "the", "SimpleDateFormat", "rules", ".", "@return", "The", "parsed", "date", "object", ".", "@throws", "ParseException", "If", "the", "given", "date", "string", "or", "its", "actual", "date", "is", "invalid", "based", "on", "the", "given", "date", "format", "pattern", "." ]
public static Date parse(String dateString, String dateFormat) throws ParseException { SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormat); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); simpleDateFormat.setLenient(false); return simpleDateFormat.parse(dateString); }
[ "public", "static", "Date", "parse", "(", "String", "dateString", ",", "String", "dateFormat", ")", "throws", "ParseException", "{", "SimpleDateFormat", "simpleDateFormat", "=", "new", "SimpleDateFormat", "(", "dateFormat", ")", ";", "simpleDateFormat", ".", "setTimeZone", "(", "TimeZone", ".", "getTimeZone", "(", "\"UTC\"", ")", ")", ";", "simpleDateFormat", ".", "setLenient", "(", "false", ")", ";", "return", "simpleDateFormat", ".", "parse", "(", "dateString", ")", ";", "}" ]
Validate the actual date of the given date string based on the given date format pattern and return a date instance based on the given date string.
[ "Validate", "the", "actual", "date", "of", "the", "given", "date", "string", "based", "on", "the", "given", "date", "format", "pattern", "and", "return", "a", "date", "instance", "based", "on", "the", "given", "date", "string", "." ]
[ "// Don't automatically convert invalid date." ]
[ { "param": "dateString", "type": "String" }, { "param": "dateFormat", "type": "String" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "dateString", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dateFormat", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 760, 2167, 1109, 12, 780, 24757, 16, 514, 16996, 13, 1216, 10616, 288, 203, 3639, 17005, 4143, 11878, 273, 394, 17005, 12, 712, 1630, 1769, 203, 3639, 4143, 11878, 18, 542, 16760, 12, 16760, 18, 588, 16760, 2932, 11471, 7923, 1769, 203, 3639, 4143, 11878, 18, 542, 2891, 1979, 12, 5743, 1769, 368, 7615, 1404, 6635, 1765, 2057, 1509, 18, 203, 3639, 327, 4143, 11878, 18, 2670, 12, 712, 780, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 3554, 326, 3214, 1509, 434, 326, 864, 1509, 533, 2511, 603, 326, 864, 1509, 740, 1936, 471, 203, 377, 380, 327, 279, 1509, 791, 2511, 603, 326, 864, 1509, 533, 18, 203, 377, 380, 632, 891, 24757, 1021, 1509, 533, 18, 203, 377, 380, 632, 891, 16996, 1021, 1509, 740, 1936, 1492, 1410, 8762, 326, 17005, 2931, 18, 203, 377, 380, 632, 2463, 1021, 2707, 1509, 733, 18, 203, 377, 380, 632, 15069, 10616, 971, 326, 864, 1509, 533, 578, 2097, 3214, 1509, 353, 2057, 2511, 603, 326, 203, 377, 380, 864, 1509, 740, 1936, 18, 203, 377, 380, 632, 5946, 17005, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
0ef80fef7a093752c3cf36f86469a46376697e67
Hurence/historian
historian-resources/src/main/java/com/hurence/historian/date/util/DateUtil.java
[ "Apache-2.0" ]
Java
utcFirstTimestampOfTodayMs
null
public static long utcFirstTimestampOfTodayMs() { // Get current time in UTC timezone Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); int year = calendar.get(Calendar.YEAR); int month = calendar.get(Calendar.MONTH); int day = calendar.get(Calendar.DATE); calendar.set(year, month, day, 0, 0, 0); // Remove hour, minute and seconds of the day from the time // This may return 1600387200388 timestamp in milliseconds which is GMT: Friday 18 September 2020 00:00:00.388 long timestampMillis = calendar.getTime().getTime(); // Remove the milliseconds by rounding down to number of seconds and passing again into ms // 1600387200388 -> 1600387200000 return (timestampMillis / 1000L) * 1000L; }
/** * Get the first timestamp (in milliseconds) of the current day in UTC format. * For instance if you call this method on Friday 18 September 2020 in the middle of the day, * this should return 1600387200000 which corresponds to GMT: Friday 18 September 2020 00:00:00 * @return */
Get the first timestamp (in milliseconds) of the current day in UTC format. For instance if you call this method on Friday 18 September 2020 in the middle of the day, this should return 1600387200000 which corresponds to GMT: Friday 18 September 2020 00:00:00 @return
[ "Get", "the", "first", "timestamp", "(", "in", "milliseconds", ")", "of", "the", "current", "day", "in", "UTC", "format", ".", "For", "instance", "if", "you", "call", "this", "method", "on", "Friday", "18", "September", "2020", "in", "the", "middle", "of", "the", "day", "this", "should", "return", "1600387200000", "which", "corresponds", "to", "GMT", ":", "Friday", "18", "September", "2020", "00", ":", "00", ":", "00", "@return" ]
public static long utcFirstTimestampOfTodayMs() { Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); int year = calendar.get(Calendar.YEAR); int month = calendar.get(Calendar.MONTH); int day = calendar.get(Calendar.DATE); calendar.set(year, month, day, 0, 0, 0); long timestampMillis = calendar.getTime().getTime(); return (timestampMillis / 1000L) * 1000L; }
[ "public", "static", "long", "utcFirstTimestampOfTodayMs", "(", ")", "{", "Calendar", "calendar", "=", "Calendar", ".", "getInstance", "(", "TimeZone", ".", "getTimeZone", "(", "\"UTC\"", ")", ")", ";", "int", "year", "=", "calendar", ".", "get", "(", "Calendar", ".", "YEAR", ")", ";", "int", "month", "=", "calendar", ".", "get", "(", "Calendar", ".", "MONTH", ")", ";", "int", "day", "=", "calendar", ".", "get", "(", "Calendar", ".", "DATE", ")", ";", "calendar", ".", "set", "(", "year", ",", "month", ",", "day", ",", "0", ",", "0", ",", "0", ")", ";", "long", "timestampMillis", "=", "calendar", ".", "getTime", "(", ")", ".", "getTime", "(", ")", ";", "return", "(", "timestampMillis", "/", "1000L", ")", "*", "1000L", ";", "}" ]
Get the first timestamp (in milliseconds) of the current day in UTC format.
[ "Get", "the", "first", "timestamp", "(", "in", "milliseconds", ")", "of", "the", "current", "day", "in", "UTC", "format", "." ]
[ "// Get current time in UTC timezone", "// Remove hour, minute and seconds of the day from the time", "// This may return 1600387200388 timestamp in milliseconds which is GMT: Friday 18 September 2020 00:00:00.388", "// Remove the milliseconds by rounding down to number of seconds and passing again into ms", "// 1600387200388 -> 1600387200000" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 760, 1525, 9439, 3759, 4921, 951, 56, 20136, 6947, 1435, 288, 203, 203, 3639, 368, 968, 783, 813, 316, 9951, 6371, 203, 3639, 5542, 5686, 273, 5542, 18, 588, 1442, 12, 16760, 18, 588, 16760, 2932, 11471, 7923, 1769, 203, 3639, 509, 3286, 273, 5686, 18, 588, 12, 7335, 18, 15137, 1769, 203, 3639, 509, 3138, 273, 5686, 18, 588, 12, 7335, 18, 13942, 1769, 203, 3639, 509, 2548, 273, 5686, 18, 588, 12, 7335, 18, 4594, 1769, 203, 3639, 5686, 18, 542, 12, 6874, 16, 3138, 16, 2548, 16, 374, 16, 374, 16, 374, 1769, 368, 3581, 6126, 16, 8044, 471, 3974, 434, 326, 2548, 628, 326, 813, 203, 203, 3639, 368, 1220, 2026, 327, 2872, 713, 7414, 27, 6976, 23, 5482, 2858, 316, 10993, 1492, 353, 21706, 30, 478, 1691, 528, 6549, 3265, 337, 2558, 26599, 20, 9631, 30, 713, 30, 713, 18, 23, 5482, 203, 3639, 1525, 2858, 4814, 273, 5686, 18, 588, 950, 7675, 588, 950, 5621, 203, 203, 3639, 368, 3581, 326, 10993, 635, 13885, 2588, 358, 1300, 434, 3974, 471, 9588, 3382, 1368, 4086, 203, 3639, 368, 2872, 713, 7414, 27, 6976, 23, 5482, 317, 2872, 713, 7414, 9060, 11706, 203, 203, 3639, 327, 261, 5508, 4814, 342, 4336, 48, 13, 380, 4336, 48, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 968, 326, 1122, 2858, 261, 267, 10993, 13, 434, 326, 783, 2548, 316, 9951, 740, 18, 203, 377, 380, 2457, 791, 309, 1846, 745, 333, 707, 603, 478, 1691, 528, 6549, 3265, 337, 2558, 26599, 20, 316, 326, 7689, 434, 326, 2548, 16, 203, 377, 380, 333, 1410, 327, 2872, 713, 7414, 9060, 11706, 1492, 13955, 358, 21706, 30, 478, 1691, 528, 6549, 3265, 337, 2558, 26599, 20, 9631, 30, 713, 30, 713, 203, 377, 380, 632, 2463, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
0ef80fef7a093752c3cf36f86469a46376697e67
Hurence/historian
historian-resources/src/main/java/com/hurence/historian/date/util/DateUtil.java
[ "Apache-2.0" ]
Java
utcCurrentHourTimestampOfTodayMs
null
public static long utcCurrentHourTimestampOfTodayMs() { // Get current time in UTC timezone Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); int year = calendar.get(Calendar.YEAR); int month = calendar.get(Calendar.MONTH); int day = calendar.get(Calendar.DATE); int hourOfTheDay = calendar.get(Calendar.HOUR_OF_DAY); calendar.set(year, month, day, hourOfTheDay, 0, 0); // Remove minute and seconds of the day from the time // This may return 1600387200388 timestamp in milliseconds which is GMT: Friday 18 September 2020 00:00:00.388 long timestampMillis = calendar.getTime().getTime(); // Remove the milliseconds by rounding down to number of seconds and passing again into ms // 1600387200388 -> 1600387200000 return (timestampMillis / 1000L) * 1000L; }
/** * Get the timestamp (in milliseconds) of the current day at the current hour in UTC format. * For instance if you call this method on Friday 18 September 2020 in the middle of the day, * this should return 1600387200000 which corresponds to GMT: Friday 18 September 2020 00:00:00 * @return */
Get the timestamp (in milliseconds) of the current day at the current hour in UTC format. For instance if you call this method on Friday 18 September 2020 in the middle of the day, this should return 1600387200000 which corresponds to GMT: Friday 18 September 2020 00:00:00 @return
[ "Get", "the", "timestamp", "(", "in", "milliseconds", ")", "of", "the", "current", "day", "at", "the", "current", "hour", "in", "UTC", "format", ".", "For", "instance", "if", "you", "call", "this", "method", "on", "Friday", "18", "September", "2020", "in", "the", "middle", "of", "the", "day", "this", "should", "return", "1600387200000", "which", "corresponds", "to", "GMT", ":", "Friday", "18", "September", "2020", "00", ":", "00", ":", "00", "@return" ]
public static long utcCurrentHourTimestampOfTodayMs() { Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); int year = calendar.get(Calendar.YEAR); int month = calendar.get(Calendar.MONTH); int day = calendar.get(Calendar.DATE); int hourOfTheDay = calendar.get(Calendar.HOUR_OF_DAY); calendar.set(year, month, day, hourOfTheDay, 0, 0); long timestampMillis = calendar.getTime().getTime(); return (timestampMillis / 1000L) * 1000L; }
[ "public", "static", "long", "utcCurrentHourTimestampOfTodayMs", "(", ")", "{", "Calendar", "calendar", "=", "Calendar", ".", "getInstance", "(", "TimeZone", ".", "getTimeZone", "(", "\"UTC\"", ")", ")", ";", "int", "year", "=", "calendar", ".", "get", "(", "Calendar", ".", "YEAR", ")", ";", "int", "month", "=", "calendar", ".", "get", "(", "Calendar", ".", "MONTH", ")", ";", "int", "day", "=", "calendar", ".", "get", "(", "Calendar", ".", "DATE", ")", ";", "int", "hourOfTheDay", "=", "calendar", ".", "get", "(", "Calendar", ".", "HOUR_OF_DAY", ")", ";", "calendar", ".", "set", "(", "year", ",", "month", ",", "day", ",", "hourOfTheDay", ",", "0", ",", "0", ")", ";", "long", "timestampMillis", "=", "calendar", ".", "getTime", "(", ")", ".", "getTime", "(", ")", ";", "return", "(", "timestampMillis", "/", "1000L", ")", "*", "1000L", ";", "}" ]
Get the timestamp (in milliseconds) of the current day at the current hour in UTC format.
[ "Get", "the", "timestamp", "(", "in", "milliseconds", ")", "of", "the", "current", "day", "at", "the", "current", "hour", "in", "UTC", "format", "." ]
[ "// Get current time in UTC timezone", "// Remove minute and seconds of the day from the time", "// This may return 1600387200388 timestamp in milliseconds which is GMT: Friday 18 September 2020 00:00:00.388", "// Remove the milliseconds by rounding down to number of seconds and passing again into ms", "// 1600387200388 -> 1600387200000" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 760, 1525, 9439, 3935, 13433, 4921, 951, 56, 20136, 6947, 1435, 288, 203, 203, 3639, 368, 968, 783, 813, 316, 9951, 6371, 203, 3639, 5542, 5686, 273, 5542, 18, 588, 1442, 12, 16760, 18, 588, 16760, 2932, 11471, 7923, 1769, 203, 3639, 509, 3286, 273, 5686, 18, 588, 12, 7335, 18, 15137, 1769, 203, 3639, 509, 3138, 273, 5686, 18, 588, 12, 7335, 18, 13942, 1769, 203, 3639, 509, 2548, 273, 5686, 18, 588, 12, 7335, 18, 4594, 1769, 203, 3639, 509, 6126, 951, 1986, 4245, 273, 5686, 18, 588, 12, 7335, 18, 21372, 67, 3932, 67, 10339, 1769, 203, 3639, 5686, 18, 542, 12, 6874, 16, 3138, 16, 2548, 16, 6126, 951, 1986, 4245, 16, 374, 16, 374, 1769, 368, 3581, 8044, 471, 3974, 434, 326, 2548, 628, 326, 813, 203, 203, 3639, 368, 1220, 2026, 327, 2872, 713, 7414, 27, 6976, 23, 5482, 2858, 316, 10993, 1492, 353, 21706, 30, 478, 1691, 528, 6549, 3265, 337, 2558, 26599, 20, 9631, 30, 713, 30, 713, 18, 23, 5482, 203, 3639, 1525, 2858, 4814, 273, 5686, 18, 588, 950, 7675, 588, 950, 5621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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 968, 326, 2858, 261, 267, 10993, 13, 434, 326, 783, 2548, 622, 326, 783, 6126, 316, 9951, 740, 18, 203, 377, 380, 2457, 791, 309, 1846, 745, 333, 707, 603, 478, 1691, 528, 6549, 3265, 337, 2558, 26599, 20, 316, 326, 7689, 434, 326, 2548, 16, 203, 377, 380, 333, 1410, 327, 2872, 713, 7414, 9060, 11706, 1492, 13955, 358, 21706, 30, 478, 1691, 528, 6549, 3265, 337, 2558, 26599, 20, 9631, 30, 713, 30, 713, 203, 377, 380, 632, 2463, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
382925a307afce97cade782c88e875953febb4c0
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/converter/MeasuresToChunkVersionEVOA0.java
[ "Apache-2.0" ]
Java
computeAndSetAggs
null
private void computeAndSetAggs(Chunk.ChunkBuilder builder, MetricTimeSeries timeSeries) { Integer sax_alphabet_size = Math.max(Math.min(timeSeries.size(), 7), 2); Integer sax_string_length = Math.min(timeSeries.size(), 100); String metricString = String.format(METRIC_STRING, sax_alphabet_size, sax_string_length); String[] metrics = new String[]{"metric{" + metricString + "}"}; configMetricsCalcul(metrics); functionValueMap.resetValues(); transformations.forEach(transfo -> transfo.execute(timeSeries, functionValueMap)); analyses.forEach(analyse -> analyse.execute(timeSeries, functionValueMap)); aggregations.forEach(aggregation -> aggregation.execute(timeSeries, functionValueMap)); encodings.forEach(encoding -> encoding.execute(timeSeries, functionValueMap)); for (int i = 0; i < functionValueMap.sizeOfAggregations(); i++) { String name = functionValueMap.getAggregation(i).getQueryName(); double value = functionValueMap.getAggregationValue(i); switch (name) { case "first": builder.first(value); break; case "min": builder.min(value); break; case "max": builder.max(value); break; case "sum": builder.sum(value); break; case "avg": builder.avg(value); break; case "count": builder.count((long) value); break; } } for (int i = 0; i < functionValueMap.sizeOfAnalyses(); i++) { String name = functionValueMap.getAnalysis(i).getQueryName(); boolean value = functionValueMap.getAnalysisValue(i); switch (name) { case "trend": builder.trend(value); break; } } for (int i = 0; i < functionValueMap.sizeOfEncodings(); i++) { String name = functionValueMap.getEncoding(i).getQueryName(); String value = functionValueMap.getEncodingValue(i); switch (name) { case "sax": builder.sax(value); break; } } }
/** * Converts a list of records to a timeseries chunk * * @return */
Converts a list of records to a timeseries chunk @return
[ "Converts", "a", "list", "of", "records", "to", "a", "timeseries", "chunk", "@return" ]
private void computeAndSetAggs(Chunk.ChunkBuilder builder, MetricTimeSeries timeSeries) { Integer sax_alphabet_size = Math.max(Math.min(timeSeries.size(), 7), 2); Integer sax_string_length = Math.min(timeSeries.size(), 100); String metricString = String.format(METRIC_STRING, sax_alphabet_size, sax_string_length); String[] metrics = new String[]{"metric{" + metricString + "}"}; configMetricsCalcul(metrics); functionValueMap.resetValues(); transformations.forEach(transfo -> transfo.execute(timeSeries, functionValueMap)); analyses.forEach(analyse -> analyse.execute(timeSeries, functionValueMap)); aggregations.forEach(aggregation -> aggregation.execute(timeSeries, functionValueMap)); encodings.forEach(encoding -> encoding.execute(timeSeries, functionValueMap)); for (int i = 0; i < functionValueMap.sizeOfAggregations(); i++) { String name = functionValueMap.getAggregation(i).getQueryName(); double value = functionValueMap.getAggregationValue(i); switch (name) { case "first": builder.first(value); break; case "min": builder.min(value); break; case "max": builder.max(value); break; case "sum": builder.sum(value); break; case "avg": builder.avg(value); break; case "count": builder.count((long) value); break; } } for (int i = 0; i < functionValueMap.sizeOfAnalyses(); i++) { String name = functionValueMap.getAnalysis(i).getQueryName(); boolean value = functionValueMap.getAnalysisValue(i); switch (name) { case "trend": builder.trend(value); break; } } for (int i = 0; i < functionValueMap.sizeOfEncodings(); i++) { String name = functionValueMap.getEncoding(i).getQueryName(); String value = functionValueMap.getEncodingValue(i); switch (name) { case "sax": builder.sax(value); break; } } }
[ "private", "void", "computeAndSetAggs", "(", "Chunk", ".", "ChunkBuilder", "builder", ",", "MetricTimeSeries", "timeSeries", ")", "{", "Integer", "sax_alphabet_size", "=", "Math", ".", "max", "(", "Math", ".", "min", "(", "timeSeries", ".", "size", "(", ")", ",", "7", ")", ",", "2", ")", ";", "Integer", "sax_string_length", "=", "Math", ".", "min", "(", "timeSeries", ".", "size", "(", ")", ",", "100", ")", ";", "String", "metricString", "=", "String", ".", "format", "(", "METRIC_STRING", ",", "sax_alphabet_size", ",", "sax_string_length", ")", ";", "String", "[", "]", "metrics", "=", "new", "String", "[", "]", "{", "\"metric{\"", "+", "metricString", "+", "\"}\"", "}", ";", "configMetricsCalcul", "(", "metrics", ")", ";", "functionValueMap", ".", "resetValues", "(", ")", ";", "transformations", ".", "forEach", "(", "transfo", "->", "transfo", ".", "execute", "(", "timeSeries", ",", "functionValueMap", ")", ")", ";", "analyses", ".", "forEach", "(", "analyse", "->", "analyse", ".", "execute", "(", "timeSeries", ",", "functionValueMap", ")", ")", ";", "aggregations", ".", "forEach", "(", "aggregation", "->", "aggregation", ".", "execute", "(", "timeSeries", ",", "functionValueMap", ")", ")", ";", "encodings", ".", "forEach", "(", "encoding", "->", "encoding", ".", "execute", "(", "timeSeries", ",", "functionValueMap", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "functionValueMap", ".", "sizeOfAggregations", "(", ")", ";", "i", "++", ")", "{", "String", "name", "=", "functionValueMap", ".", "getAggregation", "(", "i", ")", ".", "getQueryName", "(", ")", ";", "double", "value", "=", "functionValueMap", ".", "getAggregationValue", "(", "i", ")", ";", "switch", "(", "name", ")", "{", "case", "\"first\"", ":", "builder", ".", "first", "(", "value", ")", ";", "break", ";", "case", "\"min\"", ":", "builder", ".", "min", "(", "value", ")", ";", "break", ";", "case", "\"max\"", ":", "builder", ".", "max", "(", "value", ")", ";", "break", ";", "case", "\"sum\"", ":", "builder", ".", "sum", "(", "value", ")", ";", "break", ";", "case", "\"avg\"", ":", "builder", ".", "avg", "(", "value", ")", ";", "break", ";", "case", "\"count\"", ":", "builder", ".", "count", "(", "(", "long", ")", "value", ")", ";", "break", ";", "}", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "functionValueMap", ".", "sizeOfAnalyses", "(", ")", ";", "i", "++", ")", "{", "String", "name", "=", "functionValueMap", ".", "getAnalysis", "(", "i", ")", ".", "getQueryName", "(", ")", ";", "boolean", "value", "=", "functionValueMap", ".", "getAnalysisValue", "(", "i", ")", ";", "switch", "(", "name", ")", "{", "case", "\"trend\"", ":", "builder", ".", "trend", "(", "value", ")", ";", "break", ";", "}", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "functionValueMap", ".", "sizeOfEncodings", "(", ")", ";", "i", "++", ")", "{", "String", "name", "=", "functionValueMap", ".", "getEncoding", "(", "i", ")", ".", "getQueryName", "(", ")", ";", "String", "value", "=", "functionValueMap", ".", "getEncodingValue", "(", "i", ")", ";", "switch", "(", "name", ")", "{", "case", "\"sax\"", ":", "builder", ".", "sax", "(", "value", ")", ";", "break", ";", "}", "}", "}" ]
Converts a list of records to a timeseries chunk @return
[ "Converts", "a", "list", "of", "records", "to", "a", "timeseries", "chunk", "@return" ]
[]
[ { "param": "builder", "type": "Chunk.ChunkBuilder" }, { "param": "timeSeries", "type": "MetricTimeSeries" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "builder", "type": "Chunk.ChunkBuilder", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "timeSeries", "type": "MetricTimeSeries", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 3238, 918, 3671, 13152, 2577, 564, 12, 5579, 18, 5579, 1263, 2089, 16, 7279, 28486, 813, 6485, 13, 288, 203, 3639, 2144, 20319, 67, 287, 8907, 67, 1467, 273, 2361, 18, 1896, 12, 10477, 18, 1154, 12, 957, 6485, 18, 1467, 9334, 2371, 3631, 576, 1769, 203, 3639, 2144, 20319, 67, 1080, 67, 2469, 273, 2361, 18, 1154, 12, 957, 6485, 18, 1467, 9334, 2130, 1769, 203, 3639, 514, 3999, 780, 273, 514, 18, 2139, 12, 23081, 39, 67, 5804, 16, 20319, 67, 287, 8907, 67, 1467, 16, 20319, 67, 1080, 67, 2469, 1769, 203, 3639, 514, 8526, 4309, 273, 394, 514, 63, 7073, 6, 6899, 16711, 397, 3999, 780, 397, 11883, 20451, 203, 3639, 642, 5653, 4844, 12, 9597, 1769, 203, 203, 3639, 445, 26795, 18, 6208, 1972, 5621, 203, 3639, 19245, 18, 1884, 3442, 12, 2338, 617, 317, 906, 617, 18, 8837, 12, 957, 6485, 16, 445, 26795, 10019, 203, 3639, 22813, 18, 1884, 3442, 12, 304, 3450, 307, 317, 31087, 18, 8837, 12, 957, 6485, 16, 445, 26795, 10019, 203, 3639, 25809, 18, 1884, 3442, 12, 22082, 317, 10163, 18, 8837, 12, 957, 6485, 16, 445, 26795, 10019, 203, 3639, 24118, 18, 1884, 3442, 12, 5999, 317, 2688, 18, 8837, 12, 957, 6485, 16, 445, 26795, 10019, 203, 203, 3639, 364, 261, 474, 277, 273, 374, 31, 277, 411, 445, 26795, 18, 1467, 951, 6078, 1012, 5621, 277, 27245, 288, 203, 5411, 514, 508, 273, 445, 26795, 18, 588, 12089, 12, 77, 2934, 588, 1138, 461, 5621, 203, 5411, 1645, 460, 273, 445, 26795, 18, 588, 12089, 620, 12, 77, 1769, 203, 5411, 1620, 261, 529, 13, 288, 203, 7734, 648, 315, 3645, 6877, 203, 10792, 2089, 18, 3645, 12, 1132, 1769, 203, 10792, 898, 31, 203, 7734, 648, 315, 1154, 6877, 203, 10792, 2089, 18, 1154, 12, 1132, 1769, 203, 10792, 898, 31, 203, 7734, 648, 315, 1896, 6877, 203, 10792, 2089, 18, 1896, 12, 1132, 1769, 203, 10792, 898, 31, 203, 7734, 648, 315, 1364, 6877, 203, 10792, 2089, 18, 1364, 12, 1132, 1769, 203, 10792, 898, 31, 203, 7734, 648, 315, 14141, 6877, 203, 10792, 2089, 18, 14141, 12, 1132, 1769, 203, 10792, 898, 31, 203, 7734, 648, 315, 1883, 6877, 203, 10792, 2089, 18, 1883, 12443, 5748, 13, 460, 1769, 203, 10792, 898, 31, 203, 5411, 289, 203, 3639, 289, 203, 3639, 364, 261, 474, 277, 273, 374, 31, 277, 411, 445, 26795, 18, 1467, 951, 979, 23723, 5621, 277, 27245, 288, 203, 5411, 514, 508, 273, 445, 26795, 18, 588, 9418, 12, 77, 2934, 588, 1138, 461, 5621, 203, 5411, 1250, 460, 273, 445, 26795, 18, 588, 9418, 620, 12, 77, 1769, 203, 5411, 1620, 261, 529, 13, 288, 203, 7734, 648, 315, 88, 20262, 6877, 203, 10792, 2089, 18, 88, 20262, 12, 1132, 1769, 203, 10792, 898, 31, 203, 5411, 289, 203, 3639, 289, 203, 3639, 364, 261, 474, 277, 273, 374, 31, 277, 411, 445, 26795, 18, 1467, 951, 25100, 899, 5621, 277, 27245, 288, 203, 5411, 514, 508, 273, 445, 26795, 18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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
[ 1, 26873, 203, 377, 380, 20377, 279, 666, 434, 3853, 358, 279, 18677, 2441, 203, 377, 380, 203, 377, 380, 632, 2463, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
d5c7a68db9e5fa2e1c388eeec14ca31799808205
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/functions/aggregation/Median.java
[ "Apache-2.0" ]
Java
execute
null
@Override public void execute(MetricTimeSeries timeSeries, FunctionValueMap functionValueMap) { // we need a sorted time series timeSeries.sort(); // If it is empty, we return NaN if (timeSeries.size() <= 0) { functionValueMap.add(this, Double.NaN); return; } // Else calculate the analysis value double[] clonedSeries = timeSeries.getValuesAsArray(); double median; if (clonedSeries.length % 2 == 0) { median = (clonedSeries[clonedSeries.length / 2] + (double) clonedSeries[clonedSeries.length / 2 - 1]) / 2; } else { median = clonedSeries[clonedSeries.length / 2]; } functionValueMap.add(this, median); }
/** * Computes the median value of timeseries. * * @param timeSeries the time series * @return The median value. */
Computes the median value of timeseries. @param timeSeries the time series @return The median value.
[ "Computes", "the", "median", "value", "of", "timeseries", ".", "@param", "timeSeries", "the", "time", "series", "@return", "The", "median", "value", "." ]
@Override public void execute(MetricTimeSeries timeSeries, FunctionValueMap functionValueMap) { timeSeries.sort(); if (timeSeries.size() <= 0) { functionValueMap.add(this, Double.NaN); return; } double[] clonedSeries = timeSeries.getValuesAsArray(); double median; if (clonedSeries.length % 2 == 0) { median = (clonedSeries[clonedSeries.length / 2] + (double) clonedSeries[clonedSeries.length / 2 - 1]) / 2; } else { median = clonedSeries[clonedSeries.length / 2]; } functionValueMap.add(this, median); }
[ "@", "Override", "public", "void", "execute", "(", "MetricTimeSeries", "timeSeries", ",", "FunctionValueMap", "functionValueMap", ")", "{", "timeSeries", ".", "sort", "(", ")", ";", "if", "(", "timeSeries", ".", "size", "(", ")", "<=", "0", ")", "{", "functionValueMap", ".", "add", "(", "this", ",", "Double", ".", "NaN", ")", ";", "return", ";", "}", "double", "[", "]", "clonedSeries", "=", "timeSeries", ".", "getValuesAsArray", "(", ")", ";", "double", "median", ";", "if", "(", "clonedSeries", ".", "length", "%", "2", "==", "0", ")", "{", "median", "=", "(", "clonedSeries", "[", "clonedSeries", ".", "length", "/", "2", "]", "+", "(", "double", ")", "clonedSeries", "[", "clonedSeries", ".", "length", "/", "2", "-", "1", "]", ")", "/", "2", ";", "}", "else", "{", "median", "=", "clonedSeries", "[", "clonedSeries", ".", "length", "/", "2", "]", ";", "}", "functionValueMap", ".", "add", "(", "this", ",", "median", ")", ";", "}" ]
Computes the median value of timeseries.
[ "Computes", "the", "median", "value", "of", "timeseries", "." ]
[ "// we need a sorted time series", "// If it is empty, we return NaN", "// Else calculate the analysis value" ]
[ { "param": "timeSeries", "type": "MetricTimeSeries" }, { "param": "functionValueMap", "type": "FunctionValueMap" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "timeSeries", "type": "MetricTimeSeries", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "functionValueMap", "type": "FunctionValueMap", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 565, 1071, 918, 1836, 12, 5396, 28486, 813, 6485, 16, 4284, 26795, 445, 26795, 13, 288, 203, 203, 3639, 368, 732, 1608, 279, 3115, 813, 4166, 203, 3639, 813, 6485, 18, 3804, 5621, 203, 203, 3639, 368, 971, 518, 353, 1008, 16, 732, 327, 10180, 203, 3639, 309, 261, 957, 6485, 18, 1467, 1435, 1648, 374, 13, 288, 203, 5411, 445, 26795, 18, 1289, 12, 2211, 16, 3698, 18, 21172, 1769, 203, 5411, 327, 31, 203, 3639, 289, 203, 203, 3639, 368, 16289, 4604, 326, 6285, 460, 203, 3639, 1645, 8526, 13027, 6485, 273, 813, 6485, 18, 588, 1972, 19196, 5621, 203, 3639, 1645, 12644, 31, 203, 203, 3639, 309, 261, 830, 8184, 6485, 18, 2469, 738, 576, 422, 374, 13, 288, 203, 5411, 12644, 273, 261, 830, 8184, 6485, 63, 830, 8184, 6485, 18, 2469, 342, 576, 65, 203, 10792, 397, 261, 9056, 13, 13027, 6485, 63, 830, 8184, 6485, 18, 2469, 342, 576, 300, 404, 5717, 342, 576, 31, 203, 3639, 289, 203, 3639, 469, 288, 203, 5411, 12644, 273, 13027, 6485, 63, 830, 8184, 6485, 18, 2469, 342, 576,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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 14169, 281, 326, 12644, 460, 434, 18677, 18, 203, 377, 380, 203, 377, 380, 632, 891, 813, 6485, 326, 813, 4166, 203, 377, 380, 632, 2463, 1021, 12644, 460, 18, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
4fc9ca3672bbf1dd7a3858e134e36be341a8a1d2
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/query/QueryEvaluator.java
[ "Apache-2.0" ]
Java
extractFunctions
TypeFunctions
public static TypeFunctions extractFunctions(String[] chronixFunctions) { //The result that contains the asked analyses final TypeFunctions result = new TypeFunctions(); //Check if there are filter queries with functions if (isEmpty(chronixFunctions)) { //return a empty result return result; } //Placeholder for arguments String[] arguments = new String[0]; //Iterate over all filter queries for (String unmodifiedAnalysis : chronixFunctions) { //For each type String[] types = unmodifiedAnalysis.split(TYPE_SPLITS); for (String type : types) { //split the type functions String typeName = type.substring(0, type.indexOf(TYPE_FUNCTION_START)); ChronixType chronixType = new MetricType();//plugInTypes.getTypeForName(typeName); if (chronixType == null) { LOGGER.info("Type {} not supported", typeName); continue; } QueryFunctions resultingTypeFunctions = new QueryFunctions(); String typeFunctions = type.substring(type.indexOf(TYPE_FUNCTION_START)).replaceAll("(\\{|\\})", ""); String[] queryFunctions = typeFunctions.split(FUNCTION_ARGUMENT_SPLITTER); //run over the functions for (String queryFunction : queryFunctions) { //function has an argument if (queryFunction.contains(AGGREGATION_ARGUMENT_DELIMITER)) { arguments = extractAggregationParameter(queryFunction); queryFunction = queryFunction.substring(0, queryFunction.indexOf(AGGREGATION_ARGUMENT_DELIMITER)); } ChronixFunction chronixFunction = chronixType.getFunction(queryFunction, arguments); //No function found. if (chronixFunction == null) { LOGGER.error("Could not find custom function {} for type {}", queryFunction, typeName); continue; } switch (chronixFunction.getType()) { case AGGREGATION: resultingTypeFunctions.addAggregation((ChronixAggregation) chronixFunction); break; case TRANSFORMATION: resultingTypeFunctions.addTransformation((ChronixTransformation) chronixFunction); break; case ANALYSIS: resultingTypeFunctions.addAnalysis((ChronixAnalysis) chronixFunction); break; case ENCODING: resultingTypeFunctions.addEncoding((ChronixEncoding) chronixFunction); break; default: //ignore break; } } result.setTypeFunctions(chronixType, resultingTypeFunctions); } } return result; }
/** * Analyzes the filter queries and parses them for chronix fucntions * * @param chronixFunctions the filter queries (solr api) * @return a set of chronix analyses asked in the filter queries */
Analyzes the filter queries and parses them for chronix fucntions @param chronixFunctions the filter queries (solr api) @return a set of chronix analyses asked in the filter queries
[ "Analyzes", "the", "filter", "queries", "and", "parses", "them", "for", "chronix", "fucntions", "@param", "chronixFunctions", "the", "filter", "queries", "(", "solr", "api", ")", "@return", "a", "set", "of", "chronix", "analyses", "asked", "in", "the", "filter", "queries" ]
public static TypeFunctions extractFunctions(String[] chronixFunctions) { final TypeFunctions result = new TypeFunctions(); if (isEmpty(chronixFunctions)) { return result; } String[] arguments = new String[0]; for (String unmodifiedAnalysis : chronixFunctions) { String[] types = unmodifiedAnalysis.split(TYPE_SPLITS); for (String type : types) { String typeName = type.substring(0, type.indexOf(TYPE_FUNCTION_START)); ChronixType chronixType = new MetricType(); if (chronixType == null) { LOGGER.info("Type {} not supported", typeName); continue; } QueryFunctions resultingTypeFunctions = new QueryFunctions(); String typeFunctions = type.substring(type.indexOf(TYPE_FUNCTION_START)).replaceAll("(\\{|\\})", ""); String[] queryFunctions = typeFunctions.split(FUNCTION_ARGUMENT_SPLITTER); for (String queryFunction : queryFunctions) { if (queryFunction.contains(AGGREGATION_ARGUMENT_DELIMITER)) { arguments = extractAggregationParameter(queryFunction); queryFunction = queryFunction.substring(0, queryFunction.indexOf(AGGREGATION_ARGUMENT_DELIMITER)); } ChronixFunction chronixFunction = chronixType.getFunction(queryFunction, arguments); if (chronixFunction == null) { LOGGER.error("Could not find custom function {} for type {}", queryFunction, typeName); continue; } switch (chronixFunction.getType()) { case AGGREGATION: resultingTypeFunctions.addAggregation((ChronixAggregation) chronixFunction); break; case TRANSFORMATION: resultingTypeFunctions.addTransformation((ChronixTransformation) chronixFunction); break; case ANALYSIS: resultingTypeFunctions.addAnalysis((ChronixAnalysis) chronixFunction); break; case ENCODING: resultingTypeFunctions.addEncoding((ChronixEncoding) chronixFunction); break; default: break; } } result.setTypeFunctions(chronixType, resultingTypeFunctions); } } return result; }
[ "public", "static", "TypeFunctions", "extractFunctions", "(", "String", "[", "]", "chronixFunctions", ")", "{", "final", "TypeFunctions", "result", "=", "new", "TypeFunctions", "(", ")", ";", "if", "(", "isEmpty", "(", "chronixFunctions", ")", ")", "{", "return", "result", ";", "}", "String", "[", "]", "arguments", "=", "new", "String", "[", "0", "]", ";", "for", "(", "String", "unmodifiedAnalysis", ":", "chronixFunctions", ")", "{", "String", "[", "]", "types", "=", "unmodifiedAnalysis", ".", "split", "(", "TYPE_SPLITS", ")", ";", "for", "(", "String", "type", ":", "types", ")", "{", "String", "typeName", "=", "type", ".", "substring", "(", "0", ",", "type", ".", "indexOf", "(", "TYPE_FUNCTION_START", ")", ")", ";", "ChronixType", "chronixType", "=", "new", "MetricType", "(", ")", ";", "if", "(", "chronixType", "==", "null", ")", "{", "LOGGER", ".", "info", "(", "\"Type {} not supported\"", ",", "typeName", ")", ";", "continue", ";", "}", "QueryFunctions", "resultingTypeFunctions", "=", "new", "QueryFunctions", "(", ")", ";", "String", "typeFunctions", "=", "type", ".", "substring", "(", "type", ".", "indexOf", "(", "TYPE_FUNCTION_START", ")", ")", ".", "replaceAll", "(", "\"(\\\\{|\\\\})\"", ",", "\"\"", ")", ";", "String", "[", "]", "queryFunctions", "=", "typeFunctions", ".", "split", "(", "FUNCTION_ARGUMENT_SPLITTER", ")", ";", "for", "(", "String", "queryFunction", ":", "queryFunctions", ")", "{", "if", "(", "queryFunction", ".", "contains", "(", "AGGREGATION_ARGUMENT_DELIMITER", ")", ")", "{", "arguments", "=", "extractAggregationParameter", "(", "queryFunction", ")", ";", "queryFunction", "=", "queryFunction", ".", "substring", "(", "0", ",", "queryFunction", ".", "indexOf", "(", "AGGREGATION_ARGUMENT_DELIMITER", ")", ")", ";", "}", "ChronixFunction", "chronixFunction", "=", "chronixType", ".", "getFunction", "(", "queryFunction", ",", "arguments", ")", ";", "if", "(", "chronixFunction", "==", "null", ")", "{", "LOGGER", ".", "error", "(", "\"Could not find custom function {} for type {}\"", ",", "queryFunction", ",", "typeName", ")", ";", "continue", ";", "}", "switch", "(", "chronixFunction", ".", "getType", "(", ")", ")", "{", "case", "AGGREGATION", ":", "resultingTypeFunctions", ".", "addAggregation", "(", "(", "ChronixAggregation", ")", "chronixFunction", ")", ";", "break", ";", "case", "TRANSFORMATION", ":", "resultingTypeFunctions", ".", "addTransformation", "(", "(", "ChronixTransformation", ")", "chronixFunction", ")", ";", "break", ";", "case", "ANALYSIS", ":", "resultingTypeFunctions", ".", "addAnalysis", "(", "(", "ChronixAnalysis", ")", "chronixFunction", ")", ";", "break", ";", "case", "ENCODING", ":", "resultingTypeFunctions", ".", "addEncoding", "(", "(", "ChronixEncoding", ")", "chronixFunction", ")", ";", "break", ";", "default", ":", "break", ";", "}", "}", "result", ".", "setTypeFunctions", "(", "chronixType", ",", "resultingTypeFunctions", ")", ";", "}", "}", "return", "result", ";", "}" ]
Analyzes the filter queries and parses them for chronix fucntions @param chronixFunctions the filter queries (solr api) @return a set of chronix analyses asked in the filter queries
[ "Analyzes", "the", "filter", "queries", "and", "parses", "them", "for", "chronix", "fucntions", "@param", "chronixFunctions", "the", "filter", "queries", "(", "solr", "api", ")", "@return", "a", "set", "of", "chronix", "analyses", "asked", "in", "the", "filter", "queries" ]
[ "//The result that contains the asked analyses", "//Check if there are filter queries with functions", "//return a empty result", "//Placeholder for arguments", "//Iterate over all filter queries", "//For each type", "//split the type functions", "//plugInTypes.getTypeForName(typeName);", "//run over the functions", "//function has an argument", "//No function found.", "//ignore" ]
[ { "param": "chronixFunctions", "type": "String[]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "chronixFunctions", "type": "String[]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 760, 1412, 7503, 2608, 7503, 12, 780, 8526, 12227, 697, 7503, 13, 288, 203, 203, 3639, 368, 1986, 563, 716, 1914, 326, 19279, 22813, 203, 3639, 727, 1412, 7503, 563, 273, 394, 1412, 7503, 5621, 203, 3639, 368, 1564, 309, 1915, 854, 1034, 6218, 598, 4186, 203, 3639, 309, 261, 291, 1921, 12, 29115, 697, 7503, 3719, 288, 203, 5411, 368, 2463, 279, 1008, 563, 203, 5411, 327, 563, 31, 203, 3639, 289, 203, 203, 3639, 368, 14038, 364, 1775, 203, 3639, 514, 8526, 1775, 273, 394, 514, 63, 20, 15533, 203, 203, 3639, 368, 14916, 1879, 777, 1034, 6218, 203, 3639, 364, 261, 780, 30481, 9418, 294, 12227, 697, 7503, 13, 288, 203, 203, 5411, 368, 1290, 1517, 618, 203, 5411, 514, 8526, 1953, 273, 30481, 9418, 18, 4939, 12, 2399, 67, 3118, 48, 10158, 1769, 203, 203, 5411, 364, 261, 780, 618, 294, 1953, 13, 288, 203, 203, 7734, 368, 4939, 326, 618, 4186, 203, 7734, 514, 8173, 273, 618, 18, 28023, 12, 20, 16, 618, 18, 31806, 12, 2399, 67, 7788, 67, 7570, 10019, 203, 203, 7734, 13110, 697, 559, 12227, 697, 559, 273, 394, 7279, 559, 5621, 759, 22045, 382, 2016, 18, 588, 559, 1290, 461, 12, 723, 461, 1769, 203, 203, 7734, 309, 261, 29115, 697, 559, 422, 446, 13, 288, 203, 10792, 4145, 18, 1376, 2932, 559, 2618, 486, 3260, 3113, 8173, 1769, 203, 10792, 1324, 31, 203, 7734, 289, 203, 203, 7734, 2770, 7503, 8156, 559, 7503, 273, 394, 2770, 7503, 5621, 203, 7734, 514, 618, 7503, 273, 618, 18, 28023, 12, 723, 18, 31806, 12, 2399, 67, 7788, 67, 7570, 13, 2934, 2079, 1595, 2932, 24480, 95, 26984, 12646, 16, 1408, 1769, 203, 7734, 514, 8526, 843, 7503, 273, 618, 7503, 18, 4939, 12, 7788, 67, 18311, 67, 17482, 2560, 1769, 203, 203, 7734, 368, 2681, 1879, 326, 4186, 203, 7734, 364, 261, 780, 843, 2083, 294, 843, 7503, 13, 288, 203, 10792, 368, 915, 711, 392, 1237, 203, 10792, 309, 261, 2271, 2083, 18, 12298, 12, 1781, 43, 5937, 2689, 67, 18311, 67, 19722, 3719, 288, 203, 13491, 1775, 273, 2608, 12089, 1662, 12, 2271, 2083, 1769, 203, 13491, 843, 2083, 273, 843, 2083, 18, 28023, 12, 20, 16, 843, 2083, 18, 31806, 12, 1781, 43, 5937, 2689, 67, 18311, 67, 19722, 10019, 203, 10792, 289, 203, 203, 10792, 13110, 697, 2083, 12227, 697, 2083, 273, 12227, 697, 559, 18, 588, 2083, 12, 2271, 2083, 16, 1775, 1769, 203, 203, 10792, 368, 2279, 445, 1392, 18, 203, 203, 10792, 309, 261, 29115, 697, 2083, 422, 446, 13, 288, 203, 13491, 4145, 18, 1636, 2932, 4445, 486, 1104, 1679, 445, 2618, 364, 618, 3728, 16, 843, 2083, 16, 8173, 1769, 203, 13491, 1324, 31, 203, 10792, 289, 203, 203, 203, 10792, 1620, 261, 29115, 697, 2083, 18, 588, 559, 10756, 288, 203, 13491, 648, 432, 19491, 5937, 2689, 30, 203, 18701, 8156, 559, 7503, 18, 1289, 12089, 12443, 20235, 697, 12089, 13, 12227, 697, 2083, 1769, 203, 18701, 898, 31, 203, 13491, 648, 28093, 23805, 30, 203, 2 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,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 471, 8940, 2182, 364, 12227, 697, 284, 5286, 496, 1115, 203, 377, 380, 203, 377, 380, 632, 891, 12227, 697, 7503, 326, 1034, 6218, 261, 22495, 1536, 13, 203, 377, 380, 632, 2463, 279, 444, 434, 12227, 697, 22813, 19279, 316, 326, 1034, 6218, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
4fc9ca3672bbf1dd7a3858e134e36be341a8a1d2
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/query/QueryEvaluator.java
[ "Apache-2.0" ]
Java
isEmpty
null
private static boolean isEmpty(String[] fqs) { if (fqs == null || fqs.length == 0) { return true; } for (String fq : fqs) { if (!fq.isEmpty()) { return false; } } return true; }
/** * Helper to check if the given string array is empty. * A string is empty if it is null, or "" * * @param fqs the string array * @return true if empty, otherwise false */
Helper to check if the given string array is empty. A string is empty if it is null, or "" @param fqs the string array @return true if empty, otherwise false
[ "Helper", "to", "check", "if", "the", "given", "string", "array", "is", "empty", ".", "A", "string", "is", "empty", "if", "it", "is", "null", "or", "\"", "\"", "@param", "fqs", "the", "string", "array", "@return", "true", "if", "empty", "otherwise", "false" ]
private static boolean isEmpty(String[] fqs) { if (fqs == null || fqs.length == 0) { return true; } for (String fq : fqs) { if (!fq.isEmpty()) { return false; } } return true; }
[ "private", "static", "boolean", "isEmpty", "(", "String", "[", "]", "fqs", ")", "{", "if", "(", "fqs", "==", "null", "||", "fqs", ".", "length", "==", "0", ")", "{", "return", "true", ";", "}", "for", "(", "String", "fq", ":", "fqs", ")", "{", "if", "(", "!", "fq", ".", "isEmpty", "(", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Helper to check if the given string array is empty.
[ "Helper", "to", "check", "if", "the", "given", "string", "array", "is", "empty", "." ]
[]
[ { "param": "fqs", "type": "String[]" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fqs", "type": "String[]", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 3238, 760, 1250, 2709, 12, 780, 8526, 8508, 87, 13, 288, 203, 3639, 309, 261, 74, 12926, 422, 446, 747, 8508, 87, 18, 2469, 422, 374, 13, 288, 203, 5411, 327, 638, 31, 203, 3639, 289, 203, 203, 3639, 364, 261, 780, 8508, 294, 8508, 87, 13, 288, 203, 5411, 309, 16051, 19206, 18, 291, 1921, 10756, 288, 203, 7734, 327, 629, 31, 203, 5411, 289, 203, 3639, 289, 203, 3639, 327, 638, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 9705, 358, 866, 309, 326, 864, 533, 526, 353, 1008, 18, 203, 377, 380, 432, 533, 353, 1008, 309, 518, 353, 446, 16, 578, 1408, 203, 377, 380, 203, 377, 380, 632, 891, 8508, 87, 326, 533, 526, 203, 377, 380, 632, 2463, 638, 309, 1008, 16, 3541, 629, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
7cb9b1b99fb996c81f53098f6ff5831d5428f11c
Hurence/historian
historian-server/src/main/java/com/hurence/webapiservice/historian/handler/GetSeriesHandler.java
[ "Apache-2.0" ]
Java
buildTagNamesQuery
SolrQuery
private SolrQuery buildTagNamesQuery(JsonObject params) { // compute date range query Long from = params.getLong(HistorianServiceFields.FROM); Long to = params.getLong(HistorianServiceFields.TO); String dateRange = String.format("%s:[* TO %d] AND %s:[%d TO *]", SOLR_COLUMN_START, to, SOLR_COLUMN_END, from); // compute tags filter query SolrQuery query = new SolrQuery(); query.setQuery(dateRange); query.setFilterQueries(params.getString(LUCENE_QUERY)); query.setRows(20); query.setFields(SOLR_COLUMN_METRIC_KEY); LOGGER.info("TagNamesQuery : {}", query.toQueryString()); return query; }
/** * try to retrieve possible tags for a metric name in a given time range * * @param params * @return */
try to retrieve possible tags for a metric name in a given time range @param params @return
[ "try", "to", "retrieve", "possible", "tags", "for", "a", "metric", "name", "in", "a", "given", "time", "range", "@param", "params", "@return" ]
private SolrQuery buildTagNamesQuery(JsonObject params) { Long from = params.getLong(HistorianServiceFields.FROM); Long to = params.getLong(HistorianServiceFields.TO); String dateRange = String.format("%s:[* TO %d] AND %s:[%d TO *]", SOLR_COLUMN_START, to, SOLR_COLUMN_END, from); SolrQuery query = new SolrQuery(); query.setQuery(dateRange); query.setFilterQueries(params.getString(LUCENE_QUERY)); query.setRows(20); query.setFields(SOLR_COLUMN_METRIC_KEY); LOGGER.info("TagNamesQuery : {}", query.toQueryString()); return query; }
[ "private", "SolrQuery", "buildTagNamesQuery", "(", "JsonObject", "params", ")", "{", "Long", "from", "=", "params", ".", "getLong", "(", "HistorianServiceFields", ".", "FROM", ")", ";", "Long", "to", "=", "params", ".", "getLong", "(", "HistorianServiceFields", ".", "TO", ")", ";", "String", "dateRange", "=", "String", ".", "format", "(", "\"%s:[* TO %d] AND %s:[%d TO *]\"", ",", "SOLR_COLUMN_START", ",", "to", ",", "SOLR_COLUMN_END", ",", "from", ")", ";", "SolrQuery", "query", "=", "new", "SolrQuery", "(", ")", ";", "query", ".", "setQuery", "(", "dateRange", ")", ";", "query", ".", "setFilterQueries", "(", "params", ".", "getString", "(", "LUCENE_QUERY", ")", ")", ";", "query", ".", "setRows", "(", "20", ")", ";", "query", ".", "setFields", "(", "SOLR_COLUMN_METRIC_KEY", ")", ";", "LOGGER", ".", "info", "(", "\"TagNamesQuery : {}\"", ",", "query", ".", "toQueryString", "(", ")", ")", ";", "return", "query", ";", "}" ]
try to retrieve possible tags for a metric name in a given time range @param params @return
[ "try", "to", "retrieve", "possible", "tags", "for", "a", "metric", "name", "in", "a", "given", "time", "range", "@param", "params", "@return" ]
[ "// compute date range query", "// compute tags filter query" ]
[ { "param": "params", "type": "JsonObject" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "params", "type": "JsonObject", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 3238, 19026, 1138, 1361, 1805, 1557, 1138, 12, 23857, 859, 13, 288, 203, 203, 3639, 368, 3671, 1509, 1048, 843, 203, 3639, 3407, 628, 273, 859, 18, 588, 3708, 12, 8648, 280, 2779, 1179, 2314, 18, 11249, 1769, 203, 3639, 3407, 358, 273, 859, 18, 588, 3708, 12, 8648, 280, 2779, 1179, 2314, 18, 4296, 1769, 203, 3639, 514, 1509, 2655, 273, 514, 18, 2139, 27188, 87, 30, 63, 14, 8493, 738, 72, 65, 4116, 738, 87, 30, 14451, 72, 8493, 380, 65, 3113, 27175, 54, 67, 11009, 67, 7570, 16, 358, 16, 27175, 54, 67, 11009, 67, 4415, 16, 628, 1769, 203, 203, 3639, 368, 3671, 2342, 1034, 843, 203, 3639, 19026, 1138, 843, 273, 394, 19026, 1138, 5621, 203, 3639, 843, 18, 542, 1138, 12, 712, 2655, 1769, 203, 3639, 843, 18, 542, 1586, 9592, 12, 2010, 18, 588, 780, 12, 11778, 39, 1157, 41, 67, 10753, 10019, 203, 3639, 843, 18, 542, 4300, 12, 3462, 1769, 203, 3639, 843, 18, 542, 2314, 12, 19815, 54, 67, 11009, 67, 23081, 39, 67, 3297, 1769, 203, 3639, 4145, 18, 1376, 2932, 1805, 1557, 1138, 294, 3728, 16, 843, 18, 869, 15276, 10663, 203, 203, 3639, 327, 843, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 775, 358, 4614, 3323, 2342, 364, 279, 3999, 508, 316, 279, 864, 813, 1048, 203, 377, 380, 203, 377, 380, 632, 891, 859, 203, 377, 380, 632, 2463, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
7cb9b1b99fb996c81f53098f6ff5831d5428f11c
Hurence/historian
historian-server/src/main/java/com/hurence/webapiservice/historian/handler/GetSeriesHandler.java
[ "Apache-2.0" ]
Java
buildTagValuesQuery
SolrQuery
private SolrQuery buildTagValuesQuery(JsonObject params, String tagName) { // buld final query SolrQuery query = buildTagNamesQuery(params); query.setRows(0); query.setFacet(true); query.setFacetMinCount(1); query.setFacetLimit(50); query.addFacetField(tagName); LOGGER.info("TagValuesQuery : {}", query.toQueryString()); return query; }
/** * try to retrieve possible values for a metric name in a given time range * for the given tags * * @param params * @return */
try to retrieve possible values for a metric name in a given time range for the given tags @param params @return
[ "try", "to", "retrieve", "possible", "values", "for", "a", "metric", "name", "in", "a", "given", "time", "range", "for", "the", "given", "tags", "@param", "params", "@return" ]
private SolrQuery buildTagValuesQuery(JsonObject params, String tagName) { SolrQuery query = buildTagNamesQuery(params); query.setRows(0); query.setFacet(true); query.setFacetMinCount(1); query.setFacetLimit(50); query.addFacetField(tagName); LOGGER.info("TagValuesQuery : {}", query.toQueryString()); return query; }
[ "private", "SolrQuery", "buildTagValuesQuery", "(", "JsonObject", "params", ",", "String", "tagName", ")", "{", "SolrQuery", "query", "=", "buildTagNamesQuery", "(", "params", ")", ";", "query", ".", "setRows", "(", "0", ")", ";", "query", ".", "setFacet", "(", "true", ")", ";", "query", ".", "setFacetMinCount", "(", "1", ")", ";", "query", ".", "setFacetLimit", "(", "50", ")", ";", "query", ".", "addFacetField", "(", "tagName", ")", ";", "LOGGER", ".", "info", "(", "\"TagValuesQuery : {}\"", ",", "query", ".", "toQueryString", "(", ")", ")", ";", "return", "query", ";", "}" ]
try to retrieve possible values for a metric name in a given time range for the given tags
[ "try", "to", "retrieve", "possible", "values", "for", "a", "metric", "name", "in", "a", "given", "time", "range", "for", "the", "given", "tags" ]
[ "// buld final query" ]
[ { "param": "params", "type": "JsonObject" }, { "param": "tagName", "type": "String" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "params", "type": "JsonObject", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "tagName", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 3238, 19026, 1138, 1361, 1805, 1972, 1138, 12, 23857, 859, 16, 514, 7196, 13, 288, 203, 203, 3639, 368, 30353, 72, 727, 843, 203, 3639, 19026, 1138, 843, 273, 1361, 1805, 1557, 1138, 12, 2010, 1769, 203, 3639, 843, 18, 542, 4300, 12, 20, 1769, 203, 3639, 843, 18, 542, 11137, 12, 3767, 1769, 203, 3639, 843, 18, 542, 11137, 2930, 1380, 12, 21, 1769, 203, 3639, 843, 18, 542, 11137, 3039, 12, 3361, 1769, 203, 3639, 843, 18, 1289, 11137, 974, 12, 2692, 461, 1769, 203, 203, 3639, 4145, 18, 1376, 2932, 1805, 1972, 1138, 294, 3728, 16, 843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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 775, 358, 4614, 3323, 924, 364, 279, 3999, 508, 316, 279, 864, 813, 1048, 203, 377, 380, 364, 326, 864, 2342, 203, 377, 380, 203, 377, 380, 632, 891, 859, 203, 377, 380, 632, 2463, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
e275d994e3c3be9ca19c780b6e353fcbe5538b53
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/converter/MeasuresToChunkVersionCurrent.java
[ "Apache-2.0" ]
Java
computeAndSetAggs
null
private void computeAndSetAggs(Chunk.ChunkBuilder builder, MetricTimeSeries timeSeries) { Integer sax_alphabet_size = Math.max(Math.min(timeSeries.size(), 7), 2); Integer sax_string_length = Math.min(timeSeries.size(), 24); timeSeries.sort(); final List<Double> values = timeSeries.getValues().toList(); final List<Double> qualities = timeSeries.getQualities().toList(); final List<Long> timestamps = timeSeries.getTimestamps().toList(); // set quality stats if needed TimeseriesAnalysis qualitiesAnalysis = TimeseriesAnalyzer.builder() .computeOutlier(false) .computeStats(true) .computeTrend(false) .build() .run(timestamps, qualities); if (qualitiesAnalysis.getCount() > 0) { builder.qualityFirst(timeSeries.getQuality(0)); builder.qualitySum((float) qualitiesAnalysis.getSum()); builder.qualityMin((float) qualitiesAnalysis.getMin()); builder.qualityMax((float) qualitiesAnalysis.getMax()); builder.qualityAvg((float) qualitiesAnalysis.getMean()); } // compute stats for values TimeseriesAnalysis valuesAnalysis = TimeseriesAnalyzer.builder() .computeOutlier(true) .computeStats(true) .computeTrend(true) .build() .run(timestamps, values); builder.first(valuesAnalysis.getFirst()); builder.last(valuesAnalysis.getLast()); builder.min(valuesAnalysis.getMin()); builder.max(valuesAnalysis.getMax()); builder.sum(valuesAnalysis.getSum()); builder.avg(valuesAnalysis.getMean()); builder.count(valuesAnalysis.getCount()); builder.stdDev(valuesAnalysis.getStdDev()); builder.trend(valuesAnalysis.isHasTrend()); builder.outlier(valuesAnalysis.isHasOutlier()); // finish with sax SaxConverter converter = SaxConverter.builder() .alphabetSize(sax_alphabet_size) .paaSize(sax_string_length) .build(); String sax = converter.run(values); builder.sax(sax); }
/** * Converts a list of records to a timeseries chunk * * @return */
Converts a list of records to a timeseries chunk @return
[ "Converts", "a", "list", "of", "records", "to", "a", "timeseries", "chunk", "@return" ]
private void computeAndSetAggs(Chunk.ChunkBuilder builder, MetricTimeSeries timeSeries) { Integer sax_alphabet_size = Math.max(Math.min(timeSeries.size(), 7), 2); Integer sax_string_length = Math.min(timeSeries.size(), 24); timeSeries.sort(); final List<Double> values = timeSeries.getValues().toList(); final List<Double> qualities = timeSeries.getQualities().toList(); final List<Long> timestamps = timeSeries.getTimestamps().toList(); TimeseriesAnalysis qualitiesAnalysis = TimeseriesAnalyzer.builder() .computeOutlier(false) .computeStats(true) .computeTrend(false) .build() .run(timestamps, qualities); if (qualitiesAnalysis.getCount() > 0) { builder.qualityFirst(timeSeries.getQuality(0)); builder.qualitySum((float) qualitiesAnalysis.getSum()); builder.qualityMin((float) qualitiesAnalysis.getMin()); builder.qualityMax((float) qualitiesAnalysis.getMax()); builder.qualityAvg((float) qualitiesAnalysis.getMean()); } TimeseriesAnalysis valuesAnalysis = TimeseriesAnalyzer.builder() .computeOutlier(true) .computeStats(true) .computeTrend(true) .build() .run(timestamps, values); builder.first(valuesAnalysis.getFirst()); builder.last(valuesAnalysis.getLast()); builder.min(valuesAnalysis.getMin()); builder.max(valuesAnalysis.getMax()); builder.sum(valuesAnalysis.getSum()); builder.avg(valuesAnalysis.getMean()); builder.count(valuesAnalysis.getCount()); builder.stdDev(valuesAnalysis.getStdDev()); builder.trend(valuesAnalysis.isHasTrend()); builder.outlier(valuesAnalysis.isHasOutlier()); SaxConverter converter = SaxConverter.builder() .alphabetSize(sax_alphabet_size) .paaSize(sax_string_length) .build(); String sax = converter.run(values); builder.sax(sax); }
[ "private", "void", "computeAndSetAggs", "(", "Chunk", ".", "ChunkBuilder", "builder", ",", "MetricTimeSeries", "timeSeries", ")", "{", "Integer", "sax_alphabet_size", "=", "Math", ".", "max", "(", "Math", ".", "min", "(", "timeSeries", ".", "size", "(", ")", ",", "7", ")", ",", "2", ")", ";", "Integer", "sax_string_length", "=", "Math", ".", "min", "(", "timeSeries", ".", "size", "(", ")", ",", "24", ")", ";", "timeSeries", ".", "sort", "(", ")", ";", "final", "List", "<", "Double", ">", "values", "=", "timeSeries", ".", "getValues", "(", ")", ".", "toList", "(", ")", ";", "final", "List", "<", "Double", ">", "qualities", "=", "timeSeries", ".", "getQualities", "(", ")", ".", "toList", "(", ")", ";", "final", "List", "<", "Long", ">", "timestamps", "=", "timeSeries", ".", "getTimestamps", "(", ")", ".", "toList", "(", ")", ";", "TimeseriesAnalysis", "qualitiesAnalysis", "=", "TimeseriesAnalyzer", ".", "builder", "(", ")", ".", "computeOutlier", "(", "false", ")", ".", "computeStats", "(", "true", ")", ".", "computeTrend", "(", "false", ")", ".", "build", "(", ")", ".", "run", "(", "timestamps", ",", "qualities", ")", ";", "if", "(", "qualitiesAnalysis", ".", "getCount", "(", ")", ">", "0", ")", "{", "builder", ".", "qualityFirst", "(", "timeSeries", ".", "getQuality", "(", "0", ")", ")", ";", "builder", ".", "qualitySum", "(", "(", "float", ")", "qualitiesAnalysis", ".", "getSum", "(", ")", ")", ";", "builder", ".", "qualityMin", "(", "(", "float", ")", "qualitiesAnalysis", ".", "getMin", "(", ")", ")", ";", "builder", ".", "qualityMax", "(", "(", "float", ")", "qualitiesAnalysis", ".", "getMax", "(", ")", ")", ";", "builder", ".", "qualityAvg", "(", "(", "float", ")", "qualitiesAnalysis", ".", "getMean", "(", ")", ")", ";", "}", "TimeseriesAnalysis", "valuesAnalysis", "=", "TimeseriesAnalyzer", ".", "builder", "(", ")", ".", "computeOutlier", "(", "true", ")", ".", "computeStats", "(", "true", ")", ".", "computeTrend", "(", "true", ")", ".", "build", "(", ")", ".", "run", "(", "timestamps", ",", "values", ")", ";", "builder", ".", "first", "(", "valuesAnalysis", ".", "getFirst", "(", ")", ")", ";", "builder", ".", "last", "(", "valuesAnalysis", ".", "getLast", "(", ")", ")", ";", "builder", ".", "min", "(", "valuesAnalysis", ".", "getMin", "(", ")", ")", ";", "builder", ".", "max", "(", "valuesAnalysis", ".", "getMax", "(", ")", ")", ";", "builder", ".", "sum", "(", "valuesAnalysis", ".", "getSum", "(", ")", ")", ";", "builder", ".", "avg", "(", "valuesAnalysis", ".", "getMean", "(", ")", ")", ";", "builder", ".", "count", "(", "valuesAnalysis", ".", "getCount", "(", ")", ")", ";", "builder", ".", "stdDev", "(", "valuesAnalysis", ".", "getStdDev", "(", ")", ")", ";", "builder", ".", "trend", "(", "valuesAnalysis", ".", "isHasTrend", "(", ")", ")", ";", "builder", ".", "outlier", "(", "valuesAnalysis", ".", "isHasOutlier", "(", ")", ")", ";", "SaxConverter", "converter", "=", "SaxConverter", ".", "builder", "(", ")", ".", "alphabetSize", "(", "sax_alphabet_size", ")", ".", "paaSize", "(", "sax_string_length", ")", ".", "build", "(", ")", ";", "String", "sax", "=", "converter", ".", "run", "(", "values", ")", ";", "builder", ".", "sax", "(", "sax", ")", ";", "}" ]
Converts a list of records to a timeseries chunk @return
[ "Converts", "a", "list", "of", "records", "to", "a", "timeseries", "chunk", "@return" ]
[ "// set quality stats if needed", "// compute stats for values", "// finish with sax" ]
[ { "param": "builder", "type": "Chunk.ChunkBuilder" }, { "param": "timeSeries", "type": "MetricTimeSeries" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "builder", "type": "Chunk.ChunkBuilder", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "timeSeries", "type": "MetricTimeSeries", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 3238, 918, 3671, 13152, 2577, 564, 12, 5579, 18, 5579, 1263, 2089, 16, 7279, 28486, 813, 6485, 13, 288, 203, 3639, 2144, 20319, 67, 287, 8907, 67, 1467, 273, 2361, 18, 1896, 12, 10477, 18, 1154, 12, 957, 6485, 18, 1467, 9334, 2371, 3631, 576, 1769, 203, 3639, 2144, 20319, 67, 1080, 67, 2469, 273, 2361, 18, 1154, 12, 957, 6485, 18, 1467, 9334, 4248, 1769, 203, 203, 3639, 813, 6485, 18, 3804, 5621, 203, 3639, 727, 987, 32, 5265, 34, 924, 273, 813, 6485, 18, 588, 1972, 7675, 869, 682, 5621, 203, 3639, 727, 987, 32, 5265, 34, 4544, 1961, 273, 813, 6485, 18, 588, 5628, 1961, 7675, 869, 682, 5621, 203, 3639, 727, 987, 32, 3708, 34, 11267, 273, 813, 6485, 18, 588, 23761, 7675, 869, 682, 5621, 203, 203, 203, 3639, 368, 444, 9312, 3177, 309, 3577, 203, 3639, 399, 4485, 3924, 9418, 4544, 1961, 9418, 273, 399, 4485, 3924, 12803, 18, 9574, 1435, 203, 7734, 263, 9200, 1182, 9800, 12, 5743, 13, 203, 7734, 263, 9200, 4195, 12, 3767, 13, 203, 7734, 263, 9200, 56, 20262, 12, 5743, 13, 203, 7734, 263, 3510, 1435, 203, 7734, 263, 2681, 12, 25459, 16, 4544, 1961, 1769, 203, 203, 3639, 309, 261, 3369, 1961, 9418, 18, 588, 1380, 1435, 405, 374, 13, 288, 203, 5411, 2089, 18, 16495, 3759, 12, 957, 6485, 18, 588, 14846, 12, 20, 10019, 203, 5411, 2089, 18, 16495, 3495, 12443, 5659, 13, 4544, 1961, 9418, 18, 588, 3495, 10663, 203, 5411, 2089, 18, 16495, 2930, 12443, 5659, 13, 4544, 1961, 9418, 18, 588, 2930, 10663, 203, 5411, 2089, 18, 16495, 2747, 12443, 5659, 13, 4544, 1961, 9418, 18, 588, 2747, 10663, 203, 5411, 2089, 18, 16495, 22823, 12443, 5659, 13, 4544, 1961, 9418, 18, 588, 15312, 10663, 203, 3639, 289, 203, 203, 3639, 368, 3671, 3177, 364, 924, 203, 3639, 399, 4485, 3924, 9418, 924, 9418, 273, 399, 4485, 3924, 12803, 18, 9574, 1435, 203, 7734, 263, 9200, 1182, 9800, 12, 3767, 13, 203, 7734, 263, 9200, 4195, 12, 3767, 13, 203, 7734, 263, 9200, 56, 20262, 12, 3767, 13, 203, 7734, 263, 3510, 1435, 203, 7734, 263, 2681, 12, 25459, 16, 924, 1769, 203, 203, 203, 3639, 2089, 18, 3645, 12, 2372, 9418, 18, 588, 3759, 10663, 203, 3639, 2089, 18, 2722, 12, 2372, 9418, 18, 588, 3024, 10663, 203, 3639, 2089, 18, 1154, 12, 2372, 9418, 18, 588, 2930, 10663, 203, 3639, 2089, 18, 1896, 12, 2372, 9418, 18, 588, 2747, 10663, 203, 3639, 2089, 18, 1364, 12, 2372, 9418, 18, 588, 3495, 10663, 203, 3639, 2089, 18, 14141, 12, 2372, 9418, 18, 588, 15312, 10663, 203, 3639, 2089, 18, 1883, 12, 2372, 9418, 18, 588, 1380, 10663, 203, 3639, 2089, 18, 5084, 8870, 12, 2372, 9418, 18, 588, 10436, 8870, 10663, 203, 3639, 2089, 18, 88, 20262, 12, 2372, 9418, 18, 291, 5582, 56, 20262, 10663, 203, 3639, 2089, 18, 659, 9800, 12, 2372, 9418, 18, 291, 5582, 1182, 9800, 10663, 203, 203, 203, 3639, 368, 4076, 598, 20319, 203, 3639, 348, 651, 5072, 6027, 273, 348, 2 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
[ 1, 26873, 203, 377, 380, 20377, 279, 666, 434, 3853, 358, 279, 18677, 2441, 203, 377, 380, 203, 377, 380, 632, 2463, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
c8c02619d7cb16a5a0074264fa4cdc50b46a047d
Hurence/historian
historian-server/src/main/java/com/hurence/webapiservice/http/api/ingestion/ImportRequestParser.java
[ "Apache-2.0" ]
Java
parseJsonImportRequest
CorrectPointsAndErrorMessages
public static CorrectPointsAndErrorMessages parseJsonImportRequest(JsonArray jsonImportRequest) { if (null == jsonImportRequest) { throw new NullPointerException("Null request body"); }else if (jsonImportRequest.isEmpty()) { throw new IllegalArgumentException("Empty request body"); } CorrectPointsAndErrorMessages correctPointsAndErrorMessages = new CorrectPointsAndErrorMessages(); for (Object metricsObject : jsonImportRequest) { JsonObject timeserie = (JsonObject) metricsObject; if (!(timeserie.containsKey(FIELD_NAME))) throw new IllegalArgumentException("Missing a name for at least one metric"); if (((timeserie.getValue(FIELD_NAME) == null) && (timeserie.getValue(POINTS) != null)) || (timeserie.getValue(FIELD_NAME) == "") ) { int numPoints = timeserie.getJsonArray(POINTS).size(); correctPointsAndErrorMessages.errorMessages.add("Ignored "+ numPoints +" measures for metric with name "+timeserie.getValue(FIELD_NAME)+" because this is not a valid name"); continue; } else if (!(timeserie.getValue(FIELD_NAME) instanceof String)) { throw new IllegalArgumentException("A name is not a string for at least one metric"); } else if (!(timeserie.containsKey(POINTS))) { throw new IllegalArgumentException("field 'measures' is required"); } else if ((!(timeserie.getValue(POINTS) instanceof JsonArray)) || (timeserie.getValue(POINTS)==null)) { throw new IllegalArgumentException("field 'measures' : " + timeserie.getValue(POINTS) + " is not an array"); } JsonObject newTimeserie = new JsonObject(); newTimeserie.put(FIELD_NAME, timeserie.getString(FIELD_NAME)); JsonArray newPoints = new JsonArray(); for (Object point : timeserie.getJsonArray(POINTS)) { JsonArray pointArray; String commonErrorMessage = "Ignored 1 measures for metric with name '" + timeserie.getString(FIELD_NAME); try { pointArray = (JsonArray) point; pointArray.size(); } catch (Exception ex) { correctPointsAndErrorMessages.errorMessages.add(commonErrorMessage + "' because it was not an array"); continue; } if (pointArray.size() == 0){ correctPointsAndErrorMessages.errorMessages.add(commonErrorMessage + "' because this point was an empty array"); continue; } else if (pointArray.size() != 2 && pointArray.size() != 3) throw new IllegalArgumentException("Points should be of the form [timestamp, value] or [timestamp, value, quality]"); try { if (pointArray.getLong(0) == null) { correctPointsAndErrorMessages.errorMessages.add(commonErrorMessage + "' because its timestamp is null"); continue; } } catch (Exception e) { correctPointsAndErrorMessages.errorMessages.add(commonErrorMessage + "' because its timestamp is not a long"); continue; } try { if ((pointArray.getDouble(1) == null)) { correctPointsAndErrorMessages.errorMessages.add(commonErrorMessage + "' because its value was not a double"); continue; } } catch (Exception e) { correctPointsAndErrorMessages.errorMessages.add(commonErrorMessage + "' because its value was not a double"); continue; } newPoints.add(pointArray); } if(!newPoints.isEmpty()) { newTimeserie.put(POINTS, newPoints); correctPointsAndErrorMessages.correctPoints.add(newTimeserie); } } if (correctPointsAndErrorMessages.correctPoints.isEmpty()) throw new IllegalArgumentException("There is no valid measures"); return correctPointsAndErrorMessages; }
/** * @param jsonImportRequest JsonArray that have the jsonObjects that will be added, ex : * [ * { * "name": ... * "measures": [ * [time, value, quality], * [time, value, quality] * ] * }, * { * "name": ... * "measures": [ * [time, value], * [time, value] * ] * } * ] * * @return CorrectPointsAndErrorMessages an object that have the correct measures in a jsonArray and a list of the error * messages if there is bad measures */
@return CorrectPointsAndErrorMessages an object that have the correct measures in a jsonArray and a list of the error messages if there is bad measures
[ "@return", "CorrectPointsAndErrorMessages", "an", "object", "that", "have", "the", "correct", "measures", "in", "a", "jsonArray", "and", "a", "list", "of", "the", "error", "messages", "if", "there", "is", "bad", "measures" ]
public static CorrectPointsAndErrorMessages parseJsonImportRequest(JsonArray jsonImportRequest) { if (null == jsonImportRequest) { throw new NullPointerException("Null request body"); }else if (jsonImportRequest.isEmpty()) { throw new IllegalArgumentException("Empty request body"); } CorrectPointsAndErrorMessages correctPointsAndErrorMessages = new CorrectPointsAndErrorMessages(); for (Object metricsObject : jsonImportRequest) { JsonObject timeserie = (JsonObject) metricsObject; if (!(timeserie.containsKey(FIELD_NAME))) throw new IllegalArgumentException("Missing a name for at least one metric"); if (((timeserie.getValue(FIELD_NAME) == null) && (timeserie.getValue(POINTS) != null)) || (timeserie.getValue(FIELD_NAME) == "") ) { int numPoints = timeserie.getJsonArray(POINTS).size(); correctPointsAndErrorMessages.errorMessages.add("Ignored "+ numPoints +" measures for metric with name "+timeserie.getValue(FIELD_NAME)+" because this is not a valid name"); continue; } else if (!(timeserie.getValue(FIELD_NAME) instanceof String)) { throw new IllegalArgumentException("A name is not a string for at least one metric"); } else if (!(timeserie.containsKey(POINTS))) { throw new IllegalArgumentException("field 'measures' is required"); } else if ((!(timeserie.getValue(POINTS) instanceof JsonArray)) || (timeserie.getValue(POINTS)==null)) { throw new IllegalArgumentException("field 'measures' : " + timeserie.getValue(POINTS) + " is not an array"); } JsonObject newTimeserie = new JsonObject(); newTimeserie.put(FIELD_NAME, timeserie.getString(FIELD_NAME)); JsonArray newPoints = new JsonArray(); for (Object point : timeserie.getJsonArray(POINTS)) { JsonArray pointArray; String commonErrorMessage = "Ignored 1 measures for metric with name '" + timeserie.getString(FIELD_NAME); try { pointArray = (JsonArray) point; pointArray.size(); } catch (Exception ex) { correctPointsAndErrorMessages.errorMessages.add(commonErrorMessage + "' because it was not an array"); continue; } if (pointArray.size() == 0){ correctPointsAndErrorMessages.errorMessages.add(commonErrorMessage + "' because this point was an empty array"); continue; } else if (pointArray.size() != 2 && pointArray.size() != 3) throw new IllegalArgumentException("Points should be of the form [timestamp, value] or [timestamp, value, quality]"); try { if (pointArray.getLong(0) == null) { correctPointsAndErrorMessages.errorMessages.add(commonErrorMessage + "' because its timestamp is null"); continue; } } catch (Exception e) { correctPointsAndErrorMessages.errorMessages.add(commonErrorMessage + "' because its timestamp is not a long"); continue; } try { if ((pointArray.getDouble(1) == null)) { correctPointsAndErrorMessages.errorMessages.add(commonErrorMessage + "' because its value was not a double"); continue; } } catch (Exception e) { correctPointsAndErrorMessages.errorMessages.add(commonErrorMessage + "' because its value was not a double"); continue; } newPoints.add(pointArray); } if(!newPoints.isEmpty()) { newTimeserie.put(POINTS, newPoints); correctPointsAndErrorMessages.correctPoints.add(newTimeserie); } } if (correctPointsAndErrorMessages.correctPoints.isEmpty()) throw new IllegalArgumentException("There is no valid measures"); return correctPointsAndErrorMessages; }
[ "public", "static", "CorrectPointsAndErrorMessages", "parseJsonImportRequest", "(", "JsonArray", "jsonImportRequest", ")", "{", "if", "(", "null", "==", "jsonImportRequest", ")", "{", "throw", "new", "NullPointerException", "(", "\"Null request body\"", ")", ";", "}", "else", "if", "(", "jsonImportRequest", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Empty request body\"", ")", ";", "}", "CorrectPointsAndErrorMessages", "correctPointsAndErrorMessages", "=", "new", "CorrectPointsAndErrorMessages", "(", ")", ";", "for", "(", "Object", "metricsObject", ":", "jsonImportRequest", ")", "{", "JsonObject", "timeserie", "=", "(", "JsonObject", ")", "metricsObject", ";", "if", "(", "!", "(", "timeserie", ".", "containsKey", "(", "FIELD_NAME", ")", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"Missing a name for at least one metric\"", ")", ";", "if", "(", "(", "(", "timeserie", ".", "getValue", "(", "FIELD_NAME", ")", "==", "null", ")", "&&", "(", "timeserie", ".", "getValue", "(", "POINTS", ")", "!=", "null", ")", ")", "||", "(", "timeserie", ".", "getValue", "(", "FIELD_NAME", ")", "==", "\"\"", ")", ")", "{", "int", "numPoints", "=", "timeserie", ".", "getJsonArray", "(", "POINTS", ")", ".", "size", "(", ")", ";", "correctPointsAndErrorMessages", ".", "errorMessages", ".", "add", "(", "\"Ignored \"", "+", "numPoints", "+", "\" measures for metric with name \"", "+", "timeserie", ".", "getValue", "(", "FIELD_NAME", ")", "+", "\" because this is not a valid name\"", ")", ";", "continue", ";", "}", "else", "if", "(", "!", "(", "timeserie", ".", "getValue", "(", "FIELD_NAME", ")", "instanceof", "String", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"A name is not a string for at least one metric\"", ")", ";", "}", "else", "if", "(", "!", "(", "timeserie", ".", "containsKey", "(", "POINTS", ")", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"field 'measures' is required\"", ")", ";", "}", "else", "if", "(", "(", "!", "(", "timeserie", ".", "getValue", "(", "POINTS", ")", "instanceof", "JsonArray", ")", ")", "||", "(", "timeserie", ".", "getValue", "(", "POINTS", ")", "==", "null", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"field 'measures' : \"", "+", "timeserie", ".", "getValue", "(", "POINTS", ")", "+", "\" is not an array\"", ")", ";", "}", "JsonObject", "newTimeserie", "=", "new", "JsonObject", "(", ")", ";", "newTimeserie", ".", "put", "(", "FIELD_NAME", ",", "timeserie", ".", "getString", "(", "FIELD_NAME", ")", ")", ";", "JsonArray", "newPoints", "=", "new", "JsonArray", "(", ")", ";", "for", "(", "Object", "point", ":", "timeserie", ".", "getJsonArray", "(", "POINTS", ")", ")", "{", "JsonArray", "pointArray", ";", "String", "commonErrorMessage", "=", "\"Ignored 1 measures for metric with name '\"", "+", "timeserie", ".", "getString", "(", "FIELD_NAME", ")", ";", "try", "{", "pointArray", "=", "(", "JsonArray", ")", "point", ";", "pointArray", ".", "size", "(", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "correctPointsAndErrorMessages", ".", "errorMessages", ".", "add", "(", "commonErrorMessage", "+", "\"' because it was not an array\"", ")", ";", "continue", ";", "}", "if", "(", "pointArray", ".", "size", "(", ")", "==", "0", ")", "{", "correctPointsAndErrorMessages", ".", "errorMessages", ".", "add", "(", "commonErrorMessage", "+", "\"' because this point was an empty array\"", ")", ";", "continue", ";", "}", "else", "if", "(", "pointArray", ".", "size", "(", ")", "!=", "2", "&&", "pointArray", ".", "size", "(", ")", "!=", "3", ")", "throw", "new", "IllegalArgumentException", "(", "\"Points should be of the form [timestamp, value] or [timestamp, value, quality]\"", ")", ";", "try", "{", "if", "(", "pointArray", ".", "getLong", "(", "0", ")", "==", "null", ")", "{", "correctPointsAndErrorMessages", ".", "errorMessages", ".", "add", "(", "commonErrorMessage", "+", "\"' because its timestamp is null\"", ")", ";", "continue", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "correctPointsAndErrorMessages", ".", "errorMessages", ".", "add", "(", "commonErrorMessage", "+", "\"' because its timestamp is not a long\"", ")", ";", "continue", ";", "}", "try", "{", "if", "(", "(", "pointArray", ".", "getDouble", "(", "1", ")", "==", "null", ")", ")", "{", "correctPointsAndErrorMessages", ".", "errorMessages", ".", "add", "(", "commonErrorMessage", "+", "\"' because its value was not a double\"", ")", ";", "continue", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "correctPointsAndErrorMessages", ".", "errorMessages", ".", "add", "(", "commonErrorMessage", "+", "\"' because its value was not a double\"", ")", ";", "continue", ";", "}", "newPoints", ".", "add", "(", "pointArray", ")", ";", "}", "if", "(", "!", "newPoints", ".", "isEmpty", "(", ")", ")", "{", "newTimeserie", ".", "put", "(", "POINTS", ",", "newPoints", ")", ";", "correctPointsAndErrorMessages", ".", "correctPoints", ".", "add", "(", "newTimeserie", ")", ";", "}", "}", "if", "(", "correctPointsAndErrorMessages", ".", "correctPoints", ".", "isEmpty", "(", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"There is no valid measures\"", ")", ";", "return", "correctPointsAndErrorMessages", ";", "}" ]
@param jsonImportRequest JsonArray that have the jsonObjects that will be added, ex : [ { "name": ... "measures": [ [time, value, quality], [time, value, quality] ] }, { "name": ... "measures": [ [time, value], [time, value] ] } ]
[ "@param", "jsonImportRequest", "JsonArray", "that", "have", "the", "jsonObjects", "that", "will", "be", "added", "ex", ":", "[", "{", "\"", "name", "\"", ":", "...", "\"", "measures", "\"", ":", "[", "[", "time", "value", "quality", "]", "[", "time", "value", "quality", "]", "]", "}", "{", "\"", "name", "\"", ":", "...", "\"", "measures", "\"", ":", "[", "[", "time", "value", "]", "[", "time", "value", "]", "]", "}", "]" ]
[]
[ { "param": "jsonImportRequest", "type": "JsonArray" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "jsonImportRequest", "type": "JsonArray", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 760, 30626, 5636, 1876, 668, 5058, 1109, 3185, 5010, 691, 12, 3185, 1076, 1163, 5010, 691, 13, 288, 203, 3639, 309, 261, 2011, 422, 1163, 5010, 691, 13, 288, 203, 5411, 604, 394, 10108, 2932, 2041, 590, 1417, 8863, 203, 3639, 289, 12107, 309, 261, 1977, 5010, 691, 18, 291, 1921, 10756, 288, 203, 5411, 604, 394, 2754, 2932, 1921, 590, 1417, 8863, 203, 3639, 289, 203, 3639, 30626, 5636, 1876, 668, 5058, 3434, 5636, 1876, 668, 5058, 273, 394, 30626, 5636, 1876, 668, 5058, 5621, 203, 3639, 364, 261, 921, 4309, 921, 294, 1163, 5010, 691, 13, 288, 203, 5411, 11596, 4124, 264, 1385, 273, 261, 23857, 13, 4309, 921, 31, 203, 5411, 309, 16051, 12, 8293, 264, 1385, 18, 12298, 653, 12, 6776, 67, 1985, 20349, 203, 7734, 604, 394, 2754, 2932, 4841, 279, 508, 364, 622, 4520, 1245, 3999, 8863, 203, 5411, 309, 261, 12443, 8293, 264, 1385, 18, 24805, 12, 6776, 67, 1985, 13, 422, 446, 13, 597, 261, 8293, 264, 1385, 18, 24805, 12, 8941, 55, 13, 480, 446, 3719, 747, 261, 8293, 264, 1385, 18, 24805, 12, 6776, 67, 1985, 13, 422, 1408, 13, 262, 288, 203, 7734, 509, 818, 5636, 273, 4124, 264, 1385, 18, 588, 3185, 1076, 12, 8941, 55, 2934, 1467, 5621, 203, 7734, 3434, 5636, 1876, 668, 5058, 18, 1636, 5058, 18, 1289, 2932, 15596, 13773, 818, 5636, 397, 6, 22692, 364, 3999, 598, 508, 13773, 8293, 264, 1385, 18, 24805, 12, 6776, 67, 1985, 13, 9078, 2724, 333, 353, 486, 279, 923, 508, 8863, 203, 7734, 1324, 31, 203, 5411, 289, 469, 309, 16051, 12, 8293, 264, 1385, 18, 24805, 12, 6776, 67, 1985, 13, 1276, 514, 3719, 288, 203, 7734, 604, 394, 2754, 2932, 37, 508, 353, 486, 279, 533, 364, 622, 4520, 1245, 3999, 8863, 203, 5411, 289, 469, 309, 16051, 12, 8293, 264, 1385, 18, 12298, 653, 12, 8941, 55, 20349, 288, 203, 7734, 604, 394, 2754, 2932, 1518, 296, 21992, 1823, 11, 353, 1931, 8863, 203, 5411, 289, 469, 309, 225, 14015, 5, 12, 8293, 264, 1385, 18, 24805, 12, 8941, 55, 13, 1276, 25109, 3719, 747, 261, 8293, 264, 1385, 18, 24805, 12, 8941, 55, 13, 631, 2011, 3719, 288, 203, 7734, 604, 394, 2754, 2932, 1518, 296, 21992, 1823, 11, 294, 315, 397, 4124, 264, 1385, 18, 24805, 12, 8941, 55, 13, 397, 315, 353, 486, 392, 526, 8863, 203, 5411, 289, 203, 5411, 11596, 394, 10694, 264, 1385, 273, 394, 11596, 5621, 203, 5411, 394, 10694, 264, 1385, 18, 458, 12, 6776, 67, 1985, 16, 4124, 264, 1385, 18, 588, 780, 12, 6776, 67, 1985, 10019, 203, 5411, 25109, 394, 5636, 273, 394, 25109, 5621, 203, 5411, 364, 261, 921, 1634, 294, 4124, 264, 1385, 18, 588, 3185, 1076, 12, 8941, 55, 3719, 288, 203, 7734, 25109, 1634, 1076, 31, 203, 7734, 514, 2975, 14935, 273, 315, 15596, 404, 22692, 364, 3999, 598, 508, 2119, 397, 4124, 264, 1385, 18, 588, 780, 12, 6776, 67, 1985, 1769, 203, 7734, 775, 288, 203, 10792, 1634, 1076, 273, 261, 2 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
[ 1, 26873, 203, 377, 380, 632, 891, 1163, 5010, 691, 3639, 25109, 716, 1240, 326, 1163, 4710, 716, 903, 506, 3096, 16, 431, 294, 203, 377, 380, 4766, 306, 203, 377, 380, 21394, 288, 203, 377, 380, 4766, 1377, 315, 529, 6877, 1372, 203, 377, 380, 4766, 1377, 315, 21992, 1823, 6877, 306, 203, 377, 380, 4766, 1850, 306, 957, 16, 460, 16, 9312, 6487, 203, 377, 380, 4766, 1850, 306, 957, 16, 460, 16, 9312, 65, 203, 377, 380, 4766, 1377, 308, 203, 377, 380, 21394, 19879, 203, 377, 380, 4766, 288, 203, 377, 380, 4766, 1377, 315, 529, 6877, 1372, 203, 377, 380, 4766, 1377, 315, 21992, 1823, 6877, 306, 203, 377, 380, 4766, 1850, 306, 957, 16, 460, 6487, 203, 377, 380, 4766, 1850, 2 ]
c8c02619d7cb16a5a0074264fa4cdc50b46a047d
Hurence/historian
historian-server/src/main/java/com/hurence/webapiservice/http/api/ingestion/ImportRequestParser.java
[ "Apache-2.0" ]
Java
parseCsvImportRequest
FileReport
public static FileReport parseCsvImportRequest(JsonArray fileInArray, CsvFilesConvertorConf csvFilesConvertorConf, FileReport fileReport) { if (null == fileInArray) { throw new NullPointerException("Null request body"); }else if (fileInArray.isEmpty()) { throw new IllegalArgumentException("Empty request body"); } parseEachObjectInTheArray(fileInArray, fileReport, csvFilesConvertorConf); if (fileReport.correctPoints.isEmpty()) throw new IllegalArgumentException("There is no valid points"); return fileReport; }
/** * @param fileInArray JsonArray * @param csvFilesConvertorConf CsvFilesConvertorConf * @param fileReport FileReport * * parse the json and fill the fileReport: * - fill the correctPoints * - fill the numberOfFailedPointsPerMetric * * @return void */
parse the json and fill the fileReport: - fill the correctPoints - fill the numberOfFailedPointsPerMetric @return void
[ "parse", "the", "json", "and", "fill", "the", "fileReport", ":", "-", "fill", "the", "correctPoints", "-", "fill", "the", "numberOfFailedPointsPerMetric", "@return", "void" ]
public static FileReport parseCsvImportRequest(JsonArray fileInArray, CsvFilesConvertorConf csvFilesConvertorConf, FileReport fileReport) { if (null == fileInArray) { throw new NullPointerException("Null request body"); }else if (fileInArray.isEmpty()) { throw new IllegalArgumentException("Empty request body"); } parseEachObjectInTheArray(fileInArray, fileReport, csvFilesConvertorConf); if (fileReport.correctPoints.isEmpty()) throw new IllegalArgumentException("There is no valid points"); return fileReport; }
[ "public", "static", "FileReport", "parseCsvImportRequest", "(", "JsonArray", "fileInArray", ",", "CsvFilesConvertorConf", "csvFilesConvertorConf", ",", "FileReport", "fileReport", ")", "{", "if", "(", "null", "==", "fileInArray", ")", "{", "throw", "new", "NullPointerException", "(", "\"Null request body\"", ")", ";", "}", "else", "if", "(", "fileInArray", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Empty request body\"", ")", ";", "}", "parseEachObjectInTheArray", "(", "fileInArray", ",", "fileReport", ",", "csvFilesConvertorConf", ")", ";", "if", "(", "fileReport", ".", "correctPoints", ".", "isEmpty", "(", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"There is no valid points\"", ")", ";", "return", "fileReport", ";", "}" ]
@param fileInArray JsonArray @param csvFilesConvertorConf CsvFilesConvertorConf @param fileReport FileReport
[ "@param", "fileInArray", "JsonArray", "@param", "csvFilesConvertorConf", "CsvFilesConvertorConf", "@param", "fileReport", "FileReport" ]
[]
[ { "param": "fileInArray", "type": "JsonArray" }, { "param": "csvFilesConvertorConf", "type": "CsvFilesConvertorConf" }, { "param": "fileReport", "type": "FileReport" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fileInArray", "type": "JsonArray", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "csvFilesConvertorConf", "type": "CsvFilesConvertorConf", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fileReport", "type": "FileReport", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 760, 1387, 4820, 1109, 16759, 5010, 691, 12, 3185, 1076, 585, 382, 1076, 16, 21532, 2697, 2723, 280, 3976, 6101, 2697, 2723, 280, 3976, 16, 1387, 4820, 585, 4820, 13, 288, 203, 3639, 309, 261, 2011, 422, 585, 382, 1076, 13, 288, 203, 5411, 604, 394, 10108, 2932, 2041, 590, 1417, 8863, 203, 3639, 289, 12107, 309, 261, 768, 382, 1076, 18, 291, 1921, 10756, 288, 203, 5411, 604, 394, 2754, 2932, 1921, 590, 1417, 8863, 203, 3639, 289, 203, 203, 3639, 1109, 3442, 921, 382, 1986, 1076, 12, 768, 382, 1076, 16, 585, 4820, 16, 6101, 2697, 2723, 280, 3976, 1769, 203, 203, 3639, 309, 261, 768, 4820, 18, 6746, 5636, 18, 291, 1921, 10756, 203, 5411, 604, 394, 2754, 2932, 9828, 353, 1158, 923, 3143, 8863, 203, 3639, 327, 585, 4820, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 326, 585, 4820, 30, 203, 377, 380, 8227, 300, 3636, 326, 3434, 5636, 203, 377, 380, 8227, 300, 3636, 326, 7922, 2925, 5636, 2173, 5396, 203, 377, 380, 203, 377, 380, 632, 2463, 918, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
c8c02619d7cb16a5a0074264fa4cdc50b46a047d
Hurence/historian
historian-server/src/main/java/com/hurence/webapiservice/http/api/ingestion/ImportRequestParser.java
[ "Apache-2.0" ]
Java
calculateNumberOfFailedPoints
null
private static void calculateNumberOfFailedPoints(FileReport fileReport, CsvFilesConvertorConf csvFilesConvertorConf, JsonObject timeserie, int numberOfFailedPointsForThisName) { int currentNumberOfFailedPoints; LinkedHashMap<String, String> groupByMap = getGroupedByFields(csvFilesConvertorConf, timeserie); if (fileReport.numberOfFailedPointsPerMetric.containsKey(groupByMap)) { currentNumberOfFailedPoints = fileReport.numberOfFailedPointsPerMetric.get(groupByMap); fileReport.numberOfFailedPointsPerMetric.put(groupByMap, currentNumberOfFailedPoints+numberOfFailedPointsForThisName); }else { fileReport.numberOfFailedPointsPerMetric.put(groupByMap, numberOfFailedPointsForThisName); } }
/** * @param fileReport FileReport * @param csvFilesConvertorConf CsvFilesConvertorConf * @param timeserie JsonObject * @param numberOfFailedPointsForThisName int * * calculate the number of failed points per metric * * @return void */
calculate the number of failed points per metric @return void
[ "calculate", "the", "number", "of", "failed", "points", "per", "metric", "@return", "void" ]
private static void calculateNumberOfFailedPoints(FileReport fileReport, CsvFilesConvertorConf csvFilesConvertorConf, JsonObject timeserie, int numberOfFailedPointsForThisName) { int currentNumberOfFailedPoints; LinkedHashMap<String, String> groupByMap = getGroupedByFields(csvFilesConvertorConf, timeserie); if (fileReport.numberOfFailedPointsPerMetric.containsKey(groupByMap)) { currentNumberOfFailedPoints = fileReport.numberOfFailedPointsPerMetric.get(groupByMap); fileReport.numberOfFailedPointsPerMetric.put(groupByMap, currentNumberOfFailedPoints+numberOfFailedPointsForThisName); }else { fileReport.numberOfFailedPointsPerMetric.put(groupByMap, numberOfFailedPointsForThisName); } }
[ "private", "static", "void", "calculateNumberOfFailedPoints", "(", "FileReport", "fileReport", ",", "CsvFilesConvertorConf", "csvFilesConvertorConf", ",", "JsonObject", "timeserie", ",", "int", "numberOfFailedPointsForThisName", ")", "{", "int", "currentNumberOfFailedPoints", ";", "LinkedHashMap", "<", "String", ",", "String", ">", "groupByMap", "=", "getGroupedByFields", "(", "csvFilesConvertorConf", ",", "timeserie", ")", ";", "if", "(", "fileReport", ".", "numberOfFailedPointsPerMetric", ".", "containsKey", "(", "groupByMap", ")", ")", "{", "currentNumberOfFailedPoints", "=", "fileReport", ".", "numberOfFailedPointsPerMetric", ".", "get", "(", "groupByMap", ")", ";", "fileReport", ".", "numberOfFailedPointsPerMetric", ".", "put", "(", "groupByMap", ",", "currentNumberOfFailedPoints", "+", "numberOfFailedPointsForThisName", ")", ";", "}", "else", "{", "fileReport", ".", "numberOfFailedPointsPerMetric", ".", "put", "(", "groupByMap", ",", "numberOfFailedPointsForThisName", ")", ";", "}", "}" ]
@param fileReport FileReport @param csvFilesConvertorConf CsvFilesConvertorConf @param timeserie JsonObject @param numberOfFailedPointsForThisName int
[ "@param", "fileReport", "FileReport", "@param", "csvFilesConvertorConf", "CsvFilesConvertorConf", "@param", "timeserie", "JsonObject", "@param", "numberOfFailedPointsForThisName", "int" ]
[]
[ { "param": "fileReport", "type": "FileReport" }, { "param": "csvFilesConvertorConf", "type": "CsvFilesConvertorConf" }, { "param": "timeserie", "type": "JsonObject" }, { "param": "numberOfFailedPointsForThisName", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "fileReport", "type": "FileReport", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "csvFilesConvertorConf", "type": "CsvFilesConvertorConf", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "timeserie", "type": "JsonObject", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "numberOfFailedPointsForThisName", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 3238, 760, 918, 4604, 9226, 2925, 5636, 12, 812, 4820, 585, 4820, 16, 21532, 2697, 2723, 280, 3976, 6101, 2697, 2723, 280, 3976, 16, 11596, 4124, 264, 1385, 16, 509, 7922, 2925, 5636, 1290, 2503, 461, 13, 288, 203, 3639, 509, 783, 9226, 2925, 5636, 31, 203, 3639, 13589, 32, 780, 16, 514, 34, 13197, 863, 273, 11751, 18696, 2314, 12, 6715, 2697, 2723, 280, 3976, 16, 4124, 264, 1385, 1769, 203, 3639, 309, 261, 768, 4820, 18, 2696, 951, 2925, 5636, 2173, 5396, 18, 12298, 653, 12, 1655, 858, 863, 3719, 288, 203, 5411, 783, 9226, 2925, 5636, 273, 585, 4820, 18, 2696, 951, 2925, 5636, 2173, 5396, 18, 588, 12, 1655, 858, 863, 1769, 203, 5411, 585, 4820, 18, 2696, 951, 2925, 5636, 2173, 5396, 18, 458, 12, 1655, 858, 863, 16, 783, 9226, 2925, 5636, 15, 2696, 951, 2925, 5636, 1290, 2503, 461, 1769, 203, 3639, 289, 12107, 288, 203, 5411, 585, 4820, 18, 2696, 951, 2925, 5636, 2173, 5396, 18, 458, 12, 1655, 858, 863, 16, 7922, 2925, 5636, 1290, 2503, 461, 1769, 203, 3639, 289, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 632, 891, 585, 4820, 7682, 1387, 4820, 203, 377, 380, 632, 891, 6101, 2697, 2723, 280, 3976, 2868, 21532, 2697, 2723, 280, 3976, 203, 377, 380, 632, 891, 4124, 264, 1385, 12900, 11596, 203, 377, 380, 632, 891, 7922, 2925, 5636, 1290, 2503, 461, 565, 509, 203, 377, 380, 203, 377, 380, 4604, 326, 1300, 434, 2535, 3143, 1534, 3999, 203, 377, 380, 203, 377, 380, 632, 2463, 918, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
5241a0680fa1dcc3b4aed9fdf2fa563c9e67bebd
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/functions/transformation/SampleMovingAverage.java
[ "Apache-2.0" ]
Java
execute
null
@Override public void execute(MetricTimeSeries timeSeries, FunctionValueMap functionValueMap) { //we need a sorted time series timeSeries.sort(); //get the raw values as arrays double[] values = timeSeries.getValuesAsArray(); long[] times = timeSeries.getTimestampsAsArray(); int timeSeriesSize = timeSeries.size(); //remove the old values timeSeries.clear(); //the start is already set for (int start = 0; start < timeSeriesSize; start++) { int end = start + samples; //calculate the average of the values and the time evaluteAveragesAndAddToTimeSeries(timeSeries, values, times, start, end); //check if window end is larger than time series if (end + 1 >= timeSeriesSize) { evaluteAveragesAndAddToTimeSeries(timeSeries, values, times, start + 1, timeSeriesSize); break; } } functionValueMap.add(this); }
/** * Transforms a time series using a moving average that is based on a window with a fixed amount of samples. * The last window contains equals or a lower amount samples. * * @param timeSeries the time series that is transformed */
Transforms a time series using a moving average that is based on a window with a fixed amount of samples. The last window contains equals or a lower amount samples. @param timeSeries the time series that is transformed
[ "Transforms", "a", "time", "series", "using", "a", "moving", "average", "that", "is", "based", "on", "a", "window", "with", "a", "fixed", "amount", "of", "samples", ".", "The", "last", "window", "contains", "equals", "or", "a", "lower", "amount", "samples", ".", "@param", "timeSeries", "the", "time", "series", "that", "is", "transformed" ]
@Override public void execute(MetricTimeSeries timeSeries, FunctionValueMap functionValueMap) { timeSeries.sort(); double[] values = timeSeries.getValuesAsArray(); long[] times = timeSeries.getTimestampsAsArray(); int timeSeriesSize = timeSeries.size(); timeSeries.clear(); for (int start = 0; start < timeSeriesSize; start++) { int end = start + samples; evaluteAveragesAndAddToTimeSeries(timeSeries, values, times, start, end); if (end + 1 >= timeSeriesSize) { evaluteAveragesAndAddToTimeSeries(timeSeries, values, times, start + 1, timeSeriesSize); break; } } functionValueMap.add(this); }
[ "@", "Override", "public", "void", "execute", "(", "MetricTimeSeries", "timeSeries", ",", "FunctionValueMap", "functionValueMap", ")", "{", "timeSeries", ".", "sort", "(", ")", ";", "double", "[", "]", "values", "=", "timeSeries", ".", "getValuesAsArray", "(", ")", ";", "long", "[", "]", "times", "=", "timeSeries", ".", "getTimestampsAsArray", "(", ")", ";", "int", "timeSeriesSize", "=", "timeSeries", ".", "size", "(", ")", ";", "timeSeries", ".", "clear", "(", ")", ";", "for", "(", "int", "start", "=", "0", ";", "start", "<", "timeSeriesSize", ";", "start", "++", ")", "{", "int", "end", "=", "start", "+", "samples", ";", "evaluteAveragesAndAddToTimeSeries", "(", "timeSeries", ",", "values", ",", "times", ",", "start", ",", "end", ")", ";", "if", "(", "end", "+", "1", ">=", "timeSeriesSize", ")", "{", "evaluteAveragesAndAddToTimeSeries", "(", "timeSeries", ",", "values", ",", "times", ",", "start", "+", "1", ",", "timeSeriesSize", ")", ";", "break", ";", "}", "}", "functionValueMap", ".", "add", "(", "this", ")", ";", "}" ]
Transforms a time series using a moving average that is based on a window with a fixed amount of samples.
[ "Transforms", "a", "time", "series", "using", "a", "moving", "average", "that", "is", "based", "on", "a", "window", "with", "a", "fixed", "amount", "of", "samples", "." ]
[ "//we need a sorted time series", "//get the raw values as arrays", "//remove the old values", "//the start is already set", "//calculate the average of the values and the time", "//check if window end is larger than time series" ]
[ { "param": "timeSeries", "type": "MetricTimeSeries" }, { "param": "functionValueMap", "type": "FunctionValueMap" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "timeSeries", "type": "MetricTimeSeries", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "functionValueMap", "type": "FunctionValueMap", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 565, 1071, 918, 1836, 12, 5396, 28486, 813, 6485, 16, 4284, 26795, 445, 26795, 13, 288, 203, 203, 3639, 368, 1814, 1608, 279, 3115, 813, 4166, 203, 3639, 813, 6485, 18, 3804, 5621, 203, 203, 3639, 368, 588, 326, 1831, 924, 487, 5352, 203, 3639, 1645, 8526, 924, 273, 813, 6485, 18, 588, 1972, 19196, 5621, 203, 3639, 1525, 8526, 4124, 273, 813, 6485, 18, 588, 23761, 19196, 5621, 203, 203, 3639, 509, 813, 6485, 1225, 273, 813, 6485, 18, 1467, 5621, 203, 3639, 368, 4479, 326, 1592, 924, 203, 3639, 813, 6485, 18, 8507, 5621, 203, 203, 3639, 368, 5787, 787, 353, 1818, 444, 203, 3639, 364, 261, 474, 787, 273, 374, 31, 787, 411, 813, 6485, 1225, 31, 787, 27245, 288, 203, 203, 5411, 509, 679, 273, 787, 397, 5216, 31, 203, 5411, 368, 11162, 326, 8164, 434, 326, 924, 471, 326, 813, 203, 5411, 5302, 624, 37, 502, 1023, 1876, 986, 774, 28486, 12, 957, 6485, 16, 924, 16, 4124, 16, 787, 16, 679, 1769, 203, 203, 5411, 368, 1893, 309, 2742, 679, 353, 10974, 2353, 813, 4166, 203, 5411, 309, 261, 409, 397, 404, 1545, 813, 6485, 1225, 13, 288, 203, 7734, 5302, 624, 37, 502, 1023, 1876, 986, 774, 28486, 12, 957, 6485, 16, 924, 16, 4124, 16, 787, 397, 404, 16, 813, 6485, 1225, 1769, 203, 7734, 898, 31, 203, 5411, 289, 203, 3639, 289, 203, 203, 3639, 445, 26795, 18, 1289, 12, 2211, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 2604, 9741, 279, 813, 4166, 1450, 279, 12499, 8164, 716, 353, 2511, 603, 279, 2742, 598, 279, 5499, 3844, 434, 5216, 18, 203, 377, 380, 1021, 1142, 2742, 1914, 1606, 578, 279, 2612, 3844, 5216, 18, 203, 377, 380, 203, 377, 380, 632, 891, 813, 6485, 326, 813, 4166, 716, 353, 10220, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
c4f1abcad3566945136178562983a255545caba8
Hurence/historian
historian-timeseries/src/main/java/com/hurence/forecasting/ArimaDoubleForecaster.java
[ "Apache-2.0" ]
Java
forecast
null
@Override public List<Double> forecast(List<Double> inputData, int numPoints) { double[] dataArray = new double[inputData.size()]; for (int i = 0; i < dataArray.length; i++) { dataArray[i] = inputData.get(i); } verifier(); ForecastResult forecastResult = Arima.forecast_arima(dataArray, numPoints, new ArimaParams(p, d, q, P, D, Q, m)); double[] forecastData = forecastResult.getForecast(); ArrayList<Double> forecasted = new ArrayList<Double>(); for (double forecastDatum : forecastData) { forecasted.add(forecastDatum); } return forecasted; }
/** * Forecast the number of points we want of a time series * * @param inputData the series which we want to predict the next points * @param numPoints number of points to forecast * @return a list of double forecasted values * @throws IOException */
Forecast the number of points we want of a time series @param inputData the series which we want to predict the next points @param numPoints number of points to forecast @return a list of double forecasted values @throws IOException
[ "Forecast", "the", "number", "of", "points", "we", "want", "of", "a", "time", "series", "@param", "inputData", "the", "series", "which", "we", "want", "to", "predict", "the", "next", "points", "@param", "numPoints", "number", "of", "points", "to", "forecast", "@return", "a", "list", "of", "double", "forecasted", "values", "@throws", "IOException" ]
@Override public List<Double> forecast(List<Double> inputData, int numPoints) { double[] dataArray = new double[inputData.size()]; for (int i = 0; i < dataArray.length; i++) { dataArray[i] = inputData.get(i); } verifier(); ForecastResult forecastResult = Arima.forecast_arima(dataArray, numPoints, new ArimaParams(p, d, q, P, D, Q, m)); double[] forecastData = forecastResult.getForecast(); ArrayList<Double> forecasted = new ArrayList<Double>(); for (double forecastDatum : forecastData) { forecasted.add(forecastDatum); } return forecasted; }
[ "@", "Override", "public", "List", "<", "Double", ">", "forecast", "(", "List", "<", "Double", ">", "inputData", ",", "int", "numPoints", ")", "{", "double", "[", "]", "dataArray", "=", "new", "double", "[", "inputData", ".", "size", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "dataArray", ".", "length", ";", "i", "++", ")", "{", "dataArray", "[", "i", "]", "=", "inputData", ".", "get", "(", "i", ")", ";", "}", "verifier", "(", ")", ";", "ForecastResult", "forecastResult", "=", "Arima", ".", "forecast_arima", "(", "dataArray", ",", "numPoints", ",", "new", "ArimaParams", "(", "p", ",", "d", ",", "q", ",", "P", ",", "D", ",", "Q", ",", "m", ")", ")", ";", "double", "[", "]", "forecastData", "=", "forecastResult", ".", "getForecast", "(", ")", ";", "ArrayList", "<", "Double", ">", "forecasted", "=", "new", "ArrayList", "<", "Double", ">", "(", ")", ";", "for", "(", "double", "forecastDatum", ":", "forecastData", ")", "{", "forecasted", ".", "add", "(", "forecastDatum", ")", ";", "}", "return", "forecasted", ";", "}" ]
Forecast the number of points we want of a time series @param inputData the series which we want to predict the next points @param numPoints number of points to forecast @return a list of double forecasted values @throws IOException
[ "Forecast", "the", "number", "of", "points", "we", "want", "of", "a", "time", "series", "@param", "inputData", "the", "series", "which", "we", "want", "to", "predict", "the", "next", "points", "@param", "numPoints", "number", "of", "points", "to", "forecast", "@return", "a", "list", "of", "double", "forecasted", "values", "@throws", "IOException" ]
[]
[ { "param": "inputData", "type": "List<Double>" }, { "param": "numPoints", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "inputData", "type": "List<Double>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "numPoints", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 565, 1071, 987, 32, 5265, 34, 18763, 12, 682, 32, 5265, 34, 24149, 16, 509, 818, 5636, 13, 288, 203, 203, 3639, 1645, 8526, 30541, 273, 394, 1645, 63, 2630, 751, 18, 1467, 1435, 15533, 203, 3639, 364, 261, 474, 277, 273, 374, 31, 277, 411, 30541, 18, 2469, 31, 277, 27245, 288, 203, 5411, 30541, 63, 77, 65, 273, 24149, 18, 588, 12, 77, 1769, 203, 3639, 289, 203, 3639, 20130, 5621, 203, 3639, 17605, 4155, 1253, 18763, 1253, 273, 1201, 13888, 18, 1405, 4155, 67, 297, 13888, 12, 892, 1076, 16, 818, 5636, 16, 394, 1201, 13888, 1370, 12, 84, 16, 302, 16, 1043, 16, 453, 16, 463, 16, 2238, 16, 312, 10019, 203, 3639, 1645, 8526, 18763, 751, 273, 18763, 1253, 18, 588, 13573, 4155, 5621, 203, 203, 3639, 2407, 32, 5265, 34, 18763, 329, 273, 394, 2407, 32, 5265, 34, 5621, 203, 3639, 364, 261, 9056, 18763, 18268, 294, 18763, 751, 13, 288, 203, 5411, 18763, 329, 18, 1289, 12, 1405, 4155, 18268, 1769, 203, 3639, 289, 203, 3639, 327, 18763, 329, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 17605, 4155, 326, 1300, 434, 3143, 732, 2545, 434, 279, 813, 4166, 203, 377, 380, 203, 377, 380, 632, 891, 24149, 326, 4166, 1492, 732, 2545, 358, 7810, 326, 1024, 3143, 203, 377, 380, 632, 891, 818, 5636, 1300, 434, 3143, 358, 18763, 203, 377, 380, 632, 2463, 279, 666, 434, 1645, 18763, 329, 924, 203, 377, 380, 632, 15069, 1860, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
c4f1abcad3566945136178562983a255545caba8
Hurence/historian
historian-timeseries/src/main/java/com/hurence/forecasting/ArimaDoubleForecaster.java
[ "Apache-2.0" ]
Java
fit
null
@Override public void fit(List<Double> trainingData, List<Double> validatingData) { List<Integer> order = Arrays.asList(0, 0, 0, 0, 0, 0); double[] train = listToDouble(trainingData); double[] valid = listToDouble(validatingData); double minMse = 99999999; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { for (int k = 0; k < 10; k++) { try{ ForecastResult forecastResult = null; if (i == 0 && k == 0) { forecastResult = Arima.forecast_arima(train, valid.length, new ArimaParams(1, j, k, P, D, Q, 1+k+1)); } else { forecastResult = Arima.forecast_arima(train, valid.length, new ArimaParams(i, j, k, P, D, Q, i+k+1)); } double[] forecastData = forecastResult.getForecast(); double mse = rootMeanSquaredError(valid, forecastData); if (mse < minMse) { minMse = mse; order.set(0, i); order.set(1, j); order.set(2, k); } }catch (Exception ex){ logger.debug(ex.getMessage()); } } } } p = order.get(0); d = order.get(1); q = order.get(2); P = order.get(3); D = order.get(4); Q = order.get(5); m = p + q + P + Q + 1; logger.debug("Min RMSE={} found , for p={}, d={}, q={}, P={}, D={}, Q={}, m={}", minMse, p, d, q, P, D, Q, m); }
/** * Find the ARIMA's parameters * * @param trainingData the given elements to train the model * @param validatingData the elements to compare with the forecasted values */
Find the ARIMA's parameters @param trainingData the given elements to train the model @param validatingData the elements to compare with the forecasted values
[ "Find", "the", "ARIMA", "'", "s", "parameters", "@param", "trainingData", "the", "given", "elements", "to", "train", "the", "model", "@param", "validatingData", "the", "elements", "to", "compare", "with", "the", "forecasted", "values" ]
@Override public void fit(List<Double> trainingData, List<Double> validatingData) { List<Integer> order = Arrays.asList(0, 0, 0, 0, 0, 0); double[] train = listToDouble(trainingData); double[] valid = listToDouble(validatingData); double minMse = 99999999; for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { for (int k = 0; k < 10; k++) { try{ ForecastResult forecastResult = null; if (i == 0 && k == 0) { forecastResult = Arima.forecast_arima(train, valid.length, new ArimaParams(1, j, k, P, D, Q, 1+k+1)); } else { forecastResult = Arima.forecast_arima(train, valid.length, new ArimaParams(i, j, k, P, D, Q, i+k+1)); } double[] forecastData = forecastResult.getForecast(); double mse = rootMeanSquaredError(valid, forecastData); if (mse < minMse) { minMse = mse; order.set(0, i); order.set(1, j); order.set(2, k); } }catch (Exception ex){ logger.debug(ex.getMessage()); } } } } p = order.get(0); d = order.get(1); q = order.get(2); P = order.get(3); D = order.get(4); Q = order.get(5); m = p + q + P + Q + 1; logger.debug("Min RMSE={} found , for p={}, d={}, q={}, P={}, D={}, Q={}, m={}", minMse, p, d, q, P, D, Q, m); }
[ "@", "Override", "public", "void", "fit", "(", "List", "<", "Double", ">", "trainingData", ",", "List", "<", "Double", ">", "validatingData", ")", "{", "List", "<", "Integer", ">", "order", "=", "Arrays", ".", "asList", "(", "0", ",", "0", ",", "0", ",", "0", ",", "0", ",", "0", ")", ";", "double", "[", "]", "train", "=", "listToDouble", "(", "trainingData", ")", ";", "double", "[", "]", "valid", "=", "listToDouble", "(", "validatingData", ")", ";", "double", "minMse", "=", "99999999", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "10", ";", "i", "++", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "10", ";", "j", "++", ")", "{", "for", "(", "int", "k", "=", "0", ";", "k", "<", "10", ";", "k", "++", ")", "{", "try", "{", "ForecastResult", "forecastResult", "=", "null", ";", "if", "(", "i", "==", "0", "&&", "k", "==", "0", ")", "{", "forecastResult", "=", "Arima", ".", "forecast_arima", "(", "train", ",", "valid", ".", "length", ",", "new", "ArimaParams", "(", "1", ",", "j", ",", "k", ",", "P", ",", "D", ",", "Q", ",", "1", "+", "k", "+", "1", ")", ")", ";", "}", "else", "{", "forecastResult", "=", "Arima", ".", "forecast_arima", "(", "train", ",", "valid", ".", "length", ",", "new", "ArimaParams", "(", "i", ",", "j", ",", "k", ",", "P", ",", "D", ",", "Q", ",", "i", "+", "k", "+", "1", ")", ")", ";", "}", "double", "[", "]", "forecastData", "=", "forecastResult", ".", "getForecast", "(", ")", ";", "double", "mse", "=", "rootMeanSquaredError", "(", "valid", ",", "forecastData", ")", ";", "if", "(", "mse", "<", "minMse", ")", "{", "minMse", "=", "mse", ";", "order", ".", "set", "(", "0", ",", "i", ")", ";", "order", ".", "set", "(", "1", ",", "j", ")", ";", "order", ".", "set", "(", "2", ",", "k", ")", ";", "}", "}", "catch", "(", "Exception", "ex", ")", "{", "logger", ".", "debug", "(", "ex", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}", "}", "p", "=", "order", ".", "get", "(", "0", ")", ";", "d", "=", "order", ".", "get", "(", "1", ")", ";", "q", "=", "order", ".", "get", "(", "2", ")", ";", "P", "=", "order", ".", "get", "(", "3", ")", ";", "D", "=", "order", ".", "get", "(", "4", ")", ";", "Q", "=", "order", ".", "get", "(", "5", ")", ";", "m", "=", "p", "+", "q", "+", "P", "+", "Q", "+", "1", ";", "logger", ".", "debug", "(", "\"Min RMSE={} found , for p={}, d={}, q={}, P={}, D={}, Q={}, m={}\"", ",", "minMse", ",", "p", ",", "d", ",", "q", ",", "P", ",", "D", ",", "Q", ",", "m", ")", ";", "}" ]
Find the ARIMA's parameters @param trainingData the given elements to train the model @param validatingData the elements to compare with the forecasted values
[ "Find", "the", "ARIMA", "'", "s", "parameters", "@param", "trainingData", "the", "given", "elements", "to", "train", "the", "model", "@param", "validatingData", "the", "elements", "to", "compare", "with", "the", "forecasted", "values" ]
[]
[ { "param": "trainingData", "type": "List<Double>" }, { "param": "validatingData", "type": "List<Double>" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "trainingData", "type": "List<Double>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "validatingData", "type": "List<Double>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 565, 1071, 918, 4845, 12, 682, 32, 5265, 34, 8277, 751, 16, 987, 32, 5265, 34, 18075, 751, 13, 288, 203, 3639, 987, 32, 4522, 34, 1353, 273, 5647, 18, 345, 682, 12, 20, 16, 374, 16, 374, 16, 374, 16, 374, 16, 374, 1769, 203, 3639, 1645, 8526, 4691, 273, 666, 774, 5265, 12, 17584, 751, 1769, 203, 3639, 1645, 8526, 923, 273, 666, 774, 5265, 12, 877, 1776, 751, 1769, 203, 3639, 1645, 1131, 49, 307, 273, 23841, 11984, 31, 203, 3639, 364, 261, 474, 277, 273, 374, 31, 277, 411, 1728, 31, 277, 27245, 288, 203, 5411, 364, 261, 474, 525, 273, 374, 31, 525, 411, 1728, 31, 525, 27245, 288, 203, 7734, 364, 261, 474, 417, 273, 374, 31, 417, 411, 1728, 31, 417, 27245, 288, 203, 10792, 775, 95, 203, 13491, 17605, 4155, 1253, 18763, 1253, 273, 446, 31, 203, 13491, 309, 261, 77, 422, 374, 597, 417, 422, 374, 13, 288, 203, 18701, 18763, 1253, 273, 1201, 13888, 18, 1405, 4155, 67, 297, 13888, 12, 9754, 16, 923, 18, 2469, 16, 394, 1201, 13888, 1370, 12, 21, 16, 525, 16, 417, 16, 453, 16, 463, 16, 2238, 16, 404, 15, 79, 15, 21, 10019, 203, 13491, 289, 469, 288, 203, 18701, 18763, 1253, 273, 1201, 13888, 18, 1405, 4155, 67, 297, 13888, 12, 9754, 16, 923, 18, 2469, 16, 394, 1201, 13888, 1370, 12, 77, 16, 525, 16, 417, 16, 453, 16, 463, 16, 2238, 16, 277, 15, 79, 15, 21, 10019, 203, 13491, 289, 203, 13491, 1645, 8526, 18763, 751, 273, 18763, 1253, 18, 588, 13573, 4155, 5621, 203, 13491, 1645, 18689, 273, 1365, 15312, 20888, 668, 12, 877, 16, 18763, 751, 1769, 203, 13491, 309, 261, 81, 307, 411, 1131, 49, 307, 13, 288, 203, 18701, 1131, 49, 307, 273, 18689, 31, 203, 18701, 1353, 18, 542, 12, 20, 16, 277, 1769, 203, 18701, 1353, 18, 542, 12, 21, 16, 525, 1769, 203, 18701, 1353, 18, 542, 12, 22, 16, 417, 1769, 203, 13491, 289, 203, 10792, 289, 14683, 261, 503, 431, 15329, 203, 13491, 1194, 18, 4148, 12, 338, 18, 24906, 10663, 203, 10792, 289, 203, 203, 7734, 289, 203, 5411, 289, 203, 3639, 289, 203, 203, 203, 3639, 293, 273, 1353, 18, 588, 12, 20, 1769, 203, 3639, 302, 273, 1353, 18, 588, 12, 21, 1769, 203, 3639, 1043, 273, 1353, 18, 588, 12, 22, 1769, 203, 3639, 453, 273, 1353, 18, 588, 12, 23, 1769, 203, 3639, 463, 273, 1353, 18, 588, 12, 24, 1769, 203, 3639, 2238, 273, 1353, 18, 588, 12, 25, 1769, 203, 3639, 312, 273, 293, 397, 1043, 397, 453, 397, 2238, 397, 404, 31, 203, 203, 3639, 1194, 18, 4148, 2932, 2930, 534, 49, 1090, 12938, 1392, 269, 364, 293, 28793, 302, 28793, 1043, 28793, 453, 28793, 463, 28793, 2238, 28793, 312, 18046, 16, 1131, 49, 307, 16, 293, 16, 302, 16, 1043, 16, 453, 16, 463, 16, 2238, 16, 312, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 4163, 326, 432, 2259, 5535, 1807, 1472, 203, 377, 380, 203, 377, 380, 632, 891, 8277, 751, 326, 864, 2186, 358, 4691, 326, 938, 203, 377, 380, 632, 891, 18075, 751, 326, 2186, 358, 3400, 598, 326, 18763, 329, 924, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
c4f1abcad3566945136178562983a255545caba8
Hurence/historian
historian-timeseries/src/main/java/com/hurence/forecasting/ArimaDoubleForecaster.java
[ "Apache-2.0" ]
Java
listToDouble
null
public double[] listToDouble(List<Double> inputData) { double[] result = new double[inputData.size()]; for (int i = 0; i < result.length; i++) { result[i] = inputData.get(i); } return result; }
/** * Transform a List<Double> into a double[] * * @param inputData is a list of Measure * @return a list of double */
Transform a List into a double[] @param inputData is a list of Measure @return a list of double
[ "Transform", "a", "List", "into", "a", "double", "[]", "@param", "inputData", "is", "a", "list", "of", "Measure", "@return", "a", "list", "of", "double" ]
public double[] listToDouble(List<Double> inputData) { double[] result = new double[inputData.size()]; for (int i = 0; i < result.length; i++) { result[i] = inputData.get(i); } return result; }
[ "public", "double", "[", "]", "listToDouble", "(", "List", "<", "Double", ">", "inputData", ")", "{", "double", "[", "]", "result", "=", "new", "double", "[", "inputData", ".", "size", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "result", ".", "length", ";", "i", "++", ")", "{", "result", "[", "i", "]", "=", "inputData", ".", "get", "(", "i", ")", ";", "}", "return", "result", ";", "}" ]
Transform a List<Double> into a double[] @param inputData is a list of Measure @return a list of double
[ "Transform", "a", "List<Double", ">", "into", "a", "double", "[]", "@param", "inputData", "is", "a", "list", "of", "Measure", "@return", "a", "list", "of", "double" ]
[]
[ { "param": "inputData", "type": "List<Double>" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "inputData", "type": "List<Double>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 1645, 8526, 666, 774, 5265, 12, 682, 32, 5265, 34, 24149, 13, 288, 203, 3639, 1645, 8526, 563, 273, 394, 1645, 63, 2630, 751, 18, 1467, 1435, 15533, 203, 3639, 364, 261, 474, 277, 273, 374, 31, 277, 411, 563, 18, 2469, 31, 277, 27245, 288, 203, 5411, 563, 63, 77, 65, 273, 24149, 18, 588, 12, 77, 1769, 203, 3639, 289, 203, 3639, 327, 563, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 11514, 279, 987, 32, 5265, 34, 1368, 279, 1645, 8526, 203, 377, 380, 203, 377, 380, 632, 891, 24149, 353, 279, 666, 434, 13544, 203, 377, 380, 632, 2463, 279, 666, 434, 1645, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
e3758f39e92dc9e4eef0e1dcd58be6b7954f6036
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/functions/aggregation/Max.java
[ "Apache-2.0" ]
Java
execute
null
@Override public void execute(MetricTimeSeries timeSeries, FunctionValueMap functionValueMap) { //If it is empty, we return NaN if (timeSeries.size() <= 0) { functionValueMap.add(this, Double.NaN); return; } //Else calculate the analysis value int size = timeSeries.size(); double max = timeSeries.getValue(0); for (int i = 1; i < size; i++) { double next = timeSeries.getValue(i); if (next > max) { max = next; } } functionValueMap.add(this, max); }
/** * Calculates the maximum value of the first time series. * * @param timeSeries the time series * @return the maximum or 0 if the list is empty */
Calculates the maximum value of the first time series. @param timeSeries the time series @return the maximum or 0 if the list is empty
[ "Calculates", "the", "maximum", "value", "of", "the", "first", "time", "series", ".", "@param", "timeSeries", "the", "time", "series", "@return", "the", "maximum", "or", "0", "if", "the", "list", "is", "empty" ]
@Override public void execute(MetricTimeSeries timeSeries, FunctionValueMap functionValueMap) { if (timeSeries.size() <= 0) { functionValueMap.add(this, Double.NaN); return; } int size = timeSeries.size(); double max = timeSeries.getValue(0); for (int i = 1; i < size; i++) { double next = timeSeries.getValue(i); if (next > max) { max = next; } } functionValueMap.add(this, max); }
[ "@", "Override", "public", "void", "execute", "(", "MetricTimeSeries", "timeSeries", ",", "FunctionValueMap", "functionValueMap", ")", "{", "if", "(", "timeSeries", ".", "size", "(", ")", "<=", "0", ")", "{", "functionValueMap", ".", "add", "(", "this", ",", "Double", ".", "NaN", ")", ";", "return", ";", "}", "int", "size", "=", "timeSeries", ".", "size", "(", ")", ";", "double", "max", "=", "timeSeries", ".", "getValue", "(", "0", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "size", ";", "i", "++", ")", "{", "double", "next", "=", "timeSeries", ".", "getValue", "(", "i", ")", ";", "if", "(", "next", ">", "max", ")", "{", "max", "=", "next", ";", "}", "}", "functionValueMap", ".", "add", "(", "this", ",", "max", ")", ";", "}" ]
Calculates the maximum value of the first time series.
[ "Calculates", "the", "maximum", "value", "of", "the", "first", "time", "series", "." ]
[ "//If it is empty, we return NaN", "//Else calculate the analysis value" ]
[ { "param": "timeSeries", "type": "MetricTimeSeries" }, { "param": "functionValueMap", "type": "FunctionValueMap" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "timeSeries", "type": "MetricTimeSeries", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "functionValueMap", "type": "FunctionValueMap", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 565, 1071, 918, 1836, 12, 5396, 28486, 813, 6485, 16, 4284, 26795, 445, 26795, 13, 288, 203, 203, 3639, 368, 2047, 518, 353, 1008, 16, 732, 327, 10180, 203, 3639, 309, 261, 957, 6485, 18, 1467, 1435, 1648, 374, 13, 288, 203, 5411, 445, 26795, 18, 1289, 12, 2211, 16, 3698, 18, 21172, 1769, 203, 5411, 327, 31, 203, 3639, 289, 203, 3639, 368, 12427, 4604, 326, 6285, 460, 203, 3639, 509, 963, 273, 813, 6485, 18, 1467, 5621, 203, 3639, 1645, 943, 273, 813, 6485, 18, 24805, 12, 20, 1769, 203, 203, 3639, 364, 261, 474, 277, 273, 404, 31, 277, 411, 963, 31, 277, 27245, 288, 203, 5411, 1645, 1024, 273, 813, 6485, 18, 24805, 12, 77, 1769, 203, 5411, 309, 261, 4285, 405, 943, 13, 288, 203, 7734, 943, 273, 1024, 31, 203, 5411, 289, 203, 3639, 289, 203, 3639, 445, 26795, 18, 1289, 12, 2211, 16, 943, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 26128, 326, 4207, 460, 434, 326, 1122, 813, 4166, 18, 203, 377, 380, 203, 377, 380, 632, 891, 813, 6485, 326, 813, 4166, 203, 377, 380, 632, 2463, 326, 4207, 578, 374, 309, 326, 666, 353, 1008, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
82b520d3bc4efcb85bfcaa4c0aa3951413dbcba0
Hurence/historian
logisland-timeseries/src/main/java/com/hurence/logisland/sampling/record/AverageRecordSampler.java
[ "Apache-2.0" ]
Java
sample
null
@Override public List<Record> sample(List<Record> inputRecords) { // simple average to 100 data points return SamplingUtils.grouped(inputRecords, bucketSize) .map(bucket -> { SummaryStatistics stats = new SummaryStatistics(); bucket.forEach(record -> { final Double recordValue = getRecordValue(record); if (recordValue != null) stats.addValue(recordValue); }); final double meanValue = stats.getMean(); final Record sampleRecord = getTimeValueRecord(bucket.get(0)); final FieldType fieldType = bucket.get(0).getField(valueFieldName).getType(); switch (fieldType) { case INT: sampleRecord.setField(valueFieldName, fieldType, (int) Math.round(meanValue)); break; case LONG: sampleRecord.setField(valueFieldName, fieldType, Math.round(meanValue)); break; case FLOAT: sampleRecord.setField(valueFieldName, fieldType, (float) meanValue); break; case DOUBLE: sampleRecord.setField(valueFieldName, fieldType, meanValue); break; } return sampleRecord; }).collect(Collectors.toList()); }
/** * divide the points sequence into equally sized buckets * and select the first point of each bucket * * @param inputRecords the input list * @return */
divide the points sequence into equally sized buckets and select the first point of each bucket @param inputRecords the input list @return
[ "divide", "the", "points", "sequence", "into", "equally", "sized", "buckets", "and", "select", "the", "first", "point", "of", "each", "bucket", "@param", "inputRecords", "the", "input", "list", "@return" ]
@Override public List<Record> sample(List<Record> inputRecords) { return SamplingUtils.grouped(inputRecords, bucketSize) .map(bucket -> { SummaryStatistics stats = new SummaryStatistics(); bucket.forEach(record -> { final Double recordValue = getRecordValue(record); if (recordValue != null) stats.addValue(recordValue); }); final double meanValue = stats.getMean(); final Record sampleRecord = getTimeValueRecord(bucket.get(0)); final FieldType fieldType = bucket.get(0).getField(valueFieldName).getType(); switch (fieldType) { case INT: sampleRecord.setField(valueFieldName, fieldType, (int) Math.round(meanValue)); break; case LONG: sampleRecord.setField(valueFieldName, fieldType, Math.round(meanValue)); break; case FLOAT: sampleRecord.setField(valueFieldName, fieldType, (float) meanValue); break; case DOUBLE: sampleRecord.setField(valueFieldName, fieldType, meanValue); break; } return sampleRecord; }).collect(Collectors.toList()); }
[ "@", "Override", "public", "List", "<", "Record", ">", "sample", "(", "List", "<", "Record", ">", "inputRecords", ")", "{", "return", "SamplingUtils", ".", "grouped", "(", "inputRecords", ",", "bucketSize", ")", ".", "map", "(", "bucket", "->", "{", "SummaryStatistics", "stats", "=", "new", "SummaryStatistics", "(", ")", ";", "bucket", ".", "forEach", "(", "record", "->", "{", "final", "Double", "recordValue", "=", "getRecordValue", "(", "record", ")", ";", "if", "(", "recordValue", "!=", "null", ")", "stats", ".", "addValue", "(", "recordValue", ")", ";", "}", ")", ";", "final", "double", "meanValue", "=", "stats", ".", "getMean", "(", ")", ";", "final", "Record", "sampleRecord", "=", "getTimeValueRecord", "(", "bucket", ".", "get", "(", "0", ")", ")", ";", "final", "FieldType", "fieldType", "=", "bucket", ".", "get", "(", "0", ")", ".", "getField", "(", "valueFieldName", ")", ".", "getType", "(", ")", ";", "switch", "(", "fieldType", ")", "{", "case", "INT", ":", "sampleRecord", ".", "setField", "(", "valueFieldName", ",", "fieldType", ",", "(", "int", ")", "Math", ".", "round", "(", "meanValue", ")", ")", ";", "break", ";", "case", "LONG", ":", "sampleRecord", ".", "setField", "(", "valueFieldName", ",", "fieldType", ",", "Math", ".", "round", "(", "meanValue", ")", ")", ";", "break", ";", "case", "FLOAT", ":", "sampleRecord", ".", "setField", "(", "valueFieldName", ",", "fieldType", ",", "(", "float", ")", "meanValue", ")", ";", "break", ";", "case", "DOUBLE", ":", "sampleRecord", ".", "setField", "(", "valueFieldName", ",", "fieldType", ",", "meanValue", ")", ";", "break", ";", "}", "return", "sampleRecord", ";", "}", ")", ".", "collect", "(", "Collectors", ".", "toList", "(", ")", ")", ";", "}" ]
divide the points sequence into equally sized buckets and select the first point of each bucket
[ "divide", "the", "points", "sequence", "into", "equally", "sized", "buckets", "and", "select", "the", "first", "point", "of", "each", "bucket" ]
[ "// simple average to 100 data points" ]
[ { "param": "inputRecords", "type": "List<Record>" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "inputRecords", "type": "List<Record>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 565, 1071, 987, 32, 2115, 34, 3296, 12, 682, 32, 2115, 34, 810, 6499, 13, 288, 203, 3639, 368, 4143, 8164, 358, 2130, 501, 3143, 203, 3639, 327, 348, 7639, 1989, 18, 25472, 12, 2630, 6499, 16, 2783, 1225, 13, 203, 7734, 263, 1458, 12, 7242, 317, 288, 203, 10792, 17967, 8569, 3177, 273, 394, 17967, 8569, 5621, 203, 10792, 2783, 18, 1884, 3442, 12, 3366, 317, 288, 203, 13491, 727, 3698, 1409, 620, 273, 11674, 620, 12, 3366, 1769, 203, 13491, 309, 261, 3366, 620, 480, 446, 13, 203, 18701, 3177, 18, 1289, 620, 12, 3366, 620, 1769, 203, 10792, 15549, 203, 203, 10792, 727, 1645, 3722, 620, 273, 3177, 18, 588, 15312, 5621, 203, 10792, 727, 5059, 3296, 2115, 273, 6135, 620, 2115, 12, 7242, 18, 588, 12, 20, 10019, 203, 10792, 727, 16602, 9596, 273, 2783, 18, 588, 12, 20, 2934, 588, 974, 12, 1132, 7287, 2934, 588, 559, 5621, 203, 10792, 1620, 261, 1518, 559, 13, 288, 203, 13491, 648, 6137, 30, 203, 18701, 3296, 2115, 18, 542, 974, 12, 1132, 7287, 16, 9596, 16, 261, 474, 13, 2361, 18, 2260, 12, 7079, 620, 10019, 203, 18701, 898, 31, 203, 13491, 648, 14011, 30, 203, 18701, 3296, 2115, 18, 542, 974, 12, 1132, 7287, 16, 9596, 16, 2361, 18, 2260, 12, 7079, 620, 10019, 203, 18701, 898, 31, 203, 13491, 648, 15483, 30, 203, 18701, 3296, 2115, 18, 542, 974, 12, 1132, 7287, 16, 9596, 16, 261, 5659, 13, 3722, 620, 1769, 203, 18701, 898, 31, 203, 13491, 648, 14918, 30, 203, 18701, 3296, 2115, 18, 542, 974, 12, 1132, 7287, 16, 9596, 16, 3722, 620, 1769, 203, 18701, 898, 31, 203, 10792, 289, 203, 10792, 327, 3296, 2115, 31, 203, 7734, 289, 2934, 14676, 12, 10808, 1383, 18, 869, 682, 10663, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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26046, 9169, 203, 377, 380, 471, 2027, 326, 1122, 1634, 434, 1517, 2783, 203, 377, 380, 203, 377, 380, 632, 891, 810, 6499, 326, 810, 666, 203, 377, 380, 632, 2463, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
1c1c1348af5241f3164b025dbbc0f9fa09473252
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/functions/transformation/Distinct.java
[ "Apache-2.0" ]
Java
execute
null
@Override public void execute(MetricTimeSeries timeSeries, FunctionValueMap functionValueMap) { if (timeSeries.isEmpty()) { return; } timeSeries.sort(); LongList timeList = new LongList(timeSeries.size()); DoubleList valueList = new DoubleList(timeSeries.size()); //We should use a other data structure... Set<Double> distinct = new HashSet<>(); for (int i = 0; i < timeSeries.size(); i++) { double value = timeSeries.getValue(i); if (!distinct.contains(value)) { timeList.add(timeSeries.getTime(i)); valueList.add(value); distinct.add(value); } } timeSeries.clear(); timeSeries.addAll(timeList, valueList); functionValueMap.add(this); }
/** * Transforms a time series into a representation with distinct values. * The distinct operation uses the first occurrence of a point. * * @param timeSeries the time series that is transformed * @param functionValueMap the function value map */
Transforms a time series into a representation with distinct values. The distinct operation uses the first occurrence of a point. @param timeSeries the time series that is transformed @param functionValueMap the function value map
[ "Transforms", "a", "time", "series", "into", "a", "representation", "with", "distinct", "values", ".", "The", "distinct", "operation", "uses", "the", "first", "occurrence", "of", "a", "point", ".", "@param", "timeSeries", "the", "time", "series", "that", "is", "transformed", "@param", "functionValueMap", "the", "function", "value", "map" ]
@Override public void execute(MetricTimeSeries timeSeries, FunctionValueMap functionValueMap) { if (timeSeries.isEmpty()) { return; } timeSeries.sort(); LongList timeList = new LongList(timeSeries.size()); DoubleList valueList = new DoubleList(timeSeries.size()); Set<Double> distinct = new HashSet<>(); for (int i = 0; i < timeSeries.size(); i++) { double value = timeSeries.getValue(i); if (!distinct.contains(value)) { timeList.add(timeSeries.getTime(i)); valueList.add(value); distinct.add(value); } } timeSeries.clear(); timeSeries.addAll(timeList, valueList); functionValueMap.add(this); }
[ "@", "Override", "public", "void", "execute", "(", "MetricTimeSeries", "timeSeries", ",", "FunctionValueMap", "functionValueMap", ")", "{", "if", "(", "timeSeries", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "timeSeries", ".", "sort", "(", ")", ";", "LongList", "timeList", "=", "new", "LongList", "(", "timeSeries", ".", "size", "(", ")", ")", ";", "DoubleList", "valueList", "=", "new", "DoubleList", "(", "timeSeries", ".", "size", "(", ")", ")", ";", "Set", "<", "Double", ">", "distinct", "=", "new", "HashSet", "<", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "timeSeries", ".", "size", "(", ")", ";", "i", "++", ")", "{", "double", "value", "=", "timeSeries", ".", "getValue", "(", "i", ")", ";", "if", "(", "!", "distinct", ".", "contains", "(", "value", ")", ")", "{", "timeList", ".", "add", "(", "timeSeries", ".", "getTime", "(", "i", ")", ")", ";", "valueList", ".", "add", "(", "value", ")", ";", "distinct", ".", "add", "(", "value", ")", ";", "}", "}", "timeSeries", ".", "clear", "(", ")", ";", "timeSeries", ".", "addAll", "(", "timeList", ",", "valueList", ")", ";", "functionValueMap", ".", "add", "(", "this", ")", ";", "}" ]
Transforms a time series into a representation with distinct values.
[ "Transforms", "a", "time", "series", "into", "a", "representation", "with", "distinct", "values", "." ]
[ "//We should use a other data structure..." ]
[ { "param": "timeSeries", "type": "MetricTimeSeries" }, { "param": "functionValueMap", "type": "FunctionValueMap" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "timeSeries", "type": "MetricTimeSeries", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "functionValueMap", "type": "FunctionValueMap", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 565, 1071, 918, 1836, 12, 5396, 28486, 813, 6485, 16, 4284, 26795, 445, 26795, 13, 288, 203, 203, 3639, 309, 261, 957, 6485, 18, 291, 1921, 10756, 288, 203, 5411, 327, 31, 203, 3639, 289, 203, 203, 3639, 813, 6485, 18, 3804, 5621, 203, 203, 3639, 3407, 682, 813, 682, 273, 394, 3407, 682, 12, 957, 6485, 18, 1467, 10663, 203, 3639, 3698, 682, 460, 682, 273, 394, 3698, 682, 12, 957, 6485, 18, 1467, 10663, 203, 203, 3639, 368, 3218, 1410, 999, 279, 1308, 501, 3695, 2777, 203, 3639, 1000, 32, 5265, 34, 10217, 273, 394, 6847, 29667, 5621, 203, 203, 3639, 364, 261, 474, 277, 273, 374, 31, 277, 411, 813, 6485, 18, 1467, 5621, 277, 27245, 288, 203, 5411, 1645, 460, 273, 813, 6485, 18, 24805, 12, 77, 1769, 203, 203, 5411, 309, 16051, 24592, 18, 12298, 12, 1132, 3719, 288, 203, 7734, 813, 682, 18, 1289, 12, 957, 6485, 18, 588, 950, 12, 77, 10019, 203, 7734, 460, 682, 18, 1289, 12, 1132, 1769, 203, 7734, 10217, 18, 1289, 12, 1132, 1769, 203, 5411, 289, 203, 3639, 289, 203, 3639, 813, 6485, 18, 8507, 5621, 203, 3639, 813, 6485, 18, 1289, 1595, 12, 957, 682, 16, 460, 682, 1769, 203, 203, 3639, 445, 26795, 18, 1289, 12, 2211, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 2604, 9741, 279, 813, 4166, 1368, 279, 4335, 598, 10217, 924, 18, 203, 377, 380, 1021, 10217, 1674, 4692, 326, 1122, 13083, 434, 279, 1634, 18, 203, 377, 380, 203, 377, 380, 632, 891, 813, 6485, 3639, 326, 813, 4166, 716, 353, 10220, 203, 377, 380, 632, 891, 445, 26795, 326, 445, 460, 852, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
65141cfaae1f3a44de0cee19c1bba7d00daf7a4e
Hurence/historian
historian-server/src/main/java/com/hurence/webapiservice/http/api/ingestion/util/IngestionFinalResponseUtil.java
[ "Apache-2.0" ]
Java
constructFinalResponseCsv
JsonObject
public static JsonObject constructFinalResponseCsv(AllFilesReport allFilesReport, CsvFilesConvertorConf csvFilesConvertorConf) { JsonArray report = getGroupedByReportFromInjectedPoints(allFilesReport, csvFilesConvertorConf); JsonObject finalResponse = new JsonObject(); if (!report.isEmpty()) finalResponse.put(FIELD_TAGS, new JsonArray(csvFilesConvertorConf.getTags())) .put(GROUPED_BY_IN_RESPONSE, new JsonArray(csvFilesConvertorConf.getGroupByListWithNAME())) .put(REPORT, report); if (!allFilesReport.filesThatFailedToBeImported.isEmpty()) finalResponse.put(ERRORS, allFilesReport.filesThatFailedToBeImported); return finalResponse; }
/** * @param allFilesReport AllFilesReport * @param csvFilesConvertorConf CsvFilesConvertorConf * * construct the final response to return, which should be grouped by. * * @return JsonObject : the response to return */
construct the final response to return, which should be grouped by. @return JsonObject : the response to return
[ "construct", "the", "final", "response", "to", "return", "which", "should", "be", "grouped", "by", ".", "@return", "JsonObject", ":", "the", "response", "to", "return" ]
public static JsonObject constructFinalResponseCsv(AllFilesReport allFilesReport, CsvFilesConvertorConf csvFilesConvertorConf) { JsonArray report = getGroupedByReportFromInjectedPoints(allFilesReport, csvFilesConvertorConf); JsonObject finalResponse = new JsonObject(); if (!report.isEmpty()) finalResponse.put(FIELD_TAGS, new JsonArray(csvFilesConvertorConf.getTags())) .put(GROUPED_BY_IN_RESPONSE, new JsonArray(csvFilesConvertorConf.getGroupByListWithNAME())) .put(REPORT, report); if (!allFilesReport.filesThatFailedToBeImported.isEmpty()) finalResponse.put(ERRORS, allFilesReport.filesThatFailedToBeImported); return finalResponse; }
[ "public", "static", "JsonObject", "constructFinalResponseCsv", "(", "AllFilesReport", "allFilesReport", ",", "CsvFilesConvertorConf", "csvFilesConvertorConf", ")", "{", "JsonArray", "report", "=", "getGroupedByReportFromInjectedPoints", "(", "allFilesReport", ",", "csvFilesConvertorConf", ")", ";", "JsonObject", "finalResponse", "=", "new", "JsonObject", "(", ")", ";", "if", "(", "!", "report", ".", "isEmpty", "(", ")", ")", "finalResponse", ".", "put", "(", "FIELD_TAGS", ",", "new", "JsonArray", "(", "csvFilesConvertorConf", ".", "getTags", "(", ")", ")", ")", ".", "put", "(", "GROUPED_BY_IN_RESPONSE", ",", "new", "JsonArray", "(", "csvFilesConvertorConf", ".", "getGroupByListWithNAME", "(", ")", ")", ")", ".", "put", "(", "REPORT", ",", "report", ")", ";", "if", "(", "!", "allFilesReport", ".", "filesThatFailedToBeImported", ".", "isEmpty", "(", ")", ")", "finalResponse", ".", "put", "(", "ERRORS", ",", "allFilesReport", ".", "filesThatFailedToBeImported", ")", ";", "return", "finalResponse", ";", "}" ]
@param allFilesReport AllFilesReport @param csvFilesConvertorConf CsvFilesConvertorConf
[ "@param", "allFilesReport", "AllFilesReport", "@param", "csvFilesConvertorConf", "CsvFilesConvertorConf" ]
[]
[ { "param": "allFilesReport", "type": "AllFilesReport" }, { "param": "csvFilesConvertorConf", "type": "CsvFilesConvertorConf" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "allFilesReport", "type": "AllFilesReport", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "csvFilesConvertorConf", "type": "CsvFilesConvertorConf", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 760, 11596, 4872, 7951, 1064, 16759, 12, 1595, 2697, 4820, 777, 2697, 4820, 16, 203, 4766, 15604, 21532, 2697, 2723, 280, 3976, 6101, 2697, 2723, 280, 3976, 13, 288, 203, 203, 3639, 25109, 2605, 273, 11751, 18696, 4820, 1265, 382, 6059, 5636, 12, 454, 2697, 4820, 16, 6101, 2697, 2723, 280, 3976, 1769, 203, 203, 3639, 11596, 727, 1064, 273, 394, 11596, 5621, 203, 203, 3639, 309, 16051, 6006, 18, 291, 1921, 10756, 203, 5411, 727, 1064, 18, 458, 12, 6776, 67, 29915, 16, 394, 25109, 12, 6715, 2697, 2723, 280, 3976, 18, 588, 3453, 1435, 3719, 203, 10792, 263, 458, 12, 43, 1457, 57, 12120, 67, 6486, 67, 706, 67, 14508, 16, 394, 25109, 12, 6715, 2697, 2723, 280, 3976, 18, 588, 26257, 682, 1190, 1985, 1435, 3719, 203, 10792, 263, 458, 12, 22710, 16, 2605, 1769, 203, 203, 3639, 309, 16051, 454, 2697, 4820, 18, 2354, 18163, 2925, 15360, 24934, 18, 291, 1921, 10756, 203, 5411, 727, 1064, 18, 458, 12, 29127, 16, 777, 2697, 4820, 18, 2354, 18163, 2925, 15360, 24934, 1769, 203, 203, 3639, 327, 727,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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 632, 891, 777, 2697, 4820, 1850, 4826, 2697, 4820, 203, 377, 380, 632, 891, 6101, 2697, 2723, 280, 3976, 282, 21532, 2697, 2723, 280, 3976, 203, 377, 380, 203, 377, 380, 4872, 326, 727, 766, 358, 327, 16, 1492, 1410, 506, 10303, 635, 18, 203, 377, 380, 203, 377, 380, 632, 2463, 11596, 294, 326, 766, 358, 327, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
65141cfaae1f3a44de0cee19c1bba7d00daf7a4e
Hurence/historian
historian-server/src/main/java/com/hurence/webapiservice/http/api/ingestion/util/IngestionFinalResponseUtil.java
[ "Apache-2.0" ]
Java
fillingThe_groupedByFieldsForEveryChunk_List
null
private static void fillingThe_groupedByFieldsForEveryChunk_List(JsonArray timeseriesPoints, JsonArray groupedByFields, List<HashMap<String, String>> groupedByFieldsForEveryChunk ) { for (Object timeserieObject : timeseriesPoints) { JsonObject timeserie = (JsonObject) timeserieObject; JsonObject tagsObject = timeserie.getJsonObject(FIELD_TAGS); HashMap<String, String> groupedByFieldsForThisChunk = new LinkedHashMap<>(); groupedByFields.forEach(f -> { if (f.toString().equals(FIELD_NAME)) groupedByFieldsForThisChunk.put(f.toString(),timeserie.getString(f.toString())); else groupedByFieldsForThisChunk.put(f.toString(),tagsObject.getString(f.toString())); }); int totalNumPointsInChunk = timeserie.getJsonArray(POINTS).size(); groupedByFieldsForThisChunk.put("totalPointsForThisChunk", String.valueOf(totalNumPointsInChunk)); groupedByFieldsForEveryChunk.add(groupedByFieldsForThisChunk); } }
/** * @param timeseriesPoints JsonArray * @param groupedByFields JsonArray * @param groupedByFieldsForEveryChunk List<HashMap<String, String>> * * fill the groupedByFieldsForEveryChunk list which contains the fields to group by for every chunk, * and add the element totalPointsForThisChunk for every chunk * * @return void */
fill the groupedByFieldsForEveryChunk list which contains the fields to group by for every chunk, and add the element totalPointsForThisChunk for every chunk @return void
[ "fill", "the", "groupedByFieldsForEveryChunk", "list", "which", "contains", "the", "fields", "to", "group", "by", "for", "every", "chunk", "and", "add", "the", "element", "totalPointsForThisChunk", "for", "every", "chunk", "@return", "void" ]
private static void fillingThe_groupedByFieldsForEveryChunk_List(JsonArray timeseriesPoints, JsonArray groupedByFields, List<HashMap<String, String>> groupedByFieldsForEveryChunk ) { for (Object timeserieObject : timeseriesPoints) { JsonObject timeserie = (JsonObject) timeserieObject; JsonObject tagsObject = timeserie.getJsonObject(FIELD_TAGS); HashMap<String, String> groupedByFieldsForThisChunk = new LinkedHashMap<>(); groupedByFields.forEach(f -> { if (f.toString().equals(FIELD_NAME)) groupedByFieldsForThisChunk.put(f.toString(),timeserie.getString(f.toString())); else groupedByFieldsForThisChunk.put(f.toString(),tagsObject.getString(f.toString())); }); int totalNumPointsInChunk = timeserie.getJsonArray(POINTS).size(); groupedByFieldsForThisChunk.put("totalPointsForThisChunk", String.valueOf(totalNumPointsInChunk)); groupedByFieldsForEveryChunk.add(groupedByFieldsForThisChunk); } }
[ "private", "static", "void", "fillingThe_groupedByFieldsForEveryChunk_List", "(", "JsonArray", "timeseriesPoints", ",", "JsonArray", "groupedByFields", ",", "List", "<", "HashMap", "<", "String", ",", "String", ">", ">", "groupedByFieldsForEveryChunk", ")", "{", "for", "(", "Object", "timeserieObject", ":", "timeseriesPoints", ")", "{", "JsonObject", "timeserie", "=", "(", "JsonObject", ")", "timeserieObject", ";", "JsonObject", "tagsObject", "=", "timeserie", ".", "getJsonObject", "(", "FIELD_TAGS", ")", ";", "HashMap", "<", "String", ",", "String", ">", "groupedByFieldsForThisChunk", "=", "new", "LinkedHashMap", "<", ">", "(", ")", ";", "groupedByFields", ".", "forEach", "(", "f", "->", "{", "if", "(", "f", ".", "toString", "(", ")", ".", "equals", "(", "FIELD_NAME", ")", ")", "groupedByFieldsForThisChunk", ".", "put", "(", "f", ".", "toString", "(", ")", ",", "timeserie", ".", "getString", "(", "f", ".", "toString", "(", ")", ")", ")", ";", "else", "groupedByFieldsForThisChunk", ".", "put", "(", "f", ".", "toString", "(", ")", ",", "tagsObject", ".", "getString", "(", "f", ".", "toString", "(", ")", ")", ")", ";", "}", ")", ";", "int", "totalNumPointsInChunk", "=", "timeserie", ".", "getJsonArray", "(", "POINTS", ")", ".", "size", "(", ")", ";", "groupedByFieldsForThisChunk", ".", "put", "(", "\"totalPointsForThisChunk\"", ",", "String", ".", "valueOf", "(", "totalNumPointsInChunk", ")", ")", ";", "groupedByFieldsForEveryChunk", ".", "add", "(", "groupedByFieldsForThisChunk", ")", ";", "}", "}" ]
@param timeseriesPoints JsonArray @param groupedByFields JsonArray @param groupedByFieldsForEveryChunk List<HashMap<String, String>>
[ "@param", "timeseriesPoints", "JsonArray", "@param", "groupedByFields", "JsonArray", "@param", "groupedByFieldsForEveryChunk", "List<HashMap<String", "String", ">>" ]
[]
[ { "param": "timeseriesPoints", "type": "JsonArray" }, { "param": "groupedByFields", "type": "JsonArray" }, { "param": "groupedByFieldsForEveryChunk", "type": "List<HashMap<String, String>>" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "timeseriesPoints", "type": "JsonArray", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "groupedByFields", "type": "JsonArray", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "groupedByFieldsForEveryChunk", "type": "List<HashMap<String, String>>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 3238, 760, 918, 25740, 1986, 67, 1655, 18696, 2314, 1290, 21465, 5579, 67, 682, 12, 3185, 1076, 18677, 5636, 16, 25109, 10303, 858, 2314, 16, 203, 4766, 19694, 987, 32, 8658, 32, 780, 16, 514, 9778, 10303, 858, 2314, 1290, 21465, 5579, 262, 288, 203, 3639, 364, 261, 921, 4124, 264, 1385, 921, 294, 18677, 5636, 13, 288, 203, 5411, 11596, 4124, 264, 1385, 273, 261, 23857, 13, 4124, 264, 1385, 921, 31, 203, 5411, 11596, 2342, 921, 273, 4124, 264, 1385, 18, 588, 23857, 12, 6776, 67, 29915, 1769, 203, 5411, 4317, 32, 780, 16, 514, 34, 10303, 858, 2314, 1290, 2503, 5579, 273, 394, 13589, 29667, 5621, 203, 5411, 10303, 858, 2314, 18, 1884, 3442, 12, 74, 317, 288, 203, 7734, 309, 261, 74, 18, 10492, 7675, 14963, 12, 6776, 67, 1985, 3719, 203, 10792, 10303, 858, 2314, 1290, 2503, 5579, 18, 458, 12, 74, 18, 10492, 9334, 8293, 264, 1385, 18, 588, 780, 12, 74, 18, 10492, 1435, 10019, 203, 7734, 469, 203, 10792, 10303, 858, 2314, 1290, 2503, 5579, 18, 458, 12, 74, 18, 10492, 9334, 4156, 921, 18, 588, 780, 12, 74, 18, 10492, 1435, 10019, 203, 5411, 15549, 203, 5411, 509, 2078, 2578, 5636, 382, 5579, 273, 4124, 264, 1385, 18, 588, 3185, 1076, 12, 8941, 55, 2934, 1467, 5621, 203, 5411, 10303, 858, 2314, 1290, 2503, 5579, 18, 458, 2932, 4963, 5636, 1290, 2503, 5579, 3113, 514, 18, 1132, 951, 12, 4963, 2578, 5636, 382, 5579, 10019, 203, 5411, 10303, 858, 2314, 1290, 21465, 5579, 18, 1289, 12, 1655, 18696, 2314, 1290, 2503, 5579, 1769, 203, 3639, 289, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 632, 891, 18677, 5636, 9079, 25109, 203, 377, 380, 632, 891, 10303, 858, 2314, 7734, 25109, 203, 377, 380, 632, 891, 10303, 858, 2314, 1290, 21465, 5579, 282, 987, 32, 8658, 32, 780, 16, 514, 9778, 203, 377, 380, 203, 377, 380, 3636, 326, 10303, 858, 2314, 1290, 21465, 5579, 666, 1492, 1914, 326, 1466, 358, 1041, 635, 364, 3614, 2441, 16, 203, 377, 380, 4766, 4202, 471, 527, 326, 930, 2078, 5636, 1290, 2503, 5579, 364, 3614, 2441, 203, 377, 380, 203, 377, 380, 632, 2463, 918, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
8c56d7708d104d28562619767c9eeda33e8ab55d
Hurence/historian
historian-timeseries/src/test/java/com/hurence/timeseries/compaction/protobuf/ProtoBufTimeSeriesSerializerWithQualityEmbedded3Test.java
[ "Apache-2.0" ]
Java
test3
null
@Test public void test3() throws IOException { List<Measure> inputMeasures = Arrays.asList( Measure.fromValueAndQuality(1, 1.2d, 1.0f), Measure.fromValueAndQuality(2, 1.0d, 0.9f), Measure.fromValueAndQuality(3, 1.0d, 0.8f), Measure.fromValueAndQuality(4, 1.0d, 0.7f), Measure.fromValueAndQuality(5, 1.0d, 0.69f), Measure.fromValueAndQuality(6, 1.0d, 0.68f), Measure.fromValueAndQuality(7, 1.0d, 0.679f), Measure.fromValueAndQuality(8, 1.0d, 0.671f), Measure.fromValueAndQuality(9, 1.0d, 0.67f), Measure.fromValueAndQuality(10, 1.0d, 0.669f), Measure.fromValueAndQuality(11, 1.0d, 0.05f), Measure.fromValueAndQuality(12, 1.0d, 0.0f), Measure.fromValueAndQuality(13, 1.2d, 0.9f), Measure.fromValueAndQuality(14, 1.2d, 0.99f), Measure.fromValueAndQuality(15, 1.2d, 1f) ); TreeSet<Measure> actualMeasures = testThereIsNoInformationLost(inputMeasures, 0.33f); TreeSet<Measure> expectedMeasures = new TreeSet(Arrays.asList( Measure.fromValueAndQuality(1, 1.2d, 1.0f), Measure.fromValueAndQuality(2, 1.0d, 1.0f), Measure.fromValueAndQuality(3, 1.0d, 1.0f), Measure.fromValueAndQuality(4, 1.0d, 1.0f), Measure.fromValueAndQuality(5, 1.0d, 1.0f), Measure.fromValueAndQuality(6, 1.0d, 1.0f), Measure.fromValueAndQuality(7, 1.0d, 1.0f), Measure.fromValueAndQuality(8, 1.0d, 1.0f), Measure.fromValueAndQuality(9, 1.0d, 1.0f), Measure.fromValueAndQuality(10, 1.0d, 0.669f), Measure.fromValueAndQuality(11, 1.0d, 0.05f), Measure.fromValueAndQuality(12, 1.0d, 0.0f), Measure.fromValueAndQuality(13, 1.2d, 0.9f), Measure.fromValueAndQuality(14, 1.2d, 0.9f), Measure.fromValueAndQuality(15, 1.2d, 1f) )); assertEquals(expectedMeasures, actualMeasures); }
//Here when the diff is exactly 0.05 this is not enough to make the quality stored
Here when the diff is exactly 0.05 this is not enough to make the quality stored
[ "Here", "when", "the", "diff", "is", "exactly", "0", ".", "05", "this", "is", "not", "enough", "to", "make", "the", "quality", "stored" ]
@Test public void test3() throws IOException { List<Measure> inputMeasures = Arrays.asList( Measure.fromValueAndQuality(1, 1.2d, 1.0f), Measure.fromValueAndQuality(2, 1.0d, 0.9f), Measure.fromValueAndQuality(3, 1.0d, 0.8f), Measure.fromValueAndQuality(4, 1.0d, 0.7f), Measure.fromValueAndQuality(5, 1.0d, 0.69f), Measure.fromValueAndQuality(6, 1.0d, 0.68f), Measure.fromValueAndQuality(7, 1.0d, 0.679f), Measure.fromValueAndQuality(8, 1.0d, 0.671f), Measure.fromValueAndQuality(9, 1.0d, 0.67f), Measure.fromValueAndQuality(10, 1.0d, 0.669f), Measure.fromValueAndQuality(11, 1.0d, 0.05f), Measure.fromValueAndQuality(12, 1.0d, 0.0f), Measure.fromValueAndQuality(13, 1.2d, 0.9f), Measure.fromValueAndQuality(14, 1.2d, 0.99f), Measure.fromValueAndQuality(15, 1.2d, 1f) ); TreeSet<Measure> actualMeasures = testThereIsNoInformationLost(inputMeasures, 0.33f); TreeSet<Measure> expectedMeasures = new TreeSet(Arrays.asList( Measure.fromValueAndQuality(1, 1.2d, 1.0f), Measure.fromValueAndQuality(2, 1.0d, 1.0f), Measure.fromValueAndQuality(3, 1.0d, 1.0f), Measure.fromValueAndQuality(4, 1.0d, 1.0f), Measure.fromValueAndQuality(5, 1.0d, 1.0f), Measure.fromValueAndQuality(6, 1.0d, 1.0f), Measure.fromValueAndQuality(7, 1.0d, 1.0f), Measure.fromValueAndQuality(8, 1.0d, 1.0f), Measure.fromValueAndQuality(9, 1.0d, 1.0f), Measure.fromValueAndQuality(10, 1.0d, 0.669f), Measure.fromValueAndQuality(11, 1.0d, 0.05f), Measure.fromValueAndQuality(12, 1.0d, 0.0f), Measure.fromValueAndQuality(13, 1.2d, 0.9f), Measure.fromValueAndQuality(14, 1.2d, 0.9f), Measure.fromValueAndQuality(15, 1.2d, 1f) )); assertEquals(expectedMeasures, actualMeasures); }
[ "@", "Test", "public", "void", "test3", "(", ")", "throws", "IOException", "{", "List", "<", "Measure", ">", "inputMeasures", "=", "Arrays", ".", "asList", "(", "Measure", ".", "fromValueAndQuality", "(", "1", ",", "1.2d", ",", "1.0f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "2", ",", "1.0d", ",", "0.9f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "3", ",", "1.0d", ",", "0.8f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "4", ",", "1.0d", ",", "0.7f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "5", ",", "1.0d", ",", "0.69f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "6", ",", "1.0d", ",", "0.68f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "7", ",", "1.0d", ",", "0.679f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "8", ",", "1.0d", ",", "0.671f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "9", ",", "1.0d", ",", "0.67f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "10", ",", "1.0d", ",", "0.669f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "11", ",", "1.0d", ",", "0.05f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "12", ",", "1.0d", ",", "0.0f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "13", ",", "1.2d", ",", "0.9f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "14", ",", "1.2d", ",", "0.99f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "15", ",", "1.2d", ",", "1f", ")", ")", ";", "TreeSet", "<", "Measure", ">", "actualMeasures", "=", "testThereIsNoInformationLost", "(", "inputMeasures", ",", "0.33f", ")", ";", "TreeSet", "<", "Measure", ">", "expectedMeasures", "=", "new", "TreeSet", "(", "Arrays", ".", "asList", "(", "Measure", ".", "fromValueAndQuality", "(", "1", ",", "1.2d", ",", "1.0f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "2", ",", "1.0d", ",", "1.0f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "3", ",", "1.0d", ",", "1.0f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "4", ",", "1.0d", ",", "1.0f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "5", ",", "1.0d", ",", "1.0f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "6", ",", "1.0d", ",", "1.0f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "7", ",", "1.0d", ",", "1.0f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "8", ",", "1.0d", ",", "1.0f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "9", ",", "1.0d", ",", "1.0f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "10", ",", "1.0d", ",", "0.669f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "11", ",", "1.0d", ",", "0.05f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "12", ",", "1.0d", ",", "0.0f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "13", ",", "1.2d", ",", "0.9f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "14", ",", "1.2d", ",", "0.9f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "15", ",", "1.2d", ",", "1f", ")", ")", ")", ";", "assertEquals", "(", "expectedMeasures", ",", "actualMeasures", ")", ";", "}" ]
Here when the diff is exactly 0.05 this is not enough to make the quality stored
[ "Here", "when", "the", "diff", "is", "exactly", "0", ".", "05", "this", "is", "not", "enough", "to", "make", "the", "quality", "stored" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 4709, 203, 565, 1071, 918, 1842, 23, 1435, 1216, 1860, 288, 203, 3639, 987, 32, 7197, 34, 810, 23177, 1823, 273, 5647, 18, 345, 682, 12, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 21, 16, 404, 18, 22, 72, 16, 404, 18, 20, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 22, 16, 404, 18, 20, 72, 16, 374, 18, 29, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 23, 16, 404, 18, 20, 72, 16, 374, 18, 28, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 24, 16, 404, 18, 20, 72, 16, 374, 18, 27, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 25, 16, 404, 18, 20, 72, 16, 374, 18, 8148, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 26, 16, 404, 18, 20, 72, 16, 374, 18, 9470, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 27, 16, 404, 18, 20, 72, 16, 374, 18, 26, 7235, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 28, 16, 404, 18, 20, 72, 16, 374, 18, 9599, 21, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 29, 16, 404, 18, 20, 72, 16, 374, 18, 9599, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 2163, 16, 404, 18, 20, 72, 16, 374, 18, 6028, 29, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 2499, 16, 404, 18, 20, 72, 16, 374, 18, 6260, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 2138, 16, 404, 18, 20, 72, 16, 374, 18, 20, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 3437, 16, 404, 18, 22, 72, 16, 374, 18, 29, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 3461, 16, 404, 18, 22, 72, 16, 374, 18, 2733, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 3600, 16, 404, 18, 22, 72, 16, 404, 74, 13, 203, 3639, 11272, 203, 3639, 19461, 32, 7197, 34, 3214, 23177, 1823, 273, 1842, 9828, 2520, 2279, 5369, 19024, 12, 2630, 23177, 1823, 16, 374, 18, 3707, 74, 1769, 203, 3639, 19461, 32, 7197, 34, 2665, 23177, 1823, 273, 394, 19461, 12, 12726, 18, 345, 682, 12, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 21, 16, 404, 18, 22, 72, 16, 404, 18, 20, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 22, 16, 404, 18, 20, 72, 16, 404, 18, 20, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 23, 16, 404, 18, 20, 72, 16, 404, 18, 20, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 24, 16, 404, 18, 20, 72, 16, 404, 18, 20, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 25, 16, 404, 18, 20, 72, 16, 404, 18, 20, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 26, 16, 2 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
[ 1, 759, 26715, 1347, 326, 3122, 353, 8950, 374, 18, 6260, 333, 353, 486, 7304, 358, 1221, 326, 9312, 4041, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
8c56d7708d104d28562619767c9eeda33e8ab55d
Hurence/historian
historian-timeseries/src/test/java/com/hurence/timeseries/compaction/protobuf/ProtoBufTimeSeriesSerializerWithQualityEmbedded3Test.java
[ "Apache-2.0" ]
Java
test4
null
@Test public void test4() throws IOException { List<Measure> inputMeasures = Arrays.asList( Measure.fromValueAndQuality(1, 1.2d, 1.0f), Measure.fromValueAndQuality(2, 1.0d, 1.0f), Measure.fromValueAndQuality(3, 1.8d, 0.2f), Measure.fromValueAndQuality(4, 1.8d, 0.10000001f), Measure.fromValueAndQuality(5, 1.3d, 0.1f), Measure.fromValueAndQuality(6, 1.3d, 0.09f), Measure.fromValueAndQuality(7, 1.2d, 1.0f) ); TreeSet<Measure> actualMeasures = testThereIsNoInformationLost(inputMeasures, 0.1f); TreeSet<Measure> expectedMeasures = new TreeSet(Arrays.asList( Measure.fromValueAndQuality(1, 1.2d, 1.0f), Measure.fromValueAndQuality(2, 1.0d, 1.0f), Measure.fromValueAndQuality(3, 1.8d, 0.2f), Measure.fromValueAndQuality(4, 1.8d, 0.2f), Measure.fromValueAndQuality(5, 1.3d, 0.2f), Measure.fromValueAndQuality(6, 1.3d, 0.09f), Measure.fromValueAndQuality(7, 1.2d, 1.0f) )); assertEquals(expectedMeasures, actualMeasures); }
//Here when the diff is exactly 0.05 this is not enough to make the quality stored
Here when the diff is exactly 0.05 this is not enough to make the quality stored
[ "Here", "when", "the", "diff", "is", "exactly", "0", ".", "05", "this", "is", "not", "enough", "to", "make", "the", "quality", "stored" ]
@Test public void test4() throws IOException { List<Measure> inputMeasures = Arrays.asList( Measure.fromValueAndQuality(1, 1.2d, 1.0f), Measure.fromValueAndQuality(2, 1.0d, 1.0f), Measure.fromValueAndQuality(3, 1.8d, 0.2f), Measure.fromValueAndQuality(4, 1.8d, 0.10000001f), Measure.fromValueAndQuality(5, 1.3d, 0.1f), Measure.fromValueAndQuality(6, 1.3d, 0.09f), Measure.fromValueAndQuality(7, 1.2d, 1.0f) ); TreeSet<Measure> actualMeasures = testThereIsNoInformationLost(inputMeasures, 0.1f); TreeSet<Measure> expectedMeasures = new TreeSet(Arrays.asList( Measure.fromValueAndQuality(1, 1.2d, 1.0f), Measure.fromValueAndQuality(2, 1.0d, 1.0f), Measure.fromValueAndQuality(3, 1.8d, 0.2f), Measure.fromValueAndQuality(4, 1.8d, 0.2f), Measure.fromValueAndQuality(5, 1.3d, 0.2f), Measure.fromValueAndQuality(6, 1.3d, 0.09f), Measure.fromValueAndQuality(7, 1.2d, 1.0f) )); assertEquals(expectedMeasures, actualMeasures); }
[ "@", "Test", "public", "void", "test4", "(", ")", "throws", "IOException", "{", "List", "<", "Measure", ">", "inputMeasures", "=", "Arrays", ".", "asList", "(", "Measure", ".", "fromValueAndQuality", "(", "1", ",", "1.2d", ",", "1.0f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "2", ",", "1.0d", ",", "1.0f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "3", ",", "1.8d", ",", "0.2f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "4", ",", "1.8d", ",", "0.10000001f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "5", ",", "1.3d", ",", "0.1f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "6", ",", "1.3d", ",", "0.09f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "7", ",", "1.2d", ",", "1.0f", ")", ")", ";", "TreeSet", "<", "Measure", ">", "actualMeasures", "=", "testThereIsNoInformationLost", "(", "inputMeasures", ",", "0.1f", ")", ";", "TreeSet", "<", "Measure", ">", "expectedMeasures", "=", "new", "TreeSet", "(", "Arrays", ".", "asList", "(", "Measure", ".", "fromValueAndQuality", "(", "1", ",", "1.2d", ",", "1.0f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "2", ",", "1.0d", ",", "1.0f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "3", ",", "1.8d", ",", "0.2f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "4", ",", "1.8d", ",", "0.2f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "5", ",", "1.3d", ",", "0.2f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "6", ",", "1.3d", ",", "0.09f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "7", ",", "1.2d", ",", "1.0f", ")", ")", ")", ";", "assertEquals", "(", "expectedMeasures", ",", "actualMeasures", ")", ";", "}" ]
Here when the diff is exactly 0.05 this is not enough to make the quality stored
[ "Here", "when", "the", "diff", "is", "exactly", "0", ".", "05", "this", "is", "not", "enough", "to", "make", "the", "quality", "stored" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 4709, 203, 565, 1071, 918, 1842, 24, 1435, 1216, 1860, 288, 203, 3639, 987, 32, 7197, 34, 810, 23177, 1823, 273, 5647, 18, 345, 682, 12, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 21, 16, 404, 18, 22, 72, 16, 404, 18, 20, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 22, 16, 404, 18, 20, 72, 16, 404, 18, 20, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 23, 16, 404, 18, 28, 72, 16, 374, 18, 22, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 24, 16, 404, 18, 28, 72, 16, 374, 18, 21, 9449, 21, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 25, 16, 404, 18, 23, 72, 16, 374, 18, 21, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 26, 16, 404, 18, 23, 72, 16, 374, 18, 5908, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 27, 16, 404, 18, 22, 72, 16, 404, 18, 20, 74, 13, 203, 3639, 11272, 203, 3639, 19461, 32, 7197, 34, 3214, 23177, 1823, 273, 1842, 9828, 2520, 2279, 5369, 19024, 12, 2630, 23177, 1823, 16, 374, 18, 21, 74, 1769, 203, 3639, 19461, 32, 7197, 34, 2665, 23177, 1823, 273, 394, 19461, 12, 12726, 18, 345, 682, 12, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 21, 16, 404, 18, 22, 72, 16, 404, 18, 20, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 22, 16, 404, 18, 20, 72, 16, 404, 18, 20, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 23, 16, 404, 18, 28, 72, 16, 374, 18, 22, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 24, 16, 404, 18, 28, 72, 16, 374, 18, 22, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 25, 16, 404, 18, 23, 72, 16, 374, 18, 22, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 26, 16, 404, 18, 23, 72, 16, 374, 18, 5908, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 27, 16, 404, 18, 22, 72, 16, 404, 18, 20, 74, 13, 203, 3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-100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
8c56d7708d104d28562619767c9eeda33e8ab55d
Hurence/historian
historian-timeseries/src/test/java/com/hurence/timeseries/compaction/protobuf/ProtoBufTimeSeriesSerializerWithQualityEmbedded3Test.java
[ "Apache-2.0" ]
Java
test5
null
@Test public void test5() throws IOException { List<Measure> inputMeasures = Arrays.asList( Measure.fromValueAndQuality(1, 1.2d, 1.0f), Measure.fromValueAndQuality(2, 1.0d, 1.5f), Measure.fromValueAndQuality(3, 1.8d, 1.549f), Measure.fromValueAndQuality(4, 1.3d, 1.451f), Measure.fromValueAndQuality(5, 1.2d, 1.45f), Measure.fromValueAndQuality(6, 1.2d, 1.449f) ); TreeSet<Measure> actualMeasures = testThereIsNoInformationLost(inputMeasures, 0.05f); TreeSet<Measure> expectedMeasures = new TreeSet(Arrays.asList( Measure.fromValueAndQuality(1, 1.2d, 1.0f), Measure.fromValueAndQuality(2, 1.0d, 1.5f), Measure.fromValueAndQuality(3, 1.8d, 1.5f), Measure.fromValueAndQuality(4, 1.3d, 1.5f), Measure.fromValueAndQuality(5, 1.2d, 1.5f), Measure.fromValueAndQuality(6, 1.2d, 1.449f) )); assertEquals(expectedMeasures, actualMeasures); }
//Here when the diff is exactly 0.05 this is not enough to make the quality stored
Here when the diff is exactly 0.05 this is not enough to make the quality stored
[ "Here", "when", "the", "diff", "is", "exactly", "0", ".", "05", "this", "is", "not", "enough", "to", "make", "the", "quality", "stored" ]
@Test public void test5() throws IOException { List<Measure> inputMeasures = Arrays.asList( Measure.fromValueAndQuality(1, 1.2d, 1.0f), Measure.fromValueAndQuality(2, 1.0d, 1.5f), Measure.fromValueAndQuality(3, 1.8d, 1.549f), Measure.fromValueAndQuality(4, 1.3d, 1.451f), Measure.fromValueAndQuality(5, 1.2d, 1.45f), Measure.fromValueAndQuality(6, 1.2d, 1.449f) ); TreeSet<Measure> actualMeasures = testThereIsNoInformationLost(inputMeasures, 0.05f); TreeSet<Measure> expectedMeasures = new TreeSet(Arrays.asList( Measure.fromValueAndQuality(1, 1.2d, 1.0f), Measure.fromValueAndQuality(2, 1.0d, 1.5f), Measure.fromValueAndQuality(3, 1.8d, 1.5f), Measure.fromValueAndQuality(4, 1.3d, 1.5f), Measure.fromValueAndQuality(5, 1.2d, 1.5f), Measure.fromValueAndQuality(6, 1.2d, 1.449f) )); assertEquals(expectedMeasures, actualMeasures); }
[ "@", "Test", "public", "void", "test5", "(", ")", "throws", "IOException", "{", "List", "<", "Measure", ">", "inputMeasures", "=", "Arrays", ".", "asList", "(", "Measure", ".", "fromValueAndQuality", "(", "1", ",", "1.2d", ",", "1.0f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "2", ",", "1.0d", ",", "1.5f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "3", ",", "1.8d", ",", "1.549f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "4", ",", "1.3d", ",", "1.451f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "5", ",", "1.2d", ",", "1.45f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "6", ",", "1.2d", ",", "1.449f", ")", ")", ";", "TreeSet", "<", "Measure", ">", "actualMeasures", "=", "testThereIsNoInformationLost", "(", "inputMeasures", ",", "0.05f", ")", ";", "TreeSet", "<", "Measure", ">", "expectedMeasures", "=", "new", "TreeSet", "(", "Arrays", ".", "asList", "(", "Measure", ".", "fromValueAndQuality", "(", "1", ",", "1.2d", ",", "1.0f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "2", ",", "1.0d", ",", "1.5f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "3", ",", "1.8d", ",", "1.5f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "4", ",", "1.3d", ",", "1.5f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "5", ",", "1.2d", ",", "1.5f", ")", ",", "Measure", ".", "fromValueAndQuality", "(", "6", ",", "1.2d", ",", "1.449f", ")", ")", ")", ";", "assertEquals", "(", "expectedMeasures", ",", "actualMeasures", ")", ";", "}" ]
Here when the diff is exactly 0.05 this is not enough to make the quality stored
[ "Here", "when", "the", "diff", "is", "exactly", "0", ".", "05", "this", "is", "not", "enough", "to", "make", "the", "quality", "stored" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 4709, 203, 565, 1071, 918, 1842, 25, 1435, 1216, 1860, 288, 203, 3639, 987, 32, 7197, 34, 810, 23177, 1823, 273, 5647, 18, 345, 682, 12, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 21, 16, 404, 18, 22, 72, 16, 404, 18, 20, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 22, 16, 404, 18, 20, 72, 16, 404, 18, 25, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 23, 16, 404, 18, 28, 72, 16, 404, 18, 6564, 29, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 24, 16, 404, 18, 23, 72, 16, 404, 18, 7950, 21, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 25, 16, 404, 18, 22, 72, 16, 404, 18, 7950, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 26, 16, 404, 18, 22, 72, 16, 404, 18, 6334, 29, 74, 13, 203, 3639, 11272, 203, 3639, 19461, 32, 7197, 34, 3214, 23177, 1823, 273, 1842, 9828, 2520, 2279, 5369, 19024, 12, 2630, 23177, 1823, 16, 374, 18, 6260, 74, 1769, 203, 3639, 19461, 32, 7197, 34, 2665, 23177, 1823, 273, 394, 19461, 12, 12726, 18, 345, 682, 12, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 21, 16, 404, 18, 22, 72, 16, 404, 18, 20, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 22, 16, 404, 18, 20, 72, 16, 404, 18, 25, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 23, 16, 404, 18, 28, 72, 16, 404, 18, 25, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 24, 16, 404, 18, 23, 72, 16, 404, 18, 25, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 25, 16, 404, 18, 22, 72, 16, 404, 18, 25, 74, 3631, 203, 7734, 13544, 18, 2080, 620, 1876, 14846, 12, 26, 16, 404, 18, 22, 72, 16, 404, 18, 6334, 29, 74, 13, 203, 3639, 262, 1769, 203, 3639, 1815, 8867, 12, 3825, 23177, 1823, 16, 3214, 23177, 1823, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 759, 26715, 1347, 326, 3122, 353, 8950, 374, 18, 6260, 333, 353, 486, 7304, 358, 1221, 326, 9312, 4041, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
300e8a3e50ae5d81a6e3027b8c65b9f3adedcd03
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/functions/analyse/FastDtw.java
[ "Apache-2.0" ]
Java
buildMultiVariateTimeSeries
MultivariateTimeSeries
private MultivariateTimeSeries buildMultiVariateTimeSeries(MetricTimeSeries timeSeries) { MultivariateTimeSeries multivariateTimeSeries = new MultivariateTimeSeries(1); if (timeSeries.size() > 0) { //First sort the values timeSeries.sort(); long formerTimestamp = timeSeries.getTime(0); double formerValue = timeSeries.getValue(0); int timesSameTimestamp = 0; for (int i = 1; i < timeSeries.size(); i++) { //We have two timestamps that are the same if (formerTimestamp == timeSeries.getTime(i)) { formerValue += timeSeries.getValue(i); timesSameTimestamp++; } else { //calc the average of the values of the same timestamp if (timesSameTimestamp > 0) { formerValue = formerValue / timesSameTimestamp; timesSameTimestamp = 0; } //first add the former timestamp multivariateTimeSeries.add(formerTimestamp, new double[]{formerValue}); formerTimestamp = timeSeries.getTime(i); formerValue = timeSeries.getValue(i); } } //add the last point multivariateTimeSeries.add(formerTimestamp, new double[]{formerValue}); } return multivariateTimeSeries; }
/** * Builds a multivariate time series of the given univariate time series. * If two or more timestamps are the same, the values are aggregated using the average. * * @param timeSeries the metric time series * @return a multivariate time series for the fast dtw analysis */
Builds a multivariate time series of the given univariate time series. If two or more timestamps are the same, the values are aggregated using the average. @param timeSeries the metric time series @return a multivariate time series for the fast dtw analysis
[ "Builds", "a", "multivariate", "time", "series", "of", "the", "given", "univariate", "time", "series", ".", "If", "two", "or", "more", "timestamps", "are", "the", "same", "the", "values", "are", "aggregated", "using", "the", "average", ".", "@param", "timeSeries", "the", "metric", "time", "series", "@return", "a", "multivariate", "time", "series", "for", "the", "fast", "dtw", "analysis" ]
private MultivariateTimeSeries buildMultiVariateTimeSeries(MetricTimeSeries timeSeries) { MultivariateTimeSeries multivariateTimeSeries = new MultivariateTimeSeries(1); if (timeSeries.size() > 0) { timeSeries.sort(); long formerTimestamp = timeSeries.getTime(0); double formerValue = timeSeries.getValue(0); int timesSameTimestamp = 0; for (int i = 1; i < timeSeries.size(); i++) { if (formerTimestamp == timeSeries.getTime(i)) { formerValue += timeSeries.getValue(i); timesSameTimestamp++; } else { if (timesSameTimestamp > 0) { formerValue = formerValue / timesSameTimestamp; timesSameTimestamp = 0; } multivariateTimeSeries.add(formerTimestamp, new double[]{formerValue}); formerTimestamp = timeSeries.getTime(i); formerValue = timeSeries.getValue(i); } } multivariateTimeSeries.add(formerTimestamp, new double[]{formerValue}); } return multivariateTimeSeries; }
[ "private", "MultivariateTimeSeries", "buildMultiVariateTimeSeries", "(", "MetricTimeSeries", "timeSeries", ")", "{", "MultivariateTimeSeries", "multivariateTimeSeries", "=", "new", "MultivariateTimeSeries", "(", "1", ")", ";", "if", "(", "timeSeries", ".", "size", "(", ")", ">", "0", ")", "{", "timeSeries", ".", "sort", "(", ")", ";", "long", "formerTimestamp", "=", "timeSeries", ".", "getTime", "(", "0", ")", ";", "double", "formerValue", "=", "timeSeries", ".", "getValue", "(", "0", ")", ";", "int", "timesSameTimestamp", "=", "0", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "timeSeries", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "formerTimestamp", "==", "timeSeries", ".", "getTime", "(", "i", ")", ")", "{", "formerValue", "+=", "timeSeries", ".", "getValue", "(", "i", ")", ";", "timesSameTimestamp", "++", ";", "}", "else", "{", "if", "(", "timesSameTimestamp", ">", "0", ")", "{", "formerValue", "=", "formerValue", "/", "timesSameTimestamp", ";", "timesSameTimestamp", "=", "0", ";", "}", "multivariateTimeSeries", ".", "add", "(", "formerTimestamp", ",", "new", "double", "[", "]", "{", "formerValue", "}", ")", ";", "formerTimestamp", "=", "timeSeries", ".", "getTime", "(", "i", ")", ";", "formerValue", "=", "timeSeries", ".", "getValue", "(", "i", ")", ";", "}", "}", "multivariateTimeSeries", ".", "add", "(", "formerTimestamp", ",", "new", "double", "[", "]", "{", "formerValue", "}", ")", ";", "}", "return", "multivariateTimeSeries", ";", "}" ]
Builds a multivariate time series of the given univariate time series.
[ "Builds", "a", "multivariate", "time", "series", "of", "the", "given", "univariate", "time", "series", "." ]
[ "//First sort the values", "//We have two timestamps that are the same", "//calc the average of the values of the same timestamp", "//first add the former timestamp", "//add the last point" ]
[ { "param": "timeSeries", "type": "MetricTimeSeries" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "timeSeries", "type": "MetricTimeSeries", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 3238, 7778, 27693, 28486, 1361, 5002, 1537, 3840, 28486, 12, 5396, 28486, 813, 6485, 13, 288, 203, 3639, 7778, 27693, 28486, 1778, 27693, 28486, 273, 394, 7778, 27693, 28486, 12, 21, 1769, 203, 203, 3639, 309, 261, 957, 6485, 18, 1467, 1435, 405, 374, 13, 288, 203, 5411, 368, 3759, 1524, 326, 924, 203, 5411, 813, 6485, 18, 3804, 5621, 203, 203, 5411, 1525, 27313, 4921, 273, 813, 6485, 18, 588, 950, 12, 20, 1769, 203, 5411, 1645, 27313, 620, 273, 813, 6485, 18, 24805, 12, 20, 1769, 203, 5411, 509, 4124, 8650, 4921, 273, 374, 31, 203, 203, 5411, 364, 261, 474, 277, 273, 404, 31, 277, 411, 813, 6485, 18, 1467, 5621, 277, 27245, 288, 203, 203, 7734, 368, 3218, 1240, 2795, 11267, 716, 854, 326, 1967, 203, 7734, 309, 261, 7208, 4921, 422, 813, 6485, 18, 588, 950, 12, 77, 3719, 288, 203, 10792, 27313, 620, 1011, 813, 6485, 18, 24805, 12, 77, 1769, 203, 10792, 4124, 8650, 4921, 9904, 31, 203, 7734, 289, 469, 288, 203, 10792, 368, 12448, 326, 8164, 434, 326, 924, 434, 326, 1967, 2858, 203, 10792, 309, 261, 8293, 8650, 4921, 405, 374, 13, 288, 203, 13491, 27313, 620, 273, 27313, 620, 342, 4124, 8650, 4921, 31, 203, 13491, 4124, 8650, 4921, 273, 374, 31, 203, 10792, 289, 203, 10792, 368, 3645, 527, 326, 27313, 2858, 203, 10792, 1778, 27693, 28486, 18, 1289, 12, 7208, 4921, 16, 394, 1645, 63, 7073, 7208, 620, 22938, 203, 10792, 27313, 4921, 273, 813, 6485, 18, 588, 950, 12, 77, 1769, 203, 10792, 27313, 620, 273, 813, 6485, 18, 24805, 12, 77, 1769, 203, 7734, 289, 203, 5411, 289, 203, 5411, 368, 1289, 326, 1142, 1634, 203, 5411, 1778, 27693, 28486, 18, 1289, 12, 7208, 4921, 16, 394, 1645, 63, 7073, 7208, 620, 22938, 203, 3639, 289, 203, 203, 3639, 327, 1778, 27693, 28486, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 3998, 87, 279, 1778, 27693, 813, 4166, 434, 326, 864, 640, 27693, 813, 4166, 18, 203, 377, 380, 971, 2795, 578, 1898, 11267, 854, 326, 1967, 16, 326, 924, 854, 16165, 1450, 326, 8164, 18, 203, 377, 380, 203, 377, 380, 632, 891, 813, 6485, 326, 3999, 813, 4166, 203, 377, 380, 632, 2463, 279, 1778, 27693, 813, 4166, 364, 326, 4797, 3681, 91, 6285, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
637b7f32306dfb77b48dc278f4261e96cde05f1d
Hurence/historian
logisland-timeseries/src/main/java/com/hurence/logisland/BinaryCompactionConverterOfRecord.java
[ "Apache-2.0" ]
Java
chunk
TimeSeriesRecord
@Override public TimeSeriesRecord chunk(List<Record> records) { if (records.isEmpty()) throw new ProcessException("not enough records to build a timeseries, should contain at least 1 records "); final MetricTimeSeries timeSeries = buildTimeSeries(records); final TimeSeriesRecord chunkrecord = new TimeSeriesRecord(timeSeries); // compress chunk into binaries byte[] serializedTimeseries = serializeTimeseries(timeSeries); chunkrecord.setField(TimeSeriesRecord.CHUNK_VALUE, FieldType.BYTES, serializedTimeseries); chunkrecord.setField(TimeSeriesRecord.CHUNK_SIZE_BYTES, FieldType.INT, serializedTimeseries.length); return chunkrecord; }
/** * Compact a related list of records a single chunked one * * @param records * @return * @throws ProcessException */
Compact a related list of records a single chunked one @param records @return @throws ProcessException
[ "Compact", "a", "related", "list", "of", "records", "a", "single", "chunked", "one", "@param", "records", "@return", "@throws", "ProcessException" ]
@Override public TimeSeriesRecord chunk(List<Record> records) { if (records.isEmpty()) throw new ProcessException("not enough records to build a timeseries, should contain at least 1 records "); final MetricTimeSeries timeSeries = buildTimeSeries(records); final TimeSeriesRecord chunkrecord = new TimeSeriesRecord(timeSeries); byte[] serializedTimeseries = serializeTimeseries(timeSeries); chunkrecord.setField(TimeSeriesRecord.CHUNK_VALUE, FieldType.BYTES, serializedTimeseries); chunkrecord.setField(TimeSeriesRecord.CHUNK_SIZE_BYTES, FieldType.INT, serializedTimeseries.length); return chunkrecord; }
[ "@", "Override", "public", "TimeSeriesRecord", "chunk", "(", "List", "<", "Record", ">", "records", ")", "{", "if", "(", "records", ".", "isEmpty", "(", ")", ")", "throw", "new", "ProcessException", "(", "\"not enough records to build a timeseries, should contain at least 1 records \"", ")", ";", "final", "MetricTimeSeries", "timeSeries", "=", "buildTimeSeries", "(", "records", ")", ";", "final", "TimeSeriesRecord", "chunkrecord", "=", "new", "TimeSeriesRecord", "(", "timeSeries", ")", ";", "byte", "[", "]", "serializedTimeseries", "=", "serializeTimeseries", "(", "timeSeries", ")", ";", "chunkrecord", ".", "setField", "(", "TimeSeriesRecord", ".", "CHUNK_VALUE", ",", "FieldType", ".", "BYTES", ",", "serializedTimeseries", ")", ";", "chunkrecord", ".", "setField", "(", "TimeSeriesRecord", ".", "CHUNK_SIZE_BYTES", ",", "FieldType", ".", "INT", ",", "serializedTimeseries", ".", "length", ")", ";", "return", "chunkrecord", ";", "}" ]
Compact a related list of records a single chunked one @param records @return @throws ProcessException
[ "Compact", "a", "related", "list", "of", "records", "a", "single", "chunked", "one", "@param", "records", "@return", "@throws", "ProcessException" ]
[ "// compress chunk into binaries" ]
[ { "param": "records", "type": "List<Record>" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "records", "type": "List<Record>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 565, 1071, 26084, 2115, 2441, 12, 682, 32, 2115, 34, 3853, 13, 288, 203, 203, 3639, 309, 261, 7094, 18, 291, 1921, 10756, 203, 5411, 604, 394, 4389, 503, 2932, 902, 7304, 3853, 358, 1361, 279, 18677, 16, 1410, 912, 622, 4520, 404, 3853, 315, 1769, 203, 203, 3639, 727, 7279, 28486, 813, 6485, 273, 1361, 28486, 12, 7094, 1769, 203, 3639, 727, 26084, 2115, 2441, 3366, 273, 394, 26084, 2115, 12, 957, 6485, 1769, 203, 203, 3639, 368, 8099, 2441, 1368, 4158, 5646, 203, 3639, 1160, 8526, 5343, 10694, 3924, 273, 4472, 10694, 3924, 12, 957, 6485, 1769, 203, 3639, 2441, 3366, 18, 542, 974, 12, 28486, 2115, 18, 26464, 67, 4051, 16, 16602, 18, 13718, 16, 5343, 10694, 3924, 1769, 203, 3639, 2441, 3366, 18, 542, 974, 12, 28486, 2115, 18, 26464, 67, 4574, 67, 13718, 16, 16602, 18, 3217, 16, 5343, 10694, 3924, 18, 2469, 1769, 203, 203, 3639, 327, 2441, 3366, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 23823, 279, 3746, 666, 434, 3853, 279, 2202, 19949, 1245, 203, 377, 380, 203, 377, 380, 632, 891, 3853, 203, 377, 380, 632, 2463, 203, 377, 380, 632, 15069, 4389, 503, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
637b7f32306dfb77b48dc278f4261e96cde05f1d
Hurence/historian
logisland-timeseries/src/main/java/com/hurence/logisland/BinaryCompactionConverterOfRecord.java
[ "Apache-2.0" ]
Java
unchunk
null
@Override public List<Record> unchunk(final TimeSeriesRecord record) throws IOException { final long start = record.getTimeSeries().getStart(); final long end = record.getTimeSeries().getEnd(); return BinaryCompactionUtil.unCompressPoints(record.getField(TimeSeriesRecord.CHUNK_VALUE).asBytes(), start, end).stream() .map(m -> { long timestamp = m.getTimestamp(); double value = m.getValue(); Record pointRecord = new StandardRecord(record.getType()) .setStringField(FieldDictionary.RECORD_NAME, record.getTimeSeries().getName()) .setField(FieldDictionary.RECORD_TIME, FieldType.LONG, timestamp) .setField(FieldDictionary.RECORD_VALUE, FieldType.DOUBLE, value); record.getTimeSeries().attributes().keySet().forEach(key -> { pointRecord.setStringField(key, String.valueOf(record.getTimeSeries().attribute(key))); }); return pointRecord; }).collect(Collectors.toList()); }
/** * Reverse operation for chunk operation * * @param record * @return * @throws ProcessException */
Reverse operation for chunk operation @param record @return @throws ProcessException
[ "Reverse", "operation", "for", "chunk", "operation", "@param", "record", "@return", "@throws", "ProcessException" ]
@Override public List<Record> unchunk(final TimeSeriesRecord record) throws IOException { final long start = record.getTimeSeries().getStart(); final long end = record.getTimeSeries().getEnd(); return BinaryCompactionUtil.unCompressPoints(record.getField(TimeSeriesRecord.CHUNK_VALUE).asBytes(), start, end).stream() .map(m -> { long timestamp = m.getTimestamp(); double value = m.getValue(); Record pointRecord = new StandardRecord(record.getType()) .setStringField(FieldDictionary.RECORD_NAME, record.getTimeSeries().getName()) .setField(FieldDictionary.RECORD_TIME, FieldType.LONG, timestamp) .setField(FieldDictionary.RECORD_VALUE, FieldType.DOUBLE, value); record.getTimeSeries().attributes().keySet().forEach(key -> { pointRecord.setStringField(key, String.valueOf(record.getTimeSeries().attribute(key))); }); return pointRecord; }).collect(Collectors.toList()); }
[ "@", "Override", "public", "List", "<", "Record", ">", "unchunk", "(", "final", "TimeSeriesRecord", "record", ")", "throws", "IOException", "{", "final", "long", "start", "=", "record", ".", "getTimeSeries", "(", ")", ".", "getStart", "(", ")", ";", "final", "long", "end", "=", "record", ".", "getTimeSeries", "(", ")", ".", "getEnd", "(", ")", ";", "return", "BinaryCompactionUtil", ".", "unCompressPoints", "(", "record", ".", "getField", "(", "TimeSeriesRecord", ".", "CHUNK_VALUE", ")", ".", "asBytes", "(", ")", ",", "start", ",", "end", ")", ".", "stream", "(", ")", ".", "map", "(", "m", "->", "{", "long", "timestamp", "=", "m", ".", "getTimestamp", "(", ")", ";", "double", "value", "=", "m", ".", "getValue", "(", ")", ";", "Record", "pointRecord", "=", "new", "StandardRecord", "(", "record", ".", "getType", "(", ")", ")", ".", "setStringField", "(", "FieldDictionary", ".", "RECORD_NAME", ",", "record", ".", "getTimeSeries", "(", ")", ".", "getName", "(", ")", ")", ".", "setField", "(", "FieldDictionary", ".", "RECORD_TIME", ",", "FieldType", ".", "LONG", ",", "timestamp", ")", ".", "setField", "(", "FieldDictionary", ".", "RECORD_VALUE", ",", "FieldType", ".", "DOUBLE", ",", "value", ")", ";", "record", ".", "getTimeSeries", "(", ")", ".", "attributes", "(", ")", ".", "keySet", "(", ")", ".", "forEach", "(", "key", "->", "{", "pointRecord", ".", "setStringField", "(", "key", ",", "String", ".", "valueOf", "(", "record", ".", "getTimeSeries", "(", ")", ".", "attribute", "(", "key", ")", ")", ")", ";", "}", ")", ";", "return", "pointRecord", ";", "}", ")", ".", "collect", "(", "Collectors", ".", "toList", "(", ")", ")", ";", "}" ]
Reverse operation for chunk operation @param record @return @throws ProcessException
[ "Reverse", "operation", "for", "chunk", "operation", "@param", "record", "@return", "@throws", "ProcessException" ]
[]
[ { "param": "record", "type": "TimeSeriesRecord" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "record", "type": "TimeSeriesRecord", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 565, 1071, 987, 32, 2115, 34, 640, 6551, 12, 6385, 26084, 2115, 1409, 13, 1216, 1860, 288, 203, 203, 3639, 727, 1525, 787, 273, 1409, 18, 588, 28486, 7675, 588, 1685, 5621, 203, 3639, 727, 1525, 679, 273, 1409, 18, 588, 28486, 7675, 588, 1638, 5621, 203, 3639, 327, 7896, 2945, 1128, 1304, 18, 318, 16552, 5636, 12, 3366, 18, 588, 974, 12, 28486, 2115, 18, 26464, 67, 4051, 2934, 345, 2160, 9334, 787, 16, 679, 2934, 3256, 1435, 203, 7734, 263, 1458, 12, 81, 317, 288, 203, 203, 10792, 1525, 2858, 273, 312, 18, 588, 4921, 5621, 203, 10792, 1645, 460, 273, 312, 18, 24805, 5621, 203, 203, 10792, 5059, 1634, 2115, 273, 394, 8263, 2115, 12, 3366, 18, 588, 559, 10756, 203, 18701, 263, 542, 780, 974, 12, 974, 10905, 18, 22261, 67, 1985, 16, 1409, 18, 588, 28486, 7675, 17994, 10756, 203, 18701, 263, 542, 974, 12, 974, 10905, 18, 22261, 67, 4684, 16, 16602, 18, 14639, 16, 2858, 13, 203, 18701, 263, 542, 974, 12, 974, 10905, 18, 22261, 67, 4051, 16, 16602, 18, 17088, 16, 460, 1769, 203, 203, 10792, 1409, 18, 588, 28486, 7675, 4350, 7675, 856, 694, 7675, 1884, 3442, 12, 856, 317, 288, 203, 13491, 1634, 2115, 18, 542, 780, 974, 12, 856, 16, 514, 18, 1132, 951, 12, 3366, 18, 588, 28486, 7675, 4589, 12, 856, 3719, 1769, 203, 10792, 15549, 203, 203, 203, 10792, 327, 1634, 2115, 31, 203, 7734, 289, 2934, 14676, 12, 10808, 1383, 18, 869, 682, 10663, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 18469, 1674, 364, 2441, 1674, 203, 377, 380, 203, 377, 380, 632, 891, 1409, 203, 377, 380, 632, 2463, 203, 377, 380, 632, 15069, 4389, 503, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
d5096a22d9e288b62d389b2a08b747b159e19379
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/model/Chunk.java
[ "Apache-2.0" ]
Java
computeMetrics
ChunkBuilder
public ChunkBuilder computeMetrics() { DateTime time = new DateTime(start); day = time.toString("yyyy-MM-dd"); year = time.getYear(); month = time.getMonthOfYear(); return this; }
/** * compute the metrics from the valueBinaries field so there's no need to read them */
compute the metrics from the valueBinaries field so there's no need to read them
[ "compute", "the", "metrics", "from", "the", "valueBinaries", "field", "so", "there", "'", "s", "no", "need", "to", "read", "them" ]
public ChunkBuilder computeMetrics() { DateTime time = new DateTime(start); day = time.toString("yyyy-MM-dd"); year = time.getYear(); month = time.getMonthOfYear(); return this; }
[ "public", "ChunkBuilder", "computeMetrics", "(", ")", "{", "DateTime", "time", "=", "new", "DateTime", "(", "start", ")", ";", "day", "=", "time", ".", "toString", "(", "\"yyyy-MM-dd\"", ")", ";", "year", "=", "time", ".", "getYear", "(", ")", ";", "month", "=", "time", ".", "getMonthOfYear", "(", ")", ";", "return", "this", ";", "}" ]
compute the metrics from the valueBinaries field so there's no need to read them
[ "compute", "the", "metrics", "from", "the", "valueBinaries", "field", "so", "there", "'", "s", "no", "need", "to", "read", "them" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 13021, 1263, 3671, 5653, 1435, 288, 203, 5411, 3716, 813, 273, 394, 3716, 12, 1937, 1769, 203, 5411, 2548, 273, 813, 18, 10492, 2932, 17722, 17, 8206, 17, 449, 8863,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 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
d5096a22d9e288b62d389b2a08b747b159e19379
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/model/Chunk.java
[ "Apache-2.0" ]
Java
toHumanReadable
String
public String toHumanReadable(boolean withTimestamps) { SimpleDateFormat sdf = Measure.createUtcDateFormatter("yyyy-MM-dd HH:mm:ss.SSS"); StringBuilder stringBuilder = new StringBuilder(" Value as string: " + getValueAsString()); stringBuilder.append("\n Human readable value:"); try { TreeSet<Measure> measures = BinaryCompactionUtil.unCompressPoints(value, start, end); for (Measure measure : measures) { double measureValue = measure.getValue(); float quality = measure.getQuality(); long timestamp = measure.getTimestamp(); String readableTimestamp = sdf.format(new Date(timestamp)); stringBuilder.append("\n t=").append(readableTimestamp); if (withTimestamps) { stringBuilder.append(" (" + timestamp + ")"); } stringBuilder .append(" v=").append(measureValue) .append(" q=").append(quality); } } catch (IOException e) { e.printStackTrace(); } return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE) + stringBuilder; }
/** * Get human readable Chunk including uncompressed readable measure values * * @param withTimestamps Display timestamp next to human readable dates or not * @return */
Get human readable Chunk including uncompressed readable measure values @param withTimestamps Display timestamp next to human readable dates or not @return
[ "Get", "human", "readable", "Chunk", "including", "uncompressed", "readable", "measure", "values", "@param", "withTimestamps", "Display", "timestamp", "next", "to", "human", "readable", "dates", "or", "not", "@return" ]
public String toHumanReadable(boolean withTimestamps) { SimpleDateFormat sdf = Measure.createUtcDateFormatter("yyyy-MM-dd HH:mm:ss.SSS"); StringBuilder stringBuilder = new StringBuilder(" Value as string: " + getValueAsString()); stringBuilder.append("\n Human readable value:"); try { TreeSet<Measure> measures = BinaryCompactionUtil.unCompressPoints(value, start, end); for (Measure measure : measures) { double measureValue = measure.getValue(); float quality = measure.getQuality(); long timestamp = measure.getTimestamp(); String readableTimestamp = sdf.format(new Date(timestamp)); stringBuilder.append("\n t=").append(readableTimestamp); if (withTimestamps) { stringBuilder.append(" (" + timestamp + ")"); } stringBuilder .append(" v=").append(measureValue) .append(" q=").append(quality); } } catch (IOException e) { e.printStackTrace(); } return ReflectionToStringBuilder.toString(this, ToStringStyle.MULTI_LINE_STYLE) + stringBuilder; }
[ "public", "String", "toHumanReadable", "(", "boolean", "withTimestamps", ")", "{", "SimpleDateFormat", "sdf", "=", "Measure", ".", "createUtcDateFormatter", "(", "\"yyyy-MM-dd HH:mm:ss.SSS\"", ")", ";", "StringBuilder", "stringBuilder", "=", "new", "StringBuilder", "(", "\" Value as string: \"", "+", "getValueAsString", "(", ")", ")", ";", "stringBuilder", ".", "append", "(", "\"\\n Human readable value:\"", ")", ";", "try", "{", "TreeSet", "<", "Measure", ">", "measures", "=", "BinaryCompactionUtil", ".", "unCompressPoints", "(", "value", ",", "start", ",", "end", ")", ";", "for", "(", "Measure", "measure", ":", "measures", ")", "{", "double", "measureValue", "=", "measure", ".", "getValue", "(", ")", ";", "float", "quality", "=", "measure", ".", "getQuality", "(", ")", ";", "long", "timestamp", "=", "measure", ".", "getTimestamp", "(", ")", ";", "String", "readableTimestamp", "=", "sdf", ".", "format", "(", "new", "Date", "(", "timestamp", ")", ")", ";", "stringBuilder", ".", "append", "(", "\"\\n t=\"", ")", ".", "append", "(", "readableTimestamp", ")", ";", "if", "(", "withTimestamps", ")", "{", "stringBuilder", ".", "append", "(", "\" (\"", "+", "timestamp", "+", "\")\"", ")", ";", "}", "stringBuilder", ".", "append", "(", "\" v=\"", ")", ".", "append", "(", "measureValue", ")", ".", "append", "(", "\" q=\"", ")", ".", "append", "(", "quality", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "ReflectionToStringBuilder", ".", "toString", "(", "this", ",", "ToStringStyle", ".", "MULTI_LINE_STYLE", ")", "+", "stringBuilder", ";", "}" ]
Get human readable Chunk including uncompressed readable measure values @param withTimestamps Display timestamp next to human readable dates or not @return
[ "Get", "human", "readable", "Chunk", "including", "uncompressed", "readable", "measure", "values", "@param", "withTimestamps", "Display", "timestamp", "next", "to", "human", "readable", "dates", "or", "not", "@return" ]
[]
[ { "param": "withTimestamps", "type": "boolean" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "withTimestamps", "type": "boolean", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 514, 358, 28201, 14151, 12, 6494, 598, 23761, 13, 288, 203, 3639, 17005, 31789, 273, 13544, 18, 2640, 57, 5111, 1626, 5074, 2932, 17722, 17, 8206, 17, 449, 20842, 30, 7020, 30, 1049, 18, 1260, 55, 8863, 203, 3639, 3225, 24777, 273, 394, 3225, 2932, 1445, 487, 533, 30, 315, 397, 2366, 8092, 10663, 203, 3639, 24777, 18, 6923, 31458, 82, 225, 670, 6925, 7471, 460, 2773, 1769, 203, 3639, 775, 288, 203, 5411, 19461, 32, 7197, 34, 22692, 273, 7896, 2945, 1128, 1304, 18, 318, 16552, 5636, 12, 1132, 16, 787, 16, 679, 1769, 203, 5411, 364, 261, 7197, 6649, 294, 22692, 13, 288, 203, 7734, 1645, 6649, 620, 273, 6649, 18, 24805, 5621, 203, 7734, 1431, 9312, 273, 6649, 18, 588, 14846, 5621, 203, 7734, 1525, 2858, 273, 6649, 18, 588, 4921, 5621, 203, 7734, 514, 7471, 4921, 273, 31789, 18, 2139, 12, 2704, 2167, 12, 5508, 10019, 203, 7734, 24777, 18, 6923, 31458, 82, 565, 268, 1546, 2934, 6923, 12, 11018, 4921, 1769, 203, 7734, 309, 261, 1918, 23761, 13, 288, 203, 10792, 24777, 18, 6923, 2932, 7566, 397, 2858, 397, 7310, 1769, 203, 7734, 289, 203, 7734, 24777, 203, 13491, 263, 6923, 2932, 331, 1546, 2934, 6923, 12, 10772, 620, 13, 203, 13491, 263, 6923, 2932, 1043, 1546, 2934, 6923, 12, 16495, 1769, 203, 5411, 289, 203, 3639, 289, 1044, 261, 14106, 425, 13, 288, 203, 5411, 425, 18, 1188, 6332, 5621, 203, 3639, 289, 203, 3639, 327, 5685, 5808, 1263, 18, 10492, 12, 2211, 16, 21901, 2885, 18, 26588, 67, 5997, 67, 15066, 13, 397, 24777, 31, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 968, 8672, 7471, 13021, 6508, 20560, 7471, 6649, 924, 203, 377, 380, 203, 377, 380, 632, 891, 598, 23761, 9311, 2858, 1024, 358, 8672, 7471, 7811, 578, 486, 203, 377, 380, 632, 2463, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
d5096a22d9e288b62d389b2a08b747b159e19379
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/model/Chunk.java
[ "Apache-2.0" ]
Java
compute
String
public String compute() { StringBuilder idBuilder = new StringBuilder(name); // If there are some tags, add them with their values in an alphabetically sorted way // according to the tag key if (tags != null && tags.size() > 0) { SortedSet<String> sortedTags = new TreeSet<>(tags.keySet()); // Sort tag keys sortedTags.forEach((tagKey) -> { idBuilder.append(TOKEN_SEPARATOR) .append(tagKey) .append(TAG_KEY_VALUE_SEPARATOR) .append(tags.get(tagKey)); }); } return idBuilder.toString(); }
/** * Computes the unique metric key in the form: * <name>[|tagName=tageValue] with tags alphabetically sorted * according to the tag name * * @return */
Computes the unique metric key in the form: [|tagName=tageValue] with tags alphabetically sorted according to the tag name @return
[ "Computes", "the", "unique", "metric", "key", "in", "the", "form", ":", "[", "|tagName", "=", "tageValue", "]", "with", "tags", "alphabetically", "sorted", "according", "to", "the", "tag", "name", "@return" ]
public String compute() { StringBuilder idBuilder = new StringBuilder(name); if (tags != null && tags.size() > 0) { SortedSet<String> sortedTags = new TreeSet<>(tags.keySet()); sortedTags.forEach((tagKey) -> { idBuilder.append(TOKEN_SEPARATOR) .append(tagKey) .append(TAG_KEY_VALUE_SEPARATOR) .append(tags.get(tagKey)); }); } return idBuilder.toString(); }
[ "public", "String", "compute", "(", ")", "{", "StringBuilder", "idBuilder", "=", "new", "StringBuilder", "(", "name", ")", ";", "if", "(", "tags", "!=", "null", "&&", "tags", ".", "size", "(", ")", ">", "0", ")", "{", "SortedSet", "<", "String", ">", "sortedTags", "=", "new", "TreeSet", "<", ">", "(", "tags", ".", "keySet", "(", ")", ")", ";", "sortedTags", ".", "forEach", "(", "(", "tagKey", ")", "->", "{", "idBuilder", ".", "append", "(", "TOKEN_SEPARATOR", ")", ".", "append", "(", "tagKey", ")", ".", "append", "(", "TAG_KEY_VALUE_SEPARATOR", ")", ".", "append", "(", "tags", ".", "get", "(", "tagKey", ")", ")", ";", "}", ")", ";", "}", "return", "idBuilder", ".", "toString", "(", ")", ";", "}" ]
Computes the unique metric key in the form: <name>[|tagName=tageValue] with tags alphabetically sorted according to the tag name
[ "Computes", "the", "unique", "metric", "key", "in", "the", "form", ":", "<name", ">", "[", "|tagName", "=", "tageValue", "]", "with", "tags", "alphabetically", "sorted", "according", "to", "the", "tag", "name" ]
[ "// If there are some tags, add them with their values in an alphabetically sorted way", "// according to the tag key", "// Sort tag keys" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 514, 3671, 1435, 288, 203, 5411, 3225, 612, 1263, 273, 394, 3225, 12, 529, 1769, 203, 5411, 368, 971, 1915, 854, 2690, 2342, 16, 527, 2182, 598, 3675, 924, 316, 392, 10877, 6478, 3115, 4031, 203, 5411, 368, 4888, 358, 326, 1047, 498, 203, 5411, 309, 261, 4156, 480, 446, 597, 2342, 18, 1467, 1435, 405, 374, 13, 288, 203, 7734, 22123, 32, 780, 34, 3115, 3453, 273, 394, 19461, 29667, 12, 4156, 18, 856, 694, 10663, 368, 5928, 1047, 1311, 203, 7734, 3115, 3453, 18, 1884, 3442, 12443, 2692, 653, 13, 317, 288, 203, 10792, 612, 1263, 18, 6923, 12, 8412, 67, 4550, 13, 203, 18701, 263, 6923, 12, 2692, 653, 13, 203, 18701, 263, 6923, 12, 7927, 67, 3297, 67, 4051, 67, 4550, 13, 203, 18701, 263, 6923, 12, 4156, 18, 588, 12, 2692, 653, 10019, 203, 7734, 15549, 203, 5411, 289, 203, 5411, 327, 612, 1263, 18, 10492, 5621, 203, 3639, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 540, 380, 14169, 281, 326, 3089, 3999, 498, 316, 326, 646, 30, 203, 540, 380, 411, 529, 23224, 96, 2692, 461, 33, 88, 410, 620, 65, 598, 2342, 10877, 6478, 3115, 203, 540, 380, 4888, 358, 326, 1047, 508, 203, 540, 380, 203, 540, 380, 632, 2463, 203, 540, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
d5096a22d9e288b62d389b2a08b747b159e19379
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/model/Chunk.java
[ "Apache-2.0" ]
Java
parse
MetricKey
public static MetricKey parse(String id) { if ((id == null) || (id.length() == 0)) { throw new IllegalArgumentException("null or empty metric key"); } // metricName|tag1$tag1Val|tag2$tag2val String[] tokens = id.split(Pattern.quote(TOKEN_SEPARATOR)); String name = tokens[0]; if (tokens.length == 1) { // No tags ( ["metricName"] ) return new MetricKey(name); } else { // Some tags: parse them ( ["metricName", "tag1$tag1Val" , "tag2$tag2val"] ) Map<String, String> tags = new HashMap<String, String>(); for (int i = 1; i < tokens.length; i++) { // "tag1$tag1Val" String tagAndValues = tokens[i]; String[] tagAndValue = tagAndValues.split(Pattern.quote(TAG_KEY_VALUE_SEPARATOR)); if ((tagAndValue == null) || (tagAndValue.length != 2)) { StringBuilder stringBuilder = new StringBuilder(); if (tagAndValue != null) { for (String token : tagAndValue) { stringBuilder.append(" " + token); } } else { stringBuilder.append(" null"); } // sometimes there's no value for one key. this is real life :) if (tagAndValue.length == 1) tags.put(tagAndValue[0], ""); else throw new IllegalArgumentException("tag component has wrong format:" + stringBuilder); } else { tags.put(tagAndValue[0], tagAndValue[1]); } } return new MetricKey(name, tags); } }
/** * Parses a metric key in the form as defined by the compute method * * @param id * @return */
Parses a metric key in the form as defined by the compute method @param id @return
[ "Parses", "a", "metric", "key", "in", "the", "form", "as", "defined", "by", "the", "compute", "method", "@param", "id", "@return" ]
public static MetricKey parse(String id) { if ((id == null) || (id.length() == 0)) { throw new IllegalArgumentException("null or empty metric key"); } String[] tokens = id.split(Pattern.quote(TOKEN_SEPARATOR)); String name = tokens[0]; if (tokens.length == 1) { return new MetricKey(name); } else { Map<String, String> tags = new HashMap<String, String>(); for (int i = 1; i < tokens.length; i++) { String tagAndValues = tokens[i]; String[] tagAndValue = tagAndValues.split(Pattern.quote(TAG_KEY_VALUE_SEPARATOR)); if ((tagAndValue == null) || (tagAndValue.length != 2)) { StringBuilder stringBuilder = new StringBuilder(); if (tagAndValue != null) { for (String token : tagAndValue) { stringBuilder.append(" " + token); } } else { stringBuilder.append(" null"); } if (tagAndValue.length == 1) tags.put(tagAndValue[0], ""); else throw new IllegalArgumentException("tag component has wrong format:" + stringBuilder); } else { tags.put(tagAndValue[0], tagAndValue[1]); } } return new MetricKey(name, tags); } }
[ "public", "static", "MetricKey", "parse", "(", "String", "id", ")", "{", "if", "(", "(", "id", "==", "null", ")", "||", "(", "id", ".", "length", "(", ")", "==", "0", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"null or empty metric key\"", ")", ";", "}", "String", "[", "]", "tokens", "=", "id", ".", "split", "(", "Pattern", ".", "quote", "(", "TOKEN_SEPARATOR", ")", ")", ";", "String", "name", "=", "tokens", "[", "0", "]", ";", "if", "(", "tokens", ".", "length", "==", "1", ")", "{", "return", "new", "MetricKey", "(", "name", ")", ";", "}", "else", "{", "Map", "<", "String", ",", "String", ">", "tags", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "tokens", ".", "length", ";", "i", "++", ")", "{", "String", "tagAndValues", "=", "tokens", "[", "i", "]", ";", "String", "[", "]", "tagAndValue", "=", "tagAndValues", ".", "split", "(", "Pattern", ".", "quote", "(", "TAG_KEY_VALUE_SEPARATOR", ")", ")", ";", "if", "(", "(", "tagAndValue", "==", "null", ")", "||", "(", "tagAndValue", ".", "length", "!=", "2", ")", ")", "{", "StringBuilder", "stringBuilder", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "tagAndValue", "!=", "null", ")", "{", "for", "(", "String", "token", ":", "tagAndValue", ")", "{", "stringBuilder", ".", "append", "(", "\" \"", "+", "token", ")", ";", "}", "}", "else", "{", "stringBuilder", ".", "append", "(", "\" null\"", ")", ";", "}", "if", "(", "tagAndValue", ".", "length", "==", "1", ")", "tags", ".", "put", "(", "tagAndValue", "[", "0", "]", ",", "\"\"", ")", ";", "else", "throw", "new", "IllegalArgumentException", "(", "\"tag component has wrong format:\"", "+", "stringBuilder", ")", ";", "}", "else", "{", "tags", ".", "put", "(", "tagAndValue", "[", "0", "]", ",", "tagAndValue", "[", "1", "]", ")", ";", "}", "}", "return", "new", "MetricKey", "(", "name", ",", "tags", ")", ";", "}", "}" ]
Parses a metric key in the form as defined by the compute method @param id @return
[ "Parses", "a", "metric", "key", "in", "the", "form", "as", "defined", "by", "the", "compute", "method", "@param", "id", "@return" ]
[ "// metricName|tag1$tag1Val|tag2$tag2val", "// No tags ( [\"metricName\"] )", "// Some tags: parse them ( [\"metricName\", \"tag1$tag1Val\" , \"tag2$tag2val\"] )", "// \"tag1$tag1Val\"", "// sometimes there's no value for one key. this is real life :)" ]
[ { "param": "id", "type": "String" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "id", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 760, 7279, 653, 1109, 12, 780, 612, 13, 288, 203, 203, 5411, 309, 14015, 350, 422, 446, 13, 747, 261, 350, 18, 2469, 1435, 422, 374, 3719, 288, 203, 7734, 604, 394, 2754, 2932, 2011, 578, 1008, 3999, 498, 8863, 203, 5411, 289, 203, 203, 5411, 368, 25700, 96, 2692, 21, 8, 2692, 21, 3053, 96, 2692, 22, 8, 2692, 22, 1125, 203, 5411, 514, 8526, 2430, 273, 612, 18, 4939, 12, 3234, 18, 6889, 12, 8412, 67, 4550, 10019, 203, 5411, 514, 508, 273, 2430, 63, 20, 15533, 203, 5411, 309, 261, 7860, 18, 2469, 422, 404, 13, 288, 203, 7734, 368, 2631, 2342, 261, 8247, 6899, 461, 11929, 262, 203, 7734, 327, 394, 7279, 653, 12, 529, 1769, 203, 5411, 289, 469, 288, 203, 7734, 368, 10548, 2342, 30, 1109, 2182, 261, 8247, 6899, 461, 3113, 315, 2692, 21, 8, 2692, 21, 3053, 6, 269, 315, 2692, 22, 8, 2692, 22, 1125, 11929, 262, 203, 7734, 1635, 32, 780, 16, 514, 34, 2342, 273, 394, 4317, 32, 780, 16, 514, 34, 5621, 203, 7734, 364, 261, 474, 277, 273, 404, 31, 277, 411, 2430, 18, 2469, 31, 277, 27245, 288, 203, 10792, 368, 315, 2692, 21, 8, 2692, 21, 3053, 6, 203, 10792, 514, 1047, 1876, 1972, 273, 2430, 63, 77, 15533, 203, 10792, 514, 8526, 1047, 30154, 273, 1047, 1876, 1972, 18, 4939, 12, 3234, 18, 6889, 12, 7927, 67, 3297, 67, 4051, 67, 4550, 10019, 203, 10792, 309, 14015, 2692, 30154, 422, 446, 13, 747, 261, 2692, 30154, 18, 2469, 480, 576, 3719, 288, 203, 13491, 3225, 24777, 273, 394, 3225, 5621, 203, 13491, 309, 261, 2692, 30154, 480, 446, 13, 288, 203, 18701, 364, 261, 780, 1147, 294, 1047, 30154, 13, 288, 203, 27573, 24777, 18, 6923, 2932, 315, 397, 1147, 1769, 203, 18701, 289, 203, 13491, 289, 469, 288, 203, 18701, 24777, 18, 6923, 2932, 446, 8863, 203, 13491, 289, 203, 203, 13491, 368, 16594, 1915, 1807, 1158, 460, 364, 1245, 498, 18, 333, 353, 2863, 17140, 294, 13, 203, 13491, 309, 261, 2692, 30154, 18, 2469, 422, 404, 13, 203, 18701, 2342, 18, 458, 12, 2692, 30154, 63, 20, 6487, 1408, 1769, 203, 13491, 469, 203, 18701, 604, 394, 2754, 2932, 2692, 1794, 711, 7194, 740, 2773, 397, 24777, 1769, 203, 10792, 289, 469, 288, 203, 13491, 2342, 18, 458, 12, 2692, 30154, 63, 20, 6487, 1047, 30154, 63, 21, 19226, 203, 10792, 289, 203, 7734, 289, 203, 7734, 327, 394, 7279, 653, 12, 529, 16, 2342, 1769, 203, 5411, 289, 203, 3639, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 540, 380, 2280, 2420, 279, 3999, 498, 316, 326, 646, 487, 2553, 635, 326, 3671, 707, 203, 540, 380, 203, 540, 380, 632, 891, 612, 203, 540, 380, 632, 2463, 203, 540, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
d5096a22d9e288b62d389b2a08b747b159e19379
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/model/Chunk.java
[ "Apache-2.0" ]
Java
truncate
Chunk
public Chunk truncate(long from, long to) { try { return ChunkTruncater.truncate(this, from, to); } catch (IOException e) { LOGGER.error("Error encoding binaries", e); throw new IllegalArgumentException(e); } }
/** * Cut a Chunk into a smaller time range * * @param from * @param to * @return a truncated copy of the Chunk * @see ChunkTruncater */
Cut a Chunk into a smaller time range @param from @param to @return a truncated copy of the Chunk @see ChunkTruncater
[ "Cut", "a", "Chunk", "into", "a", "smaller", "time", "range", "@param", "from", "@param", "to", "@return", "a", "truncated", "copy", "of", "the", "Chunk", "@see", "ChunkTruncater" ]
public Chunk truncate(long from, long to) { try { return ChunkTruncater.truncate(this, from, to); } catch (IOException e) { LOGGER.error("Error encoding binaries", e); throw new IllegalArgumentException(e); } }
[ "public", "Chunk", "truncate", "(", "long", "from", ",", "long", "to", ")", "{", "try", "{", "return", "ChunkTruncater", ".", "truncate", "(", "this", ",", "from", ",", "to", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "LOGGER", ".", "error", "(", "\"Error encoding binaries\"", ",", "e", ")", ";", "throw", "new", "IllegalArgumentException", "(", "e", ")", ";", "}", "}" ]
Cut a Chunk into a smaller time range @param from @param to @return a truncated copy of the Chunk @see ChunkTruncater
[ "Cut", "a", "Chunk", "into", "a", "smaller", "time", "range", "@param", "from", "@param", "to", "@return", "a", "truncated", "copy", "of", "the", "Chunk", "@see", "ChunkTruncater" ]
[]
[ { "param": "from", "type": "long" }, { "param": "to", "type": "long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "from", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "to", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 13021, 10310, 12, 5748, 628, 16, 1525, 358, 13, 288, 203, 3639, 775, 288, 203, 5411, 327, 13021, 18002, 2045, 18, 27201, 12, 2211, 16, 628, 16, 358, 1769, 203, 3639, 289, 1044, 261, 14106, 425, 13, 288, 203, 5411, 4145, 18, 1636, 2932, 668, 2688, 4158, 5646, 3113, 425, 1769, 203, 5411, 604, 394, 2754, 12, 73, 1769, 203, 3639, 289, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 385, 322, 279, 13021, 1368, 279, 10648, 813, 1048, 203, 377, 380, 203, 377, 380, 632, 891, 628, 203, 377, 380, 632, 891, 358, 203, 377, 380, 632, 2463, 279, 15282, 1610, 434, 326, 13021, 203, 377, 380, 632, 5946, 13021, 18002, 2045, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
67b388bcfa404785b514e7e14ad7a295f87a33be
Hurence/historian
logisland-timeseries/src/main/java/com/hurence/logisland/sampling/record/IsoRecordSampler.java
[ "Apache-2.0" ]
Java
sample
null
@Override public List<Record> sample(List<Record> inputRecords) { return inputRecords .stream() .map(this::getTimeValueRecord) .collect(Collectors.toList()); }
/** * do no sample at all => for test or benchmark purpose * * @param inputRecords * @return the same list as input */
do no sample at all => for test or benchmark purpose @param inputRecords @return the same list as input
[ "do", "no", "sample", "at", "all", "=", ">", "for", "test", "or", "benchmark", "purpose", "@param", "inputRecords", "@return", "the", "same", "list", "as", "input" ]
@Override public List<Record> sample(List<Record> inputRecords) { return inputRecords .stream() .map(this::getTimeValueRecord) .collect(Collectors.toList()); }
[ "@", "Override", "public", "List", "<", "Record", ">", "sample", "(", "List", "<", "Record", ">", "inputRecords", ")", "{", "return", "inputRecords", ".", "stream", "(", ")", ".", "map", "(", "this", "::", "getTimeValueRecord", ")", ".", "collect", "(", "Collectors", ".", "toList", "(", ")", ")", ";", "}" ]
do no sample at all => for test or benchmark purpose @param inputRecords @return the same list as input
[ "do", "no", "sample", "at", "all", "=", ">", "for", "test", "or", "benchmark", "purpose", "@param", "inputRecords", "@return", "the", "same", "list", "as", "input" ]
[]
[ { "param": "inputRecords", "type": "List<Record>" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "inputRecords", "type": "List<Record>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 632, 6618, 203, 565, 1071, 987, 32, 2115, 34, 3296, 12, 682, 32, 2115, 34, 810, 6499, 13, 288, 203, 3639, 327, 810, 6499, 203, 7734, 263, 3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891, 810, 6499, 203, 377, 380, 632, 2463, 326, 1967, 666, 487, 810, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
53e1ab99f265de231498ea4ce3f3fe4bc44681c8
Hurence/historian
integration-tests/src/main/java/com/hurence/historian/solr/util/SolrITHelper.java
[ "Apache-2.0" ]
Java
printSolrJsonDocs
null
public static void printSolrJsonDocs(SolrClient solrClient, String collection) { SolrDocumentList solrDocumentList = getSolrDocs(solrClient, collection); System.out.println("Solr contains " + solrDocumentList.size() + " document(s):\n" + JSONUtil.toJSON(solrDocumentList)); }
/** * Prints solr docs of a collection * @param solrClient * @param collection */
Prints solr docs of a collection @param solrClient @param collection
[ "Prints", "solr", "docs", "of", "a", "collection", "@param", "solrClient", "@param", "collection" ]
public static void printSolrJsonDocs(SolrClient solrClient, String collection) { SolrDocumentList solrDocumentList = getSolrDocs(solrClient, collection); System.out.println("Solr contains " + solrDocumentList.size() + " document(s):\n" + JSONUtil.toJSON(solrDocumentList)); }
[ "public", "static", "void", "printSolrJsonDocs", "(", "SolrClient", "solrClient", ",", "String", "collection", ")", "{", "SolrDocumentList", "solrDocumentList", "=", "getSolrDocs", "(", "solrClient", ",", "collection", ")", ";", "System", ".", "out", ".", "println", "(", "\"Solr contains \"", "+", "solrDocumentList", ".", "size", "(", ")", "+", "\" document(s):\\n\"", "+", "JSONUtil", ".", "toJSON", "(", "solrDocumentList", ")", ")", ";", "}" ]
Prints solr docs of a collection @param solrClient @param collection
[ "Prints", "solr", "docs", "of", "a", "collection", "@param", "solrClient", "@param", "collection" ]
[]
[ { "param": "solrClient", "type": "SolrClient" }, { "param": "collection", "type": "String" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "solrClient", "type": "SolrClient", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "collection", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 760, 918, 1172, 16478, 3185, 12656, 12, 16478, 1227, 15575, 1227, 16, 514, 1849, 13, 288, 203, 203, 3639, 19026, 2519, 682, 15575, 2519, 682, 273, 1322, 9575, 12656, 12, 22495, 1227, 16, 1849, 1769, 203, 203, 3639, 2332, 18, 659, 18, 8222, 2932, 16478, 1914, 315, 397, 15575, 2519, 682, 18, 1467, 1435, 397, 203, 7734, 315, 1668, 12, 87, 4672, 64, 82, 6, 397, 1796, 1304, 18, 869, 2986, 12, 22495, 2519, 682, 10019, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 3038, 87, 15575, 3270, 434, 279, 1849, 203, 377, 380, 632, 891, 15575, 1227, 203, 377, 380, 632, 891, 1849, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
53e1ab99f265de231498ea4ce3f3fe4bc44681c8
Hurence/historian
integration-tests/src/main/java/com/hurence/historian/solr/util/SolrITHelper.java
[ "Apache-2.0" ]
Java
printUnChunkedSolrJsonDocs
null
public static void printUnChunkedSolrJsonDocs(SolrClient solrClient, String collection) { SolrDocumentList solrDocumentList = getSolrDocs(solrClient, collection); System.out.println("Solr contains " + solrDocumentList.size() + " document(s):"); SimpleDateFormat sdf = Measure.createUtcDateFormatter("yyyy-MM-dd HH:mm:ss.SSS"); StringBuilder stringBuilder = new StringBuilder("\n{"); for (SolrDocument solrDocument : solrDocumentList) { for (String field : solrDocument.getFieldNames().stream().sorted().collect(Collectors.toList())) { stringBuilder.append("\n \"").append(field).append("\": "); Object value = solrDocument.getFieldValue(field); if (field.equals(SOLR_COLUMN_VALUE)) { // Uncompress the chunk and display points in a human readable way byte[] compressedPoints = BinaryEncodingUtils.decode((String)value); long chunkStart = (Long)solrDocument.getFieldValue(SOLR_COLUMN_START); long chunkEnd = (Long)solrDocument.getFieldValue(SOLR_COLUMN_END); try { TreeSet<Measure> measures = BinaryCompactionUtil.unCompressPoints(compressedPoints, chunkStart, chunkEnd); for (Measure measure : measures) { double measureValue = measure.getValue(); float quality = measure.getQuality(); String readableTimestamp = sdf.format(new Date(measure.getTimestamp())); stringBuilder.append("\n t=").append(readableTimestamp) .append(" v=").append(measureValue) .append(" q=").append(quality); } } catch (IOException e) { e.printStackTrace(); fail(e.getMessage()); } } else { stringBuilder.append(value); } } stringBuilder.append("\n}"); } System.out.println(stringBuilder); }
/** * Prints solr chunks docs of a collection, uncompressing measures in a human readable way * @param solrClient * @param collection */
Prints solr chunks docs of a collection, uncompressing measures in a human readable way @param solrClient @param collection
[ "Prints", "solr", "chunks", "docs", "of", "a", "collection", "uncompressing", "measures", "in", "a", "human", "readable", "way", "@param", "solrClient", "@param", "collection" ]
public static void printUnChunkedSolrJsonDocs(SolrClient solrClient, String collection) { SolrDocumentList solrDocumentList = getSolrDocs(solrClient, collection); System.out.println("Solr contains " + solrDocumentList.size() + " document(s):"); SimpleDateFormat sdf = Measure.createUtcDateFormatter("yyyy-MM-dd HH:mm:ss.SSS"); StringBuilder stringBuilder = new StringBuilder("\n{"); for (SolrDocument solrDocument : solrDocumentList) { for (String field : solrDocument.getFieldNames().stream().sorted().collect(Collectors.toList())) { stringBuilder.append("\n \"").append(field).append("\": "); Object value = solrDocument.getFieldValue(field); if (field.equals(SOLR_COLUMN_VALUE)) { byte[] compressedPoints = BinaryEncodingUtils.decode((String)value); long chunkStart = (Long)solrDocument.getFieldValue(SOLR_COLUMN_START); long chunkEnd = (Long)solrDocument.getFieldValue(SOLR_COLUMN_END); try { TreeSet<Measure> measures = BinaryCompactionUtil.unCompressPoints(compressedPoints, chunkStart, chunkEnd); for (Measure measure : measures) { double measureValue = measure.getValue(); float quality = measure.getQuality(); String readableTimestamp = sdf.format(new Date(measure.getTimestamp())); stringBuilder.append("\n t=").append(readableTimestamp) .append(" v=").append(measureValue) .append(" q=").append(quality); } } catch (IOException e) { e.printStackTrace(); fail(e.getMessage()); } } else { stringBuilder.append(value); } } stringBuilder.append("\n}"); } System.out.println(stringBuilder); }
[ "public", "static", "void", "printUnChunkedSolrJsonDocs", "(", "SolrClient", "solrClient", ",", "String", "collection", ")", "{", "SolrDocumentList", "solrDocumentList", "=", "getSolrDocs", "(", "solrClient", ",", "collection", ")", ";", "System", ".", "out", ".", "println", "(", "\"Solr contains \"", "+", "solrDocumentList", ".", "size", "(", ")", "+", "\" document(s):\"", ")", ";", "SimpleDateFormat", "sdf", "=", "Measure", ".", "createUtcDateFormatter", "(", "\"yyyy-MM-dd HH:mm:ss.SSS\"", ")", ";", "StringBuilder", "stringBuilder", "=", "new", "StringBuilder", "(", "\"\\n{\"", ")", ";", "for", "(", "SolrDocument", "solrDocument", ":", "solrDocumentList", ")", "{", "for", "(", "String", "field", ":", "solrDocument", ".", "getFieldNames", "(", ")", ".", "stream", "(", ")", ".", "sorted", "(", ")", ".", "collect", "(", "Collectors", ".", "toList", "(", ")", ")", ")", "{", "stringBuilder", ".", "append", "(", "\"\\n \\\"\"", ")", ".", "append", "(", "field", ")", ".", "append", "(", "\"\\\": \"", ")", ";", "Object", "value", "=", "solrDocument", ".", "getFieldValue", "(", "field", ")", ";", "if", "(", "field", ".", "equals", "(", "SOLR_COLUMN_VALUE", ")", ")", "{", "byte", "[", "]", "compressedPoints", "=", "BinaryEncodingUtils", ".", "decode", "(", "(", "String", ")", "value", ")", ";", "long", "chunkStart", "=", "(", "Long", ")", "solrDocument", ".", "getFieldValue", "(", "SOLR_COLUMN_START", ")", ";", "long", "chunkEnd", "=", "(", "Long", ")", "solrDocument", ".", "getFieldValue", "(", "SOLR_COLUMN_END", ")", ";", "try", "{", "TreeSet", "<", "Measure", ">", "measures", "=", "BinaryCompactionUtil", ".", "unCompressPoints", "(", "compressedPoints", ",", "chunkStart", ",", "chunkEnd", ")", ";", "for", "(", "Measure", "measure", ":", "measures", ")", "{", "double", "measureValue", "=", "measure", ".", "getValue", "(", ")", ";", "float", "quality", "=", "measure", ".", "getQuality", "(", ")", ";", "String", "readableTimestamp", "=", "sdf", ".", "format", "(", "new", "Date", "(", "measure", ".", "getTimestamp", "(", ")", ")", ")", ";", "stringBuilder", ".", "append", "(", "\"\\n t=\"", ")", ".", "append", "(", "readableTimestamp", ")", ".", "append", "(", "\" v=\"", ")", ".", "append", "(", "measureValue", ")", ".", "append", "(", "\" q=\"", ")", ".", "append", "(", "quality", ")", ";", "}", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "fail", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "else", "{", "stringBuilder", ".", "append", "(", "value", ")", ";", "}", "}", "stringBuilder", ".", "append", "(", "\"\\n}\"", ")", ";", "}", "System", ".", "out", ".", "println", "(", "stringBuilder", ")", ";", "}" ]
Prints solr chunks docs of a collection, uncompressing measures in a human readable way @param solrClient @param collection
[ "Prints", "solr", "chunks", "docs", "of", "a", "collection", "uncompressing", "measures", "in", "a", "human", "readable", "way", "@param", "solrClient", "@param", "collection" ]
[ "// Uncompress the chunk and display points in a human readable way" ]
[ { "param": "solrClient", "type": "SolrClient" }, { "param": "collection", "type": "String" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "solrClient", "type": "SolrClient", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "collection", "type": "String", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 760, 918, 1172, 984, 5579, 329, 16478, 3185, 12656, 12, 16478, 1227, 15575, 1227, 16, 514, 1849, 13, 288, 203, 203, 3639, 19026, 2519, 682, 15575, 2519, 682, 273, 1322, 9575, 12656, 12, 22495, 1227, 16, 1849, 1769, 203, 203, 3639, 2332, 18, 659, 18, 8222, 2932, 16478, 1914, 315, 397, 15575, 2519, 682, 18, 1467, 1435, 397, 203, 7734, 315, 1668, 12, 87, 13, 2773, 1769, 203, 203, 3639, 17005, 31789, 273, 13544, 18, 2640, 57, 5111, 1626, 5074, 2932, 17722, 17, 8206, 17, 449, 20842, 30, 7020, 30, 1049, 18, 1260, 55, 8863, 203, 3639, 3225, 24777, 273, 394, 3225, 31458, 82, 95, 8863, 203, 203, 3639, 364, 261, 16478, 2519, 15575, 2519, 294, 15575, 2519, 682, 13, 288, 203, 5411, 364, 261, 780, 652, 294, 15575, 2519, 18, 588, 20393, 7675, 3256, 7675, 10350, 7675, 14676, 12, 10808, 1383, 18, 869, 682, 1435, 3719, 288, 203, 7734, 24777, 18, 6923, 31458, 82, 225, 11843, 2934, 6923, 12, 1518, 2934, 6923, 2932, 21392, 315, 1769, 203, 7734, 1033, 460, 273, 15575, 2519, 18, 588, 13559, 12, 1518, 1769, 203, 7734, 309, 261, 1518, 18, 14963, 12, 19815, 54, 67, 11009, 67, 4051, 3719, 288, 203, 10792, 368, 1351, 14706, 326, 2441, 471, 2562, 3143, 316, 279, 8672, 7471, 4031, 203, 10792, 1160, 8526, 8968, 5636, 273, 7896, 4705, 1989, 18, 3922, 12443, 780, 13, 1132, 1769, 203, 10792, 1525, 2441, 1685, 273, 261, 3708, 13, 22495, 2519, 18, 588, 13559, 12, 19815, 54, 67, 11009, 67, 7570, 1769, 203, 10792, 1525, 2441, 1638, 273, 261, 3708, 13, 22495, 2519, 18, 588, 13559, 12, 19815, 54, 67, 11009, 67, 4415, 1769, 203, 10792, 775, 288, 203, 13491, 19461, 32, 7197, 34, 22692, 273, 7896, 2945, 1128, 1304, 18, 318, 16552, 5636, 12, 15385, 5636, 16, 2441, 1685, 16, 2441, 1638, 1769, 203, 13491, 364, 261, 7197, 6649, 294, 22692, 13, 288, 203, 18701, 1645, 6649, 620, 273, 6649, 18, 24805, 5621, 203, 18701, 1431, 9312, 273, 6649, 18, 588, 14846, 5621, 203, 18701, 514, 7471, 4921, 273, 31789, 18, 2139, 12, 2704, 2167, 12, 10772, 18, 588, 4921, 1435, 10019, 203, 18701, 24777, 18, 6923, 31458, 82, 565, 268, 1546, 2934, 6923, 12, 11018, 4921, 13, 203, 4766, 565, 263, 6923, 2932, 331, 1546, 2934, 6923, 12, 10772, 620, 13, 203, 4766, 565, 263, 6923, 2932, 1043, 1546, 2934, 6923, 12, 16495, 1769, 203, 13491, 289, 203, 10792, 289, 1044, 261, 14106, 425, 13, 288, 203, 13491, 425, 18, 1188, 6332, 5621, 203, 13491, 2321, 12, 73, 18, 24906, 10663, 203, 10792, 289, 203, 7734, 289, 469, 203, 7734, 288, 203, 10792, 24777, 18, 6923, 12, 1132, 1769, 203, 7734, 289, 203, 5411, 289, 203, 5411, 24777, 18, 6923, 31458, 82, 1532, 1769, 203, 3639, 289, 203, 203, 3639, 2332, 18, 659, 18, 8222, 12, 1080, 1263, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 3038, 87, 15575, 6055, 3270, 434, 279, 1849, 16, 12704, 1028, 310, 22692, 316, 279, 8672, 7471, 4031, 203, 377, 380, 632, 891, 15575, 1227, 203, 377, 380, 632, 891, 1849, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
53e1ab99f265de231498ea4ce3f3fe4bc44681c8
Hurence/historian
integration-tests/src/main/java/com/hurence/historian/solr/util/SolrITHelper.java
[ "Apache-2.0" ]
Java
compareChunks
null
public static void compareChunks(Map<String, Chunk> expectedChunks, Map<String, Chunk> actualChunks) { assertEquals(expectedChunks.size(), actualChunks.size(), "Not the same number of chunks"); for (String chunkId : expectedChunks.keySet()) { Chunk expectedChunk = expectedChunks.get(chunkId); Chunk actualChunk = actualChunks.get(chunkId); assertNotNull(actualChunk, "Missing chunk id " + chunkId + " in actual chunks: " + actualChunks.values()); assertEquals(expectedChunk, actualChunk, "Actual chunk id " + chunkId + " not equal to expected one"); } }
/** * Checks 2 sets of chunks are equal * @param expectedChunks * @param actualChunks */
Checks 2 sets of chunks are equal @param expectedChunks @param actualChunks
[ "Checks", "2", "sets", "of", "chunks", "are", "equal", "@param", "expectedChunks", "@param", "actualChunks" ]
public static void compareChunks(Map<String, Chunk> expectedChunks, Map<String, Chunk> actualChunks) { assertEquals(expectedChunks.size(), actualChunks.size(), "Not the same number of chunks"); for (String chunkId : expectedChunks.keySet()) { Chunk expectedChunk = expectedChunks.get(chunkId); Chunk actualChunk = actualChunks.get(chunkId); assertNotNull(actualChunk, "Missing chunk id " + chunkId + " in actual chunks: " + actualChunks.values()); assertEquals(expectedChunk, actualChunk, "Actual chunk id " + chunkId + " not equal to expected one"); } }
[ "public", "static", "void", "compareChunks", "(", "Map", "<", "String", ",", "Chunk", ">", "expectedChunks", ",", "Map", "<", "String", ",", "Chunk", ">", "actualChunks", ")", "{", "assertEquals", "(", "expectedChunks", ".", "size", "(", ")", ",", "actualChunks", ".", "size", "(", ")", ",", "\"Not the same number of chunks\"", ")", ";", "for", "(", "String", "chunkId", ":", "expectedChunks", ".", "keySet", "(", ")", ")", "{", "Chunk", "expectedChunk", "=", "expectedChunks", ".", "get", "(", "chunkId", ")", ";", "Chunk", "actualChunk", "=", "actualChunks", ".", "get", "(", "chunkId", ")", ";", "assertNotNull", "(", "actualChunk", ",", "\"Missing chunk id \"", "+", "chunkId", "+", "\" in actual chunks: \"", "+", "actualChunks", ".", "values", "(", ")", ")", ";", "assertEquals", "(", "expectedChunk", ",", "actualChunk", ",", "\"Actual chunk id \"", "+", "chunkId", "+", "\" not equal to expected one\"", ")", ";", "}", "}" ]
Checks 2 sets of chunks are equal @param expectedChunks @param actualChunks
[ "Checks", "2", "sets", "of", "chunks", "are", "equal", "@param", "expectedChunks", "@param", "actualChunks" ]
[]
[ { "param": "expectedChunks", "type": "Map<String, Chunk>" }, { "param": "actualChunks", "type": "Map<String, Chunk>" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "expectedChunks", "type": "Map<String, Chunk>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "actualChunks", "type": "Map<String, Chunk>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 760, 918, 3400, 14975, 12, 863, 32, 780, 16, 13021, 34, 2665, 14975, 16, 1635, 32, 780, 16, 13021, 34, 3214, 14975, 13, 288, 203, 203, 3639, 1815, 8867, 12, 3825, 14975, 18, 1467, 9334, 3214, 14975, 18, 1467, 9334, 315, 1248, 326, 1967, 1300, 434, 6055, 8863, 203, 203, 3639, 364, 261, 780, 2441, 548, 294, 2665, 14975, 18, 856, 694, 10756, 288, 203, 5411, 13021, 2665, 5579, 273, 2665, 14975, 18, 588, 12, 6551, 548, 1769, 203, 5411, 13021, 3214, 5579, 273, 3214, 14975, 18, 588, 12, 6551, 548, 1769, 203, 5411, 25395, 12, 18672, 5579, 16, 315, 4841, 2441, 612, 315, 397, 2441, 548, 397, 203, 10792, 315, 316, 3214, 6055, 30, 315, 397, 3214, 14975, 18, 2372, 10663, 203, 5411, 1815, 8867, 12, 3825, 5579, 16, 3214, 5579, 16, 315, 11266, 2441, 612, 315, 397, 2441, 548, 397, 315, 486, 3959, 358, 2665, 1245, 8863, 203, 3639, 289, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 13074, 576, 1678, 434, 6055, 854, 3959, 203, 377, 380, 632, 891, 2665, 14975, 203, 377, 380, 632, 891, 3214, 14975, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
9cdc93c1934c56f39e334b098b474ea52cf0c45c
Hurence/historian
historian-timeseries/src/main/java/com/hurence/timeseries/converter/ChunkTruncater.java
[ "Apache-2.0" ]
Java
truncate
Chunk
public static Chunk truncate(Chunk chunk, long from, long to) throws IOException { byte[] binaries = chunk.getValue(); TreeSet<Measure> measures = BinaryCompactionUtil.unCompressPoints(binaries, chunk.getStart(), chunk.getEnd(), from, to);/// MeasuresToChunkVersionCurrent converter = new MeasuresToChunkVersionCurrent(TRUNCATER_ORIGIN); return converter.buildChunk(chunk.getName(), measures, chunk.getTags()); }
/** * The chunk in input must have getValueAsBinary implemented (not returning null) * The chunk in input must have getName implemented (not returning null) * The chunk in input must have getTags implemented (not returning null) * * @param from the desired chunk_start of new chunk * @param to the desired chunk_end of new chunk * @return a new Chunk without point outside of boundaries * (recompute aggregations as well) */
The chunk in input must have getValueAsBinary implemented (not returning null) The chunk in input must have getName implemented (not returning null) The chunk in input must have getTags implemented (not returning null) @param from the desired chunk_start of new chunk @param to the desired chunk_end of new chunk @return a new Chunk without point outside of boundaries (recompute aggregations as well)
[ "The", "chunk", "in", "input", "must", "have", "getValueAsBinary", "implemented", "(", "not", "returning", "null", ")", "The", "chunk", "in", "input", "must", "have", "getName", "implemented", "(", "not", "returning", "null", ")", "The", "chunk", "in", "input", "must", "have", "getTags", "implemented", "(", "not", "returning", "null", ")", "@param", "from", "the", "desired", "chunk_start", "of", "new", "chunk", "@param", "to", "the", "desired", "chunk_end", "of", "new", "chunk", "@return", "a", "new", "Chunk", "without", "point", "outside", "of", "boundaries", "(", "recompute", "aggregations", "as", "well", ")" ]
public static Chunk truncate(Chunk chunk, long from, long to) throws IOException { byte[] binaries = chunk.getValue(); TreeSet<Measure> measures = BinaryCompactionUtil.unCompressPoints(binaries, chunk.getStart(), chunk.getEnd(), from, to); MeasuresToChunkVersionCurrent converter = new MeasuresToChunkVersionCurrent(TRUNCATER_ORIGIN); return converter.buildChunk(chunk.getName(), measures, chunk.getTags()); }
[ "public", "static", "Chunk", "truncate", "(", "Chunk", "chunk", ",", "long", "from", ",", "long", "to", ")", "throws", "IOException", "{", "byte", "[", "]", "binaries", "=", "chunk", ".", "getValue", "(", ")", ";", "TreeSet", "<", "Measure", ">", "measures", "=", "BinaryCompactionUtil", ".", "unCompressPoints", "(", "binaries", ",", "chunk", ".", "getStart", "(", ")", ",", "chunk", ".", "getEnd", "(", ")", ",", "from", ",", "to", ")", ";", "MeasuresToChunkVersionCurrent", "converter", "=", "new", "MeasuresToChunkVersionCurrent", "(", "TRUNCATER_ORIGIN", ")", ";", "return", "converter", ".", "buildChunk", "(", "chunk", ".", "getName", "(", ")", ",", "measures", ",", "chunk", ".", "getTags", "(", ")", ")", ";", "}" ]
The chunk in input must have getValueAsBinary implemented (not returning null) The chunk in input must have getName implemented (not returning null) The chunk in input must have getTags implemented (not returning null)
[ "The", "chunk", "in", "input", "must", "have", "getValueAsBinary", "implemented", "(", "not", "returning", "null", ")", "The", "chunk", "in", "input", "must", "have", "getName", "implemented", "(", "not", "returning", "null", ")", "The", "chunk", "in", "input", "must", "have", "getTags", "implemented", "(", "not", "returning", "null", ")" ]
[ "///" ]
[ { "param": "chunk", "type": "Chunk" }, { "param": "from", "type": "long" }, { "param": "to", "type": "long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "chunk", "type": "Chunk", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "from", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "to", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 760, 13021, 10310, 12, 5579, 2441, 16, 1525, 628, 16, 1525, 358, 13, 1216, 1860, 288, 203, 3639, 1160, 8526, 4158, 5646, 273, 2441, 18, 24805, 5621, 203, 3639, 19461, 32, 7197, 34, 22692, 273, 7896, 2945, 1128, 1304, 18, 318, 16552, 5636, 12, 4757, 5646, 16, 2441, 18, 588, 1685, 9334, 2441, 18, 588, 1638, 9334, 628, 16, 358, 1769, 28111, 203, 3639, 18174, 1823, 774, 5579, 1444, 3935, 6027, 273, 394, 18174, 1823, 774, 5579, 1444, 3935, 12, 4349, 21163, 13641, 67, 24685, 1769, 203, 3639, 327, 6027, 18, 3510, 5579, 12, 6551, 18, 17994, 9334, 22692, 16, 2441, 18, 588, 3453, 10663, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 1021, 2441, 316, 810, 1297, 1240, 2366, 1463, 5905, 8249, 261, 902, 5785, 446, 13, 203, 377, 380, 1021, 2441, 316, 810, 1297, 1240, 1723, 8249, 261, 902, 5785, 446, 13, 203, 377, 380, 1021, 2441, 316, 810, 1297, 1240, 17388, 8249, 261, 902, 5785, 446, 13, 203, 377, 380, 203, 377, 380, 632, 891, 628, 326, 6049, 2441, 67, 1937, 434, 394, 2441, 203, 377, 380, 632, 891, 358, 326, 6049, 2441, 67, 409, 434, 394, 2441, 203, 377, 380, 632, 2463, 279, 394, 13021, 2887, 1634, 8220, 434, 15054, 203, 377, 380, 261, 266, 9200, 25809, 487, 5492, 13, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
32073c837feb515bae05b5fcda59b3abf151c592
Hurence/historian
historian-server/src/main/java/com/hurence/webapiservice/http/api/ingestion/util/DataConverter.java
[ "Apache-2.0" ]
Java
toGroupedByMetricDataPoints
JsonArray
public JsonArray toGroupedByMetricDataPoints(List<LineWithDateInfo> lineWithDateInfos) { List<Map<String, Object>> finalGroupedPoints = lineWithDateInfos.stream() //group by metric,tag,date -> [value, date, quality] ( in case where group by just metric : metric,date -> [value, date, quality]) .collect(Collectors.groupingBy(this::customGroupingBy, LinkedHashMap::new, Collectors.mapping(this::customMapping, Collectors.toList()))) .entrySet().stream() // convert to Map: metric + tag's values + points .map(this::customMap) .collect(Collectors.toList()); return new JsonArray(finalGroupedPoints); }
/** * @param lineWithDateInfos List<LineWithDateInfo> * * group by the lineWithDateInfos into a json array : * group by : metric,tag,date * * @return JsonArray */
@param lineWithDateInfos List group by the lineWithDateInfos into a json array : group by : metric,tag,date
[ "@param", "lineWithDateInfos", "List", "group", "by", "the", "lineWithDateInfos", "into", "a", "json", "array", ":", "group", "by", ":", "metric", "tag", "date" ]
public JsonArray toGroupedByMetricDataPoints(List<LineWithDateInfo> lineWithDateInfos) { List<Map<String, Object>> finalGroupedPoints = lineWithDateInfos.stream() .collect(Collectors.groupingBy(this::customGroupingBy, LinkedHashMap::new, Collectors.mapping(this::customMapping, Collectors.toList()))) .entrySet().stream() .map(this::customMap) .collect(Collectors.toList()); return new JsonArray(finalGroupedPoints); }
[ "public", "JsonArray", "toGroupedByMetricDataPoints", "(", "List", "<", "LineWithDateInfo", ">", "lineWithDateInfos", ")", "{", "List", "<", "Map", "<", "String", ",", "Object", ">", ">", "finalGroupedPoints", "=", "lineWithDateInfos", ".", "stream", "(", ")", ".", "collect", "(", "Collectors", ".", "groupingBy", "(", "this", "::", "customGroupingBy", ",", "LinkedHashMap", "::", "new", ",", "Collectors", ".", "mapping", "(", "this", "::", "customMapping", ",", "Collectors", ".", "toList", "(", ")", ")", ")", ")", ".", "entrySet", "(", ")", ".", "stream", "(", ")", ".", "map", "(", "this", "::", "customMap", ")", ".", "collect", "(", "Collectors", ".", "toList", "(", ")", ")", ";", "return", "new", "JsonArray", "(", "finalGroupedPoints", ")", ";", "}" ]
@param lineWithDateInfos List<LineWithDateInfo> group by the lineWithDateInfos into a json array : group by : metric,tag,date
[ "@param", "lineWithDateInfos", "List<LineWithDateInfo", ">", "group", "by", "the", "lineWithDateInfos", "into", "a", "json", "array", ":", "group", "by", ":", "metric", "tag", "date" ]
[ "//group by metric,tag,date -> [value, date, quality] ( in case where group by just metric : metric,date -> [value, date, quality])", "// convert to Map: metric + tag's values + points" ]
[ { "param": "lineWithDateInfos", "type": "List<LineWithDateInfo>" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "lineWithDateInfos", "type": "List<LineWithDateInfo>", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 25109, 358, 1114, 18696, 28858, 5636, 12, 682, 32, 1670, 1190, 1626, 966, 34, 980, 1190, 1626, 7655, 13, 288, 203, 203, 3639, 987, 32, 863, 32, 780, 16, 1033, 9778, 727, 24125, 5636, 273, 980, 1190, 1626, 7655, 18, 3256, 1435, 203, 7734, 368, 1655, 635, 3999, 16, 2692, 16, 712, 317, 306, 1132, 16, 1509, 16, 9312, 65, 261, 316, 648, 1625, 1041, 635, 2537, 3999, 294, 3999, 16, 712, 317, 306, 1132, 16, 1509, 16, 9312, 5717, 203, 7734, 263, 14676, 12, 10808, 1383, 18, 25592, 858, 12, 2211, 2866, 3662, 21014, 858, 16, 203, 13491, 13589, 2866, 2704, 16, 203, 13491, 13994, 18, 6770, 12, 2211, 2866, 3662, 3233, 16, 13994, 18, 869, 682, 1435, 20349, 203, 7734, 263, 4099, 694, 7675, 3256, 1435, 203, 7734, 368, 1765, 358, 1635, 30, 3999, 397, 1047, 1807, 924, 397, 3143, 203, 7734, 263, 1458, 12, 2211, 2866, 3662, 863, 13, 203, 7734, 263, 14676, 12, 10808, 1383, 18, 869, 682, 10663, 203, 3639, 327, 394, 25109, 12, 6385, 24125, 5636, 1769, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 632, 891, 980, 1190, 1626, 7655, 3639, 987, 32, 1670, 1190, 1626, 966, 34, 203, 377, 380, 203, 377, 380, 1041, 635, 326, 980, 1190, 1626, 7655, 1368, 279, 1163, 526, 294, 203, 377, 380, 4766, 1041, 635, 294, 3999, 16, 2692, 16, 712, 203, 377, 380, 203, 377, 380, 632, 2463, 25109, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]
32073c837feb515bae05b5fcda59b3abf151c592
Hurence/historian
historian-server/src/main/java/com/hurence/webapiservice/http/api/ingestion/util/DataConverter.java
[ "Apache-2.0" ]
Java
toNumber
Object
public static Object toNumber(Object value, CsvFilesConvertorConf csvFilesConvertorConf) { try { return getNumberIfLong(value, csvFilesConvertorConf); } catch (Exception e) { return getNumberIfNotLong(value, csvFilesConvertorConf); } }
/** * @param value Object * @param csvFilesConvertorConf CsvFilesConvertorConf * * get the timestamp as long if possible. * */
get the timestamp as long if possible.
[ "get", "the", "timestamp", "as", "long", "if", "possible", "." ]
public static Object toNumber(Object value, CsvFilesConvertorConf csvFilesConvertorConf) { try { return getNumberIfLong(value, csvFilesConvertorConf); } catch (Exception e) { return getNumberIfNotLong(value, csvFilesConvertorConf); } }
[ "public", "static", "Object", "toNumber", "(", "Object", "value", ",", "CsvFilesConvertorConf", "csvFilesConvertorConf", ")", "{", "try", "{", "return", "getNumberIfLong", "(", "value", ",", "csvFilesConvertorConf", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "getNumberIfNotLong", "(", "value", ",", "csvFilesConvertorConf", ")", ";", "}", "}" ]
@param value Object @param csvFilesConvertorConf CsvFilesConvertorConf
[ "@param", "value", "Object", "@param", "csvFilesConvertorConf", "CsvFilesConvertorConf" ]
[]
[ { "param": "value", "type": "Object" }, { "param": "csvFilesConvertorConf", "type": "CsvFilesConvertorConf" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "value", "type": "Object", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "csvFilesConvertorConf", "type": "CsvFilesConvertorConf", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
[ 1, 3495, 21872, 5110, 30, 1071, 760, 1033, 358, 1854, 12, 921, 460, 16, 21532, 2697, 2723, 280, 3976, 6101, 2697, 2723, 280, 3976, 13, 288, 203, 3639, 775, 288, 203, 5411, 327, 18491, 2047, 3708, 12, 1132, 16, 6101, 2697, 2723, 280, 3976, 1769, 203, 3639, 289, 1044, 261, 503, 425, 13, 288, 203, 5411, 327, 18491, 10288, 3708, 12, 1132, 16, 6101, 2697, 2723, 280, 3976, 1769, 203, 3639, 289, 203, 565, 289, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
[ 1, 26873, 203, 377, 380, 632, 891, 460, 10792, 1033, 203, 377, 380, 632, 891, 6101, 2697, 2723, 280, 3976, 565, 21532, 2697, 2723, 280, 3976, 203, 377, 380, 203, 377, 380, 336, 326, 2858, 487, 1525, 309, 3323, 18, 203, 377, 380, 203, 377, 1195, 2, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100 ]