max_stars_count
int64 301
224k
| text
stringlengths 6
1.05M
| token_count
int64 3
727k
|
---|---|---|
435 | <filename>pycon-ar-2018/videos/redes-neuronales-con-python-usando-keras-por-juan-pedro-fisanotti.json
{
"copyright_text": "Creative Commons Attribution license (reuse allowed)",
"description": "Cerebros artificiales??? No tanto, pero igualmente una herramienta muy poderosa. Las redes neuronales son uno de los campos del aprendizaje de m\u00e1quina que m\u00e1s resultados interesantes est\u00e1 obteniendo. En esta charla veremos una intro r\u00e1pida a Keras, el framework en python m\u00e1s utilizado para desarrollar redes neuronales artificiales.\n\nGracias a las herramientas que Keras nos ofrece, hoy en d\u00eda es muy sencillo crear una red neuronal artificial en python y entrenarla con datos para que aprenda a realizar una tarea de predicci\u00f3n o clasificaci\u00f3n. Y no solo eso, sino que Keras nos permite utilizar nuestro procesador gr\u00e1fico (GPU) para acelerar enormemente el entrenamiento, sin necesidad de escribir el complicado c\u00f3digo de m\u00e1s bajo nivel que las GPUs suelen requerir. En esta charla veremos c\u00f3mo utilizar Keras en un ejemplo de clasificaci\u00f3n de im\u00e1genes, explicando antes los conceptos introductorios de redes neuronales artificiales.\n",
"language": "spa",
"recorded": "2018-11-24",
"speakers": [
"<NAME>"
],
"thumbnail_url": "https://i.ytimg.com/vi/L2k1GUyisIo/hqdefault.jpg",
"title": "Redes neuronales con python usando Keras",
"videos": [
{
"type": "youtube",
"url": "https://www.youtube.com/watch?v=L2k1GUyisIo"
}
]
}
| 598 |
643 | #ifndef PIPES_SWITCH_HPP
#define PIPES_SWITCH_HPP
#include "pipes/helpers/assignable.hpp"
#include "pipes/helpers/meta.hpp"
#include "pipes/base.hpp"
namespace pipes
{
template<typename Predicate, typename Pipeline>
struct case_branch
{
detail::assignable<Predicate> predicate;
Pipeline pipeline;
case_branch(Predicate predicate, Pipeline pipeline) : predicate(predicate), pipeline(pipeline) {}
};
template<typename... CaseBranches>
class switch_pipeline : public pipeline_base<switch_pipeline<CaseBranches...>>
{
public:
template<typename T>
void onReceive(T&& value)
{
auto const firstSatisfyingBranchIndex = detail::find_if(branches_, [&value](auto&& branch){ return branch.predicate(value); });
if (firstSatisfyingBranchIndex < sizeof...(CaseBranches))
{
detail::perform(branches_, firstSatisfyingBranchIndex, [&value](auto&& branch){ send(FWD(value), branch.pipeline); });
}
}
explicit switch_pipeline(CaseBranches const&... caseBranches) : branches_(std::make_tuple(caseBranches...)) {}
private:
std::tuple<CaseBranches...> branches_;
};
template<typename... CaseBranches>
switch_pipeline<CaseBranches...> switch_(CaseBranches const&... caseBranches)
{
return switch_pipeline<CaseBranches...>(caseBranches...);
}
template<typename Predicate>
struct case_pipe
{
Predicate predicate_;
explicit case_pipe(Predicate predicate) : predicate_(predicate){}
};
template<typename Predicate, typename Pipeline>
auto operator>>= (case_pipe<Predicate> pipe, Pipeline&& pipeline)
{
return case_branch<Predicate, std::decay_t<Pipeline>>{pipe.predicate_, pipeline};
}
template<typename Predicate>
case_pipe<Predicate> case_(Predicate&& predicate)
{
return case_pipe<Predicate>(std::forward<Predicate>(predicate));
}
auto const default_ = case_([](auto&&){ return true; });
} // namespace pipes
#endif /* PIPES_SWITCH_HPP */
| 867 |
2,161 | <reponame>Symmetry-International/m2cgen
from contextlib import contextmanager
from m2cgen.ast import CompOpType
from m2cgen.interpreters.code_generator import CodeTemplate, FunctionalCodeGenerator
class FSharpCodeGenerator(FunctionalCodeGenerator):
tpl_function_signature = CodeTemplate("let {function_name} =")
tpl_if_statement = CodeTemplate("if {if_def} then")
tpl_else_statement = CodeTemplate("else")
tpl_num_value = CodeTemplate("{value}")
tpl_infix_expression = CodeTemplate("({left}) {op} ({right})")
tpl_array_index_access = CodeTemplate("{array_name}.[{index}]")
def add_if_termination(self):
self.decrease_indent()
def add_function_def(self, name, args):
func_args = " ".join(
[f"({n} : double{' list' if is_vector else ''})"
for is_vector, n in args])
function_def = f"let {name} {func_args} ="
self.add_code_line(function_def)
self.increase_indent()
@contextmanager
def function_definition(self, name, args):
self.add_function_def(name, args)
yield
self.decrease_indent()
def vector_init(self, values):
return f"[{'; '.join(values)}]"
def _comp_op_overwrite(self, op):
if op == CompOpType.EQ:
return "="
elif op == CompOpType.NOT_EQ:
return "<>"
else:
return op.value
| 595 |
488 | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#define PTR_SIZE 100
#define PTR2_SIZE 10
#define PTR3_SIZE 10
#define OUT_OF_BOUNDS_EXCESS 1
struct User{
float* user_ptr1;
};
struct VoidStr{
void **ptr2ptr;
void *L;
void *H;
void *lock; // Should this be an array of pointers?
};
class Base{
unsigned int *ptr1;
unsigned int *ptr2;
unsigned int var1;
char var2;
float var3;
float* ptr3;
unsigned int *ptr4;
struct User *str_ptr1;
public:
virtual void print() {
printf("This is base class\n");
}
};
class Derived1 : public Base {
unsigned int* der1_ptr1;
float* der1_ptr2;
public:
void print() {
printf("This is Derived1 class\n");
}
};
class Derived2 : public Derived1 {
unsigned int* der2_ptr1;
float* der2_ptr2;
public:
void print() {
printf("This is Derived2 class\n");
}
};
int main() {
int *ptr = (int*)malloc(PTR_SIZE*sizeof(int));
struct VoidStr ptr_structed;
ptr_structed.ptr2ptr = &ptr;
ptr_structed.L = (void*)ptr;
ptr_structed.H = (void*)(ptr + PTR_SIZE*sizeof(int));
find_lock(ptr_structed);
int *ptr2 = (int*)malloc(PTR2_SIZE*sizeof(int));
struct VoidStr ptr2_structed;
ptr2_structed.ptr2ptr = &ptr2;
ptr2_structed.L = (void*)ptr2;
ptr2_structed.H = (void*)(ptr2 + PTR2_SIZE*sizeof(int));
find_lock(ptr2_structed);
class Base base_obj;
class Base* base_ptr = new class Base;
struct VoidStr base_ptr_structed;
base_ptr_structed.ptr2ptr = &base_ptr;
base_ptr_structed.L = (void*)base_ptr;
base_ptr_structed.H = (void*)(base_ptr + sizeof(class Base));
find_lock(base_ptr_structed);
//base_ptr->print();
// This Deref will return the original pointer in
// void type
((class Base*)Deref(base_ptr_structed))->print();
class Base* base_ptr2 = base_ptr;
struct VoidStr base_ptr2_structed;
// Reassign is required since the locks would need
// to be updated as well -- and this could be a
// duplication of an array of pointers which won't happen
// in a simple struct to struct copy
Reassign(base_ptr2_structed,base_ptr_structed);
//base_ptr->print();
// This Deref will get return the original pointer
// in the correct type
((class Base*)Deref(base_ptr_structed))->print();
class Derived1 der1_obj;
// base_ptr = &der1_obj;
// We do the reassignment through our function
// the operation so that we know what is being assigned
// and we update the lower and upper bounds
// We also update the locks in this function
Reassign(base_ptr_structed, &der1_obj);
//(dynamic_cast<Derived1*>(base_ptr))->print();
(dynamic_cast<Derived1*>(Deref(base_ptr_structed))->print());
class Derived2* der2_ptr = new class Derived2;
struct VoidStr der2_ptr_structed;
der2_ptr_structed.ptr2ptr = &der2_ptr;
der2_ptr_structed.L = der2ptr;
der2_ptr_structed.H = sizeof(class Derived2);
find_lock(der2_ptr_structed);
//base_ptr = der2_ptr;
Reassign(base_ptr_structed, der2_ptr_structed);
//(dynamic_cast<Derived2*>(base_ptr))->print();
(dynamic_cast<Derived2*>((class Base*)Deref(base_ptr_structed))->print());
int* start_ptr = ptr;
struct VoidStr start_ptr_structed;
start_ptr_structed.ptr2ptr = &start_ptr;
start_ptr_structed.L = (void*)start_ptr;
start_ptr_structed.H = (void*)(start_ptr + sizeof(int));
find_lock(start_ptr_structed);
int* start_ptr2 = ptr2;
struct VoidStr start_ptr2_structed;
start_ptr2_structed.ptr2ptr = &start_ptr2;
start_ptr2_structed.L = (void*)start_ptr2;
start_ptr2_structed.H = (void*)(start_ptr2 + sizeof(int));
find_lock(start_ptr2_structed);
// Crossing the boundary of ptr. The condition should
// be less than, not less than or equal to
// ptr[PTR_SIZE] is an out-of-bounds access
for(int index = 0; index <= (PTR_SIZE + OUT_OF_BOUNDS_EXCESS); index++) {
//*ptr = index;
// Deref returns the right type of variable
*((int*)Deref(ptr_structed)) = index;
//ptr++;
// Increment becomes addition of 1
// This function updates the L, H and lock
// of LHS with those of RHS
Reassign(ptr_structed, Add(ptr_structed, 1));
}
// Resetting ptr to start_ptr, so that it points to the beginning
// of the allocation
//ptr = start_ptr;
Reassign(ptr_structed, start_ptr_structed);
// Printing what we wrote above
for(int index = 0; index <= (PTR_SIZE + OUT_OF_BOUNDS_EXCESS); index++) {
//printf("ptr[%d]=%d\n", index, *ptr);
printf("ptr[%d]=%d\n", index, *((int*)(Deref(ptr_structed))));
//ptr++;
Reassign(ptr_structed, Add(ptr_structed, 1));
}
return 1;
}
| 2,015 |
348 | <filename>docs/data/leg-t2/024/02404471.json
{"nom":"Sainte-Nathalène","circ":"4ème circonscription","dpt":"Dordogne","inscrits":495,"abs":247,"votants":248,"blancs":22,"nuls":5,"exp":221,"res":[{"nuance":"REM","nom":"<NAME>","voix":117},{"nuance":"FI","nom":"<NAME>","voix":104}]} | 117 |
1,209 | /*
Fontname: -FreeType-Old Standard TT-Medium-R-Normal--41-410-72-72-P-216-ISO10646-1
Copyright: Copyright (C) 2006-2008 <NAME> <<EMAIL>>
Capital A Height: 29, '1' Height: 28
Calculated Max Values w=41 h=38 x= 5 y=22 dx=44 dy= 0 ascent=31 len=174
Font Bounding box w=107 h=51 x=-33 y=-12
Calculated Min Values x=-1 y=-9 dx= 0 dy= 0
Pure Font ascent =29 descent=-9
X Font ascent =30 descent=-9
Max Font ascent =31 descent=-9
*/
#include "u8g.h"
const u8g_fntpgm_uint8_t u8g_font_osr29r[7573] U8G_FONT_SECTION("u8g_font_osr29r") = {
0,107,51,223,244,29,9,148,21,166,32,127,247,31,247,30,
247,0,0,0,11,0,0,5,28,28,11,3,0,112,248,248,
248,248,248,248,248,112,112,112,112,112,112,112,112,32,32,32,
32,32,32,0,112,248,248,248,112,9,8,16,17,4,22,227,
128,227,128,227,128,227,128,193,128,65,128,65,0,65,0,22,
28,84,28,3,0,0,192,192,0,192,192,0,192,192,0,192,
128,0,129,128,1,129,128,1,129,128,1,129,128,255,255,252,
255,255,252,1,129,0,3,3,0,3,3,0,3,3,0,3,
3,0,3,3,0,2,2,0,6,6,0,255,255,252,255,255,
252,6,6,0,6,6,0,6,4,0,4,12,0,12,12,0,
12,12,0,12,12,0,12,12,0,18,34,102,24,3,253,1,
16,0,1,16,0,1,16,0,3,248,0,13,22,0,25,17,
0,49,16,128,97,16,192,97,16,192,97,17,192,97,19,192,
97,19,192,113,19,128,61,16,0,63,144,0,31,240,0,15,
252,0,3,254,0,1,127,0,1,31,128,1,19,128,33,17,
192,113,16,192,249,16,192,241,16,192,241,16,192,225,16,128,
97,17,128,97,17,0,49,19,0,15,188,0,1,240,0,1,
16,0,1,16,0,28,28,112,36,4,0,31,0,6,0,49,
128,4,0,96,192,12,0,96,192,8,0,224,224,24,0,224,
224,48,0,224,224,32,0,224,224,96,0,224,224,64,0,224,
224,128,0,96,193,128,0,96,193,0,0,49,131,0,0,31,
6,0,0,0,4,15,0,0,12,48,128,0,8,48,192,0,
16,96,96,0,48,96,96,0,32,224,112,0,96,224,112,0,
64,224,112,0,128,224,112,1,128,224,112,1,0,96,96,2,
0,96,96,6,0,48,192,4,0,31,128,28,28,112,32,2,
0,0,248,0,0,3,140,0,0,7,4,0,0,6,2,0,
0,14,2,0,0,14,2,0,0,14,6,0,0,14,4,0,
0,15,12,0,0,7,24,0,0,7,176,0,0,3,224,0,
0,1,224,63,240,3,224,7,128,6,240,7,0,12,120,6,
0,24,124,6,0,48,60,4,0,112,30,12,0,112,31,24,
0,240,15,144,0,240,7,176,0,240,7,224,0,240,3,224,
0,240,3,240,32,120,6,248,32,60,12,124,192,31,240,63,
128,3,8,8,10,4,22,224,224,224,224,192,64,64,64,9,
37,74,15,4,249,1,128,3,0,6,0,14,0,12,0,24,
0,24,0,48,0,48,0,96,0,96,0,96,0,96,0,192,
0,192,0,192,0,192,0,192,0,192,0,192,0,192,0,192,
0,192,0,96,0,96,0,96,0,96,0,48,0,48,0,56,
0,24,0,12,0,12,0,6,0,3,0,3,128,1,128,9,
37,74,15,2,249,192,0,96,0,48,0,56,0,24,0,12,
0,12,0,6,0,6,0,3,0,3,0,3,0,3,0,1,
128,1,128,1,128,1,128,1,128,1,128,1,128,1,128,1,
128,1,128,3,128,3,0,3,0,3,0,6,0,6,0,14,
0,12,0,24,0,24,0,48,0,96,0,224,0,192,0,15,
17,34,21,3,11,3,128,3,192,3,128,3,128,225,142,241,
30,249,62,29,112,3,192,3,192,29,120,249,62,241,30,227,
142,3,128,3,192,3,128,35,34,170,39,2,250,0,0,192,
0,0,0,0,192,0,0,0,0,192,0,0,0,0,192,0,
0,0,0,192,0,0,0,0,192,0,0,0,0,192,0,0,
0,0,192,0,0,0,0,192,0,0,0,0,192,0,0,0,
0,192,0,0,0,0,192,0,0,0,0,192,0,0,0,0,
192,0,0,0,0,192,0,0,0,0,192,0,0,255,255,255,
255,224,255,255,255,255,224,0,0,192,0,0,0,0,192,0,
0,0,0,192,0,0,0,0,192,0,0,0,0,192,0,0,
0,0,192,0,0,0,0,192,0,0,0,0,192,0,0,0,
0,192,0,0,0,0,192,0,0,0,0,192,0,0,0,0,
192,0,0,0,0,192,0,0,0,0,192,0,0,0,0,192,
0,0,0,0,192,0,0,5,12,12,11,3,249,112,240,248,
248,24,8,8,16,16,32,32,64,10,2,4,14,2,9,255,
192,255,192,5,5,5,11,3,0,112,248,248,248,112,14,38,
76,18,2,248,0,12,0,12,0,12,0,8,0,24,0,24,
0,16,0,48,0,48,0,32,0,96,0,96,0,64,0,192,
0,192,0,128,1,128,1,128,1,0,3,0,3,0,2,0,
6,0,6,0,4,0,12,0,12,0,8,0,24,0,24,0,
16,0,48,0,48,0,32,0,96,0,96,0,64,0,192,0,
20,28,84,24,2,0,1,248,0,7,12,0,12,7,0,28,
3,128,24,1,128,56,1,192,56,1,192,112,0,224,112,0,
224,112,0,224,240,0,240,240,0,240,240,0,240,240,0,240,
240,0,240,240,0,240,240,0,240,240,0,240,240,0,240,112,
0,224,112,0,224,112,0,224,56,1,192,56,1,192,24,1,
128,12,3,0,6,6,0,3,252,0,14,28,56,24,5,0,
1,128,1,128,3,128,7,128,255,128,7,128,7,128,7,128,
7,128,7,128,7,128,7,128,7,128,7,128,7,128,7,128,
7,128,7,128,7,128,7,128,7,128,7,128,7,128,7,128,
7,128,7,128,7,128,255,252,17,28,84,24,3,0,7,224,
0,24,60,0,32,30,0,64,15,0,192,15,0,192,7,128,
192,7,128,240,7,128,252,7,128,252,7,128,124,7,128,24,
15,0,0,14,0,0,28,0,0,56,0,0,112,0,0,224,
0,1,192,0,3,0,0,6,0,0,12,0,128,24,0,128,
48,0,128,48,1,128,112,1,128,127,255,128,127,255,128,127,
255,128,17,28,84,24,3,0,15,224,0,48,56,0,96,28,
0,96,14,0,240,15,0,248,15,0,248,15,0,120,15,0,
0,15,0,0,15,0,0,14,0,0,28,0,28,56,0,31,
224,0,0,60,0,0,30,0,0,15,0,0,7,0,0,7,
128,0,7,128,120,7,128,248,7,128,248,7,128,248,7,0,
192,15,0,192,14,0,96,28,0,31,240,0,19,28,84,24,
2,0,0,12,0,0,12,0,0,28,0,0,60,0,0,60,
0,0,124,0,0,252,0,0,252,0,1,188,0,3,60,0,
3,60,0,6,60,0,12,60,0,12,60,0,24,60,0,48,
60,0,32,60,0,96,60,0,192,60,0,255,255,224,0,60,
0,0,60,0,0,60,0,0,60,0,0,60,0,0,60,0,
0,60,0,7,255,224,17,29,87,24,4,0,0,2,0,120,
12,0,127,248,0,127,240,0,111,192,0,96,0,0,96,0,
0,96,0,0,96,0,0,96,0,0,103,224,0,104,60,0,
112,30,0,96,14,0,96,15,0,96,7,0,0,7,128,0,
7,128,0,7,128,16,7,128,120,7,128,252,7,128,252,7,
128,248,15,0,224,15,0,224,14,0,96,28,0,48,56,0,
31,240,0,17,28,84,24,3,0,1,248,0,3,12,0,12,
6,0,28,7,0,24,15,0,56,31,0,48,31,0,112,14,
0,112,0,0,112,0,0,240,0,0,241,240,0,246,28,0,
252,14,0,248,7,0,248,7,0,240,7,128,240,7,128,240,
7,128,240,7,128,112,7,128,112,7,128,112,7,0,48,7,
0,56,7,0,24,14,0,12,28,0,7,248,0,16,28,56,
24,4,0,255,255,255,255,255,255,192,3,128,2,128,2,128,
6,128,4,0,12,0,8,0,24,0,48,0,32,0,96,0,
192,0,192,1,128,3,128,3,128,7,128,7,128,7,128,15,
192,15,192,15,192,15,192,15,192,7,192,20,28,84,24,2,
0,3,248,0,14,14,0,56,7,0,112,3,128,112,1,192,
240,1,192,240,1,192,240,1,192,240,1,192,248,1,128,126,
3,128,127,131,0,63,252,0,15,252,0,7,255,0,24,127,
192,48,15,224,112,3,224,224,1,240,224,0,240,224,0,240,
224,0,224,224,0,224,224,0,224,112,1,192,48,1,128,28,
7,0,15,252,0,17,28,84,24,3,0,7,224,0,12,56,
0,56,12,0,56,14,0,112,14,0,112,7,0,240,7,0,
240,7,0,240,7,128,240,7,128,240,7,128,240,7,128,112,
15,128,112,15,128,56,27,128,28,51,128,7,199,128,0,7,
128,0,7,0,0,7,0,56,7,0,124,7,0,124,14,0,
120,14,0,112,12,0,112,24,0,48,48,0,31,224,0,5,
19,19,11,3,0,112,248,248,248,112,0,0,0,0,0,0,
0,0,0,112,248,248,248,112,6,26,26,12,3,249,112,248,
248,248,112,0,0,0,0,0,0,0,0,0,112,248,252,124,
12,12,12,8,24,48,32,64,32,34,136,39,3,250,0,0,
0,2,0,0,0,7,0,0,0,28,0,0,0,112,0,0,
1,224,0,0,7,128,0,0,30,0,0,0,120,0,0,1,
224,0,0,3,128,0,0,14,0,0,0,56,0,0,0,240,
0,0,3,192,0,0,15,0,0,0,60,0,0,0,240,0,
0,0,224,0,0,0,120,0,0,0,30,0,0,0,7,128,
0,0,1,192,0,0,0,112,0,0,0,28,0,0,0,7,
0,0,0,3,192,0,0,0,240,0,0,0,60,0,0,0,
15,0,0,0,3,128,0,0,0,224,0,0,0,56,0,0,
0,14,0,0,0,6,35,10,50,39,2,6,255,255,255,255,
224,255,255,255,255,224,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,255,255,255,255,224,255,255,255,255,224,32,34,
136,39,3,250,64,0,0,0,224,0,0,0,56,0,0,0,
14,0,0,0,7,128,0,0,1,224,0,0,0,120,0,0,
0,30,0,0,0,7,128,0,0,1,192,0,0,0,112,0,
0,0,28,0,0,0,15,0,0,0,3,192,0,0,0,240,
0,0,0,60,0,0,0,15,0,0,0,7,0,0,0,30,
0,0,0,120,0,0,1,224,0,0,3,128,0,0,14,0,
0,0,56,0,0,0,224,0,0,3,192,0,0,15,0,0,
0,60,0,0,0,240,0,0,1,192,0,0,7,0,0,0,
28,0,0,0,112,0,0,0,96,0,0,0,15,28,56,20,
3,0,15,192,48,112,64,60,192,28,192,30,248,30,248,30,
112,30,0,28,0,60,0,120,0,240,1,192,3,128,6,0,
12,0,8,32,8,32,8,32,12,64,7,128,0,0,0,0,
3,128,7,192,7,192,7,192,3,128,29,29,116,33,2,1,
0,63,248,0,1,192,14,0,3,0,3,0,6,0,1,128,
12,0,0,192,24,7,206,96,48,12,124,32,48,56,60,48,
96,112,60,16,96,224,56,24,96,224,56,24,193,192,56,24,
193,192,56,24,193,192,48,24,195,192,112,24,195,128,112,24,
195,128,112,48,195,128,224,48,195,128,224,48,67,129,224,96,
97,130,224,192,97,196,225,128,48,120,62,0,48,0,0,0,
24,0,0,0,12,0,0,0,6,0,4,0,3,128,28,0,
0,127,240,0,29,29,116,32,2,0,0,2,0,0,0,6,
0,0,0,7,0,0,0,7,0,0,0,15,128,0,0,15,
128,0,0,15,128,0,0,31,192,0,0,19,192,0,0,51,
192,0,0,49,224,0,0,33,224,0,0,97,224,0,0,96,
240,0,0,64,240,0,0,192,240,0,0,192,120,0,0,128,
120,0,1,128,120,0,1,255,252,0,1,0,60,0,3,0,
28,0,3,0,30,0,6,0,30,0,6,0,15,0,6,0,
15,0,14,0,15,0,30,0,15,128,255,224,255,248,23,29,
87,28,3,0,255,255,128,15,0,224,15,0,120,15,0,60,
15,0,28,15,0,28,15,0,30,15,0,30,15,0,28,15,
0,28,15,0,56,15,0,48,15,0,224,15,255,0,15,0,
224,15,0,112,15,0,56,15,0,60,15,0,30,15,0,30,
15,0,30,15,0,30,15,0,30,15,0,30,15,0,60,15,
0,60,15,0,120,15,0,224,255,255,128,22,29,87,28,3,
1,1,254,8,7,3,152,12,0,248,28,0,248,24,0,120,
56,0,56,120,0,56,112,0,24,112,0,24,240,0,8,240,
0,8,240,0,0,240,0,0,240,0,0,240,0,0,240,0,
0,240,0,0,240,0,0,240,0,0,112,0,12,112,0,12,
120,0,12,56,0,24,56,0,24,28,0,24,12,0,48,6,
0,96,3,0,192,0,255,128,27,29,116,32,3,0,255,255,
192,0,15,0,112,0,15,0,28,0,15,0,14,0,15,0,
7,0,15,0,7,128,15,0,3,128,15,0,3,192,15,0,
3,192,15,0,1,192,15,0,1,224,15,0,1,224,15,0,
1,224,15,0,1,224,15,0,1,224,15,0,1,224,15,0,
1,224,15,0,1,224,15,0,1,224,15,0,3,192,15,0,
3,192,15,0,3,192,15,0,3,128,15,0,7,0,15,0,
7,0,15,0,14,0,15,0,28,0,15,0,112,0,255,255,
192,0,23,29,87,29,3,0,255,255,254,15,0,62,15,0,
14,15,0,14,15,0,6,15,0,6,15,0,2,15,0,2,
15,1,2,15,1,0,15,1,0,15,1,0,15,3,0,15,
7,0,15,255,0,15,7,0,15,3,0,15,1,0,15,1,
2,15,1,2,15,1,2,15,0,2,15,0,6,15,0,6,
15,0,6,15,0,14,15,0,30,15,0,126,255,255,254,23,
29,87,28,3,0,255,255,254,15,0,62,15,0,14,15,0,
14,15,0,6,15,0,6,15,0,2,15,0,2,15,1,2,
15,1,0,15,1,0,15,1,0,15,3,0,15,7,0,15,
255,0,15,7,0,15,3,0,15,1,0,15,1,0,15,1,
0,15,1,0,15,0,0,15,0,0,15,0,0,15,0,0,
15,0,0,15,0,0,15,0,0,255,240,0,25,30,120,29,
3,0,0,16,0,0,1,254,8,0,6,3,152,0,12,0,
248,0,28,0,248,0,24,0,120,0,56,0,56,0,56,0,
56,0,112,0,24,0,112,0,24,0,112,0,8,0,240,0,
8,0,240,0,0,0,240,0,0,0,240,0,0,0,240,7,
255,128,240,0,120,0,240,0,120,0,240,0,120,0,240,0,
120,0,112,0,120,0,112,0,120,0,112,0,120,0,56,0,
120,0,56,0,120,0,24,0,248,0,28,0,200,0,12,1,
136,0,6,3,8,0,1,254,8,0,28,29,116,33,3,0,
255,240,255,240,15,0,15,0,15,0,15,0,15,0,15,0,
15,0,15,0,15,0,15,0,15,0,15,0,15,0,15,0,
15,0,15,0,15,0,15,0,15,0,15,0,15,0,15,0,
15,0,15,0,15,255,255,0,15,0,15,0,15,0,15,0,
15,0,15,0,15,0,15,0,15,0,15,0,15,0,15,0,
15,0,15,0,15,0,15,0,15,0,15,0,15,0,15,0,
15,0,15,0,15,0,15,0,15,0,15,0,15,0,15,0,
255,240,255,240,12,29,58,17,3,0,255,240,15,0,15,0,
15,0,15,0,15,0,15,0,15,0,15,0,15,0,15,0,
15,0,15,0,15,0,15,0,15,0,15,0,15,0,15,0,
15,0,15,0,15,0,15,0,15,0,15,0,15,0,15,0,
15,0,255,240,19,29,87,22,2,0,1,255,224,0,30,0,
0,30,0,0,30,0,0,30,0,0,30,0,0,30,0,0,
30,0,0,30,0,0,30,0,0,30,0,0,30,0,0,30,
0,0,30,0,0,30,0,0,30,0,0,30,0,0,30,0,
0,30,0,0,30,0,120,30,0,248,30,0,248,30,0,248,
30,0,192,28,0,192,28,0,64,24,0,96,48,0,31,224,
0,27,29,116,32,3,0,255,241,255,192,15,0,126,0,15,
0,60,0,15,0,56,0,15,0,112,0,15,0,96,0,15,
0,192,0,15,1,128,0,15,3,0,0,15,6,0,0,15,
14,0,0,15,30,0,0,15,63,0,0,15,111,0,0,15,
207,128,0,15,135,128,0,15,7,192,0,15,3,192,0,15,
3,224,0,15,3,224,0,15,1,240,0,15,1,240,0,15,
0,248,0,15,0,248,0,15,0,124,0,15,0,124,0,15,
0,62,0,15,0,63,0,255,241,255,224,23,29,87,28,3,
0,255,248,0,15,0,0,15,0,0,15,0,0,15,0,0,
15,0,0,15,0,0,15,0,0,15,0,0,15,0,0,15,
0,0,15,0,0,15,0,0,15,0,0,15,0,0,15,0,
0,15,0,0,15,0,0,15,0,2,15,0,2,15,0,6,
15,0,6,15,0,6,15,0,14,15,0,14,15,0,30,15,
0,62,15,0,254,255,255,254,30,29,116,35,3,0,255,128,
3,252,15,128,7,192,15,192,7,192,15,192,7,192,15,192,
15,192,13,192,11,192,13,224,11,192,13,224,11,192,12,224,
27,192,12,240,19,192,12,240,19,192,12,112,51,192,12,112,
35,192,12,120,35,192,12,120,35,192,12,56,99,192,12,60,
67,192,12,60,67,192,12,28,195,192,12,28,131,192,12,30,
131,192,12,14,131,192,12,15,131,192,12,15,3,192,12,15,
3,192,12,7,3,192,12,6,3,192,30,6,3,192,255,194,
63,252,28,29,116,32,3,0,255,0,63,240,15,128,7,128,
15,128,3,0,15,192,3,0,15,224,3,0,13,224,3,0,
13,240,3,0,12,248,3,0,12,120,3,0,12,124,3,0,
12,60,3,0,12,30,3,0,12,31,3,0,12,15,3,0,
12,7,131,0,12,7,131,0,12,3,195,0,12,3,227,0,
12,1,227,0,12,0,243,0,12,0,251,0,12,0,123,0,
12,0,63,0,12,0,63,0,12,0,31,0,12,0,31,0,
12,0,15,0,30,0,7,0,255,192,7,0,24,29,87,29,
3,1,0,255,0,3,0,192,6,0,96,12,0,48,28,0,
56,56,0,28,56,0,28,120,0,30,112,0,14,112,0,14,
240,0,15,240,0,15,240,0,15,240,0,15,240,0,15,240,
0,15,240,0,15,240,0,15,240,0,15,112,0,14,112,0,
14,120,0,30,56,0,28,56,0,28,28,0,56,12,0,48,
6,0,96,3,0,192,0,255,0,23,29,87,28,3,0,255,
255,128,15,0,224,15,0,120,15,0,60,15,0,60,15,0,
30,15,0,30,15,0,30,15,0,30,15,0,30,15,0,60,
15,0,60,15,0,120,15,0,224,15,255,128,15,0,0,15,
0,0,15,0,0,15,0,0,15,0,0,15,0,0,15,0,
0,15,0,0,15,0,0,15,0,0,15,0,0,15,0,0,
15,0,0,255,248,0,24,36,108,29,3,250,0,255,0,3,
0,192,6,0,96,12,0,48,28,0,56,56,0,28,56,0,
28,120,0,30,112,0,14,112,0,14,240,0,15,240,0,15,
240,0,15,240,0,15,240,0,15,240,0,15,240,0,15,240,
0,15,240,0,15,112,0,14,120,0,30,120,0,30,56,60,
28,56,99,28,28,195,56,14,193,184,6,193,240,3,193,225,
0,247,193,0,9,193,0,1,193,0,1,195,0,1,226,0,
1,254,0,0,252,0,0,56,25,29,116,29,3,0,255,255,
128,0,15,1,240,0,15,0,120,0,15,0,120,0,15,0,
60,0,15,0,60,0,15,0,60,0,15,0,60,0,15,0,
60,0,15,0,120,0,15,0,240,0,15,1,224,0,15,255,
0,0,15,3,128,0,15,1,192,0,15,0,224,0,15,0,
224,0,15,0,240,0,15,0,240,0,15,0,240,0,15,0,
240,0,15,0,240,0,15,0,248,128,15,0,120,128,15,0,
120,128,15,0,121,128,15,0,127,0,15,0,63,0,255,248,
30,0,19,29,87,25,4,1,15,240,192,48,28,192,96,15,
192,96,7,192,192,3,192,192,1,192,192,1,192,192,0,192,
224,0,192,240,0,192,120,0,64,127,0,0,63,192,0,31,
248,0,15,254,0,1,255,128,128,127,128,128,15,192,128,3,
224,128,1,224,192,0,224,192,0,96,224,0,96,224,0,96,
240,0,96,248,0,192,156,0,128,134,1,0,131,254,0,24,
29,87,29,3,0,255,255,255,248,60,31,240,60,15,224,60,
7,192,60,3,192,60,3,192,60,3,128,60,1,128,60,1,
128,60,1,128,60,1,0,60,0,0,60,0,0,60,0,0,
60,0,0,60,0,0,60,0,0,60,0,0,60,0,0,60,
0,0,60,0,0,60,0,0,60,0,0,60,0,0,60,0,
0,60,0,0,60,0,0,60,0,7,255,224,29,29,116,34,
3,0,255,240,31,248,15,0,3,192,15,0,1,128,15,0,
1,128,15,0,1,128,15,0,1,128,15,0,1,128,15,0,
1,128,15,0,1,128,15,0,1,128,15,0,1,128,15,0,
1,128,15,0,1,128,15,0,1,128,15,0,1,128,15,0,
1,128,15,0,1,128,15,0,1,128,15,0,1,128,15,0,
1,128,15,0,1,128,15,0,1,128,15,0,1,128,7,0,
1,0,7,0,3,0,3,128,2,0,1,192,6,0,0,224,
24,0,0,63,240,0,29,29,116,32,2,0,255,248,63,248,
15,128,3,192,7,128,3,128,7,128,3,0,3,192,3,0,
3,192,3,0,3,192,2,0,1,224,6,0,1,224,6,0,
1,240,4,0,0,240,12,0,0,240,12,0,0,248,8,0,
0,120,24,0,0,120,24,0,0,60,16,0,0,60,48,0,
0,60,48,0,0,30,32,0,0,30,96,0,0,31,96,0,
0,15,64,0,0,15,192,0,0,15,192,0,0,7,128,0,
0,7,128,0,0,7,128,0,0,3,0,0,0,3,0,0,
41,29,174,44,2,0,255,241,255,227,255,128,15,128,63,0,
124,0,7,128,30,0,56,0,7,128,30,0,48,0,7,128,
31,0,48,0,3,192,31,0,48,0,3,192,31,0,96,0,
3,192,55,0,96,0,1,224,55,128,96,0,1,224,55,128,
64,0,1,224,39,128,192,0,1,224,99,192,192,0,0,240,
99,192,128,0,0,240,67,193,128,0,0,240,193,193,128,0,
0,120,193,225,0,0,0,120,193,227,0,0,0,120,129,227,
0,0,0,125,128,242,0,0,0,61,128,246,0,0,0,61,
0,246,0,0,0,61,0,116,0,0,0,31,0,124,0,0,
0,31,0,124,0,0,0,30,0,60,0,0,0,14,0,56,
0,0,0,14,0,56,0,0,0,12,0,56,0,0,0,12,
0,16,0,0,28,29,116,31,2,0,255,248,255,224,7,192,
30,0,7,192,28,0,3,224,24,0,1,224,24,0,1,240,
48,0,0,240,32,0,0,248,96,0,0,120,192,0,0,124,
128,0,0,61,128,0,0,63,0,0,0,30,0,0,0,15,
0,0,0,15,0,0,0,15,128,0,0,31,128,0,0,51,
192,0,0,51,224,0,0,97,224,0,0,193,240,0,0,192,
240,0,1,128,248,0,3,0,120,0,3,0,124,0,6,0,
60,0,14,0,62,0,31,0,63,0,255,225,255,240,27,29,
116,30,2,0,255,248,127,224,15,128,31,0,15,128,14,0,
7,128,12,0,3,192,12,0,3,192,8,0,1,224,24,0,
1,240,16,0,0,240,48,0,0,248,32,0,0,120,96,0,
0,60,64,0,0,60,192,0,0,30,128,0,0,31,0,0,
0,15,0,0,0,15,0,0,0,15,0,0,0,15,0,0,
0,15,0,0,0,15,0,0,0,15,0,0,0,15,0,0,
0,15,0,0,0,15,0,0,0,15,0,0,0,15,0,0,
0,15,0,0,1,255,248,0,22,29,87,27,3,0,63,255,
252,62,0,120,60,0,248,56,0,240,48,1,224,48,3,224,
96,3,192,96,7,128,64,15,128,64,15,0,0,31,0,0,
62,0,0,60,0,0,124,0,0,120,0,0,240,0,1,240,
0,1,224,0,3,224,4,7,192,4,7,128,12,15,128,12,
31,0,12,31,0,28,62,0,28,60,0,60,124,0,120,248,
0,248,255,255,248,8,37,37,16,5,248,255,240,224,224,224,
224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,
224,224,224,224,224,224,224,224,224,224,224,224,224,224,240,255,
14,38,76,18,2,248,192,0,64,0,96,0,96,0,32,0,
48,0,48,0,16,0,24,0,24,0,8,0,12,0,12,0,
4,0,4,0,6,0,2,0,2,0,3,0,3,0,1,0,
1,128,1,128,0,128,0,192,0,192,0,64,0,96,0,96,
0,32,0,48,0,48,0,16,0,24,0,24,0,8,0,12,
0,12,8,37,37,16,3,248,255,15,7,7,7,7,7,7,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
7,7,7,7,7,7,7,7,7,7,7,15,255,18,14,42,
24,3,15,0,192,0,1,192,0,1,224,0,3,48,0,3,
48,0,6,24,0,12,12,0,12,12,0,24,6,0,48,6,
0,48,3,0,96,1,128,224,1,128,192,0,192,21,2,6,
21,0,250,255,255,248,255,255,248,7,7,7,18,3,21,192,
224,112,56,24,12,2,18,19,57,21,2,0,15,192,0,56,
112,0,32,56,0,96,28,0,120,28,0,120,28,0,56,28,
0,0,28,0,0,252,0,15,28,0,56,28,0,112,28,0,
224,28,0,224,28,64,224,60,64,224,60,64,224,92,192,112,
159,128,31,15,0,18,29,87,21,1,0,252,0,0,28,0,
0,28,0,0,28,0,0,28,0,0,28,0,0,28,0,0,
28,0,0,28,0,0,28,0,0,28,120,0,28,142,0,29,
7,0,30,3,128,30,3,128,28,3,128,28,3,192,28,3,
192,28,3,192,28,3,192,28,3,192,28,3,192,28,3,192,
28,3,128,28,3,128,30,3,128,27,7,0,17,142,0,16,
248,0,15,19,38,18,2,0,7,224,28,16,56,8,48,12,
112,28,112,60,240,60,240,24,240,0,240,0,240,0,240,0,
240,6,112,4,112,4,48,12,56,8,12,48,7,224,18,29,
87,21,2,0,0,254,0,0,14,0,0,14,0,0,14,0,
0,14,0,0,14,0,0,14,0,0,14,0,0,14,0,0,
14,0,15,142,0,28,78,0,56,46,0,112,30,0,112,30,
0,112,14,0,240,14,0,240,14,0,240,14,0,240,14,0,
240,14,0,240,14,0,240,14,0,112,14,0,112,14,0,112,
30,0,56,62,0,24,110,0,7,207,192,15,19,38,19,2,
0,7,192,12,112,56,56,48,28,112,28,112,28,240,30,240,
30,255,254,240,0,240,0,240,0,240,6,112,4,112,4,56,
4,56,8,28,16,7,224,14,29,58,14,1,0,1,240,7,
24,14,24,12,60,28,60,28,56,28,0,28,0,28,0,28,
0,255,192,28,0,28,0,28,0,28,0,28,0,28,0,28,
0,28,0,28,0,28,0,28,0,28,0,28,0,28,0,28,
0,28,0,28,0,255,192,20,28,84,22,2,247,7,225,192,
28,58,96,56,30,240,112,30,240,112,14,224,240,15,0,240,
15,0,240,15,0,112,14,0,112,30,0,56,28,0,28,56,
0,7,224,0,56,0,0,64,0,0,192,0,0,240,0,0,
255,254,0,63,255,0,15,7,128,112,1,192,64,0,192,192,
0,192,192,0,192,192,1,128,96,1,128,56,6,0,7,248,
0,20,29,87,22,1,0,252,0,0,28,0,0,28,0,0,
28,0,0,28,0,0,28,0,0,28,0,0,28,0,0,28,
0,0,28,0,0,28,60,0,28,199,0,29,3,0,29,3,
128,30,3,128,30,3,128,28,3,128,28,3,128,28,3,128,
28,3,128,28,3,128,28,3,128,28,3,128,28,3,128,28,
3,128,28,3,128,28,3,128,28,3,128,255,159,240,8,28,
28,11,1,0,24,60,60,24,0,0,0,0,0,252,28,28,
28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,255,
11,37,74,14,255,247,0,192,1,224,1,224,0,192,0,0,
0,0,0,0,0,0,0,0,15,224,0,224,0,224,0,224,
0,224,0,224,0,224,0,224,0,224,0,224,0,224,0,224,
0,224,0,224,0,224,0,224,0,224,0,224,0,224,0,224,
0,224,0,224,224,224,240,224,224,192,193,128,99,128,62,0,
19,29,87,21,1,0,252,0,0,28,0,0,28,0,0,28,
0,0,28,0,0,28,0,0,28,0,0,28,0,0,28,0,
0,28,0,0,28,63,192,28,14,0,28,12,0,28,8,0,
28,16,0,28,48,0,28,96,0,28,192,0,28,224,0,29,
224,0,30,240,0,30,120,0,28,60,0,28,60,0,28,30,
0,28,15,0,28,15,0,28,15,128,255,63,224,9,29,58,
11,1,0,252,0,28,0,28,0,28,0,28,0,28,0,28,
0,28,0,28,0,28,0,28,0,28,0,28,0,28,0,28,
0,28,0,28,0,28,0,28,0,28,0,28,0,28,0,28,
0,28,0,28,0,28,0,28,0,28,0,255,128,31,19,76,
33,1,0,252,124,15,128,28,199,24,192,29,7,32,224,31,
3,224,112,30,3,192,112,28,3,128,112,28,3,128,112,28,
3,128,112,28,3,128,112,28,3,128,112,28,3,128,112,28,
3,128,112,28,3,128,112,28,3,128,112,28,3,128,112,28,
3,128,112,28,3,128,112,28,3,128,112,255,159,243,254,20,
19,57,22,1,0,252,60,0,28,199,0,29,3,0,31,3,
128,30,3,128,30,3,128,28,3,128,28,3,128,28,3,128,
28,3,128,28,3,128,28,3,128,28,3,128,28,3,128,28,
3,128,28,3,128,28,3,128,28,3,128,255,159,240,17,19,
57,21,2,0,3,224,0,12,56,0,24,28,0,56,14,0,
112,14,0,112,7,0,240,7,0,240,7,0,240,7,128,240,
7,128,240,7,128,240,7,0,240,7,0,112,7,0,112,14,
0,56,14,0,24,28,0,12,56,0,3,224,0,18,28,84,
21,1,247,252,120,0,29,142,0,31,7,0,30,3,128,30,
3,128,28,3,128,28,3,192,28,3,192,28,3,192,28,3,
192,28,3,192,28,3,192,28,3,192,28,3,128,28,3,128,
30,3,128,31,7,0,29,134,0,28,120,0,28,0,0,28,
0,0,28,0,0,28,0,0,28,0,0,28,0,0,28,0,
0,28,0,0,255,128,0,18,28,84,21,2,247,7,130,0,
28,98,0,56,54,0,112,22,0,112,30,0,112,14,0,240,
14,0,240,14,0,240,14,0,240,14,0,240,14,0,240,14,
0,240,14,0,112,14,0,112,14,0,112,30,0,56,62,0,
24,110,0,7,206,0,0,14,0,0,14,0,0,14,0,0,
14,0,0,14,0,0,14,0,0,14,0,0,14,0,0,127,
192,15,19,38,16,1,0,252,56,28,196,28,142,29,30,31,
28,30,12,30,0,30,0,28,0,28,0,28,0,28,0,28,
0,28,0,28,0,28,0,28,0,28,0,255,128,14,19,38,
18,2,0,31,16,96,208,64,112,192,48,192,16,224,16,240,
0,126,0,63,128,31,224,3,248,128,252,192,28,192,12,224,
12,224,12,240,8,140,24,131,224,12,27,54,14,1,0,4,
0,4,0,4,0,4,0,4,0,12,0,12,0,28,0,255,
224,28,0,28,0,28,0,28,0,28,0,28,0,28,0,28,
0,28,0,28,0,28,0,28,16,28,16,28,16,28,48,30,
32,15,224,7,192,20,19,57,22,1,0,252,31,128,28,3,
128,28,3,128,28,3,128,28,3,128,28,3,128,28,3,128,
28,3,128,28,3,128,28,3,128,28,3,128,28,3,128,28,
3,128,28,7,128,28,7,128,28,15,128,12,11,128,14,51,
128,3,195,240,20,19,57,21,1,0,255,15,240,60,3,128,
28,3,0,28,3,0,14,2,0,14,2,0,15,6,0,7,
4,0,7,4,0,3,140,0,3,136,0,3,200,0,1,216,
0,1,208,0,0,240,0,0,240,0,0,96,0,0,96,0,
0,96,0,30,19,76,31,1,0,255,31,243,252,60,7,128,
224,28,3,128,192,28,3,128,192,14,3,192,128,14,3,192,
128,15,7,193,128,7,5,225,0,7,4,225,0,3,140,227,
0,3,136,114,0,1,200,114,0,1,216,118,0,1,240,60,
0,0,240,60,0,0,240,60,0,0,96,24,0,0,96,24,
0,0,32,24,0,18,19,57,21,1,0,255,31,192,30,14,
0,30,12,0,14,8,0,15,24,0,7,16,0,3,160,0,
3,224,0,1,192,0,1,224,0,1,224,0,1,112,0,3,
120,0,2,56,0,4,28,0,12,28,0,24,14,0,24,15,
0,254,63,192,20,28,84,22,1,247,255,143,240,30,1,128,
30,1,128,14,1,0,14,1,0,15,3,0,7,2,0,7,
2,0,3,134,0,3,132,0,3,132,0,1,204,0,1,200,
0,1,200,0,0,248,0,0,240,0,0,240,0,0,112,0,
0,96,0,0,96,0,0,96,0,0,64,0,48,64,0,120,
192,0,120,128,0,113,128,0,51,0,0,30,0,0,14,19,
38,18,2,0,255,252,224,60,192,56,192,120,128,240,128,224,
129,224,1,192,3,128,7,128,7,0,15,0,30,4,28,4,
60,4,56,12,112,12,240,28,255,252,10,37,74,17,4,248,
1,192,6,0,12,0,8,0,24,0,24,0,24,0,28,0,
28,0,12,0,14,0,14,0,14,0,6,0,6,0,6,0,
4,0,8,0,240,0,24,0,12,0,4,0,6,0,6,0,
14,0,14,0,14,0,12,0,28,0,28,0,24,0,24,0,
24,0,8,0,12,0,6,0,1,192,2,38,38,12,5,248,
192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,192,
192,192,192,192,192,192,10,37,74,17,3,248,224,0,24,0,
12,0,4,0,6,0,6,0,6,0,14,0,14,0,12,0,
28,0,28,0,28,0,24,0,24,0,24,0,8,0,4,0,
3,192,6,0,8,0,24,0,24,0,24,0,28,0,28,0,
28,0,12,0,14,0,14,0,6,0,6,0,6,0,4,0,
12,0,24,0,224,0,23,8,24,27,2,7,30,0,8,127,
192,4,255,240,2,199,254,2,128,255,134,128,63,254,192,15,
252,96,1,248,255};
| 16,348 |
450 | //===- GlobalLpPool.cpp ---------------------------------------------------===//
//
// The ONNC Project
//
// See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include <onnc/IR/Compute/GlobalLpPool.h>
using namespace onnc;
char GlobalLpPool::ID = 0;
//===----------------------------------------------------------------------===//
// GlobalLpPool
//===----------------------------------------------------------------------===//
GlobalLpPool::GlobalLpPool()
: ComputeOperator("GlobalLpPool", ID),
m_P(2) {
}
GlobalLpPool::GlobalLpPool(const IntAttr& pP)
: ComputeOperator("GlobalLpPool", ID),
m_P(pP) {
}
GlobalLpPool::GlobalLpPool(const GlobalLpPool& pCopy)
: ComputeOperator(pCopy) /* shallow copy */,
m_P(pCopy.getP()) {
}
void GlobalLpPool::printAttributes(std::ostream& pOS) const
{
pOS << '<' << "p: " << getP()<< '>';
}
bool GlobalLpPool::classof(const ComputeOperator* pOp)
{
if (nullptr == pOp)
return false;
return (pOp->getID() == &ID);
}
| 375 |
337 | package cn.ycbjie.ycaudioplayer.ui.advert.model.bean;
import java.io.Serializable;
/**
* Created by yc on 2018/2/8.
*/
public class AdvertCommon {
/**
* 返回码,0成功
*/
public String message;
/**
* 返回状态 200代表成功
*/
public int status;
/**
* 具体内容
*/
public Splash splash;
public class Splash implements Serializable {
/**这里需要写死序列化Id*/
private static final long serialVersionUID = 7382351359868556980L;
public int id;
/**大图 url*/
public String burl;
/**小图url*/
public String surl;
/**点击跳转 URl*/
public String clickUrl;
/**图片的存储地址*/
public String savePath;
/**图片的存储地址*/
public String title;
public Splash(String burl, String surl, String clickUrl, String savePath) {
this.burl = burl;
this.surl = surl;
this.clickUrl = clickUrl;
this.savePath = savePath;
}
}
}
| 547 |
846 | from .backgammon.backgammon_env import env, raw_env
| 18 |
2,023 | def allindices(string, sub, listindex, offset):
#call as l = allindices(string, sub, [], 0)
if (string.find(sub) == -1):
return listindex
else:
offset = string.index(sub)+offset
listindex.append(offset)
string = string[(string.index(sub)+1):]
return allindices(string, sub, listindex, offset+1)
| 122 |
2,350 | <gh_stars>1000+
package org.roaringbitmap.realdata;
import com.google.common.collect.ImmutableMap;
import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.roaringbitmap.RealDataset.*;
public class RealDataBenchmarkWideOrPqTest extends RealDataBenchmarkSanityTest {
private static final Map<String, Integer> EXPECTED_RESULTS =
ImmutableMap.<String, Integer>builder().put(CENSUS_INCOME, 199523).put(CENSUS1881, 988653)
.put(DIMENSION_008, 148278).put(DIMENSION_003, 3866847).put(DIMENSION_033, 3866847)
.put(USCENSUS2000, 5985).put(WEATHER_SEPT_85, 1015367).put(WIKILEAKS_NOQUOTES, 242540)
.put(CENSUS_INCOME_SRT, 199523).put(CENSUS1881_SRT, 656346)
.put(WEATHER_SEPT_85_SRT, 1015367).put(WIKILEAKS_NOQUOTES_SRT, 236436).build();
@Override
protected void doTest(String dataset, String type, boolean immutable) {
int expected = EXPECTED_RESULTS.get(dataset);
RealDataBenchmarkWideOrPq bench = new RealDataBenchmarkWideOrPq();
assertEquals(expected, bench.wideOr_pq(bs));
}
}
| 446 |
654 | // SPDX-License-Identifier: BSD-3-Clause
package org.xbill.DNS;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
import java.nio.file.Paths;
import org.junit.jupiter.api.Test;
class MasterTest {
@Test
void nextRecord() throws IOException {
Name exampleComName = Name.fromConstantString("example.com.");
try (Master master = new Master(MasterTest.class.getResourceAsStream("/zonefileEx1"))) {
master.expandGenerate(false);
Record rr = master.nextRecord();
assertEquals(Type.SOA, rr.getType());
rr = master.nextRecord();
assertEquals(Type.NS, rr.getType());
rr = master.nextRecord();
assertEquals(Type.MX, rr.getType());
rr = master.nextRecord();
// test special '@' resolves name correctly
assertEquals(exampleComName, rr.getName());
rr = master.nextRecord();
// test relative host become absolute
assertEquals(Name.fromConstantString("mail3.example.com."), rr.getAdditionalName());
rr = master.nextRecord();
assertEquals(Type.A, rr.getType());
rr = master.nextRecord();
assertEquals(Type.AAAA, rr.getType());
rr = master.nextRecord();
assertEquals(Type.CNAME, rr.getType());
rr = master.nextRecord();
assertNull(rr);
// $GENERATE directive is last in zonefile
assertTrue(master.generators().hasNext());
}
}
@Test
void includeDirective() throws IOException, URISyntaxException {
try (Master master =
new Master(
Paths.get(MasterTest.class.getResource("/zonefileIncludeDirective").toURI())
.toString())) {
Record rr = master.nextRecord();
assertEquals(Type.SOA, rr.getType());
}
}
@Test
void includeDirectiveComment() throws IOException, URISyntaxException {
try (Master master =
new Master(
Paths.get(MasterTest.class.getResource("/zonefileIncludeDirectiveComment").toURI())
.toString())) {
Record rr = master.nextRecord();
assertEquals(Type.SOA, rr.getType());
}
}
@Test
void relativeIncludeDirectiveViaStream() throws IOException {
try (InputStream is = MasterTest.class.getResourceAsStream("/zonefileIncludeDirective");
Master m = new Master(is)) {
assertThrows(TextParseException.class, m::nextRecord);
}
}
@Test
void includeDirectiveDisabled() throws IOException {
try (InputStream is = MasterTest.class.getResourceAsStream("/zonefileIncludeDirective");
Master m = new Master(is)) {
m.disableIncludes();
assertNull(m.nextRecord());
}
}
@Test
void includeDirectiveDisabledStrict() throws IOException {
try (InputStream is = MasterTest.class.getResourceAsStream("/zonefileIncludeDirective");
Master m = new Master(is)) {
m.disableIncludes(true);
assertThrows(TextParseException.class, m::nextRecord);
}
}
@Test
void includeDirectiveDisabledComment() throws IOException {
try (InputStream is = MasterTest.class.getResourceAsStream("/zonefileIncludeDirectiveComment");
Master m = new Master(is)) {
m.disableIncludes();
assertNull(m.nextRecord());
}
}
@Test
void expandGenerated() throws IOException {
try (Master master = new Master(MasterTest.class.getResourceAsStream("/zonefileEx1"))) {
master.expandGenerate(true);
// until we get to the generator directive, it's empty
assertFalse(master.generators().hasNext());
Record rr = skipTo(master, Type.PTR);
assertTrue(master.generators().hasNext());
assertEquals(Type.PTR, rr.getType());
assertEquals(
Name.fromConstantString("host-1.dsl.example.com."), ((PTRRecord) rr).getTarget());
}
}
@Test
void invalidGenRange() {
try (Master master = new Master(new ByteArrayInputStream("$GENERATE 3-1".getBytes()))) {
TextParseException thrown = assertThrows(TextParseException.class, master::nextRecord);
assertTrue(thrown.getMessage().contains("Invalid $GENERATE range specifier: 3-1"));
}
}
@Test
void invalidGenType() {
try (Master master =
new Master(
new ByteArrayInputStream(
"$TTL 1h\n$GENERATE 1-3 example.com. MX 10 mail.example.com.".getBytes()))) {
TextParseException thrown = assertThrows(TextParseException.class, master::nextRecord);
assertTrue(thrown.getMessage().contains("$GENERATE does not support MX records"));
}
}
@Test
void invalidGenerateRangeSpecifier() {
try (Master master = new Master(new ByteArrayInputStream("$GENERATE 1to20".getBytes()))) {
TextParseException thrown = assertThrows(TextParseException.class, master::nextRecord);
assertTrue(thrown.getMessage().contains("Invalid $GENERATE range specifier"));
}
}
@Test
void invalidDirective() {
try (Master master = new Master(new ByteArrayInputStream("$INVALID".getBytes()))) {
TextParseException thrown = assertThrows(TextParseException.class, master::nextRecord);
assertTrue(thrown.getMessage().contains("Invalid directive: $INVALID"));
}
}
@Test
void missingTTL() {
try (Master master = new Master(new ByteArrayInputStream("example.com. IN NS ns".getBytes()))) {
TextParseException thrown = assertThrows(TextParseException.class, master::nextRecord);
assertTrue(thrown.getMessage().contains("missing TTL"));
}
}
@Test
void invalidType() {
try (Master master =
new Master(new ByteArrayInputStream("example.com. IN INVALID".getBytes()))) {
TextParseException thrown = assertThrows(TextParseException.class, master::nextRecord);
assertTrue(thrown.getMessage().contains("Invalid type"));
}
}
@Test
void noOwner() {
try (Master master = new Master(new ByteArrayInputStream(" \n ^".getBytes()))) {
TextParseException thrown = assertThrows(TextParseException.class, master::nextRecord);
assertTrue(thrown.getMessage().contains("no owner"));
}
}
@Test
void invalidOriginNotAbsolute_ctorInputStream() {
RelativeNameException thrown =
assertThrows(
RelativeNameException.class,
() -> new Master((InputStream) null, Name.fromConstantString("notabsolute")));
assertTrue(thrown.getMessage().contains("'notabsolute' is not an absolute name"));
}
@Test
void invalidOriginNotAbsolute_ctorString() {
RelativeNameException thrown =
assertThrows(
RelativeNameException.class,
() -> new Master("zonefileEx1", Name.fromConstantString("notabsolute")));
assertTrue(thrown.getMessage().contains("'notabsolute' is not an absolute name"));
}
private Record skipTo(Master master, int type) throws IOException {
Record record;
do {
record = master.nextRecord();
} while (record != null && record.getType() != type);
return record;
}
}
| 2,663 |
396 | package com.ibm.cns.articles.control;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
@ApplicationScoped
public class DataAccessFacade {
@Inject
@ConfigProperty(name = "inmemory", defaultValue = "true")
private boolean inMemory;
@Inject
InMemoryDataAccess inMemoryDataAccess;
@Inject
JPADataAccess jPADataAccess;
@Produces
@MPConfigured
public DataAccess getDataAccess() {
if (inMemory)
return inMemoryDataAccess;
return jPADataAccess;
}
}
| 247 |
682 | /**CFile****************************************************************
FileName [int2Int.h]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Interpolation engine.]
Synopsis [Internal declarations.]
Author [<NAME>]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - Dec 1, 2013.]
Revision [$Id: int2Int.h,v 1.00 2013/12/01 00:00:00 alanmi Exp $]
***********************************************************************/
#ifndef ABC__Gia__int2__intInt_h
#define ABC__Gia__int2__intInt_h
////////////////////////////////////////////////////////////////////////
/// INCLUDES ///
////////////////////////////////////////////////////////////////////////
#include "aig/gia/gia.h"
#include "sat/bsat/satSolver.h"
#include "sat/cnf/cnf.h"
#include "int2.h"
////////////////////////////////////////////////////////////////////////
/// PARAMETERS ///
////////////////////////////////////////////////////////////////////////
ABC_NAMESPACE_HEADER_START
////////////////////////////////////////////////////////////////////////
/// BASIC TYPES ///
////////////////////////////////////////////////////////////////////////
// interpolation manager
typedef struct Int2_Man_t_ Int2_Man_t;
struct Int2_Man_t_
{
// parameters
Int2_ManPars_t * pPars; // parameters
// GIA managers
Gia_Man_t * pGia; // original manager
Gia_Man_t * pGiaPref; // prefix manager
Gia_Man_t * pGiaSuff; // suffix manager
// subset of the manager
Vec_Int_t * vSuffCis; // suffix CIs
Vec_Int_t * vSuffCos; // suffix COs
Vec_Int_t * vPrefCos; // suffix POs
Vec_Int_t * vStack; // temporary stack
// preimages
Vec_Int_t * vImageOne; // latest preimage
Vec_Int_t * vImagesAll; // cumulative preimage
// variable maps
Vec_Ptr_t * vMapFrames; // mapping of GIA IDs into frame IDs
Vec_Int_t * vMapPref; // mapping of flop inputs into SAT variables
Vec_Int_t * vMapSuff; // mapping of flop outputs into SAT variables
// initial minimization
Vec_Int_t * vAssign; // assignment of PIs in pGiaSuff
Vec_Int_t * vPrio; // priority of PIs in pGiaSuff
// SAT solving
sat_solver * pSatPref; // prefix solver
sat_solver * pSatSuff; // suffix solver
// runtime
abctime timeSatPref;
abctime timeSatSuff;
abctime timeOther;
abctime timeTotal;
};
static inline Int2_Man_t * Int2_ManCreate( Gia_Man_t * pGia, Int2_ManPars_t * pPars )
{
Int2_Man_t * p;
p = ABC_CALLOC( Int2_Man_t, 1 );
p->pPars = pPars;
p->pGia = pGia;
p->pGiaPref = Gia_ManStart( 10000 );
// perform structural hashing
Gia_ManHashAlloc( pFrames );
// subset of the manager
p->vSuffCis = Vec_IntAlloc( Gia_ManCiNum(pGia) );
p->vSuffCos = Vec_IntAlloc( Gia_ManCoNum(pGia) );
p->vPrefCos = Vec_IntAlloc( Gia_ManCoNum(pGia) );
p->vStack = Vec_IntAlloc( 10000 );
// preimages
p->vImageOne = Vec_IntAlloc( 1000 );
p->vImagesAll = Vec_IntAlloc( 1000 );
// variable maps
p->vMapFrames = Vec_PtrAlloc( 100 );
p->vMapPref = Vec_IntAlloc( Gia_ManRegNum(pGia) );
p->vMapSuff = Vec_IntAlloc( Gia_ManRegNum(pGia) );
// initial minimization
p->vAssign = Vec_IntAlloc( Gia_ManCiNum(pGia) );
p->vPrio = Vec_IntAlloc( Gia_ManCiNum(pGia) );
return p;
}
static inline void Int2_ManStop( Int2_Man_t * p )
{
// GIA managers
Gia_ManStopP( &p->pGiaPref );
Gia_ManStopP( &p->pGiaSuff );
// subset of the manager
Vec_IntFreeP( &p->vSuffCis );
Vec_IntFreeP( &p->vSuffCos );
Vec_IntFreeP( &p->vPrefCos );
Vec_IntFreeP( &p->vStack );
// preimages
Vec_IntFreeP( &p->vImageOne );
Vec_IntFreeP( &p->vImagesAll );
// variable maps
Vec_VecFree( (Vec_Vec_t *)p->vMapFrames );
Vec_IntFreeP( &p->vMapPref );
Vec_IntFreeP( &p->vMapSuff );
// initial minimization
Vec_IntFreeP( &p->vAssign );
Vec_IntFreeP( &p->vPrio );
// SAT solving
if ( p->pSatPref )
sat_solver_delete( p->pSatPref );
if ( p->timeSatSuff )
sat_solver_delete( p->pSatSuff );
ABC_FREE( p );
}
////////////////////////////////////////////////////////////////////////
/// MACRO DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
/*=== int2Bmc.c =============================================================*/
extern int Int2_ManCheckInit( Gia_Man_t * p );
extern Gia_Man_t * Int2_ManDupInit( Gia_Man_t * p, int fVerbose );
extern sat_solver * Int2_ManSetupBmcSolver( Gia_Man_t * p, int nFrames );
extern void Int2_ManCreateFrames( Int2_Man_t * p, int iFrame, Vec_Int_t * vPrefCos );
extern int Int2_ManCheckBmc( Int2_Man_t * p, Vec_Int_t * vCube );
/*=== int2Refine.c =============================================================*/
extern Vec_Int_t * Int2_ManRefineCube( Gia_Man_t * p, Vec_Int_t * vAssign, Vec_Int_t * vPrio );
/*=== int2Util.c ============================================================*/
extern Gia_Man_t * Int2_ManProbToGia( Gia_Man_t * p, Vec_Int_t * vSop );
ABC_NAMESPACE_HEADER_END
#endif
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
| 2,544 |
331 | <reponame>janst97/Monal
//
// MLXMPPActivityItem.h
// Monal
//
// Created by <NAME> on 9/5/19.
// Copyright © 2019 Monal.im. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface MLXMPPActivityItem : UIActivityItemProvider
@end
NS_ASSUME_NONNULL_END
| 125 |
342 | <gh_stars>100-1000
#ifndef TOPPRA_SOLVER_SEIDEL_INTERNAL_HPP
#define TOPPRA_SOLVER_SEIDEL_INTERNAL_HPP
#include <toppra/solver/seidel.hpp>
namespace toppra {
namespace solver {
typedef Eigen::Matrix<value_type, 2, 1> Vector2;
typedef Eigen::Matrix<value_type, 1, 2> RowVector2;
typedef Eigen::Matrix<value_type, 3, 1> Vector3;
typedef Eigen::Matrix<value_type, 1, 3> RowVector3;
typedef Eigen::Matrix<value_type, Eigen::Dynamic, 2> MatrixX2;
typedef Eigen::Matrix<value_type, Eigen::Dynamic, 3> MatrixX3;
namespace seidel {
constexpr int LOW_0 = -1,
HIGH_0 = -2,
LOW_1 = -3,
HIGH_1 = -4;
constexpr int LOW (int i) { return (i == 0) ? LOW_0 : LOW_1 ; }
constexpr int HIGH(int i) { return (i == 0) ? HIGH_0 : HIGH_1; }
struct LpSol1d {
bool feasible;
value_type optvar;
int active_c;
};
struct LpSol {
bool feasible;
value_type optval;
Vector2 optvar;
std::array<int, 2> active_c;
};
inline std::ostream& operator<< (std::ostream& os, const LpSol1d& sol)
{
if (!sol.feasible) return os << "infeasible";
return os << "feasible. x* = " << sol.optvar
<< ", active_c = " << sol.active_c;
}
inline std::ostream& operator<< (std::ostream& os, const LpSol& sol)
{
if (!sol.feasible) return os << "infeasible";
return os << "feasible: " << sol.optval
<< "\n\toptvar: " << sol.optvar.transpose()
<< "\n\tactive_c: " << sol.active_c[0] << ' ' << sol.active_c[1]
;
}
constexpr LpSol1d INFEASIBLE_1D { false };
/// Avoid division by number less TINY.
constexpr double TINY = 1e-10;
/// Authorized constraint violation threshold.
constexpr double REL_TOLERANCE = 1e-10;
constexpr double ABS_TOLERANCE = 1e-13;
constexpr value_type infinity = std::numeric_limits<value_type>::infinity();
#define TOPPRA_SEIDEL_LP1D(w,X) \
TOPPRA_LOG_##w("Seidel LP 1D:\n" \
<< "v: " << v << '\n' \
<< "A:\n" << A << '\n' \
<< X);
/**
Solve a Linear Program with 1 variable.
max v[0] x + v[1]
s.t. A [ x 1 ] <= 0
**/
template<typename Derived>
LpSol1d solve_lp1d(const RowVector2& v, const Eigen::MatrixBase<Derived>& A)
{
// initial bounds are +/- infinity.
value_type cur_min = -infinity,
cur_max = infinity;
int active_c_min = -1,
active_c_max = -2;
auto a (A.col(0)), b (A.col(1));
TOPPRA_SEIDEL_LP1D(DEBUG, "");
bool maximize { v[0] > 0 };
for (int i = 0; i < A.rows(); ++i) {
// If a[i] is very small, then consider the constraint as constant.
// TODO: Shouldn't we check instead that a[i] is much smaller that b[i] ?
// For the following problem, what solution should be returned ?
// max x
// s.t. x - 2 <= 0
// eps*x - eps <= 0
// For eps small, the code below skips the second constraint and returns 2.
if (std::abs(a[i]) < ABS_TOLERANCE) {
if (b[i] > ABS_TOLERANCE) {
TOPPRA_SEIDEL_LP1D(WARN, "-> constraint " << i << " infeasible.");
return INFEASIBLE_1D;
}
continue;
}
if (a[i] > 0) {
if (a[i] * cur_max + b[i] > 0) { // Constraint bounds x from above
cur_max = std::min(-b[i]/a[i], cur_max);
active_c_max = i;
}
} else if (a[i] < 0 && a[i] * cur_min + b[i] > 0) { // Constraint bounds x from below
cur_min = std::max(-b[i]/a[i], cur_min);
active_c_min = i;
}
}
if ( cur_min - cur_max > std::max(std::abs(cur_min),std::abs(cur_max))*REL_TOLERANCE
|| cur_min == infinity
|| cur_max == -infinity) {
TOPPRA_SEIDEL_LP1D(WARN, "-> incoherent bounds. high - low = "
<< cur_max << " - " << cur_min << " = " << cur_max - cur_min);
return INFEASIBLE_1D;
}
if (v[0] == 0) {
value_type x;
if (cur_min != -infinity)
if (cur_max != infinity) return { true, (cur_max/2+cur_min/2), active_c_min };
else return { true, cur_min, active_c_min };
else return { true, cur_max, active_c_max };
}
if (maximize)
return LpSol1d{ true, cur_max, active_c_max };
else
// optimizing direction is perpencicular to the line, or is
// pointing toward the negative direction.
return LpSol1d{ true, cur_min, active_c_min };
}
#undef TOPPRA_SEIDEL_LP1D
/**
Solve a LP with two variables.
The LP is specified as follow:
max v^T x
s.t. A [ x^T 1 ]^T <= 0
low <= x <= high
NOTE: A possible optimization for this function is pruning linear
constraints that are clearly infeasible. This is not implemented
because in my current code, the bottleneck is not in solving
TOPP-RA but in setting up the parameters.
Parameters
----------
\param v
\param a
\param b
\param c
\param low
\param high
\param active_c Contains (2) indicies of rows in a, b, c that are likely the
active constraints at the optimal solution.
\param use_cache: bool
\param index_map A view to a pre-allocated integer array, to map from
[1,...,nrows] to the considered entries. This array is created
to avoid the cost of initializing a new array.
\param A_1d A view to an initialized array. This array is created to avoid
the cost of initializing a new array.
\return A LpSol instance that contains the ouput. When LpSol.feasible is false,
other fields are not meaningful.
**/
LpSol solve_lp2d(const RowVector2& v, const MatrixX3& A,
const Vector2& low, const Vector2& high,
MatrixX2& A_1d);
} // namespace seidel
} // namespace solver
} // namespace toppra
#endif
| 2,381 |
5,169 | {
"name": "FoglightAPM",
"version": "6.3.0-alpha.4",
"homepage": "http://documents.software.dell.com/DOC253107",
"license": {
"type": "Commercial",
"file": "FoglightAPM.framework-6.3.0/LICENSE"
},
"authors": {
"<NAME>": "<EMAIL>"
},
"summary": "FoglightAPM SaaS iOS monitoring.",
"source": {
"http": "http://172.16.31.10:8000/FoglightAPM.framework-6.3.0-alpha.2.zip",
"sha1": "3f82de8c0eb0c1dc99cb1759ef8eb551ee09cc84"
},
"vendored_frameworks": "FoglightAPM.framework-6.3.0/FoglightAPM.framework",
"public_header_files": "FoglightAPM.framework-6.3.0/FoglightAPM.framework/**/*.h",
"frameworks": [
"CoreLocation",
"CoreTelephony",
"SystemConfiguration"
],
"libraries": "z",
"requires_arc": true,
"platforms": {
"ios": "7.0"
},
"dependencies": {
"PLCrashReporter": [
"1.2.0"
]
}
}
| 406 |
851 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from torch import optim
# Non-centered RMSprop update with shared statistics (without momentum)
class SharedRMSprop(optim.RMSprop):
"""Implements RMSprop algorithm with shared states.
"""
def __init__(self, params, lr=1e-2, alpha=0.99, eps=1e-8, weight_decay=0):
super(SharedRMSprop, self).__init__(params, lr=lr, alpha=alpha, eps=eps, weight_decay=weight_decay, momentum=0, centered=False)
# State initialisation (must be done before step, else will not be shared between threads)
for group in self.param_groups:
for p in group['params']:
state = self.state[p]
state['step'] = p.data.new().resize_(1).zero_()
state['square_avg'] = p.data.new().resize_as_(p.data).zero_()
def share_memory(self):
for group in self.param_groups:
for p in group['params']:
state = self.state[p]
state['step'].share_memory_()
state['square_avg'].share_memory_()
def step(self, closure=None):
"""Performs a single optimization step.
Arguments:
closure (callable, optional): A closure that reevaluates the model
and returns the loss.
"""
loss = None
if closure is not None:
loss = closure()
for group in self.param_groups:
for p in group['params']:
if p.grad is None:
continue
grad = p.grad.data
state = self.state[p]
square_avg = state['square_avg']
alpha = group['alpha']
state['step'] += 1
if group['weight_decay'] != 0:
grad = grad.add(group['weight_decay'], p.data)
# g = αg + (1 - α)Δθ^2
square_avg.mul_(alpha).addcmul_(1 - alpha, grad, grad)
# θ ← θ - ηΔθ/√(g + ε)
avg = square_avg.sqrt().add_(group['eps'])
p.data.addcdiv_(-group['lr'], grad, avg)
return loss
| 1,075 |
312 | //
// Copyright (c) 1990-2011, Scientific Toolworks, Inc.
//
// The License.txt file describes the conditions under which this software may be distributed.
//
// Author: <NAME>
//
// Additions Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware
// ScintillaQt.h - Qt specific subclass of ScintillaBase
#ifndef SCINTILLAQT_H
#define SCINTILLAQT_H
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include <ctype.h>
#include <time.h>
#include <cmath>
#include <stdexcept>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include "Scintilla.h"
#include "Platform.h"
#include "ILexer.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
#include "ContractionState.h"
#include "CellBuffer.h"
#include "CallTip.h"
#include "KeyMap.h"
#include "Indicator.h"
#include "XPM.h"
#include "LineMarker.h"
#include "Style.h"
#include "AutoComplete.h"
#include "ViewStyle.h"
#include "CharClassify.h"
#include "Decoration.h"
#include "CaseFolder.h"
#include "Document.h"
#include "Selection.h"
#include "PositionCache.h"
#include "EditModel.h"
#include "MarginView.h"
#include "EditView.h"
#include "Editor.h"
#include "ScintillaBase.h"
#include "CaseConvert.h"
#ifdef SCI_LEXER
#include "SciLexer.h"
#include "PropSetSimple.h"
#endif
#include <QObject>
#include <QAbstractScrollArea>
#include <QAction>
#include <QClipboard>
#include <QPaintEvent>
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
class ScintillaQt : public QObject, public ScintillaBase {
Q_OBJECT
public:
explicit ScintillaQt(QAbstractScrollArea *parent);
virtual ~ScintillaQt();
signals:
void horizontalScrolled(int value);
void verticalScrolled(int value);
void horizontalRangeChanged(int max, int page);
void verticalRangeChanged(int max, int page);
void notifyParent(SCNotification scn);
void notifyChange();
// Clients can use this hook to add additional
// formats (e.g. rich text) to the MIME data.
void aboutToCopy(QMimeData *data);
void command(uptr_t wParam, sptr_t lParam);
private slots:
void onIdle();
void execCommand(QAction *action);
void SelectionChanged();
private:
virtual void Initialise();
virtual void Finalise();
virtual bool DragThreshold(Point ptStart, Point ptNow);
virtual bool ValidCodePage(int codePage) const;
private:
virtual void ScrollText(int linesToMove);
virtual void SetVerticalScrollPos();
virtual void SetHorizontalScrollPos();
virtual bool ModifyScrollBars(int nMax, int nPage);
virtual void ReconfigureScrollBars();
void CopyToModeClipboard(const SelectionText &selectedText, QClipboard::Mode clipboardMode_);
virtual void Copy();
virtual void CopyToClipboard(const SelectionText &selectedText);
void PasteFromMode(QClipboard::Mode clipboardMode_);
virtual void Paste();
virtual void ClaimSelection();
virtual void NotifyChange();
virtual void NotifyFocus(bool focus);
virtual void NotifyParent(SCNotification scn);
int timers[tickDwell+1];
virtual bool FineTickerAvailable();
virtual bool FineTickerRunning(TickReason reason);
virtual void FineTickerStart(TickReason reason, int millis, int tolerance);
virtual void FineTickerCancel(TickReason reason);
virtual bool SetIdle(bool on);
virtual void SetMouseCapture(bool on);
virtual bool HaveMouseCapture();
virtual void StartDrag();
int CharacterSetOfDocument() const;
const char *CharacterSetIDOfDocument() const;
QString StringFromDocument(const char *s) const;
QByteArray BytesForDocument(const QString &text) const;
virtual CaseFolder *CaseFolderForEncoding();
virtual std::string CaseMapString(const std::string &s, int caseMapping);
virtual void CreateCallTipWindow(PRectangle rc);
virtual void AddToPopUp(const char *label, int cmd = 0, bool enabled = true);
virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
static sptr_t DirectFunction(sptr_t ptr,
unsigned int iMessage, uptr_t wParam, sptr_t lParam);
protected:
void PartialPaint(const PRectangle &rect);
void DragEnter(const Point &point);
void DragMove(const Point &point);
void DragLeave();
void Drop(const Point &point, const QMimeData *data, bool move);
void timerEvent(QTimerEvent *event);
private:
QAbstractScrollArea *scrollArea;
int vMax, hMax; // Scroll bar maximums.
int vPage, hPage; // Scroll bar page sizes.
bool haveMouseCapture;
bool dragWasDropped;
int rectangularSelectionModifier;
friend class ScintillaEditBase;
};
#ifdef SCI_NAMESPACE
}
#endif
#endif // SCINTILLAQT_H
| 1,551 |
325 | // Tencent is pleased to support the open source community by making Mars available.
// Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved.
// Licensed under the MIT License (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://opensource.org/licenses/MIT
// Unless required by applicable law or agreed to in writing, software distributed under the License is
// distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions and
// limitations under the License.
/*
* log_buffer.h
*
* Created on: 2015-7-28
* Author: yanguoyue
*/
#ifndef LOGBUFFER_H_
#define LOGBUFFER_H_
#include <zlib.h>
#include <string>
#include <stdint.h>
#include "mars/comm/ptrbuffer.h"
#include "mars/comm/autobuffer.h"
class LogCrypt;
class LogBuffer {
public:
LogBuffer(void* _pbuffer, size_t _len, bool _is_compress, const char* _pubkey);
~LogBuffer();
public:
static bool GetPeriodLogs(const char* _log_path, int _begin_hour, int _end_hour, unsigned long& _begin_pos, unsigned long& _end_pos, std::string& _err_msg);
public:
PtrBuffer& GetData();
void Flush(AutoBuffer& _buff);
bool Write(const void* _data, size_t _inputlen, AutoBuffer& _out_buff);
bool Write(const void* _data, size_t _length);
private:
bool __Reset();
void __Flush();
void __Clear();
void __Fix();
private:
PtrBuffer buff_;
bool is_compress_;
z_stream cstream_;
class LogCrypt* log_crypt_;
size_t remain_nocrypt_len_;
};
#endif /* LOGBUFFER_H_ */
| 609 |
319 | <gh_stars>100-1000
/*
* Copyright (c) 2013, Regents of the University of California
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package edu.uci.python.runtime.object.location;
import org.python.core.*;
import com.oracle.truffle.api.*;
import edu.uci.python.runtime.object.*;
public final class ArrayObjectStorageLocation extends StorageLocation {
private final int index;
private final Class<?> storedClass;
public ArrayObjectStorageLocation(ObjectLayout objectLayout, int index, Class<?> storedClass) {
super(objectLayout);
this.index = index;
this.storedClass = storedClass;
}
@Override
public boolean isSet(PythonObject object) {
return object.getSpillArray()[index] != null;
}
@Override
public Object read(PythonObject object) {
final Object result = ObjectLayoutUtil.readObjectArrayUnsafeAt(object.getSpillArray(), index, this);
if (result != null) {
return result;
}
CompilerDirectives.transferToInterpreterAndInvalidate();
throw Py.AttributeError(object + " object has no attribute " + getObjectLayout().findAttributeId(this));
}
@Override
public void write(PythonObject object, Object value) {
ObjectLayoutUtil.writeObjectArrayUnsafeAt(object.getSpillArray(), index, value, this);
}
@Override
public Class<?> getStoredClass() {
return storedClass;
}
@Override
public String toString() {
return "arrayObject" + index;
}
}
| 900 |
302 | <gh_stars>100-1000
package com.github.sakserv.minicluster.impl;
import org.apache.commons.lang.StringUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.gateway.GatewayMessages;
import org.apache.hadoop.gateway.config.GatewayConfig;
import org.apache.hadoop.gateway.config.impl.GatewayConfigImpl;
import org.apache.hadoop.gateway.i18n.messages.MessagesFactory;
import org.joda.time.Period;
import org.joda.time.format.PeriodFormatter;
import org.joda.time.format.PeriodFormatterBuilder;
import java.io.File;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import static org.apache.hadoop.gateway.config.impl.GatewayConfigImpl.*;
public class LocalGatewayConfig extends Configuration implements GatewayConfig {
private static final String GATEWAY_DEFAULT_TOPOLOGY_NAME = null;
private static final String GATEWAY_CONFIG_FILE_PREFIX = "gateway";
public static final String HTTP_HOST = "gateway.host";
public static final String HTTP_PORT = "gateway.port";
public static final String HTTP_PATH = "gateway.path";
private static List<String> DEFAULT_GLOBAL_RULES_SERVICES;
private static final String CRYPTO_ALGORITHM = GATEWAY_CONFIG_FILE_PREFIX + ".crypto.algorithm";
private static final String CRYPTO_PBE_ALGORITHM = GATEWAY_CONFIG_FILE_PREFIX + ".crypto.pbe.algorithm";
private static final String CRYPTO_TRANSFORMATION = GATEWAY_CONFIG_FILE_PREFIX + ".crypto.transformation";
private static final String CRYPTO_SALTSIZE = GATEWAY_CONFIG_FILE_PREFIX + ".crypto.salt.size";
private static final String CRYPTO_ITERATION_COUNT = GATEWAY_CONFIG_FILE_PREFIX + ".crypto.iteration.count";
private static final String CRYPTO_KEY_LENGTH = GATEWAY_CONFIG_FILE_PREFIX + ".crypto.key.length";
public static final String SERVER_HEADER_ENABLED = GATEWAY_CONFIG_FILE_PREFIX + ".server.header.enabled";
public static final String CLIENT_AUTH_WANTED = GATEWAY_CONFIG_FILE_PREFIX + ".client.auth.wanted";
public LocalGatewayConfig() {
super(false);
this.init();
}
private String getVar(String variableName, String defaultValue) {
String value = this.get(variableName);
if (value == null) {
value = System.getProperty(variableName);
}
if (value == null) {
value = System.getenv(variableName);
}
if (value == null) {
value = defaultValue;
}
return value;
}
private String getGatewayHomeDir() {
String home = this.get("GATEWAY_HOME", System.getProperty("GATEWAY_HOME", System.getenv("GATEWAY_HOME")));
return home;
}
private void setGatewayHomeDir(String dir) {
this.set("GATEWAY_HOME", dir);
}
public String getGatewayConfDir() {
String value = this.getVar("GATEWAY_CONF_HOME", this.getGatewayHomeDir() + File.separator + "conf");
return value;
}
public String getGatewayDataDir() {
String systemValue = System.getProperty("GATEWAY_DATA_HOME", System.getenv("GATEWAY_DATA_HOME"));
String dataDir = null;
if (systemValue != null) {
dataDir = systemValue;
} else {
dataDir = this.get("gateway.data.dir", this.getGatewayHomeDir() + File.separator + "data");
}
return dataDir;
}
public String getGatewayServicesDir() {
return this.get("gateway.services.dir", this.getGatewayDataDir() + File.separator + "services");
}
public String getGatewayApplicationsDir() {
return this.get("gateway.applications.dir", this.getGatewayDataDir() + File.separator + "applications");
}
public String getHadoopConfDir() {
return this.get("gateway.hadoop.conf.dir");
}
private void init() {
this.setDefaultGlobalRulesServices();
}
private void setDefaultGlobalRulesServices() {
DEFAULT_GLOBAL_RULES_SERVICES = new ArrayList();
DEFAULT_GLOBAL_RULES_SERVICES.add("NAMENODE");
DEFAULT_GLOBAL_RULES_SERVICES.add("JOBTRACKER");
DEFAULT_GLOBAL_RULES_SERVICES.add("WEBHDFS");
DEFAULT_GLOBAL_RULES_SERVICES.add("WEBHCAT");
DEFAULT_GLOBAL_RULES_SERVICES.add("OOZIE");
DEFAULT_GLOBAL_RULES_SERVICES.add("WEBHBASE");
DEFAULT_GLOBAL_RULES_SERVICES.add("HIVE");
DEFAULT_GLOBAL_RULES_SERVICES.add("RESOURCEMANAGER");
}
public String getGatewayHost() {
String host = this.get("gateway.host", "0.0.0.0");
return host;
}
public int getGatewayPort() {
return Integer.parseInt(this.get("gateway.port", "8888"));
}
public String getGatewayPath() {
return this.get("gateway.path", "gateway");
}
public String getGatewayTopologyDir() {
return this.getGatewayConfDir() + File.separator + "topologies";
}
public String getGatewayDeploymentDir() {
return this.get("gateway.deployment.dir", this.getGatewayDataDir() + File.separator + "deployments");
}
public String getGatewaySecurityDir() {
return this.get("gateway.security.dir", this.getGatewayDataDir() + File.separator + "security");
}
public InetSocketAddress getGatewayAddress() throws UnknownHostException {
String host = this.getGatewayHost();
int port = this.getGatewayPort();
InetSocketAddress address = new InetSocketAddress(host, port);
return address;
}
public boolean isSSLEnabled() {
String enabled = this.get("ssl.enabled", "true");
return "true".equals(enabled);
}
public boolean isHadoopKerberosSecured() {
String hadoopKerberosSecured = this.get("gateway.hadoop.kerberos.secured", "false");
return "true".equals(hadoopKerberosSecured);
}
public String getKerberosConfig() {
return this.get("java.security.krb5.conf");
}
public boolean isKerberosDebugEnabled() {
String kerberosDebugEnabled = this.get("sun.security.krb5.debug", "false");
return "true".equals(kerberosDebugEnabled);
}
public String getKerberosLoginConfig() {
return this.get("java.security.auth.login.config");
}
public String getDefaultTopologyName() {
String name = this.get("default.app.topology.name");
return name != null ? name : GATEWAY_DEFAULT_TOPOLOGY_NAME;
}
public String getDefaultAppRedirectPath() {
String defTopo = this.getDefaultTopologyName();
return defTopo == null ? null : "/" + this.getGatewayPath() + "/" + defTopo;
}
public String getFrontendUrl() {
String url = this.get("gateway.frontend.url", (String) null);
return url;
}
public List<String> getExcludedSSLProtocols() {
List protocols = null;
String value = this.get("ssl.exclude.protocols");
if (!"none".equals(value)) {
protocols = Arrays.asList(value.split("\\s*,\\s*"));
}
return protocols;
}
public List<String> getIncludedSSLCiphers() {
List list = null;
String value = this.get("ssl.include.ciphers");
if (value != null && !value.isEmpty() && !"none".equalsIgnoreCase(value.trim())) {
list = Arrays.asList(value.trim().split("\\s*,\\s*"));
}
return list;
}
public List<String> getExcludedSSLCiphers() {
List list = null;
String value = this.get("ssl.exclude.ciphers");
if (value != null && !value.isEmpty() && !"none".equalsIgnoreCase(value.trim())) {
list = Arrays.asList(value.trim().split("\\s*,\\s*"));
}
return list;
}
public boolean isClientAuthNeeded() {
String clientAuthNeeded = this.get("gateway.client.auth.needed", "false");
return "true".equals(clientAuthNeeded);
}
public String getTruststorePath() {
return this.get("gateway.truststore.path", (String) null);
}
public boolean getTrustAllCerts() {
String trustAllCerts = this.get("gateway.trust.all.certs", "false");
return "true".equals(trustAllCerts);
}
public String getTruststoreType() {
return this.get("gateway.truststore.type", "JKS");
}
public String getKeystoreType() {
return this.get("gateway.keystore.type", "JKS");
}
public boolean isXForwardedEnabled() {
String xForwardedEnabled = this.get("gateway.xforwarded.enabled", "true");
return "true".equals(xForwardedEnabled);
}
public String getEphemeralDHKeySize() {
return this.get("gateway.jdk.tls.ephemeralDHKeySize", "2048");
}
public int getHttpClientMaxConnections() {
return this.getInt("gateway.httpclient.maxConnections", 32);
}
public int getHttpClientConnectionTimeout() {
int t = -1;
String s = this.get("gateway.httpclient.connectionTimeout", (String) null);
if (s != null) {
try {
t = (int) parseNetworkTimeout(s);
} catch (Exception var4) {
;
}
}
return t;
}
public int getHttpClientSocketTimeout() {
int t = -1;
String s = this.get("gateway.httpclient.socketTimeout", (String) null);
if (s != null) {
try {
t = (int) parseNetworkTimeout(s);
} catch (Exception var4) {
;
}
}
return t;
}
public int getThreadPoolMax() {
int i = this.getInt("gateway.threadpool.max", 254);
if (i < 5) {
i = 5;
}
return i;
}
public int getHttpServerRequestBuffer() {
int i = this.getInt("gateway.httpserver.requestBuffer", 16384);
return i;
}
public int getHttpServerRequestHeaderBuffer() {
int i = this.getInt("gateway.httpserver.requestHeaderBuffer", 8192);
return i;
}
public int getHttpServerResponseBuffer() {
int i = this.getInt("gateway.httpserver.responseBuffer", '耀');
return i;
}
public int getHttpServerResponseHeaderBuffer() {
int i = this.getInt("gateway.httpserver.responseHeaderBuffer", 8192);
return i;
}
public int getGatewayDeploymentsBackupVersionLimit() {
int i = this.getInt("gateway.deployment.backup.versionLimit", 5);
if (i < 0) {
i = -1;
}
return i;
}
public long getGatewayDeploymentsBackupAgeLimit() {
PeriodFormatter f = (new PeriodFormatterBuilder()).appendDays().toFormatter();
String s = this.get("gateway.deployment.backup.ageLimit", "-1");
long d;
try {
Period e = Period.parse(s, f);
d = e.toStandardDuration().getMillis();
if (d < 0L) {
d = -1L;
}
} catch (Exception var6) {
d = -1L;
}
return d;
}
public String getSigningKeystoreName() {
return this.get("gateway.signing.keystore.name");
}
public String getSigningKeyAlias() {
return this.get("gateway.signing.key.alias");
}
public List<String> getGlobalRulesServices() {
String value = this.get("gateway.global.rules.services");
return value != null && !value.isEmpty() && !"none".equalsIgnoreCase(value.trim()) ? Arrays.asList(value.trim().split("\\s*,\\s*")) : DEFAULT_GLOBAL_RULES_SERVICES;
}
private static long parseNetworkTimeout(String s) {
PeriodFormatter f = (new PeriodFormatterBuilder()).appendMinutes().appendSuffix("m", " min").appendSeconds().appendSuffix("s", " sec").appendMillis().toFormatter();
Period p = Period.parse(s, f);
return p.toStandardDuration().getMillis();
}
@Override
public List<String> getMimeTypesToCompress() {
List<String> mimeTypes = null;
String value = get(MIME_TYPES_TO_COMPRESS, DEFAULT_MIME_TYPES_TO_COMPRESS);
if (value != null && !value.isEmpty()) {
mimeTypes = Arrays.asList(value.trim().split("\\s*,\\s*"));
}
return mimeTypes;
}
@Override
public boolean isCookieScopingToPathEnabled() {
return false;
}
@Override
public boolean isWebsocketEnabled() {
final String result = get( WEBSOCKET_FEATURE_ENABLED, Boolean.toString(DEFAULT_WEBSOCKET_FEATURE_ENABLED));
return Boolean.parseBoolean(result);
}
@Override
public int getWebsocketMaxTextMessageSize() {
return getInt( WEBSOCKET_MAX_TEXT_MESSAGE_SIZE, DEFAULT_WEBSOCKET_MAX_TEXT_MESSAGE_SIZE);
}
@Override
public int getWebsocketMaxBinaryMessageSize() {
return getInt( WEBSOCKET_MAX_BINARY_MESSAGE_SIZE, DEFAULT_WEBSOCKET_MAX_BINARY_MESSAGE_SIZE);
}
@Override
public int getWebsocketMaxTextMessageBufferSize() {
return getInt( WEBSOCKET_MAX_TEXT_MESSAGE_BUFFER_SIZE, DEFAULT_WEBSOCKET_MAX_TEXT_MESSAGE_BUFFER_SIZE);
}
@Override
public int getWebsocketMaxBinaryMessageBufferSize() {
return getInt( WEBSOCKET_MAX_BINARY_MESSAGE_BUFFER_SIZE, DEFAULT_WEBSOCKET_MAX_BINARY_MESSAGE_BUFFER_SIZE);
}
@Override
public int getWebsocketInputBufferSize() {
return getInt( WEBSOCKET_INPUT_BUFFER_SIZE, DEFAULT_WEBSOCKET_INPUT_BUFFER_SIZE);
}
@Override
public int getWebsocketAsyncWriteTimeout() {
return getInt( WEBSOCKET_ASYNC_WRITE_TIMEOUT, DEFAULT_WEBSOCKET_ASYNC_WRITE_TIMEOUT);
}
@Override
public int getWebsocketIdleTimeout() {
return getInt( WEBSOCKET_IDLE_TIMEOUT, DEFAULT_WEBSOCKET_IDLE_TIMEOUT);
}
@Override
public boolean isMetricsEnabled() {
String metricsEnabled = get( METRICS_ENABLED, "true" );
return "true".equals(metricsEnabled);
}
@Override
public boolean isJmxMetricsReportingEnabled() {
String enabled = get( JMX_METRICS_REPORTING_ENABLED, "true" );
return "true".equals(enabled);
}
@Override
public boolean isGraphiteMetricsReportingEnabled() {
String enabled = get( GRAPHITE_METRICS_REPORTING_ENABLED, "false" );
return "true".equals(enabled);
}
@Override
public String getGraphiteHost() {
String host = get( GRAPHITE_METRICS_REPORTING_HOST, "localhost" );
return host;
}
@Override
public int getGraphitePort() {
int i = getInt( GRAPHITE_METRICS_REPORTING_PORT, 32772 );
return i;
}
@Override
public int getGraphiteReportingFrequency() {
int i = getInt( GRAPHITE_METRICS_REPORTING_FREQUENCY, 1 );
return i;
}
@Override
public long getGatewayIdleTimeout() {
return getLong(GATEWAY_IDLE_TIMEOUT, 300000l);
}
@Override
public boolean isGatewayPortMappingEnabled() {
String enabled = get( GATEWAY_PORT_MAPPING_ENABLED, "false" );
return "true".equals(enabled);
}
@Override
public String getAlgorithm() {
return getVar(CRYPTO_ALGORITHM, null);
}
@Override
public String getPBEAlgorithm() {
return getVar(CRYPTO_PBE_ALGORITHM, null);
}
@Override
public String getTransformation() {
return getVar(CRYPTO_TRANSFORMATION, null);
}
@Override
public String getSaltSize() {
return getVar(CRYPTO_SALTSIZE, null);
}
@Override
public String getIterationCount() {
return getVar(CRYPTO_ITERATION_COUNT, null);
}
@Override
public String getKeyLength() {
return getVar(CRYPTO_KEY_LENGTH, null);
}
@Override
public boolean isGatewayServerHeaderEnabled() {
return Boolean.parseBoolean(getVar(SERVER_HEADER_ENABLED, "true"));
}
/**
* Map of Topology names and their ports.
*
* @return
*/
@Override
public Map<String, Integer> getGatewayPortMappings() {
final Map<String, Integer> result = new ConcurrentHashMap<String, Integer>();
final Map<String, String> properties = getValByRegex(GATEWAY_PORT_MAPPING_REGEX);
// Convert port no. from string to int
for(final Map.Entry<String, String> e : properties.entrySet()) {
// ignore the GATEWAY_PORT_MAPPING_ENABLED property
if(!e.getKey().equalsIgnoreCase(GATEWAY_PORT_MAPPING_ENABLED)) {
// extract the topology name and use it as a key
result.put(StringUtils.substringAfter(e.getKey(), GATEWAY_PORT_MAPPING_PREFIX), Integer.parseInt(e.getValue()) );
}
}
return Collections.unmodifiableMap(result);
}
@Override
public boolean isClientAuthWanted() {
return Boolean.parseBoolean(getVar(CLIENT_AUTH_WANTED, "false"));
}
}
| 7,032 |
2,206 | /*
*
* Copyright (c) 2006-2020, Speedment, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); You may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.speedment.runtime.compute;
import static com.speedment.runtime.compute.expression.ExpressionType.BOOLEAN_NULLABLE;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import com.speedment.runtime.compute.util.Pair;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import java.util.function.Function;
final class ToBooleanNullableTest {
private static final ToBooleanNullable<String> DEFAULT_NULLABLE = string -> string == null ?
null : string.length() > 2;
@ParameterizedTest
@ValueSource(strings = "test")
void of(String input) {
final Function<String, Boolean> function = string -> string.length() > 2;
final ToBooleanNullable<String> fromFunction = ToBooleanNullable.of(function);
assertNotNull(fromFunction);
assertEquals(function.apply(input), fromFunction.apply(input));
final ToBooleanNullable<String> raw = DEFAULT_NULLABLE;
final ToBooleanNullable<String> fromRaw = ToBooleanNullable.of(raw);
assertNotNull(fromFunction);
assertEquals(raw.apply(input), fromRaw.apply(input));
}
@Test
void expressionType() {
Assertions.assertEquals(BOOLEAN_NULLABLE, DEFAULT_NULLABLE.expressionType());
}
@Test
void orThrow() {
final ToBooleanNullable<String> nullValue = string -> null;
assertDoesNotThrow(nullValue::orThrow);
final ToBoolean<String> toBoolean = nullValue.orThrow();
assertThrows(NullPointerException.class, () -> toBoolean.applyAsBoolean(""));
assertDoesNotThrow(DEFAULT_NULLABLE::orThrow);
}
@ParameterizedTest
@ValueSource(strings = {"a", "foo", "test"})
void orElseGet(String input) {
final ToBooleanNullable<String> nullValue = string -> null;
ToBoolean<String> toBoolean = nullValue.orElseGet(string -> string.length() > 2);
assertEquals(input.length() > 2, toBoolean.applyAsBoolean(input));
toBoolean = DEFAULT_NULLABLE.orElseGet(string -> true);
assertEquals(input.length() > 2, toBoolean.applyAsBoolean(input));
}
@ParameterizedTest
@ValueSource(strings = {"test", "foo", ""})
void orElse(String input) {
final ToBooleanNullable<String> nullValue = string -> null;
ToBoolean<String> toBoolean = nullValue.orElse(true);
assertTrue(toBoolean.applyAsBoolean(input));
toBoolean = DEFAULT_NULLABLE.orElse(true);
assertEquals(input.length() > 2, toBoolean.applyAsBoolean(input));
}
@Test
void mapToDoubleIfPresent() {
final ToDoubleNullable<String> toDoubleNullable = DEFAULT_NULLABLE
.mapToDoubleIfPresent(bool -> bool ? 1 : 0);
assertNotNull(toDoubleNullable);
assertEquals(1, toDoubleNullable.applyAsDouble("three"));
assertEquals(0, toDoubleNullable.applyAsDouble("1"));
assertNull(toDoubleNullable.apply(null));
assertEquals(1, toDoubleNullable.apply("three"));
assertEquals(0, toDoubleNullable.apply("1"));
final ToDouble<String> orElseGet = toDoubleNullable.orElseGet(string -> 0);
assertEquals(1, orElseGet.applyAsDouble("test"));
assertEquals(0, orElseGet.applyAsDouble(null));
final ToDouble<String> orElse = toDoubleNullable.orElse((double) 0);
assertEquals(1, orElse.applyAsDouble("test"));
assertEquals(0, orElse.applyAsDouble(null));
assertTrue(toDoubleNullable.isNotNull("test"));
assertFalse(toDoubleNullable.isNotNull(null));
assertTrue(toDoubleNullable.isNull(null));
assertFalse(toDoubleNullable.isNull("test"));
}
@Test
void mapIfPresent() {
final ToBooleanNullable<String> toBooleanNullable = DEFAULT_NULLABLE.mapIfPresent(bool -> !bool);
assertNotNull(toBooleanNullable);
assertTrue(toBooleanNullable.applyAsBoolean("1"));
assertFalse(toBooleanNullable.applyAsBoolean("three"));
assertNull(toBooleanNullable.apply(null));
assertFalse(toBooleanNullable.apply("three"));
assertTrue(toBooleanNullable.apply("1"));
final ToBoolean<String> orElseGet = toBooleanNullable.orElseGet(string -> false);
assertFalse(orElseGet.applyAsBoolean("test"));
assertFalse(orElseGet.applyAsBoolean(null));
final ToBoolean<String> orElse = toBooleanNullable.orElse(false);
assertFalse(orElse.applyAsBoolean("test"));
assertFalse(orElse.applyAsBoolean(null));
assertTrue(toBooleanNullable.isNotNull("test"));
assertFalse(toBooleanNullable.isNotNull(null));
assertTrue(toBooleanNullable.isNull(null));
assertFalse(toBooleanNullable.isNull("test"));
}
@ParameterizedTest
@ValueSource(strings = {"test", "foo"})
void hash(String input) {
assertEquals(0, DEFAULT_NULLABLE.hash(null));
assertEquals(1, DEFAULT_NULLABLE.hash(input));
assertEquals(2, DEFAULT_NULLABLE.hash("a"));
}
@Test
void compare() {
final ToBooleanNullable<String> raw = string -> string.length() > 4 ? true : null;
final Pair<String, String> nullNull = new Pair<>("foo", "bar");
final Pair<String, String> nullHas = new Pair<>("foo", "longer");
final Pair<String, String> hasNull = new Pair<>("longer", "foo");
final Pair<String, String> hasHas = new Pair<>("longer", "longer");
assertEquals(0, raw.compare(nullNull.getFirst(), nullNull.getSecond()));
assertEquals(1, raw.compare(nullHas.getFirst(), nullHas.getSecond()));
assertEquals(-1, raw.compare(hasNull.getFirst(), hasNull.getSecond()));
assertEquals(0, raw.compare(hasHas.getFirst(), hasHas.getSecond()));
}
@Test
void compose() {
assertThrows(NullPointerException.class, () -> DEFAULT_NULLABLE.compose(null));
final ToBooleanNullable<Boolean> composed = DEFAULT_NULLABLE.compose(Object::toString);
assertNotNull(composed);
}
}
| 2,688 |
2,542 | // ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------
#include "stdafx.h"
using namespace Common;
using namespace std;
using namespace Management::ClusterManager;
StoreDataVerifiedFabricUpgradeDomains::StoreDataVerifiedFabricUpgradeDomains()
: StoreData()
, upgradeDomains_()
{
}
StoreDataVerifiedFabricUpgradeDomains::StoreDataVerifiedFabricUpgradeDomains(
vector<wstring> && verifiedDomains)
: StoreData()
, upgradeDomains_(move(verifiedDomains))
{
}
wstring const & StoreDataVerifiedFabricUpgradeDomains::get_Type() const
{
return Constants::StoreType_VerifiedFabricUpgradeDomains;
}
wstring StoreDataVerifiedFabricUpgradeDomains::ConstructKey() const
{
return Constants::StoreKey_VerifiedFabricUpgradeDomains;
}
void StoreDataVerifiedFabricUpgradeDomains::WriteTo(Common::TextWriter & w, Common::FormatOptions const &) const
{
w.Write("VerifiedFabricUpgradeDomains: {0}", upgradeDomains_);
}
| 330 |
17,702 | <reponame>shyamalschandra/CNTK
#pragma once
#include <vector>
#include <memory>
#include "latticearchive.h"
namespace msra { namespace dbn {
// ---------------------------------------------------------------------------
// latticesource -- manages loading of lattices for MMI (in pairs for numer and denom)
// ---------------------------------------------------------------------------
class latticepair : public std::pair<msra::lattices::lattice, msra::lattices::lattice>
{
public:
// NOTE: we don't check numerator lattice now
size_t getnumframes() const
{
return second.getnumframes();
}
size_t getnumnodes() const
{
return second.getnumnodes();
}
size_t getnumedges() const
{
return second.getnumedges();
}
std::wstring getkey() const
{
return second.getkey();
}
};
class latticesource
{
const msra::lattices::archive numlattices, denlattices;
int verbosity;
public:
typedef msra::dbn::latticepair latticepair;
latticesource(std::pair<std::vector<std::wstring>, std::vector<std::wstring>> latticetocs, const std::unordered_map<std::string, size_t>& modelsymmap, std::wstring RootPathInToc)
: numlattices(latticetocs.first, modelsymmap, RootPathInToc), denlattices(latticetocs.second, modelsymmap, RootPathInToc), verbosity(0)
{
}
bool empty() const
{
#ifndef NONUMLATTICEMMI // TODO:set NUM lattice to null so as to save memory
if (numlattices.empty() ^ denlattices.empty())
RuntimeError("latticesource: numerator and denominator lattices must be either both empty or both not empty");
#endif
return denlattices.empty();
}
bool haslattice(std::wstring key) const
{
#ifdef NONUMLATTICEMMI
return denlattices.haslattice(key);
#else
return numlattices.haslattice(key) && denlattices.haslattice(key);
#endif
}
void getlattices(const std::wstring& key, std::shared_ptr<const latticepair>& L, size_t expectedframes) const
{
std::shared_ptr<latticepair> LP(new latticepair);
denlattices.getlattice(key, LP->second, expectedframes); // this loads the lattice from disk, using the existing L.second object
L = LP;
}
void setverbosity(int veb)
{
verbosity = veb;
numlattices.setverbosity(veb);
denlattices.setverbosity(veb);
}
};
} }
| 937 |
1,073 | <filename>llvm/lib/Target/XCore/XCoreTargetStreamer.h
//===-- XCoreTargetStreamer.h - XCore Target Streamer ----------*- C++ -*--===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_TARGET_XCORE_XCORETARGETSTREAMER_H
#define LLVM_LIB_TARGET_XCORE_XCORETARGETSTREAMER_H
#include "llvm/MC/MCStreamer.h"
namespace llvm {
class XCoreTargetStreamer : public MCTargetStreamer {
public:
XCoreTargetStreamer(MCStreamer &S);
~XCoreTargetStreamer() override;
virtual void emitCCTopData(StringRef Name) = 0;
virtual void emitCCTopFunction(StringRef Name) = 0;
virtual void emitCCBottomData(StringRef Name) = 0;
virtual void emitCCBottomFunction(StringRef Name) = 0;
};
}
#endif
| 297 |
2,761 | // Scintilla source code edit control
/** @file Geometry.h
** Classes and functions for geometric and colour calculations.
**/
// Copyright 2020 by <NAME> <<EMAIL>>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef GEOMETRY_H
#define GEOMETRY_H
namespace Scintilla::Internal {
typedef double XYPOSITION;
typedef double XYACCUMULATOR;
/**
* A geometric point class.
* Point is similar to the Win32 POINT and GTK+ GdkPoint types.
*/
class Point {
public:
XYPOSITION x;
XYPOSITION y;
constexpr explicit Point(XYPOSITION x_=0, XYPOSITION y_=0) noexcept : x(x_), y(y_) {
}
static constexpr Point FromInts(int x_, int y_) noexcept {
return Point(static_cast<XYPOSITION>(x_), static_cast<XYPOSITION>(y_));
}
constexpr bool operator==(Point other) const noexcept {
return (x == other.x) && (y == other.y);
}
constexpr bool operator!=(Point other) const noexcept {
return (x != other.x) || (y != other.y);
}
constexpr Point operator+(Point other) const noexcept {
return Point(x + other.x, y + other.y);
}
constexpr Point operator-(Point other) const noexcept {
return Point(x - other.x, y - other.y);
}
// Other automatically defined methods (assignment, copy constructor, destructor) are fine
};
/**
* A geometric interval class.
*/
class Interval {
public:
XYPOSITION left;
XYPOSITION right;
constexpr bool operator==(const Interval &other) const noexcept {
return (left == other.left) && (right == other.right);
}
constexpr XYPOSITION Width() const noexcept { return right - left; }
constexpr bool Empty() const noexcept {
return Width() <= 0;
}
constexpr bool Intersects(Interval other) const noexcept {
return (right > other.left) && (left < other.right);
}
};
/**
* A geometric rectangle class.
* PRectangle is similar to Win32 RECT.
* PRectangles contain their top and left sides, but not their right and bottom sides.
*/
class PRectangle {
public:
XYPOSITION left;
XYPOSITION top;
XYPOSITION right;
XYPOSITION bottom;
constexpr explicit PRectangle(XYPOSITION left_=0, XYPOSITION top_=0, XYPOSITION right_=0, XYPOSITION bottom_ = 0) noexcept :
left(left_), top(top_), right(right_), bottom(bottom_) {
}
static constexpr PRectangle FromInts(int left_, int top_, int right_, int bottom_) noexcept {
return PRectangle(static_cast<XYPOSITION>(left_), static_cast<XYPOSITION>(top_),
static_cast<XYPOSITION>(right_), static_cast<XYPOSITION>(bottom_));
}
// Other automatically defined methods (assignment, copy constructor, destructor) are fine
constexpr bool operator==(const PRectangle &rc) const noexcept {
return (rc.left == left) && (rc.right == right) &&
(rc.top == top) && (rc.bottom == bottom);
}
constexpr bool Contains(Point pt) const noexcept {
return (pt.x >= left) && (pt.x <= right) &&
(pt.y >= top) && (pt.y <= bottom);
}
constexpr bool ContainsWholePixel(Point pt) const noexcept {
// Does the rectangle contain all of the pixel to left/below the point
return (pt.x >= left) && ((pt.x+1) <= right) &&
(pt.y >= top) && ((pt.y+1) <= bottom);
}
constexpr bool Contains(PRectangle rc) const noexcept {
return (rc.left >= left) && (rc.right <= right) &&
(rc.top >= top) && (rc.bottom <= bottom);
}
constexpr bool Intersects(PRectangle other) const noexcept {
return (right > other.left) && (left < other.right) &&
(bottom > other.top) && (top < other.bottom);
}
void Move(XYPOSITION xDelta, XYPOSITION yDelta) noexcept {
left += xDelta;
top += yDelta;
right += xDelta;
bottom += yDelta;
}
constexpr PRectangle Inset(XYPOSITION delta) const noexcept {
return PRectangle(left + delta, top + delta, right - delta, bottom - delta);
}
constexpr PRectangle Inset(Point delta) const noexcept {
return PRectangle(left + delta.x, top + delta.y, right - delta.x, bottom - delta.y);
}
constexpr Point Centre() const noexcept {
return Point((left + right) / 2, (top + bottom) / 2);
}
constexpr XYPOSITION Width() const noexcept { return right - left; }
constexpr XYPOSITION Height() const noexcept { return bottom - top; }
constexpr bool Empty() const noexcept {
return (Height() <= 0) || (Width() <= 0);
}
};
enum class Edge { left, top, bottom, right };
PRectangle Clamp(PRectangle rc, Edge edge, XYPOSITION position) noexcept;
PRectangle Side(PRectangle rc, Edge edge, XYPOSITION size) noexcept;
Interval Intersection(Interval a, Interval b) noexcept;
PRectangle Intersection(PRectangle rc, Interval horizontalBounds) noexcept;
Interval HorizontalBounds(PRectangle rc) noexcept;
XYPOSITION PixelAlign(XYPOSITION xy, int pixelDivisions) noexcept;
XYPOSITION PixelAlignFloor(XYPOSITION xy, int pixelDivisions) noexcept;
Point PixelAlign(const Point &pt, int pixelDivisions) noexcept;
PRectangle PixelAlign(const PRectangle &rc, int pixelDivisions) noexcept;
PRectangle PixelAlignOutside(const PRectangle &rc, int pixelDivisions) noexcept;
/**
* Holds an RGBA colour with 8 bits for each component.
*/
constexpr const float componentMaximum = 255.0f;
class ColourRGBA {
int co;
constexpr static unsigned int Mixed(unsigned char a, unsigned char b, double proportion) noexcept {
return static_cast<unsigned int>(a + proportion * (b - a));
}
public:
constexpr explicit ColourRGBA(int co_ = 0) noexcept : co(co_) {
}
constexpr ColourRGBA(unsigned int red, unsigned int green, unsigned int blue, unsigned int alpha=0xff) noexcept :
ColourRGBA(red | (green << 8) | (blue << 16) | (alpha << 24)) {
}
constexpr ColourRGBA(ColourRGBA cd, unsigned int alpha) noexcept :
ColourRGBA(cd.OpaqueRGB() | (alpha << 24)) {
}
static constexpr ColourRGBA FromRGB(int co_) noexcept {
return ColourRGBA(co_ | (0xffu << 24));
}
static constexpr ColourRGBA FromIpRGB(intptr_t co_) noexcept {
return ColourRGBA(static_cast<int>(co_) | (0xffu << 24));
}
constexpr ColourRGBA WithoutAlpha() const noexcept {
return ColourRGBA(co & 0xffffff);
}
constexpr ColourRGBA Opaque() const noexcept {
return ColourRGBA(co | (0xffu << 24));
}
constexpr int AsInteger() const noexcept {
return co;
}
constexpr int OpaqueRGB() const noexcept {
return co & 0xffffff;
}
// Red, green and blue values as bytes 0..255
constexpr unsigned char GetRed() const noexcept {
return co & 0xff;
}
constexpr unsigned char GetGreen() const noexcept {
return (co >> 8) & 0xff;
}
constexpr unsigned char GetBlue() const noexcept {
return (co >> 16) & 0xff;
}
constexpr unsigned char GetAlpha() const noexcept {
return (co >> 24) & 0xff;
}
// Red, green, blue, and alpha values as float 0..1.0
constexpr float GetRedComponent() const noexcept {
return GetRed() / componentMaximum;
}
constexpr float GetGreenComponent() const noexcept {
return GetGreen() / componentMaximum;
}
constexpr float GetBlueComponent() const noexcept {
return GetBlue() / componentMaximum;
}
constexpr float GetAlphaComponent() const noexcept {
return GetAlpha() / componentMaximum;
}
constexpr bool operator==(const ColourRGBA &other) const noexcept {
return co == other.co;
}
constexpr bool IsOpaque() const noexcept {
return GetAlpha() == 0xff;
}
constexpr ColourRGBA MixedWith(ColourRGBA other) const noexcept {
const unsigned int red = (GetRed() + other.GetRed()) / 2;
const unsigned int green = (GetGreen() + other.GetGreen()) / 2;
const unsigned int blue = (GetBlue() + other.GetBlue()) / 2;
const unsigned int alpha = (GetAlpha() + other.GetAlpha()) / 2;
return ColourRGBA(red, green, blue, alpha);
}
constexpr ColourRGBA MixedWith(ColourRGBA other, double proportion) const noexcept {
return ColourRGBA(
Mixed(GetRed(), other.GetRed(), proportion),
Mixed(GetGreen(), other.GetGreen(), proportion),
Mixed(GetBlue(), other.GetBlue(), proportion),
Mixed(GetAlpha(), other.GetAlpha(), proportion));
}
};
/**
* Holds an RGBA colour and stroke width to stroke a shape.
*/
class Stroke {
public:
ColourRGBA colour;
XYPOSITION width;
constexpr Stroke(ColourRGBA colour_, XYPOSITION width_=1.0) noexcept :
colour(colour_), width(width_) {
}
constexpr float WidthF() const noexcept {
return static_cast<float>(width);
}
};
/**
* Holds an RGBA colour to fill a shape.
*/
class Fill {
public:
ColourRGBA colour;
constexpr Fill(ColourRGBA colour_) noexcept :
colour(colour_) {
}
};
/**
* Holds a pair of RGBA colours and stroke width to fill and stroke a shape.
*/
class FillStroke {
public:
Fill fill;
Stroke stroke;
constexpr FillStroke(ColourRGBA colourFill_, ColourRGBA colourStroke_, XYPOSITION widthStroke_=1.0) noexcept :
fill(colourFill_), stroke(colourStroke_, widthStroke_) {
}
constexpr FillStroke(ColourRGBA colourBoth, XYPOSITION widthStroke_=1.0) noexcept :
fill(colourBoth), stroke(colourBoth, widthStroke_) {
}
};
/**
* Holds an element of a gradient with an RGBA colour and a relative position.
*/
class ColourStop {
public:
XYPOSITION position;
ColourRGBA colour;
constexpr ColourStop(XYPOSITION position_, ColourRGBA colour_) noexcept :
position(position_), colour(colour_) {
}
};
}
#endif
| 3,072 |
1,676 | #ifndef DATAIO_HOMEDATA_H_
#define DATAIO_HOMEDATA_H_
#include "../core/global.h"
namespace HomeData {
//Returns directory for reading files that may have been installed as defaults to
//command line arguments, in order of preference. May throw StringError if filesystem access fails.
std::vector<std::string> getDefaultFilesDirs();
//A version that doesn't access the file system, intended for help messages, and should never fail.
std::string getDefaultFilesDirForHelpMessage();
//Returns a directory suitable for writing data that KataGo generates automatically, such as auto-tuning data.
//May throw StringError if filesystem access fails.
//If makeDir is true, will attempt to create the directory if it doesn't exist.
//If homeDataDirOverride is nonempty, then just uses homeDataDirOverride.
std::string getHomeDataDir(bool makeDir, const std::string& homeDataDirOverride);
}
#endif //DATAIO_HOMEDATA_H_
| 255 |
1,855 | <reponame>SammyEnigma/NanaZip<filename>SevenZip/CPP/7zip/Compress/ZstdDecoder.h
// (C) 2016 - 2018 <NAME>
#define ZSTD_STATIC_LINKING_ONLY
#include "../../../C/Alloc.h"
#include "../../../C/zstd/zstd.h"
#include "../../../C/zstd/zstd_errors.h"
#include "../../Windows/System.h"
#include "../../Common/Common.h"
#include "../../Common/MyCom.h"
#include "../ICoder.h"
#include "../Common/StreamUtils.h"
#include "../Common/RegisterCodec.h"
#include "../Common/ProgressMt.h"
/**
* possible return values @ 7zip:
* S_OK / S_FALSE
* E_NOTIMPL
* E_NOINTERFACE
* E_ABORT
* E_FAIL
* E_OUTOFMEMORY
* E_INVALIDARG
*/
#define ZSTD_LEVEL_MIN 1
#define ZSTD_LEVEL_MAX 22
#define ZSTD_THREAD_MAX 256
namespace NCompress {
namespace NZSTD {
struct DProps
{
DProps() { clear (); }
void clear ()
{
memset(this, 0, sizeof (*this));
_ver_major = ZSTD_VERSION_MAJOR;
_ver_minor = ZSTD_VERSION_MINOR;
_level = 3;
}
Byte _ver_major;
Byte _ver_minor;
Byte _level;
Byte _reserved[2];
};
class CDecoder:public ICompressCoder,
public ICompressSetDecoderProperties2,
public ICompressSetCoderMt,
public CMyUnknownImp
{
CMyComPtr < ISequentialInStream > _inStream;
DProps _props;
ZSTD_DCtx* _ctx;
void* _srcBuf;
void* _dstBuf;
size_t _srcBufSize;
size_t _dstBufSize;
UInt64 _processedIn;
UInt64 _processedOut;
HRESULT CodeSpec(ISequentialInStream *inStream, ISequentialOutStream *outStream, ICompressProgressInfo *progress);
HRESULT SetOutStreamSizeResume(const UInt64 *outSize);
public:
MY_QUERYINTERFACE_BEGIN2(ICompressCoder)
MY_QUERYINTERFACE_ENTRY(ICompressSetDecoderProperties2)
#ifndef NO_READ_FROM_CODER
MY_QUERYINTERFACE_ENTRY(ICompressSetInStream)
#endif
MY_QUERYINTERFACE_ENTRY(ICompressSetCoderMt)
MY_QUERYINTERFACE_END
MY_ADDREF_RELEASE
STDMETHOD (Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
STDMETHOD (SetDecoderProperties2)(const Byte *data, UInt32 size);
STDMETHOD (SetOutStreamSize)(const UInt64 *outSize);
STDMETHOD (SetNumberOfThreads)(UInt32 numThreads);
#ifndef NO_READ_FROM_CODER
STDMETHOD (SetInStream)(ISequentialInStream *inStream);
STDMETHOD (ReleaseInStream)();
UInt64 GetInputProcessedSize() const { return _processedIn; }
#endif
HRESULT CodeResume(ISequentialOutStream *outStream, const UInt64 *outSize, ICompressProgressInfo *progress);
CDecoder();
virtual ~CDecoder();
};
}}
| 1,007 |
852 | /**
Translates a Ecal record to XML
\version $Id: EcalDAQStripStatusXMLTranslator.h,v 1.1 2011/06/14 fay Exp $
\date 14 Jun 2011
*/
#ifndef __EcalTPGStripStatusXMLTranslator_h_
#define __EcalTPGStripStatusXMLTranslator_h_
#include "CondFormats/EcalObjects/interface/EcalTPGStripStatus.h"
#include "CondTools/Ecal/interface/EcalCondHeader.h"
#include <string>
class EcalTPGStripStatusXMLTranslator {
public:
static int readXML(const std::string& filename, EcalCondHeader& header, EcalTPGStripStatus& record);
static int writeXML(const std::string& filename, const EcalCondHeader& header, const EcalTPGStripStatus& record);
private:
static std::string dumpXML(const EcalCondHeader& header, const EcalTPGStripStatus& record);
};
#endif // __EcalTPGStripStatusXMLTranslator_h_
| 288 |
460 | <reponame>juandesant/astrometry.net<gh_stars>100-1000
# Script for automatically downloading UCAC4 catalogue
# Last revision: Jan 08, 2015
# Author: <NAME>, <EMAIL>
# This file is part of the Astrometry.net suite.
# Copyright 2014 <NAME>.
# The Astrometry.net suite is free software; you can redistribute
# it and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, version 2.
# The Astrometry.net suite is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with the Astrometry.net suite ; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
from __future__ import print_function
# Start dectination (in degrees, e.g. +50.0)
start_dec = +90.0
# End declination (in degrees, e.g. -30.0)
end_dec = -90.0
try:
from urllib.request import URLopener
except ImportError:
from urllib import URLopener
import os
from shutil import copyfileobj
import bz2
# Retry failed downloads (how many times?)
No_retries = 5
# The URL prefix to the FTP repository
prefix = 'http://cdsarc.u-strasbg.fr/viz-bin/ftp-index?/ftp/cats/aliases/U/UCAC4/UCAC4/u4b/'
def Convert_Dec_to_Znum(start_dec, end_dec):
""" Convert declination range to UCAC4 file number range. """
z_file_constatnt = 180.0/900
if start_dec < end_dec:
temp = start_dec
start_dec = end_dec
end_dec = start_dec
if start_dec > +90.0:
start_dec = +90.0
if end_dec < -90.0:
end_dec = -90.0
start_z = int(-(start_dec-90)/z_file_constatnt) + 1
end_z = int(-(end_dec-90)/z_file_constatnt)
return start_z, end_z
def Download_File(name):
""" Download UCAC4 file. """
url_name = prefix+name
ucac_file = URLopener()
ucac_file.retrieve(url_name, name)
inp = open(name, 'rb')
bz2_file = bz2.BZ2File(name+'.bz2', 'wb', compresslevel=1)
copyfileobj(inp, bz2_file)
inp.close()
bz2_file.close()
os.remove(name)
return 0
start_z, end_z = Convert_Dec_to_Znum(start_dec, end_dec)
# Downloading the catalogue
fail_list = []
successes = 0
for i in range(start_z, end_z+1):
name = 'z'+str(i).zfill(3)
print('Downloading: '+name)
try:
Download_File(name)
successes += 1
except:
fail_list.append(name)
print('ERROR downloading file: ', name)
# Retry failed downloads
for i in range(No_retries):
for name in fail_list:
print('Retrying:', name)
try:
Download_File(name)
successes += 1
fail_list.pop(fail_list.index(name))
except:
print('Will retry', name, 'again...')
if len(fail_list) == 0:
print('SUCCESS! All files downloaded successfully!')
elif successes > 0:
print('WARNING! PARTIAL SUCCESS:')
print(successes, 'files downloaded successfully,', len(fail_list), 'failed!')
print('These files were NOT downloaded:', fail_list)
else:
print('ERROR! ALL FILES FAILED TO DOWNLOAD!')
print('Check your internet connection or try downloading later...')
| 1,286 |
1,845 | <gh_stars>1000+
package org.rajawali3d.examples.examples.materials;
import android.content.Context;
import androidx.annotation.Nullable;
import org.rajawali3d.Object3D;
import org.rajawali3d.examples.R;
import org.rajawali3d.examples.examples.AExampleFragment;
import org.rajawali3d.examples.examples.materials.materials.CustomRawFragmentShader;
import org.rajawali3d.examples.examples.materials.materials.CustomRawVertexShader;
import org.rajawali3d.lights.DirectionalLight;
import org.rajawali3d.materials.Material;
import org.rajawali3d.materials.textures.ATexture;
import org.rajawali3d.materials.textures.Texture;
import org.rajawali3d.primitives.Sphere;
public class RawShaderFilesFragment extends AExampleFragment {
@Override
public AExampleRenderer createRenderer() {
return new RawShaderFilesRenderer(getActivity(), this);
}
public class RawShaderFilesRenderer extends AExampleRenderer {
private DirectionalLight mLight;
private Object3D mCube;
private float mTime;
private Material mMaterial;
public RawShaderFilesRenderer(Context context, @Nullable AExampleFragment fragment) {
super(context, fragment);
}
@Override
protected void initScene() {
mLight = new DirectionalLight(0, 1, 1);
getCurrentScene().addLight(mLight);
mMaterial = new Material(new CustomRawVertexShader(), new CustomRawFragmentShader());
mMaterial.enableTime(true);
try {
Texture texture = new Texture("myTex", R.drawable.flickrpics);
texture.setInfluence(.5f);
mMaterial.addTexture(texture);
} catch (ATexture.TextureException e) {
e.printStackTrace();
}
mMaterial.setColorInfluence(.5f);
mCube = new Sphere(2, 64, 64);
mCube.setMaterial(mMaterial);
getCurrentScene().addChild(mCube);
getCurrentCamera().setPosition(0, 0, 10);
mTime = 0;
}
@Override
protected void onRender(long elapsedRealtime, double deltaTime) {
super.onRender(elapsedRealtime, deltaTime);
mTime += .007f;
mMaterial.setTime(mTime);
}
}
}
| 762 |
2,996 | <gh_stars>1000+
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
package org.terasology.engine.world.block;
import gnu.trove.list.TIntList;
import org.terasology.engine.world.BlockEntityRegistry;
/**
* This event informs of the activation of a group of blocks. It is sent against the BlockTypeEntity of the type of block
* being activated, with the positions of those blocks.
*
*/
public class OnActivatedBlocks extends BlockLifecycleEvent {
public OnActivatedBlocks(TIntList positions, BlockEntityRegistry registry) {
super(positions, registry);
}
}
| 182 |
460 | /****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (<EMAIL>)
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QAHISCREEN_H
#define QAHISCREEN_H
#include <QtGui/qscreenlinuxfb_qws.h>
#ifndef QT_NO_QWS_AHI
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
class QAhiScreenPrivate;
class QAhiScreen : public QScreen
{
public:
QAhiScreen(int displayId);
~QAhiScreen();
bool connect(const QString &displaySpec);
void disconnect();
bool initDevice();
void shutdownDevice();
void setMode(int width, int height, int depth);
void blit(const QImage &image, const QPoint &topLeft,
const QRegion ®ion);
void solidFill(const QColor &color, const QRegion ®ion);
private:
bool configure();
QAhiScreenPrivate *d_ptr;
};
QT_END_NAMESPACE
QT_END_HEADER
#endif // QT_NO_QWS_AHI
#endif // QAHISCREEN_H
| 828 |
2,338 | //===-- llvm/BinaryFormat/XCOFF.cpp - The XCOFF file format -----*- C++/-*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "llvm/BinaryFormat/XCOFF.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/Error.h"
using namespace llvm;
#define SMC_CASE(A) \
case XCOFF::XMC_##A: \
return #A;
StringRef XCOFF::getMappingClassString(XCOFF::StorageMappingClass SMC) {
switch (SMC) {
SMC_CASE(PR)
SMC_CASE(RO)
SMC_CASE(DB)
SMC_CASE(GL)
SMC_CASE(XO)
SMC_CASE(SV)
SMC_CASE(SV64)
SMC_CASE(SV3264)
SMC_CASE(TI)
SMC_CASE(TB)
SMC_CASE(RW)
SMC_CASE(TC0)
SMC_CASE(TC)
SMC_CASE(TD)
SMC_CASE(DS)
SMC_CASE(UA)
SMC_CASE(BS)
SMC_CASE(UC)
SMC_CASE(TL)
SMC_CASE(UL)
SMC_CASE(TE)
#undef SMC_CASE
}
// TODO: need to add a test case for "Unknown" and other SMC.
return "Unknown";
}
#define RELOC_CASE(A) \
case XCOFF::A: \
return #A;
StringRef XCOFF::getRelocationTypeString(XCOFF::RelocationType Type) {
switch (Type) {
RELOC_CASE(R_POS)
RELOC_CASE(R_RL)
RELOC_CASE(R_RLA)
RELOC_CASE(R_NEG)
RELOC_CASE(R_REL)
RELOC_CASE(R_TOC)
RELOC_CASE(R_TRL)
RELOC_CASE(R_TRLA)
RELOC_CASE(R_GL)
RELOC_CASE(R_TCL)
RELOC_CASE(R_REF)
RELOC_CASE(R_BA)
RELOC_CASE(R_BR)
RELOC_CASE(R_RBA)
RELOC_CASE(R_RBR)
RELOC_CASE(R_TLS)
RELOC_CASE(R_TLS_IE)
RELOC_CASE(R_TLS_LD)
RELOC_CASE(R_TLS_LE)
RELOC_CASE(R_TLSM)
RELOC_CASE(R_TLSML)
RELOC_CASE(R_TOCU)
RELOC_CASE(R_TOCL)
}
return "Unknown";
}
#undef RELOC_CASE
#define LANG_CASE(A) \
case XCOFF::TracebackTable::A: \
return #A;
StringRef XCOFF::getNameForTracebackTableLanguageId(
XCOFF::TracebackTable::LanguageID LangId) {
switch (LangId) {
LANG_CASE(C)
LANG_CASE(Fortran)
LANG_CASE(Pascal)
LANG_CASE(Ada)
LANG_CASE(PL1)
LANG_CASE(Basic)
LANG_CASE(Lisp)
LANG_CASE(Cobol)
LANG_CASE(Modula2)
LANG_CASE(Rpg)
LANG_CASE(PL8)
LANG_CASE(Assembly)
LANG_CASE(Java)
LANG_CASE(ObjectiveC)
LANG_CASE(CPlusPlus)
}
return "Unknown";
}
#undef LANG_CASE
Expected<SmallString<32>> XCOFF::parseParmsType(uint32_t Value,
unsigned FixedParmsNum,
unsigned FloatingParmsNum) {
SmallString<32> ParmsType;
int Bits = 0;
unsigned ParsedFixedNum = 0;
unsigned ParsedFloatingNum = 0;
unsigned ParsedNum = 0;
unsigned ParmsNum = FixedParmsNum + FloatingParmsNum;
// In the function PPCFunctionInfo::getParmsType(), when there are no vector
// parameters, the 31st bit of ParmsType is always zero even if it indicates a
// floating point parameter. The parameter type information is lost. There
// are only 8 GPRs used for parameters passing, the floating parameters
// also occupy GPRs if there are available, so the 31st bit can never be a
// fixed parameter. At the same time, we also do not know whether the zero of
// the 31st bit indicates a float or double parameter type here. Therefore, we
// ignore the 31st bit.
while (Bits < 31 && ParsedNum < ParmsNum) {
if (++ParsedNum > 1)
ParmsType += ", ";
if ((Value & TracebackTable::ParmTypeIsFloatingBit) == 0) {
// Fixed parameter type.
ParmsType += "i";
++ParsedFixedNum;
Value <<= 1;
++Bits;
} else {
if ((Value & TracebackTable::ParmTypeFloatingIsDoubleBit) == 0)
// Float parameter type.
ParmsType += "f";
else
// Double parameter type.
ParmsType += "d";
++ParsedFloatingNum;
Value <<= 2;
Bits += 2;
}
}
// We have more parameters than the 32 Bits could encode.
if (ParsedNum < ParmsNum)
ParmsType += ", ...";
if (Value != 0u || ParsedFixedNum > FixedParmsNum ||
ParsedFloatingNum > FloatingParmsNum)
return createStringError(errc::invalid_argument,
"ParmsType encodes can not map to ParmsNum "
"parameters in parseParmsType.");
return ParmsType;
}
SmallString<32> XCOFF::getExtendedTBTableFlagString(uint8_t Flag) {
SmallString<32> Res;
if (Flag & ExtendedTBTableFlag::TB_OS1)
Res += "TB_OS1 ";
if (Flag & ExtendedTBTableFlag::TB_RESERVED)
Res += "TB_RESERVED ";
if (Flag & ExtendedTBTableFlag::TB_SSP_CANARY)
Res += "TB_SSP_CANARY ";
if (Flag & ExtendedTBTableFlag::TB_OS2)
Res += "TB_OS2 ";
if (Flag & ExtendedTBTableFlag::TB_EH_INFO)
Res += "TB_EH_INFO ";
if (Flag & ExtendedTBTableFlag::TB_LONGTBTABLE2)
Res += "TB_LONGTBTABLE2 ";
// Two of the bits that haven't got used in the mask.
if (Flag & 0x06)
Res += "Unknown ";
// Pop the last space.
Res.pop_back();
return Res;
}
Expected<SmallString<32>>
XCOFF::parseParmsTypeWithVecInfo(uint32_t Value, unsigned FixedParmsNum,
unsigned FloatingParmsNum,
unsigned VectorParmsNum) {
SmallString<32> ParmsType;
unsigned ParsedFixedNum = 0;
unsigned ParsedFloatingNum = 0;
unsigned ParsedVectorNum = 0;
unsigned ParsedNum = 0;
unsigned ParmsNum = FixedParmsNum + FloatingParmsNum + VectorParmsNum;
for (int Bits = 0; Bits < 32 && ParsedNum < ParmsNum; Bits += 2) {
if (++ParsedNum > 1)
ParmsType += ", ";
switch (Value & TracebackTable::ParmTypeMask) {
case TracebackTable::ParmTypeIsFixedBits:
ParmsType += "i";
++ParsedFixedNum;
break;
case TracebackTable::ParmTypeIsVectorBits:
ParmsType += "v";
++ParsedVectorNum;
break;
case TracebackTable::ParmTypeIsFloatingBits:
ParmsType += "f";
++ParsedFloatingNum;
break;
case TracebackTable::ParmTypeIsDoubleBits:
ParmsType += "d";
++ParsedFloatingNum;
break;
default:
assert(false && "Unrecognized bits in ParmsType.");
}
Value <<= 2;
}
// We have more parameters than the 32 Bits could encode.
if (ParsedNum < ParmsNum)
ParmsType += ", ...";
if (Value != 0u || ParsedFixedNum > FixedParmsNum ||
ParsedFloatingNum > FloatingParmsNum || ParsedVectorNum > VectorParmsNum)
return createStringError(
errc::invalid_argument,
"ParmsType encodes can not map to ParmsNum parameters "
"in parseParmsTypeWithVecInfo.");
return ParmsType;
}
Expected<SmallString<32>> XCOFF::parseVectorParmsType(uint32_t Value,
unsigned ParmsNum) {
SmallString<32> ParmsType;
unsigned ParsedNum = 0;
for (int Bits = 0; ParsedNum < ParmsNum && Bits < 32; Bits += 2) {
if (++ParsedNum > 1)
ParmsType += ", ";
switch (Value & TracebackTable::ParmTypeMask) {
case TracebackTable::ParmTypeIsVectorCharBit:
ParmsType += "vc";
break;
case TracebackTable::ParmTypeIsVectorShortBit:
ParmsType += "vs";
break;
case TracebackTable::ParmTypeIsVectorIntBit:
ParmsType += "vi";
break;
case TracebackTable::ParmTypeIsVectorFloatBit:
ParmsType += "vf";
break;
}
Value <<= 2;
}
// We have more parameters than the 32 Bits could encode.
if (ParsedNum < ParmsNum)
ParmsType += ", ...";
if (Value != 0u)
return createStringError(errc::invalid_argument,
"ParmsType encodes more than ParmsNum parameters "
"in parseVectorParmsType.");
return ParmsType;
}
| 3,870 |
5,169 | {
"name": "SocialSDK_R",
"version": "0.0.5",
"summary": "SocialSDK_R SDK for iOS",
"homepage": "https://github.com/GagSquad/SocialSDK",
"authors": {
"<EMAIL>": "https://github.com/itlijunjie",
"LVJIALIN": "https://github.com/LVJIALIN"
},
"license": {
"type": "WTFPL",
"file": "LICENSE"
},
"platforms": {
"ios": "8.0"
},
"source": {
"git": "https://github.com/GagSquad/SocialSDK.git",
"tag": "0.0.5"
},
"requires_arc": true,
"default_subspecs": [
"WeiboSDK_R",
"SocialSDK_R"
],
"subspecs": [
{
"name": "WeiboSDK_R",
"resources": "SDK/libWeiboSDK/WeiboSDK.bundle"
},
{
"name": "SocialSDK_R",
"resources": "SocialSDK/Rrources/GSSocialSDKResources.bundle"
}
]
}
| 386 |
605 | import os
from clang.cindex import Config
if 'CLANG_LIBRARY_PATH' in os.environ:
Config.set_library_path(os.environ['CLANG_LIBRARY_PATH'])
import gc
import unittest
from clang.cindex import CursorKind
from clang.cindex import TranslationUnit
from clang.cindex import TypeKind
from .util import get_cursor
from .util import get_tu
kInput = """\
typedef int I;
struct teststruct {
int a;
I b;
long c;
unsigned long d;
signed long e;
const int f;
int *g;
int ***h;
};
"""
constarrayInput="""
struct teststruct {
void *A[2];
};
"""
class TestType(unittest.TestCase):
def test_a_struct(self):
tu = get_tu(kInput)
teststruct = get_cursor(tu, 'teststruct')
self.assertIsNotNone(teststruct, "Could not find teststruct.")
fields = list(teststruct.get_children())
self.assertEqual(fields[0].kind, CursorKind.FIELD_DECL)
self.assertIsNotNone(fields[0].translation_unit)
self.assertEqual(fields[0].spelling, 'a')
self.assertFalse(fields[0].type.is_const_qualified())
self.assertEqual(fields[0].type.kind, TypeKind.INT)
self.assertEqual(fields[0].type.get_canonical().kind, TypeKind.INT)
self.assertEqual(fields[0].type.get_typedef_name(), '')
self.assertEqual(fields[1].kind, CursorKind.FIELD_DECL)
self.assertIsNotNone(fields[1].translation_unit)
self.assertEqual(fields[1].spelling, 'b')
self.assertFalse(fields[1].type.is_const_qualified())
self.assertEqual(fields[1].type.kind, TypeKind.TYPEDEF)
self.assertEqual(fields[1].type.get_canonical().kind, TypeKind.INT)
self.assertEqual(fields[1].type.get_declaration().spelling, 'I')
self.assertEqual(fields[1].type.get_typedef_name(), 'I')
self.assertEqual(fields[2].kind, CursorKind.FIELD_DECL)
self.assertIsNotNone(fields[2].translation_unit)
self.assertEqual(fields[2].spelling, 'c')
self.assertFalse(fields[2].type.is_const_qualified())
self.assertEqual(fields[2].type.kind, TypeKind.LONG)
self.assertEqual(fields[2].type.get_canonical().kind, TypeKind.LONG)
self.assertEqual(fields[2].type.get_typedef_name(), '')
self.assertEqual(fields[3].kind, CursorKind.FIELD_DECL)
self.assertIsNotNone(fields[3].translation_unit)
self.assertEqual(fields[3].spelling, 'd')
self.assertFalse(fields[3].type.is_const_qualified())
self.assertEqual(fields[3].type.kind, TypeKind.ULONG)
self.assertEqual(fields[3].type.get_canonical().kind, TypeKind.ULONG)
self.assertEqual(fields[3].type.get_typedef_name(), '')
self.assertEqual(fields[4].kind, CursorKind.FIELD_DECL)
self.assertIsNotNone(fields[4].translation_unit)
self.assertEqual(fields[4].spelling, 'e')
self.assertFalse(fields[4].type.is_const_qualified())
self.assertEqual(fields[4].type.kind, TypeKind.LONG)
self.assertEqual(fields[4].type.get_canonical().kind, TypeKind.LONG)
self.assertEqual(fields[4].type.get_typedef_name(), '')
self.assertEqual(fields[5].kind, CursorKind.FIELD_DECL)
self.assertIsNotNone(fields[5].translation_unit)
self.assertEqual(fields[5].spelling, 'f')
self.assertTrue(fields[5].type.is_const_qualified())
self.assertEqual(fields[5].type.kind, TypeKind.INT)
self.assertEqual(fields[5].type.get_canonical().kind, TypeKind.INT)
self.assertEqual(fields[5].type.get_typedef_name(), '')
self.assertEqual(fields[6].kind, CursorKind.FIELD_DECL)
self.assertIsNotNone(fields[6].translation_unit)
self.assertEqual(fields[6].spelling, 'g')
self.assertFalse(fields[6].type.is_const_qualified())
self.assertEqual(fields[6].type.kind, TypeKind.POINTER)
self.assertEqual(fields[6].type.get_pointee().kind, TypeKind.INT)
self.assertEqual(fields[6].type.get_typedef_name(), '')
self.assertEqual(fields[7].kind, CursorKind.FIELD_DECL)
self.assertIsNotNone(fields[7].translation_unit)
self.assertEqual(fields[7].spelling, 'h')
self.assertFalse(fields[7].type.is_const_qualified())
self.assertEqual(fields[7].type.kind, TypeKind.POINTER)
self.assertEqual(fields[7].type.get_pointee().kind, TypeKind.POINTER)
self.assertEqual(fields[7].type.get_pointee().get_pointee().kind, TypeKind.POINTER)
self.assertEqual(fields[7].type.get_pointee().get_pointee().get_pointee().kind, TypeKind.INT)
self.assertEqual(fields[7].type.get_typedef_name(), '')
def test_references(self):
"""Ensure that a Type maintains a reference to a TranslationUnit."""
tu = get_tu('int x;')
children = list(tu.cursor.get_children())
self.assertGreater(len(children), 0)
cursor = children[0]
t = cursor.type
self.assertIsInstance(t.translation_unit, TranslationUnit)
# Delete main TranslationUnit reference and force a GC.
del tu
gc.collect()
self.assertIsInstance(t.translation_unit, TranslationUnit)
# If the TU was destroyed, this should cause a segfault.
decl = t.get_declaration()
def testConstantArray(self):
tu = get_tu(constarrayInput)
teststruct = get_cursor(tu, 'teststruct')
self.assertIsNotNone(teststruct, "Didn't find teststruct??")
fields = list(teststruct.get_children())
self.assertEqual(fields[0].spelling, 'A')
self.assertEqual(fields[0].type.kind, TypeKind.CONSTANTARRAY)
self.assertIsNotNone(fields[0].type.get_array_element_type())
self.assertEqual(fields[0].type.get_array_element_type().kind, TypeKind.POINTER)
self.assertEqual(fields[0].type.get_array_size(), 2)
def test_equal(self):
"""Ensure equivalence operators work on Type."""
source = 'int a; int b; void *v;'
tu = get_tu(source)
a = get_cursor(tu, 'a')
b = get_cursor(tu, 'b')
v = get_cursor(tu, 'v')
self.assertIsNotNone(a)
self.assertIsNotNone(b)
self.assertIsNotNone(v)
self.assertEqual(a.type, b.type)
self.assertNotEqual(a.type, v.type)
self.assertNotEqual(a.type, None)
self.assertNotEqual(a.type, 'foo')
def test_type_spelling(self):
"""Ensure Type.spelling works."""
tu = get_tu('int c[5]; void f(int i[]); int x; int v[x];')
c = get_cursor(tu, 'c')
i = get_cursor(tu, 'i')
x = get_cursor(tu, 'x')
v = get_cursor(tu, 'v')
self.assertIsNotNone(c)
self.assertIsNotNone(i)
self.assertIsNotNone(x)
self.assertIsNotNone(v)
self.assertEqual(c.type.spelling, "int[5]")
self.assertEqual(i.type.spelling, "int[]")
self.assertEqual(x.type.spelling, "int")
self.assertEqual(v.type.spelling, "int[x]")
def test_typekind_spelling(self):
"""Ensure TypeKind.spelling works."""
tu = get_tu('int a;')
a = get_cursor(tu, 'a')
self.assertIsNotNone(a)
self.assertEqual(a.type.kind.spelling, 'Int')
def test_function_argument_types(self):
"""Ensure that Type.argument_types() works as expected."""
tu = get_tu('void f(int, int);')
f = get_cursor(tu, 'f')
self.assertIsNotNone(f)
args = f.type.argument_types()
self.assertIsNotNone(args)
self.assertEqual(len(args), 2)
t0 = args[0]
self.assertIsNotNone(t0)
self.assertEqual(t0.kind, TypeKind.INT)
t1 = args[1]
self.assertIsNotNone(t1)
self.assertEqual(t1.kind, TypeKind.INT)
args2 = list(args)
self.assertEqual(len(args2), 2)
self.assertEqual(t0, args2[0])
self.assertEqual(t1, args2[1])
def test_argument_types_string_key(self):
"""Ensure that non-int keys raise a TypeError."""
tu = get_tu('void f(int, int);')
f = get_cursor(tu, 'f')
self.assertIsNotNone(f)
args = f.type.argument_types()
self.assertEqual(len(args), 2)
with self.assertRaises(TypeError):
args['foo']
def test_argument_types_negative_index(self):
"""Ensure that negative indexes on argument_types Raises an IndexError."""
tu = get_tu('void f(int, int);')
f = get_cursor(tu, 'f')
args = f.type.argument_types()
with self.assertRaises(IndexError):
args[-1]
def test_argument_types_overflow_index(self):
"""Ensure that indexes beyond the length of Type.argument_types() raise."""
tu = get_tu('void f(int, int);')
f = get_cursor(tu, 'f')
args = f.type.argument_types()
with self.assertRaises(IndexError):
args[2]
def test_argument_types_invalid_type(self):
"""Ensure that obtaining argument_types on a Type without them raises."""
tu = get_tu('int i;')
i = get_cursor(tu, 'i')
self.assertIsNotNone(i)
with self.assertRaises(Exception):
i.type.argument_types()
def test_is_pod(self):
"""Ensure Type.is_pod() works."""
tu = get_tu('int i; void f();')
i = get_cursor(tu, 'i')
f = get_cursor(tu, 'f')
self.assertIsNotNone(i)
self.assertIsNotNone(f)
self.assertTrue(i.type.is_pod())
self.assertFalse(f.type.is_pod())
def test_function_variadic(self):
"""Ensure Type.is_function_variadic works."""
source ="""
#include <stdarg.h>
void foo(int a, ...);
void bar(int a, int b);
"""
tu = get_tu(source)
foo = get_cursor(tu, 'foo')
bar = get_cursor(tu, 'bar')
self.assertIsNotNone(foo)
self.assertIsNotNone(bar)
self.assertIsInstance(foo.type.is_function_variadic(), bool)
self.assertTrue(foo.type.is_function_variadic())
self.assertFalse(bar.type.is_function_variadic())
def test_element_type(self):
"""Ensure Type.element_type works."""
tu = get_tu('int c[5]; void f(int i[]); int x; int v[x];')
c = get_cursor(tu, 'c')
i = get_cursor(tu, 'i')
v = get_cursor(tu, 'v')
self.assertIsNotNone(c)
self.assertIsNotNone(i)
self.assertIsNotNone(v)
self.assertEqual(c.type.kind, TypeKind.CONSTANTARRAY)
self.assertEqual(c.type.element_type.kind, TypeKind.INT)
self.assertEqual(i.type.kind, TypeKind.INCOMPLETEARRAY)
self.assertEqual(i.type.element_type.kind, TypeKind.INT)
self.assertEqual(v.type.kind, TypeKind.VARIABLEARRAY)
self.assertEqual(v.type.element_type.kind, TypeKind.INT)
def test_invalid_element_type(self):
"""Ensure Type.element_type raises if type doesn't have elements."""
tu = get_tu('int i;')
i = get_cursor(tu, 'i')
self.assertIsNotNone(i)
with self.assertRaises(Exception):
i.element_type
def test_element_count(self):
"""Ensure Type.element_count works."""
tu = get_tu('int i[5]; int j;')
i = get_cursor(tu, 'i')
j = get_cursor(tu, 'j')
self.assertIsNotNone(i)
self.assertIsNotNone(j)
self.assertEqual(i.type.element_count, 5)
with self.assertRaises(Exception):
j.type.element_count
def test_is_volatile_qualified(self):
"""Ensure Type.is_volatile_qualified works."""
tu = get_tu('volatile int i = 4; int j = 2;')
i = get_cursor(tu, 'i')
j = get_cursor(tu, 'j')
self.assertIsNotNone(i)
self.assertIsNotNone(j)
self.assertIsInstance(i.type.is_volatile_qualified(), bool)
self.assertTrue(i.type.is_volatile_qualified())
self.assertFalse(j.type.is_volatile_qualified())
def test_is_restrict_qualified(self):
"""Ensure Type.is_restrict_qualified works."""
tu = get_tu('struct s { void * restrict i; void * j; };')
i = get_cursor(tu, 'i')
j = get_cursor(tu, 'j')
self.assertIsNotNone(i)
self.assertIsNotNone(j)
self.assertIsInstance(i.type.is_restrict_qualified(), bool)
self.assertTrue(i.type.is_restrict_qualified())
self.assertFalse(j.type.is_restrict_qualified())
def test_record_layout(self):
"""Ensure Cursor.type.get_size, Cursor.type.get_align and
Cursor.type.get_offset works."""
source ="""
struct a {
long a1;
long a2:3;
long a3:4;
long long a4;
};
"""
tries=[(['-target','i386-linux-gnu'],(4,16,0,32,35,64)),
(['-target','nvptx64-unknown-unknown'],(8,24,0,64,67,128)),
(['-target','i386-pc-win32'],(8,16,0,32,35,64)),
(['-target','msp430-none-none'],(2,14,0,32,35,48))]
for flags, values in tries:
align,total,a1,a2,a3,a4 = values
tu = get_tu(source, flags=flags)
teststruct = get_cursor(tu, 'a')
fields = list(teststruct.get_children())
self.assertEqual(teststruct.type.get_align(), align)
self.assertEqual(teststruct.type.get_size(), total)
self.assertEqual(teststruct.type.get_offset(fields[0].spelling), a1)
self.assertEqual(teststruct.type.get_offset(fields[1].spelling), a2)
self.assertEqual(teststruct.type.get_offset(fields[2].spelling), a3)
self.assertEqual(teststruct.type.get_offset(fields[3].spelling), a4)
self.assertEqual(fields[0].is_bitfield(), False)
self.assertEqual(fields[1].is_bitfield(), True)
self.assertEqual(fields[1].get_bitfield_width(), 3)
self.assertEqual(fields[2].is_bitfield(), True)
self.assertEqual(fields[2].get_bitfield_width(), 4)
self.assertEqual(fields[3].is_bitfield(), False)
def test_offset(self):
"""Ensure Cursor.get_record_field_offset works in anonymous records"""
source="""
struct Test {
struct {int a;} typeanon;
struct {
int bariton;
union {
int foo;
};
};
int bar;
};"""
tries=[(['-target','i386-linux-gnu'],(4,16,0,32,64,96)),
(['-target','nvptx64-unknown-unknown'],(8,24,0,32,64,96)),
(['-target','i386-pc-win32'],(8,16,0,32,64,96)),
(['-target','msp430-none-none'],(2,14,0,32,64,96))]
for flags, values in tries:
align,total,f1,bariton,foo,bar = values
tu = get_tu(source)
teststruct = get_cursor(tu, 'Test')
children = list(teststruct.get_children())
fields = list(teststruct.type.get_fields())
self.assertEqual(children[0].kind, CursorKind.STRUCT_DECL)
self.assertNotEqual(children[0].spelling, "typeanon")
self.assertEqual(children[1].spelling, "typeanon")
self.assertEqual(fields[0].kind, CursorKind.FIELD_DECL)
self.assertEqual(fields[1].kind, CursorKind.FIELD_DECL)
self.assertTrue(fields[1].is_anonymous())
self.assertEqual(teststruct.type.get_offset("typeanon"), f1)
self.assertEqual(teststruct.type.get_offset("bariton"), bariton)
self.assertEqual(teststruct.type.get_offset("foo"), foo)
self.assertEqual(teststruct.type.get_offset("bar"), bar)
def test_decay(self):
"""Ensure decayed types are handled as the original type"""
tu = get_tu("void foo(int a[]);")
foo = get_cursor(tu, 'foo')
a = foo.type.argument_types()[0]
self.assertEqual(a.kind, TypeKind.INCOMPLETEARRAY)
self.assertEqual(a.element_type.kind, TypeKind.INT)
self.assertEqual(a.get_canonical().kind, TypeKind.INCOMPLETEARRAY)
def test_addrspace(self):
"""Ensure the address space can be queried"""
tu = get_tu('__attribute__((address_space(2))) int testInteger = 3;', 'c')
testInteger = get_cursor(tu, 'testInteger')
self.assertIsNotNone(testInteger, "Could not find testInteger.")
self.assertEqual(testInteger.type.get_address_space(), 2)
def test_template_arguments(self):
source = """
class Foo {
};
template <typename T>
class Template {
};
Template<Foo> instance;
int bar;
"""
tu = get_tu(source, lang='cpp')
# Varible with a template argument.
cursor = get_cursor(tu, 'instance')
cursor_type = cursor.type
self.assertEqual(cursor.kind, CursorKind.VAR_DECL)
self.assertEqual(cursor_type.spelling, 'Template<Foo>')
self.assertEqual(cursor_type.get_num_template_arguments(), 1)
template_type = cursor_type.get_template_argument_type(0)
self.assertEqual(template_type.spelling, 'Foo')
# Variable without a template argument.
cursor = get_cursor(tu, 'bar')
self.assertEqual(cursor.get_num_template_arguments(), -1)
| 7,881 |
687 | <reponame>felixzhuologist/xls
// Copyright 2021 The XLS Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef XLS_EXAMPLES_JPEG_CONSTANTS_H_
#define XLS_EXAMPLES_JPEG_CONSTANTS_H_
#include <array>
#include <cstdint>
namespace xls::jpeg {
// An "MCU" is a "Minimum Coded Unit" which is an 8x8 grid of values.
constexpr int kMcuHeight = 8;
constexpr int kMcuWidth = 8;
constexpr int kCoeffPerMcu = kMcuHeight * kMcuWidth;
// The JPEG byte stream has "markers" that delimit the sections of the JPEG
// (first metadata, then scan data). This all-bits-set byte is an escape that
// notes that a marker identifier bytes (indicating what kind of section we're
// decoding, e.g. kSof0Marker perhaps) will come next.
constexpr uint8_t kMarkerStart = 0xff;
// JPEG markers defined in the specification, see
// https://www.w3.org/Graphics/JPEG/ -- for more details see the spec document.
constexpr uint8_t kSof0Marker = 0xc0; // Start of Frame (Baseline DCT)
constexpr uint8_t kDhtMarker = 0xc4; // Define Huffman Table(s)
constexpr uint8_t kSoiMarker = 0xd8; // Start of Image
constexpr uint8_t kEoiMarker = 0xd9; // End of Image
constexpr uint8_t kSosMarker = 0xda; // Start of Scan
constexpr uint8_t kDqtMarker = 0xdb; // Define Quantization Table(s)
constexpr uint8_t kApp0Marker = 0xe0; // "Application 0" (JFIF image metadata)
constexpr uint8_t kComMarker = 0xfe; // Comment
constexpr uint8_t kChrominanceZero = 128; // See internal::ToRgb().
// The prefix codes in the stream can be at most 16 bits long.
constexpr uint8_t kHuffmanCodeSizeLimit = 16;
// The number of bits that we need to pop after a given prefix code does not
// exceed 11 bits. Technically there's encoding room in the DHT data for up to
// 15 bits, but the values encoded in the stream can't exceed 1024, so 11 bits
// is the max we'll observe.
constexpr uint8_t kBitsToPopLimit = 11;
// Currently we only support 3 color comonents, since we assume YCbCr.
constexpr uint8_t kColorLimit = 3;
// When the image uses three color components (without downsampling) this is the
// order in which MCU components are interleaved in the stream.
constexpr uint8_t kYIndex = 0;
constexpr uint8_t kCbIndex = 1;
constexpr uint8_t kCrIndex = 2;
// Coefficients are encoded in the scan data in an order that should maximimize
// compression in frequency space; that is, the highest frequency components
// should come at the end of the block so that we can easily squash them to zero
// and say "end of block" as early as possible.
//
// This "zig zag map" indicates where coefficient values (decoded from the
// stream) scatter before performing an IDCT. That is, as we scan coefficients
// in the stream:
//
// frequency_data[kZigZagMap[coeffno]] = value;
//
// Note that this is the inverse of the encoder-side zigzag map; e.g. the
// encoder's map looks like:
//
// 0, 1, 5, ...
// 2, 4, ...
// 3, ...
//
// For example, you can see the value at index 2 in the map below is "8", and 8
// is the index of the value "2" in the map above.
constexpr std::array<uint8_t, kCoeffPerMcu> kZigZagMap = {
0, 1, 8, 16, 9, 2, 3, 10, //
17, 24, 32, 25, 18, 11, 4, 5, //
12, 19, 26, 33, 40, 48, 41, 34, //
27, 20, 13, 6, 7, 14, 21, 28, //
35, 42, 49, 56, 57, 50, 43, 36, //
29, 22, 15, 23, 30, 37, 44, 51, //
58, 59, 52, 45, 38, 31, 39, 46, //
53, 60, 61, 54, 47, 55, 62, 63, //
};
} // namespace xls::jpeg
#endif // XLS_EXAMPLES_JPEG_CONSTANTS_H_
| 1,380 |
355 | <filename>gff/convert_genbank_to_gff3.py
#!/usr/bin/env python3
"""
This is a script to convert GenBank flat files to GFF3 format with a specific focus on
initially maintaining as much structural annotation as possible, then expanding into
functional annotation support.
This is not guaranteed to convert all features, but warnings will be printed wherever possible
for features which aren't included.
Currently supported:
Structural features: gene, CDS, mRNA, tRNA, rRNA
Annotations: primary identifiers, gene product name
This is written to handle multi-entry GBK files
Caveats:
- Because the GBK flatfile format doesn't explicitly model parent/child features, this script
links them using the expected format convention of shared /locus_tag entries for each feature
of the gene graph (gene, mRNA, CDS)
- It has only been tested with prokaryotic (non-spliced) genes
Author: <NAME> (jorvis AT gmail)
"""
import argparse
import sys
from collections import defaultdict
from Bio import SeqIO
from biocode import annotation, things, utils
def main():
parser = argparse.ArgumentParser( description='Convert GenBank flat files to GFF3 format')
## output file to be written
parser.add_argument('-i', '--input_file', type=str, required=True, help='Path to an input GBK file' )
parser.add_argument('-o', '--output_file', type=str, required=False, help='Path to an output GFF file to be created' )
parser.add_argument('--with_fasta', dest='fasta', action='store_true', help='Include the FASTA section with genomic sequence at end of file. (default)' )
parser.add_argument('--no_fasta', dest='fasta', action='store_false' )
parser.set_defaults(fasta=True)
args = parser.parse_args()
## output will either be a file or STDOUT
ofh = sys.stdout
if args.output_file is not None:
ofh = open(args.output_file, 'wt')
ofh.write("##gff-version 3\n")
assemblies = dict()
current_assembly = None
current_gene = None
current_RNA = None
rna_count_by_gene = defaultdict(int)
exon_count_by_RNA = defaultdict(int)
seqs_pending_writes = False
features_skipped_count = 0
# each gb_record is a SeqRecord object
for gb_record in SeqIO.parse(open(args.input_file, "r"), "genbank"):
mol_id = gb_record.name
if mol_id not in assemblies:
assemblies[mol_id] = things.Assembly(id=mol_id)
if len(str(gb_record.seq)) > 0:
seqs_pending_writes = True
assemblies[mol_id].residues = str(gb_record.seq)
assemblies[mol_id].length = len(str(gb_record.seq))
current_assembly = assemblies[mol_id]
# each feat is a SeqFeature object
for feat in gb_record.features:
#print(feat)
fmin = int(feat.location.start)
fmax = int(feat.location.end)
if feat.location.strand == 1:
strand = '+'
elif feat.location.strand == -1:
strand = '-'
else:
raise Exception("ERROR: unstranded feature encountered: {0}".format(feat))
#print("{0} located at {1}-{2} strand:{3}".format( locus_tag, fmin, fmax, strand ) )
if feat.type == 'source':
continue
if feat.type == 'gene':
# print the previous gene (if there is one)
if current_gene is not None:
gene.print_as(fh=ofh, source='GenBank', format='gff3')
locus_tag = feat.qualifiers['locus_tag'][0]
gene = things.Gene(id=locus_tag, locus_tag=locus_tag)
gene.locate_on( target=current_assembly, fmin=fmin, fmax=fmax, strand=strand )
current_gene = gene
current_RNA = None
elif feat.type == 'mRNA':
locus_tag = feat.qualifiers['locus_tag'][0]
rna_count_by_gene[locus_tag] += 1
feat_id = "{0}.mRNA.{1}".format( locus_tag, rna_count_by_gene[locus_tag] )
mRNA = things.mRNA(id=feat_id, parent=current_gene, locus_tag=locus_tag)
mRNA.locate_on( target=current_assembly, fmin=fmin, fmax=fmax, strand=strand )
gene.add_mRNA(mRNA)
current_RNA = mRNA
if feat_id in exon_count_by_RNA:
raise Exception( "ERROR: two different RNAs found with same ID: {0}".format(feat_id) )
else:
exon_count_by_RNA[feat_id] = 0
elif feat.type == 'tRNA':
locus_tag = feat.qualifiers['locus_tag'][0]
rna_count_by_gene[locus_tag] += 1
feat_id = "{0}.tRNA.{1}".format(locus_tag, rna_count_by_gene[locus_tag])
if 'product' in feat.qualifiers:
anticodon = feat.qualifiers['product'][0]
else:
anticodon = None
tRNA = things.tRNA(id=feat_id, parent=current_gene, anticodon=anticodon)
tRNA.locate_on(target=current_assembly, fmin=fmin, fmax=fmax, strand=strand)
gene.add_tRNA(tRNA)
current_RNA = tRNA
if feat_id in exon_count_by_RNA:
raise Exception( "ERROR: two different RNAs found with same ID: {0}".format(feat_id) )
else:
exon_count_by_RNA[feat_id] = 0
elif feat.type == 'rRNA':
locus_tag = feat.qualifiers['locus_tag'][0]
rna_count_by_gene[locus_tag] += 1
feat_id = "{0}.rRNA.{1}".format(locus_tag, rna_count_by_gene[locus_tag])
if 'product' in feat.qualifiers:
product = feat.qualifiers['product'][0]
else:
product = None
annot = annotation.FunctionalAnnotation(product_name=product)
rRNA = things.rRNA(id=feat_id, parent=current_gene, annotation=annot)
rRNA.locate_on( target=current_assembly, fmin=fmin, fmax=fmax, strand=strand )
gene.add_rRNA(rRNA)
current_RNA = rRNA
if feat_id in exon_count_by_RNA:
raise Exception( "ERROR: two different RNAs found with same ID: {0}".format(feat_id) )
else:
exon_count_by_RNA[feat_id] = 0
elif feat.type == 'CDS':
locus_tag = feat.qualifiers['locus_tag'][0]
# If processing a prokaryotic GBK, we'll encounter CDS before mRNA, so we have to
# manually make one
if current_RNA is None:
feat_id = "{0}.mRNA.{1}".format( locus_tag, rna_count_by_gene[locus_tag] )
mRNA = things.mRNA(id=feat_id, parent=current_gene)
mRNA.locate_on( target=current_assembly, fmin=fmin, fmax=fmax, strand=strand )
gene.add_mRNA(mRNA)
current_RNA = mRNA
if 'product' in feat.qualifiers:
product = feat.qualifiers['product'][0]
else:
product = None
if 'gene' in feat.qualifiers:
gene_symbol = feat.qualifiers['gene'][0]
else:
gene_symbol = None
annot = annotation.FunctionalAnnotation(product_name=product, gene_symbol=gene_symbol)
if 'db_xref' in feat.qualifiers:
for dbxref in feat.qualifiers['db_xref']:
annot.add_dbxref(dbxref)
polypeptide_id = "{0}.polypeptide.{1}".format( locus_tag, rna_count_by_gene[locus_tag] )
polypeptide = things.Polypeptide(id=polypeptide_id, parent=mRNA, annotation=annot)
mRNA.add_polypeptide(polypeptide)
exon_count_by_RNA[current_RNA.id] += 1
cds_id = "{0}.CDS.{1}".format( current_RNA.id, exon_count_by_RNA[current_RNA.id] )
current_CDS_phase = 0
for loc in feat.location.parts:
subfmin = int(loc.start)
subfmax = int(loc.end)
CDS = things.CDS(id=cds_id, parent=current_RNA)
CDS.locate_on( target=current_assembly, fmin=subfmin, fmax=subfmax, strand=strand, phase=current_CDS_phase )
current_RNA.add_CDS(CDS)
# calculate the starting phase for the next CDS feature (in case there is one)
# 0 + 6 = 0 TTGCAT
# 0 + 7 = 2 TTGCATG
# 1 + 6 = 1 TTGCAT
# 2 + 7 = 1 TTGCATG
# general: 3 - ((length - previous phase) % 3)
current_CDS_phase = 3 - (((subfmax - subfmin) - current_CDS_phase) % 3)
if current_CDS_phase == 3:
current_CDS_phase = 0
exon_id = "{0}.exon.{1}".format( current_RNA.id, exon_count_by_RNA[current_RNA.id] )
exon = things.Exon(id=exon_id, parent=current_RNA)
exon.locate_on( target=current_assembly, fmin=subfmin, fmax=subfmax, strand=strand )
current_RNA.add_exon(exon)
exon_count_by_RNA[current_RNA.id] += 1
else:
print("WARNING: The following feature was skipped:\n{0}".format(feat))
features_skipped_count += 1
# don't forget to do the last gene, if there were any
if current_gene is not None:
gene.print_as(fh=ofh, source='GenBank', format='gff3')
if args.fasta is True:
if seqs_pending_writes is True:
ofh.write("##FASTA\n")
for assembly_id in assemblies:
ofh.write(">{0}\n".format(assembly_id))
ofh.write("{0}\n".format(utils.wrapped_fasta(assemblies[assembly_id].residues)))
if features_skipped_count > 0:
print("Warning: {0} unsupported feature types were skipped".format(features_skipped_count))
if __name__ == '__main__':
main()
| 5,289 |
1,433 | <filename>src/PhilipsHueDSB/BridgeRT/WidgetPropertyLabel.cpp<gh_stars>1000+
//
// Copyright (c) 2015, Microsoft Corporation
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
// IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
//
#include "pch.h"
#include "WidgetConsts.h"
#include "WidgetPropertyLabel.h"
#include "BridgeUtils.h"
using namespace BridgeRT;
const uint16_t WIDGET_LABEL_TYPE = 11;
//**************************************************************************************************************************************
//
// Constructor
//
// pControlPanel The control panel hosting this widget
// srcValue The source content of this widget
//
//**************************************************************************************************************************************
WidgetPropertyLabel::WidgetPropertyLabel(_In_ ControlPanel* pControlPanel, _In_ IAdapterValue^ srcValue)
: WidgetProperty(pControlPanel, WIDGET_LABEL_TYPE, true)
, m_srcValue(srcValue)
{
}
//**************************************************************************************************************************************
//
// Destructor
//
//**************************************************************************************************************************************
WidgetPropertyLabel::~WidgetPropertyLabel()
{
}
//**************************************************************************************************************************************
//
// Gets the current value of this label's content
//
// val Variant message arg value to return to the caller.
//
//**************************************************************************************************************************************
QStatus WidgetPropertyLabel::GetValue(_Out_ alljoyn_msgarg val) const
{
QStatus status = ER_OK;
std::string srcContent = ConvertTo<std::string>(m_srcValue->Data->ToString());
alljoyn_msgarg variantarg = alljoyn_msgarg_create();
CHK_POINTER(variantarg);
CHK_AJSTATUS(alljoyn_msgarg_set(variantarg, ARG_STRING_STR, srcContent.c_str()));
CHK_AJSTATUS(alljoyn_msgarg_set(val, ARG_VARIANT_STR, variantarg));
alljoyn_msgarg_stabilize(val);
leave:
if (variantarg != nullptr)
{
alljoyn_msgarg_destroy(variantarg);
variantarg = nullptr;
}
return status;
}
| 798 |
348 | {"nom":"Saint-Vivien","circ":"2ème circonscription","dpt":"Dordogne","inscrits":219,"abs":114,"votants":105,"blancs":8,"nuls":1,"exp":96,"res":[{"nuance":"REM","nom":"<NAME>","voix":67},{"nuance":"FN","nom":"<NAME>","voix":29}]} | 92 |
3,699 | package com.wugui.datax.admin.tool.meta;
/**
* hive元数据信息
*
* @author jingwk
* @ClassName HiveDatabaseMeta
* @Version 2.0
* @since 2020/01/05 15:45
*/
public class HiveDatabaseMeta extends BaseDatabaseMeta implements DatabaseInterface {
private volatile static HiveDatabaseMeta single;
public static HiveDatabaseMeta getInstance() {
if (single == null) {
synchronized (HiveDatabaseMeta.class) {
if (single == null) {
single = new HiveDatabaseMeta();
}
}
}
return single;
}
@Override
public String getSQLQueryTables() {
return "show tables";
}
}
| 294 |
354 | package com.dalimao.library;
import android.content.Context;
import android.graphics.Point;
import android.os.Bundle;
import android.util.Log;
import android.util.SparseArray;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationSet;
import com.dalimao.library.constants.StandOutFlags;
import com.dalimao.library.util.Utils;
import java.lang.reflect.Constructor;
import java.util.LinkedList;
import java.util.Set;
import java.util.logging.Handler;
public class StandOutWindowManager {
static final String TAG = "StandOutWindowManager";
static final boolean DEBUG = false;
public void Log(String msg) {
if (DEBUG) Log.d(TAG, msg);
}
// internal map of ids to shown/hidden views
static WindowCache sWindowCache;
static Window sFocusedWindow;
// static constructors
static {
if (sWindowCache == null) {
sWindowCache = new WindowCache();
}
sFocusedWindow = null;
}
private static StandOutWindowManager instance;
/**
* Return the ids of all shown or hidden windows.
* @param cls
* @return A set of ids, or an empty set.
*/
public final static Set<Integer> getExistingIds(Class<? extends Context> cls) {
return sWindowCache.getCacheIds(cls);
}
/**
* check the special window wrapper if exited
* @param servClass class of service which contains the target window wrapper
* @param cls special window wrapper class
* @return true if target is exit
*/
public final static boolean isCached(Class<? extends Context> servClass, Class<? extends WindowWrapper> cls) {
int id = cls.hashCode();
return sWindowCache.isCached(id, servClass);
}
public final static void clearCache(Class<? extends Context> servClass) {
if (sWindowCache != null) {
sWindowCache.clear(servClass);
}
}
/**
* window 是否可见
* @param cls window的类对象
* @return
*/
public boolean isWindowShowing(Class<? extends WindowWrapper> cls) {
int id = cls.hashCode();
Window window = getWindow(id);
if (window != null) {
return window.isShown();
} else {
return false;
}
}
private Context mContext;
//the class of service which contains this menuManager
private Class<? extends Context> mServClass;
//window wrapper cache, the key is wrapper's hash code, that it's the id of window too
private SparseArray<WindowWrapper> mWindowWrappers = new SparseArray<WindowWrapper>();
// internal system services
private android.view.WindowManager mSysWindowManager;
private StandOutWindowManager(Context context) {
this.mContext = context;
this.mServClass = context.getClass();
this.mSysWindowManager = (android.view.WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
}
public static StandOutWindowManager getInstance(Context context){
if (instance == null){
instance = new StandOutWindowManager(context);
}
return instance;
}
public Context getContext() {
return mContext.getApplicationContext();
}
public Context getServiceContext() {
return mContext;
}
/**
* check WindowWrapper is exist(not close)
* @param cls the check class of wrapper
* @return is exist
*/
public boolean isWindowExist(Class<? extends WindowWrapper> cls) {
int id = cls.hashCode();
WindowWrapper windowWrapper = mWindowWrappers.get(id);
return windowWrapper != null;
}
/**
* return a new one window wrapper if not exit in cache
* @param cls the class of special wrapper
* @return instance
*/
public WindowWrapper getWindowWrapper(Class<? extends WindowWrapper> cls, Integer id) {
WindowWrapper windowWrapper = mWindowWrappers.get(id);
if (windowWrapper == null) {
windowWrapper = createWindowWrapperInstance(cls, id);
}else if (windowWrapper.getClass() != cls) {
}
if (windowWrapper == null) {
String msg = String.format("%s can not be instant !", cls.getSimpleName());
if (DEBUG) {
throw new NullPointerException(msg);
} else {
Log.w(TAG, msg);
}
}
return windowWrapper;
}
/**
* return window wrapper that set with attach window
* @param cls
* @param anchor anchor for window calculate it's real showing position
* @return
*/
public WindowWrapper getWindowWrapper(Class<? extends WindowWrapper> cls, Window anchor, Integer id) {
WindowWrapper windowWrapper = getWindowWrapper(cls, id);
if (windowWrapper != null) {
windowWrapper.setWindowAnchor(anchor);
}
return windowWrapper;
}
private WindowWrapper createWindowWrapperInstance(Class<? extends WindowWrapper> cls, Integer id) {
WindowWrapper windowWrapper = null;
if (cls != null) {
try {
Class[] paramTypes = { StandOutWindowManager.class, Integer.class };
Object[] params = { this, id};
Constructor con = cls.getConstructor(paramTypes);
windowWrapper = (WindowWrapper) con.newInstance(params);
} catch (InstantiationException e) {
Log.e(TAG,e.getMessage());
} catch (IllegalAccessException e) {
Log.e(TAG, e.getMessage());
} catch (Exception e) {
Log.e(TAG, e.getMessage());
}
}
if (windowWrapper != null) {
mWindowWrappers.put(id, windowWrapper);
}
return windowWrapper;
}
private WindowWrapper getWindowWrapperFromCache(int windowId) {
return mWindowWrappers.get(windowId);
}
//----------------------------------------------------------------------------------------------
/**
* Return whether the window corresponding to the id exists. This is useful
* for testing if the id is being restored (return true) or shown for the
* first time (return false).
*
* @param id
* The id of the window.
* @return True if the window corresponding to the id is either shown or
* hidden, or false if it has never been shown or was previously
* closed.
*/
public final boolean isExistingId(int id) {
return sWindowCache.isCached(id, mServClass);
}
/**
* Return the ids of all shown or hidden windows.
*
* @return A set of ids, or an empty set.
*/
public final Set<Integer> getExistingIds() {
return sWindowCache.getCacheIds(mServClass);
}
/**
* Return the window corresponding to the id, if it exists in cache. The
* window will not be created with
* value will be null if the window is not shown or hidden.
*
* @param id
* The id of the window.
* @return The window if it is shown/hidden, or null if it is closed.
*/
public final Window getWindow(int id) {
return sWindowCache.getCache(id, mServClass);
}
/**
* Return the window that currently has focus.
*
* @return The window that has focus.
*/
public final Window getFocusedWindow() {
return sFocusedWindow;
}
/**
* Sets the window that currently has focus.
*/
public final void setFocusedWindow(Window window) {
sFocusedWindow = window;
}
//----------------------------------------------------------------------------------------------
/**
* open a window with special window wrapper class
*
*
* @param cls
* @param args the args will pass to the special window wrapper:
*
* @param shouldCloseAll close all showing window before target window is open
*/
public void show(Class<? extends WindowWrapper> cls, Bundle args, boolean shouldCloseAll) {
int targetId = cls.hashCode();
if (shouldCloseAll) {
closeAll(targetId);
}
Window window = getWindow(targetId);
if (window != null) {
Log("can not open an exited window: " + cls.getSimpleName());
return;
}
show(cls, args, null);
}
public void showView(View view, Bundle args, int gravity) {
final WindowWrapper wrapper = getWindowWrapper(CommonWindowWrapper.class, null , view.getClass().hashCode());
StandOutLayoutParams params = wrapper.getStandOutLayoutParams();
params.gravity = gravity;
wrapper.setStandOutLayoutParams(params);
showWrapper(wrapper, args, null, view);
}
/**
*
* @param view
* @param args
*/
public void showView(View view, Bundle args){
showView(view, args, Gravity.TOP | Gravity.LEFT, WindowManager.LayoutParams.TYPE_PHONE);
}
/**
*
* @param view
* @param args
* @param gravity
* @param type
*/
public void showView(View view, Bundle args, int gravity ,int type){
final WindowWrapper wrapper = getWindowWrapper(CommonWindowWrapper.class, null , view.getClass().hashCode());
StandOutLayoutParams params = wrapper.getStandOutLayoutParams();
params.gravity = gravity;
params.type = type;
wrapper.setStandOutLayoutParams(params);
showWrapper(wrapper, args, null, view);
}
/**
*
* @param view
* @param args
* @param gravity
* @param type
*/
public void showView(View view, Bundle args, int gravity , int type, Point point){
showView(view, args, gravity, type, point, false);
}
/**
*
* @param view
* @param args
* @param gravity
* @param type
* @param point
* @param drag
*/
public void showView(View view, Bundle args, int gravity, int type, Point point, boolean drag) {
final WindowWrapper wrapper = getWindowWrapper(CommonWindowWrapper.class, null , view.getClass().hashCode());
wrapper.setCanMove(drag);
StandOutLayoutParams params = wrapper.getStandOutLayoutParams();
params.gravity = gravity;
params.type = type;
params.x = point.x;
params.y = point.y;
wrapper.setStandOutLayoutParams(params);
showWrapper(wrapper, args, null, view);
}
/**
* open a window and pass it a anchor window object <p>
* or you can close the anchor window by pass it's wrapper class and closeAnchor with true, before open the target window
*
*
* @param cls the class of target window
* @param args the args will pass to the special window wrapper:
* @param anchor wrapper class of anchor window,
* @param closeAnchor if true close the anchor window before window open
*/
public void show(Class<? extends WindowWrapper> cls, Bundle args, Class<? extends WindowWrapper> anchor, boolean closeAnchor) {
int anchorId = anchor.hashCode();
if (closeAnchor && isExistingId(anchorId)) {
close(anchorId);
}
Log("start window : " + cls.getSimpleName());
if (closeAnchor) {
show(cls, args, null);
return;
}
Window anchorWindow = getWindow(anchorId);
if(anchorWindow == null) {
Log("window caller is null: " + anchorId);
return;
}
show(cls, args, anchorWindow);
}
protected final void show(Class<? extends WindowWrapper> cls) {
show(cls, null, null);
}
protected final void show(Class<? extends WindowWrapper> cls, Bundle args) {
show(cls, args, null);
}
/**
* Show or restore a window corresponding to the wrapper class.
* Return the window that was shown/restored.
*
* @param cls the class of target window
* @param args the args will pass to the special window wrapper:
* @param anchor wrapper class of anchor window,
* you can get the anchor window object on target wrapper {@link WindowWrapper#onPrepareShow(Window, Window)}
* @return The window shown.
*/
public synchronized Window show(Class<? extends WindowWrapper> cls, Bundle args, Window anchor) {
final WindowWrapper wrapper = getWindowWrapper(cls, anchor , cls.hashCode());
Window window = showWrapper(wrapper, args, anchor, null);
return window;
}
private Window showWrapper(WindowWrapper wrapper, Bundle args, Window anchor, View child) {
if(wrapper == null) {
return null;
}
final int id = wrapper.WindowId;
wrapper.setParams(args);
// get the window corresponding to the id
Window cachedWindow = getWindow(id);
if (cachedWindow != null && wrapper != cachedWindow.getWindowWrapper()) {
}
final Window window;
// check cache first
if (cachedWindow != null && wrapper.isCreated) {
window = cachedWindow;
} else {
window = new Window(wrapper);
}
if (child != null && cachedWindow == null){
window.addView(child);
if (args != null) {
try {
((ParamReceiver)child).onParamReceive(args);
} catch (ClassCastException e) {
Log.e(TAG, "Your custom view must implement ParamReceiver, or you can not receive params!");
}
}
}
if (window.visibility == Window.VISIBILITY_VISIBLE) {
// String msg = "Tried to show " + cls.getSimpleName()+ " that is already shown.";
// if (DEBUG) {
// throw new IllegalStateException(msg);
// } else {
// Log.e(TAG, msg);
// }
wrapper.onReShown(window, args);
return null;
}
// alert callbacks and cancel if instructed
wrapper.onPrepareShow(window, anchor);
window.visibility = Window.VISIBILITY_VISIBLE;
// get animation
Animation animation = wrapper.getShowAnimation();
wrapper.onShown(window, args);
// get the params corresponding to the id
StandOutLayoutParams params = window.getLayoutParams();
try {
// add the view to the window menuManager
mSysWindowManager.addView(window, params);
// animate
if (animation != null) {
window.getChildAt(0).startAnimation(animation);
}
} catch (Exception ex) {
Log.e(TAG, ex.getMessage());
}
// add view to internal map
sWindowCache.putCache(id, mServClass, window);
// mContext.startServiceForeground();
focus(id);
return window;
}
/**
* Create a window corresponding to the wrapper class.
* Return the window that was shown/restored.
*
* @param cls the class of target window
* @param args the args will pass to the special window wrapper:
* @param anchor wrapper class of anchor window,
* you can get the anchor window object on target wrapper {@link WindowWrapper#onPrepareShow(Window, Window)}
* @return The window shown.
*/
public synchronized Window create(Class<? extends WindowWrapper> cls, Bundle args, Window anchor) {
final WindowWrapper wrapper = getWindowWrapper(cls, anchor, cls.hashCode());
if(wrapper == null) {
return null;
}
final int id = wrapper.WindowId;
wrapper.setParams(args);
// get the window corresponding to the id
Window cachedWindow = getWindow(id);
if (cachedWindow != null && wrapper != cachedWindow.getWindowWrapper()) {
}
final Window window;
// check cache first
if (cachedWindow != null && wrapper.isCreated) {
window = cachedWindow;
} else {
window = new Window(wrapper);
}
// add view to internal map
sWindowCache.putCache(id, mServClass, window);
// mContext.startServiceForeground();
return window;
}
private void hide(int windowId, final boolean ignoreAnim) {
WindowWrapper wrapper = mWindowWrappers.get(windowId);
if (wrapper != null) {
hide(wrapper, ignoreAnim);
}
}
/**
* Hide a window corresponding to the wrapper class, then will be invoke <br>
* this hide action request return
* or it will be the same as invoke the method {@link #close(Class)}
*
* @param cls
* The class of the window.
*/
public final void hide(Class<? extends WindowWrapper> cls) {
final int id = cls.hashCode();
final WindowWrapper wrapper = getWindowWrapperFromCache(id);
if (wrapper == null) {
return;
}
hide(wrapper);
}
private void hide(final WindowWrapper wrapper) {
hide(wrapper, false);
}
private synchronized void hide(final WindowWrapper wrapper, final boolean ignoreAnim) {
final int id = wrapper.WindowId;
// get the view corresponding to the id
final Window window = getWindow(id);
if (window == null) {
/*final String windowName = wrapper.getClass().getSimpleName();
String msg = "Tried to hide(" + windowName + ") a null window.";
if (DEBUG) {
throw new IllegalArgumentException(msg);
} else {
Log.e(TAG, msg);
}*/
return;
}
if (window.visibility == Window.VISIBILITY_GONE) {
/*final String windowName = wrapper.getClass().getSimpleName();
String msg = "Tried to hide(" + windowName + ") a window that is not shown.";
if (DEBUG) {
throw new IllegalStateException(msg);
} else {
Log.e(TAG, msg);
}*/
return;
}
// alert callbacks and cancel if instructed
wrapper.onHidden(window);
// check if hide enabled
if (Utils.isSet(window.flags, StandOutFlags.FLAG_WINDOW_HIDE_ENABLE)) {
window.visibility = Window.VISIBILITY_TRANSITION;
// get animation
Animation animation = wrapper.getHideAnimation();
try {
View windowContent = window.getChildAt(0);
// animate
if (!ignoreAnim && animation != null && windowContent!=null) {
AnimationSet animationSet = new AnimationSet(false);
animationSet.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
// remove the window from the window menuManager
try {
mSysWindowManager.removeView(window);
} catch (Exception e) {
Log.e(TAG, e.getMessage());
}
window.visibility = Window.VISIBILITY_GONE;
}
});
animationSet.addAnimation(animation);
windowContent.startAnimation(animationSet);
} else {
// remove the window from the window menuManager
mSysWindowManager.removeView(window);
window.visibility = Window.VISIBILITY_GONE;
}
} catch (Exception ex) {
Log.e(TAG, ex.getMessage());
}
// mContext.updateNotificationOnHide();
} else {
// if hide not enabled, close window
close(wrapper);
}
}
public void hideAll() {
for (int id : getExistingIds()) {
hide(id, true);
}
}
/**
* Close a window corresponding to the wrapper class.
*
* @param cls
* The class of the window.
*/
public final synchronized void close(Class<? extends WindowWrapper> cls) {
final int id = cls.hashCode();
final WindowWrapper wrapper = getWindowWrapperFromCache(id);
if (wrapper == null) {
return;
} else {
close(wrapper);
}
}
public final synchronized void close(final WindowWrapper wrapper) {
final int id = wrapper.WindowId;
// get the view corresponding to the id
final Window window = getWindow(wrapper.WindowId);
if (window == null) {
return;
}
if (window.visibility == Window.VISIBILITY_TRANSITION) {
return;
}
// mContext.cancelNotificationOnClose();
unfocus(window);
window.visibility = Window.VISIBILITY_TRANSITION;
// get animation
Animation animation = wrapper.getCloseAnimation();
// remove window
try {
View windowContent = window.getChildAt(0);
if (animation != null && windowContent != null) { // animate
new android.os.Handler().postDelayed(new Runnable() {
@Override
public void run() {
removeWindowView(id, window, wrapper);
}
}, animation.getDuration());
windowContent.startAnimation(animation);
} else {
removeWindowView(id, window, wrapper);
}
} catch (Exception ex) {
Log.e(TAG, ex.getMessage());
}
}
private void removeWindowView(int id, Window window, WindowWrapper wrapper) {
// remove the window from the window menuManager
try{
mSysWindowManager.removeView(window);
} catch (IllegalArgumentException e) {
//e.printStackTrace();
Log.w(TAG, "View not attached to window menuManager, maybe it's a hided window ?");
}
window.visibility = Window.VISIBILITY_GONE;
// remove view from internal map
sWindowCache.removeCache(id, mContext.getClass());
// if we just released the last window, quit
if (sWindowCache.getCacheSize(mServClass) == 0) {
// mContext.stopServiceForeground();
}
wrapper.onClosed(window);
mWindowWrappers.remove(id);
Log.d(TAG, "remove window id=" + id);
}
private void closeAll(int target) {
LinkedList<Integer> ids = new LinkedList<Integer>();
for (int id : getExistingIds()) {
if(id==target) {
continue;
}
ids.add(id);
}
close(ids);
}
public void closeAll() {
for (int id : getExistingIds()) {
close(id);
}
}
private void close(LinkedList<Integer> ids) {
// close each window
for (int id : ids) {
if(isExistingId(id)) {
close(id);
} else {
Log("try close a not exited window :" + id);
}
}
}
private void close(int windowId) {
WindowWrapper wrapper = mWindowWrappers.get(windowId);
if (wrapper != null) {
close(wrapper);
}
}
//----------------------------------------------------------------------------------------------
/**
* Internal touch handler for handling moving the window.
*
* @see {@link View#onTouchEvent(MotionEvent)}
*
* @param window
* @param view
* @param event
* @return
*/
public boolean onTouchHandleMove(Window window, View view, MotionEvent event) {
WindowWrapper wrapper = mWindowWrappers.get(window.id);
if (wrapper == null) {
return true;
}
if (wrapper.onPrepareMove(window, view, event)){
return true;
}
StandOutLayoutParams params = window.getLayoutParams();
// how much you have to move in either direction in order for the
// gesture to be a move and not tap
int totalDeltaX = window.touchInfo.lastX - window.touchInfo.firstX;
int totalDeltaY = window.touchInfo.lastY - window.touchInfo.firstY;
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
window.touchInfo.lastX = (int) event.getRawX();
window.touchInfo.lastY = (int) event.getRawY();
window.touchInfo.firstX = window.touchInfo.lastX;
window.touchInfo.firstY = window.touchInfo.lastY;
break;
case MotionEvent.ACTION_MOVE:
int deltaX = (int) event.getRawX() - window.touchInfo.lastX;
int deltaY = (int) event.getRawY() - window.touchInfo.lastY;
window.touchInfo.lastX = (int) event.getRawX();
window.touchInfo.lastY = (int) event.getRawY();
/**
* 非长按的才执行移动window操作
* **/
if(!window.touchInfo.isLongPress) {
if (window.touchInfo.moving
|| Math.abs(totalDeltaX) >= params.threshold
|| Math.abs(totalDeltaY) >= params.threshold) {
window.touchInfo.moving = true;
if (Utils.isSet(window.flags, StandOutFlags.FLAG_BODY_MOVE_X_ENABLE)) {
//only move x axis
if (event.getPointerCount() == 1) {
params.x += deltaX;
}
window.edit().setPosition(params.x, params.y).commit();
} else if (Utils.isSet(window.flags,
StandOutFlags.FLAG_BODY_MOVE_ENABLE)) {
// update the position of the window
if (event.getPointerCount() == 1) {
params.x += deltaX;
params.y += deltaY;
}
window.edit().setPosition(params.x, params.y).commit();
}
}
}
break;
case MotionEvent.ACTION_UP:
window.touchInfo.moving = false;
window.touchInfo.isLongPress = false;
if (event.getPointerCount() == 1) {
// bring to front on tap
boolean tap = Math.abs(totalDeltaX) < params.threshold
&& Math.abs(totalDeltaY) < params.threshold;
if (tap
&& Utils.isSet(
window.flags,
StandOutFlags.FLAG_WINDOW_BRING_TO_FRONT_ON_TAP)) {
bringToFront(window.id);
}
}
// bring to front on touch
else if (Utils.isSet(window.flags,
StandOutFlags.FLAG_WINDOW_BRING_TO_FRONT_ON_TOUCH)) {
bringToFront(window.id);
}
break;
case MotionEvent.ACTION_CANCEL:
window.touchInfo.isLongPress = false;
break;
}
if (wrapper != null) {
wrapper.onMove(window, view, event);
}
return !window.touchInfo.isLongPress;
}
/**
* Bring the window corresponding to this id in front of all other windows.
* The window may flicker as it is removed and restored by the system.
*
* @param id
* The id of the window to bring to the front.
*/
public final synchronized void bringToFront(int id) {
Window window = getWindow(id);
if (window == null) {
if (DEBUG) {
throw new IllegalArgumentException("Tried to bringToFront(" + id
+ ") a null window.");
}
return;
}
if (window.visibility == Window.VISIBILITY_GONE) {
if (DEBUG) {
throw new IllegalStateException("Tried to bringToFront(" + id
+ ") a window that is not shown.");
}
return;
}
if (window.visibility == Window.VISIBILITY_TRANSITION) {
return;
}
StandOutLayoutParams params = window.getLayoutParams();
// remove from window menuManager then add back
try {
mSysWindowManager.removeView(window);
} catch (Exception ex) {
Log.e(TAG, ex.getMessage());
}
try {
mSysWindowManager.addView(window, params);
} catch (Exception ex) {
Log.e(TAG, ex.getMessage());
}
}
/**
* Request focus for the window corresponding to this id. A maximum of one
* window can have focus, and that window will receive all key events,
* including Back and Menu.
*
* @param id
* The id of the window.
* @return True if focus changed successfully, false if it failed.
*/
public final synchronized boolean focus(int id) {
// check if that window is focusable
final Window window = getWindow(id);
if (window == null) {
if (DEBUG) {
throw new IllegalArgumentException("Tried to focus(" + id
+ ") a null window.");
}
return false;
}
if (!Utils.isSet(window.flags,
StandOutFlags.FLAG_WINDOW_FOCUSABLE_DISABLE)) {
// remove focus from previously focused window
if (sFocusedWindow != null) {
unfocus(sFocusedWindow);
}
return window.onFocus(true);
}
return false;
}
/**
* Remove focus for the window corresponding to this id. Once a window is
* unfocused, it will stop receiving key events.
*
* @param id
* The id of the window.
* @return True if focus changed successfully, false if it failed.
*/
public final synchronized boolean unfocus(int id) {
Window window = getWindow(id);
return unfocus(window);
}
/**
* Remove focus for the window, which could belong to another application.
*
* @param window
* The window to unfocus.
*
* @return True if focus changed successfully, false if it failed.
*/
public synchronized boolean unfocus(Window window) {
if (window == null) {
if (DEBUG) {
throw new IllegalArgumentException(
"Tried to unfocus a null window.");
}
return false;
}
return window.onFocus(false);
}
/**
* Update the window corresponding to this id with the given params.
*
* @param id
* The id of the window.
* @param params
* The updated layout params to apply.
*/
public void updateViewLayout(int id, StandOutLayoutParams params) {
Window window = getWindow(id);
if (window == null) {
if (DEBUG) {
throw new IllegalArgumentException("Tried to updateViewLayout("
+ id + ") a null window.");
}
return;
}
if (window.visibility == Window.VISIBILITY_GONE) {
return;
}
if (window.visibility == Window.VISIBILITY_TRANSITION) {
return;
}
try {
window.setLayoutParams(params);
mSysWindowManager.updateViewLayout(window, params);
} catch (Exception ex) {
Log.e(TAG, ex.getMessage());
}
}
//----------------------------------------------------------------------------------------------
/**
* sent a special command to a target window wrapper,
* the target wrapper's method {@link WindowWrapper#onReceiveCommand(int, Bundle)} will be invoked when command get
* @param cls the class of target window wrapper
* @param type command type declared by custom window wrapper
* @param data
*/
public void sendWindowCommand(Class<? extends WindowWrapper> cls, int type, Bundle data) {
int targetId = cls.hashCode();
Window window = getWindow(targetId);
if (window == null) {
Log("can not send command to a null window");
return;
}
WindowWrapper windowWrapper = mWindowWrappers.get(targetId);
if (windowWrapper != null) {
windowWrapper.onReceiveCommand(type, data);
}
}
public void hideView(Class<? extends View> viewClass, boolean cache) {
final WindowWrapper wrapper = getWindowWrapperFromCache(viewClass.hashCode());
if (wrapper == null) {
return;
}
if (cache) {
hide(wrapper);
} else {
close(viewClass.hashCode());
}
}
}
| 14,963 |
711 | package com.java110.po.product;
import java.io.Serializable;
import java.util.Date;
public class ProductPo implements Serializable {
private String productId;
private String unitName;
private String isPostage;
private String statusCd = "0";
private String sort;
private String storeId;
private String barCode;
private String postage;
private String prodName;
private String state;
private String keyword;
private String prodDesc;
private String categoryId;
public String getProductId() {
return productId;
}
public void setProductId(String productId) {
this.productId = productId;
}
public String getUnitName() {
return unitName;
}
public void setUnitName(String unitName) {
this.unitName = unitName;
}
public String getIsPostage() {
return isPostage;
}
public void setIsPostage(String isPostage) {
this.isPostage = isPostage;
}
public String getStatusCd() {
return statusCd;
}
public void setStatusCd(String statusCd) {
this.statusCd = statusCd;
}
public String getSort() {
return sort;
}
public void setSort(String sort) {
this.sort = sort;
}
public String getStoreId() {
return storeId;
}
public void setStoreId(String storeId) {
this.storeId = storeId;
}
public String getBarCode() {
return barCode;
}
public void setBarCode(String barCode) {
this.barCode = barCode;
}
public String getPostage() {
return postage;
}
public void setPostage(String postage) {
this.postage = postage;
}
public String getProdName() {
return prodName;
}
public void setProdName(String prodName) {
this.prodName = prodName;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
public String getProdDesc() {
return prodDesc;
}
public void setProdDesc(String prodDesc) {
this.prodDesc = prodDesc;
}
public String getCategoryId() {
return categoryId;
}
public void setCategoryId(String categoryId) {
this.categoryId = categoryId;
}
}
| 879 |
628 | <gh_stars>100-1000
# Copyright (C) 2021, Mindee.
# This program is licensed under the Apache License version 2.
# See LICENSE or go to <https://www.apache.org/licenses/LICENSE-2.0.txt> for full license details.
import os
os.environ['USE_TF'] = '1'
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"
import datetime
import multiprocessing as mp
import time
import numpy as np
import tensorflow as tf
import wandb
from fastprogress.fastprogress import master_bar, progress_bar
from tensorflow.keras import mixed_precision
gpu_devices = tf.config.experimental.list_physical_devices('GPU')
if any(gpu_devices):
tf.config.experimental.set_memory_growth(gpu_devices[0], True)
from doctr import transforms as T
from doctr.datasets import VOCABS, CharacterGenerator, DataLoader
from doctr.models import classification
from utils import plot_recorder, plot_samples
def record_lr(
model: tf.keras.Model,
train_loader: DataLoader,
batch_transforms,
optimizer,
start_lr: float = 1e-7,
end_lr: float = 1,
num_it: int = 100,
amp: bool = False,
):
"""Gridsearch the optimal learning rate for the training.
Adapted from https://github.com/frgfm/Holocron/blob/master/holocron/trainer/core.py
"""
if num_it > len(train_loader):
raise ValueError("the value of `num_it` needs to be lower than the number of available batches")
# Update param groups & LR
gamma = (end_lr / start_lr) ** (1 / (num_it - 1))
optimizer.learning_rate = start_lr
lr_recorder = [start_lr * gamma ** idx for idx in range(num_it)]
loss_recorder = []
for batch_idx, (images, targets) in enumerate(train_loader):
images = batch_transforms(images)
# Forward, Backward & update
with tf.GradientTape() as tape:
out = model(images, training=True)
train_loss = tf.nn.sparse_softmax_cross_entropy_with_logits(targets, out)
grads = tape.gradient(train_loss, model.trainable_weights)
if amp:
grads = optimizer.get_unscaled_gradients(grads)
optimizer.apply_gradients(zip(grads, model.trainable_weights))
optimizer.learning_rate = optimizer.learning_rate * gamma
# Record
train_loss = train_loss.numpy()
if np.any(np.isnan(train_loss)):
if batch_idx == 0:
raise ValueError("loss value is NaN or inf.")
else:
break
loss_recorder.append(train_loss.mean())
# Stop after the number of iterations
if batch_idx + 1 == num_it:
break
return lr_recorder[:len(loss_recorder)], loss_recorder
def fit_one_epoch(model, train_loader, batch_transforms, optimizer, mb, amp=False):
# Iterate over the batches of the dataset
for images, targets in progress_bar(train_loader, parent=mb):
images = batch_transforms(images)
with tf.GradientTape() as tape:
out = model(images, training=True)
train_loss = tf.nn.sparse_softmax_cross_entropy_with_logits(targets, out)
grads = tape.gradient(train_loss, model.trainable_weights)
if amp:
grads = optimizer.get_unscaled_gradients(grads)
optimizer.apply_gradients(zip(grads, model.trainable_weights))
mb.child.comment = f'Training loss: {train_loss.numpy().mean():.6}'
def evaluate(model, val_loader, batch_transforms):
# Validation loop
val_loss, correct, samples, batch_cnt = 0, 0, 0, 0
val_iter = iter(val_loader)
for images, targets in val_iter:
images = batch_transforms(images)
out = model(images, training=False)
loss = tf.nn.sparse_softmax_cross_entropy_with_logits(targets, out)
# Compute metric
correct += int((out.numpy().argmax(1) == targets.numpy()).sum())
val_loss += loss.numpy().mean()
batch_cnt += 1
samples += images.shape[0]
val_loss /= batch_cnt
acc = correct / samples
return val_loss, acc
def collate_fn(samples):
images, targets = zip(*samples)
images = tf.stack(images, axis=0)
return images, tf.convert_to_tensor(targets)
def main(args):
print(args)
if not isinstance(args.workers, int):
args.workers = min(16, mp.cpu_count())
vocab = VOCABS[args.vocab]
fonts = args.font.split(",")
# AMP
if args.amp:
mixed_precision.set_global_policy('mixed_float16')
# Load val data generator
st = time.time()
val_set = CharacterGenerator(
vocab=vocab,
num_samples=args.val_samples * len(vocab),
cache_samples=True,
img_transforms=T.Compose([
T.Resize((args.input_size, args.input_size)),
# Ensure we have a 90% split of white-background images
T.RandomApply(T.ColorInversion(), .9),
]),
font_family=fonts,
)
val_loader = DataLoader(
val_set,
batch_size=args.batch_size,
shuffle=False,
drop_last=False,
num_workers=args.workers,
collate_fn=collate_fn,
)
print(f"Validation set loaded in {time.time() - st:.4}s ({len(val_set)} samples in "
f"{val_loader.num_batches} batches)")
# Load doctr model
model = classification.__dict__[args.arch](
pretrained=args.pretrained,
input_shape=(args.input_size, args.input_size, 3),
num_classes=len(vocab),
include_top=True,
)
# Resume weights
if isinstance(args.resume, str):
model.load_weights(args.resume)
batch_transforms = T.Compose([
T.Normalize(mean=(0.694, 0.695, 0.693), std=(0.299, 0.296, 0.301)),
])
if args.test_only:
print("Running evaluation")
val_loss, acc = evaluate(model, val_loader, batch_transforms)
print(f"Validation loss: {val_loss:.6} (Acc: {acc:.2%})")
return
st = time.time()
# Load train data generator
train_set = CharacterGenerator(
vocab=vocab,
num_samples=args.train_samples * len(vocab),
cache_samples=True,
img_transforms=T.Compose([
T.Resize((args.input_size, args.input_size)),
# Augmentations
T.RandomApply(T.ColorInversion(), .9),
T.RandomApply(T.ToGray(3), .1),
T.RandomJpegQuality(60),
T.RandomSaturation(.3),
T.RandomContrast(.3),
T.RandomBrightness(.3),
# Blur
T.RandomApply(T.GaussianBlur(kernel_shape=(3, 3), std=(0.1, 3)), .3),
]),
font_family=fonts,
)
train_loader = DataLoader(
train_set,
batch_size=args.batch_size,
shuffle=True,
drop_last=True,
num_workers=args.workers,
collate_fn=collate_fn,
)
print(f"Train set loaded in {time.time() - st:.4}s ({len(train_set)} samples in "
f"{train_loader.num_batches} batches)")
if args.show_samples:
x, target = next(iter(train_loader))
plot_samples(x, list(map(vocab.__getitem__, target)))
return
# Optimizer
scheduler = tf.keras.optimizers.schedules.ExponentialDecay(
args.lr,
decay_steps=args.epochs * len(train_loader),
decay_rate=1 / (1e3), # final lr as a fraction of initial lr
staircase=False
)
optimizer = tf.keras.optimizers.Adam(
learning_rate=scheduler,
beta_1=0.95,
beta_2=0.99,
epsilon=1e-6,
)
if args.amp:
optimizer = mixed_precision.LossScaleOptimizer(optimizer)
# LR Finder
if args.find_lr:
lrs, losses = record_lr(model, train_loader, batch_transforms, optimizer, amp=args.amp)
plot_recorder(lrs, losses)
return
# Tensorboard to monitor training
current_time = datetime.datetime.now().strftime("%Y%m%d-%H%M%S")
exp_name = f"{args.arch}_{current_time}" if args.name is None else args.name
# W&B
if args.wb:
run = wandb.init(
name=exp_name,
project="character-classification",
config={
"learning_rate": args.lr,
"epochs": args.epochs,
"weight_decay": 0.,
"batch_size": args.batch_size,
"architecture": args.arch,
"input_size": args.input_size,
"optimizer": "adam",
"framework": "tensorflow",
"vocab": args.vocab,
"scheduler": "exp_decay",
"pretrained": args.pretrained,
}
)
# Create loss queue
min_loss = np.inf
# Training loop
mb = master_bar(range(args.epochs))
for epoch in mb:
fit_one_epoch(model, train_loader, batch_transforms, optimizer, mb, args.amp)
# Validation loop at the end of each epoch
val_loss, acc = evaluate(model, val_loader, batch_transforms)
if val_loss < min_loss:
print(f"Validation loss decreased {min_loss:.6} --> {val_loss:.6}: saving state...")
model.save_weights(f'./{exp_name}/weights')
min_loss = val_loss
mb.write(f"Epoch {epoch + 1}/{args.epochs} - Validation loss: {val_loss:.6} (Acc: {acc:.2%})")
# W&B
if args.wb:
wandb.log({
'val_loss': val_loss,
'acc': acc,
})
if args.wb:
run.finish()
def parse_args():
import argparse
parser = argparse.ArgumentParser(description='DocTR training script for character classification (TensorFlow)',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('arch', type=str, help='text-recognition model to train')
parser.add_argument('--name', type=str, default=None, help='Name of your training experiment')
parser.add_argument('--epochs', type=int, default=10, help='number of epochs to train the model on')
parser.add_argument('-b', '--batch_size', type=int, default=64, help='batch size for training')
parser.add_argument('--input_size', type=int, default=32, help='input size H for the model, W = 4*H')
parser.add_argument('--lr', type=float, default=0.001, help='learning rate for the optimizer (Adam)')
parser.add_argument('-j', '--workers', type=int, default=None, help='number of workers used for dataloading')
parser.add_argument('--resume', type=str, default=None, help='Path to your checkpoint')
parser.add_argument(
'--font',
type=str,
default="FreeMono.ttf,FreeSans.ttf,FreeSerif.ttf",
help='Font family to be used'
)
parser.add_argument('--vocab', type=str, default="french", help='Vocab to be used for training')
parser.add_argument(
'--train-samples',
dest='train_samples',
type=int,
default=1000,
help='Multiplied by the vocab length gets you the number of training samples that will be used.'
)
parser.add_argument(
'--val-samples',
dest='val_samples',
type=int,
default=20,
help='Multiplied by the vocab length gets you the number of validation samples that will be used.'
)
parser.add_argument("--test-only", dest='test_only', action='store_true', help="Run the validation loop")
parser.add_argument('--show-samples', dest='show_samples', action='store_true',
help='Display unormalized training samples')
parser.add_argument('--wb', dest='wb', action='store_true',
help='Log to Weights & Biases')
parser.add_argument('--pretrained', dest='pretrained', action='store_true',
help='Load pretrained parameters before starting the training')
parser.add_argument("--amp", dest="amp", help="Use Automatic Mixed Precision", action="store_true")
parser.add_argument('--find-lr', action='store_true', help='Gridsearch the optimal LR')
args = parser.parse_args()
return args
if __name__ == "__main__":
args = parse_args()
main(args)
| 5,271 |
854 | <reponame>rakhi2001/ecom7
__________________________________________________________________________________________________
sample 11 ms submission
class Solution {
public List<String> wordSubsets(String[] A, String[] B) {
int[] count = new int[26];
for(String b : B) {
fill(b, count);
}
List<String> res = new ArrayList<String>();
for(String a : A) {
if(isAnswer(a, count)) {
res.add(a);
}
}
return res;
}
private void fill(String b, int[] count) {
int[] temp = new int[26];
for(int i = 0; i < b.length(); i++) {
char c = b.charAt(i);
int idx = c - 'a';
temp[idx]++;
count[idx] = Math.max(count[idx], temp[idx]);
}
}
private boolean isAnswer(String a, int[] count) {
int[] temp = new int[26];
for(int i = 0; i < a.length(); i++) {
char c = a.charAt(i);
temp[c - 'a']++;
}
for(int i = 0; i < count.length; i++) {
if(count[i] == 0) continue;
if(temp[i] < count[i]) {
return false;
}
}
return true;
}
}
__________________________________________________________________________________________________
sample 48748 kb submission
class Solution {
public List<String> wordSubsets(String[] A, String[] B) {
int La=A.length, i=0, j=0, Lb=B.length, L=0, t=0;
String cur;
char [] cur1;
int [] cal=new int [26], curCal;
while( i<Lb )
{
cur=B[i];
cur1=cur.toCharArray();
curCal=new int [26];
L=cur.length();
j=0;
while( j<L )
{
curCal[cur1[j]-'a']++;
j++;
}
j=0;
while( j<26 )
{
t=curCal[j];
if( t>0 && t>cal[j] )
cal[j]=t;
j++;
}
i++;
}
i=0;
List<String> l=new ArrayList<String>();
while( i<La )
{
cur=A[i];
cur1=cur.toCharArray();
curCal=new int [26];
L=cur.length();
j=0;
while( j<L )
{
curCal[cur1[j]-'a']++;
j++;
}
j=0;
while( j<26 )
{
if( curCal[j]<cal[j] )
break;
j++;
}
if( j==26 )
l.add(cur);
i++;
}
return l;
}
}
__________________________________________________________________________________________________
| 1,383 |
14,793 | <filename>weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/messagebuilder/TemplateCardBuilder.java<gh_stars>1000+
package me.chanjar.weixin.cp.bean.messagebuilder;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.cp.bean.message.WxCpMessage;
import me.chanjar.weixin.cp.bean.templatecard.*;
import java.util.List;
/**
* <pre>
* 模板卡片消息Builder
* 用法: WxCustomMessage m = WxCustomMessage.TEMPLATECARD().title(...)....toUser(...).build();
* </pre>
*
* @author yzts</a>
* @date 2019-05-16
*/
public class TemplateCardBuilder extends BaseBuilder<TemplateCardBuilder>{
/**
* 模板卡片类型,文本通知型卡片填写 “text_notice”,
* 图文展示型卡片此处填写 “news_notice”,
* 按钮交互型卡片填写”button_interaction”,
* 投票选择型卡片填写”vote_interaction”,
* 多项选择型卡片填写 “multiple_interaction”
*/
private String card_type;
/**
* 卡片来源样式信息,不需要来源样式可不填写
* 来源图片的url
*/
private String source_icon_url;
/**
* 卡片来源样式信息,不需要来源样式可不填写
* 来源图片的描述,建议不超过20个字
*/
private String source_desc;
/**
* 一级标题,建议不超过36个字
*/
private String main_title_title;
/**
* 标题辅助信息,建议不超过44个字
*/
private String main_title_desc;
/**
* 图文展示型的卡片必须有图片字段。
* 图片的url.
*/
private String card_image_url;
/**
* 图片的宽高比,宽高比要小于2.25,大于1.3,不填该参数默认1.3
*/
private Float card_image_aspect_ratio;
/**
* 关键数据样式
* 关键数据样式的数据内容,建议不超过14个字
*/
private String emphasis_content_title;
/**
* 关键数据样式的数据描述内容,建议不超过22个字
*/
private String emphasis_content_desc;
/**
* 二级普通文本,建议不超过160个字
*/
private String sub_title_text;
/**
* 卡片二级垂直内容,该字段可为空数组,但有数据的话需确认对应字段是否必填,列表长度不超过4
*/
private List<VerticalContent> vertical_contents;
/**
* 二级标题+文本列表,该字段可为空数组,但有数据的话需确认对应字段是否必填,列表长度不超过6
*/
private List<HorizontalContent> horizontal_contents;
/**
* 跳转指引样式的列表,该字段可为空数组,但有数据的话需确认对应字段是否必填,列表长度不超过3
*/
private List<TemplateCardJump> jumps;
/**
* 整体卡片的点击跳转事件,text_notice必填本字段
* 跳转事件类型,1 代表跳转url,2 代表打开小程序。text_notice卡片模版中该字段取值范围为[1,2]
*/
private Integer card_action_type;
/**
* 跳转事件的url,card_action.type是1时必填
*/
private String card_action_url;
/**
* 跳转事件的小程序的appid,必须是与当前应用关联的小程序,card_action.type是2时必填
*/
private String card_action_appid;
/**
* 跳转事件的小程序的pagepath,card_action.type是2时选填
*/
private String card_action_pagepath;
/**
* 任务id,同一个应用任务id不能重复,只能由数字、字母和“_-@”组成,最长128字节
*/
private String task_id;
/**
* 按钮交互型卡片需指定。
* 按钮列表,该字段可为空数组,但有数据的话需确认对应字段是否必填,列表长度不超过6
*/
private List<TemplateCardButton> buttons;
/**
* 投票选择型卡片需要指定
* 选择题key值,用户提交选项后,会产生回调事件,回调事件会带上该key值表示该题,最长支持1024字节
*/
private String checkbox_question_key;
/**
* 选择题模式,单选:0,多选:1,不填默认0
*/
private Integer checkbox_mode;
/**
* 选项list,选项个数不超过 20 个,最少1个
*/
private List<CheckboxOption> options;
/**
* 提交按钮样式
* 按钮文案,建议不超过10个字,不填默认为提交
*/
private String submit_button_text;
/**
* 提交按钮的key,会产生回调事件将本参数作为EventKey返回,最长支持1024字节
*/
private String submit_button_key;
/**
* 下拉式的选择器列表,multiple_interaction类型的卡片该字段不可为空,一个消息最多支持 3 个选择器
*/
private List<MultipleSelect> selects;
public TemplateCardBuilder() {
this.msgType = WxConsts.KefuMsgType.TEMPLATE_CARD;
}
public TemplateCardBuilder card_type(String card_type) {
this.card_type = card_type;
return this;
}
public TemplateCardBuilder source_icon_url(String source_icon_url) {
this.source_icon_url = source_icon_url;
return this;
}
public TemplateCardBuilder source_desc(String source_desc) {
this.source_desc = source_desc;
return this;
}
public TemplateCardBuilder main_title_title(String main_title_title) {
this.main_title_title = main_title_title;
return this;
}
public TemplateCardBuilder main_title_desc(String mainTitleDesc) {
this.main_title_desc = mainTitleDesc;
return this;
}
public TemplateCardBuilder emphasis_content_title(String emphasis_content_title) {
this.emphasis_content_title = emphasis_content_title;
return this;
}
public TemplateCardBuilder emphasis_content_desc(String emphasis_content_desc) {
this.emphasis_content_desc = emphasis_content_desc;
return this;
}
public TemplateCardBuilder sub_title_text(String sub_title_text) {
this.sub_title_text = sub_title_text;
return this;
}
public TemplateCardBuilder vertical_contents(List<VerticalContent> vertical_contents) {
this.vertical_contents = vertical_contents;
return this;
}
public TemplateCardBuilder horizontal_contents(List<HorizontalContent> horizontal_contents) {
this.horizontal_contents = horizontal_contents;
return this;
}
public TemplateCardBuilder jumps(List<TemplateCardJump> jumps) {
this.jumps = jumps;
return this;
}
public TemplateCardBuilder card_action_type(Integer card_action_type) {
this.card_action_type = card_action_type;
return this;
}
public TemplateCardBuilder card_action_url(String card_action_url) {
this.card_action_url = card_action_url;
return this;
}
public TemplateCardBuilder card_action_appid(String card_action_appid) {
this.card_action_appid = card_action_appid;
return this;
}
public TemplateCardBuilder card_action_pagepath(String card_action_pagepath) {
this.card_action_pagepath = card_action_pagepath;
return this;
}
public TemplateCardBuilder task_id(String taskId) {
this.task_id = taskId;
return this;
}
public TemplateCardBuilder buttons(List<TemplateCardButton> buttons) {
this.buttons = buttons;
return this;
}
public TemplateCardBuilder checkbox_question_key(String checkbox_question_key) {
this.checkbox_question_key = checkbox_question_key;
return this;
}
public TemplateCardBuilder checkbox_mode(Integer checkbox_mode) {
this.checkbox_mode = checkbox_mode;
return this;
}
public TemplateCardBuilder options(List<CheckboxOption> options) {
this.options = options;
return this;
}
public TemplateCardBuilder submit_button_text(String submit_button_text) {
this.submit_button_text = submit_button_text;
return this;
}
public TemplateCardBuilder submit_button_key(String submit_button_key) {
this.submit_button_key = submit_button_key;
return this;
}
public TemplateCardBuilder selects(List<MultipleSelect> selects) {
this.selects = selects;
return this;
}
@Override
public WxCpMessage build() {
WxCpMessage m = super.build();
m.setSafe(null);
m.setCard_type(this.card_type);
m.setSource_icon_url(this.source_icon_url);
m.setSource_desc(this.source_desc);
m.setMain_title_title(this.main_title_title);
m.setMain_title_desc(this.main_title_desc);
m.setCard_image_url(this.card_image_url);
m.setCard_image_aspect_ratio(this.card_image_aspect_ratio);
m.setEmphasis_content_title(this.emphasis_content_title);
m.setEmphasis_content_desc(this.emphasis_content_desc);
m.setSub_title_text(this.sub_title_text);
m.setVertical_contents(this.vertical_contents);
m.setHorizontal_contents(this.horizontal_contents);
m.setJumps(this.jumps);
m.setCard_action_type(this.card_action_type);
m.setCard_action_appid(this.card_action_appid);
m.setCard_action_pagepath(this.card_action_pagepath);
m.setCard_action_url(this.card_action_url);
m.setTaskId(this.task_id);
m.setButtons(this.buttons);
m.setCheckbox_mode(this.checkbox_mode);
m.setCheckbox_question_key(this.checkbox_question_key);
m.setOptions(this.options);
m.setSubmit_button_text(this.submit_button_text);
m.setSubmit_button_key(this.submit_button_key);
m.setSelects(this.selects);
return m;
}
}
| 4,289 |
14,668 | // Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_PERMISSIONS_LAST_TAB_STANDING_TRACKER_OBSERVER_H_
#define CHROME_BROWSER_PERMISSIONS_LAST_TAB_STANDING_TRACKER_OBSERVER_H_
#include "base/observer_list_types.h"
#include "url/origin.h"
class LastTabStandingTrackerObserver : public base::CheckedObserver {
public:
// Event fired when the last tab in a given Profile whose top-level document
// is from |origin| is closed or navigated away.
virtual void OnLastPageFromOriginClosed(const url::Origin&) = 0;
// Event fired to let the observers know that the BrowserContext is going to
// shut down.
// The observers don't need to take care of removing themselves as an
// observer.
virtual void OnShutdown() = 0;
};
#endif // CHROME_BROWSER_PERMISSIONS_LAST_TAB_STANDING_TRACKER_OBSERVER_H_
| 313 |
836 | <filename>runner/android_junit_runner/javatests/androidx/test/internal/runner/listener/ManifestListenerTest.java
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package androidx.test.internal.runner.listener;
import static org.junit.Assert.assertTrue;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;
import androidx.test.testing.fixtures.ManifestListener;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Simple test to check that specifying a <a
* href="http://junit.org/javadoc/latest/org/junit/runner/notification/RunListener.html"><code>
* RunListener</code></a> via a meta-data tag in manifest works.
*/
@RunWith(AndroidJUnit4.class)
@SmallTest
public class ManifestListenerTest {
@Test
public void testListenerInvoked() {
assertTrue(ManifestListener.isRunStarted());
}
}
| 422 |
572 | <filename>Embedding/code/Word2Vec.py
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import absolute_import
from __future__ import division
import torch
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import Dataset, DataLoader
torch.manual_seed(1)
np.random.seed(1)
word_to_ix = {"hello": 0, "world":1}
embeds = nn.Embedding(2, 5)
lookup_tensor = torch.tensor([word_to_ix["hello"]], dtype=torch.long)
hello_embed = embeds(lookup_tensor)
print(hello_embed)
"""
1. N-Gram Language Model
"""
print("N-Gram Language Model")
CONTEXT_SIZE = 2
EMBEDDING_DIM = 10
test_sentence = """When forty winters shall besiege thy brow,
And dig deep trenches in thy beauty's field,
Thy youth's proud livery so gazed on now,
Will be a totter'd weed of small worth held:
Then being asked, where all thy beauty lies,
Where all the treasure of thy lusty days;
To say, within thine own deep sunken eyes,
Were an all-eating shame, and thriftless praise.
How much more praise deserv'd thy beauty's use,
If thou couldst answer 'This fair child of mine
Shall sum my count, and make my old excuse,'
Proving his beauty by succession thine!
This were to be new made when thou art old,
And see thy blood warm when thou feel'st it cold.""".split()
# Build tuples. Each tuple is ([word_i - 2, word_i-1], target word)
trigrams = [([test_sentence[i], test_sentence[i + 1]], test_sentence[i + 2]) for i in range(len(test_sentence)-2)]
print(trigrams[:3])
vocab = set(test_sentence)
word_to_ix = { word: i for i, word in enumerate(vocab)}
class NGramLanguageModeler(nn.Module):
def __init__(self, vocab_size, embedding_dim, context_size):
super(NGramLanguageModeler, self).__init__()
self.embedding = nn.Embedding(vocab_size, embedding_dim)
self.linear1 = nn.Linear(context_size * embedding_dim, 128)
self.linear2 = nn.Linear(128, vocab_size)
def forward(self, *input):
embeds = self.embedding(input[0]).view(1, -1)
out = F.relu(self.linear1(embeds))
out = self.linear2(out)
log_probs = F.log_softmax(out, dim=1)
return log_probs
losses = []
loss_function = nn.NLLLoss()
model = NGramLanguageModeler(len(vocab), EMBEDDING_DIM, CONTEXT_SIZE)
optimizer = optim.SGD(model.parameters(), lr=0.01)
for epoch in range(10):
total_loss = 0
for context, target in trigrams:
context_idxs = torch.tensor([word_to_ix[w] for w in context], dtype=torch.long)
model.zero_grad()
log_probs = model(context_idxs)
loss = loss_function(log_probs, torch.tensor([word_to_ix[target]], dtype=torch.long))
loss.backward()
optimizer.step()
total_loss += loss
losses.append(total_loss)
print(losses)
"""
2. Continuous Bag Of Words
"""
print("CBOW")
CONTEXT_SIZE = 2 # 2 words left, 2 words right
raw_text = """We are about to study the idea of a computational process.
Computational processes are abstract beings that inhabit computers.
As they evolve, processes manipulate other abstract things called data.
The evolution of a process is directed by a pattern of rules
called a program. People create programs to direct processes. In effect,
we conjure the spirits of the computer with our spells.""".split(' ')
vocab = set(raw_text)
vocab_size = len(vocab)
word_to_ix = {word: i for i, word in enumerate(vocab)}
data = []
for i in range(2, len(raw_text) - 2):
context = [raw_text[i-2], raw_text[i-1],
raw_text[i+1], raw_text[i+2]]
target = raw_text[i]
data.append((context, target))
print(data[:5])
class CBOWNaive(nn.Module):
def __init__(self, vocab_size, embedding_dim):
super(CBOWNaive, self).__init__()
self.embedding = nn.Embedding(vocab_size, embedding_dim)
self.linear = nn.Linear(embedding_dim, vocab_size)
def forward(self, *input):
# 输入已经是context的id列表了
embeds = self.embedding(input[0]).mean(dim=0).view(1, -1)
out = self.linear(embeds)
log_probs = F.log_softmax(out, dim=1)
return log_probs
def make_context_vector(context, word_to_ix):
idxs = [word_to_ix[w] for w in context]
return torch.tensor(idxs, dtype=torch.long)
# make_context_vector(data[0][0], word_to_ix)
# Negative Log Likelihood Loss
loss_function = nn.NLLLoss()
model = CBOWNaive(vocab_size, EMBEDDING_DIM)
optimizer = optim.SGD(model.parameters(), lr=0.01)
losses = []
for epoch in range(10):
total_loss = 0.
for context, target in data:
context_ixs = make_context_vector(context, word_to_ix)
target_ix = torch.tensor([word_to_ix[target]], dtype=torch.long)
model.zero_grad()
log_probs = model(context_ixs)
loss = loss_function(log_probs, target_ix)
loss.backward()
optimizer.step()
total_loss += loss
losses.append(total_loss)
print(losses)
"""
3. SkipGram
"""
print("SkipGram Naive sample")
CONTEXT_SIZE = 2
EMBEDDING_DIM = 10
raw_data = """We are about to study the idea of a computational process.
Computational processes are abstract beings that inhabit computers.
As they evolve, processes manipulate other abstract things called data.
The evolution of a process is directed by a pattern of rules
called a program. People create programs to direct processes. In effect,
we conjure the spirits of the computer with our spells.""".split()
vocab = set(raw_data)
vocab_size = len(vocab)
word_to_ix = {word:i for i, word in enumerate(vocab)}
data = []
for ix in range(CONTEXT_SIZE, len(raw_data) - CONTEXT_SIZE):
center = raw_data[ix]
context = []
for w in range(ix-CONTEXT_SIZE, ix + CONTEXT_SIZE + 1):
if w == ix:
continue
context.append(raw_data[w])
data.append((context, center))
print(data[:5])
class SkipGramNaiveModel(nn.Module):
def __init__(self, vocab_size, embedding_size, context_size):
super(SkipGramNaiveModel, self).__init__()
self.embedding_in = nn.Embedding(vocab_size, embedding_size)
self.linear = nn.Linear(embedding_size, vocab_size)
self.context_size = context_size
def forward(self, *input):
embeds = self.embedding_in(input[0]).view(1, -1)
out = self.linear(embeds)
log_probs = F.log_softmax(out, dim=1)
return log_probs
loss_function = nn.NLLLoss()
model = SkipGramNaiveModel(vocab_size, EMBEDDING_DIM, CONTEXT_SIZE)
optimizer = optim.SGD(model.parameters(), lr=0.01)
def make_context_ixs(context, word_to_ix):
context = [word_to_ix[word] for word in context]
return torch.tensor(context, dtype=torch.long)
losses = []
for epoch in range(10):
total_loss = 0
for context, center in data:
context_ixs = make_context_ixs(context, word_to_ix)
center_ix = torch.tensor([word_to_ix[center]], dtype=torch.long)
center_ixs = center_ix.repeat(CONTEXT_SIZE)
for center, context in zip(center_ixs, context_ixs):
model.zero_grad()
log_probs = model(center.view(1))
loss = loss_function(log_probs, context.view(1))
loss.backward()
optimizer.step()
total_loss += loss
losses.append(total_loss)
print(losses)
"""
Skip-Gram Negative Sample
"""
print("Skip-gram negative sample")
# Subsample threshold
T = 1e-5
CONTEXT_SIZE = 2
EMBEDDING_DIM = 10
class PermutedSubsampleedCorpus(Dataset):
def __init__(self, data, word_sample):
self.data = []
for iword, owords in data:
if np.random.rand() > word_sample[iword]:
self.data.append((iword, owords))
def __len__(self):
return len(self.data)
def __getitem__(self, item):
iword, owords = self.data[item]
# 按列拼接形成batch的
return (iword, owords)
class SkipGramNegativeSample(nn.Module):
def __init__(self, vocab_size, embedding_size, n_negs):
super(SkipGramNegativeSample, self).__init__()
self.ivectors = nn.Embedding(vocab_size, embedding_size)
self.ovectors = nn.Embedding(vocab_size, embedding_size)
self.ivectors.weight.data.uniform_(- 0.5/embedding_size, 0.5/embedding_size)
self.ovectors.weight.data.zero_()
self.n_negs = n_negs
self.vocab_size = vocab_size
def forward(self, iwords, owords):
# iwords: (batch_size)
# owords: (batch_size, context_size * 2)
batch_size = iwords.size()[0]
context_size = owords.size()[-1] # 两边的context之和
nwords = torch.FloatTensor(batch_size, context_size * self.n_negs).uniform_(0, self.vocab_size - 1).long()
ivectors = self.ivectors(iwords).unsqueeze(2) # (batch_size, embeding_dim, 1)
ovectors = self.ovectors(owords) # (batch_size, context_size, embedding_dim)
nvectors = self.ovectors(nwords).neg() #(batch_size, context_size * n_negs, embedding_dim)
oloss = torch.bmm(ovectors, ivectors).squeeze().sigmoid().log().mean() #(batch_size)
nloss = torch.bmm(nvectors, ivectors).squeeze().sigmoid().log().view(-1, context_size, self.n_negs).sum(2).mean(1) #(batch_size)
return -(oloss + nloss).mean()
f = open("./text9", "rb+")
raw_data = f.readlines()
f.close()
raw_data = raw_data[0].split()
vocab = set(raw_data)
vocab_size = len(vocab)
word_to_ix = {word: i for i, word in enumerate(vocab)}
ix_to_word = {i: word for i, word in enumerate(vocab)}
word_count = dict()
for word in raw_data:
if word in word_count:
word_count[word] += 1
else:
word_count[word] = 0
# print(word_count)
word_frequency = np.array(list(word_count.values()))
word_frequency = word_frequency / word_frequency.sum()
word_sample = 1 - np.sqrt(T / word_frequency)
word_sample = np.clip(word_sample, 0, 1)
word_sample = {wc[0]: s for wc, s in zip(word_count.items(), word_sample)}
# print(word_sample)
data = []
for target_pos in range(CONTEXT_SIZE, len(raw_data) - CONTEXT_SIZE):
context = []
for w in range(-CONTEXT_SIZE, CONTEXT_SIZE + 1):
if w == 0:
continue
context.append(raw_data[target_pos + w])
data.append((raw_data[target_pos], context))
dataset = PermutedSubsampleedCorpus(data, word_sample)
print(dataset)
dataloader = DataLoader(dataset, batch_size=5, shuffle=False, num_workers=1)
model = SkipGramNegativeSample(vocab_size, EMBEDDING_DIM, n_negs=5)
optimizer = optim.SGD(model.parameters(), lr=0.1)
def make_context_vectors(context, word_to_ix):
context_ixs = [word_to_ix[w] for w in context]
return torch.tensor(context_ixs, dtype=torch.long)
losses = []
for epoch in range(10):
total_loss = 0
for batch_size, (iword, owords) in enumerate(dataloader):
iword = list(map(lambda x: word_to_ix[x], iword))
iword = torch.tensor(iword, dtype=torch.long)
owords = list(map(list, owords))
owords = np.array(owords).T
myfunc = np.vectorize(lambda x: word_to_ix[x])
owords = list(map(myfunc, owords))
owords = torch.tensor(owords, dtype=torch.long)
model.zero_grad()
loss = model(iword, owords)
loss.backward()
optimizer.step()
total_loss += loss
losses.append(total_loss)
print(losses)
| 4,691 |
384 | <filename>nautobot/extras/datasources/utils.py<gh_stars>100-1000
import logging
import os
from django.contrib.contenttypes.models import ContentType
from nautobot.extras.choices import LogLevelChoices
logger = logging.getLogger("nautobot.datasources.utils")
def files_from_contenttype_directories(base_path, job_result, log_grouping):
"""
Iterate over a directory structure base_path/<app_label>/<model>/ and yield the ContentType and files encountered.
Yields:
(ContentType, file_path)
"""
for app_label in os.listdir(base_path):
app_label_path = os.path.join(base_path, app_label)
if not os.path.isdir(app_label_path):
continue
for modelname in os.listdir(app_label_path):
modelname_path = os.path.join(app_label_path, modelname)
if not os.path.isdir(modelname_path):
continue
try:
model_content_type = ContentType.objects.get(app_label=app_label, model=modelname)
except ContentType.DoesNotExist:
job_result.log(
f"Skipping `{app_label}.{modelname}` as it isn't a known content type",
level_choice=LogLevelChoices.LOG_FAILURE,
grouping=log_grouping,
logger=logger,
)
continue
for filename in os.listdir(modelname_path):
yield (model_content_type, os.path.join(modelname_path, filename))
| 687 |
4,372 | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.shardingsphere.infra.metadata.schema.loader.common;
import org.junit.Test;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Map;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public final class DataTypeLoaderTest {
@Test
public void assertLoad() throws SQLException {
ResultSet resultSet = mock(ResultSet.class);
when(resultSet.next()).thenReturn(true, true, false);
when(resultSet.getString("TYPE_NAME")).thenReturn("int", "varchar");
when(resultSet.getInt("DATA_TYPE")).thenReturn(4, 12);
DatabaseMetaData databaseMetaData = mock(DatabaseMetaData.class);
when(databaseMetaData.getTypeInfo()).thenReturn(resultSet);
Map<String, Integer> actual = DataTypeLoader.load(databaseMetaData);
assertThat(actual.size(), is(2));
assertThat(actual.get("INT"), is(4));
assertThat(actual.get("VARCHAR"), is(12));
}
}
| 612 |
1,350 | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.resourcemanager.resources.fluentcore.collection;
import reactor.core.publisher.Mono;
/**
* Provides access to update a private endpoint connection.
*/
public interface SupportsUpdatingPrivateEndpointConnection {
/**
* Approves the private endpoint connection.
*
* @param privateEndpointConnectionName the name of the private endpoint connection.
*/
void approvePrivateEndpointConnection(String privateEndpointConnectionName);
/**
* Approves the private endpoint connection.
*
* @param privateEndpointConnectionName the name of the private endpoint connection.
* @return the completion.
*/
Mono<Void> approvePrivateEndpointConnectionAsync(String privateEndpointConnectionName);
/**
* Rejects the private endpoint connection.
*
* @param privateEndpointConnectionName the name of the private endpoint connection.
*/
void rejectPrivateEndpointConnection(String privateEndpointConnectionName);
/**
* Rejects the private endpoint connection.
*
* @param privateEndpointConnectionName the name of the private endpoint connection.
* @return the completion.
*/
Mono<Void> rejectPrivateEndpointConnectionAsync(String privateEndpointConnectionName);
}
| 392 |
641 | // LPC17xx specific PIO support
#include <string.h>
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
#include "platform.h"
#include "lrotable.h"
#include "platform_conf.h"
#include "auxmods.h"
#include "lpc17xx_pinsel.h"
static int configpin( lua_State* L )
{
pio_type v = ( pio_type )luaL_checkinteger( L, 1 );
int funcnum = luaL_checkinteger( L, 2 );
int opendrain = luaL_checkinteger( L, 3 );
int pinmode = luaL_checkinteger( L, 4 );
PINSEL_CFG_Type PinCfg;
int port, pin;
port = PLATFORM_IO_GET_PORT( v );
pin = PLATFORM_IO_GET_PIN( v );
if( PLATFORM_IO_IS_PORT( v ) || !platform_pio_has_port( port ) || !platform_pio_has_pin( port, pin ) )
return luaL_error( L, "invalid pin" );
PinCfg.Funcnum = funcnum;
PinCfg.OpenDrain = opendrain;
PinCfg.Pinmode = pinmode;
PinCfg.Portnum = port;
PinCfg.Pinnum = pin;
PINSEL_ConfigPin(&PinCfg);
return 0;
}
// Module function map
#define MIN_OPT_LEVEL 2
#include "lrodefs.h"
const LUA_REG_TYPE lpc17xx_pio_map[] =
{
#if LUA_OPTIMIZE_MEMORY > 0
{ LSTRKEY( "__metatable" ), LROVAL( lpc17xx_pio_map ) },
{ LSTRKEY( "RES_PULLUP" ), LNUMVAL( PINSEL_PINMODE_PULLUP )},
{ LSTRKEY( "RES_TRISTATE" ), LNUMVAL( PINSEL_PINMODE_TRISTATE )},
{ LSTRKEY( "RES_PULLDOWN" ), LNUMVAL( PINSEL_PINMODE_PULLDOWN )},
{ LSTRKEY( "FUNCTION_0" ), LNUMVAL( PINSEL_FUNC_0 )},
{ LSTRKEY( "FUNCTION_1" ), LNUMVAL( PINSEL_FUNC_1 )},
{ LSTRKEY( "FUNCTION_2" ), LNUMVAL( PINSEL_FUNC_2 )},
{ LSTRKEY( "FUNCTION_3" ), LNUMVAL( PINSEL_FUNC_3 )},
{ LSTRKEY( "MODE_DEFAULT" ), LNUMVAL( PINSEL_PINMODE_NORMAL )},
{ LSTRKEY( "MODE_OD" ), LNUMVAL( PINSEL_PINMODE_OPENDRAIN )},
#endif
{ LSTRKEY( "configpin" ), LFUNCVAL( configpin ) },
{ LNILKEY, LNILVAL }
};
LUALIB_API int luaopen_lpc17xx_pio( lua_State *L )
{
#if LUA_OPTIMIZE_MEMORY > 0
return 0;
#else
luaL_register( L, PS_LIB_TABLE_NAME, lpc17xx_pio_map );
MOD_REG_NUMBER( L, "RES_PULLUP", PINSEL_PINMODE_PULLUP );
MOD_REG_NUMBER( L, "RES_TRISTATE", PINSEL_PINMODE_TRISTATE );
MOD_REG_NUMBER( L, "RES_PULLDOWN", PINSEL_PINMODE_PULLDOWN );
MOD_REG_NUMBER( L, "FUNCTION_0", PINSEL_FUNC_0 );
MOD_REG_NUMBER( L, "FUNCTION_1", PINSEL_FUNC_1 );
MOD_REG_NUMBER( L, "FUNCTION_2", PINSEL_FUNC_2 );
MOD_REG_NUMBER( L, "FUNCTION_3", PINSEL_FUNC_3 );
MOD_REG_NUMBER( L, "MODE_DEFAULT", PINSEL_PINMODE_NORMAL );
MOD_REG_NUMBER( L, "MODE_OD", PINSEL_PINMODE_OPENDRAIN );
// Set it as its own metatable
lua_pushvalue( L, -1 );
lua_setmetatable( L, -2 );
return 1;
#endif
}
| 1,193 |
4,339 | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ignite.internal.client.thin.io.gridnioserver;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.channels.SocketChannel;
import java.util.HashMap;
import java.util.Map;
import javax.net.ssl.SSLContext;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.client.ClientConnectionException;
import org.apache.ignite.configuration.ClientConfiguration;
import org.apache.ignite.internal.client.thin.ClientSslUtils;
import org.apache.ignite.internal.client.thin.io.ClientConnection;
import org.apache.ignite.internal.client.thin.io.ClientConnectionMultiplexer;
import org.apache.ignite.internal.client.thin.io.ClientConnectionStateHandler;
import org.apache.ignite.internal.client.thin.io.ClientMessageHandler;
import org.apache.ignite.internal.util.nio.GridNioCodecFilter;
import org.apache.ignite.internal.util.nio.GridNioFilter;
import org.apache.ignite.internal.util.nio.GridNioFuture;
import org.apache.ignite.internal.util.nio.GridNioFutureImpl;
import org.apache.ignite.internal.util.nio.GridNioServer;
import org.apache.ignite.internal.util.nio.GridNioSession;
import org.apache.ignite.internal.util.nio.ssl.GridNioSslFilter;
import org.apache.ignite.logger.NullLogger;
/**
* Client connection multiplexer based on {@link org.apache.ignite.internal.util.nio.GridNioServer}.
*/
public class GridNioClientConnectionMultiplexer implements ClientConnectionMultiplexer {
/** Worker thread prefix. */
private static final String THREAD_PREFIX = "thin-client-channel";
/** */
private static final int CLIENT_MODE_PORT = -1;
/** */
private final GridNioServer<ByteBuffer> srv;
/** */
private final SSLContext sslCtx;
/**
* Constructor.
*
* @param cfg Client config.
*/
public GridNioClientConnectionMultiplexer(ClientConfiguration cfg) {
IgniteLogger gridLog = new NullLogger();
GridNioFilter[] filters;
GridNioFilter codecFilter = new GridNioCodecFilter(new GridNioClientParser(), gridLog, false);
sslCtx = ClientSslUtils.getSslContext(cfg);
if (sslCtx != null) {
GridNioSslFilter sslFilter = new GridNioSslFilter(sslCtx, true, ByteOrder.nativeOrder(), gridLog, null);
sslFilter.directMode(false);
filters = new GridNioFilter[] {codecFilter, sslFilter};
}
else
filters = new GridNioFilter[] {codecFilter};
try {
srv = GridNioServer.<ByteBuffer>builder()
.port(CLIENT_MODE_PORT)
.listener(new GridNioClientListener())
.filters(filters)
.logger(gridLog)
.selectorCount(1) // Using more selectors does not seem to improve performance.
.byteOrder(ByteOrder.nativeOrder())
.directBuffer(true)
.directMode(false)
.igniteInstanceName("thinClient")
.serverName(THREAD_PREFIX)
.idleTimeout(Long.MAX_VALUE)
.socketReceiveBufferSize(cfg.getReceiveBufferSize())
.socketSendBufferSize(cfg.getSendBufferSize())
.tcpNoDelay(true)
.build();
}
catch (IgniteCheckedException e) {
throw new IgniteException(e);
}
}
/** {@inheritDoc} */
@Override public void start() {
srv.start();
}
/** {@inheritDoc} */
@Override public void stop() {
srv.stop();
}
/** {@inheritDoc} */
@Override public ClientConnection open(InetSocketAddress addr,
ClientMessageHandler msgHnd,
ClientConnectionStateHandler stateHnd)
throws ClientConnectionException {
try {
SocketChannel ch = SocketChannel.open();
ch.socket().connect(new InetSocketAddress(addr.getHostName(), addr.getPort()), Integer.MAX_VALUE);
Map<Integer, Object> meta = new HashMap<>();
GridNioFuture<?> sslHandshakeFut = null;
if (sslCtx != null) {
sslHandshakeFut = new GridNioFutureImpl<>(null);
meta.put(GridNioSslFilter.HANDSHAKE_FUT_META_KEY, sslHandshakeFut);
}
GridNioSession ses = srv.createSession(ch, meta, false, null).get();
if (sslHandshakeFut != null)
sslHandshakeFut.get();
return new GridNioClientConnection(ses, msgHnd, stateHnd);
}
catch (Exception e) {
throw new ClientConnectionException(e.getMessage(), e);
}
}
}
| 2,296 |
619 | <reponame>moredu/upm<filename>include/fti/upm_potentiometer.h
/*
* Authors:
* Copyright (c) 2016 Intel Corporation.
*
* This program and the accompanying materials are made available under the
* terms of the The MIT License which is available at
* https://opensource.org/licenses/MIT.
*
* SPDX-License-Identifier: MIT
*/
#ifndef UPM_POTENTIOMETER_H_
#define UPM_POTENTIOMETER_H_
#ifdef __cplusplus
extern "C" {
#endif
typedef enum _upm_potentiometer_u {VOLTAGE} upm_potentiometer_u;
typedef struct _upm_potentiometer_ft {
upm_result_t (*upm_potentiometer_get_value) (void* dev, float* value, upm_potentiometer_u unit);
} upm_potentiometer_ft;
#ifdef __cplusplus
}
#endif
#endif /* UPM_POTENTIOMETER_H_ */
| 291 |
2,151 | <filename>core/java/android/util/PrefixPrinter.java
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.util;
/**
* PrefixPrinter is a Printer which prefixes all lines with a given
* prefix.
*
* @hide
*/
public class PrefixPrinter implements Printer {
private final Printer mPrinter;
private final String mPrefix;
/**
* Creates a new PrefixPrinter.
*
* <p>If prefix is null or empty, the provided printer is returned, rather
* than making a prefixing printer.
*/
public static Printer create(Printer printer, String prefix) {
if (prefix == null || prefix.equals("")) {
return printer;
}
return new PrefixPrinter(printer, prefix);
}
private PrefixPrinter(Printer printer, String prefix) {
mPrinter = printer;
mPrefix = prefix;
}
public void println(String str) {
mPrinter.println(mPrefix + str);
}
}
| 497 |
60,067 | #include <c10/util/C++17.h>
| 15 |
2,996 | // Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
package org.terasology.engine.logic.characters;
import org.terasology.engine.entitySystem.event.AbstractValueModifiableEvent;
public class AffectJumpForceEvent extends AbstractValueModifiableEvent {
public AffectJumpForceEvent(float baseValue) {
super(baseValue);
}
}
| 112 |
335 | {
"word": "Footwork",
"definitions": [
"The manner in which one moves one's feet in various sports, especially in dancing, boxing, and football.",
"Adroit response to sudden danger or new opportunities."
],
"parts-of-speech": "Noun"
} | 93 |
535 | <reponame>Nemo157/mynewt-core
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* @addtogroup OSKernel
* @{
* @defgroup OSSanity Sanity
* @{
*/
#ifndef _OS_SANITY_H
#define _OS_SANITY_H
#include <stdint.h>
#include "os/os_time.h"
#include "os/queue.h"
#ifdef __cplusplus
extern "C" {
#endif
struct os_sanity_check;
typedef int (*os_sanity_check_func_t)(struct os_sanity_check *, void *);
struct os_sanity_check {
/** Time this check last ran successfully. */
os_time_t sc_checkin_last;
/** Interval this task should check in at */
os_time_t sc_checkin_itvl;
/** Sanity check to run */
os_sanity_check_func_t sc_func;
/** Argument to pass to sanity check */
void *sc_arg;
SLIST_ENTRY(os_sanity_check) sc_next;
};
#define OS_SANITY_CHECK_SETFUNC(__sc, __f, __arg, __itvl) \
(__sc)->sc_func = (__f); \
(__sc)->sc_arg = (__arg); \
(__sc)->sc_checkin_itvl = (__itvl) * OS_TICKS_PER_SEC;
/** @cond INTERNAL_HIDDEN */
int os_sanity_init(void);
void os_sanity_run(void);
/** @endcond */
struct os_task;
/**
* Provide a "task checkin" for the sanity task.
*
* @param t The task to check in
*
* @return 0 on success, error code on failure
*/
int os_sanity_task_checkin(struct os_task *);
/**
* Initialize a sanity check
*
* @param sc The sanity check to initialize
*
* @return 0 on success, error code on failure.
*/
int os_sanity_check_init(struct os_sanity_check *);
/**
* Register a sanity check
*
* @param sc The sanity check to register
*
* @return 0 on success, error code on failure
*/
int os_sanity_check_register(struct os_sanity_check *);
/**
* Reset the os sanity check, so that it doesn't trip up the
* sanity timer.
*
* @param sc The sanity check to reset
*
* @return 0 on success, error code on failure
*/
int os_sanity_check_reset(struct os_sanity_check *);
#ifdef __cplusplus
}
#endif
#endif /* _OS_SANITY_H */
/**
* @} OSSanity
* @} OSKernel
*/
| 1,012 |
575 | <reponame>Octachron/lwt<filename>src/unix/unix_c/unix_invalidate_dir.c<gh_stars>100-1000
/* This file is part of Lwt, released under the MIT license. See LICENSE.md for
details, or visit https://github.com/ocsigen/lwt/blob/master/LICENSE.md. */
#include "lwt_config.h"
#if !defined(LWT_ON_WINDOWS)
#include <caml/memory.h>
#include <caml/mlvalues.h>
#include <caml/unixsupport.h>
#include <dirent.h>
#include <sys/types.h>
#include "lwt_unix.h"
CAMLprim value lwt_unix_invalidate_dir(value dir)
{
CAMLparam1(dir);
DIR_Val(dir) = NULL;
CAMLreturn(Val_unit);
}
#endif
| 260 |
336 | #include "platform.h"
#include "DS213HwDriver.h"
extern HwDrvDef Hw;
void SetLogic()
{
#define Mask32(adr, mask, val) *((volatile uint32_t*)adr) &= ~mask; *((volatile uint32_t*)adr) |= val;
#define Write32(adr, val) *((volatile uint32_t*)adr) = val;
Hw.pDevInit(SO_DGTL);
// PA2_T23 TIM2_CR1
Write32(0x40000000, 0x80);
// SetGpioState<GPIOA_BASE, 2, Output50MHz | OutputPushPull>();
Mask32(0x40010800, 0x0f00, 0x0300);
}
void SetLogicHigh()
{
// SetGpioLevel<GPIOA_BASE, 2, true>();
Write32(0x40010810, 1<<2);
}
void SetLogicLow()
{
// SetGpioLevel<GPIOA_BASE, 2, false>();
Write32(0x40010814, 1<<2);
}
namespace BIOS
{
namespace DAC
{
void* wave = nullptr;
int arr = 1;
int psc = 1;
int ccr = 1;
int samples = 1;
int duty = 50;
#define Hz *1
#define KHz *1000
#define MHz *1000000
void SetFrequency(int freqHz)
{
if (!wave)
{
psc = 1;
if ( freqHz <= 10 Hz )
psc = 240;
else if ( freqHz <= 2 KHz )
psc = 180;
else if ( freqHz <= 20 KHz )
psc = 18;
arr = 72000000UL / (psc + 1) / freqHz - 1;
if (arr<2)
arr = 2;
ccr = arr * duty / 100;
*Hw.pFout_TIM_PSC = psc;
*Hw.pFout_TIM_ARR = arr;
*Hw.pFout_TIM_CCR = ccr;
return;
}
psc = 20;
arr = 72000000 / 20 / freqHz - 1;
if (arr<1)
arr = 1;
*Hw.pFout_DMA_PSC = psc;
*Hw.pFout_DMA_ARR = arr;
}
void SetDuty(int dutyPercent)
{
ccr = arr * (100-dutyPercent) / 100;
*Hw.pFout_TIM_CCR = ccr;
}
int GetFrequency()
{
if (!wave)
return 72000000UL / (arr + 1) / (psc + 1);
return 72000000UL / 20 / ( arr + 1 );
}
int GetDuty()
{
return ccr * 100 / arr;
}
void SetMode(EMode mode, uint16_t* buffer, int length)
{
switch (mode)
{
case EMode::Square:
Hw.pDevInit(SGNLOUT);
Hw.pDevInit(SO_DGTL);
wave = nullptr;
samples = 0;
break;
case EMode::Buffer:
if (wave != buffer || length != samples)
{
Hw.pDevInit(SGNLOUT);
Hw.pDevInit(SO_ANLG);
Hw.pFout_DMA(DISABLE);
*Hw.pFout_DMA_CNT = length;
*Hw.pFout_DMA_CMA = (uint32_t)buffer;
*Hw.pFout_DMA_PSC = psc;
*Hw.pFout_DMA_ARR = arr;
Hw.pFout_DMA(ENABLE);
samples = length;
wave = buffer;
}
break;
case EMode::LogicHigh:
SetLogic();
SetLogicHigh();
break;
case EMode::LogicLow:
SetLogic();
SetLogicLow();
break;
default:
_ASSERT(!"Not supported");
}
}
}
}
| 1,606 |
3,893 | <filename>albumentations/augmentations/dropout/channel_dropout.py
import random
from typing import Union, Tuple, Any, Mapping
import numpy as np
from albumentations.core.transforms_interface import (
ImageOnlyTransform,
)
from .functional import channel_dropout
__all__ = ["ChannelDropout"]
class ChannelDropout(ImageOnlyTransform):
"""Randomly Drop Channels in the input Image.
Args:
channel_drop_range (int, int): range from which we choose the number of channels to drop.
fill_value (int, float): pixel value for the dropped channel.
p (float): probability of applying the transform. Default: 0.5.
Targets:
image
Image types:
uint8, uint16, unit32, float32
"""
def __init__(
self,
channel_drop_range: Tuple[int, int] = (1, 1),
fill_value: Union[int, float] = 0,
always_apply: bool = False,
p: float = 0.5,
):
super(ChannelDropout, self).__init__(always_apply, p)
self.channel_drop_range = channel_drop_range
self.min_channels = channel_drop_range[0]
self.max_channels = channel_drop_range[1]
if not 1 <= self.min_channels <= self.max_channels:
raise ValueError("Invalid channel_drop_range. Got: {}".format(channel_drop_range))
self.fill_value = fill_value
def apply(self, img: np.ndarray, channels_to_drop: Tuple[int, ...] = (0,), **params) -> np.ndarray:
return channel_dropout(img, channels_to_drop, self.fill_value)
def get_params_dependent_on_targets(self, params: Mapping[str, Any]):
img = params["image"]
num_channels = img.shape[-1]
if len(img.shape) == 2 or num_channels == 1:
raise NotImplementedError("Images has one channel. ChannelDropout is not defined.")
if self.max_channels >= num_channels:
raise ValueError("Can not drop all channels in ChannelDropout.")
num_drop_channels = random.randint(self.min_channels, self.max_channels)
channels_to_drop = random.sample(range(num_channels), k=num_drop_channels)
return {"channels_to_drop": channels_to_drop}
def get_transform_init_args_names(self) -> Tuple[str, ...]:
return "channel_drop_range", "fill_value"
@property
def targets_as_params(self):
return ["image"]
| 928 |
428 | <reponame>ilackarms/voxelquest<filename>src/glsl/WaveHeightShader.c
#version 120
varying vec2 TexCoord0;
uniform float waveSpacing;
uniform float curTime;
uniform float cameraZoom;
uniform vec3 cameraPos;
uniform vec2 bufferDim;
uniform vec2 mapDimInPixels;
// world space fbo
uniform sampler2D Texture4;
uniform sampler2D Texture5;
uniform sampler2D Texture6;
uniform sampler2D Texture7;
uniform float tiltAmount;
const float timeScale = 0.0002;
const float pi = 3.14159;
const int numWaves = 8;
float amplitude[8] = float[]( 1.0/16.0, 1.0/32.0, 1.0/2.0, 1.0/4.0, 1.0/8.0, 1.0/64.0, 1.0/128.0, 1.0/256.0 );
float wavelength[8] = float[]( 48.0/1.0, 48.0/5.0, 48.0/9.0, 48.0/19.0, 48.0/29.0, 48.0/41.0, 48.0/53.0, 48.0/68.0 );
float speed[8] = float[]( 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0);
vec2 direction[8] = vec2[](
vec2(cos(-0.7),sin(-0.7)),
vec2(cos(0.4),sin(0.4)),
vec2(cos(0.1),sin(0.1)),
vec2(cos(-0.75),sin(-0.75)),
vec2(cos(-0.2),sin(-0.2)),
vec2(cos(0.3),sin(0.3)),
vec2(cos(-0.1),sin(-0.1)),
vec2(cos(-0.25),sin(-0.25))
);
$
void main() {
TexCoord0 = gl_MultiTexCoord0.xy;// = ;//TexCoord0 = gl_MultiTexCoord0;
gl_Position = gl_Vertex;
}
$
int intMod(int lhs, int rhs) {
return lhs - ( (lhs/rhs)*rhs );
}
float unpack16(vec2 num) {
return num.r*255.0 + num.g*65280.0;
}
float wave(int i, float x, float y) {
float frequency = 2.0*pi/(wavelength[i]);// + (sin( (TexCoord0.x + TexCoord0.y)*4.0 + curTime/1000.0 ))*0.001 ;
float phase = speed[i] * frequency;
float theta = dot(direction[i], vec2(x, y));
return amplitude[i] * sin(theta * frequency + curTime*timeScale * phase);
}
float waveHeight(vec2 param) {
float x = param.x;
float y = param.y;
float height = 0.0;
for (int i = 0; i < numWaves; ++i) {
height += wave(i, x, y);
}
return height;
}
float dWavedx(int i, float x, float y) {
float frequency = 2*pi/wavelength[i];
float phase = speed[i] * frequency;
float theta = dot(direction[i], vec2(x, y));
float A = amplitude[i] * direction[i].x * frequency;
float res = A * cos(theta * frequency + curTime*timeScale * phase);
return res*2.0;
}
float dWavedy(int i, float x, float y) {
float frequency = 2*pi/wavelength[i];
float phase = speed[i] * frequency;
float theta = dot(direction[i], vec2(x, y));
float A = amplitude[i] * direction[i].y * frequency;
float res = A * cos(theta * frequency + curTime*timeScale * phase);
return res*2.0;
}
vec3 waveNormal(vec2 param) {
float x = param.x;
float y = param.y;
float dx = 0.0;
float dy = 0.0;
for (int i = 0; i < numWaves; ++i) {
dx += dWavedx(i, x, y);
dy += dWavedy(i, x, y);
}
vec3 n = vec3(-dx, -dy, 1.0);
return normalize(n);
}
void main() {
float newZoom = min(cameraZoom,1.0);
// vec4 tex4 = texture2D(Texture4, TexCoord0.xy);
// vec4 tex5 = texture2D(Texture5, TexCoord0.xy);
// vec4 tex6 = texture2D(Texture6, TexCoord0.xy);
vec4 tex7 = texture2D(Texture7, TexCoord0.xy);
vec3 worldPosition = tex7.xyz;
// vec2 tcMod = (vec2(TexCoord0.x,1.0-TexCoord0.y)*2.0-1.0 );
// tcMod.x *= bufferDim.x/(newZoom);
// tcMod.y *= bufferDim.y/(newZoom);
// tcMod.y -= cameraPos.z;
// vec3 worldPosition = vec3(0.0,0.0,0.0);
// worldPosition.x = tcMod.y + tcMod.x/2.0;
// worldPosition.y = tcMod.y - tcMod.x/2.0;
// worldPosition.x += cameraPos.x;
// worldPosition.y += cameraPos.y;
// worldPosition.z = 0.0;
// float tilt = tiltAmount;
// float itilt = 1.0-tiltAmount;
// float baseHeight = 0.0;
// vec3 worldPosition = vec3(0.0,0.0,0.0);
// vec2 ssCoord = vec2(0.0);
// ssCoord = vec2(TexCoord0.x,1.0-TexCoord0.y)*2.0-1.0;
// ssCoord.x *= bufferDim.x/(newZoom);
// ssCoord.y *= bufferDim.y/(newZoom);
// ssCoord.y -= cameraPos.z*tilt*2.0;
// ssCoord.y += baseHeight*tilt*2.0;
// worldPosition.x = (ssCoord.y*0.5/itilt + ssCoord.x*0.5);
// worldPosition.y = (ssCoord.y*0.5/itilt - ssCoord.x*0.5);
// worldPosition.z = baseHeight;
// worldPosition.x += cameraPos.x;
// worldPosition.y += cameraPos.y;
vec2 newPos = worldPosition.xy/waveSpacing;
// float wm = mix(
// abs(
// sin(
// (curTime)/500.0 + (TexCoord0.x + TexCoord0.y) * 12.0
// )
// ),
// 0.25,
// 1.0
// )*2.0;
float waveh = (waveHeight(newPos) )*0.5+0.5;
vec3 waven = (normalize( waveNormal(newPos) )+1.0)/2.0;
gl_FragData[0] = vec4(waven,waveh);
}
| 2,287 |
432 | <reponame>lambdaxymox/DragonFlyBSD<gh_stars>100-1000
/* Shrink-wrapping related optimizations.
Copyright (C) 1987-2018 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
/* This file handles shrink-wrapping related optimizations. */
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "backend.h"
#include "target.h"
#include "rtl.h"
#include "tree.h"
#include "cfghooks.h"
#include "df.h"
#include "memmodel.h"
#include "tm_p.h"
#include "regs.h"
#include "insn-config.h"
#include "emit-rtl.h"
#include "output.h"
#include "tree-pass.h"
#include "cfgrtl.h"
#include "cfgbuild.h"
#include "params.h"
#include "bb-reorder.h"
#include "shrink-wrap.h"
#include "regcprop.h"
#include "rtl-iter.h"
#include "valtrack.h"
/* Return true if INSN requires the stack frame to be set up.
PROLOGUE_USED contains the hard registers used in the function
prologue. SET_UP_BY_PROLOGUE is the set of registers we expect the
prologue to set up for the function. */
bool
requires_stack_frame_p (rtx_insn *insn, HARD_REG_SET prologue_used,
HARD_REG_SET set_up_by_prologue)
{
df_ref def, use;
HARD_REG_SET hardregs;
unsigned regno;
if (CALL_P (insn))
return !SIBLING_CALL_P (insn);
/* We need a frame to get the unique CFA expected by the unwinder. */
if (cfun->can_throw_non_call_exceptions && can_throw_internal (insn))
return true;
CLEAR_HARD_REG_SET (hardregs);
FOR_EACH_INSN_DEF (def, insn)
{
rtx dreg = DF_REF_REG (def);
if (!REG_P (dreg))
continue;
add_to_hard_reg_set (&hardregs, GET_MODE (dreg), REGNO (dreg));
}
if (hard_reg_set_intersect_p (hardregs, prologue_used))
return true;
AND_COMPL_HARD_REG_SET (hardregs, call_used_reg_set);
for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
if (TEST_HARD_REG_BIT (hardregs, regno)
&& df_regs_ever_live_p (regno))
return true;
FOR_EACH_INSN_USE (use, insn)
{
rtx reg = DF_REF_REG (use);
if (!REG_P (reg))
continue;
add_to_hard_reg_set (&hardregs, GET_MODE (reg),
REGNO (reg));
}
if (hard_reg_set_intersect_p (hardregs, set_up_by_prologue))
return true;
return false;
}
/* See whether there has a single live edge from BB, which dest uses
[REGNO, END_REGNO). Return the live edge if its dest bb has
one or two predecessors. Otherwise return NULL. */
static edge
live_edge_for_reg (basic_block bb, int regno, int end_regno)
{
edge e, live_edge;
edge_iterator ei;
bitmap live;
int i;
live_edge = NULL;
FOR_EACH_EDGE (e, ei, bb->succs)
{
live = df_get_live_in (e->dest);
for (i = regno; i < end_regno; i++)
if (REGNO_REG_SET_P (live, i))
{
if (live_edge && live_edge != e)
return NULL;
live_edge = e;
}
}
/* We can sometimes encounter dead code. Don't try to move it
into the exit block. */
if (!live_edge || live_edge->dest == EXIT_BLOCK_PTR_FOR_FN (cfun))
return NULL;
/* Reject targets of abnormal edges. This is needed for correctness
on ports like Alpha and MIPS, whose pic_offset_table_rtx can die on
exception edges even though it is generally treated as call-saved
for the majority of the compilation. Moving across abnormal edges
isn't going to be interesting for shrink-wrap usage anyway. */
if (live_edge->flags & EDGE_ABNORMAL)
return NULL;
/* When live_edge->dest->preds == 2, we can create a new block on
the edge to make it meet the requirement. */
if (EDGE_COUNT (live_edge->dest->preds) > 2)
return NULL;
return live_edge;
}
/* Try to move INSN from BB to a successor. Return true on success.
USES and DEFS are the set of registers that are used and defined
after INSN in BB. SPLIT_P indicates whether a live edge from BB
is splitted or not. */
static bool
move_insn_for_shrink_wrap (basic_block bb, rtx_insn *insn,
const HARD_REG_SET uses,
const HARD_REG_SET defs,
bool *split_p,
struct dead_debug_local *debug)
{
rtx set, src, dest;
bitmap live_out, live_in, bb_uses = NULL, bb_defs = NULL;
unsigned int i, dregno, end_dregno;
unsigned int sregno = FIRST_PSEUDO_REGISTER;
unsigned int end_sregno = FIRST_PSEUDO_REGISTER;
basic_block next_block;
edge live_edge;
rtx_insn *dinsn;
df_ref def;
/* Look for a simple register assignment. We don't use single_set here
because we can't deal with any CLOBBERs, USEs, or REG_UNUSED secondary
destinations. */
if (!INSN_P (insn))
return false;
set = PATTERN (insn);
if (GET_CODE (set) != SET)
return false;
src = SET_SRC (set);
dest = SET_DEST (set);
/* For the destination, we want only a register. Also disallow STACK
or FRAME related adjustments. They are likely part of the prologue,
so keep them in the entry block. */
if (!REG_P (dest)
|| dest == stack_pointer_rtx
|| dest == frame_pointer_rtx
|| dest == hard_frame_pointer_rtx)
return false;
/* For the source, we want one of:
(1) A (non-overlapping) register
(2) A constant,
(3) An expression involving no more than one register.
That last point comes from the code following, which was originally
written to handle only register move operations, and still only handles
a single source register when checking for overlaps. Happily, the
same checks can be applied to expressions like (plus reg const). */
if (CONSTANT_P (src))
;
else if (!REG_P (src))
{
rtx src_inner = NULL_RTX;
if (can_throw_internal (insn))
return false;
subrtx_var_iterator::array_type array;
FOR_EACH_SUBRTX_VAR (iter, array, src, ALL)
{
rtx x = *iter;
switch (GET_RTX_CLASS (GET_CODE (x)))
{
case RTX_CONST_OBJ:
case RTX_COMPARE:
case RTX_COMM_COMPARE:
case RTX_BIN_ARITH:
case RTX_COMM_ARITH:
case RTX_UNARY:
case RTX_TERNARY:
/* Constant or expression. Continue. */
break;
case RTX_OBJ:
case RTX_EXTRA:
switch (GET_CODE (x))
{
case UNSPEC:
case SUBREG:
case STRICT_LOW_PART:
case PC:
case LO_SUM:
/* Ok. Continue. */
break;
case REG:
/* Fail if we see a second inner register. */
if (src_inner != NULL)
return false;
src_inner = x;
break;
default:
return false;
}
break;
default:
return false;
}
}
if (src_inner != NULL)
src = src_inner;
}
/* Make sure that the source register isn't defined later in BB. */
if (REG_P (src))
{
sregno = REGNO (src);
end_sregno = END_REGNO (src);
if (overlaps_hard_reg_set_p (defs, GET_MODE (src), sregno))
return false;
}
/* Make sure that the destination register isn't referenced later in BB. */
dregno = REGNO (dest);
end_dregno = END_REGNO (dest);
if (overlaps_hard_reg_set_p (uses, GET_MODE (dest), dregno)
|| overlaps_hard_reg_set_p (defs, GET_MODE (dest), dregno))
return false;
/* See whether there is a successor block to which we could move INSN. */
live_edge = live_edge_for_reg (bb, dregno, end_dregno);
if (!live_edge)
return false;
next_block = live_edge->dest;
/* Create a new basic block on the edge. */
if (EDGE_COUNT (next_block->preds) == 2)
{
/* split_edge for a block with only one successor is meaningless. */
if (EDGE_COUNT (bb->succs) == 1)
return false;
/* If DF_LIVE doesn't exist, i.e. at -O1, just give up. */
if (!df_live)
return false;
basic_block old_dest = live_edge->dest;
next_block = split_edge (live_edge);
/* We create a new basic block. Call df_grow_bb_info to make sure
all data structures are allocated. */
df_grow_bb_info (df_live);
bitmap_and (df_get_live_in (next_block), df_get_live_out (bb),
df_get_live_in (old_dest));
df_set_bb_dirty (next_block);
/* We should not split more than once for a function. */
if (*split_p)
return false;
*split_p = true;
}
/* At this point we are committed to moving INSN, but let's try to
move it as far as we can. */
do
{
if (MAY_HAVE_DEBUG_BIND_INSNS)
{
FOR_BB_INSNS_REVERSE (bb, dinsn)
if (DEBUG_BIND_INSN_P (dinsn))
{
df_ref use;
FOR_EACH_INSN_USE (use, dinsn)
if (refers_to_regno_p (dregno, end_dregno,
DF_REF_REG (use), (rtx *) NULL))
dead_debug_add (debug, use, DF_REF_REGNO (use));
}
else if (dinsn == insn)
break;
}
live_out = df_get_live_out (bb);
live_in = df_get_live_in (next_block);
bb = next_block;
/* Check whether BB uses DEST or clobbers DEST. We need to add
INSN to BB if so. Either way, DEST is no longer live on entry,
except for any part that overlaps SRC (next loop). */
if (!*split_p)
{
bb_uses = &DF_LR_BB_INFO (bb)->use;
bb_defs = &DF_LR_BB_INFO (bb)->def;
}
if (df_live)
{
for (i = dregno; i < end_dregno; i++)
{
if (*split_p
|| REGNO_REG_SET_P (bb_uses, i)
|| REGNO_REG_SET_P (bb_defs, i)
|| REGNO_REG_SET_P (&DF_LIVE_BB_INFO (bb)->gen, i))
next_block = NULL;
CLEAR_REGNO_REG_SET (live_out, i);
CLEAR_REGNO_REG_SET (live_in, i);
}
/* Check whether BB clobbers SRC. We need to add INSN to BB if so.
Either way, SRC is now live on entry. */
for (i = sregno; i < end_sregno; i++)
{
if (*split_p
|| REGNO_REG_SET_P (bb_defs, i)
|| REGNO_REG_SET_P (&DF_LIVE_BB_INFO (bb)->gen, i))
next_block = NULL;
SET_REGNO_REG_SET (live_out, i);
SET_REGNO_REG_SET (live_in, i);
}
}
else
{
/* DF_LR_BB_INFO (bb)->def does not comprise the DF_REF_PARTIAL and
DF_REF_CONDITIONAL defs. So if DF_LIVE doesn't exist, i.e.
at -O1, just give up searching NEXT_BLOCK. */
next_block = NULL;
for (i = dregno; i < end_dregno; i++)
{
CLEAR_REGNO_REG_SET (live_out, i);
CLEAR_REGNO_REG_SET (live_in, i);
}
for (i = sregno; i < end_sregno; i++)
{
SET_REGNO_REG_SET (live_out, i);
SET_REGNO_REG_SET (live_in, i);
}
}
/* If we don't need to add the move to BB, look for a single
successor block. */
if (next_block)
{
live_edge = live_edge_for_reg (next_block, dregno, end_dregno);
if (!live_edge || EDGE_COUNT (live_edge->dest->preds) > 1)
break;
next_block = live_edge->dest;
}
}
while (next_block);
/* For the new created basic block, there is no dataflow info at all.
So skip the following dataflow update and check. */
if (!(*split_p))
{
/* BB now defines DEST. It only uses the parts of DEST that overlap SRC
(next loop). */
for (i = dregno; i < end_dregno; i++)
{
CLEAR_REGNO_REG_SET (bb_uses, i);
SET_REGNO_REG_SET (bb_defs, i);
}
/* BB now uses SRC. */
for (i = sregno; i < end_sregno; i++)
SET_REGNO_REG_SET (bb_uses, i);
}
/* Insert debug temps for dead REGs used in subsequent debug insns. */
if (debug->used && !bitmap_empty_p (debug->used))
FOR_EACH_INSN_DEF (def, insn)
dead_debug_insert_temp (debug, DF_REF_REGNO (def), insn,
DEBUG_TEMP_BEFORE_WITH_VALUE);
emit_insn_after (PATTERN (insn), bb_note (bb));
delete_insn (insn);
return true;
}
/* Look for register copies in the first block of the function, and move
them down into successor blocks if the register is used only on one
path. This exposes more opportunities for shrink-wrapping. These
kinds of sets often occur when incoming argument registers are moved
to call-saved registers because their values are live across one or
more calls during the function. */
static void
prepare_shrink_wrap (basic_block entry_block)
{
rtx_insn *insn, *curr;
rtx x;
HARD_REG_SET uses, defs;
df_ref def, use;
bool split_p = false;
unsigned int i;
struct dead_debug_local debug;
if (JUMP_P (BB_END (entry_block)))
{
/* To have more shrink-wrapping opportunities, prepare_shrink_wrap tries
to sink the copies from parameter to callee saved register out of
entry block. copyprop_hardreg_forward_bb_without_debug_insn is called
to release some dependences. */
copyprop_hardreg_forward_bb_without_debug_insn (entry_block);
}
dead_debug_local_init (&debug, NULL, NULL);
CLEAR_HARD_REG_SET (uses);
CLEAR_HARD_REG_SET (defs);
FOR_BB_INSNS_REVERSE_SAFE (entry_block, insn, curr)
if (NONDEBUG_INSN_P (insn)
&& !move_insn_for_shrink_wrap (entry_block, insn, uses, defs,
&split_p, &debug))
{
/* Add all defined registers to DEFs. */
FOR_EACH_INSN_DEF (def, insn)
{
x = DF_REF_REG (def);
if (REG_P (x) && HARD_REGISTER_P (x))
for (i = REGNO (x); i < END_REGNO (x); i++)
SET_HARD_REG_BIT (defs, i);
}
/* Add all used registers to USESs. */
FOR_EACH_INSN_USE (use, insn)
{
x = DF_REF_REG (use);
if (REG_P (x) && HARD_REGISTER_P (x))
for (i = REGNO (x); i < END_REGNO (x); i++)
SET_HARD_REG_BIT (uses, i);
}
}
dead_debug_local_finish (&debug, NULL);
}
/* Return whether basic block PRO can get the prologue. It can not if it
has incoming complex edges that need a prologue inserted (we make a new
block for the prologue, so those edges would need to be redirected, which
does not work). It also can not if there exist registers live on entry
to PRO that are clobbered by the prologue. */
static bool
can_get_prologue (basic_block pro, HARD_REG_SET prologue_clobbered)
{
edge e;
edge_iterator ei;
FOR_EACH_EDGE (e, ei, pro->preds)
if (e->flags & (EDGE_COMPLEX | EDGE_CROSSING)
&& !dominated_by_p (CDI_DOMINATORS, e->src, pro))
return false;
HARD_REG_SET live;
REG_SET_TO_HARD_REG_SET (live, df_get_live_in (pro));
if (hard_reg_set_intersect_p (live, prologue_clobbered))
return false;
return true;
}
/* Return whether we can duplicate basic block BB for shrink wrapping. We
cannot if the block cannot be duplicated at all, or if any of its incoming
edges are complex and come from a block that does not require a prologue
(we cannot redirect such edges), or if the block is too big to copy.
PRO is the basic block before which we would put the prologue, MAX_SIZE is
the maximum size block we allow to be copied. */
static bool
can_dup_for_shrink_wrapping (basic_block bb, basic_block pro, unsigned max_size)
{
if (!can_duplicate_block_p (bb))
return false;
edge e;
edge_iterator ei;
FOR_EACH_EDGE (e, ei, bb->preds)
if (e->flags & (EDGE_COMPLEX | EDGE_CROSSING)
&& !dominated_by_p (CDI_DOMINATORS, e->src, pro))
return false;
unsigned size = 0;
rtx_insn *insn;
FOR_BB_INSNS (bb, insn)
if (NONDEBUG_INSN_P (insn))
{
size += get_attr_min_length (insn);
if (size > max_size)
return false;
}
return true;
}
/* Do whatever needs to be done for exits that run without prologue.
Sibcalls need nothing done. Normal exits get a simple_return inserted. */
static void
handle_simple_exit (edge e)
{
if (e->flags & EDGE_SIBCALL)
{
/* Tell function.c to take no further action on this edge. */
e->flags |= EDGE_IGNORE;
e->flags &= ~EDGE_FALLTHRU;
emit_barrier_after_bb (e->src);
return;
}
/* If the basic block the edge comes from has multiple successors,
split the edge. */
if (EDGE_COUNT (e->src->succs) > 1)
{
basic_block old_bb = e->src;
rtx_insn *end = BB_END (old_bb);
rtx_note *note = emit_note_after (NOTE_INSN_DELETED, end);
basic_block new_bb = create_basic_block (note, note, old_bb);
BB_COPY_PARTITION (new_bb, old_bb);
BB_END (old_bb) = end;
redirect_edge_succ (e, new_bb);
new_bb->count = e->count ();
e->flags |= EDGE_FALLTHRU;
e = make_single_succ_edge (new_bb, EXIT_BLOCK_PTR_FOR_FN (cfun), 0);
}
e->flags &= ~EDGE_FALLTHRU;
rtx_jump_insn *ret = emit_jump_insn_after (targetm.gen_simple_return (),
BB_END (e->src));
JUMP_LABEL (ret) = simple_return_rtx;
emit_barrier_after_bb (e->src);
if (dump_file)
fprintf (dump_file, "Made simple_return with UID %d in bb %d\n",
INSN_UID (ret), e->src->index);
}
/* Try to perform a kind of shrink-wrapping, making sure the
prologue/epilogue is emitted only around those parts of the
function that require it.
There will be exactly one prologue, and it will be executed either
zero or one time, on any path. Depending on where the prologue is
placed, some of the basic blocks can be reached via both paths with
and without a prologue. Such blocks will be duplicated here, and the
edges changed to match.
Paths that go to the exit without going through the prologue will use
a simple_return instead of the epilogue. We maximize the number of
those, making sure to only duplicate blocks that can be duplicated.
If the prologue can then still be placed in multiple locations, we
place it as early as possible.
An example, where we duplicate blocks with control flow (legend:
_B_egin, _R_eturn and _S_imple_return; edges without arrowhead should
be taken to point down or to the right, to simplify the diagram; here,
block 3 needs a prologue, the rest does not):
B B
| |
2 2
|\ |\
| 3 becomes | 3
|/ | \
4 7 4
|\ |\ |\
| 5 | 8 | 5
|/ |/ |/
6 9 6
| | |
R S R
(bb 4 is duplicated to 7, and so on; the prologue is inserted on the
edge 2->3).
Another example, where part of a loop is duplicated (again, bb 3 is
the only block that needs a prologue):
B 3<-- B ->3<--
| | | | | | |
| v | becomes | | v |
2---4--- 2---5-- 4---
| | |
R S R
(bb 4 is duplicated to 5; the prologue is inserted on the edge 5->3).
ENTRY_EDGE is the edge where the prologue will be placed, possibly
changed by this function. PROLOGUE_SEQ is the prologue we will insert. */
void
try_shrink_wrapping (edge *entry_edge, rtx_insn *prologue_seq)
{
/* If we cannot shrink-wrap, are told not to shrink-wrap, or it makes
no sense to shrink-wrap: then do not shrink-wrap! */
if (!SHRINK_WRAPPING_ENABLED)
return;
if (crtl->profile && !targetm.profile_before_prologue ())
return;
if (crtl->calls_eh_return)
return;
bool empty_prologue = true;
for (rtx_insn *insn = prologue_seq; insn; insn = NEXT_INSN (insn))
if (!(NOTE_P (insn) && NOTE_KIND (insn) == NOTE_INSN_PROLOGUE_END))
{
empty_prologue = false;
break;
}
if (empty_prologue)
return;
/* Move some code down to expose more shrink-wrapping opportunities. */
basic_block entry = (*entry_edge)->dest;
prepare_shrink_wrap (entry);
if (dump_file)
fprintf (dump_file, "Attempting shrink-wrapping optimization.\n");
/* Compute the registers set and used in the prologue. */
HARD_REG_SET prologue_clobbered, prologue_used;
CLEAR_HARD_REG_SET (prologue_clobbered);
CLEAR_HARD_REG_SET (prologue_used);
for (rtx_insn *insn = prologue_seq; insn; insn = NEXT_INSN (insn))
if (NONDEBUG_INSN_P (insn))
{
HARD_REG_SET this_used;
CLEAR_HARD_REG_SET (this_used);
note_uses (&PATTERN (insn), record_hard_reg_uses, &this_used);
AND_COMPL_HARD_REG_SET (this_used, prologue_clobbered);
IOR_HARD_REG_SET (prologue_used, this_used);
note_stores (PATTERN (insn), record_hard_reg_sets, &prologue_clobbered);
}
CLEAR_HARD_REG_BIT (prologue_clobbered, STACK_POINTER_REGNUM);
if (frame_pointer_needed)
CLEAR_HARD_REG_BIT (prologue_clobbered, HARD_FRAME_POINTER_REGNUM);
/* Find out what registers are set up by the prologue; any use of these
cannot happen before the prologue. */
struct hard_reg_set_container set_up_by_prologue;
CLEAR_HARD_REG_SET (set_up_by_prologue.set);
add_to_hard_reg_set (&set_up_by_prologue.set, Pmode, STACK_POINTER_REGNUM);
add_to_hard_reg_set (&set_up_by_prologue.set, Pmode, ARG_POINTER_REGNUM);
if (frame_pointer_needed)
add_to_hard_reg_set (&set_up_by_prologue.set, Pmode,
HARD_FRAME_POINTER_REGNUM);
if (pic_offset_table_rtx
&& (unsigned) PIC_OFFSET_TABLE_REGNUM != INVALID_REGNUM)
add_to_hard_reg_set (&set_up_by_prologue.set, Pmode,
PIC_OFFSET_TABLE_REGNUM);
if (crtl->drap_reg)
add_to_hard_reg_set (&set_up_by_prologue.set,
GET_MODE (crtl->drap_reg),
REGNO (crtl->drap_reg));
if (targetm.set_up_by_prologue)
targetm.set_up_by_prologue (&set_up_by_prologue);
/* We will insert the prologue before the basic block PRO. PRO should
dominate all basic blocks that need the prologue to be executed
before them. First, make PRO the "tightest wrap" possible. */
calculate_dominance_info (CDI_DOMINATORS);
basic_block pro = 0;
basic_block bb;
edge e;
edge_iterator ei;
FOR_EACH_BB_FN (bb, cfun)
{
rtx_insn *insn;
FOR_BB_INSNS (bb, insn)
if (NONDEBUG_INSN_P (insn)
&& requires_stack_frame_p (insn, prologue_used,
set_up_by_prologue.set))
{
if (dump_file)
fprintf (dump_file, "Block %d needs the prologue.\n", bb->index);
pro = nearest_common_dominator (CDI_DOMINATORS, pro, bb);
break;
}
}
/* If nothing needs a prologue, just put it at the start. This really
shouldn't happen, but we cannot fix it here. */
if (pro == 0)
{
if (dump_file)
fprintf(dump_file, "Nothing needs a prologue, but it isn't empty; "
"putting it at the start.\n");
pro = entry;
}
if (dump_file)
fprintf (dump_file, "After wrapping required blocks, PRO is now %d\n",
pro->index);
/* Now see if we can put the prologue at the start of PRO. Putting it
there might require duplicating a block that cannot be duplicated,
or in some cases we cannot insert the prologue there at all. If PRO
wont't do, try again with the immediate dominator of PRO, and so on.
The blocks that need duplicating are those reachable from PRO but
not dominated by it. We keep in BB_WITH a bitmap of the blocks
reachable from PRO that we already found, and in VEC a stack of
those we still need to consider (to find successors). */
auto_bitmap bb_with;
bitmap_set_bit (bb_with, pro->index);
vec<basic_block> vec;
vec.create (n_basic_blocks_for_fn (cfun));
vec.quick_push (pro);
unsigned max_grow_size = get_uncond_jump_length ();
max_grow_size *= PARAM_VALUE (PARAM_MAX_GROW_COPY_BB_INSNS);
while (!vec.is_empty () && pro != entry)
{
while (pro != entry && !can_get_prologue (pro, prologue_clobbered))
{
pro = get_immediate_dominator (CDI_DOMINATORS, pro);
if (bitmap_set_bit (bb_with, pro->index))
vec.quick_push (pro);
}
basic_block bb = vec.pop ();
if (!can_dup_for_shrink_wrapping (bb, pro, max_grow_size))
while (!dominated_by_p (CDI_DOMINATORS, bb, pro))
{
gcc_assert (pro != entry);
pro = get_immediate_dominator (CDI_DOMINATORS, pro);
if (bitmap_set_bit (bb_with, pro->index))
vec.quick_push (pro);
}
FOR_EACH_EDGE (e, ei, bb->succs)
if (e->dest != EXIT_BLOCK_PTR_FOR_FN (cfun)
&& bitmap_set_bit (bb_with, e->dest->index))
vec.quick_push (e->dest);
}
if (dump_file)
fprintf (dump_file, "Avoiding non-duplicatable blocks, PRO is now %d\n",
pro->index);
/* If we can move PRO back without having to duplicate more blocks, do so.
We do this because putting the prologue earlier is better for scheduling.
We can move back to a block PRE if every path from PRE will eventually
need a prologue, that is, PRO is a post-dominator of PRE. PRE needs
to dominate every block reachable from itself. We keep in BB_TMP a
bitmap of the blocks reachable from PRE that we already found, and in
VEC a stack of those we still need to consider.
Any block reachable from PRE is also reachable from all predecessors
of PRE, so if we find we need to move PRE back further we can leave
everything not considered so far on the stack. Any block dominated
by PRE is also dominated by all other dominators of PRE, so anything
found good for some PRE does not need to be reconsidered later.
We don't need to update BB_WITH because none of the new blocks found
can jump to a block that does not need the prologue. */
if (pro != entry)
{
calculate_dominance_info (CDI_POST_DOMINATORS);
auto_bitmap bb_tmp;
bitmap_copy (bb_tmp, bb_with);
basic_block last_ok = pro;
vec.truncate (0);
while (pro != entry)
{
basic_block pre = get_immediate_dominator (CDI_DOMINATORS, pro);
if (!dominated_by_p (CDI_POST_DOMINATORS, pre, pro))
break;
if (bitmap_set_bit (bb_tmp, pre->index))
vec.quick_push (pre);
bool ok = true;
while (!vec.is_empty ())
{
if (!dominated_by_p (CDI_DOMINATORS, vec.last (), pre))
{
ok = false;
break;
}
basic_block bb = vec.pop ();
FOR_EACH_EDGE (e, ei, bb->succs)
if (bitmap_set_bit (bb_tmp, e->dest->index))
vec.quick_push (e->dest);
}
if (ok && can_get_prologue (pre, prologue_clobbered))
last_ok = pre;
pro = pre;
}
pro = last_ok;
free_dominance_info (CDI_POST_DOMINATORS);
}
vec.release ();
if (dump_file)
fprintf (dump_file, "Bumping back to anticipatable blocks, PRO is now %d\n",
pro->index);
if (pro == entry)
{
free_dominance_info (CDI_DOMINATORS);
return;
}
/* Compute what fraction of the frequency and count of the blocks that run
both with and without prologue are for running with prologue. This gives
the correct answer for reducible flow graphs; for irreducible flow graphs
our profile is messed up beyond repair anyway. */
profile_count num = profile_count::zero ();
profile_count den = profile_count::zero ();
FOR_EACH_EDGE (e, ei, pro->preds)
if (!dominated_by_p (CDI_DOMINATORS, e->src, pro))
{
if (e->count ().initialized_p ())
num += e->count ();
if (e->src->count.initialized_p ())
den += e->src->count;
}
/* All is okay, so do it. */
crtl->shrink_wrapped = true;
if (dump_file)
fprintf (dump_file, "Performing shrink-wrapping.\n");
/* Copy the blocks that can run both with and without prologue. The
originals run with prologue, the copies without. Store a pointer to
the copy in the ->aux field of the original. */
FOR_EACH_BB_FN (bb, cfun)
if (bitmap_bit_p (bb_with, bb->index)
&& !dominated_by_p (CDI_DOMINATORS, bb, pro))
{
basic_block dup = duplicate_block (bb, 0, 0);
bb->aux = dup;
if (JUMP_P (BB_END (dup)) && !any_condjump_p (BB_END (dup)))
emit_barrier_after_bb (dup);
if (EDGE_COUNT (dup->succs) == 0)
emit_barrier_after_bb (dup);
if (dump_file)
fprintf (dump_file, "Duplicated %d to %d\n", bb->index, dup->index);
if (num == profile_count::zero () || den.nonzero_p ())
bb->count = bb->count.apply_scale (num, den);
dup->count -= bb->count;
}
/* Now change the edges to point to the copies, where appropriate. */
FOR_EACH_BB_FN (bb, cfun)
if (!dominated_by_p (CDI_DOMINATORS, bb, pro))
{
basic_block src = bb;
if (bitmap_bit_p (bb_with, bb->index))
src = (basic_block) bb->aux;
FOR_EACH_EDGE (e, ei, src->succs)
{
if (e->dest == EXIT_BLOCK_PTR_FOR_FN (cfun))
continue;
if (bitmap_bit_p (bb_with, e->dest->index)
&& !dominated_by_p (CDI_DOMINATORS, e->dest, pro))
{
if (dump_file)
fprintf (dump_file, "Redirecting edge %d->%d to %d\n",
e->src->index, e->dest->index,
((basic_block) e->dest->aux)->index);
redirect_edge_and_branch_force (e, (basic_block) e->dest->aux);
}
else if (e->flags & EDGE_FALLTHRU
&& bitmap_bit_p (bb_with, bb->index))
force_nonfallthru (e);
}
}
/* Also redirect the function entry edge if necessary. */
FOR_EACH_EDGE (e, ei, ENTRY_BLOCK_PTR_FOR_FN (cfun)->succs)
if (bitmap_bit_p (bb_with, e->dest->index)
&& !dominated_by_p (CDI_DOMINATORS, e->dest, pro))
{
basic_block split_bb = split_edge (e);
e = single_succ_edge (split_bb);
redirect_edge_and_branch_force (e, (basic_block) e->dest->aux);
}
/* Make a simple_return for those exits that run without prologue. */
FOR_EACH_BB_REVERSE_FN (bb, cfun)
if (!bitmap_bit_p (bb_with, bb->index))
FOR_EACH_EDGE (e, ei, bb->succs)
if (e->dest == EXIT_BLOCK_PTR_FOR_FN (cfun))
handle_simple_exit (e);
/* Finally, we want a single edge to put the prologue on. Make a new
block before the PRO block; the edge beteen them is the edge we want.
Then redirect those edges into PRO that come from blocks without the
prologue, to point to the new block instead. The new prologue block
is put at the end of the insn chain. */
basic_block new_bb = create_empty_bb (EXIT_BLOCK_PTR_FOR_FN (cfun)->prev_bb);
BB_COPY_PARTITION (new_bb, pro);
new_bb->count = profile_count::zero ();
if (dump_file)
fprintf (dump_file, "Made prologue block %d\n", new_bb->index);
for (ei = ei_start (pro->preds); (e = ei_safe_edge (ei)); )
{
if (bitmap_bit_p (bb_with, e->src->index)
|| dominated_by_p (CDI_DOMINATORS, e->src, pro))
{
ei_next (&ei);
continue;
}
new_bb->count += e->count ();
redirect_edge_and_branch_force (e, new_bb);
if (dump_file)
fprintf (dump_file, "Redirected edge from %d\n", e->src->index);
}
*entry_edge = make_single_succ_edge (new_bb, pro, EDGE_FALLTHRU);
force_nonfallthru (*entry_edge);
free_dominance_info (CDI_DOMINATORS);
}
/* Separate shrink-wrapping
Instead of putting all of the prologue and epilogue in one spot, we
can put parts of it in places where those components are executed less
frequently. The following code does this, for prologue and epilogue
components that can be put in more than one location, and where those
components can be executed more than once (the epilogue component will
always be executed before the prologue component is executed a second
time).
What exactly is a component is target-dependent. The more usual
components are simple saves/restores to/from the frame of callee-saved
registers. This code treats components abstractly (as an sbitmap),
letting the target handle all details.
Prologue components are placed in such a way that for every component
the prologue is executed as infrequently as possible. We do this by
walking the dominator tree, comparing the cost of placing a prologue
component before a block to the sum of costs determined for all subtrees
of that block.
From this placement, we then determine for each component all blocks
where at least one of this block's dominators (including itself) will
get a prologue inserted. That then is how the components are placed.
We could place the epilogue components a bit smarter (we can save a
bit of code size sometimes); this is a possible future improvement.
Prologues and epilogues are preferably placed into a block, either at
the beginning or end of it, if it is needed for all predecessor resp.
successor edges; or placed on the edge otherwise.
If the placement of any prologue/epilogue leads to a situation we cannot
handle (for example, an abnormal edge would need to be split, or some
targets want to use some specific registers that may not be available
where we want to put them), separate shrink-wrapping for the components
in that prologue/epilogue is aborted. */
/* Print the sbitmap COMPONENTS to the DUMP_FILE if not empty, with the
label LABEL. */
static void
dump_components (const char *label, sbitmap components)
{
if (bitmap_empty_p (components))
return;
fprintf (dump_file, " [%s", label);
for (unsigned int j = 0; j < components->n_bits; j++)
if (bitmap_bit_p (components, j))
fprintf (dump_file, " %u", j);
fprintf (dump_file, "]");
}
/* The data we collect for each bb. */
struct sw {
/* What components does this BB need? */
sbitmap needs_components;
/* What components does this BB have? This is the main decision this
pass makes. */
sbitmap has_components;
/* The components for which we placed code at the start of the BB (instead
of on all incoming edges). */
sbitmap head_components;
/* The components for which we placed code at the end of the BB (instead
of on all outgoing edges). */
sbitmap tail_components;
/* The frequency of executing the prologue for this BB, if a prologue is
placed on this BB. This is a pessimistic estimate (no prologue is
needed for edges from blocks that have the component under consideration
active already). */
gcov_type own_cost;
/* The frequency of executing the prologue for this BB and all BBs
dominated by it. */
gcov_type total_cost;
};
/* A helper function for accessing the pass-specific info. */
static inline struct sw *
SW (basic_block bb)
{
gcc_assert (bb->aux);
return (struct sw *) bb->aux;
}
/* Create the pass-specific data structures for separately shrink-wrapping
with components COMPONENTS. */
static void
init_separate_shrink_wrap (sbitmap components)
{
basic_block bb;
FOR_ALL_BB_FN (bb, cfun)
{
bb->aux = xcalloc (1, sizeof (struct sw));
SW (bb)->needs_components = targetm.shrink_wrap.components_for_bb (bb);
/* Mark all basic blocks without successor as needing all components.
This avoids problems in at least cfgcleanup, sel-sched, and
regrename (largely to do with all paths to such a block still
needing the same dwarf CFI info). */
if (EDGE_COUNT (bb->succs) == 0)
bitmap_copy (SW (bb)->needs_components, components);
if (dump_file)
{
fprintf (dump_file, "bb %d components:", bb->index);
dump_components ("has", SW (bb)->needs_components);
fprintf (dump_file, "\n");
}
SW (bb)->has_components = sbitmap_alloc (SBITMAP_SIZE (components));
SW (bb)->head_components = sbitmap_alloc (SBITMAP_SIZE (components));
SW (bb)->tail_components = sbitmap_alloc (SBITMAP_SIZE (components));
bitmap_clear (SW (bb)->has_components);
}
}
/* Destroy the pass-specific data. */
static void
fini_separate_shrink_wrap (void)
{
basic_block bb;
FOR_ALL_BB_FN (bb, cfun)
if (bb->aux)
{
sbitmap_free (SW (bb)->needs_components);
sbitmap_free (SW (bb)->has_components);
sbitmap_free (SW (bb)->head_components);
sbitmap_free (SW (bb)->tail_components);
free (bb->aux);
bb->aux = 0;
}
}
/* Place the prologue for component WHICH, in the basic blocks dominated
by HEAD. Do a DFS over the dominator tree, and set bit WHICH in the
HAS_COMPONENTS of a block if either the block has that bit set in
NEEDS_COMPONENTS, or it is cheaper to place the prologue here than in all
dominator subtrees separately. */
static void
place_prologue_for_one_component (unsigned int which, basic_block head)
{
/* The block we are currently dealing with. */
basic_block bb = head;
/* Is this the first time we visit this block, i.e. have we just gone
down the tree. */
bool first_visit = true;
/* Walk the dominator tree, visit one block per iteration of this loop.
Each basic block is visited twice: once before visiting any children
of the block, and once after visiting all of them (leaf nodes are
visited only once). As an optimization, we do not visit subtrees
that can no longer influence the prologue placement. */
for (;;)
{
/* First visit of a block: set the (children) cost accumulator to zero;
if the block does not have the component itself, walk down. */
if (first_visit)
{
/* Initialize the cost. The cost is the block execution frequency
that does not come from backedges. Calculating this by simply
adding the cost of all edges that aren't backedges does not
work: this does not always add up to the block frequency at
all, and even if it does, rounding error makes for bad
decisions. */
SW (bb)->own_cost = bb->count.to_frequency (cfun);
edge e;
edge_iterator ei;
FOR_EACH_EDGE (e, ei, bb->preds)
if (dominated_by_p (CDI_DOMINATORS, e->src, bb))
{
if (SW (bb)->own_cost > EDGE_FREQUENCY (e))
SW (bb)->own_cost -= EDGE_FREQUENCY (e);
else
SW (bb)->own_cost = 0;
}
SW (bb)->total_cost = 0;
if (!bitmap_bit_p (SW (bb)->needs_components, which)
&& first_dom_son (CDI_DOMINATORS, bb))
{
bb = first_dom_son (CDI_DOMINATORS, bb);
continue;
}
}
/* If this block does need the component itself, or it is cheaper to
put the prologue here than in all the descendants that need it,
mark it so. If this block's immediate post-dominator is dominated
by this block, and that needs the prologue, we can put it on this
block as well (earlier is better). */
if (bitmap_bit_p (SW (bb)->needs_components, which)
|| SW (bb)->total_cost > SW (bb)->own_cost)
{
SW (bb)->total_cost = SW (bb)->own_cost;
bitmap_set_bit (SW (bb)->has_components, which);
}
else
{
basic_block kid = get_immediate_dominator (CDI_POST_DOMINATORS, bb);
if (dominated_by_p (CDI_DOMINATORS, kid, bb)
&& bitmap_bit_p (SW (kid)->has_components, which))
{
SW (bb)->total_cost = SW (bb)->own_cost;
bitmap_set_bit (SW (bb)->has_components, which);
}
}
/* We are back where we started, so we are done now. */
if (bb == head)
return;
/* We now know the cost of the subtree rooted at the current block.
Accumulate this cost in the parent. */
basic_block parent = get_immediate_dominator (CDI_DOMINATORS, bb);
SW (parent)->total_cost += SW (bb)->total_cost;
/* Don't walk the tree down unless necessary. */
if (next_dom_son (CDI_DOMINATORS, bb)
&& SW (parent)->total_cost <= SW (parent)->own_cost)
{
bb = next_dom_son (CDI_DOMINATORS, bb);
first_visit = true;
}
else
{
bb = parent;
first_visit = false;
}
}
}
/* Set HAS_COMPONENTS in every block to the maximum it can be set to without
setting it on any path from entry to exit where it was not already set
somewhere (or, for blocks that have no path to the exit, consider only
paths from the entry to the block itself). */
static void
spread_components (sbitmap components)
{
basic_block entry_block = ENTRY_BLOCK_PTR_FOR_FN (cfun);
basic_block exit_block = EXIT_BLOCK_PTR_FOR_FN (cfun);
/* A stack of all blocks left to consider, and a bitmap of all blocks
on that stack. */
vec<basic_block> todo;
todo.create (n_basic_blocks_for_fn (cfun));
auto_bitmap seen;
auto_sbitmap old (SBITMAP_SIZE (components));
/* Find for every block the components that are *not* needed on some path
from the entry to that block. Do this with a flood fill from the entry
block. Every block can be visited at most as often as the number of
components (plus one), and usually much less often. */
if (dump_file)
fprintf (dump_file, "Spreading down...\n");
basic_block bb;
FOR_ALL_BB_FN (bb, cfun)
bitmap_clear (SW (bb)->head_components);
bitmap_copy (SW (entry_block)->head_components, components);
edge e;
edge_iterator ei;
todo.quick_push (single_succ (entry_block));
bitmap_set_bit (seen, single_succ (entry_block)->index);
while (!todo.is_empty ())
{
bb = todo.pop ();
bitmap_copy (old, SW (bb)->head_components);
FOR_EACH_EDGE (e, ei, bb->preds)
bitmap_ior (SW (bb)->head_components, SW (bb)->head_components,
SW (e->src)->head_components);
bitmap_and_compl (SW (bb)->head_components, SW (bb)->head_components,
SW (bb)->has_components);
if (!bitmap_equal_p (old, SW (bb)->head_components))
FOR_EACH_EDGE (e, ei, bb->succs)
if (bitmap_set_bit (seen, e->dest->index))
todo.quick_push (e->dest);
bitmap_clear_bit (seen, bb->index);
}
/* Find for every block the components that are *not* needed on some reverse
path from the exit to that block. */
if (dump_file)
fprintf (dump_file, "Spreading up...\n");
/* First, mark all blocks not reachable from the exit block as not needing
any component on any path to the exit. Mark everything, and then clear
again by a flood fill. */
FOR_ALL_BB_FN (bb, cfun)
bitmap_copy (SW (bb)->tail_components, components);
FOR_EACH_EDGE (e, ei, exit_block->preds)
{
todo.quick_push (e->src);
bitmap_set_bit (seen, e->src->index);
}
while (!todo.is_empty ())
{
bb = todo.pop ();
if (!bitmap_empty_p (SW (bb)->tail_components))
FOR_EACH_EDGE (e, ei, bb->preds)
if (bitmap_set_bit (seen, e->src->index))
todo.quick_push (e->src);
bitmap_clear (SW (bb)->tail_components);
bitmap_clear_bit (seen, bb->index);
}
/* And then, flood fill backwards to find for every block the components
not needed on some path to the exit. */
bitmap_copy (SW (exit_block)->tail_components, components);
FOR_EACH_EDGE (e, ei, exit_block->preds)
{
todo.quick_push (e->src);
bitmap_set_bit (seen, e->src->index);
}
while (!todo.is_empty ())
{
bb = todo.pop ();
bitmap_copy (old, SW (bb)->tail_components);
FOR_EACH_EDGE (e, ei, bb->succs)
bitmap_ior (SW (bb)->tail_components, SW (bb)->tail_components,
SW (e->dest)->tail_components);
bitmap_and_compl (SW (bb)->tail_components, SW (bb)->tail_components,
SW (bb)->has_components);
if (!bitmap_equal_p (old, SW (bb)->tail_components))
FOR_EACH_EDGE (e, ei, bb->preds)
if (bitmap_set_bit (seen, e->src->index))
todo.quick_push (e->src);
bitmap_clear_bit (seen, bb->index);
}
todo.release ();
/* Finally, mark everything not not needed both forwards and backwards. */
FOR_EACH_BB_FN (bb, cfun)
{
bitmap_and (SW (bb)->head_components, SW (bb)->head_components,
SW (bb)->tail_components);
bitmap_and_compl (SW (bb)->has_components, components,
SW (bb)->head_components);
}
FOR_ALL_BB_FN (bb, cfun)
{
if (dump_file)
{
fprintf (dump_file, "bb %d components:", bb->index);
dump_components ("has", SW (bb)->has_components);
fprintf (dump_file, "\n");
}
}
}
/* If we cannot handle placing some component's prologues or epilogues where
we decided we should place them, unmark that component in COMPONENTS so
that it is not wrapped separately. */
static void
disqualify_problematic_components (sbitmap components)
{
auto_sbitmap pro (SBITMAP_SIZE (components));
auto_sbitmap epi (SBITMAP_SIZE (components));
basic_block bb;
FOR_EACH_BB_FN (bb, cfun)
{
edge e;
edge_iterator ei;
FOR_EACH_EDGE (e, ei, bb->succs)
{
/* Find which components we want pro/epilogues for here. */
bitmap_and_compl (epi, SW (e->src)->has_components,
SW (e->dest)->has_components);
bitmap_and_compl (pro, SW (e->dest)->has_components,
SW (e->src)->has_components);
/* Ask the target what it thinks about things. */
if (!bitmap_empty_p (epi))
targetm.shrink_wrap.disqualify_components (components, e, epi,
false);
if (!bitmap_empty_p (pro))
targetm.shrink_wrap.disqualify_components (components, e, pro,
true);
/* If this edge doesn't need splitting, we're fine. */
if (single_pred_p (e->dest)
&& e->dest != EXIT_BLOCK_PTR_FOR_FN (cfun))
continue;
/* If the edge can be split, that is fine too. */
if ((e->flags & EDGE_ABNORMAL) == 0)
continue;
/* We also can handle sibcalls. */
if (e->dest == EXIT_BLOCK_PTR_FOR_FN (cfun))
{
gcc_assert (e->flags & EDGE_SIBCALL);
continue;
}
/* Remove from consideration those components we would need
pro/epilogues for on edges where we cannot insert them. */
bitmap_and_compl (components, components, epi);
bitmap_and_compl (components, components, pro);
if (dump_file && !bitmap_subset_p (epi, components))
{
fprintf (dump_file, " BAD epi %d->%d", e->src->index,
e->dest->index);
if (e->flags & EDGE_EH)
fprintf (dump_file, " for EH");
dump_components ("epi", epi);
fprintf (dump_file, "\n");
}
if (dump_file && !bitmap_subset_p (pro, components))
{
fprintf (dump_file, " BAD pro %d->%d", e->src->index,
e->dest->index);
if (e->flags & EDGE_EH)
fprintf (dump_file, " for EH");
dump_components ("pro", pro);
fprintf (dump_file, "\n");
}
}
}
}
/* Place code for prologues and epilogues for COMPONENTS where we can put
that code at the start of basic blocks. */
static void
emit_common_heads_for_components (sbitmap components)
{
auto_sbitmap pro (SBITMAP_SIZE (components));
auto_sbitmap epi (SBITMAP_SIZE (components));
auto_sbitmap tmp (SBITMAP_SIZE (components));
basic_block bb;
FOR_ALL_BB_FN (bb, cfun)
bitmap_clear (SW (bb)->head_components);
FOR_EACH_BB_FN (bb, cfun)
{
/* Find which prologue resp. epilogue components are needed for all
predecessor edges to this block. */
/* First, select all possible components. */
bitmap_copy (epi, components);
bitmap_copy (pro, components);
edge e;
edge_iterator ei;
FOR_EACH_EDGE (e, ei, bb->preds)
{
if (e->flags & EDGE_ABNORMAL)
{
bitmap_clear (epi);
bitmap_clear (pro);
break;
}
/* Deselect those epilogue components that should not be inserted
for this edge. */
bitmap_and_compl (tmp, SW (e->src)->has_components,
SW (e->dest)->has_components);
bitmap_and (epi, epi, tmp);
/* Similar, for the prologue. */
bitmap_and_compl (tmp, SW (e->dest)->has_components,
SW (e->src)->has_components);
bitmap_and (pro, pro, tmp);
}
if (dump_file && !(bitmap_empty_p (epi) && bitmap_empty_p (pro)))
fprintf (dump_file, " bb %d", bb->index);
if (dump_file && !bitmap_empty_p (epi))
dump_components ("epi", epi);
if (dump_file && !bitmap_empty_p (pro))
dump_components ("pro", pro);
if (dump_file && !(bitmap_empty_p (epi) && bitmap_empty_p (pro)))
fprintf (dump_file, "\n");
/* Place code after the BB note. */
if (!bitmap_empty_p (pro))
{
start_sequence ();
targetm.shrink_wrap.emit_prologue_components (pro);
rtx_insn *seq = get_insns ();
end_sequence ();
record_prologue_seq (seq);
emit_insn_after (seq, bb_note (bb));
bitmap_ior (SW (bb)->head_components, SW (bb)->head_components, pro);
}
if (!bitmap_empty_p (epi))
{
start_sequence ();
targetm.shrink_wrap.emit_epilogue_components (epi);
rtx_insn *seq = get_insns ();
end_sequence ();
record_epilogue_seq (seq);
emit_insn_after (seq, bb_note (bb));
bitmap_ior (SW (bb)->head_components, SW (bb)->head_components, epi);
}
}
}
/* Place code for prologues and epilogues for COMPONENTS where we can put
that code at the end of basic blocks. */
static void
emit_common_tails_for_components (sbitmap components)
{
auto_sbitmap pro (SBITMAP_SIZE (components));
auto_sbitmap epi (SBITMAP_SIZE (components));
auto_sbitmap tmp (SBITMAP_SIZE (components));
basic_block bb;
FOR_ALL_BB_FN (bb, cfun)
bitmap_clear (SW (bb)->tail_components);
FOR_EACH_BB_FN (bb, cfun)
{
/* Find which prologue resp. epilogue components are needed for all
successor edges from this block. */
if (EDGE_COUNT (bb->succs) == 0)
continue;
/* First, select all possible components. */
bitmap_copy (epi, components);
bitmap_copy (pro, components);
edge e;
edge_iterator ei;
FOR_EACH_EDGE (e, ei, bb->succs)
{
if (e->flags & EDGE_ABNORMAL)
{
bitmap_clear (epi);
bitmap_clear (pro);
break;
}
/* Deselect those epilogue components that should not be inserted
for this edge, and also those that are already put at the head
of the successor block. */
bitmap_and_compl (tmp, SW (e->src)->has_components,
SW (e->dest)->has_components);
bitmap_and_compl (tmp, tmp, SW (e->dest)->head_components);
bitmap_and (epi, epi, tmp);
/* Similarly, for the prologue. */
bitmap_and_compl (tmp, SW (e->dest)->has_components,
SW (e->src)->has_components);
bitmap_and_compl (tmp, tmp, SW (e->dest)->head_components);
bitmap_and (pro, pro, tmp);
}
/* If the last insn of this block is a control flow insn we cannot
put anything after it. We can put our code before it instead,
but only if that jump insn is a simple jump. */
rtx_insn *last_insn = BB_END (bb);
if (control_flow_insn_p (last_insn) && !simplejump_p (last_insn))
{
bitmap_clear (epi);
bitmap_clear (pro);
}
if (dump_file && !(bitmap_empty_p (epi) && bitmap_empty_p (pro)))
fprintf (dump_file, " bb %d", bb->index);
if (dump_file && !bitmap_empty_p (epi))
dump_components ("epi", epi);
if (dump_file && !bitmap_empty_p (pro))
dump_components ("pro", pro);
if (dump_file && !(bitmap_empty_p (epi) && bitmap_empty_p (pro)))
fprintf (dump_file, "\n");
/* Put the code at the end of the BB, but before any final jump. */
if (!bitmap_empty_p (epi))
{
start_sequence ();
targetm.shrink_wrap.emit_epilogue_components (epi);
rtx_insn *seq = get_insns ();
end_sequence ();
record_epilogue_seq (seq);
if (control_flow_insn_p (last_insn))
emit_insn_before (seq, last_insn);
else
emit_insn_after (seq, last_insn);
bitmap_ior (SW (bb)->tail_components, SW (bb)->tail_components, epi);
}
if (!bitmap_empty_p (pro))
{
start_sequence ();
targetm.shrink_wrap.emit_prologue_components (pro);
rtx_insn *seq = get_insns ();
end_sequence ();
record_prologue_seq (seq);
if (control_flow_insn_p (last_insn))
emit_insn_before (seq, last_insn);
else
emit_insn_after (seq, last_insn);
bitmap_ior (SW (bb)->tail_components, SW (bb)->tail_components, pro);
}
}
}
/* Place prologues and epilogues for COMPONENTS on edges, if we haven't already
placed them inside blocks directly. */
static void
insert_prologue_epilogue_for_components (sbitmap components)
{
auto_sbitmap pro (SBITMAP_SIZE (components));
auto_sbitmap epi (SBITMAP_SIZE (components));
basic_block bb;
FOR_EACH_BB_FN (bb, cfun)
{
if (!bb->aux)
continue;
edge e;
edge_iterator ei;
FOR_EACH_EDGE (e, ei, bb->succs)
{
/* Find which pro/epilogue components are needed on this edge. */
bitmap_and_compl (epi, SW (e->src)->has_components,
SW (e->dest)->has_components);
bitmap_and_compl (pro, SW (e->dest)->has_components,
SW (e->src)->has_components);
bitmap_and (epi, epi, components);
bitmap_and (pro, pro, components);
/* Deselect those we already have put at the head or tail of the
edge's dest resp. src. */
bitmap_and_compl (epi, epi, SW (e->dest)->head_components);
bitmap_and_compl (pro, pro, SW (e->dest)->head_components);
bitmap_and_compl (epi, epi, SW (e->src)->tail_components);
bitmap_and_compl (pro, pro, SW (e->src)->tail_components);
if (!bitmap_empty_p (epi) || !bitmap_empty_p (pro))
{
if (dump_file)
{
fprintf (dump_file, " %d->%d", e->src->index,
e->dest->index);
dump_components ("epi", epi);
dump_components ("pro", pro);
if (e->flags & EDGE_SIBCALL)
fprintf (dump_file, " (SIBCALL)");
else if (e->flags & EDGE_ABNORMAL)
fprintf (dump_file, " (ABNORMAL)");
fprintf (dump_file, "\n");
}
/* Put the epilogue components in place. */
start_sequence ();
targetm.shrink_wrap.emit_epilogue_components (epi);
rtx_insn *seq = get_insns ();
end_sequence ();
record_epilogue_seq (seq);
if (e->flags & EDGE_SIBCALL)
{
gcc_assert (e->dest == EXIT_BLOCK_PTR_FOR_FN (cfun));
rtx_insn *insn = BB_END (e->src);
gcc_assert (CALL_P (insn) && SIBLING_CALL_P (insn));
emit_insn_before (seq, insn);
}
else if (e->dest == EXIT_BLOCK_PTR_FOR_FN (cfun))
{
gcc_assert (e->flags & EDGE_FALLTHRU);
basic_block new_bb = split_edge (e);
emit_insn_after (seq, BB_END (new_bb));
}
else
insert_insn_on_edge (seq, e);
/* Put the prologue components in place. */
start_sequence ();
targetm.shrink_wrap.emit_prologue_components (pro);
seq = get_insns ();
end_sequence ();
record_prologue_seq (seq);
insert_insn_on_edge (seq, e);
}
}
}
commit_edge_insertions ();
}
/* The main entry point to this subpass. FIRST_BB is where the prologue
would be normally put. */
void
try_shrink_wrapping_separate (basic_block first_bb)
{
if (HAVE_cc0)
return;
if (!(SHRINK_WRAPPING_ENABLED
&& flag_shrink_wrap_separate
&& optimize_function_for_speed_p (cfun)
&& targetm.shrink_wrap.get_separate_components))
return;
/* We don't handle "strange" functions. */
if (cfun->calls_alloca
|| cfun->calls_setjmp
|| cfun->can_throw_non_call_exceptions
|| crtl->calls_eh_return
|| crtl->has_nonlocal_goto
|| crtl->saves_all_registers)
return;
/* Ask the target what components there are. If it returns NULL, don't
do anything. */
sbitmap components = targetm.shrink_wrap.get_separate_components ();
if (!components)
return;
/* We need LIVE info, not defining anything in the entry block and not
using anything in the exit block. A block then needs a component if
the register for that component is in the IN or GEN or KILL set for
that block. */
df_scan->local_flags |= DF_SCAN_EMPTY_ENTRY_EXIT;
df_update_entry_exit_and_calls ();
df_live_add_problem ();
df_live_set_all_dirty ();
df_analyze ();
calculate_dominance_info (CDI_DOMINATORS);
calculate_dominance_info (CDI_POST_DOMINATORS);
init_separate_shrink_wrap (components);
sbitmap_iterator sbi;
unsigned int j;
EXECUTE_IF_SET_IN_BITMAP (components, 0, j, sbi)
place_prologue_for_one_component (j, first_bb);
spread_components (components);
disqualify_problematic_components (components);
/* Don't separately shrink-wrap anything where the "main" prologue will
go; the target code can often optimize things if it is presented with
all components together (say, if it generates store-multiple insns). */
bitmap_and_compl (components, components, SW (first_bb)->has_components);
if (bitmap_empty_p (components))
{
if (dump_file)
fprintf (dump_file, "Not wrapping anything separately.\n");
}
else
{
if (dump_file)
{
fprintf (dump_file, "The components we wrap separately are");
dump_components ("sep", components);
fprintf (dump_file, "\n");
fprintf (dump_file, "... Inserting common heads...\n");
}
emit_common_heads_for_components (components);
if (dump_file)
fprintf (dump_file, "... Inserting common tails...\n");
emit_common_tails_for_components (components);
if (dump_file)
fprintf (dump_file, "... Inserting the more difficult ones...\n");
insert_prologue_epilogue_for_components (components);
if (dump_file)
fprintf (dump_file, "... Done.\n");
targetm.shrink_wrap.set_handled_components (components);
crtl->shrink_wrapped_separate = true;
}
fini_separate_shrink_wrap ();
sbitmap_free (components);
free_dominance_info (CDI_DOMINATORS);
free_dominance_info (CDI_POST_DOMINATORS);
/* All done. */
df_scan->local_flags &= ~DF_SCAN_EMPTY_ENTRY_EXIT;
df_update_entry_exit_and_calls ();
df_live_set_all_dirty ();
df_analyze ();
}
| 23,136 |
416 | package org.springframework.roo.addon.field.addon;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.springframework.roo.classpath.operations.Cardinality;
/**
* Provides current supported options for "set" and "list" relationships.
*
* @author <NAME>
* @since 2.0
*/
public enum CardinalitySupported {
MANY_TO_MANY, ONE_TO_MANY;
/**
* @return {@link Cardinality} value related current item
*/
public Cardinality getCardinality() {
return Cardinality.valueOf(this.name());
}
@Override
public String toString() {
final ToStringBuilder builder = new ToStringBuilder(this);
builder.append("name", name());
return builder.toString();
}
}
| 223 |
759 | from .MSA_transformer_block import TiedRowAxialAttention, MSATransformerBlock, MSATransformerEncoder
| 31 |
606 | /*
* Copyright 2016 <NAME>.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.rodolfonavalon.shaperipplelibrary;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Build;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.Interpolator;
import android.view.animation.LinearInterpolator;
import com.rodolfonavalon.shaperipplelibrary.data.ShapeRippleEntry;
import com.rodolfonavalon.shaperipplelibrary.model.BaseShape;
import com.rodolfonavalon.shaperipplelibrary.model.Circle;
import com.rodolfonavalon.shaperipplelibrary.util.ShapePulseUtil;
import java.util.Deque;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import static com.rodolfonavalon.shaperipplelibrary.DebugLogger.logD;
import static com.rodolfonavalon.shaperipplelibrary.DebugLogger.logE;
public class ShapeRipple extends View {
static final String TAG = ShapeRipple.class.getSimpleName();
private static final int NO_VALUE = 0;
/**
* Debug logging flag for the library
*/
static boolean DEBUG = false;
/**
* Default color of the ripple
*/
private static final int DEFAULT_RIPPLE_COLOR = Color.parseColor("#FFF44336");
/**
* Default color of the start ripple color transition
*/
private static final int DEFAULT_RIPPLE_FROM_COLOR = Color.parseColor("#FFF44336");
/**
* Default color of the end ripple color transition
*/
private static final int DEFAULT_RIPPLE_TO_COLOR = Color.parseColor("#00FFFFFF");
/**
* The default duration of the ripples
*/
private static final int DEFAULT_RIPPLE_DURATION = 1500;
/**
* The default ripple interval factor see {@link #rippleIntervalFactor} for
* more details
*/
private static final float DEFAULT_RIPPLE_INTERVAL_FACTOR = 1F;
/**
* Base ripple color, only used when {@link #enableColorTransition} flag is set to false
*/
private int rippleColor;
/**
* Starting color for the color transition of the ripple, only
* used when {@link #enableColorTransition} flag is set to true
*/
private int rippleFromColor;
/**
* End color for the color transition of the ripple, only
* used when {@link #enableColorTransition} flag is set to true
*/
private int rippleToColor;
/**
* Base ripple duration for the animation, by default the value is {@value DEFAULT_RIPPLE_DURATION}
*/
private int rippleDuration;
/**
* Base stroke width for each of the ripple
*/
private int rippleStrokeWidth;
/**
* Ripple interval handles the actual timing of each spacing
* of ripples in the list, calculated in {@link #onMeasure(int, int)}
*/
private float rippleInterval;
/**
* Ripple maximum radius that will be used instead of the pre-calculated value, default value is
* the size of the layout.
*/
private float rippleMaximumRadius;
/**
* Ripple interval factor is the spacing for each ripple
* the more the factor the more the spacing
*/
private float rippleIntervalFactor;
/**
* Ripple count that will be rendered in the layout, default value is calculated based on the
* layout_width / ripple_width
*/
private int rippleCount;
/**
* The width of the view in the layout which is calculated in {@link #onMeasure(int, int)}
*/
private int viewWidth;
/**
* The height of the view in the layout which is calculated in {@link #onMeasure(int, int)}
*/
private int viewHeight;
/**
* The maximum radius of the ripple which is calculated in the {@link #onMeasure(int, int)}
*/
private int maxRippleRadius;
/**
* The last multiplier value of the animation after invalidation of this view
*/
private float lastMultiplierValue = 0f;
/**
* Enables the color transition for each ripple, it is true by default
*/
private boolean enableColorTransition = true;
/**
* Enables the single ripple, it is false by default
*/
private boolean enableSingleRipple = false;
/**
* Enables the random positioning of the ripple, it is false by default
*/
private boolean enableRandomPosition = false;
/**
* Enable the random color of the ripple, it is false by default
*/
private boolean enableRandomColor = false;
/**
* Enables the stroke style of the ripples, it is false by default
*
* This means that if it is enabled it will use the {@link Paint#setStyle(Paint.Style)} as
* {@link Paint.Style#STROKE}, by default it will use the {@link Paint.Style#FILL}.
*
*/
private boolean enableStrokeStyle = false;
/**
* The list of {@link ShapeRippleEntry} which is rendered in {@link #render(Float)}
*/
private Deque<ShapeRippleEntry> shapeRippleEntries;
/**
* The list of developer predefined random colors which is used when {@link #enableRandomColor} is set to true.
* <p>
* If this is not defined by the developer it will have a default value from {@link ShapePulseUtil#generateRandomColours(Context)}
*/
private List<Integer> rippleRandomColors;
/**
* The actual animator for the ripples, used in {@link #render(Float)}
*/
private ValueAnimator rippleValueAnimator;
/**
* The {@link Interpolator} of the {@link #rippleValueAnimator}, by default it is {@link LinearInterpolator}
*/
private Interpolator rippleInterpolator;
/**
* The random generator object for both color ({@link #enableRandomColor} is set to true) and position ({@link #enableRandomPosition} is set to true)
*/
private Random random;
/**
* The renderer of shape ripples which is drawn in the {@link BaseShape#onDraw(Canvas, int, int, float, int, int, Paint)}
*/
private BaseShape rippleShape;
/**
* The default paint for the ripple
*/
protected Paint shapePaint;
/**
* This flag will handle that it was stopped by the user
*/
private boolean isStopped;
/**
* The life activity life cycle the shape ripple uses.
*/
private LifeCycleManager lifeCycleManager;
public ShapeRipple(Context context) {
super(context);
init(context, null);
}
public ShapeRipple(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs);
}
public ShapeRipple(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init(context, attrs);
}
private void init(Context context, AttributeSet attrs) {
// initialize the paint for the shape ripple
shapePaint = new Paint();
shapePaint.setAntiAlias(true);
shapePaint.setDither(true);
shapePaint.setStyle(Paint.Style.FILL);
this.shapeRippleEntries = new LinkedList<>();
this.random = new Random();
rippleShape = new Circle();
rippleShape.onSetup(context, shapePaint);
rippleColor = DEFAULT_RIPPLE_COLOR;
rippleFromColor = DEFAULT_RIPPLE_FROM_COLOR;
rippleToColor = DEFAULT_RIPPLE_TO_COLOR;
rippleStrokeWidth = getResources().getDimensionPixelSize(R.dimen.default_stroke_width);
rippleRandomColors = ShapePulseUtil.generateRandomColours(getContext());
rippleDuration = DEFAULT_RIPPLE_DURATION;
rippleIntervalFactor = DEFAULT_RIPPLE_INTERVAL_FACTOR;
rippleInterpolator = new LinearInterpolator();
if (attrs != null) {
TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.ConnectingRipple, 0, 0);
try {
rippleColor = ta.getColor(R.styleable.ConnectingRipple_ripple_color, DEFAULT_RIPPLE_COLOR);
rippleFromColor = ta.getColor(R.styleable.ConnectingRipple_ripple_from_color, DEFAULT_RIPPLE_FROM_COLOR);
rippleToColor = ta.getColor(R.styleable.ConnectingRipple_ripple_to_color, DEFAULT_RIPPLE_TO_COLOR);
setRippleDuration(ta.getInteger(R.styleable.ConnectingRipple_ripple_duration, DEFAULT_RIPPLE_DURATION));
enableColorTransition = ta.getBoolean(R.styleable.ConnectingRipple_enable_color_transition, true);
enableSingleRipple = ta.getBoolean(R.styleable.ConnectingRipple_enable_single_ripple, false);
enableRandomPosition = ta.getBoolean(R.styleable.ConnectingRipple_enable_random_position, false);
rippleMaximumRadius = ta.getDimensionPixelSize(R.styleable.ConnectingRipple_ripple_maximum_radius, NO_VALUE);
rippleCount = ta.getInteger(R.styleable.ConnectingRipple_ripple_count, NO_VALUE);
setEnableStrokeStyle(ta.getBoolean(R.styleable.ConnectingRipple_enable_stroke_style, false));
setEnableRandomColor(ta.getBoolean(R.styleable.ConnectingRipple_enable_random_color, false));
setRippleStrokeWidth(ta.getDimensionPixelSize(R.styleable.ConnectingRipple_ripple_stroke_width, getResources().getDimensionPixelSize(R.dimen.default_stroke_width)));
} finally {
ta.recycle();
}
}
start(rippleDuration);
// Only attach the activity for ICE_CREAM_SANDWICH and up
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
lifeCycleManager = new LifeCycleManager(this);
lifeCycleManager.attachListener();
}
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
for (ShapeRippleEntry shapeRippleEntry : shapeRippleEntries) {
if (shapeRippleEntry.isRender()) {
// Each ripple entry is a rendered as a shape
shapeRippleEntry.getBaseShape().onDraw(canvas, shapeRippleEntry.getX(),
shapeRippleEntry.getY(),
shapeRippleEntry.getRadiusSize(),
shapeRippleEntry.getChangingColorValue(),
shapeRippleEntry.getRippleIndex(),
shapePaint);
}
}
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
// Get the measure base of the measure spec
viewWidth = MeasureSpec.getSize(widthMeasureSpec);
viewHeight = MeasureSpec.getSize(heightMeasureSpec);
initializeEntries(rippleShape);
rippleShape.setWidth(viewWidth);
rippleShape.setHeight(viewHeight);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
stop();
}
@Override
protected void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
stop();
}
/**
* This method will initialize the list of {@link ShapeRippleEntry} with
* initial position, color, index, and multiplier value.)
*
* @param shapeRipple the renderer of shape ripples
*/
private void initializeEntries(BaseShape shapeRipple) {
// Sets the stroke width of the ripple
shapePaint.setStrokeWidth(rippleStrokeWidth);
if (viewWidth == 0 && viewHeight == 0) {
return;
}
// we remove all the shape ripples entries
shapeRippleEntries.clear();
// the ripple radius based on the x or y
maxRippleRadius = rippleMaximumRadius != NO_VALUE ? (int)rippleMaximumRadius :
(Math.min(viewWidth, viewHeight) / 2 - (rippleStrokeWidth / 2));
// Calculate the max number of ripples
rippleCount = rippleCount > NO_VALUE ? rippleCount : maxRippleRadius / rippleStrokeWidth;
// Calculate the interval of ripples
rippleInterval = DEFAULT_RIPPLE_INTERVAL_FACTOR / rippleCount;
for (int i = 0; i < rippleCount; i++) {
ShapeRippleEntry shapeRippleEntry = new ShapeRippleEntry(shapeRipple);
shapeRippleEntry.setX(enableRandomPosition ? random.nextInt(viewWidth) : viewWidth / 2);
shapeRippleEntry.setY(enableRandomPosition ? random.nextInt(viewHeight) : viewHeight / 2);
shapeRippleEntry.setMultiplierValue(-(rippleInterval * (float) i));
shapeRippleEntry.setRippleIndex(i);
if (enableRandomColor) {
shapeRippleEntry.setOriginalColorValue(rippleRandomColors.get(random.nextInt(rippleRandomColors.size())));
} else {
shapeRippleEntry.setOriginalColorValue(rippleColor);
}
shapeRippleEntries.add(shapeRippleEntry);
// we only render 1 ripple when it is enabled
if (enableSingleRipple) {
break;
}
}
}
/**
* Refreshes the list of ticket entries after certain options are changed such as the {@link #rippleColor},
* {@link #rippleShape}, {@link #enableRandomPosition}, etc.
* <p>
* This will only execute after the {@link #initializeEntries(BaseShape)}, this is safe to call before it.
*/
private void reconfigureEntries() {
// we do not re configure when dimension is not calculated
// or if the list is empty
if (viewWidth == 0 && viewHeight == 0 && (shapeRippleEntries == null || shapeRippleEntries.size() == 0)) {
logE("The view dimensions was not calculated!!");
return;
}
// sets the stroke width of the ripple
shapePaint.setStrokeWidth(rippleStrokeWidth);
for (ShapeRippleEntry shapeRippleEntry : shapeRippleEntries) {
if (enableRandomColor) {
shapeRippleEntry.setOriginalColorValue(rippleRandomColors.get(random.nextInt(rippleRandomColors.size())));
} else {
shapeRippleEntry.setOriginalColorValue(rippleColor);
}
shapeRippleEntry.setBaseShape(rippleShape);
}
}
/**
* Start the {@link #rippleValueAnimator} with specified duration for each ripple.
*
* @param millis the duration in milliseconds
*/
void start(int millis) {
// Do a ripple value renderer
rippleValueAnimator = ValueAnimator.ofFloat(0f, 1f);
rippleValueAnimator.setDuration(millis);
rippleValueAnimator.setRepeatMode(ValueAnimator.RESTART);
rippleValueAnimator.setRepeatCount(ValueAnimator.INFINITE);
rippleValueAnimator.setInterpolator(rippleInterpolator);
rippleValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
render((Float) animation.getAnimatedValue());
}
});
rippleValueAnimator.start();
}
/**
* This is the main renderer for the list of ripple, we always check that the first ripple is already
* finished.
* <p>
* When the ripple is finished it is {@link ShapeRippleEntry#reset()} and move to the end of the list to be reused all over again
* to prevent creating a new instance of it.
* <p>
* Each ripple will be configured to be either rendered or not rendered to the view to prevent extra rendering process.
*
* @param multiplierValue the current multiplier value of the {@link #rippleValueAnimator}
*/
private void render(Float multiplierValue) {
// Do not render when entries are empty
if (shapeRippleEntries.size() == 0) {
logD("There are no ripple entries that was created!!");
return;
}
ShapeRippleEntry firstEntry = shapeRippleEntries.peekFirst();
// Calculate the multiplier value of the first entry
float firstEntryMultiplierValue = firstEntry.getMultiplierValue() + Math.max(multiplierValue - lastMultiplierValue, 0);
// Check if the first entry is done the ripple (happens when the ripple reaches to end)
if (firstEntryMultiplierValue >= 1.0f) {
// Remove and relocate the first entry to the last entry
ShapeRippleEntry removedEntry = shapeRippleEntries.pop();
removedEntry.reset();
removedEntry.setOriginalColorValue(enableRandomColor ? rippleRandomColors.get(random.nextInt(rippleRandomColors.size())) : rippleColor);
shapeRippleEntries.addLast(removedEntry);
// Get the new first entry of the list
firstEntry = shapeRippleEntries.peekFirst();
// Calculate the new multiplier value of the first entry of the list
firstEntryMultiplierValue = firstEntry.getMultiplierValue() + Math.max(multiplierValue - lastMultiplierValue, 0);
firstEntry.setX(enableRandomPosition ? random.nextInt(viewWidth) : viewWidth / 2);
firstEntry.setY(enableRandomPosition ? random.nextInt(viewHeight) : viewHeight / 2);
if (enableSingleRipple) {
firstEntryMultiplierValue = 0;
}
}
int index = 0;
for (ShapeRippleEntry shapeRippleEntry : shapeRippleEntries) {
// set the updated index
shapeRippleEntry.setRippleIndex(index);
// calculate the shape multiplier by index
float currentEntryMultiplier = firstEntryMultiplierValue - rippleInterval * index;
// Check if we render the current ripple in the list
// We render when the multiplier value is >= 0
if (currentEntryMultiplier >= 0) {
shapeRippleEntry.setRender(true);
} else {
// We continue to the next item
// since we know that we do not
// need the calculations below
shapeRippleEntry.setRender(false);
continue;
}
// We already calculated the multiplier value of the first entry of the list
if (index == 0) {
shapeRippleEntry.setMultiplierValue(firstEntryMultiplierValue);
} else {
shapeRippleEntry.setMultiplierValue(currentEntryMultiplier);
}
// calculate the color if we enabled the color transition
shapeRippleEntry.setChangingColorValue(enableColorTransition
? ShapePulseUtil.evaluateTransitionColor(currentEntryMultiplier, shapeRippleEntry.getOriginalColorValue(), rippleToColor)
: rippleColor);
// calculate the current ripple size
shapeRippleEntry.setRadiusSize(maxRippleRadius * currentEntryMultiplier);
index += 1;
}
// save the last multiplier value
lastMultiplierValue = multiplierValue;
// we draw the shapes
invalidate();
}
/**
* Stop the {@link #rippleValueAnimator} and clears the {@link #shapeRippleEntries}
*/
void stop() {
if (rippleValueAnimator != null) {
rippleValueAnimator.cancel();
rippleValueAnimator.end();
rippleValueAnimator.removeAllUpdateListeners();
rippleValueAnimator.removeAllListeners();
rippleValueAnimator = null;
}
if (shapeRippleEntries != null) {
shapeRippleEntries.clear();
invalidate();
}
}
/**
* Starts the ripple by stopping the current {@link #rippleValueAnimator} using the {@link #stop()}
* then initializing ticket entries using the {@link #initializeEntries(BaseShape)}
* and lastly starting the {@link #rippleValueAnimator} using {@link #start(int)}
*/
public void startRipple() {
//stop the animation from previous before starting it again
stop();
initializeEntries(rippleShape);
start(rippleDuration);
this.isStopped = false;
}
/**
* Stops the ripple see {@link #stop()} for more details
*/
public void stopRipple() {
stop();
this.isStopped = true;
}
/**
* This restarts the ripple or continue where it was left off, this is mostly used
* for {@link LifeCycleManager}.
*/
protected void restartRipple() {
if (this.isStopped) {
logD("Restarted from stopped ripple!!");
return;
}
startRipple();
}
/**
* @return The max ripple radius
*/
public float getRippleMaximumRadius() {
return maxRippleRadius;
}
/**
* @return True if color transition is enabled
*/
public boolean isEnableColorTransition() {
return enableColorTransition;
}
/**
* @return True of single ripple is enabled
*/
public boolean isEnableSingleRipple() {
return enableSingleRipple;
}
/**
* @return True of random ripple position is enabled
*/
public boolean isEnableRandomPosition() {
return enableRandomPosition;
}
/**
* @return The stroke width(in pixels) for each ripple
*/
public int getRippleStrokeWidth() {
return rippleStrokeWidth;
}
/**
* @return The base ripple color
*/
public int getRippleColor() {
return rippleColor;
}
/**
* @return The starting ripple color of the color transition
*/
public int getRippleFromColor() {
return rippleFromColor;
}
/**
* @return The end ripple color of the color transition
*/
public int getRippleToColor() {
return rippleToColor;
}
/**
* @return The duration of each ripple in milliseconds
*/
public int getRippleDuration() {
return rippleDuration;
}
/**
* @return The number of ripple being rendered
*/
public int getRippleCount() {
return rippleCount;
}
/**
* @return The interpolator of the value animator
*/
public Interpolator getRippleInterpolator() {
return rippleInterpolator;
}
/**
* @return True if random color for each ripple is enabled
*/
public boolean isEnableRandomColor() {
return enableRandomColor;
}
/**
* @return True if it is using STROKE style for each ripple
*/
public boolean isEnableStrokeStyle() {
return enableStrokeStyle;
}
/**
* @return The shape renderer for the shape ripples
*/
public BaseShape getRippleShape() {
return rippleShape;
}
/**
* @return The list of developer predefined random colors
*/
public List<Integer> getRippleRandomColors() {
return rippleRandomColors;
}
/**
* Change the maximum size of the ripple, default to the size of the layout.
* <p>
* Value must be greater than 1
*
* @param rippleMaximumRadius The floating ripple interval for each ripple
*/
public void setRippleMaximumRadius(float rippleMaximumRadius) {
if (rippleMaximumRadius <= NO_VALUE) {
throw new IllegalArgumentException("Ripple max radius must be greater than 0");
}
this.rippleMaximumRadius = rippleMaximumRadius;
requestLayout();
}
/**
* Enables the color transition for each ripple
*
* @param enableColorTransition flag for enabling color trasition
*/
public void setEnableColorTransition(boolean enableColorTransition) {
this.enableColorTransition = enableColorTransition;
}
/**
* Enables the single ripple rendering
*
* @param enableSingleRipple flag for enabling single ripple
*/
public void setEnableSingleRipple(boolean enableSingleRipple) {
this.enableSingleRipple = enableSingleRipple;
initializeEntries(rippleShape);
}
/**
* Change the stroke width for each ripple
*
* @param rippleStrokeWidth The stroke width in pixel
*/
public void setRippleStrokeWidth(int rippleStrokeWidth) {
if (rippleStrokeWidth <= 0) {
throw new IllegalArgumentException("Ripple duration must be > 0");
}
this.rippleStrokeWidth = rippleStrokeWidth;
}
/**
* Change the base color of each ripple
*
* @param rippleColor The ripple color
*/
public void setRippleColor(int rippleColor) {
setRippleColor(rippleColor, true);
}
/**
* Change the base color of each ripple
*
* @param rippleColor The ripple color
* @param instant flag for when changing color is instant without delay
*/
public void setRippleColor(int rippleColor, boolean instant) {
this.rippleColor = rippleColor;
if (instant) {
reconfigureEntries();
}
}
/**
* Change the starting color of the color transition
*
* @param rippleFromColor The starting color
*/
public void setRippleFromColor(int rippleFromColor) {
setRippleFromColor(rippleFromColor, true);
}
/**
* Change the starting color of the color transition
*
* @param rippleFromColor The starting color
* @param instant flag for when changing color is instant without delay
*/
public void setRippleFromColor(int rippleFromColor, boolean instant) {
this.rippleFromColor = rippleFromColor;
if (instant) {
reconfigureEntries();
}
}
/**
* Change the end color of the color transition
*
* @param rippleToColor The end color
*/
public void setRippleToColor(int rippleToColor) {
setRippleToColor(rippleToColor, true);
}
/**
* Change the end color of the color transition
*
* @param rippleToColor The end color
* @param instant flag for when changing color is instant without delay
*/
public void setRippleToColor(int rippleToColor, boolean instant) {
this.rippleToColor = rippleToColor;
if (instant) {
reconfigureEntries();
}
}
/**
* Change the ripple duration of the animator
*
* @param millis The duration in milliseconds
*/
public void setRippleDuration(int millis) {
if (rippleDuration <= 0) {
throw new IllegalArgumentException("Ripple duration must be > 0");
}
this.rippleDuration = millis;
// We set the duration here this will auto change the animator
if (rippleValueAnimator != null) {
rippleValueAnimator.setDuration(rippleDuration);
}
}
/**
* Enables the random positioning of ripples
*
* @param enableRandomPosition flag for enabling random position
*/
public void setEnableRandomPosition(boolean enableRandomPosition) {
this.enableRandomPosition = enableRandomPosition;
initializeEntries(rippleShape);
}
/**
* Change the {@link Interpolator} of the animator
*
* @param rippleInterpolator The interpolator
*/
public void setRippleInterpolator(Interpolator rippleInterpolator) {
if (rippleInterpolator == null) {
throw new NullPointerException("Ripple interpolator in null");
}
this.rippleInterpolator = rippleInterpolator;
}
/**
* Enables the random coloring of each ripple
*
* @param enableRandomColor flag for enabling random color
*/
public void setEnableRandomColor(boolean enableRandomColor) {
this.enableRandomColor = enableRandomColor;
reconfigureEntries();
}
/**
* Change the number of ripples, default value is calculated based on the
* layout_width / ripple_width.
*
* @param rippleCount The number of ripples
*/
public void setRippleCount(int rippleCount) {
if (rippleCount <= NO_VALUE) {
throw new NullPointerException("Invalid ripple count");
}
this.rippleCount = rippleCount;
requestLayout();
}
/**
* Enables the stroke style of each ripple
*
* @param enableStrokeStyle flag for enabling STROKE style
*/
public void setEnableStrokeStyle(boolean enableStrokeStyle) {
this.enableStrokeStyle = enableStrokeStyle;
if (enableStrokeStyle) {
this.shapePaint.setStyle(Paint.Style.STROKE);
} else {
this.shapePaint.setStyle(Paint.Style.FILL);
}
}
/**
* Change the shape renderer of the ripples
*
* @param rippleShape The renderer of shapes ripple
*/
public void setRippleShape(BaseShape rippleShape) {
this.rippleShape = rippleShape;
// Make sure we call onSetup right away
this.rippleShape.onSetup(getContext(), this.shapePaint);
reconfigureEntries();
}
/**
* Change the developer predefined random colors
*
* @param rippleRandomColors The list of colors
*/
public void setRippleRandomColors(List<Integer> rippleRandomColors) {
if (rippleRandomColors == null) {
throw new NullPointerException("List of colors cannot be null");
}
if (rippleRandomColors.size() == 0) {
throw new IllegalArgumentException("List of color cannot be empty");
}
// We clear the list of colors before adding new colors
this.rippleRandomColors.clear();
this.rippleRandomColors = rippleRandomColors;
reconfigureEntries();
}
/**
* Enabled the debugging for the library
*/
public static void enableDebugging() {
ShapeRipple.DEBUG = true;
}
}
| 11,660 |
348 | {"nom":"Beyrie-en-Béarn","circ":"1ère circonscription","dpt":"Pyrénées-Atlantiques","inscrits":144,"abs":52,"votants":92,"blancs":2,"nuls":0,"exp":90,"res":[{"nuance":"MDM","nom":"<NAME>","voix":41},{"nuance":"FN","nom":"Mme <NAME>","voix":12},{"nuance":"FI","nom":"Mme <NAME>","voix":12},{"nuance":"LR","nom":"<NAME>","voix":8},{"nuance":"SOC","nom":"M. <NAME>","voix":7},{"nuance":"COM","nom":"M. <NAME>","voix":5},{"nuance":"REG","nom":"Mme <NAME>","voix":3},{"nuance":"DVG","nom":"<NAME>","voix":1},{"nuance":"DLF","nom":"M. <NAME>","voix":1},{"nuance":"DVG","nom":"<NAME>","voix":0},{"nuance":"EXG","nom":"Mme <NAME>","voix":0},{"nuance":"DIV","nom":"Mme <NAME>","voix":0}]} | 281 |
1,443 | <filename>users/cel.json
{
"copyright": "<NAME>",
"url": "http://celehner.com",
"email": "<EMAIL>",
"gravatar": true
}
| 54 |
432 | <gh_stars>100-1000
package org.openmhealth.shim.googlefit.mapper;
import com.fasterxml.jackson.databind.JsonNode;
import org.openmhealth.schema.domain.omh.DataPoint;
import org.openmhealth.schema.domain.omh.DataPointHeader;
import org.openmhealth.schema.domain.omh.Measure;
import org.openmhealth.schema.domain.omh.SchemaId;
import org.openmhealth.shim.common.mapper.DataPointMapperUnitTests;
import org.openmhealth.shim.googlefit.common.GoogleFitTestProperties;
import java.io.IOException;
import java.util.Arrays;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.nullValue;
import static org.openmhealth.schema.domain.omh.DataPointModality.SELF_REPORTED;
import static org.openmhealth.shim.googlefit.mapper.GoogleFitDataPointMapper.RESOURCE_API_SOURCE_NAME;
/**
* Base class for unit tests that evaluate individual data point mappers, used to build the measure specific unit
* tests.
*
* @author <NAME>
*/
public abstract class GoogleFitDataPointMapperUnitTests<T extends Measure> extends DataPointMapperUnitTests {
protected JsonNode responseNode;
public abstract void initializeResponseNode() throws IOException;
/**
* Implemented by measure specific test classes in order to test the {@link Measure} contained within the mapper
* created {@link DataPoint}. Should contain the assertions needed to test the individual values in the measure.
*/
public abstract void assertThatMeasureMatches(T testMeasure, GoogleFitTestProperties testProperties);
/**
* Used to test data points created through measure specific Google Fit mappers.
*
* @param dataPoint data point created by the mapper
* @param testProperties properties to test against the mapper generated data point
*/
public void assertThatDataPointMatches(DataPoint<T> dataPoint, GoogleFitTestProperties testProperties) {
assertThatMeasureMatches(dataPoint.getBody(), testProperties);
DataPointHeader dataPointHeader = dataPoint.getHeader();
assertThat(dataPointHeader.getAcquisitionProvenance().getSourceName(), equalTo(RESOURCE_API_SOURCE_NAME));
assertThat(dataPointHeader.getAcquisitionProvenance().getAdditionalProperties().get(
"source_origin_id"), equalTo(testProperties.getSourceOriginId()));
assertThat(dataPointHeader.getBodySchemaId(), equalTo(testProperties.getBodySchemaId()));
if (testProperties.getModality().isPresent()) {
assertThat(
dataPointHeader.getAcquisitionProvenance().getModality(),
equalTo(testProperties.getModality().get()));
}
else {
assertThat(dataPointHeader.getAcquisitionProvenance().getModality(), nullValue());
}
}
/**
* Creates a test properties object used to generate an expected value data point to test google fit data points
* that use floating point values in their response.
*
* @deprecated use varargs instead
*/
@Deprecated
public GoogleFitTestProperties createFloatingPointTestProperties(double fpValue, String startDateTime,
String endDateTime, String sourceOriginId, SchemaId schemaId) {
return createTestProperties(startDateTime, endDateTime, sourceOriginId, schemaId, fpValue);
}
/**
* Creates a test properties object used to generate an expected value data point to test google fit data points
* that use integer values in their response.
*
* @deprecated use varargs instead
*/
@Deprecated
public GoogleFitTestProperties createIntegerTestProperties(long intValue, String startDateTime, String endDateTime,
String sourceOriginId, SchemaId schemaId) {
return createTestProperties(startDateTime, endDateTime, sourceOriginId, schemaId, intValue);
}
/**
* Creates a test properties object used to generate an expected value data point to test google fit data points
* that use strings to represent values.
*
* @deprecated use varargs instead
*/
public GoogleFitTestProperties createStringTestProperties(
String stringValue,
String startDateTime,
String endDateTime,
String sourceOriginId,
SchemaId schemaId) {
return createTestProperties(startDateTime, endDateTime, sourceOriginId, schemaId, stringValue);
}
public GoogleFitTestProperties createTestProperties(
String startDateTimeString,
String endDateTimeString,
String sourceOriginId,
SchemaId schemaId,
Object... values) {
GoogleFitTestProperties testProperties = new GoogleFitTestProperties();
if (startDateTimeString != null) {
testProperties.setEffectiveStartDateTime(startDateTimeString);
}
if (endDateTimeString != null) {
testProperties.setEffectiveEndDateTime(endDateTimeString);
}
if (sourceOriginId != null) {
testProperties.setSourceOriginId(sourceOriginId);
if (sourceOriginId.endsWith("user_input")) {
testProperties.setModality(SELF_REPORTED);
}
}
testProperties.setBodySchemaId(schemaId);
Arrays.stream(values).forEach(testProperties::addValue);
return testProperties;
}
}
| 1,922 |
1,305 | /*
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.sun.org.apache.xml.internal.res;
import java.util.ListResourceBundle;
/**
* Set up error messages.
* We build a two dimensional array of message keys and
* message strings. In order to add a new message here,
* you need to first add a String constant. And you need
* to enter key, value pair as part of the contents
* array. You also need to update MAX_CODE for error strings
* and MAX_WARNING for warnings ( Needed for only information
* purpose )
*/
public class XMLErrorResources_it extends ListResourceBundle
{
/*
* This file contains error and warning messages related to Xalan Error
* Handling.
*
* General notes to translators:
*
* 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of
* components.
* XSLT is an acronym for "XML Stylesheet Language: Transformations".
* XSLTC is an acronym for XSLT Compiler.
*
* 2) A stylesheet is a description of how to transform an input XML document
* into a resultant XML document (or HTML document or text). The
* stylesheet itself is described in the form of an XML document.
*
* 3) A template is a component of a stylesheet that is used to match a
* particular portion of an input document and specifies the form of the
* corresponding portion of the output document.
*
* 4) An element is a mark-up tag in an XML document; an attribute is a
* modifier on the tag. For example, in <elem attr='val' attr2='val2'>
* "elem" is an element name, "attr" and "attr2" are attribute names with
* the values "val" and "val2", respectively.
*
* 5) A namespace declaration is a special attribute that is used to associate
* a prefix with a URI (the namespace). The meanings of element names and
* attribute names that use that prefix are defined with respect to that
* namespace.
*
* 6) "Translet" is an invented term that describes the class file that
* results from compiling an XML stylesheet into a Java class.
*
* 7) XPath is a specification that describes a notation for identifying
* nodes in a tree-structured representation of an XML document. An
* instance of that notation is referred to as an XPath expression.
*
*/
/** Maximum error messages, this is needed to keep track of the number of messages. */
public static final int MAX_CODE = 61;
/** Maximum warnings, this is needed to keep track of the number of warnings. */
public static final int MAX_WARNING = 0;
/** Maximum misc strings. */
public static final int MAX_OTHERS = 4;
/** Maximum total warnings and error messages. */
public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING + 1;
/*
* Message keys
*/
public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED";
public static final String ER_CANNOT_OVERWRITE_CAUSE = "ER_CANNOT_OVERWRITE_CAUSE";
public static final String ER_NO_DEFAULT_IMPL = "ER_NO_DEFAULT_IMPL";
public static final String ER_CHUNKEDINTARRAY_NOT_SUPPORTED = "ER_CHUNKEDINTARRAY_NOT_SUPPORTED";
public static final String ER_OFFSET_BIGGER_THAN_SLOT = "ER_OFFSET_BIGGER_THAN_SLOT";
public static final String ER_COROUTINE_NOT_AVAIL = "ER_COROUTINE_NOT_AVAIL";
public static final String ER_COROUTINE_CO_EXIT = "ER_COROUTINE_CO_EXIT";
public static final String ER_COJOINROUTINESET_FAILED = "ER_COJOINROUTINESET_FAILED";
public static final String ER_COROUTINE_PARAM = "ER_COROUTINE_PARAM";
public static final String ER_PARSER_DOTERMINATE_ANSWERS = "ER_PARSER_DOTERMINATE_ANSWERS";
public static final String ER_NO_PARSE_CALL_WHILE_PARSING = "ER_NO_PARSE_CALL_WHILE_PARSING";
public static final String ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED";
public static final String ER_ITERATOR_AXIS_NOT_IMPLEMENTED = "ER_ITERATOR_AXIS_NOT_IMPLEMENTED";
public static final String ER_ITERATOR_CLONE_NOT_SUPPORTED = "ER_ITERATOR_CLONE_NOT_SUPPORTED";
public static final String ER_UNKNOWN_AXIS_TYPE = "ER_UNKNOWN_AXIS_TYPE";
public static final String ER_AXIS_NOT_SUPPORTED = "ER_AXIS_NOT_SUPPORTED";
public static final String ER_NO_DTMIDS_AVAIL = "ER_NO_DTMIDS_AVAIL";
public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED";
public static final String ER_NODE_NON_NULL = "ER_NODE_NON_NULL";
public static final String ER_COULD_NOT_RESOLVE_NODE = "ER_COULD_NOT_RESOLVE_NODE";
public static final String ER_STARTPARSE_WHILE_PARSING = "ER_STARTPARSE_WHILE_PARSING";
public static final String ER_STARTPARSE_NEEDS_SAXPARSER = "ER_STARTPARSE_NEEDS_SAXPARSER";
public static final String ER_COULD_NOT_INIT_PARSER = "ER_COULD_NOT_INIT_PARSER";
public static final String ER_EXCEPTION_CREATING_POOL = "ER_EXCEPTION_CREATING_POOL";
public static final String ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE = "ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE";
public static final String ER_SCHEME_REQUIRED = "ER_SCHEME_REQUIRED";
public static final String ER_NO_SCHEME_IN_URI = "ER_NO_SCHEME_IN_URI";
public static final String ER_NO_SCHEME_INURI = "ER_NO_SCHEME_INURI";
public static final String ER_PATH_INVALID_CHAR = "ER_PATH_INVALID_CHAR";
public static final String ER_SCHEME_FROM_NULL_STRING = "ER_SCHEME_FROM_NULL_STRING";
public static final String ER_SCHEME_NOT_CONFORMANT = "ER_SCHEME_NOT_CONFORMANT";
public static final String ER_HOST_ADDRESS_NOT_WELLFORMED = "ER_HOST_ADDRESS_NOT_WELLFORMED";
public static final String ER_PORT_WHEN_HOST_NULL = "ER_PORT_WHEN_HOST_NULL";
public static final String ER_INVALID_PORT = "ER_INVALID_PORT";
public static final String ER_FRAG_FOR_GENERIC_URI ="ER_FRAG_FOR_GENERIC_URI";
public static final String ER_FRAG_WHEN_PATH_NULL = "ER_FRAG_WHEN_PATH_NULL";
public static final String ER_FRAG_INVALID_CHAR = "ER_FRAG_INVALID_CHAR";
public static final String ER_PARSER_IN_USE = "ER_PARSER_IN_USE";
public static final String ER_CANNOT_CHANGE_WHILE_PARSING = "ER_CANNOT_CHANGE_WHILE_PARSING";
public static final String ER_SELF_CAUSATION_NOT_PERMITTED = "ER_SELF_CAUSATION_NOT_PERMITTED";
public static final String ER_NO_USERINFO_IF_NO_HOST = "ER_NO_USERINFO_IF_NO_HOST";
public static final String ER_NO_PORT_IF_NO_HOST = "ER_NO_PORT_IF_NO_HOST";
public static final String ER_NO_QUERY_STRING_IN_PATH = "ER_NO_QUERY_STRING_IN_PATH";
public static final String ER_NO_FRAGMENT_STRING_IN_PATH = "ER_NO_FRAGMENT_STRING_IN_PATH";
public static final String ER_CANNOT_INIT_URI_EMPTY_PARMS = "ER_CANNOT_INIT_URI_EMPTY_PARMS";
public static final String ER_METHOD_NOT_SUPPORTED ="ER_METHOD_NOT_SUPPORTED";
public static final String ER_INCRSAXSRCFILTER_NOT_RESTARTABLE = "ER_INCRSAXSRCFILTER_NOT_RESTARTABLE";
public static final String ER_XMLRDR_NOT_BEFORE_STARTPARSE = "ER_XMLRDR_NOT_BEFORE_STARTPARSE";
public static final String ER_AXIS_TRAVERSER_NOT_SUPPORTED = "ER_AXIS_TRAVERSER_NOT_SUPPORTED";
public static final String ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER = "ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER";
public static final String ER_SYSTEMID_UNKNOWN = "ER_SYSTEMID_UNKNOWN";
public static final String ER_LOCATION_UNKNOWN = "ER_LOCATION_UNKNOWN";
public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE";
public static final String ER_CREATEDOCUMENT_NOT_SUPPORTED = "ER_CREATEDOCUMENT_NOT_SUPPORTED";
public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT";
public static final String ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT = "ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT";
public static final String ER_CANT_OUTPUT_TEXT_BEFORE_DOC = "ER_CANT_OUTPUT_TEXT_BEFORE_DOC";
public static final String ER_CANT_HAVE_MORE_THAN_ONE_ROOT = "ER_CANT_HAVE_MORE_THAN_ONE_ROOT";
public static final String ER_ARG_LOCALNAME_NULL = "ER_ARG_LOCALNAME_NULL";
public static final String ER_ARG_LOCALNAME_INVALID = "ER_ARG_LOCALNAME_INVALID";
public static final String ER_ARG_PREFIX_INVALID = "ER_ARG_PREFIX_INVALID";
public static final String ER_NAME_CANT_START_WITH_COLON = "ER_NAME_CANT_START_WITH_COLON";
// Message keys used by the serializer
public static final String ER_RESOURCE_COULD_NOT_FIND = "ER_RESOURCE_COULD_NOT_FIND";
public static final String ER_RESOURCE_COULD_NOT_LOAD = "ER_RESOURCE_COULD_NOT_LOAD";
public static final String ER_BUFFER_SIZE_LESSTHAN_ZERO = "ER_BUFFER_SIZE_LESSTHAN_ZERO";
public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE";
public static final String ER_OIERROR = "ER_OIERROR";
public static final String ER_NAMESPACE_PREFIX = "ER_NAMESPACE_PREFIX";
public static final String ER_STRAY_ATTRIBUTE = "ER_STRAY_ATTIRBUTE";
public static final String ER_STRAY_NAMESPACE = "ER_STRAY_NAMESPACE";
public static final String ER_COULD_NOT_LOAD_RESOURCE = "ER_COULD_NOT_LOAD_RESOURCE";
public static final String ER_COULD_NOT_LOAD_METHOD_PROPERTY = "ER_COULD_NOT_LOAD_METHOD_PROPERTY";
public static final String ER_SERIALIZER_NOT_CONTENTHANDLER = "ER_SERIALIZER_NOT_CONTENTHANDLER";
public static final String ER_ILLEGAL_ATTRIBUTE_POSITION = "ER_ILLEGAL_ATTRIBUTE_POSITION";
public static final String ER_ILLEGAL_CHARACTER = "ER_ILLEGAL_CHARACTER";
/*
* Now fill in the message text.
* Then fill in the message text for that message code in the
* array. Use the new error code as the index into the array.
*/
// Error messages...
/** The lookup table for error messages. */
private static final Object[][] contents = {
/** Error message ID that has a null message, but takes in a single object. */
{"ER0000" , "{0}" },
{ ER_FUNCTION_NOT_SUPPORTED,
"Funzione non supportata."},
{ ER_CANNOT_OVERWRITE_CAUSE,
"Impossibile sovrascrivere la causa"},
{ ER_NO_DEFAULT_IMPL,
"Nessuna implementazione predefinita trovata "},
{ ER_CHUNKEDINTARRAY_NOT_SUPPORTED,
"ChunkedIntArray({0}) non supportato al momento"},
{ ER_OFFSET_BIGGER_THAN_SLOT,
"Offset pi\u00F9 grande dello slot"},
{ ER_COROUTINE_NOT_AVAIL,
"Co-routine non disponibile, ID={0}"},
{ ER_COROUTINE_CO_EXIT,
"CoroutineManager ha ricevuto una richiesta co_exit()"},
{ ER_COJOINROUTINESET_FAILED,
"co_joinCoroutineSet() non riuscito"},
{ ER_COROUTINE_PARAM,
"Errore del parametro di co-routine ({0})"},
{ ER_PARSER_DOTERMINATE_ANSWERS,
"\nIMPREVISTO: risposte doTerminate del parser {0}"},
{ ER_NO_PARSE_CALL_WHILE_PARSING,
"impossibile richiamare parse mentre \u00E8 in corso un'analisi"},
{ ER_TYPED_ITERATOR_AXIS_NOT_IMPLEMENTED,
"Errore: l''iteratore con tipo per l''asse {0} non \u00E8 implementato"},
{ ER_ITERATOR_AXIS_NOT_IMPLEMENTED,
"Errore: l''iteratore per l''asse {0} non \u00E8 implementato "},
{ ER_ITERATOR_CLONE_NOT_SUPPORTED,
"Duplicazione dell'iteratore non supportata"},
{ ER_UNKNOWN_AXIS_TYPE,
"Tipo di asse trasversale sconosciuto: {0}"},
{ ER_AXIS_NOT_SUPPORTED,
"Asse trasversale non supportato: {0}"},
{ ER_NO_DTMIDS_AVAIL,
"Non sono disponibili altri ID DTM"},
{ ER_NOT_SUPPORTED,
"Non supportato: {0}"},
{ ER_NODE_NON_NULL,
"Il nodo deve essere non nullo per getDTMHandleFromNode"},
{ ER_COULD_NOT_RESOLVE_NODE,
"Impossibile risolvere il nodo in un handle"},
{ ER_STARTPARSE_WHILE_PARSING,
"impossibile richiamare startParse mentre \u00E8 in corso un'analisi"},
{ ER_STARTPARSE_NEEDS_SAXPARSER,
"startParse richiede un valore non nullo per SAXParser"},
{ ER_COULD_NOT_INIT_PARSER,
"impossibile inizializzare il parser con"},
{ ER_EXCEPTION_CREATING_POOL,
"eccezione durante la creazione di una nuova istanza per il pool"},
{ ER_PATH_CONTAINS_INVALID_ESCAPE_SEQUENCE,
"Il percorso contiene sequenza di escape non valida"},
{ ER_SCHEME_REQUIRED,
"Lo schema \u00E8 obbligatorio."},
{ ER_NO_SCHEME_IN_URI,
"Nessuno schema trovato nell''URI: {0}"},
{ ER_NO_SCHEME_INURI,
"Nessuno schema trovato nell'URI"},
{ ER_PATH_INVALID_CHAR,
"Il percorso contiene un carattere non valido: {0}"},
{ ER_SCHEME_FROM_NULL_STRING,
"Impossibile impostare lo schema da una stringa nulla"},
{ ER_SCHEME_NOT_CONFORMANT,
"Lo schema non \u00E8 conforme."},
{ ER_HOST_ADDRESS_NOT_WELLFORMED,
"Host non \u00E8 un indirizzo corretto"},
{ ER_PORT_WHEN_HOST_NULL,
"La porta non pu\u00F2 essere impostata se l'host \u00E8 nullo"},
{ ER_INVALID_PORT,
"Numero di porta non valido"},
{ ER_FRAG_FOR_GENERIC_URI,
"Il frammento pu\u00F2 essere impostato solo per un URI generico"},
{ ER_FRAG_WHEN_PATH_NULL,
"Il frammento non pu\u00F2 essere impostato se il percorso \u00E8 nullo"},
{ ER_FRAG_INVALID_CHAR,
"Il frammento contiene un carattere non valido"},
{ ER_PARSER_IN_USE,
"Parser gi\u00E0 in uso"},
{ ER_CANNOT_CHANGE_WHILE_PARSING,
"Impossibile modificare {0} {1} durante l''analisi"},
{ ER_SELF_CAUSATION_NOT_PERMITTED,
"Creazione automatica della causa non consentita"},
{ ER_NO_USERINFO_IF_NO_HOST,
"Userinfo non pu\u00F2 essere specificato se l'host non \u00E8 specificato"},
{ ER_NO_PORT_IF_NO_HOST,
"La porta non pu\u00F2 essere specificata se l'host non \u00E8 specificato"},
{ ER_NO_QUERY_STRING_IN_PATH,
"La stringa di query non pu\u00F2 essere specificata nella stringa di percorso e query."},
{ ER_NO_FRAGMENT_STRING_IN_PATH,
"Il frammento non pu\u00F2 essere specificato sia nel percorso che nel frammento"},
{ ER_CANNOT_INIT_URI_EMPTY_PARMS,
"Impossibile inizializzare l'URI con i parametri vuoti"},
{ ER_METHOD_NOT_SUPPORTED,
"Metodo attualmente non supportato "},
{ ER_INCRSAXSRCFILTER_NOT_RESTARTABLE,
"IncrementalSAXSource_Filter attualmente non riavviabile"},
{ ER_XMLRDR_NOT_BEFORE_STARTPARSE,
"XMLReader non si trova prima della richiesta startParse"},
{ ER_AXIS_TRAVERSER_NOT_SUPPORTED,
"Asse trasversale non supportato: {0}"},
{ ER_ERRORHANDLER_CREATED_WITH_NULL_PRINTWRITER,
"ListingErrorHandler creato con PrintWriter nullo."},
{ ER_SYSTEMID_UNKNOWN,
"SystemId sconosciuto"},
{ ER_LOCATION_UNKNOWN,
"Posizione sconosciuta dell'errore"},
{ ER_PREFIX_MUST_RESOLVE,
"Il prefisso deve essere risolto in uno spazio di nomi: {0}"},
{ ER_CREATEDOCUMENT_NOT_SUPPORTED,
"createDocument() non supportato in XPathContext"},
{ ER_CHILD_HAS_NO_OWNER_DOCUMENT,
"L'elemento figlio dell'attributo non dispone di un documento proprietario."},
{ ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT,
"L'elemento figlio dell'attributo non dispone di un elemento di documento proprietario."},
{ ER_CANT_OUTPUT_TEXT_BEFORE_DOC,
"Avvertenza: impossibile creare l'output del testo prima dell'elemento del documento. Operazione ignorata..."},
{ ER_CANT_HAVE_MORE_THAN_ONE_ROOT,
"Non possono esistere pi\u00F9 radici in un DOM."},
{ ER_ARG_LOCALNAME_NULL,
"L'argomento 'localName' \u00E8 nullo"},
// Note to translators: A QNAME has the syntactic form [NCName:]NCName
// The localname is the portion after the optional colon; the message indicates
// that there is a problem with that part of the QNAME.
{ ER_ARG_LOCALNAME_INVALID,
"Localname in QNAME deve essere un NCName valido"},
// Note to translators: A QNAME has the syntactic form [NCName:]NCName
// The prefix is the portion before the optional colon; the message indicates
// that there is a problem with that part of the QNAME.
{ ER_ARG_PREFIX_INVALID,
"Il prefisso in QNAME deve essere un NCName valido"},
{ ER_NAME_CANT_START_WITH_COLON,
"Il nome non pu\u00F2 iniziare con i due punti"},
{ "BAD_CODE", "Parametro per createMessage fuori limite"},
{ "FORMAT_FAILED", "Eccezione durante la chiamata messageFormat"},
{ "line", "N. riga"},
{ "column","N. colonna"},
{ER_SERIALIZER_NOT_CONTENTHANDLER,
"La classe serializzatore ''{0}'' non implementa org.xml.sax.ContentHandler."},
{ER_RESOURCE_COULD_NOT_FIND,
"Risorsa [ {0} ] non trovata.\n {1}" },
{ER_RESOURCE_COULD_NOT_LOAD,
"Impossibile caricare la risorsa [ {0} ]: {1} \n {2} \t {3}" },
{ER_BUFFER_SIZE_LESSTHAN_ZERO,
"Dimensione buffer <=0" },
{ER_INVALID_UTF16_SURROGATE,
"Rilevato surrogato UTF-16 non valido: {0}?" },
{ER_OIERROR,
"Errore IO" },
{ER_ILLEGAL_ATTRIBUTE_POSITION,
"Impossibile aggiungere l''attributo {0} dopo i nodi figlio o prima che sia prodotto un elemento. L''attributo verr\u00E0 ignorato."},
/*
* Note to translators: The stylesheet contained a reference to a
* namespace prefix that was undefined. The value of the substitution
* text is the name of the prefix.
*/
{ER_NAMESPACE_PREFIX,
"Lo spazio di nomi per il prefisso ''{0}'' non \u00E8 stato dichiarato." },
/*
* Note to translators: This message is reported if the stylesheet
* being processed attempted to construct an XML document with an
* attribute in a place other than on an element. The substitution text
* specifies the name of the attribute.
*/
{ER_STRAY_ATTRIBUTE,
"Attributo ''{0}'' al di fuori dell''elemento." },
/*
* Note to translators: As with the preceding message, a namespace
* declaration has the form of an attribute and is only permitted to
* appear on an element. The substitution text {0} is the namespace
* prefix and {1} is the URI that was being used in the erroneous
* namespace declaration.
*/
{ER_STRAY_NAMESPACE,
"Dichiarazione dello spazio di nomi ''{0}''=''{1}'' al di fuori dell''elemento." },
{ER_COULD_NOT_LOAD_RESOURCE,
"Impossibile caricare ''{0}'' (verificare CLASSPATH); verranno utilizzati i valori predefiniti"},
{ ER_ILLEGAL_CHARACTER,
"Tentativo di eseguire l''output di un carattere di valore integrale {0} non rappresentato nella codifica di output {1} specificata."},
{ER_COULD_NOT_LOAD_METHOD_PROPERTY,
"Impossibile caricare il file delle propriet\u00E0 ''{0}'' per il metodo di emissione ''{1}'' (verificare CLASSPATH)" }
};
/**
* Get the association list.
*
* @return The association list.
*/
protected Object[][] getContents() {
return contents;
}
}
| 7,602 |
13,648 | # test ustruct and endian specific things
try:
import ustruct as struct
except:
try:
import struct
except ImportError:
print("SKIP")
raise SystemExit
# unpack/unpack_from with unaligned native type
buf = b'0123456789'
print(struct.unpack('h', memoryview(buf)[1:3]))
print(struct.unpack_from('i', buf, 1))
print(struct.unpack_from('@i', buf, 1))
print(struct.unpack_from('@ii', buf, 1))
# pack_into with unaligned native type
buf = bytearray(b'>----<<<<<<<')
struct.pack_into('i', buf, 1, 0x30313233)
print(buf)
struct.pack_into('@ii', buf, 3, 0x34353637, 0x41424344)
print(buf)
| 253 |
1,560 | <gh_stars>1000+
#!/usr/bin/env python
import sys
count = 0
while True:
line = sys.stdin.readline()
if ' route' in line:
count += 1
if count % 100 == 0:
sys.stderr.write('received %-10d\n' % count)
sys.stderr.flush()
| 133 |
435 | {
"description": "Brand-new challenges have arisen in the field of three-dimensional space\nand form, such as; architecture, geometry, material, and even energy,\nwhich requires in thorough investigation and understanding of the\noutcomes to discover optimum design solutions. However, without this\nunderstanding, analysis and the overlay of interactive data seems\nimpossible and fanciful. Although it was not possible to analyse and use\ndata in traditional architecture, today it is getting real to do with\nthe large volumes of information such as, annual climatic data, sun\npositions, environmental data, energy data etc.\n\nPython is the most adaptable and robust program which we use to analyse,\noverlay and optimise data in the field of architecture. We want to\nunderstand how it works in a three-dimensional program such as Rhino and\nhow it can help us to develop our ideas and utilise the recent\narchitectural design methodology, which is known as parametric\narchitecture, or algorithmic architecture.\n\nWe will demonstrate 3 different experiences in the fields of; geometry,\nenergy, and optimization, and what the approach of each is. Python aids\nthe design of architectural elements through the relation of form to and\ndata simulations. This would be of interest to those who want to see the\nfuture of algorithmic design for; architects, designers, and\nprogrammers. There is no experience needed, we just want to express the\nenjoyment these tools can add to three-dimensional design.\n",
"duration": 2270,
"recorded": "2016-10-06",
"related_urls": [
"https://2016.za.pycon.org/talks/40/"
],
"speakers": [
"<NAME>"
],
"thumbnail_url": "https://i.ytimg.com/vi/gXn6J70q8ac/hqdefault.jpg",
"title": "Python, Pet of Architects",
"videos": [
{
"type": "youtube",
"url": "http://youtu.be/gXn6J70q8ac"
},
{
"type": "archive",
"url": "https://archive.org/details/pyconza2016-Python_Pet_of_Architects"
}
]
}
| 577 |
3,055 | /*
Fontname: -FreeType-Old Standard TT-Bold-R-Normal--48-480-72-72-P-259-ISO10646-1
Copyright: Copyright (C) 2006-2008 <NAME> <<EMAIL>>
Glyphs: 191/1376
BBX Build Mode: 0
*/
const uint8_t u8g2_font_osb35_tf[12448] U8G2_FONT_SECTION("u8g2_font_osb35_tf") =
"\277\0\5\4\6\6\5\6\7\65\71\376\364#\366#\370\7\250\20\301\60\203 \6\0\0\301&!\35\210"
"\70Ag\60\302\204\7>\60\202\21\266A\10]\21F~\334\204\7\36\20\301\4\0\42 L\63m\251"
"\10&\10\62H(BO\224\60\310\20\203\14\61\310\20\203\14\61\310\20\203\214\0\0#Y\234\70Aq"
"\32h\270\201\206\33h\270\201F#\207\264\201\206\33h\270\201\206\33h\230\7\376@:\3\15\67\320p"
"\3\15\67\320h\4\215\66\20i\3\15\67\320p\3\15\67\320@\17\260\360\0\13\17\60\63\320p\3\15"
"\67\320p\3\215F\16i\3\221\66\320p\3\15\67\320P\0$\214\227*\71.\22D<A\304\23D"
"<ADc\252\20\21\206\31B\20\61\4!B\20i\214!\210 #\220!\210 #\220!\210\30$"
"\220!\210\20%\24!\210\10V\20D\4\23\22\21\241\210D\204\30D\11\221V\20\252)\267\332r\253"
"\251\246DXI\214$\212\20$\205\42\4yB\20\21\230\20D\10\65\4\21\3\21i\234\42\210\30C"
"\210\42\210\30C\14\42\211A\306\20D\210Q\206\20D\4\221Z\23D<A\304\23D<A\304\1%"
"\202!I\277\264\26\311<\201\210 l\240A\6\23\210\20\242D\42\204(\201\12)H\244B\312\31\251"
"\220r\204*\244\230\241\12)F\254BJ\21\215\20bD#\204\24\361\306 e\300!\206\21\322\30\361"
"\1\20^\34\62G\31bDQ\210 o\20\312\211B\10i\242\24R\230(\205\224%L!E\15S"
"HQ\342\24R\222@\205\224$P!\5\11E\10AC\21B\220`\203\14\64\30\21#\211g\222\320"
"\0&f\241(\301\362Bw\224Q\307\21u \61\11\22\223 \61\11\22\263\230\61\213\21\324\20Q\315"
"\20\67a\244\15\67\71\31uF\60\251\240\61L\32h\220\203\4\32\306\234q\310\61F\34\222L\21\246"
"$C\304)\312\214p\314\62A\34\263\20\62\314\244\303\14B\313 \304L\21!\241D\302X\203\204#"
"\4y$\231\225\314\0'\17E\63\355\245\10\202\204\7T\30b^\0( \316:\61\351\32j>E"
"\324PT\42\212\244\32\262\377\245\232\242\26Qd\215E\326`\363\232\0)&\315\32\261(\20k\60i"
"\315\24QCQ\211J\5U\310\34\373\357\24T!\222\10\42\211\244\221H\232O\5\6\0*\61\222\64"
"]\354!\216B\203\14\42\4\31\202\250\21F\11F\4a\205\20\14\42\216$\23B\60\302\210 \330\10"
"\243\4\62\4!a\220A\4\42\216:\0+hi*\261\366\34\37\234\361\301\31\37\234\361\301\31\37\234"
"\361\301\31\37\234\361\301\31\37\234\361\301\31\37\234\361\301\31\37\234\361\301\31\37\234\361\301\31\37\234\361\301"
"\31\363\201\377\201\61\307\7g|p\306\7g|p\306\7g|p\306\7g|p\306\7g|p\306"
"\7g|p\306\7g|p\306\7g|p\306\7g|p\306\4,\31\11$\257\246 \344\4\24\36"
"`\1\35\351\204#\214\60\243\214\42\214\60\0-\10L\61U)\370\3.\16\210\61Ag\60\341\201\7"
"D\60\1\0/:\20;/k\33\214\260\321&F\330h\203\21\66\332`\204\215\66\30a\243M\214\260"
"\321\6#l\264\301\10\33m\60\302F\233\30a\243\15F\330h\203\21\66\332`\204\215\66\65\0\60Z"
"\27)\77\356\12\363\70\62\310\42\205$r\10\42\207\234\252\230c\210\71f\234c\306\71G\234s\304\71"
"'\240\363@\70\17\204\363@\70\17\204\363@\70\17\204\363@\70\17\204\363@\70(\234s\304\71G\234"
"s\304\71\206\230c\210\71\246\224S\16\205\310!\211\24\262\310 \356\314\260\0\61\24\220hA.\42\214"
"\254\222\16a\351\376\377\377\217<\20\0\62K\225\70AnYi\24c\306\61d\240#H\62\241$\226"
"\32z\346+(\234r\206!\250\10s\332\325\214\63\256<\2G\34L\20\321\304\20N\10\361D\20P"
"\4\21\14\32\341\201\7T\30\341\201\20\4qA\24&\204QC\240C\0\63I\226\70AnYj\24"
"s\306\61e\240\63H\62\243\240#\314\71\342\230#\216\71\342\230\63\214\61\205\34\363\14,\220,DM"
"\264\340\365\316(\7\205cP\70\346\201`\36\10\346\35\207N(\10\211\221\16\31\347\230a\14b\6\0"
"\64;\227(An+\321\202\347a.k\252\211p\330\10\207\11q\326\20G\215q\224 '\15r\222"
"(\7\215r\220\60\347\14s\314\70\307\10t\312@\247<\200\326\201\367\247\36\20\1\0\65@\225H\77"
"\256\10M\24r\210y\306\235\206\226J\314<\61\345\215\223D\20\303\34bL\31\347\20\201\16\11\352\270"
"\343PC$ $\212A\301\230\237\71\241\240\23H\62c S\4\62F\230\222\324\1\66N\226\70A"
".J\213\30\221\312\21\247\34R\254R\312!\206 b\10\32\207\134\245\224c\304\71\16'\214y`\20"
"E\312H\305\10dN@\307\4t\276s\302\71'\234s\302\71'\234s\204\71f\230cH\71\246\24"
"S\16)%\21BV\62\0\67:\224XAn\10\303\224\21\204@d\4\21\24y@\220\7\304x\340"
"C&\20\30\202x\42\210'BxB\4\67\242\210\3\16H\340\200\344\221W\234i\247\231v\61\374\232"
"q\6\1\70O\227\70A\356Qk \221\304\22g\60Q\206\23d\70\61\210\23\203\70\61J\23\303\60"
"\61\216\22$\241PV\11\347!\247^z \240\7\202y@\24Q\330\20H\211\241R\20M\271\364\20"
"\274\242\10\344\15\61\236 \303\211\62\230\70\4\211\245\16\0\71O\226\70A\256I\213\20\222J!\247\230"
"R\314)\304\34\63\314\61\342\234\23\316\71\341\234\23\316\71\341\234\357\240`\16\12\247$aJ\32\205("
"\362\300\60F \207\271c\206\71\304\224C\256\201\210!\210\30rJeL!\247\234aJ\32\244\254\204"
"\0:\25\210\65Ag\60\341\201\7D\60\37\242&<\360\200\10&\0; \11(\257\246\60\2\5\234"
"\60\37\6\10\71\1\205\7\230\30B\34\311\210#\214T\6!&\34\0<M%J\263\366\7C| "
"\310\7\301t[\77\374t\273~\370\351v\375t\363\1(\37\10\363\201\60\37\204\363A\70\37\4\363\201"
"\60\37\10\363\201\60\37\204\363A\70\37\204\363A\60\37\10\363\201\60\37\204\363A\70\37\204\363A(\37"
"\14\21\0=\20i#\315\66\370\77\60>\374C\17\374\17\14>M%J\263v\20\37\20\362A\60\37"
"\10\363\201\60\37\10\363A\70\37\204\363A\60\37\10\363\201\60\37\10\363A\70\37\204\363A\60\37\10\363"
"\201\60\37\10\363A\70\37\4\363A(\336t\323\17\77\335\256\37~u[\77\374\362\345\3!>\30\0"
"\77\71\317\70A\353He\204\63D\61B\24\23\304\301;&\4c\204(f\10RRQ\324\232\330X"
"\203\211\22\216(\341\210\22\216(\1\211\21\24\371\200\5V\322A\267TX\60\0@\206\243(\301\63c"
"u(\2\207\33N\310\241\6\35h\330q\204*I\230\201\210\20\241\210A\6\42\344\14A\306!\305\220"
"!\306)\305\220!\206)\306\224\21\206)\306\24c\312)\306\230r\212\61\246\234bL\61\306*\345\224"
"cJ\71\345\230RN\61#\214R\214\61#\214R\214\61b\14RL\61c\14R\212\61\202\214B\210"
"\10\244\10\63\12\21b\220!\316\60\305\30\65>\20\343\3\61>\20\343\3\61\236\210D\15\332\26\0A"
"O\341(A\62\24~x\322\11/\334l\243\217F\31\341\204\325UV\210c\205@\65\14D\5\71T"
"\20\64CAR\230#\205A\61\34\4\5:P \364\36\30\356\1\342\204B-,\304\4;L\60\264"
"BCJ\270\223HC\247\60\65\30y@\0B[\235(\301\60x\300\264c\214:\250\244\203\14:\311"
"\234\223\314\71\351\230\223\216\71\351\230\223\216\71\351\230\223\314\71\311\234\203\14:\210\250s\310z\356\230\262"
"\316\61\351 \203N\62\347\244cNB\345$TNB\345$TNB\345$TN:\346 d\16:"
"\347 \203\216\61\345\201s\0CM\232\70\301oJE b\206\30\207\240S\212\62\245\254B\12+\303"
"\64\62L#\303\270!\216\33\342<!\316\23\1=\21\320\23\1I\374A\21\16\24\341@\21\16\14\303"
"<\61\314\23\303\274PL\23\246\60\201\10\23\211(\261\310\31N\35\0D\134\241(\301\62x\340\300\203"
"J;\212\260\263\212:\254\244\303J:\255\240\323\314\71\315\234\323\216\71\355\230\323\216\71\15\225\323P\71"
"\15\225\323P\71\15\225\323P\71\15\225\323P\71\15\225\323\216\71\355\230\323\216\71\315\234\323\314\71\255\240"
"\323\12:\254\244\303\210:\213\254\243\10;\210\244\7\316\2Ea\234(\301\60x\240\225\203P\71\312\224"
"\263J\71\214\224\303H\71m\224\323F\71N\224sD\21\345\34QD\71G\260c\6;f\260S\10"
";\244\260\7\2;\244\260S\10;f\260c\6;G\24Q\316\21E\224sD\21\345\70Q\216\23\345"
"\264QN\33\345\60R\16#\345\254R\216\62\345\240\7\36\60FN\234\70A\60x\240\225\203P\71\312"
"\224\263J\71\253\224\303H\71\214\224\323F\71m\224sD\21\345\34QD\71G\24Q\216\31E\224c"
"\6;\205\260C\12{ \260C\12;\205\260c\6;f\260s\4;G\260s\4;\365\376\340\3b"
"\1GZ\236\70\301qRE\260q\306\20\212\244\223\310\62\250\260rJ+\247\70b\214#\306\274Q\316"
"\33\345@Q\16\24\4AA\220\305\63\17\244u\10Z\207\240u\10Z\247\234u\312Y\247\234u\214Y"
"\307\230u\214Y\347\224uPIC\14T\222\30#\225#\212X\244\10#\32:\202\0H`\242\70\301"
"\63x \210\7B\71\353\244\263N:\353\244\263N:\353\244\263N:\353\244\263N:\353\244\263N:"
"\353\244\263N:\353\244\263N:\353\244\7T:\353\244\263N:\353\244\263N:\353\244\263N:\353\244"
"\263N:\353\244\263N:\353\244\263N:\353\244\263N:\353\244\263\16y \210\7\2I\21\220\70\301"
"*x \224\223\356\377\377\377G\36\10J,\227(\77\355y \260\3\357\377\177\207\224SL\271\310!"
"\210\34\202\310U\16\71\345\220r\214\31\310\30\221\12\22\247(a\10K\12\0K^\241\70\301\62x "
"\14vN:\352(\302\216\32\355(\341N\32\356\240\361\16\22\360\34\21\217\21\362\24\61\17\31\363\220\61"
"\317(\362\10#O@\361\1\1\37\20\20\11\364\316@\357\20\344\16A\356\24\324NA\355\30\304\216A"
"\354\34\264\316A\353 \244\16B\352$\224NB\351\244\64\36\10\342\1L\62\234\70A\60x \304S"
"\357\377\77'\312q\242\34'\312i\243\234\66\312i\243\234\66\312a\244\34F\312Y\245\234U\312Q\246"
"\234t\312\71\17<p\0M\225\347(\277\65`\256\225\343\220B\15)\324\220B,\251\264\222J+\204"
"\243\322\12\341(\225D\70J\204\223D\70J\4\204\202\70J\4\204\202\70J\210s\204\70J\10d\204"
"\70J\214c\302\70J\214c\302\70J\14D\304\70J\220C\2\71J\20\64\2\71J\20\64\2\71J"
"\224#\4\71J\24\24B\71J\230\23B\71J\230\23B\71J\230T\216\22\347\230\243\304\71\346(\201"
"\214\71J c\216\22\250\234\243D\42\347$\202\310\71\7\31rNaE\220\7B\24\24\0Nm\342"
"(\277\62X\311\215\244\224A\314\240\304\210JL\60\304\4KK\60\245\4[I\260\225\4\23!!\301"
"\204HG\60!\322\21L\214d\4\23$\25\301\4IE\60Q\22\21L\230\64\4\23'\11\301\304I"
"B\60\201R\20L\244\305DZL(\305\304JL\254\304\4CL\264\303\204\63L\70\263\210+\312\70"
"\202\24#\306\255\361A\20\6\0OZ\234\70\301\260Br\230\341\10\32\214(\222\212*\210\60r\12+"
"\305\60C\14\63\343\60\63\16;\342\260#\16;\1\261\7\2{ \260\7\2{ \260\7\2{ \260"
"\7\2C\341\260#\16;\342\260#\16\63\304\60C\14\63\245\260r\10#\250\250\222\210\42\213\240\361\206"
"\31\22)\0P:\235\70A\61x\300\264c\214:\310\240\353\34\204\314I\307\234\204\312I\250\234\204\312"
"I\250\234\204\312I\250\234t\314A\310\34t\316A\6\235S\324\3\202\35{\377_|@\60\0Q|"
"\134;\255\260Br\230\341\10\32\214(\222\212\42\211\60r\12+\305\60C\14\63\343\60\63\16;\342\260"
"#\16;\1\261\7\2{ \260\7\2{ \260\7\2{ \260\7\2C\341\60\24\16;\342\260#\16"
";\303\60C\14!\304\224\62\302\20\243\234\22B\21\241\240\22B\21\241$\22B\71\253\24S\2\42\244"
"\230\220\24\12p\240\0\7\12p\34\1\211\21\260\220\1\31\134R\311D\217-\4\0Ri \71=\62"
"x\240\304S\214;\306\264c\16;\347\254s\220:\7\251s\220:\7\251s\220:\7\251s\316:\346"
"\260cL;\305\270\27\17!\361\30\362\216\61\355\34\303\316\61\354\34\303\316\71\353\234\263\316\71\353\234C"
"D\71\347\20Q\316\71D\224s\16\21\345\234CD\71\347\14a\316\71C\230\203N\30\341\1A\22>"
"\134\24\0SO\227H\301nIE:d\10\42\324\31c\231\61X\21\244\21Q\30\21\245\15a\330\20"
"\207\11\221\224\20\13\211\261X[m\71\345\226SN\4\304\204H+\10\245\202`\214-\227^z\350%"
"\67\202i#\234\65\304\10D\211!\6A\202\210\242\14\0T\61\235\70A\61\370\300\21I\270r\312\62"
"\307(sL:\27:\310\240\203\14:\250\244\223H:\211\244\223H:i\250\243\302:\366\376\377\213\17"
"\10\3\0U\134\241\70\77\63x \24F\16C\346\70\202\316\23\351<\221\316\23\351<\221\316\23\351<"
"\221\316\23\351<\221\316\23\351<\221\316\23\351<\221\316\23\351<\221\316\23\351<\221\316\23\351<\221\316"
"\23\351<\221\316\23\351<\221\316\23\312<\241\214\23\353\64\301\14\23\316\250\361\14\32\21\211B\327\2V"
"N\242(\301\62x@\220F\22\63\10\265\241P\33\353\64\301\20\23\14\61\321\220\22\16)\361\216\22\17"
"!\1\21\22\361 \21\221\21\22\31\61\217\21\23\21A\21\21\365\20Q\221\20\367\10qQ\20W\345,"
"\243}m\323+\77>\0\343\3\60\36\0W\206\261(A:x \210\7\202hc\35\225\14B\11\255"
"\241\220:k\254\243\220\22\14%\244\4C\352(\321\216:I\70\204\22\22\16\241\204\304;(\35\1\221"
"\21\1\31\1\221\21\342\30\21\217\21\342\30\21\21\31\2\21!\21\21\344\20\61\17\21\344\20\61\321\20\4"
"\211A\217\20\346\10Q\217\20\346\10QQ\20\6\5a\23J\67\241t\23J\30%\204\217:\371\250\243"
"\315\62\272\260\262\13+\234\64\302\207#|\270\341\305\23\16\0XP\241(Arx\203\225\205\214B\211"
"\264\223\206Ch\274\203\4DfDT\204DDP\64\4EBXu\25F\31i\224SF\71\341t"
"W\35\1U\61\320\34\3MQP\24\6\301q\320\23(\65\241\20\33*\255\261\220\42+\35\243\326`"
"\345\201\0Y;\240(\301\61x\205\15\245\314I\213$\264\206BK\60\244\4CJ\264\223\204CH\274"
"s\4DF@dDDDHD\304D#P$D=BTu\63|\362\375\37} \0ZO"
"\231\70\301ox \5\204P\70\10\211\242\220(\11\15\242\320\30\12\221\221\22\21\12\25\221R\21\11\31"
"\201PD\20E\4QD\20E\4QD\20\251P\222\12\5\255@\320\22\4-\61\320\32\3\255!\320"
"\42\2\251\22\320*\1\245\207\36x\200\0[\20\213J\61)x \230\372\377\377\377\377\231\5\134+\20"
";/+\30mj\244M\215\264\251\221\66\65\322f\215\264\251\221\66\65\322\246F\332\254\221\66\65\322\246"
"F\332\324H\233\65\322\6]\20\213:\61)X\246\376\377\377\377\177\346\201\0^)V\64e\256\22s"
"L\22\15\64\17\65\42\10\33\203,BH\42f$b\310!\210\24\242F!\212\14\302\210\30n\4\342"
"\10_\10\331\0\261,\370\7`\17HB\363j\20\205\220\212\220B\31q\2a:\225%A,IK"
"\224\202F\61\206\230\252X\304\24C\214)\304\240P\316R\211\10s\10\61\246\20SJ\61\245\24CL"
"\61\304\24\63N\61\343\24#\322\70\42\210\23\326\270\4\0bF\226\30\277,H\320\376O\30d\202\20"
"\305 B\314)\245\234b\310\61\205\34S\210\71f\230c\206\71f\230c\206\71f\230c\206\71f\230"
"c\306\61\205\34S\310)\206\214\60J)b\14B\214 b\220\23\314)\0c\62\222%A\253A\210"
"\24a\212\21\244\234\61\212!\302\224\42J\61\301\24\23L)\302\230\61\14\263ke\205P\224\20%\205"
"QR \345\4SJH\210\0dC\227(\77\255J\321\376\227\214\60\210\214\20\314!\4\231RN\61"
"\345\224bN)\307\20s\14\61\307\20s\14\61\307\20s\14\61\307\20s\14\61\307\224rL)\346\24"
"S\216)\345\34B\20\42#\4\223\214Pe,\222%\301\253Ah\20b\10\251J\31\304\24QL\21"
"\305\360\314\3\217\331V\10e\205P\224\20%\11QR \345\4S\212@\210\0f\42\222\30C(B"
"i\14b\312 \206\220j\30R\206\335(\304\20B\14\263\22K\206\331\377\377\22\63\0gSX(\255"
"mQ\243\220BH\10c\10S\310 \242\230\42H\60\306\204!\214\61\42\14c\354\235bJ*\244,"
"B\210CNPaE\235\352\3\1=\60\316\3\343< \322\3\241\220d\210pd\10\70\206\200c\10"
"(\210x\243\10'\216X#\21C\32R\0hD\230\30\301-H\322\376o\34dD\30\345\230\20J"
"\61&\204b\312\61\246\34c\312\61\246\230c\212\71\246\230c\212\71\246\230c\212\71\246\230c\212\71\246"
"\230c\212\71\246\230c\212\71\246\230c\212\71F\254\241\0i\25\313(\301g\11\250\224Cn\245\240\360"
"AG\305\376\377o,j+\217\353*\350\12\254\244\203n\251\260\360\241\232\222\375\377\377\306\30F\24a"
"\202\21&\30aB\31E\224Q\306\30\245\210A\216\61\0k\77\231\30\301-H\323\376\257\244b\16A"
"\6\211d\216P\346\204e\214X\246\10f\210hf\20fDaF\230e\302Y(\30u\206I\206\230"
"d\212A\306\230c\214\71\226\61\307\30s\216`b\1l\16\214\30A'H\306\376\377\377\377\6\3m"
"I\242%\303\62@\343\24s\214\10\243\10!L\61!\220\42\2)\345*\206\234r\212!\247\234b\210"
"\61\26\61\306\42\306X\304\30\213\30c\21c,b\214E\214\261\210\61\26\61\306\42\306X\304\30\213\30"
"c\21c,b\214%tnA\227%\303-@\343\34#\302(\306\204PJ\61!\24C\216\61\344\30"
"C\314\61\304\34C\314\61\304\34C\314\61\304\34C\314\61\304\34C\314\61\304\34C\314\61\304\34C\314"
"\61\304\34C\314\61B\15\5o,\224%A\254A\212\20r\210!\245\230B\212)\243\240\42\12*\301"
" \376!\23\12*\242\240\62\212)\244\230R\210!\207\20\242\220\1pGV\30\255,H\302 \23\302"
"(\306\204@\210\71\245\224c\12\71\246\220c\12\61\307\14s\314\60\307\14s\314\60\307\14s\314\60\307"
"\14s\314\70\246\220c\12\71\246\220SJA\204\30\23\204(\306\10\203\14\264\177\215)\0qFV("
"\255l\71&\34\62\4\21\206\220\61D)e\204AL\71\244\230C\312\61\303\34\63\314\61\303\34\63\314"
"\61\303\34\63\314\61\303\34\63\314\61\244\34C\212\71\304\224SJ\71\206\20d\312\10\301 #\14\264\377"
"\32\3r#\221%C*@\243\14#\216\60!\210\42L\10\242\210#\214\70\302\210#\312\60d\20\263"
"\354\377\222:\0s\66\320\65\301\352\70#\20QF\10C\34\42\6\32b\240!\10\22\242\240 \216\11"
"\3!u\324YG\205`P\20'%\224\216:\11!\21\204\20F\210@\320\10\17\0t*\17\30\277"
"\350\21M\216M\213\250\202\216i\305$\373_\11\303\224\60L\11\303\224\60\14\21\303\220@\14\11\305\214"
"P\322\71\3\0u\37\230\25\77-H#\31\373\377\377\377\225cL\71\306\220\20\314)$\4s\214\10"
"\302\240\63\22v\63\327\25\277,`\3\11tH\61I\34\203\304\61(\244rD\62F$c\302*E"
",C\2\63$\264\62D\63\42\274\42\302C\357D+\226IQQ\205\2w\134\343\25\277\62Xb\15"
"$\216\71\207\24s\14\22\247\34\203\2\62\247\240\200\314)G\244r\214\11\312\224c\302*%\4C\304"
"*%\4C\2\63C\210\62D+#\14#\202+#\14#\202\63A\14\23\304+!\224\3K\10\345"
"\300SN,\247\310r\312$\247\314\221\6\35iT\221\304\2x\64\227\25\301,X\42\15d\210\71f"
" cD:D,\63D\63\42\270\364\16<\321H\23\17<O\4\323\204\70K\20\263B\71I\30\203"
"\206\71\206\30$\224XyIW\30\253,`\3\211\203H\61I\234\222\2\62( sD\62&(c"
"\302*E,CB+$\64#\204+\42<\23\302\63!@\23\215,\222\320\251\212\32l\344\6\11\256"
"\214\320\314\10\315\210\340\312\10\256\210\0O$\17\0z\66\222%Akx@\204bL \306\210a\314"
"\20\307\14a\14\11\307\220`\314\62\314,\303\314\62&\20s\2\61'\14s\304(H\10sF\60h"
"\4s\224y \1{\36\317*-\352\42\211Rd\21U\377O\221E\324@\245\21F\255\242\352\377\26"
"\305H\243\0|\12\3[\257&\370\77\300\0} \317:-* \215bd\221UT\375\337\42\253\60"
"\322\12\42\212R\365\377\24YD\221D-\0~\35[\42\321\357\60N\20\305\204p\352\1\202Hi\205"
"\240\7\210rB\60E\204\63\3\0\240\6\0\0\301&\241\36\310\70+\247 \303\204\7R\60\203ta"
"\344W\10\241\15#l\341\201\17\254`\6\21\0\242X\222X\65n\22P\356\221e\202@$\10\61\12"
"\21b\10R\204\30c\24!\4\21F\210PD\31\42\224`\206\10%\230!\304\20f\210c\206\70f"
"\210c\206\70f\210c\206\60!\224!\212\10e\210\42\202\21\242\204Q\204 \202\20!H\60$\210!"
"\216R\306\11(w\0\243M\235\70A\361K\222\230\341\12\32\255\240\301\14\42\312\240\242\314\61\351\34\223"
"\316)\352\240\261\216\275\311\25\5\61F\274\6\317\265\303\25&\231\60\61\10\31M\204\24\306\32A\220\263"
"\206\10\347\1\42\2z@\214p\36\20D\224!\230\71\6\35\0\244C\230%Kn\20\306\30\21\210`"
"\202\204\7\316\70\346\24\242H!\214\220\341\6\31n\214\1\207\30p\210\1\207\30p\210\1\207\30p\214"
"\341\6\31n\20\302H!\212\224c\316x\340\4\42\230 A\30cD\0\245=\232\30A.h\5\211"
"\224HAi\30\224\304AI \204BB(\250s\204B&\260S\4C$\64\64\204C\42<\24\4"
"<!\304\24\21{\300\260\63o\354\1\303\316\274\177\357\201P\0\246\15\303Z\261&\370\201\204\37\370\200"
"\1\247^\326*\61\357Ik\234\201F\32f\250aF*\204 C\310\71\204\234C\212\61\245\34b\16"
"<O\265\245\334\21\301\21A\332\20\206\205\201T\30\252\255N\271\64\302:b\260\42H\33\301\264\20\22"
"c\253\245\207\216\70\246\30S\310\71\204\234C\310\71\204\30DHI\303\214\64\316@T\31\14!\0\250"
"\20\217\61\365j \205\4\63x\303\4RH\0\251\204\343(\301sC\230\234\61G\23PD\321\304\24"
"KT\221\4*J\34q\310\20B\24\351\220R\212d\212!F\14q\10\32F\14a\12\32G\10a"
"J\22G\4aL\22(\4aL\22\210\30\223\4\42\306Lb\314$\306Lb\314$\306\250\200\210\61"
"*\240 \204)*\34!\204)I\34!\304!) \61\204)G\42\342\220\23\220(\342\20\42\220\70"
"\2\35$\222\250b\211)\232\210\342\215\66$\71\344\246\6\0\252%N$c\351(H\10R\4!d"
"\14B\210 e\10\202L\31\202\220\61\350\211\62\210(\203\210\20L(\276\1\253\66\15U\303k\11j"
"\24\61D\21c\220!F\21c\220!\310 \202\14\42\310 \202\14\42\310 \202\14\42\310 c\220\61"
"\6\31c\24AF\21D\230P\4\13\7\0\254\13X\23\315-\370\3\254\316\177\255\10L\61U)\370"
"\3\256\213\343(\301sC\230\234\61G\23PD\321\304\24KT\221\304\25G\14\207D\21\246\220bD"
"\21\246\224b\304\20\247\24S\304\20\247\24c\204\20\247\24cD\20\250\24sB\20\250\224\202\10*\244"
"$\202\26#\250\14\262\10*\204(\202J!\211\240R\12\42\250\224\202\202\20\247\224r\204\20\247\224\62"
"\302\20B\234R\312\10C\62\245\224\21\204 \302\224RD\30\242\210\261\304\21\342\10X\204H\242\212%"
"\246h\42\212\67\332\220\344\220\233\32\0\257\11\314@y*\370\200\1\260\35\320cgn\61H\25\66\210"
"!b\240\21\206\262S#\14\64\4\61d\260\242\220)\0\261Z))\273\366\34\37\234\361\301\31\37\234"
"\361\301\31\37\234\361\301\31\37\234\361\301\31\37\234\361\301\31\37\234\361\301\31\37\234\61\37\370\37\30s|"
"p\306\7g|p\306\7g|p\306\7g|p\306\7g|p\306\7g|p\306\7g|\70\371"
"\300\3*<\360\200\12\17<\240\2\0\262.NE\333*\61F\214\62D)a\30dRQ\244\4\62"
"\312\20\204$*\15%\226@A\210\24DP!\204\260B\13L\204\201D F\0\263*P\65[+"
"\61I\14bD!d\224\62\10)\243\216\14B\30Y#\225GZae\214\302\10#\253\250b\304("
"\205(\2\0\264\20H\222\363j\21\205\214\42\312\240\21a\302\1\265U\330\70\251n \211\234\202\210\61"
"\307\24sL\61\307\24sL\61\307\24sL)\310\224\202L)\310\30\202\312\31\212\234\241H\11a\250"
"a\202\20j\24!\202\42d\10\201\230\20\207\215\20\206\60\341\214 \322\60#\214S\10\11W\324\251\22"
"Zf\65\215\264f\231D\2\266nX*\63\356y@\24D\306Qd\230E\206Yd\24FFad"
"\24FFad\220FFad\24FFad\24F\206Yd\34E\6Jd\250C\206\33d\270A"
"\206\33d\270A\206\33d\270A\206\33d\270A\206\33d\270A\206\33d\270A\206\33d\270A\206\33"
"d\270A\206\33d\270A\206\33d\270A\206\33d\270A\206\33d\20\0\267\17\310\61Y\247 \303\204"
"\7R\60\203\10\0\270\23\212R\255*\11) \221\310\241\14\61f\220a\4\0\271\20KU\335j\31"
"h\34\62\220\251\377\277\261\0\272\33M\64\343))f\14Q\306\230\312\10\244\340+$\214\62\304 d"
"L\246\370\6\273\65\15U\303\353\11E\224AD\21d\42\242\214\61\310\30\203\20A\6\21d\20A\6"
"\21d\20A\6\21d\20\61\310\30\203\214!\312\20\242\214\21\214Pb\205\2\0\274n\344X\77\266\26"
"mD\321\10\34\11A\321\312\33\255<\341\212\23\257\264\361J\23\260\260\1\13\23\261\254\21\313\22\262("
"\61K\32\210\234\222\4*\247\240\201\312)H s\312\21\350\220E\4:R \21J\34(\210\22\5"
"\22\242\300q\304(P\240@\312\23H\220\342\306\21\245\70\201\36\10i\274\322\4,L\304\302D,K"
"\310\242\206cGp\0\275x#Y\275u\31r\254\21\307\42Q \4\307*P\260\362\6+n\264\342"
"\204+m\270\322\304+l\274\262\6,K\304\242F,J\24sJ\32C\214RJ\22C\224B\12\22"
"c\230\62\312\31c\230\62\312\21\204\224\7\302\30\244r\302\220Q\234@\202\20\67\32y\242\15\70\326\220"
"b\211)\226H!\15%THb\5%\320P\16\211\345\316Xa$$X \7\211Y\320\330\0\276"
"~\346\70\77\66\61R\250\61\310\23K\24\322\206\32\245\60\261\10)k\254\62\312\22\215\214\242\6%K"
"\320\301D,mT\242\304-g\340b\204\14\306\220\1\13\61c B\254!P!\226\30\250\20b\214"
"\20\310\224Q\214\30\347\224A\314\20\350\234D\4\22\241\314\201\202(S !\212\34G\214\42\5\12\244"
"\304q\4)p\34Q\12\24\350\201\260\306+O\300\342\6,N\304\322F,l\70\226\4\7\277<\320"
"\70\253k\31\254\250\223.U\330\370\300\25%\304@\301\210\23\214\70\301\210\23\214h\242\215&\30Yd"
"\25UV)\201\24\23\206\61B\24\24\202AxG\10c\304\60D\24\205L\1\300_a+A\262\32"
"\236\364\302K/~|\0\306\7`|\20\302\207\204\360\303\223Nx\341f\33}\64\312\10'\254\256\262"
"B\34+\4\252a *\310\241\202\240\31\12\222\302\34)\14\212\341 (\320\201\2\241\367\300p\17\20"
"'\24ja!&\330a\202\241\25\32R\302\235D\32:\205\251\301\310\3\2\301[a+A\62\35\236"
"\360\262\13\247\370\360\342\3\20>\64\204\37\236t\302\13\67\333\350\243QF\70au\225\25\342X!P"
"\15\3QA\16\25\4\315P\220\24\346HaP\14\7A\201\16\24\10\275\7\206{\200\70\241P\13\13"
"\61\301\16\23\14\255\320\220\22\356$\322\320)L\15F\36\20\302_!+A\362\33\236\360\262O&\201"
"\134B\310$h\310\320\304\7Z\370\341I'\274p\263\215>\32e\204\23VWY!\216\25\2\325\60"
"\20\25\344PA\320\14\5Ia\216\24\6\305p\20\24\350@\201\320{`\270\7\210\23\12\265\260\20\23"
"\354\60\301\320\12\15)\341N\42\15\235\302\324`\344\1\1\303\134\341*A\62#'P\64\304l\64\20"
"D\203!\37n\10\77<\351\204\27n\266\321G\243\214p\302\352*+\304\261B\240\32\6\242\202\34*"
"\10\232\241 )\314\221\302\240\30\16\202\2\35(\20z\17\14\367\0qB\241\26\26b\202\35&\30Z"
"\241!%\334I\244\241S\230\32\214< \0\304\134\341*A\262\42\206HCL\64\304DCL\64\304"
"Hb\310\207\3\302\223Nq\263-\215\62\206\325\25\341X!\216\25\2U\61\16\25\344PA\320\24\345"
"Ha\216\24\6Eq\16\24\350@\201\320{`\270\7\210\23\12\65\261\16\23\354\60\301\320\22\355\250\321"
"N\42\15\35\263\324`\344\1\1\305da+A\362#\33\341A\306\25F\134a\304\25F\334A\6F"
"\332|\10\10\77<\351\204\27n\266\321G\243\214p\302\42\234+\302\261#\34+\4\252b\34:\306\241"
"\202\240)\312\221\243\34)\14\212\342\34(\320\201\2\241\367\300p\17\20'\24jB!&\330a\202\241"
"%\30R\243\235D\32:f\251\301\310\3\2\306\206\255\30Ax|\200Q\205NM\252\324\264\10U\213"
"P\21\16\33s\204\303\306\24\342\64!\207\70MH\61\316\21D\304\61\316\21%DA\316\21v\220c"
"\206\25\345\230QG\71\205Ta\16)t\230\7\2\25\347\220\62\307\71\205L\201\216\31r\240c\206\24"
"\351\230Q\204\32\351\34Q\204z\200\34QD\22\353\70\221\304:m \301N\33H\260\323\306\31\354\60"
"rD;\253\230\321\316*\205\264\243\314\70\354\240\7\14y\240\1\307[Z;\255oJE b\306\20"
"\207\240c\210\62\245\254B\12+\303\64\62\214\33\303\270!\216\33\342<!\316\23\1=\21\320\23\1I"
"\374A\21\16\24\341@\21\16\14\342<\61\314\23\303\274PL\23\246\264p\12\23\250(\261\310\31m\311"
"\201\3&\326\134\312R/\230\1\207(\322(\0\310m\134+\301p\32\270\334\202+L\364\320b\207\17"
"\231\7Z\71\10\225\243L\71\253\224\303H\71\214\224\323F\71m\224\343D\71G\24Q\316\21E\224s"
"\4;f\260c\6;\205\260C\12{ \260C\12;\205\260c\6;f\260sD\21\345\34QD\71"
"G\24Q\216\23\345\70QN\33\345\264Q\16#\345\60R\316*\345(S\16z\340\1\3\311l\134+"
"\301\360\34\230\334\312\226;\360\224\303\207\316\3\255\34\204\312Q\246\234U\312a\244\34F\312i\243\234\66"
"\312q\242\234#\212(\347\210\42\312\71\202\35\63\330\61\203\235B\330!\205=\20\330!\205\235B\330\61"
"\203\35\63\330\71\242\210r\216(\242\234#\212(\307\211r\234(\247\215r\332(\207\221r\30)g\225"
"r\224)\7=\360\200\1\312p\34+\301\260\23\231\340b\317$\202DR\206#i\354\360\201\177\240\225"
"\203P\71\312\224\263J\71\214\224\303H\71m\224\323F\71N\224sD\21\345\34QD\71G\260c\6"
";f\260S\10;\244\260\7\2;\244\260S\10;f\260c\6;G\24Q\316\21E\224sD\21\345"
"\70Q\216\23\345\264QN\33\345\60R\16#\345\254R\216\62\345\240\7\36\60\313r\334*\301\60\42\206"
"\64C\14\63\304\60C\14\63\304\64b\310\207\370\3\255\34\204\312Q\246\234U\312a\244\34F\312i\243"
"\234\66\312i\243\234#\212(\347\210\42\312\71\202\35\63\330\61\203\235B\330!\205=\20\330!\205\235B"
"\330\61\203\35\63\330\71\242\210r\216(\242\234#\212(\307\211r\234(\247\215r\332(\207\221r\30)"
"g\225r\224)\7=\360\200\1\314\32P;\301\252\30\254\254\302*F\334\364\301} \224\223\356\377\377"
"\377G\36\10\315\34P;\301*\33\214\254\242\312\242\61\341\302\7\351\201PN\272\377\377\377\37y \0"
"\316 \20;\301\352\31\214\260\242\16\42\201\24R\206 i\274\360Ax \224\223\356\377\377\377G\36\10"
"\317\34\320:\301j \206\4Cx\304\4b\310\7\362\201PN\272\377\377\377\37y \0\320\134\240\70"
"\301\62x\300\300sJ;\211\260\243\212:\253\244\263J:\254\240\303\314\71\314\234\303\216\71\354\230\303\216"
"\71\14\225\303P\71\14\225\303\36H\10\225\303P\71\14\225\303P\71\14\225\303\216\71\354\230\303\216\71\354"
"\230\303\314\71\314\234\303\12:\253\244\263\210:\212\254\223\10;\247\240\7\314\2\321z\42+\277r#'"
"T\64\4m\65\20T\203!\37\16\257\344FR\312 fPbD%&\30b\202\245%\230R\202\255"
"$\330J\202\211\220\220`B\244#\230\20\351\10&F\62\202\11\222\212`\202\244\42\230(\211\10&L"
"\32\202\211\223\204`\342$!\230@)\10&\322b\42-&\224bb%&Vb\202!&\332a\302"
"\31&\234Y\304\25e\34A\212\21\343\326\370 \10\3\0\322e\134;\277\60\22\231\340\12\223L\362\330"
"b\207\17E$\207\31\216\240\301\210\42\251\250\202\10#\247\260R\14\63\304\60\63\16\63\343\260#\16;"
"\342\260\23\20{ \260\7\2{ \260\7\2{ \260\7\2{ \60\24\16;\342\260#\16;\342\60"
"C\14\63\304\60S\12+\207\60\202\212*\211(\262\10\32o\230!\221\2\323d\134;\277\260\24\231\334"
"b\313\245a\241\303\207$\222\303\14G\320`D\221TTA\204\221SX)\206\31b\230\31\207\231q"
"\330\21\207\35q\330\11\210=\20\330\3\201=\20\330\3\201=\20\330\3\201=\20\30\12\207\35q\330\21"
"\207\35q\230!\206\31b\230)\205\225C\30AE\225D\24Y\4\215\67\314\220H\1\324j\134;\277"
"p\23ydrME\223\10\22G!\216 \302\244\17)$\207\31\216\240\301\210\42\251\250\202\10#\247"
"\260R\14\63\304\60\63\16\63\343\260#\16;\342\260\23\20{ \260\7\2{ \260\7\2{ \260\7"
"\2{ \60\24\16;\342\260#\16;\342\60C\14\63\304\60S\12+\207\60\202\212*\211(\262\10\32"
"o\230!\221\2\325d\34;\277\60\15\320\20\361\232k/\24\363\341\21$\207\31\216\240\301\210\42\251\250"
"\202\10#\247\260R\14\63\304\60\63\16\63\343\260#\16;\342\260\23\20{ \260\7\2{ \260\7\2"
"{ \260\7\2{ \60\24\16;\342\260#\16;\342\60C\14\63\304\60S\12+\207\60\202\212*\211"
"(\262\10\32o\230!\221\2\326k\34;\277\360!\206\64C\14\63\304\60C\14\63\304\64b\310\207+"
"H\16\63\34A\203\21ERQ\5\21FNa\245\30f\210af\34f\306aG\34v\304a' "
"\366@`\17\4\366@`\17\4\366@`\17\4\366@`(\34v\304aG\34v\304a\206\30f\210"
"a\246\24V\16a\4\25U\22Qd\21\64\336\60C\42\5\0\327J\237w\273\266\10}`\21\212%"
"\241P\62\212$\245\274rJ+\251\254*\225VNy\245\224XF\231%\224\232\356\311%\237\233j\11"
"e\26Bb\61\344\25DZQd\25FRq\344\24HJ\221d\24JB\261$\14,\2\0\330p"
"\234\70\301\260JG\240aF\21h \42\304!\352\230\242\314!\214\234\302J\61\314\20\263\16\61\13\211"
"\243\222\70I\204#\16\32\341\201\200\204x \34\61\36\10F\220\7B\31\344\201@Fy \20a\36"
"\10C\234\7\202\20\350\201\20\6:\342\4\221\216H\352\10\264\14\71\313\20\303\212)\254\34\302\310\61\212"
"\234\243\310\21\202\240\201D\31f q\222\2\331ha;\77\363\32\235\364Z'\37\200\361\1\30\37F"
"\37\10\205\221\303\220\71\216\240\363D:O\244\363D:O\244\363D:O\244\363D:O\244\363D:"
"O\244\363D:O\244\363D:O\244\363D:O\244\363D:O\244\363D:O\244\363D:O\244"
"\363\204\62O(\343\304:M\60\303\204\63j<\203FD\242\320\265\0\332ha;\77s\35\235\360\262"
"\13\247u\361\1\10\37\242\17\204\302\310a\310\34G\320y\42\235'\322y\42\235'\322y\42\235'\322"
"y\42\235'\322y\42\235'\322y\42\235'\322y\42\235'\322y\42\235'\322y\42\235'\322y\42"
"\235'\322y\42\235'\322yB\231'\224qb\235&\230a\302\31\65\236A#\42Q\350Z\0\333o"
"a;\77s\14\37\200\321\313\66\32a\62\206\35\206\310\241\306\7!|\210=\20\12#\207!s\34A"
"\347\211t\236H\347\211t\236H\347\211t\236H\347\211t\236H\347\211t\236H\347\211t\236H\347\211"
"t\236H\347\211t\236H\347\211t\236H\347\211t\236H\347\211t\236H\347\11e\236P\306\211u\232"
"`\206\11g\324x\6\215\210D\241k\1\334l!;\77\263\42\206HCL\64\304DCL\64\304H"
"b\310\207\213\317\60r\30\62\307\21t\236H\347\211t\236H\347\211t\236H\347\211t\236H\347\211t"
"\236H\347\211t\236H\347\211t\236H\347\211t\236H\347\211t\236H\347\211t\236H\347\211t\236H"
"\347\211t\236P\346\11e\234X\247\11f\230pF\215g\320\210H\24\272\26\0\335F`+\301q\35"
"\234\354J\27M\370\340\302\207\17\305W\330P\312\234\264HBk(\264\4CJ\60\244D;I\70\204"
"\304;G@d\4DFDD\204DDL\64\2EB\324#DU\67\303'\337\377\321\7\2\2\336"
"\77\235\70A\61x@\304c\357\354\3\241\35c\324A\6]\347 dN:\346$TNB\345$T"
"NB\345$TNB\345\244c\16B\346\240s\16\62\350\234\242\36\20\354\330\373\213\17\10\6\0\337^"
"\227(\277m:\216\14\262\10)\251\24\222J)\247\230r\212)\247\230b\214)\306\30r\214!\307\230"
"\201L\31\311\4\302L\21\312\230\201\314!\306\234R\314)\305\240B\14*\304 \63\14\62\303 \63\14"
"\62\303 \63\14\62\303\204A\314X\243\220\65\12Q\303\20\65J\61a\14\62\222@\4\0\340F\225("
"\77\354\20\222\304\22\211\244\344\230c\12\32>\320i\211R\320(\306\20S\25\213\230b\210\61\205\30\24"
"\312Y*\21a\16!\306\24bJ)\246\224b\210)\206\230b\306)f\234bD\32G\4q\302\32"
"\227\0\341D\225(\77,\23\222\300\362\12\244E\61\303\207dZ\242\24\64\212\61\304T\305\42\246\30b"
"L!\6\205r\226JD\230C\210\61\205\230R\212)\245\30b\212!\246\230q\212\31\247\30\221\306\21"
"A\234\260\306%\0\342J\225(\77\354\31\222\300\352\35\67\304`\203\14\65\314@\42\215\17\251\264D)"
"h\24c\210\251\212EL\61\304\230B\14\12\345,\225\210\60\207\20c\12\61\245\24SJ\61\304\24C"
"L\61\343\24\63N\61\42\215#\202\70a\215K\0\343G\25(\77,!F\240C\304iH\214\223\202"
"!\37\206\323\22\245\240Q\214!\246*\26\61\305\20c\12\61(\224\263T\42\302\34B\214)\304\224R"
"L)\305\20S\14\61\305\214S\314\70\305\210\64\216\10\342\204\65.\1\0\344J\25(\77\254 \205\34"
"\63\214\61\303\30\63\214\61\303\34R\310\207\205\264D)h\24c\210\251\212EL\61\304\230B\14\12\345"
",\225\210\60\207\20c\12\61\245\24SJ\61\304\24CL\61\343\24\63N\61\42\215#\202\70a\215K"
"\0\345O\225(A\254\61\16\261A\306\22F,a\304\22F\254A\6C\217|\350\245%JA\243\30"
"CLU,b\212!\306\24bP(g\251\64\206\71\204\30S\210)\245\230R\212!\246\30b\212\31"
"\247\230q\212\21i\34\21\304\11\42\240\201\206\21\0\346P\235%A\61I#\35Q\20!e\24D\312"
" \306\24#J\61\246\10C\214)\302\20c\214(\304\30\243\216\61G\31S\306x`\14B\214+\304"
"\264RL+\305\254S\314:\305(TN\12\301\224\223B\70C\10\202\302\70A\220RBA&\21\0"
"\347\77\22(/\253A\210\24aJ\31\244\30\62\212!\302\224\42J\61\301\24\23L)\302\230\61\14\263"
"ke\205P\224\20%\205Q\220 \345\4SJH\210\205\30\240\210\4\216G\34\225\302 \313\30\0\350"
"\70\222(\277\353\30\217\70\342*G\36\201\42\212\17\25\204\6!\206\220\252\224AL\21\305\24Q\14\317"
"<\360\230m\205PV\10E\11Q\222\20%\5RN\60\245\10\204\10\0\351\70\222(\277+\33\256\264"
"\302\252F\332x\2\206\17\35\204\6!\206\220\252\224AL\21\305\24Q\14\317<\360\230m\205PV\10"
"E\11Q\222\20%\5RN\60\245\10\204\10\0\352>\222(\277\353!\216\270\302\14;j\210\221\6\31"
"g\230QF\22\37\2\10\15B\14!U)\203\230\42\212)\242\30\236y\340\61\333\12\241\254\20\212\22"
"\242$!J\12\244\234`J\21\10\21\0\353\66\22(\277\353 \205\20\63\354GH!\37\222\10\15B"
"\14!U)\203\230\42\212)\242\30\236y\340\61\333\12\241\254\20\212\22\242$!J\12\244\234`J\21"
"\10\21\0\354\30\214\30\301g\20\211\240r\12*i\250I\211\17\24\62\366\377\177d\1\355\30\214(\301"
"g\22\211\234b\312\241!\241\302\7\14\31\373\377\77\262\2\0\356\35\216\10Ag!\251J\346\240B\304"
"(\203\214\61\214Q\342\203\206\220\375\377\237Y\1\0\357\30\16\30Ag \204\4#x\302\4B\310\7"
"\34!\373\377\77\263\2\0\360>\224(\77,\61E\234\63DR\353\70\343\16Ki\10\203D\61\356\70"
"\363\14b\206\220C\210\61\243\30\63\212\61\242\234\23\12\342\77dBAE\224cF\61\205\24S\12\61"
"\344\20B\24\62\0\361N\27(\301\255)F$DBrI\14\244\302!\37\326\321\70\307\210\60\212\61"
"!\224RL\10\305\220c\14\71\306\20s\14\61\307\20s\14\61\307\20s\14\61\307\20s\14\61\307\20"
"s\14\61\307\20s\14\61\307\20s\14\61\307\20s\214PC\1\362\70\224(\77,\31\260\274\2+H"
"\42\221b\212\17\61\244\10!\207\30R\212)\244\230\62\12*\242\240\22\14\342\37\62\241\240\42\12*\243"
"\230B\212)\205\30r\10!\12\31\0\363\70\224(\77l\33\260\274\342\252G\336\200C\206\17\71\244\10"
"!\207\30R\212)\244\230\62\12*\242\240\22\14\342\37\62\241\240\42\12*\243\230B\212)\205\30r\10"
"!\12\31\0\364>\224(\77,\42\220<\343LCl\210\261\6\31i\230q\204\22\37:H\21B\16"
"\61\244\24SH\61e\24TDA%\30\304\77dBAE\24TF\61\205\24S\12\61\344\20B\24"
"\62\0\365\71\24(\77l)&\34D\202q&\20t\202)\37&\221\42\204\34bH)\246\220b\312"
"(\250\210\202J\60\210\177\310\204\202\212(\250\214b\12)\246\24b\310!\204(d\0\366=\24(\77"
"\354 \205\30\63L\61\303\24\63L\61\303\30R\310\207\70R\204\220C\14)\305\24RL\31\5\25Q"
"P\11\6\361\17\231PP\21\5\225QL!\305\224B\14\71\204\20\205\14\0\367\61)(\273\366\34\37"
"\230\362\1\71\37\214\363\301\70\37\220\362\201\31\37\376\355\7\376\7\306\207\377\231\361\201)\37\220\363\301\70"
"\37\214\363\1)\37\230\61\1\370\77\224%A\254AD\20*\10BL!\305\24RL\31\5\25Q\216"
"\11\306\270\42\2#B\260\61\4\33b\60!\10\13\242\70c\202\71E\230SF\61\205\24S\210)\204"
"\210@\10!\202 \3\0\371,\230\30\77m\31\225\320\62\13-\224\330a\305\25\37\252i$c\377\377"
"\377\277r\214)\307\30\22\202\71\205\204`\216\21A\30tF\2\372*\230\30\77\255\33\224\314J\26I"
"\350T\303\207p\32\311\330\377\377\377\257\34c\312\61\206\204`N!!\230cD\20\6\235\221\0\373\61"
"\230\30\77\255\32\224\320\42\215<p\210\361\6\31m\230\261F\22\37\202i$c\377\377\377\277r\214)"
"\307\30\22\202\71\205\204`\216\21A\30tF\2\374/\30\30\77m\241\224\31&\231a\222\31&\231a"
"\24)\344\303R\42\310\330\377\377\377\257\34c\312\61\206\204`N!!\230cD\20\6\235\221\0\375T"
"W\33\253\354\33\263\310\22+I\344\230\243\206\17I\66\220\70\210\24\223\304)) \203\2\62G$c"
"\202\62&\254R\304\62$\264BB\63B\270\42\302\63!<\23\2\64\321\310\42\11\235\252\250\301Fn"
"\220\340\312\10\315\214\320\214\10\256\214\340\212\10\360D\362\0\376M\26\33\251\254\31\261\274\323R\23\301@"
"\373\310)F(b\202\30\206\230\20\212\31\307\230q\214\31\307\230a\216\31\346\230aN!\306\30bL"
")\306\224b\14\61\246\220c\312@\246\210d\210Pf\210e\204`\310\31h\177\220\212c\206\12\0\377"
"Y\27\33\253\254!\205$\63\14\62\303 \63\14\62\303$R\310\207i\66\220\70\210\24\223\304)) "
"\203\2\62G$c\202\62&\254R\304\62$\264BB\63B\270\42\302\63!<\23\2\64\321\310\42\11"
"\235\252\250\301Fn\220\340\312\10\315\214\320\214\10\256\214\340\212\10\360D\362\0\0\0\0\4\377\377\0";
| 21,531 |
458 | <gh_stars>100-1000
/**
* \file Utility.cpp
* \brief Implementation for GeographicLib::Utility class
*
* Copyright (c) <NAME> (2011-2020) <<EMAIL>> and licensed
* under the MIT/X11 License. For more information, see
* https://geographiclib.sourceforge.io/
**********************************************************************/
#include <cstdlib>
#include <GeographicLib/Utility.hpp>
#if defined(_MSC_VER)
// Squelch warnings about unsafe use of getenv
# pragma warning (disable: 4996)
#endif
namespace GeographicLib {
using namespace std;
bool Utility::ParseLine(const std::string& line,
std::string& key, std::string& value,
char delim) {
key.clear(); value.clear();
string::size_type n = line.find('#');
string linea = trim(line.substr(0, n));
if (linea.empty()) return false;
n = delim ? linea.find(delim) : linea.find_first_of(" \t\n\v\f\r"); //
key = trim(linea.substr(0, n));
if (key.empty()) return false;
if (n != string::npos) value = trim(linea.substr(n + 1));
return true;
}
bool Utility::ParseLine(const std::string& line,
std::string& key, std::string& value) {
return ParseLine(line, key, value, '\0');
}
int Utility::set_digits(int ndigits) {
#if GEOGRAPHICLIB_PRECISION == 5
if (ndigits <= 0) {
char* digitenv = getenv("GEOGRAPHICLIB_DIGITS");
if (digitenv)
ndigits = strtol(digitenv, NULL, 0);
if (ndigits <= 0)
ndigits = 256;
}
#endif
return Math::set_digits(ndigits);
}
} // namespace GeographicLib
| 661 |
585 | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.solr.client.solrj.response.json;
import java.util.HashSet;
import java.util.Set;
import org.apache.solr.common.util.NamedList;
/**
* Represents an individual bucket result of a "term" or "range" facet.
*
* Allows access to JSON like:
* <pre>
* {
* "val": "termX",
* "count": 10,
* "subfacetName": ...
* }
* </pre>
* <p>
* Buckets may contain nested facets of any type.
*/
public class BucketJsonFacet extends NestableJsonFacet {
private Object val;
public BucketJsonFacet(NamedList<?> singleBucket) {
super(singleBucket); // sets "count", and stats or nested facets
val = singleBucket.get("val");
}
/**
* Retrieves the value (sometimes called the "key") of this bucket.
*
* The type of this object depends on the type of field being faceted on. Usually a Date, Double, Integer, or String
*/
public Object getVal() {
return val;
}
@Override
protected Set<String> getKeysToSkip() {
final HashSet<String> keysToSkip = new HashSet<>();
keysToSkip.add("val");
return keysToSkip;
}
}
| 577 |
503 | /**
* Yobi, Project Hosting SW
*
* Copyright 2014 NAVER Corp.
* http://yobi.io
*
* @Author <NAME>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package mailbox;
import org.junit.Test;
import static org.fest.assertions.Assertions.assertThat;
public class EmailAddressWithDetailTest {
@Test
public void email() {
EmailAddressWithDetail addr1 = new EmailAddressWithDetail("<EMAIL>");
EmailAddressWithDetail addr2 = new EmailAddressWithDetail("<EMAIL>");
assertThat(addr1.getUser()).describedAs("user part").isEqualTo("test");
assertThat(addr1.getDomain()).describedAs("domain part").isEqualTo("mail.com");
assertThat(addr1.getDetail()).describedAs("detail part").isEmpty();
assertThat(addr2.getUser()).describedAs("user part").isEqualTo("test");
assertThat(addr2.getDomain()).describedAs("domain part").isEqualTo("mail.com");
assertThat(addr2.getDetail()).describedAs("detail part").isEqualTo("1234");
assertThat(addr1.equalsExceptDetails(addr2)).describedAs("<EMAIL> equals " +
"<EMAIL> except its details").isTrue();
}
}
| 549 |
952 | {
"version": "2019.1.3",
"description": "JetBrains dotTrace Self-profiling API",
"homepage": "https://www.jetbrains.com/profiler/download/#section=selfprofilingapi",
"license": {
"identifier": "Proprietary",
"url": "https://www.jetbrains.com/legal/docs/agreements/dotnet/profiler-api"
},
"url": "https://download.jetbrains.com/resharper/ReSharperUltimate.2019.1.3/JetBrains.Profiler.SelfSdk.2019.1.3.zip",
"hash": "92890af736eb4c3aa302eb8b2da4f3ee0a7232342553975f52c55312f346394d",
"env_add_path": "."
}
| 259 |
3,066 | <filename>server/src/test/java/io/crate/integrationtests/JobLogIntegrationTest.java
/*
* Licensed to Crate.io GmbH ("Crate") under one or more contributor
* license agreements. See the NOTICE file distributed with this work for
* additional information regarding copyright ownership. Crate licenses
* this file to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may
* obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* However, if you have executed another commercial license agreement
* with Crate these terms will supersede the license and you may use the
* software solely pursuant to the terms of the relevant commercial agreement.
*/
package io.crate.integrationtests;
import io.crate.action.sql.SQLOperations;
import io.crate.action.sql.Session;
import io.crate.execution.engine.collect.stats.JobsLogService;
import io.crate.execution.engine.collect.stats.JobsLogs;
import io.crate.expression.reference.sys.job.JobContextLog;
import io.crate.testing.UseHashJoins;
import io.crate.testing.UseJdbc;
import io.crate.testing.UseRandomizedSchema;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.test.ESIntegTestCase;
import org.junit.After;
import org.junit.Test;
import java.util.Iterator;
import static io.crate.testing.TestingHelpers.printedTable;
import static org.hamcrest.core.Is.is;
@ESIntegTestCase.ClusterScope(numDataNodes = 2, numClientNodes = 0, supportsDedicatedMasters = false)
@UseRandomizedSchema(random = false) // Avoid set session stmt to interfere with tests
@UseHashJoins(1) // Avoid set session stmt to interfere with tests
public class JobLogIntegrationTest extends SQLIntegrationTestCase {
@After
public void resetSettings() {
// reset stats settings in case of some tests changed it and failed without resetting.
execute("reset global stats.enabled, stats.jobs_log_size, stats.operations_log_size");
}
@Test
@UseJdbc(0) // SET extra_float_digits = 3 gets added to the jobs_log
public void testJobLogWithEnabledAndDisabledStats() throws Exception {
String setStmt = "set global transient stats.jobs_log_size=1";
execute(setStmt);
// We record the statements in the log **after** we notify the result receivers (see {@link JobsLogsUpdateListener usage).
// So it might happen that the "set global ..." statement execution is returned to this test but the recording
// in the log is done AFTER the execution of the below "select name from sys.cluster" statement (because async
// programming is evil like that). And then this test will fail and people will spend days and days to figure
// out what's going on.
// So let's just wait for the "set global ... " statement to be recorded here and then move on with our test.
assertBusy(() -> {
boolean setStmtFound = false;
for (JobsLogService jobsLogService : internalCluster().getDataNodeInstances(JobsLogService.class)) {
// each node must have received the new jobs_log_size setting change instruction
assertThat(jobsLogService.jobsLogSize(), is(1));
JobsLogs jobsLogs = jobsLogService.get();
Iterator<JobContextLog> iterator = jobsLogs.jobsLog().iterator();
if (iterator.hasNext()) {
if (iterator.next().statement().equalsIgnoreCase(setStmt)) {
setStmtFound = true;
}
}
}
// at least one node must have the set statement logged
assertThat(setStmtFound, is(true));
});
// Each node can hold only 1 query (the latest one) so in total we should always see 2 queries in
// the jobs_log. We make sure that we hit both nodes with 2 queries each and then assert that
// only the latest queries are found in the log.
for (SQLOperations sqlOperations : internalCluster().getDataNodeInstances(SQLOperations.class)) {
Session session = sqlOperations.newSystemSession();
execute("select name from sys.cluster", null, session);
}
assertJobLogOnNodesHaveOnlyStatement("select name from sys.cluster");
for (SQLOperations sqlOperations : internalCluster().getDataNodeInstances(SQLOperations.class)) {
Session session = sqlOperations.newSystemSession();
execute("select id from sys.cluster", null, session);
}
assertJobLogOnNodesHaveOnlyStatement("select id from sys.cluster");
execute("set global transient stats.enabled = false");
for (JobsLogService jobsLogService : internalCluster().getDataNodeInstances(JobsLogService.class)) {
assertBusy(() -> assertThat(jobsLogService.isEnabled(), is(false)));
}
execute("select * from sys.jobs_log");
assertThat(response.rowCount(), is(0L));
}
private void assertJobLogOnNodesHaveOnlyStatement(String statement) throws Exception {
for (JobsLogService jobsLogService : internalCluster().getDataNodeInstances(JobsLogService.class)) {
assertBusy(() -> {
assertThat(jobsLogService.jobsLogSize(), is(1));
JobsLogs jobsLogs = jobsLogService.get();
Iterator<JobContextLog> iterator = jobsLogs.jobsLog().iterator();
if (iterator.hasNext()) {
assertThat(iterator.next().statement(), is(statement));
}
});
}
}
@Test
public void testSetSingleStatement() throws Exception {
execute("select settings['stats']['jobs_log_size'] from sys.cluster");
assertThat(response.rowCount(), is(1L));
assertThat(response.rows()[0][0], is(JobsLogService.STATS_JOBS_LOG_SIZE_SETTING.getDefault(Settings.EMPTY)));
execute("set global persistent stats.enabled= true, stats.jobs_log_size=7");
assertThat(response.rowCount(), is(1L));
execute("select settings['stats']['jobs_log_size'] from sys.cluster");
assertThat(response.rowCount(), is(1L));
assertThat(response.rows()[0][0], is(7));
execute("reset global stats.jobs_log_size");
assertThat(response.rowCount(), is(1L));
waitNoPendingTasksOnAll();
execute("select settings['stats']['enabled'], settings['stats']['jobs_log_size'] from sys.cluster");
assertThat(response.rowCount(), is(1L));
assertThat(response.rows()[0][0], is(JobsLogService.STATS_ENABLED_SETTING.getDefault(Settings.EMPTY)));
assertThat(response.rows()[0][1], is(JobsLogService.STATS_JOBS_LOG_SIZE_SETTING.getDefault(Settings.EMPTY)));
}
@Test
public void testEmptyJobsInLog() throws Exception {
// Setup data
execute("create table characters (id int primary key, name string)");
sqlExecutor.ensureYellowOrGreen();
execute("set global transient stats.enabled = true");
execute("insert into characters (id, name) values (1, 'sysjobstest')");
execute("refresh table characters");
execute("delete from characters where id = 1");
// make sure everything is deleted (nothing changed in whole class lifecycle cluster state)
assertThat(response.rowCount(), is(1L));
execute("refresh table characters");
execute("select * from sys.jobs_log where stmt like 'insert into%' or stmt like 'delete%'");
assertThat(response.rowCount(), is(2L));
}
@Test
public void test_relation_unknown_error_shows_up_in_sys_jobs_log() throws Exception {
try {
execute("select * from relation_not_known");
fail("SELECT Should fail with a relation not known error");
} catch (Exception ignored) {
// expected -> ignored
}
assertBusy(() -> {
execute("select stmt from sys.jobs_log where error is not null order by ended desc limit 1");
assertThat(
printedTable(response.rows()),
is("select * from relation_not_known\n")
);
});
}
}
| 3,089 |
929 | #pragma once
////////////////////////////////////////////////////////////////////////////////
// The MIT License (MIT)
//
// Copyright (c) 2018 <NAME> & Animation Compression Library contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
////////////////////////////////////////////////////////////////////////////////
#include "acl/core/error.h"
#include "acl/core/impl/compiler_utils.h"
#include <rtm/qvvf.h>
#include <cstdint>
ACL_IMPL_FILE_PRAGMA_PUSH
namespace acl
{
//////////////////////////////////////////////////////////////////////////
// Describes the format used by the additive clip.
enum class additive_clip_format8 : uint8_t
{
//////////////////////////////////////////////////////////////////////////
// Clip is not additive
none = 0,
//////////////////////////////////////////////////////////////////////////
// Clip is in relative space, transform_mul or equivalent is used to combine them.
// transform = transform_mul(additive_transform, base_transform)
relative = 1,
//////////////////////////////////////////////////////////////////////////
// Clip is in additive space where scale is combined with: base_scale * additive_scale
// transform = transform_add0(additive_transform, base_transform)
additive0 = 2,
//////////////////////////////////////////////////////////////////////////
// Clip is in additive space where scale is combined with: base_scale * (1.0 + additive_scale)
// transform = transform_add1(additive_transform, base_transform)
additive1 = 3,
};
//////////////////////////////////////////////////////////////////////////
// TODO: constexpr
inline const char* get_additive_clip_format_name(additive_clip_format8 format)
{
switch (format)
{
case additive_clip_format8::none: return "none";
case additive_clip_format8::relative: return "relative";
case additive_clip_format8::additive0: return "additive0";
case additive_clip_format8::additive1: return "additive1";
default: return "<Invalid>";
}
}
inline bool get_additive_clip_format(const char* format, additive_clip_format8& out_format)
{
ACL_ASSERT(format != nullptr, "Format name cannot be null");
if (format == nullptr)
return false;
const char* none_format = "None"; // ACL_DEPRECATED Legacy name, keep for backwards compatibility, remove in 3.0
const char* none_format_new = "none";
if (std::strncmp(format, none_format, std::strlen(none_format)) == 0
|| std::strncmp(format, none_format_new, std::strlen(none_format_new)) == 0)
{
out_format = additive_clip_format8::none;
return true;
}
const char* relative_format = "Relative"; // ACL_DEPRECATED Legacy name, keep for backwards compatibility, remove in 3.0
const char* relative_format_new = "relative";
if (std::strncmp(format, relative_format, std::strlen(relative_format)) == 0
|| std::strncmp(format, relative_format_new, std::strlen(relative_format_new)) == 0)
{
out_format = additive_clip_format8::relative;
return true;
}
const char* additive0_format = "Additive0"; // ACL_DEPRECATED Legacy name, keep for backwards compatibility, remove in 3.0
const char* additive0_format_new = "additive0";
if (std::strncmp(format, additive0_format, std::strlen(additive0_format)) == 0
|| std::strncmp(format, additive0_format_new, std::strlen(additive0_format_new)) == 0)
{
out_format = additive_clip_format8::additive0;
return true;
}
const char* additive1_format = "Additive1"; // ACL_DEPRECATED Legacy name, keep for backwards compatibility, remove in 3.0
const char* additive1_format_new = "additive1";
if (std::strncmp(format, additive1_format, std::strlen(additive1_format)) == 0
|| std::strncmp(format, additive1_format_new, std::strlen(additive1_format_new)) == 0)
{
out_format = additive_clip_format8::additive1;
return true;
}
return false;
}
inline rtm::qvvf RTM_SIMD_CALL transform_add0(rtm::qvvf_arg0 base, rtm::qvvf_arg1 additive)
{
const rtm::quatf rotation = rtm::quat_mul(additive.rotation, base.rotation);
const rtm::vector4f translation = rtm::vector_add(additive.translation, base.translation);
const rtm::vector4f scale = rtm::vector_mul(additive.scale, base.scale);
return rtm::qvv_set(rotation, translation, scale);
}
inline rtm::qvvf RTM_SIMD_CALL transform_add1(rtm::qvvf_arg0 base, rtm::qvvf_arg1 additive)
{
const rtm::quatf rotation = rtm::quat_mul(additive.rotation, base.rotation);
const rtm::vector4f translation = rtm::vector_add(additive.translation, base.translation);
const rtm::vector4f scale = rtm::vector_mul(rtm::vector_add(rtm::vector_set(1.0F), additive.scale), base.scale);
return rtm::qvv_set(rotation, translation, scale);
}
inline rtm::qvvf RTM_SIMD_CALL transform_add_no_scale(rtm::qvvf_arg0 base, rtm::qvvf_arg1 additive)
{
const rtm::quatf rotation = rtm::quat_mul(additive.rotation, base.rotation);
const rtm::vector4f translation = rtm::vector_add(additive.translation, base.translation);
return rtm::qvv_set(rotation, translation, rtm::vector_set(1.0F));
}
inline rtm::qvvf RTM_SIMD_CALL apply_additive_to_base(additive_clip_format8 additive_format, rtm::qvvf_arg0 base, rtm::qvvf_arg1 additive)
{
switch (additive_format)
{
default:
case additive_clip_format8::none: return additive;
case additive_clip_format8::relative: return rtm::qvv_mul(additive, base);
case additive_clip_format8::additive0: return transform_add0(base, additive);
case additive_clip_format8::additive1: return transform_add1(base, additive);
}
}
inline rtm::qvvf RTM_SIMD_CALL apply_additive_to_base_no_scale(additive_clip_format8 additive_format, rtm::qvvf_arg0 base, rtm::qvvf_arg1 additive)
{
switch (additive_format)
{
default:
case additive_clip_format8::none: return additive;
case additive_clip_format8::relative: return rtm::qvv_mul_no_scale(additive, base);
case additive_clip_format8::additive0: return transform_add_no_scale(base, additive);
case additive_clip_format8::additive1: return transform_add_no_scale(base, additive);
}
}
inline rtm::qvvf RTM_SIMD_CALL convert_to_relative(rtm::qvvf_arg0 base, rtm::qvvf_arg1 transform)
{
return rtm::qvv_mul(transform, rtm::qvv_inverse(base));
}
inline rtm::qvvf RTM_SIMD_CALL convert_to_additive0(rtm::qvvf_arg0 base, rtm::qvvf_arg1 transform)
{
const rtm::quatf rotation = rtm::quat_mul(transform.rotation, rtm::quat_conjugate(base.rotation));
const rtm::vector4f translation = rtm::vector_sub(transform.translation, base.translation);
const rtm::vector4f scale = rtm::vector_div(transform.scale, base.scale);
return rtm::qvv_set(rotation, translation, scale);
}
inline rtm::qvvf RTM_SIMD_CALL convert_to_additive1(rtm::qvvf_arg0 base, rtm::qvvf_arg1 transform)
{
const rtm::quatf rotation = rtm::quat_mul(transform.rotation, rtm::quat_conjugate(base.rotation));
const rtm::vector4f translation = rtm::vector_sub(transform.translation, base.translation);
const rtm::vector4f scale = rtm::vector_sub(rtm::vector_mul(transform.scale, rtm::vector_reciprocal(base.scale)), rtm::vector_set(1.0F));
return rtm::qvv_set(rotation, translation, scale);
}
}
ACL_IMPL_FILE_PRAGMA_POP
| 2,810 |
852 | <gh_stars>100-1000
import FWCore.ParameterSet.Config as cms
# HLT specific quality cuts - referenced by HLTPFTauDiscriminatioByIsolation
# A set of quality cuts used for the PFTaus. Note that the quality cuts are
# different for the signal and isolation regions. (Currently, only in Nhits)
hltPFTauQualityCuts = cms.PSet(
signalQualityCuts = cms.PSet(
minTrackPt = cms.double(0.0), # filter PFChargedHadrons below given pt
maxTrackChi2 = cms.double(1000.0), # require track Chi2
minTrackPixelHits = cms.uint32(0), # pixel-only hits (note that these cuts are turned off,
# the tracking cuts might be higher)
maxDeltaZ = cms.double(0.2), # Should in general be disabled at HLT (PV is sometimes missing)
maxTransverseImpactParameter = cms.double(0.03), # Should in general be disabled at HLT (PV is sometimes missing)
minTrackVertexWeight = cms.double(-1), # Should in general be disabled at HLT (PV is sometimes missing)
minTrackHits = cms.uint32(3), # total track hits
minGammaEt = cms.double(1.0), # filter PFgammas below given Pt
useTracksInsteadOfPFHadrons = cms.bool(False), # if true, use generalTracks, instead of PFChargedHadrons
),
isolationQualityCuts = cms.PSet(
minTrackPt = cms.double(1.5),
maxTrackChi2 = cms.double(100.0),
maxDeltaZ = cms.double(0.2), # Should in general be disabled at HLT (PV is sometimes missing)
maxTransverseImpactParameter = cms.double(0.03), # Should in general be disabled at HLT (PV is sometimes missing)
minTrackVertexWeight = cms.double(-1), # Should in general be disabled at HLT (PV is sometimes missing)
# Optionally cut on DZ to lead track
# This option only works for isolation, not signal!
maxDeltaZToLeadTrack = cms.double(0.2),
minTrackPixelHits = cms.uint32(0),
minTrackHits = cms.uint32(3),
minGammaEt = cms.double(1.5),
useTracksInsteadOfPFHadrons = cms.bool(False),
),
# The central definition of primary vertex source.
primaryVertexSrc = cms.InputTag("hltPixelVertices"),
# Possible algorithms are: highestPtInEvent, closestInDeltaZ,
# highestWeightForLeadTrack
pvFindingAlgo = cms.string("highestPtInEvent"),
)
| 1,099 |
1,408 | /*
* Copyright (c) 2015-2017, Renesas Electronics Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef PFC_INIT_M3_H
#define PFC_INIT_M3_H
void pfc_init_m3(void);
#endif /* PFC_INIT_M3_H */
| 101 |
2,151 | <gh_stars>1000+
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/core/frame/intervention.h"
#include "services/service_manager/public/cpp/connector.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/reporting.mojom-blink.h"
#include "third_party/blink/renderer/core/frame/frame_console.h"
#include "third_party/blink/renderer/core/frame/intervention_report.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/local_frame_client.h"
#include "third_party/blink/renderer/core/frame/report.h"
#include "third_party/blink/renderer/core/frame/reporting_context.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
namespace blink {
// static
void Intervention::GenerateReport(const LocalFrame* frame,
const String& message) {
if (!frame)
return;
// Send the message to the console.
frame->Console().AddMessage(ConsoleMessage::Create(
kInterventionMessageSource, kErrorMessageLevel, message));
if (!frame->Client())
return;
Document* document = frame->GetDocument();
// Construct the intervention report.
InterventionReport* body =
new InterventionReport(message, SourceLocation::Capture());
Report* report =
new Report("intervention", document->Url().GetString(), body);
// Send the intervention report to any ReportingObservers.
ReportingContext* reporting_context = ReportingContext::From(document);
if (reporting_context->ObserverExists())
reporting_context->QueueReport(report);
// Send the intervention report to the Reporting API.
mojom::blink::ReportingServiceProxyPtr service;
Platform* platform = Platform::Current();
platform->GetConnector()->BindInterface(platform->GetBrowserServiceName(),
&service);
service->QueueInterventionReport(document->Url(), message, body->sourceFile(),
body->lineNumber(), body->columnNumber());
}
} // namespace blink
| 742 |
319 | /**
* Copyright (c) 2011, The University of Southampton and the individual contributors.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of the University of Southampton nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.openimaj.experiment.evaluation.retrieval;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.openimaj.data.identity.Identifiable;
import org.openimaj.experiment.evaluation.AnalysisResult;
import org.openimaj.experiment.evaluation.Evaluator;
/**
* An implementation of an {@link Evaluator} for the evaluation of retrieval
* experiments using the Cranfield methodology.
*
* @author <NAME> (<EMAIL>.uk)
*
* @param <RESULT>
* Type of analysed data
* @param <DOCUMENT>
* Type of documents
* @param <QUERY>
* Type of query
*/
public class RetrievalEvaluator<RESULT extends AnalysisResult, DOCUMENT extends Identifiable, QUERY>
implements
Evaluator<Map<QUERY, List<DOCUMENT>>, RESULT>
{
protected RetrievalEngine<DOCUMENT, QUERY> engine;
protected Collection<QUERY> queries;
protected Map<QUERY, Set<DOCUMENT>> relevant; // in the future we might want
// a model more like trec
// qrels with relevance
// levels
protected RetrievalAnalyser<RESULT, QUERY, DOCUMENT> analyser;
/**
* Construct a new {@link RetrievalEvaluator} with a search engine, a set of
* queries to perform, relevant documents for each query, and a
* {@link RetrievalAnalyser} to analyse the results.
*
* @param engine
* the query engine
* @param queries
* the queries
* @param relevant
* the relevant documents for each query
* @param analyser
* the analyser
*/
public RetrievalEvaluator(RetrievalEngine<DOCUMENT, QUERY> engine, Collection<QUERY> queries,
Map<QUERY, Set<DOCUMENT>> relevant, RetrievalAnalyser<RESULT, QUERY, DOCUMENT> analyser)
{
this.engine = engine;
this.queries = queries;
this.relevant = relevant;
this.analyser = analyser;
}
/**
* Construct a new {@link RetrievalEvaluator} with a search engine, relevant
* documents for each query, and a {@link RetrievalAnalyser} to analyse the
* results. The queries are determined automatically from the keys of the
* map of relevant documents.
*
* @param engine
* the query engine
* @param relevant
* the relevant documents for each query
* @param analyser
* the analyser
*/
public RetrievalEvaluator(RetrievalEngine<DOCUMENT, QUERY> engine, Map<QUERY, Set<DOCUMENT>> relevant,
RetrievalAnalyser<RESULT, QUERY, DOCUMENT> analyser)
{
this.engine = engine;
this.queries = relevant.keySet();
this.relevant = relevant;
this.analyser = analyser;
}
/**
* Construct a new {@link RetrievalEvaluator} with the given ranked results
* lists and sets of relevant documents for each query, and a
* {@link RetrievalAnalyser} to analyse the results.
* <p>
* Internally, this constructor wraps a simple {@link RetrievalEngine}
* implementation around the results, and determines the set of queries from
* the keys of the relevant document map.
*
* @param results
* the ranked results per query
* @param relevant
* the relevant results per query
* @param analyser
* the analyser
*/
public RetrievalEvaluator(final Map<QUERY, List<DOCUMENT>> results, Map<QUERY, Set<DOCUMENT>> relevant,
RetrievalAnalyser<RESULT, QUERY, DOCUMENT> analyser)
{
this.engine = new RetrievalEngine<DOCUMENT, QUERY>() {
@Override
public List<DOCUMENT> search(QUERY query) {
return results.get(query);
}
};
this.queries = relevant.keySet();
this.relevant = relevant;
this.analyser = analyser;
}
@Override
public Map<QUERY, List<DOCUMENT>> evaluate() {
final Map<QUERY, List<DOCUMENT>> results = new HashMap<QUERY, List<DOCUMENT>>();
for (final QUERY query : queries) {
results.put(query, engine.search(query));
}
return results;
}
@Override
public RESULT analyse(Map<QUERY, List<DOCUMENT>> results) {
return analyser.analyse(results, relevant);
}
}
| 1,911 |
3,075 | <gh_stars>1000+
package org.powermock.api.mockito.internal.mockcreation;
public class RuntimeExceptionProxy extends RuntimeException {
public RuntimeExceptionProxy(Throwable t) {
super(t);
}
}
| 72 |
1,480 | <reponame>cron-ooo/django-compressor
from django.core.exceptions import ImproperlyConfigured
from django.utils.encoding import smart_str
from django.utils.functional import cached_property
from compressor.exceptions import ParserError
from compressor.parser import ParserBase
class LxmlParser(ParserBase):
"""
LxmlParser will use `lxml.html` parser to parse rendered contents of
{% compress %} tag.
"""
def __init__(self, content):
try:
from lxml.html import fromstring
from lxml.etree import tostring
except ImportError as err:
raise ImproperlyConfigured("Error while importing lxml: %s" % err)
except Exception as err:
raise ParserError("Error while initializing parser: %s" % err)
self.fromstring = fromstring
self.tostring = tostring
super().__init__(content)
@cached_property
def tree(self):
"""
Document tree.
"""
content = '<root>%s</root>' % self.content
tree = self.fromstring(content)
self.tostring(tree, encoding=str)
return tree
def css_elems(self):
return self.tree.xpath('//link[re:test(@rel, "^stylesheet$", "i")]|style',
namespaces={"re": "http://exslt.org/regular-expressions"})
def js_elems(self):
return self.tree.findall('script')
def elem_attribs(self, elem):
return elem.attrib
def elem_content(self, elem):
return smart_str(elem.text)
def elem_name(self, elem):
return elem.tag
def elem_str(self, elem):
return smart_str(self.tostring(elem, method='html', encoding=str))
| 696 |
310 | <gh_stars>100-1000
{
"name": "LayerVault",
"description": "A collaboration and presentation service for designers.",
"url": "https://www.layervault.com/"
} | 52 |
1,993 | <filename>brave/src/test/java/brave/internal/codec/WriteBufferTest.java
/*
* Copyright 2013-2020 The OpenZipkin Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package brave.internal.codec;
import java.util.Arrays;
import org.junit.Test;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.assertj.core.api.Assertions.assertThat;
// Originally a subset of zipkin2.internal.WriteBuffer
public class WriteBufferTest {
// Adapted from http://stackoverflow.com/questions/8511490/calculating-length-in-utf-8-of-java-string-without-actually-encoding-it
@Test public void utf8SizeInBytes() {
for (int codepoint = 0; codepoint <= 0x10FFFF; codepoint++) {
if (codepoint == 0xD800) codepoint = 0xDFFF + 1; // skip surrogates
if (Character.isDefined(codepoint)) {
String test = new String(Character.toChars(codepoint));
int expected = test.getBytes(UTF_8).length;
int actual = WriteBuffer.utf8SizeInBytes(test);
if (actual != expected) {
throw new AssertionError(actual + " length != " + expected + " for " + codepoint);
}
}
}
}
/** Uses test data and codepoint wrapping trick from okhttp3.FormBodyTest */
@Test public void utf8_malformed() {
for (int codepoint : Arrays.asList(0xD800, 0xDFFF, 0xD83D)) {
String test = new String(new int[] {'a', codepoint, 'c'}, 0, 3);
assertThat(WriteBuffer.utf8SizeInBytes(test))
.isEqualTo(3);
byte[] bytes = new byte[3];
WriteBuffer.wrap(bytes).writeUtf8(test);
assertThat(bytes)
.containsExactly('a', '?', 'c');
}
}
@Test public void utf8_21Bit_truncated() {
// https://en.wikipedia.org/wiki/Mahjong_Tiles_(Unicode_block)
char[] array = "\uD83C\uDC00\uD83C\uDC01".toCharArray();
array[array.length - 1] = 'c';
String test = new String(array, 0, array.length - 1);
assertThat(WriteBuffer.utf8SizeInBytes(test))
.isEqualTo(5);
byte[] bytes = new byte[5];
WriteBuffer.wrap(bytes).writeUtf8(test);
assertThat(new String(bytes, UTF_8))
.isEqualTo("\uD83C\uDC00?");
}
@Test public void utf8_21Bit_brokenLowSurrogate() {
// https://en.wikipedia.org/wiki/Mahjong_Tiles_(Unicode_block)
char[] array = "\uD83C\uDC00\uD83C\uDC01".toCharArray();
array[array.length - 1] = 'c';
String test = new String(array);
assertThat(WriteBuffer.utf8SizeInBytes(test))
.isEqualTo(6);
byte[] bytes = new byte[6];
WriteBuffer.wrap(bytes).writeUtf8(test);
assertThat(new String(bytes, UTF_8))
.isEqualTo("\uD83C\uDC00?c");
}
@Test public void utf8_matchesJRE() {
// examples from http://utf8everywhere.org/
for (String string : Arrays.asList(
"Приве́т नमस्ते שָׁלוֹם",
"ю́ cyrillic small letter yu with acute",
"∃y ∀x ¬(x ≺ y)"
)) {
int encodedSize = WriteBuffer.utf8SizeInBytes(string);
assertThat(encodedSize)
.isEqualTo(string.getBytes(UTF_8).length);
byte[] bytes = new byte[encodedSize];
WriteBuffer.wrap(bytes).writeUtf8(string);
assertThat(new String(bytes, UTF_8))
.isEqualTo(string);
}
}
@Test public void utf8_matchesAscii() {
String ascii = "86154a4ba6e913854d1e00c0db9010db";
int encodedSize = WriteBuffer.utf8SizeInBytes(ascii);
assertThat(encodedSize)
.isEqualTo(ascii.length());
byte[] bytes = new byte[encodedSize];
WriteBuffer.wrap(bytes).writeAscii(ascii);
assertThat(new String(bytes, UTF_8))
.isEqualTo(ascii);
WriteBuffer.wrap(bytes).writeUtf8(ascii);
assertThat(new String(bytes, UTF_8))
.isEqualTo(ascii);
}
@Test public void emoji() {
byte[] emojiBytes = {(byte) 0xF0, (byte) 0x9F, (byte) 0x98, (byte) 0x81};
String emoji = new String(emojiBytes, UTF_8);
assertThat(WriteBuffer.utf8SizeInBytes(emoji))
.isEqualTo(emojiBytes.length);
byte[] bytes = new byte[emojiBytes.length];
WriteBuffer.wrap(bytes).writeUtf8(emoji);
assertThat(bytes)
.isEqualTo(emojiBytes);
}
@Test public void writeAscii_long() {
assertThat(writeAscii(-1005656679588439279L))
.isEqualTo("-1005656679588439279");
assertThat(writeAscii(0L))
.isEqualTo("0");
assertThat(writeAscii(-9223372036854775808L /* Long.MIN_VALUE */))
.isEqualTo("-9223372036854775808");
assertThat(writeAscii(123456789L))
.isEqualTo("123456789");
}
static String writeAscii(long v) {
byte[] bytes = new byte[WriteBuffer.asciiSizeInBytes(v)];
WriteBuffer.wrap(bytes).writeAscii(v);
return new String(bytes, UTF_8);
}
// Test creating Buffer for a long string
@Test public void writeString() {
StringBuilder builder = new StringBuilder();
for (int i = 0; i < 100000; i++) {
builder.append("a");
}
String string = builder.toString();
byte[] bytes = new byte[string.length()];
WriteBuffer.wrap(bytes).writeAscii(string);
assertThat(new String(bytes, UTF_8)).isEqualTo(string);
}
}
| 2,283 |
3,372 | /*
* Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.mediatailor;
import javax.annotation.Generated;
import com.amazonaws.services.mediatailor.model.*;
/**
* Interface for accessing MediaTailor asynchronously. Each asynchronous method will return a Java Future object
* representing the asynchronous operation; overloads which accept an {@code AsyncHandler} can be used to receive
* notification when an asynchronous operation completes.
* <p>
* <b>Note:</b> Do not directly implement this interface, new methods are added to it regularly. Extend from
* {@link com.amazonaws.services.mediatailor.AbstractAWSMediaTailorAsync} instead.
* </p>
* <p>
* <p>
* Use the AWS Elemental MediaTailor SDKs and CLI to configure scalable ad insertion and linear channels. With
* MediaTailor, you can assemble existing content into a linear stream and serve targeted ads to viewers while
* maintaining broadcast quality in over-the-top (OTT) video applications. For information about using the service,
* including detailed information about the settings covered in this guide, see the <a
* href="https://docs.aws.amazon.com/mediatailor/latest/ug/">AWS Elemental MediaTailor User Guide</a>.
* </p>
* <p>
* Through the SDKs and the CLI you manage AWS Elemental MediaTailor configurations and channels the same as you do
* through the console. For example, you specify ad insertion behavior and mapping information for the origin server and
* the ad decision server (ADS).
* </p>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public interface AWSMediaTailorAsync extends AWSMediaTailor {
/**
* <p>
* Configures Amazon CloudWatch log settings for a playback configuration.
* </p>
*
* @param configureLogsForPlaybackConfigurationRequest
* Configures Amazon CloudWatch log settings for a playback configuration.
* @return A Java Future containing the result of the ConfigureLogsForPlaybackConfiguration operation returned by
* the service.
* @sample AWSMediaTailorAsync.ConfigureLogsForPlaybackConfiguration
* @see <a
* href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/ConfigureLogsForPlaybackConfiguration"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<ConfigureLogsForPlaybackConfigurationResult> configureLogsForPlaybackConfigurationAsync(
ConfigureLogsForPlaybackConfigurationRequest configureLogsForPlaybackConfigurationRequest);
/**
* <p>
* Configures Amazon CloudWatch log settings for a playback configuration.
* </p>
*
* @param configureLogsForPlaybackConfigurationRequest
* Configures Amazon CloudWatch log settings for a playback configuration.
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the ConfigureLogsForPlaybackConfiguration operation returned by
* the service.
* @sample AWSMediaTailorAsyncHandler.ConfigureLogsForPlaybackConfiguration
* @see <a
* href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/ConfigureLogsForPlaybackConfiguration"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<ConfigureLogsForPlaybackConfigurationResult> configureLogsForPlaybackConfigurationAsync(
ConfigureLogsForPlaybackConfigurationRequest configureLogsForPlaybackConfigurationRequest,
com.amazonaws.handlers.AsyncHandler<ConfigureLogsForPlaybackConfigurationRequest, ConfigureLogsForPlaybackConfigurationResult> asyncHandler);
/**
* <p>
* Creates a channel.
* </p>
*
* @param createChannelRequest
* @return A Java Future containing the result of the CreateChannel operation returned by the service.
* @sample AWSMediaTailorAsync.CreateChannel
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/CreateChannel" target="_top">AWS API
* Documentation</a>
*/
java.util.concurrent.Future<CreateChannelResult> createChannelAsync(CreateChannelRequest createChannelRequest);
/**
* <p>
* Creates a channel.
* </p>
*
* @param createChannelRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the CreateChannel operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.CreateChannel
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/CreateChannel" target="_top">AWS API
* Documentation</a>
*/
java.util.concurrent.Future<CreateChannelResult> createChannelAsync(CreateChannelRequest createChannelRequest,
com.amazonaws.handlers.AsyncHandler<CreateChannelRequest, CreateChannelResult> asyncHandler);
/**
* <p>
* Creates a new prefetch schedule for the specified playback configuration.
* </p>
*
* @param createPrefetchScheduleRequest
* @return A Java Future containing the result of the CreatePrefetchSchedule operation returned by the service.
* @sample AWSMediaTailorAsync.CreatePrefetchSchedule
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/CreatePrefetchSchedule"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<CreatePrefetchScheduleResult> createPrefetchScheduleAsync(CreatePrefetchScheduleRequest createPrefetchScheduleRequest);
/**
* <p>
* Creates a new prefetch schedule for the specified playback configuration.
* </p>
*
* @param createPrefetchScheduleRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the CreatePrefetchSchedule operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.CreatePrefetchSchedule
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/CreatePrefetchSchedule"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<CreatePrefetchScheduleResult> createPrefetchScheduleAsync(CreatePrefetchScheduleRequest createPrefetchScheduleRequest,
com.amazonaws.handlers.AsyncHandler<CreatePrefetchScheduleRequest, CreatePrefetchScheduleResult> asyncHandler);
/**
* <p>
* Creates a program.
* </p>
*
* @param createProgramRequest
* @return A Java Future containing the result of the CreateProgram operation returned by the service.
* @sample AWSMediaTailorAsync.CreateProgram
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/CreateProgram" target="_top">AWS API
* Documentation</a>
*/
java.util.concurrent.Future<CreateProgramResult> createProgramAsync(CreateProgramRequest createProgramRequest);
/**
* <p>
* Creates a program.
* </p>
*
* @param createProgramRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the CreateProgram operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.CreateProgram
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/CreateProgram" target="_top">AWS API
* Documentation</a>
*/
java.util.concurrent.Future<CreateProgramResult> createProgramAsync(CreateProgramRequest createProgramRequest,
com.amazonaws.handlers.AsyncHandler<CreateProgramRequest, CreateProgramResult> asyncHandler);
/**
* <p>
* Creates a source location on a specific channel.
* </p>
*
* @param createSourceLocationRequest
* @return A Java Future containing the result of the CreateSourceLocation operation returned by the service.
* @sample AWSMediaTailorAsync.CreateSourceLocation
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/CreateSourceLocation"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<CreateSourceLocationResult> createSourceLocationAsync(CreateSourceLocationRequest createSourceLocationRequest);
/**
* <p>
* Creates a source location on a specific channel.
* </p>
*
* @param createSourceLocationRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the CreateSourceLocation operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.CreateSourceLocation
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/CreateSourceLocation"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<CreateSourceLocationResult> createSourceLocationAsync(CreateSourceLocationRequest createSourceLocationRequest,
com.amazonaws.handlers.AsyncHandler<CreateSourceLocationRequest, CreateSourceLocationResult> asyncHandler);
/**
* <p>
* Creates name for a specific VOD source in a source location.
* </p>
*
* @param createVodSourceRequest
* @return A Java Future containing the result of the CreateVodSource operation returned by the service.
* @sample AWSMediaTailorAsync.CreateVodSource
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/CreateVodSource" target="_top">AWS
* API Documentation</a>
*/
java.util.concurrent.Future<CreateVodSourceResult> createVodSourceAsync(CreateVodSourceRequest createVodSourceRequest);
/**
* <p>
* Creates name for a specific VOD source in a source location.
* </p>
*
* @param createVodSourceRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the CreateVodSource operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.CreateVodSource
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/CreateVodSource" target="_top">AWS
* API Documentation</a>
*/
java.util.concurrent.Future<CreateVodSourceResult> createVodSourceAsync(CreateVodSourceRequest createVodSourceRequest,
com.amazonaws.handlers.AsyncHandler<CreateVodSourceRequest, CreateVodSourceResult> asyncHandler);
/**
* <p>
* Deletes a channel. You must stop the channel before it can be deleted.
* </p>
*
* @param deleteChannelRequest
* @return A Java Future containing the result of the DeleteChannel operation returned by the service.
* @sample AWSMediaTailorAsync.DeleteChannel
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/DeleteChannel" target="_top">AWS API
* Documentation</a>
*/
java.util.concurrent.Future<DeleteChannelResult> deleteChannelAsync(DeleteChannelRequest deleteChannelRequest);
/**
* <p>
* Deletes a channel. You must stop the channel before it can be deleted.
* </p>
*
* @param deleteChannelRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the DeleteChannel operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.DeleteChannel
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/DeleteChannel" target="_top">AWS API
* Documentation</a>
*/
java.util.concurrent.Future<DeleteChannelResult> deleteChannelAsync(DeleteChannelRequest deleteChannelRequest,
com.amazonaws.handlers.AsyncHandler<DeleteChannelRequest, DeleteChannelResult> asyncHandler);
/**
* <p>
* Deletes a channel's IAM policy.
* </p>
*
* @param deleteChannelPolicyRequest
* @return A Java Future containing the result of the DeleteChannelPolicy operation returned by the service.
* @sample AWSMediaTailorAsync.DeleteChannelPolicy
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/DeleteChannelPolicy"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<DeleteChannelPolicyResult> deleteChannelPolicyAsync(DeleteChannelPolicyRequest deleteChannelPolicyRequest);
/**
* <p>
* Deletes a channel's IAM policy.
* </p>
*
* @param deleteChannelPolicyRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the DeleteChannelPolicy operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.DeleteChannelPolicy
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/DeleteChannelPolicy"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<DeleteChannelPolicyResult> deleteChannelPolicyAsync(DeleteChannelPolicyRequest deleteChannelPolicyRequest,
com.amazonaws.handlers.AsyncHandler<DeleteChannelPolicyRequest, DeleteChannelPolicyResult> asyncHandler);
/**
* <p>
* Deletes the playback configuration for the specified name.
* </p>
*
* @param deletePlaybackConfigurationRequest
* @return A Java Future containing the result of the DeletePlaybackConfiguration operation returned by the service.
* @sample AWSMediaTailorAsync.DeletePlaybackConfiguration
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/DeletePlaybackConfiguration"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<DeletePlaybackConfigurationResult> deletePlaybackConfigurationAsync(
DeletePlaybackConfigurationRequest deletePlaybackConfigurationRequest);
/**
* <p>
* Deletes the playback configuration for the specified name.
* </p>
*
* @param deletePlaybackConfigurationRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the DeletePlaybackConfiguration operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.DeletePlaybackConfiguration
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/DeletePlaybackConfiguration"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<DeletePlaybackConfigurationResult> deletePlaybackConfigurationAsync(
DeletePlaybackConfigurationRequest deletePlaybackConfigurationRequest,
com.amazonaws.handlers.AsyncHandler<DeletePlaybackConfigurationRequest, DeletePlaybackConfigurationResult> asyncHandler);
/**
* <p>
* Deletes a prefetch schedule for a specific playback configuration. If you call DeletePrefetchSchedule on an
* expired prefetch schedule, MediaTailor returns an HTTP 404 status code.
* </p>
*
* @param deletePrefetchScheduleRequest
* @return A Java Future containing the result of the DeletePrefetchSchedule operation returned by the service.
* @sample AWSMediaTailorAsync.DeletePrefetchSchedule
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/DeletePrefetchSchedule"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<DeletePrefetchScheduleResult> deletePrefetchScheduleAsync(DeletePrefetchScheduleRequest deletePrefetchScheduleRequest);
/**
* <p>
* Deletes a prefetch schedule for a specific playback configuration. If you call DeletePrefetchSchedule on an
* expired prefetch schedule, MediaTailor returns an HTTP 404 status code.
* </p>
*
* @param deletePrefetchScheduleRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the DeletePrefetchSchedule operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.DeletePrefetchSchedule
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/DeletePrefetchSchedule"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<DeletePrefetchScheduleResult> deletePrefetchScheduleAsync(DeletePrefetchScheduleRequest deletePrefetchScheduleRequest,
com.amazonaws.handlers.AsyncHandler<DeletePrefetchScheduleRequest, DeletePrefetchScheduleResult> asyncHandler);
/**
* <p>
* Deletes a specific program on a specific channel.
* </p>
*
* @param deleteProgramRequest
* @return A Java Future containing the result of the DeleteProgram operation returned by the service.
* @sample AWSMediaTailorAsync.DeleteProgram
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/DeleteProgram" target="_top">AWS API
* Documentation</a>
*/
java.util.concurrent.Future<DeleteProgramResult> deleteProgramAsync(DeleteProgramRequest deleteProgramRequest);
/**
* <p>
* Deletes a specific program on a specific channel.
* </p>
*
* @param deleteProgramRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the DeleteProgram operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.DeleteProgram
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/DeleteProgram" target="_top">AWS API
* Documentation</a>
*/
java.util.concurrent.Future<DeleteProgramResult> deleteProgramAsync(DeleteProgramRequest deleteProgramRequest,
com.amazonaws.handlers.AsyncHandler<DeleteProgramRequest, DeleteProgramResult> asyncHandler);
/**
* <p>
* Deletes a source location on a specific channel.
* </p>
*
* @param deleteSourceLocationRequest
* @return A Java Future containing the result of the DeleteSourceLocation operation returned by the service.
* @sample AWSMediaTailorAsync.DeleteSourceLocation
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/DeleteSourceLocation"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<DeleteSourceLocationResult> deleteSourceLocationAsync(DeleteSourceLocationRequest deleteSourceLocationRequest);
/**
* <p>
* Deletes a source location on a specific channel.
* </p>
*
* @param deleteSourceLocationRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the DeleteSourceLocation operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.DeleteSourceLocation
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/DeleteSourceLocation"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<DeleteSourceLocationResult> deleteSourceLocationAsync(DeleteSourceLocationRequest deleteSourceLocationRequest,
com.amazonaws.handlers.AsyncHandler<DeleteSourceLocationRequest, DeleteSourceLocationResult> asyncHandler);
/**
* <p>
* Deletes a specific VOD source in a specific source location.
* </p>
*
* @param deleteVodSourceRequest
* @return A Java Future containing the result of the DeleteVodSource operation returned by the service.
* @sample AWSMediaTailorAsync.DeleteVodSource
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/DeleteVodSource" target="_top">AWS
* API Documentation</a>
*/
java.util.concurrent.Future<DeleteVodSourceResult> deleteVodSourceAsync(DeleteVodSourceRequest deleteVodSourceRequest);
/**
* <p>
* Deletes a specific VOD source in a specific source location.
* </p>
*
* @param deleteVodSourceRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the DeleteVodSource operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.DeleteVodSource
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/DeleteVodSource" target="_top">AWS
* API Documentation</a>
*/
java.util.concurrent.Future<DeleteVodSourceResult> deleteVodSourceAsync(DeleteVodSourceRequest deleteVodSourceRequest,
com.amazonaws.handlers.AsyncHandler<DeleteVodSourceRequest, DeleteVodSourceResult> asyncHandler);
/**
* <p>
* Describes the properties of a specific channel.
* </p>
*
* @param describeChannelRequest
* @return A Java Future containing the result of the DescribeChannel operation returned by the service.
* @sample AWSMediaTailorAsync.DescribeChannel
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/DescribeChannel" target="_top">AWS
* API Documentation</a>
*/
java.util.concurrent.Future<DescribeChannelResult> describeChannelAsync(DescribeChannelRequest describeChannelRequest);
/**
* <p>
* Describes the properties of a specific channel.
* </p>
*
* @param describeChannelRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the DescribeChannel operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.DescribeChannel
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/DescribeChannel" target="_top">AWS
* API Documentation</a>
*/
java.util.concurrent.Future<DescribeChannelResult> describeChannelAsync(DescribeChannelRequest describeChannelRequest,
com.amazonaws.handlers.AsyncHandler<DescribeChannelRequest, DescribeChannelResult> asyncHandler);
/**
* <p>
* Retrieves the properties of the requested program.
* </p>
*
* @param describeProgramRequest
* @return A Java Future containing the result of the DescribeProgram operation returned by the service.
* @sample AWSMediaTailorAsync.DescribeProgram
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/DescribeProgram" target="_top">AWS
* API Documentation</a>
*/
java.util.concurrent.Future<DescribeProgramResult> describeProgramAsync(DescribeProgramRequest describeProgramRequest);
/**
* <p>
* Retrieves the properties of the requested program.
* </p>
*
* @param describeProgramRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the DescribeProgram operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.DescribeProgram
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/DescribeProgram" target="_top">AWS
* API Documentation</a>
*/
java.util.concurrent.Future<DescribeProgramResult> describeProgramAsync(DescribeProgramRequest describeProgramRequest,
com.amazonaws.handlers.AsyncHandler<DescribeProgramRequest, DescribeProgramResult> asyncHandler);
/**
* <p>
* Retrieves the properties of the requested source location.
* </p>
*
* @param describeSourceLocationRequest
* @return A Java Future containing the result of the DescribeSourceLocation operation returned by the service.
* @sample AWSMediaTailorAsync.DescribeSourceLocation
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/DescribeSourceLocation"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<DescribeSourceLocationResult> describeSourceLocationAsync(DescribeSourceLocationRequest describeSourceLocationRequest);
/**
* <p>
* Retrieves the properties of the requested source location.
* </p>
*
* @param describeSourceLocationRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the DescribeSourceLocation operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.DescribeSourceLocation
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/DescribeSourceLocation"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<DescribeSourceLocationResult> describeSourceLocationAsync(DescribeSourceLocationRequest describeSourceLocationRequest,
com.amazonaws.handlers.AsyncHandler<DescribeSourceLocationRequest, DescribeSourceLocationResult> asyncHandler);
/**
* <p>
* Provides details about a specific VOD source in a specific source location.
* </p>
*
* @param describeVodSourceRequest
* @return A Java Future containing the result of the DescribeVodSource operation returned by the service.
* @sample AWSMediaTailorAsync.DescribeVodSource
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/DescribeVodSource" target="_top">AWS
* API Documentation</a>
*/
java.util.concurrent.Future<DescribeVodSourceResult> describeVodSourceAsync(DescribeVodSourceRequest describeVodSourceRequest);
/**
* <p>
* Provides details about a specific VOD source in a specific source location.
* </p>
*
* @param describeVodSourceRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the DescribeVodSource operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.DescribeVodSource
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/DescribeVodSource" target="_top">AWS
* API Documentation</a>
*/
java.util.concurrent.Future<DescribeVodSourceResult> describeVodSourceAsync(DescribeVodSourceRequest describeVodSourceRequest,
com.amazonaws.handlers.AsyncHandler<DescribeVodSourceRequest, DescribeVodSourceResult> asyncHandler);
/**
* <p>
* Retrieves information about a channel's IAM policy.
* </p>
*
* @param getChannelPolicyRequest
* @return A Java Future containing the result of the GetChannelPolicy operation returned by the service.
* @sample AWSMediaTailorAsync.GetChannelPolicy
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/GetChannelPolicy" target="_top">AWS
* API Documentation</a>
*/
java.util.concurrent.Future<GetChannelPolicyResult> getChannelPolicyAsync(GetChannelPolicyRequest getChannelPolicyRequest);
/**
* <p>
* Retrieves information about a channel's IAM policy.
* </p>
*
* @param getChannelPolicyRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the GetChannelPolicy operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.GetChannelPolicy
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/GetChannelPolicy" target="_top">AWS
* API Documentation</a>
*/
java.util.concurrent.Future<GetChannelPolicyResult> getChannelPolicyAsync(GetChannelPolicyRequest getChannelPolicyRequest,
com.amazonaws.handlers.AsyncHandler<GetChannelPolicyRequest, GetChannelPolicyResult> asyncHandler);
/**
* <p>
* Retrieves information about your channel's schedule.
* </p>
*
* @param getChannelScheduleRequest
* @return A Java Future containing the result of the GetChannelSchedule operation returned by the service.
* @sample AWSMediaTailorAsync.GetChannelSchedule
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/GetChannelSchedule" target="_top">AWS
* API Documentation</a>
*/
java.util.concurrent.Future<GetChannelScheduleResult> getChannelScheduleAsync(GetChannelScheduleRequest getChannelScheduleRequest);
/**
* <p>
* Retrieves information about your channel's schedule.
* </p>
*
* @param getChannelScheduleRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the GetChannelSchedule operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.GetChannelSchedule
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/GetChannelSchedule" target="_top">AWS
* API Documentation</a>
*/
java.util.concurrent.Future<GetChannelScheduleResult> getChannelScheduleAsync(GetChannelScheduleRequest getChannelScheduleRequest,
com.amazonaws.handlers.AsyncHandler<GetChannelScheduleRequest, GetChannelScheduleResult> asyncHandler);
/**
* <p>
* Returns the playback configuration for the specified name.
* </p>
*
* @param getPlaybackConfigurationRequest
* @return A Java Future containing the result of the GetPlaybackConfiguration operation returned by the service.
* @sample AWSMediaTailorAsync.GetPlaybackConfiguration
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/GetPlaybackConfiguration"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<GetPlaybackConfigurationResult> getPlaybackConfigurationAsync(GetPlaybackConfigurationRequest getPlaybackConfigurationRequest);
/**
* <p>
* Returns the playback configuration for the specified name.
* </p>
*
* @param getPlaybackConfigurationRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the GetPlaybackConfiguration operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.GetPlaybackConfiguration
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/GetPlaybackConfiguration"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<GetPlaybackConfigurationResult> getPlaybackConfigurationAsync(GetPlaybackConfigurationRequest getPlaybackConfigurationRequest,
com.amazonaws.handlers.AsyncHandler<GetPlaybackConfigurationRequest, GetPlaybackConfigurationResult> asyncHandler);
/**
* <p>
* Returns information about the prefetch schedule for a specific playback configuration. If you call
* GetPrefetchSchedule on an expired prefetch schedule, MediaTailor returns an HTTP 404 status code.
* </p>
*
* @param getPrefetchScheduleRequest
* @return A Java Future containing the result of the GetPrefetchSchedule operation returned by the service.
* @sample AWSMediaTailorAsync.GetPrefetchSchedule
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/GetPrefetchSchedule"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<GetPrefetchScheduleResult> getPrefetchScheduleAsync(GetPrefetchScheduleRequest getPrefetchScheduleRequest);
/**
* <p>
* Returns information about the prefetch schedule for a specific playback configuration. If you call
* GetPrefetchSchedule on an expired prefetch schedule, MediaTailor returns an HTTP 404 status code.
* </p>
*
* @param getPrefetchScheduleRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the GetPrefetchSchedule operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.GetPrefetchSchedule
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/GetPrefetchSchedule"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<GetPrefetchScheduleResult> getPrefetchScheduleAsync(GetPrefetchScheduleRequest getPrefetchScheduleRequest,
com.amazonaws.handlers.AsyncHandler<GetPrefetchScheduleRequest, GetPrefetchScheduleResult> asyncHandler);
/**
* <p>
* Returns a list of alerts for the given resource.
* </p>
*
* @param listAlertsRequest
* @return A Java Future containing the result of the ListAlerts operation returned by the service.
* @sample AWSMediaTailorAsync.ListAlerts
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/ListAlerts" target="_top">AWS API
* Documentation</a>
*/
java.util.concurrent.Future<ListAlertsResult> listAlertsAsync(ListAlertsRequest listAlertsRequest);
/**
* <p>
* Returns a list of alerts for the given resource.
* </p>
*
* @param listAlertsRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the ListAlerts operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.ListAlerts
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/ListAlerts" target="_top">AWS API
* Documentation</a>
*/
java.util.concurrent.Future<ListAlertsResult> listAlertsAsync(ListAlertsRequest listAlertsRequest,
com.amazonaws.handlers.AsyncHandler<ListAlertsRequest, ListAlertsResult> asyncHandler);
/**
* <p>
* Retrieves a list of channels that are associated with this account.
* </p>
*
* @param listChannelsRequest
* @return A Java Future containing the result of the ListChannels operation returned by the service.
* @sample AWSMediaTailorAsync.ListChannels
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/ListChannels" target="_top">AWS API
* Documentation</a>
*/
java.util.concurrent.Future<ListChannelsResult> listChannelsAsync(ListChannelsRequest listChannelsRequest);
/**
* <p>
* Retrieves a list of channels that are associated with this account.
* </p>
*
* @param listChannelsRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the ListChannels operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.ListChannels
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/ListChannels" target="_top">AWS API
* Documentation</a>
*/
java.util.concurrent.Future<ListChannelsResult> listChannelsAsync(ListChannelsRequest listChannelsRequest,
com.amazonaws.handlers.AsyncHandler<ListChannelsRequest, ListChannelsResult> asyncHandler);
/**
* <p>
* Returns a list of the playback configurations defined in AWS Elemental MediaTailor. You can specify a maximum
* number of configurations to return at a time. The default maximum is 50. Results are returned in pagefuls. If
* MediaTailor has more configurations than the specified maximum, it provides parameters in the response that you
* can use to retrieve the next pageful.
* </p>
*
* @param listPlaybackConfigurationsRequest
* @return A Java Future containing the result of the ListPlaybackConfigurations operation returned by the service.
* @sample AWSMediaTailorAsync.ListPlaybackConfigurations
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/ListPlaybackConfigurations"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<ListPlaybackConfigurationsResult> listPlaybackConfigurationsAsync(
ListPlaybackConfigurationsRequest listPlaybackConfigurationsRequest);
/**
* <p>
* Returns a list of the playback configurations defined in AWS Elemental MediaTailor. You can specify a maximum
* number of configurations to return at a time. The default maximum is 50. Results are returned in pagefuls. If
* MediaTailor has more configurations than the specified maximum, it provides parameters in the response that you
* can use to retrieve the next pageful.
* </p>
*
* @param listPlaybackConfigurationsRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the ListPlaybackConfigurations operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.ListPlaybackConfigurations
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/ListPlaybackConfigurations"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<ListPlaybackConfigurationsResult> listPlaybackConfigurationsAsync(
ListPlaybackConfigurationsRequest listPlaybackConfigurationsRequest,
com.amazonaws.handlers.AsyncHandler<ListPlaybackConfigurationsRequest, ListPlaybackConfigurationsResult> asyncHandler);
/**
* <p>
* Creates a new prefetch schedule.
* </p>
*
* @param listPrefetchSchedulesRequest
* @return A Java Future containing the result of the ListPrefetchSchedules operation returned by the service.
* @sample AWSMediaTailorAsync.ListPrefetchSchedules
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/ListPrefetchSchedules"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<ListPrefetchSchedulesResult> listPrefetchSchedulesAsync(ListPrefetchSchedulesRequest listPrefetchSchedulesRequest);
/**
* <p>
* Creates a new prefetch schedule.
* </p>
*
* @param listPrefetchSchedulesRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the ListPrefetchSchedules operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.ListPrefetchSchedules
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/ListPrefetchSchedules"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<ListPrefetchSchedulesResult> listPrefetchSchedulesAsync(ListPrefetchSchedulesRequest listPrefetchSchedulesRequest,
com.amazonaws.handlers.AsyncHandler<ListPrefetchSchedulesRequest, ListPrefetchSchedulesResult> asyncHandler);
/**
* <p>
* Retrieves a list of source locations.
* </p>
*
* @param listSourceLocationsRequest
* @return A Java Future containing the result of the ListSourceLocations operation returned by the service.
* @sample AWSMediaTailorAsync.ListSourceLocations
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/ListSourceLocations"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<ListSourceLocationsResult> listSourceLocationsAsync(ListSourceLocationsRequest listSourceLocationsRequest);
/**
* <p>
* Retrieves a list of source locations.
* </p>
*
* @param listSourceLocationsRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the ListSourceLocations operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.ListSourceLocations
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/ListSourceLocations"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<ListSourceLocationsResult> listSourceLocationsAsync(ListSourceLocationsRequest listSourceLocationsRequest,
com.amazonaws.handlers.AsyncHandler<ListSourceLocationsRequest, ListSourceLocationsResult> asyncHandler);
/**
* <p>
* Returns a list of the tags assigned to the specified playback configuration resource.
* </p>
*
* @param listTagsForResourceRequest
* @return A Java Future containing the result of the ListTagsForResource operation returned by the service.
* @sample AWSMediaTailorAsync.ListTagsForResource
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/ListTagsForResource"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<ListTagsForResourceResult> listTagsForResourceAsync(ListTagsForResourceRequest listTagsForResourceRequest);
/**
* <p>
* Returns a list of the tags assigned to the specified playback configuration resource.
* </p>
*
* @param listTagsForResourceRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the ListTagsForResource operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.ListTagsForResource
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/ListTagsForResource"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<ListTagsForResourceResult> listTagsForResourceAsync(ListTagsForResourceRequest listTagsForResourceRequest,
com.amazonaws.handlers.AsyncHandler<ListTagsForResourceRequest, ListTagsForResourceResult> asyncHandler);
/**
* <p>
* Lists all the VOD sources in a source location.
* </p>
*
* @param listVodSourcesRequest
* @return A Java Future containing the result of the ListVodSources operation returned by the service.
* @sample AWSMediaTailorAsync.ListVodSources
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/ListVodSources" target="_top">AWS API
* Documentation</a>
*/
java.util.concurrent.Future<ListVodSourcesResult> listVodSourcesAsync(ListVodSourcesRequest listVodSourcesRequest);
/**
* <p>
* Lists all the VOD sources in a source location.
* </p>
*
* @param listVodSourcesRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the ListVodSources operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.ListVodSources
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/ListVodSources" target="_top">AWS API
* Documentation</a>
*/
java.util.concurrent.Future<ListVodSourcesResult> listVodSourcesAsync(ListVodSourcesRequest listVodSourcesRequest,
com.amazonaws.handlers.AsyncHandler<ListVodSourcesRequest, ListVodSourcesResult> asyncHandler);
/**
* <p>
* Creates an IAM policy for the channel.
* </p>
*
* @param putChannelPolicyRequest
* @return A Java Future containing the result of the PutChannelPolicy operation returned by the service.
* @sample AWSMediaTailorAsync.PutChannelPolicy
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/PutChannelPolicy" target="_top">AWS
* API Documentation</a>
*/
java.util.concurrent.Future<PutChannelPolicyResult> putChannelPolicyAsync(PutChannelPolicyRequest putChannelPolicyRequest);
/**
* <p>
* Creates an IAM policy for the channel.
* </p>
*
* @param putChannelPolicyRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the PutChannelPolicy operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.PutChannelPolicy
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/PutChannelPolicy" target="_top">AWS
* API Documentation</a>
*/
java.util.concurrent.Future<PutChannelPolicyResult> putChannelPolicyAsync(PutChannelPolicyRequest putChannelPolicyRequest,
com.amazonaws.handlers.AsyncHandler<PutChannelPolicyRequest, PutChannelPolicyResult> asyncHandler);
/**
* <p>
* Adds a new playback configuration to AWS Elemental MediaTailor.
* </p>
*
* @param putPlaybackConfigurationRequest
* @return A Java Future containing the result of the PutPlaybackConfiguration operation returned by the service.
* @sample AWSMediaTailorAsync.PutPlaybackConfiguration
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/PutPlaybackConfiguration"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<PutPlaybackConfigurationResult> putPlaybackConfigurationAsync(PutPlaybackConfigurationRequest putPlaybackConfigurationRequest);
/**
* <p>
* Adds a new playback configuration to AWS Elemental MediaTailor.
* </p>
*
* @param putPlaybackConfigurationRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the PutPlaybackConfiguration operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.PutPlaybackConfiguration
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/PutPlaybackConfiguration"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<PutPlaybackConfigurationResult> putPlaybackConfigurationAsync(PutPlaybackConfigurationRequest putPlaybackConfigurationRequest,
com.amazonaws.handlers.AsyncHandler<PutPlaybackConfigurationRequest, PutPlaybackConfigurationResult> asyncHandler);
/**
* <p>
* Starts a specific channel.
* </p>
*
* @param startChannelRequest
* @return A Java Future containing the result of the StartChannel operation returned by the service.
* @sample AWSMediaTailorAsync.StartChannel
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/StartChannel" target="_top">AWS API
* Documentation</a>
*/
java.util.concurrent.Future<StartChannelResult> startChannelAsync(StartChannelRequest startChannelRequest);
/**
* <p>
* Starts a specific channel.
* </p>
*
* @param startChannelRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the StartChannel operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.StartChannel
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/StartChannel" target="_top">AWS API
* Documentation</a>
*/
java.util.concurrent.Future<StartChannelResult> startChannelAsync(StartChannelRequest startChannelRequest,
com.amazonaws.handlers.AsyncHandler<StartChannelRequest, StartChannelResult> asyncHandler);
/**
* <p>
* Stops a specific channel.
* </p>
*
* @param stopChannelRequest
* @return A Java Future containing the result of the StopChannel operation returned by the service.
* @sample AWSMediaTailorAsync.StopChannel
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/StopChannel" target="_top">AWS API
* Documentation</a>
*/
java.util.concurrent.Future<StopChannelResult> stopChannelAsync(StopChannelRequest stopChannelRequest);
/**
* <p>
* Stops a specific channel.
* </p>
*
* @param stopChannelRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the StopChannel operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.StopChannel
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/StopChannel" target="_top">AWS API
* Documentation</a>
*/
java.util.concurrent.Future<StopChannelResult> stopChannelAsync(StopChannelRequest stopChannelRequest,
com.amazonaws.handlers.AsyncHandler<StopChannelRequest, StopChannelResult> asyncHandler);
/**
* <p>
* Adds tags to the specified playback configuration resource. You can specify one or more tags to add.
* </p>
*
* @param tagResourceRequest
* @return A Java Future containing the result of the TagResource operation returned by the service.
* @sample AWSMediaTailorAsync.TagResource
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/TagResource" target="_top">AWS API
* Documentation</a>
*/
java.util.concurrent.Future<TagResourceResult> tagResourceAsync(TagResourceRequest tagResourceRequest);
/**
* <p>
* Adds tags to the specified playback configuration resource. You can specify one or more tags to add.
* </p>
*
* @param tagResourceRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the TagResource operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.TagResource
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/TagResource" target="_top">AWS API
* Documentation</a>
*/
java.util.concurrent.Future<TagResourceResult> tagResourceAsync(TagResourceRequest tagResourceRequest,
com.amazonaws.handlers.AsyncHandler<TagResourceRequest, TagResourceResult> asyncHandler);
/**
* <p>
* Removes tags from the specified playback configuration resource. You can specify one or more tags to remove.
* </p>
*
* @param untagResourceRequest
* @return A Java Future containing the result of the UntagResource operation returned by the service.
* @sample AWSMediaTailorAsync.UntagResource
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/UntagResource" target="_top">AWS API
* Documentation</a>
*/
java.util.concurrent.Future<UntagResourceResult> untagResourceAsync(UntagResourceRequest untagResourceRequest);
/**
* <p>
* Removes tags from the specified playback configuration resource. You can specify one or more tags to remove.
* </p>
*
* @param untagResourceRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the UntagResource operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.UntagResource
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/UntagResource" target="_top">AWS API
* Documentation</a>
*/
java.util.concurrent.Future<UntagResourceResult> untagResourceAsync(UntagResourceRequest untagResourceRequest,
com.amazonaws.handlers.AsyncHandler<UntagResourceRequest, UntagResourceResult> asyncHandler);
/**
* <p>
* Updates an existing channel.
* </p>
*
* @param updateChannelRequest
* @return A Java Future containing the result of the UpdateChannel operation returned by the service.
* @sample AWSMediaTailorAsync.UpdateChannel
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/UpdateChannel" target="_top">AWS API
* Documentation</a>
*/
java.util.concurrent.Future<UpdateChannelResult> updateChannelAsync(UpdateChannelRequest updateChannelRequest);
/**
* <p>
* Updates an existing channel.
* </p>
*
* @param updateChannelRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the UpdateChannel operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.UpdateChannel
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/UpdateChannel" target="_top">AWS API
* Documentation</a>
*/
java.util.concurrent.Future<UpdateChannelResult> updateChannelAsync(UpdateChannelRequest updateChannelRequest,
com.amazonaws.handlers.AsyncHandler<UpdateChannelRequest, UpdateChannelResult> asyncHandler);
/**
* <p>
* Updates a source location on a specific channel.
* </p>
*
* @param updateSourceLocationRequest
* @return A Java Future containing the result of the UpdateSourceLocation operation returned by the service.
* @sample AWSMediaTailorAsync.UpdateSourceLocation
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/UpdateSourceLocation"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<UpdateSourceLocationResult> updateSourceLocationAsync(UpdateSourceLocationRequest updateSourceLocationRequest);
/**
* <p>
* Updates a source location on a specific channel.
* </p>
*
* @param updateSourceLocationRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the UpdateSourceLocation operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.UpdateSourceLocation
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/UpdateSourceLocation"
* target="_top">AWS API Documentation</a>
*/
java.util.concurrent.Future<UpdateSourceLocationResult> updateSourceLocationAsync(UpdateSourceLocationRequest updateSourceLocationRequest,
com.amazonaws.handlers.AsyncHandler<UpdateSourceLocationRequest, UpdateSourceLocationResult> asyncHandler);
/**
* <p>
* Updates a specific VOD source in a specific source location.
* </p>
*
* @param updateVodSourceRequest
* @return A Java Future containing the result of the UpdateVodSource operation returned by the service.
* @sample AWSMediaTailorAsync.UpdateVodSource
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/UpdateVodSource" target="_top">AWS
* API Documentation</a>
*/
java.util.concurrent.Future<UpdateVodSourceResult> updateVodSourceAsync(UpdateVodSourceRequest updateVodSourceRequest);
/**
* <p>
* Updates a specific VOD source in a specific source location.
* </p>
*
* @param updateVodSourceRequest
* @param asyncHandler
* Asynchronous callback handler for events in the lifecycle of the request. Users can provide an
* implementation of the callback methods in this interface to receive notification of successful or
* unsuccessful completion of the operation.
* @return A Java Future containing the result of the UpdateVodSource operation returned by the service.
* @sample AWSMediaTailorAsyncHandler.UpdateVodSource
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/mediatailor-2018-04-23/UpdateVodSource" target="_top">AWS
* API Documentation</a>
*/
java.util.concurrent.Future<UpdateVodSourceResult> updateVodSourceAsync(UpdateVodSourceRequest updateVodSourceRequest,
com.amazonaws.handlers.AsyncHandler<UpdateVodSourceRequest, UpdateVodSourceResult> asyncHandler);
}
| 21,276 |
552 | /*MIT License
C++ 3D Game Tutorial Series (https://github.com/PardCode/CPP-3D-Game-Tutorial-Series)
Copyright (c) 2019-2020, PardCode
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.*/
#include "DeviceContext.h"
#include "SwapChain.h"
#include "VertexBuffer.h"
#include "IndexBuffer.h"
#include "ConstantBuffer.h"
#include "VertexShader.h"
#include "PixelShader.h"
#include <exception>
DeviceContext::DeviceContext(ID3D11DeviceContext* device_context, RenderSystem * system) : m_system(system) ,m_device_context(device_context)
{
}
void DeviceContext::clearRenderTargetColor(SwapChainPtr swap_chain, float red, float green, float blue, float alpha)
{
FLOAT clear_color[] = {red,green,blue,alpha};
m_device_context->ClearRenderTargetView(swap_chain->m_rtv, clear_color);
m_device_context->OMSetRenderTargets(1, &swap_chain->m_rtv, NULL);
}
void DeviceContext::setVertexBuffer(VertexBufferPtr vertex_buffer)
{
UINT stride = vertex_buffer->m_size_vertex;
UINT offset = 0;
m_device_context->IASetVertexBuffers(0, 1, &vertex_buffer->m_buffer, &stride, &offset);
m_device_context->IASetInputLayout(vertex_buffer->m_layout);
}
void DeviceContext::setIndexBuffer(IndexBufferPtr index_buffer)
{
m_device_context->IASetIndexBuffer(index_buffer->m_buffer, DXGI_FORMAT_R32_UINT, 0);
}
void DeviceContext::drawTriangleList(UINT vertex_count, UINT start_vertex_index)
{
m_device_context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
m_device_context->Draw(vertex_count, start_vertex_index);
}
void DeviceContext::drawIndexedTriangleList(UINT index_count, UINT start_vertex_index, UINT start_index_location)
{
m_device_context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
m_device_context->DrawIndexed(index_count, start_index_location, start_vertex_index);
}
void DeviceContext::drawTriangleStrip(UINT vertex_count, UINT start_vertex_index)
{
m_device_context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
m_device_context->Draw(vertex_count, start_vertex_index);
}
void DeviceContext::setViewportSize(UINT width, UINT height)
{
D3D11_VIEWPORT vp = {};
vp.Width = (FLOAT)width;
vp.Height = (FLOAT)height;
vp.MinDepth = 0.0f;
vp.MaxDepth = 1.0f;
m_device_context->RSSetViewports(1, &vp);
}
void DeviceContext::setVertexShader(VertexShaderPtr vertex_shader)
{
m_device_context->VSSetShader(vertex_shader->m_vs, nullptr, 0);
}
void DeviceContext::setPixelShader(PixelShaderPtr pixel_shader)
{
m_device_context->PSSetShader(pixel_shader->m_ps, nullptr, 0);
}
void DeviceContext::setConstantBuffer(VertexShaderPtr vertex_shader, ConstantBufferPtr buffer)
{
m_device_context->VSSetConstantBuffers(0, 1, &buffer->m_buffer);
}
void DeviceContext::setConstantBuffer(PixelShaderPtr pixel_shader, ConstantBufferPtr buffer)
{
m_device_context->PSSetConstantBuffers(0, 1, &buffer->m_buffer);
}
DeviceContext::~DeviceContext()
{
m_device_context->Release();
}
| 1,332 |
6,836 | <gh_stars>1000+
"""Shared pytest fixtures.
"""
import pytest
import records
@pytest.fixture(params=[
# request: (sql_url_id, sql_url_template)
('sqlite_memory', 'sqlite:///:memory:'),
('sqlite_file', 'sqlite:///{dbfile}'),
# ('psql', 'postgresql://records:records@localhost/records')
],
ids=lambda r: r[0])
def db(request, tmpdir):
"""Instance of `records.Database(dburl)`
Ensure, it gets closed after being used in a test or fixture.
Parametrized with (sql_url_id, sql_url_template) tuple.
If `sql_url_template` contains `{dbfile}` it is replaced with path to a
temporary file.
Feel free to parametrize for other databases and experiment with them.
"""
id, url = request.param
# replace {dbfile} in url with temporary db file path
url = url.format(dbfile=str(tmpdir / "db.sqlite"))
db = records.Database(url)
yield db # providing fixture value for a test case
# tear_down
db.close()
@pytest.fixture
def foo_table(db):
"""Database with table `foo` created
tear_down drops the table.
Typically applied by `@pytest.mark.usefixtures('foo_table')`
"""
db.query('CREATE TABLE foo (a integer)')
yield
db.query('DROP TABLE foo')
| 461 |
6,304 | <filename>src/third_party/skia/infra/bots/recipe_modules/doxygen/api.py
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from recipe_engine import recipe_api
class DoxygenApi(recipe_api.RecipeApi):
def generate_and_upload(self, skia_dir):
with self.m.context(cwd=skia_dir):
self.m.run(
self.m.step,
'generate and upload doxygen',
cmd=['python', self.resource('generate_and_upload_doxygen.py')],
abort_on_failure=False)
| 233 |
724 | <filename>vega/algorithms/nas/modnas/callback/predefined/estim_exporter.py
# -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# MIT License for more details.
"""Estimator results exporter."""
from modnas.registry.callback import register
from ..base import CallbackBase
@register
class EstimResultsExporter(CallbackBase):
"""Estimator results exporter class."""
priority = -1
def __init__(self, run_file_name='results', best_file_name='best',
chkpt_intv=0, desc_intv=0, save_chkpt_best=True, save_desc_best=True):
super().__init__({
'after:EstimBase.step_done': self.on_step_done,
'after:EstimBase.run': self.export_run,
'after:EstimBase.run_epoch': self.export_epoch,
})
self.run_file_name = run_file_name
self.best_file_name = best_file_name
self.chkpt_intv = chkpt_intv
self.desc_intv = desc_intv
self.save_chkpt_best = save_chkpt_best
self.save_desc_best = save_desc_best
def on_step_done(self, ret, estim, params, value, arch_desc=None):
"""Export result on each step."""
if (ret or {}).get('is_opt'):
if self.save_chkpt_best:
estim.save_checkpoint(save_name=self.best_file_name)
if params is not None:
arch_desc = arch_desc or estim.get_arch_desc()
if self.save_desc_best:
estim.save_arch_desc(save_name=self.best_file_name, arch_desc=arch_desc)
def export_run(self, ret, estim, *args, **kwargs):
"""Export results after run."""
best_res = {}
ret = ret or {}
opts = ret.get('opt_results')
if opts:
best_res['best_arch_desc'] = opts[-1][0]
best_score = opts[-1][1]
if isinstance(best_score, dict) and len(best_score) == 1:
best_score = list(best_score.values())[0]
best_res['best_score'] = best_score
if len(opts) == 1:
ret.pop('opt_results')
ret.update(best_res)
estim.save_arch_desc(save_name=self.run_file_name, arch_desc=ret)
return ret
def export_epoch(self, ret, estim, optim, epoch, tot_epochs):
"""Export results in each epoch."""
if epoch >= tot_epochs:
return
if self.desc_intv and epoch % self.desc_intv == 0:
estim.save_arch_desc(epoch)
if self.chkpt_intv and epoch % self.chkpt_intv == 0:
estim.save_checkpoint(epoch)
return ret
| 1,303 |
17,275 | /*
* The MIT License
*
* Copyright (c) 2004-2009, Sun Microsystems, Inc., <NAME>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package hudson.security;
import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import hudson.model.Hudson;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.SortedSet;
import java.util.TreeSet;
import org.jvnet.localizer.Localizable;
/**
* Group of {@link Permission}s that share the same {@link Permission#owner owner}.
*
* Sortable by the owner class name.
*/
public final class PermissionGroup implements Iterable<Permission>, Comparable<PermissionGroup> {
private final SortedSet<Permission> permissions = new TreeSet<>(Permission.ID_COMPARATOR);
@NonNull
public final Class owner;
/**
* Human readable title of this permission group.
* This should be short.
*/
public final Localizable title;
private final String id;
/**
* Both creates a registers a new permission group.
* @param owner sets {@link #owner}
* @param title sets {@link #title}
* @throws IllegalStateException if this group was already registered
*/
public PermissionGroup(@NonNull Class owner, Localizable title) throws IllegalStateException {
this(title.toString(Locale.ENGLISH), owner, title);
}
/**
* Both creates a registers a new permission group.
* @param owner sets {@link #owner}
* @param title sets {@link #title}
* @throws IllegalStateException if this group was already registered
* @since 2.127
*/
public PermissionGroup(String id, @NonNull Class owner, Localizable title) throws IllegalStateException {
this.owner = owner;
this.title = title;
this.id = id;
register(this);
}
/**
* Gets ID of the permission group.
* @return Non-localizable ID of the permission group.
*/
public String getId() {
return id;
}
public String getOwnerClassName() {
return owner.getName();
}
@Override
public Iterator<Permission> iterator() {
return getPermissions().iterator();
}
/*package*/ synchronized void add(Permission p) {
if (!permissions.add(p)) {
throw new IllegalStateException("attempt to register a second Permission for " + p.getId());
}
}
/**
* Lists up all the permissions in this group.
*/
public synchronized List<Permission> getPermissions() {
return new ArrayList<>(permissions);
}
public synchronized boolean hasPermissionContainedBy(PermissionScope scope) {
for (Permission p : permissions)
if (p.isContainedBy(scope))
return true;
return false;
}
/**
* Finds a permission that has the given name.
*/
public synchronized Permission find(String name) {
for (Permission p : permissions) {
if(p.name.equals(name))
return p;
}
return null;
}
@Override
public int compareTo(PermissionGroup that) {
// first, sort by the 'compare order' number. This is so that
// we can put Hudson.PERMISSIONS first.
int r= this.compareOrder()-that.compareOrder();
if(r!=0) return r;
// among the permissions of the same group, just sort by their names
// so that the sort order is consistent regardless of classloading order.
return getOwnerClassName().compareTo(that.getOwnerClassName());
}
private int compareOrder() {
if(owner==Hudson.class) return 0;
return 1;
}
@Override public boolean equals(Object o) {
return o instanceof PermissionGroup && getOwnerClassName().equals(((PermissionGroup) o).getOwnerClassName());
}
@Override public int hashCode() {
return getOwnerClassName().hashCode();
}
public synchronized int size() {
return permissions.size();
}
@Override public String toString() {
return "PermissionGroup[" + getOwnerClassName() + "]";
}
private static synchronized void register(PermissionGroup g) {
if (!PERMISSIONS.add(g)) {
throw new IllegalStateException("attempt to register a second PermissionGroup for " + g.getOwnerClassName());
}
}
/**
* Returns all the {@link PermissionGroup}s available in the system.
* @return
* always non-null. Read-only.
*/
public static synchronized List<PermissionGroup> getAll() {
return new ArrayList<>(PERMISSIONS);
}
/**
* Gets the {@link PermissionGroup} whose {@link PermissionGroup#owner} is the given class.
*
* @return null if not found.
*/
public static synchronized @CheckForNull PermissionGroup get(Class owner) {
for (PermissionGroup g : PERMISSIONS) {
if (g.owner == owner) {
return g;
}
}
return null;
}
/**
* All the permissions in the system, keyed by their owners.
*/
private static final SortedSet<PermissionGroup> PERMISSIONS = new TreeSet<>();
}
| 2,225 |
435 | <filename>pydata-warsaw-2019/videos/michel-voss-detection-of-solar-panels-based-on-aerial-images-of-the-city-of-pydata-warsaw-2019.json
{
"description": "The main goal of the article is to present the results of a study on the\nuse of deep learning networks to detect solar panels based on aerial\nimages of Poznan. In addition, the main motivation is to obtain more\ndetailed information about the use of solar energy in Poland drawing on\nbig data sources, which until now have not been used for this purpose.\n\nThe data was acquired from the Management Board of Geodesy and Municipal\nCadastre GEOPOZ in Pozna\u0144 and included orthophotomaps for 2016 and the\nlayer of buildings and plots of lands. We extracted buildings from the\nimages using R statistical software and the sf package. To detect solar\npanels we used the Turi Create library written in Python which\nre-implements the YOLO (You Only Look Once) library.\n\nThe object recognition algorithm was trained on a sample of images that\nincluded annotations (bounding boxes) about the exact location of solar\npanels. The results indicate a very high recognition efficiency at the\nlevel of 96-99% on the test sample. Based on this procedure we found\nthat around 2% of residential buildings in Pozna\u0144 in 2016 had solar\npanels mounted on roofs.\n\nAs far as we know, this is the first use of deep learning to detect\nsolar panels in Poland. Currently, similar studies are being carried out\nby for instance Statistics Netherlands as part of the DeepSolaris\nproject. The study exemplifies a trend involving the use of aerial and\nsatellite images for statistical purposes thanks to advanced machine\nlearning algorithms and open source software.\n",
"duration": 1062,
"language": "eng",
"published_at": "2020-01-03T08:00:08.000Z",
"recorded": "2019-12-13",
"speakers": [
"<NAME>"
],
"thumbnail_url": "https://i.ytimg.com/vi/RHV3TDgbhbc/hqdefault.jpg",
"title": "Detection of solar panels based on aerial images of the city of Pozna\u0144 using deep neural networks",
"videos": [
{
"type": "youtube",
"url": "https://www.youtube.com/watch?v=RHV3TDgbhbc"
}
]
}
| 638 |
940 | <reponame>w-v/llvm-clang-samples
// Due to the special attributes, this file should be analyzed by Clang in CUDA
// mode. For example, dump the AST with:
//
// $ clang-check inputs/kernel-signatures.c -ast-dump -- -xcuda
//
__attribute__((global)) void ker1(float* farr, double* darr, int n) {
}
__attribute__((device)) void notakernel(int n, float* f1) {
}
typedef int* intptr;
__attribute__((global)) void ker2(unsigned* uarr, intptr iarr) {
}
void foobar() {
}
template <typename T>
void bazinga(T* k) {
}
int booga, chuppa;
struct St {
int b;
void joe(int ii, float ff) {
bazinga(&ii);
bazinga(&ff);
}
};
| 253 |
1,459 | /** @file
*****************************************************************************
* @author This file is part of libsnark, developed by SCIPR Lab
* and contributors (see AUTHORS).
* @copyright MIT license (see LICENSE file)
*****************************************************************************/
#ifndef R1CS_PCD_PARAMS_TCC_
#define R1CS_PCD_PARAMS_TCC_
namespace libsnark {
template<typename FieldT>
r1cs_primary_input<FieldT> r1cs_pcd_compliance_predicate_primary_input<FieldT>::as_r1cs_primary_input() const
{
return outgoing_message->as_r1cs_variable_assignment();
}
template<typename FieldT>
r1cs_auxiliary_input<FieldT> r1cs_pcd_compliance_predicate_auxiliary_input<FieldT>::as_r1cs_auxiliary_input(const std::vector<size_t> &incoming_message_payload_lengths) const
{
const size_t arity = incoming_messages.size();
r1cs_auxiliary_input<FieldT> result;
result.emplace_back(FieldT(arity));
const size_t max_arity = incoming_message_payload_lengths.size();
assert(arity <= max_arity);
for (size_t i = 0; i < arity; ++i)
{
const r1cs_variable_assignment<FieldT> msg_as_r1cs_va = incoming_messages[i]->as_r1cs_variable_assignment();
assert(msg_as_r1cs_va.size() == (1 + incoming_message_payload_lengths[i]));
result.insert(result.end(), msg_as_r1cs_va.begin(), msg_as_r1cs_va.end());
}
/* pad with dummy messages of appropriate size */
for (size_t i = arity; i < max_arity; ++i)
{
result.resize(result.size() + (1 + incoming_message_payload_lengths[i]), FieldT::zero());
}
const r1cs_variable_assignment<FieldT> local_data_as_r1cs_va = local_data->as_r1cs_variable_assignment();
result.insert(result.end(), local_data_as_r1cs_va.begin(), local_data_as_r1cs_va.end());
result.insert(result.end(), witness.begin(), witness.end());
return result;
}
} // libsnark
#endif // R1CS_PCD_PARAMS_TCC_
| 740 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.