identifier
stringlengths 0
89
| parameters
stringlengths 0
399
| return_statement
stringlengths 0
982
⌀ | docstring
stringlengths 10
3.04k
| docstring_summary
stringlengths 0
3.04k
| function
stringlengths 13
25.8k
| function_tokens
sequence | start_point
sequence | end_point
sequence | argument_list
null | language
stringclasses 3
values | docstring_language
stringclasses 4
values | docstring_language_predictions
stringclasses 4
values | is_langid_reliable
stringclasses 2
values | is_langid_extra_reliable
bool 1
class | type
stringclasses 9
values |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ProdutosDAO. | null | Metodo Cadastrar Produtos | Metodo Cadastrar Produtos | public void cadastrar(Produtos obj) {
try {
String sql = "insert into produto (descricao,valor,qtd_estoque,fk_fornecedor) values (?,?,?,?)";
//2 passo - conectar o banco de dados e organizar o comando sql
PreparedStatement stmt = con.prepareStatement(sql);
stmt.setString(1, obj.getDescricao());
stmt.setDouble(2, obj.getValor());
stmt.setInt(3, obj.getQtd_estoque());
stmt.setInt(4, obj.getFornecedor().getId_fornecedor());
stmt.execute();
stmt.close();
JOptionPane.showMessageDialog(null, "Produto Cadastrado com Sucesso!");
} catch (Exception erro) {
JOptionPane.showMessageDialog(null, "Erro : " + erro);
}
} | [
"public",
"void",
"cadastrar",
"(",
"Produtos",
"obj",
")",
"{",
"try",
"{",
"String",
"sql",
"=",
"\"insert into produto (descricao,valor,qtd_estoque,fk_fornecedor) values (?,?,?,?)\"",
";",
"//2 passo - conectar o banco de dados e organizar o comando sql",
"PreparedStatement",
"stmt",
"=",
"con",
".",
"prepareStatement",
"(",
"sql",
")",
";",
"stmt",
".",
"setString",
"(",
"1",
",",
"obj",
".",
"getDescricao",
"(",
")",
")",
";",
"stmt",
".",
"setDouble",
"(",
"2",
",",
"obj",
".",
"getValor",
"(",
")",
")",
";",
"stmt",
".",
"setInt",
"(",
"3",
",",
"obj",
".",
"getQtd_estoque",
"(",
")",
")",
";",
"stmt",
".",
"setInt",
"(",
"4",
",",
"obj",
".",
"getFornecedor",
"(",
")",
".",
"getId_fornecedor",
"(",
")",
")",
";",
"stmt",
".",
"execute",
"(",
")",
";",
"stmt",
".",
"close",
"(",
")",
";",
"JOptionPane",
".",
"showMessageDialog",
"(",
"null",
",",
"\"Produto Cadastrado com Sucesso!\"",
")",
";",
"}",
"catch",
"(",
"Exception",
"erro",
")",
"{",
"JOptionPane",
".",
"showMessageDialog",
"(",
"null",
",",
"\"Erro : \"",
"+",
"erro",
")",
";",
"}",
"}"
] | [
28,
4
] | [
51,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
PedidoController. | null | Deleta um pedido | Deleta um pedido | @RequestMapping(value="/pedido", method=RequestMethod.DELETE)
@ApiOperation(value="Deleta um pedido")
public void deletaUsuario(@RequestBody Pedido pedido) {
pedidoService.deletaPedido(pedido);
} | [
"@",
"RequestMapping",
"(",
"value",
"=",
"\"/pedido\"",
",",
"method",
"=",
"RequestMethod",
".",
"DELETE",
")",
"@",
"ApiOperation",
"(",
"value",
"=",
"\"Deleta um pedido\"",
")",
"public",
"void",
"deletaUsuario",
"(",
"@",
"RequestBody",
"Pedido",
"pedido",
")",
"{",
"pedidoService",
".",
"deletaPedido",
"(",
"pedido",
")",
";",
"}"
] | [
43,
1
] | [
47,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
aula05ex. | null | Usei um array the Int[] para todos estes para facilitar os testes e poder chamar umas funçoes dentro de outras | Usei um array the Int[] para todos estes para facilitar os testes e poder chamar umas funçoes dentro de outras | public static int[] copy(int[] vector, int dimensao){
// criar nova array para guardar a copia alterada
int[] newArray = new int[dimensao];
// Calcular a dimensao minima das 2 arrays para evitar erros
// "Index out of bounds" e só copiar até ao sitio certo
int minLength = Math.min(dimensao, vector.length);
// iterar na antiga array e copiar elemento a elemento para a nova
for (int i=0; i<minLength; i++){
newArray[i] = vector[i];
}
return newArray;
} | [
"public",
"static",
"int",
"[",
"]",
"copy",
"(",
"int",
"[",
"]",
"vector",
",",
"int",
"dimensao",
")",
"{",
"// criar nova array para guardar a copia alterada",
"int",
"[",
"]",
"newArray",
"=",
"new",
"int",
"[",
"dimensao",
"]",
";",
"// Calcular a dimensao minima das 2 arrays para evitar erros",
"// \"Index out of bounds\" e só copiar até ao sitio certo",
"int",
"minLength",
"=",
"Math",
".",
"min",
"(",
"dimensao",
",",
"vector",
".",
"length",
")",
";",
"// iterar na antiga array e copiar elemento a elemento para a nova",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"minLength",
";",
"i",
"++",
")",
"{",
"newArray",
"[",
"i",
"]",
"=",
"vector",
"[",
"i",
"]",
";",
"}",
"return",
"newArray",
";",
"}"
] | [
105,
4
] | [
116,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Bank. | null | Recebe nome do arquivo e escreve atributos das contas | Recebe nome do arquivo e escreve atributos das contas | public void dump(String filename) {
try {
FileWriter arq = new FileWriter(filename);
PrintWriter out = new PrintWriter(arq);
/*
Conta número: <numero da conta>
Senha: <senha da conta>
Proprietário: <nome do proprietário>
Saldo: <saldo da conta>
*/
for(BankAccount conta : this.accounts){
out.printf("Conta número: " + conta.getAccountNumber() + "\n"+
"Senha: " + conta.getPassword()+ "\n"+
"Proprietário: "+ conta.getOwner()+"\n"+
"Saldo: " + conta.getBalance() +"\n");
out.println();
out.flush();
}
out.close();
} catch (IOException ex) {
Logger.getLogger(Bank.class.getName()).log(Level.SEVERE, null, ex);
}
} | [
"public",
"void",
"dump",
"(",
"String",
"filename",
")",
"{",
"try",
"{",
"FileWriter",
"arq",
"=",
"new",
"FileWriter",
"(",
"filename",
")",
";",
"PrintWriter",
"out",
"=",
"new",
"PrintWriter",
"(",
"arq",
")",
";",
"/*\n Conta número: <numero da conta>\n Senha: <senha da conta>\n Proprietário: <nome do proprietário>\n Saldo: <saldo da conta>\n */",
"for",
"(",
"BankAccount",
"conta",
":",
"this",
".",
"accounts",
")",
"{",
"out",
".",
"printf",
"(",
"\"Conta número: \" ",
" ",
"onta.",
"g",
"etAccountNumber(",
")",
" ",
" ",
"\\n\"+",
"",
"\"Senha: \"",
"+",
"conta",
".",
"getPassword",
"(",
")",
"+",
"\"\\n\"",
"+",
"\"Proprietário: \"+",
" ",
"onta.",
"g",
"etOwner(",
")",
"+",
"\"",
"\\n\"+",
"",
"\"Saldo: \"",
"+",
"conta",
".",
"getBalance",
"(",
")",
"+",
"\"\\n\"",
")",
";",
"out",
".",
"println",
"(",
")",
";",
"out",
".",
"flush",
"(",
")",
";",
"}",
"out",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"Logger",
".",
"getLogger",
"(",
"Bank",
".",
"class",
".",
"getName",
"(",
")",
")",
".",
"log",
"(",
"Level",
".",
"SEVERE",
",",
"null",
",",
"ex",
")",
";",
"}",
"}"
] | [
157,
4
] | [
179,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Rectangulo. | null | Funções adicionais | Funções adicionais | public int calculateArea(){
return getComprimento() * getLargura();
} | [
"public",
"int",
"calculateArea",
"(",
")",
"{",
"return",
"getComprimento",
"(",
")",
"*",
"getLargura",
"(",
")",
";",
"}"
] | [
40,
4
] | [
42,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | False | true | method_declaration |
|
Aulaprojeto06Application. | null | trabalhando com laços de repetição | trabalhando com laços de repetição | public static void main(String[] args) {
SpringApplication.run(Aulaprojeto06Application.class, args);
Scanner ler = new Scanner(System.in);
int numeroDePessoas;
System.out.println("-- Cadastro de Pessoas --");
System.out.println("Quantas pessoas deseja cadastrar ?");
numeroDePessoas=ler.nextInt();
if (numeroDePessoas>0){
System.out.println("vamos iniciar o cadastro!");
Pessoas[] arrayPessoas = new Pessoas[numeroDePessoas];
int ii=1;
for (int i=0;i<numeroDePessoas;i++){
int idade;String nome;float peso;
System.out.println("Pessoa "+ii+" :");
System.out.println("Nome: ");
nome=ler.next();
System.out.println("Idade: ");
idade=ler.nextInt();
System.out.println("Peso: ");
peso=ler.nextFloat();
arrayPessoas[i] = new Pessoas(idade,nome,peso);
ii++;
}
String yesOrNo;
System.out.println("Exibir pessoas cadastradas? s/n");
yesOrNo = ler.next();
if (yesOrNo.equals("s")){
for (Pessoas exibir:arrayPessoas) {
System.out.println("Nome: "+exibir.getNome());
System.out.println("Idade: "+exibir.getIdade());
System.out.println("Peso: "+exibir.getPeso());
System.out.println("-------------------------");
}
System.exit(0);
}else{
System.exit(0);
}
}/*else {
System.exit(0);
}/*/
//-----------------------------------------------------------------------------
//Testando metodo testeWhileJoaozinho()
TesteWhile testando = new TesteWhile();
testando.testeWhileJoaozinho();
//Testando metodo testeDoWhileMariazinha()
TesteWhile testando2 = new TesteWhile();
testando2.testeDoWhileMariazinha();
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"SpringApplication",
".",
"run",
"(",
"Aulaprojeto06Application",
".",
"class",
",",
"args",
")",
";",
"Scanner",
"ler",
"=",
"new",
"Scanner",
"(",
"System",
".",
"in",
")",
";",
"int",
"numeroDePessoas",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"-- Cadastro de Pessoas --\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Quantas pessoas deseja cadastrar ?\"",
")",
";",
"numeroDePessoas",
"=",
"ler",
".",
"nextInt",
"(",
")",
";",
"if",
"(",
"numeroDePessoas",
">",
"0",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"vamos iniciar o cadastro!\"",
")",
";",
"Pessoas",
"[",
"]",
"arrayPessoas",
"=",
"new",
"Pessoas",
"[",
"numeroDePessoas",
"]",
";",
"int",
"ii",
"=",
"1",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numeroDePessoas",
";",
"i",
"++",
")",
"{",
"int",
"idade",
";",
"String",
"nome",
";",
"float",
"peso",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Pessoa \"",
"+",
"ii",
"+",
"\" :\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Nome: \"",
")",
";",
"nome",
"=",
"ler",
".",
"next",
"(",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Idade: \"",
")",
";",
"idade",
"=",
"ler",
".",
"nextInt",
"(",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Peso: \"",
")",
";",
"peso",
"=",
"ler",
".",
"nextFloat",
"(",
")",
";",
"arrayPessoas",
"[",
"i",
"]",
"=",
"new",
"Pessoas",
"(",
"idade",
",",
"nome",
",",
"peso",
")",
";",
"ii",
"++",
";",
"}",
"String",
"yesOrNo",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Exibir pessoas cadastradas? s/n\"",
")",
";",
"yesOrNo",
"=",
"ler",
".",
"next",
"(",
")",
";",
"if",
"(",
"yesOrNo",
".",
"equals",
"(",
"\"s\"",
")",
")",
"{",
"for",
"(",
"Pessoas",
"exibir",
":",
"arrayPessoas",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Nome: \"",
"+",
"exibir",
".",
"getNome",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Idade: \"",
"+",
"exibir",
".",
"getIdade",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Peso: \"",
"+",
"exibir",
".",
"getPeso",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"-------------------------\"",
")",
";",
"}",
"System",
".",
"exit",
"(",
"0",
")",
";",
"}",
"else",
"{",
"System",
".",
"exit",
"(",
"0",
")",
";",
"}",
"}",
"/*else {\n\t\t\tSystem.exit(0);\n\t\t}/*/",
"//-----------------------------------------------------------------------------",
"//Testando metodo testeWhileJoaozinho()",
"TesteWhile",
"testando",
"=",
"new",
"TesteWhile",
"(",
")",
";",
"testando",
".",
"testeWhileJoaozinho",
"(",
")",
";",
"//Testando metodo testeDoWhileMariazinha()",
"TesteWhile",
"testando2",
"=",
"new",
"TesteWhile",
"(",
")",
";",
"testando2",
".",
"testeDoWhileMariazinha",
"(",
")",
";",
"}"
] | [
10,
1
] | [
61,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
AmqpSankhyaApi. | null | irá enviar um objeto do tipo Message | irá enviar um objeto do tipo Message | @ResponseStatus(HttpStatus.ACCEPTED)
@PostMapping("/envio")
public void sendToConsumer(@RequestBody Message message) {
service.sendToConsumer(message);
} | [
"@",
"ResponseStatus",
"(",
"HttpStatus",
".",
"ACCEPTED",
")",
"@",
"PostMapping",
"(",
"\"/envio\"",
")",
"public",
"void",
"sendToConsumer",
"(",
"@",
"RequestBody",
"Message",
"message",
")",
"{",
"service",
".",
"sendToConsumer",
"(",
"message",
")",
";",
"}"
] | [
28,
1
] | [
33,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
SecurityConfigurations. | null | Configurações de recursos estáticos (js, css, images, etc.) | Configurações de recursos estáticos (js, css, images, etc.) | @Override
public void configure(WebSecurity web) throws Exception {
} | [
"@",
"Override",
"public",
"void",
"configure",
"(",
"WebSecurity",
"web",
")",
"throws",
"Exception",
"{",
"}"
] | [
75,
1
] | [
77,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
ComparatorOfHighScores. | null | decrescente do numero de movimentos. | decrescente do numero de movimentos. | public int compare(HighScore s1, HighScore s2) {
// Compara quando os 2 acabam o jogo com sucesso
if (s1.getWon() && s2.getWon()) {
if (s1.getMovements() == s2.getMovements())
return 0;
// O que fizer menos movimentos primeiro
else if (s1.getMovements() > s2.getMovements())
return 1;
else
return -1;
// Se um tiver ganho e o outro nao, passar para baixo ou para cima conforme a situaçao
} else if (s1.getWon() && !s2.getWon()) {
return -1;
} else if (!s1.getWon() && s2.getWon()) {
return 1;
} else {
// Quando os 2 perdem o jogo
if (s1.getMovements() == s2.getMovements())
return 0;
// Ordena no sentido contrario, quantos menos movimentos, mais para baixo vai
else if (s1.getMovements() > s2.getMovements())
return -1;
else
return 1;
}
} | [
"public",
"int",
"compare",
"(",
"HighScore",
"s1",
",",
"HighScore",
"s2",
")",
"{",
"// Compara quando os 2 acabam o jogo com sucesso",
"if",
"(",
"s1",
".",
"getWon",
"(",
")",
"&&",
"s2",
".",
"getWon",
"(",
")",
")",
"{",
"if",
"(",
"s1",
".",
"getMovements",
"(",
")",
"==",
"s2",
".",
"getMovements",
"(",
")",
")",
"return",
"0",
";",
"// O que fizer menos movimentos primeiro",
"else",
"if",
"(",
"s1",
".",
"getMovements",
"(",
")",
">",
"s2",
".",
"getMovements",
"(",
")",
")",
"return",
"1",
";",
"else",
"return",
"-",
"1",
";",
"// Se um tiver ganho e o outro nao, passar para baixo ou para cima conforme a situaçao",
"}",
"else",
"if",
"(",
"s1",
".",
"getWon",
"(",
")",
"&&",
"!",
"s2",
".",
"getWon",
"(",
")",
")",
"{",
"return",
"-",
"1",
";",
"}",
"else",
"if",
"(",
"!",
"s1",
".",
"getWon",
"(",
")",
"&&",
"s2",
".",
"getWon",
"(",
")",
")",
"{",
"return",
"1",
";",
"}",
"else",
"{",
"// Quando os 2 perdem o jogo",
"if",
"(",
"s1",
".",
"getMovements",
"(",
")",
"==",
"s2",
".",
"getMovements",
"(",
")",
")",
"return",
"0",
";",
"// Ordena no sentido contrario, quantos menos movimentos, mais para baixo vai",
"else",
"if",
"(",
"s1",
".",
"getMovements",
"(",
")",
">",
"s2",
".",
"getMovements",
"(",
")",
")",
"return",
"-",
"1",
";",
"else",
"return",
"1",
";",
"}",
"}"
] | [
13,
4
] | [
39,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
aula04ex. | null | Exercicios de trabalho autonomo da aula04 | Exercicios de trabalho autonomo da aula04 | public static void main(String[] args) {
//ex1 - testes
System.out.println("Exercicio 1 - Soma While");
somaWhile();
//ex2 - testes
System.out.println("Exercicio 2 - Soma For");
somaFor();
//ex3 - testes
System.out.println("Exercicio 3 - Numero de Divisores");
System.out.println(divisores(10));
//ex4 - testes
System.out.println("Exercicio 4 - Soma de Divisores");
System.out.println(somatorioDivisores(10));
//ex5 - testes
System.out.println("Exercicio 5 - E Primo");
System.out.println(ePrimo(192));
//ex6 - testes
System.out.println("Exercicio 6 - E Primo Intervalo");
System.out.println(ePrimoIntervalo(2504,2520));
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"//ex1 - testes",
"System",
".",
"out",
".",
"println",
"(",
"\"Exercicio 1 - Soma While\"",
")",
";",
"somaWhile",
"(",
")",
";",
"//ex2 - testes",
"System",
".",
"out",
".",
"println",
"(",
"\"Exercicio 2 - Soma For\"",
")",
";",
"somaFor",
"(",
")",
";",
"//ex3 - testes",
"System",
".",
"out",
".",
"println",
"(",
"\"Exercicio 3 - Numero de Divisores\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"divisores",
"(",
"10",
")",
")",
";",
"//ex4 - testes",
"System",
".",
"out",
".",
"println",
"(",
"\"Exercicio 4 - Soma de Divisores\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"somatorioDivisores",
"(",
"10",
")",
")",
";",
"//ex5 - testes",
"System",
".",
"out",
".",
"println",
"(",
"\"Exercicio 5 - E Primo\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"ePrimo",
"(",
"192",
")",
")",
";",
"//ex6 - testes",
"System",
".",
"out",
".",
"println",
"(",
"\"Exercicio 6 - E Primo Intervalo\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"ePrimoIntervalo",
"(",
"2504",
",",
"2520",
")",
")",
";",
"}"
] | [
4,
4
] | [
23,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
GameBuilder. | null | * metodo usado para verificar a leitura do csv** | * metodo usado para verificar a leitura do csv** | private void printMapStdout() {
System.out.print(mapHeight);
System.out.print(" ");
System.out.println(mapWidth);
System.out.print(IEntrance);
System.out.print(" ");
System.out.println(JEntrance);
for(int i=0; i < this.mapHeight; i++) {
for(int j=0; j < this.mapWidth; j++) {
System.out.print(mapText[i][j] + " ");
}
System.out.println();
}
} | [
"private",
"void",
"printMapStdout",
"(",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"mapHeight",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"\" \"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"mapWidth",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"IEntrance",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"\" \"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"JEntrance",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"mapHeight",
";",
"i",
"++",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"this",
".",
"mapWidth",
";",
"j",
"++",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"mapText",
"[",
"i",
"]",
"[",
"j",
"]",
"+",
"\" \"",
")",
";",
"}",
"System",
".",
"out",
".",
"println",
"(",
")",
";",
"}",
"}"
] | [
146,
1
] | [
159,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
RecipeController. | null | Retorna receita por id | Retorna receita por id | @GetMapping("/recipes/{id}")
public Optional<Recipe> getRecipeById(@PathVariable(value = "id") long id){
return recipeRepository.findById(id);
} | [
"@",
"GetMapping",
"(",
"\"/recipes/{id}\"",
")",
"public",
"Optional",
"<",
"Recipe",
">",
"getRecipeById",
"(",
"@",
"PathVariable",
"(",
"value",
"=",
"\"id\"",
")",
"long",
"id",
")",
"{",
"return",
"recipeRepository",
".",
"findById",
"(",
"id",
")",
";",
"}"
] | [
53,
2
] | [
56,
3
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
CreditCard. | null | ao montante em dívida | ao montante em dívida | public void pagarCredito(int pagamento){
// Subtraio aos gastos (valor em divida) o pagamento de crédito
gastos -= pagamento;
} | [
"public",
"void",
"pagarCredito",
"(",
"int",
"pagamento",
")",
"{",
"// Subtraio aos gastos (valor em divida) o pagamento de crédito",
"gastos",
"-=",
"pagamento",
";",
"}"
] | [
58,
4
] | [
61,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
aula02ex. | null | 2. Quadrado de um numero a | 2. Quadrado de um numero a | static int quadrado(int a) {
return a * a;
} | [
"static",
"int",
"quadrado",
"(",
"int",
"a",
")",
"{",
"return",
"a",
"*",
"a",
";",
"}"
] | [
50,
4
] | [
52,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
FXMLEntregaController. | null | Carrega o combobox com os status de uma entrega para inserção | Carrega o combobox com os status de uma entrega para inserção | public void carregarComboBoxStatus() {
observableListStatus = FXCollections.observableArrayList(Arrays.asList(StatusEntrega.entregue, StatusEntrega.naoEntregue));
comboBoxStatus.setItems(observableListStatus);
} | [
"public",
"void",
"carregarComboBoxStatus",
"(",
")",
"{",
"observableListStatus",
"=",
"FXCollections",
".",
"observableArrayList",
"(",
"Arrays",
".",
"asList",
"(",
"StatusEntrega",
".",
"entregue",
",",
"StatusEntrega",
".",
"naoEntregue",
")",
")",
";",
"comboBoxStatus",
".",
"setItems",
"(",
"observableListStatus",
")",
";",
"}"
] | [
142,
1
] | [
145,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Horario. | null | fazendo o tratamento pra nao dar numero negativo. | fazendo o tratamento pra nao dar numero negativo. | public void setHoras(int horas) {
if (horas < 0) {
this.horas = 0;
}
else if (horas > 23) {
this.horas = 23;
} else {
this.horas = horas;
}
} | [
"public",
"void",
"setHoras",
"(",
"int",
"horas",
")",
"{",
"if",
"(",
"horas",
"<",
"0",
")",
"{",
"this",
".",
"horas",
"=",
"0",
";",
"}",
"else",
"if",
"(",
"horas",
">",
"23",
")",
"{",
"this",
".",
"horas",
"=",
"23",
";",
"}",
"else",
"{",
"this",
".",
"horas",
"=",
"horas",
";",
"}",
"}"
] | [
59,
4
] | [
68,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
LBSTree. | null | Quantidade de itens na arvore | Quantidade de itens na arvore | public int tamanho() {
return(counter);
} | [
"public",
"int",
"tamanho",
"(",
")",
"{",
"return",
"(",
"counter",
")",
";",
"}"
] | [
50,
1
] | [
52,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
QuickSort. | null | ===== Métodos de Ordenação por Bioma ===== // | ===== Métodos de Ordenação por Bioma ===== // | public void quickBiomaCres() {
quickBiomaCres(0, lista.size() - 1);
} | [
"public",
"void",
"quickBiomaCres",
"(",
")",
"{",
"quickBiomaCres",
"(",
"0",
",",
"lista",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"}"
] | [
475,
4
] | [
477,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Conta. | null | ele precisa ser static igual no atributo da classe | ele precisa ser static igual no atributo da classe | public static int getTotal() {
return Conta.total;
} | [
"public",
"static",
"int",
"getTotal",
"(",
")",
"{",
"return",
"Conta",
".",
"total",
";",
"}"
] | [
83,
4
] | [
85,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Posicao. | null | método privado e interno para cálculo/definição da cor da posição a partir de suas coordenadas: | método privado e interno para cálculo/definição da cor da posição a partir de suas coordenadas: | private void setCor(int linha, char coluna) {
int variacaoColuna = (((int)(coluna)) - ((int)('h'))); //calculando a distância entre a coluna da posição e a última coluna do tabuleiro
if (linha % 2 == 0) { //linhas pares
if (variacaoColuna % 2 == 0) { //posição de cor branca
this.cor = "branco";
} else { //posição de cor preta
this.cor = "preto";
}
} else { //linhas ímpares
if (variacaoColuna % 2 == 0) { //posição de cor preta
this.cor = "preto";
} else { //posição preta
this.cor = "branco";
}
}
} | [
"private",
"void",
"setCor",
"(",
"int",
"linha",
",",
"char",
"coluna",
")",
"{",
"int",
"variacaoColuna",
"=",
"(",
"(",
"(",
"int",
")",
"(",
"coluna",
")",
")",
"-",
"(",
"(",
"int",
")",
"(",
"'",
"'",
")",
")",
")",
";",
"//calculando a distância entre a coluna da posição e a última coluna do tabuleiro",
"if",
"(",
"linha",
"%",
"2",
"==",
"0",
")",
"{",
"//linhas pares",
"if",
"(",
"variacaoColuna",
"%",
"2",
"==",
"0",
")",
"{",
"//posição de cor branca",
"this",
".",
"cor",
"=",
"\"branco\"",
";",
"}",
"else",
"{",
"//posição de cor preta",
"this",
".",
"cor",
"=",
"\"preto\"",
";",
"}",
"}",
"else",
"{",
"//linhas ímpares",
"if",
"(",
"variacaoColuna",
"%",
"2",
"==",
"0",
")",
"{",
"//posição de cor preta",
"this",
".",
"cor",
"=",
"\"preto\"",
";",
"}",
"else",
"{",
"//posição preta",
"this",
".",
"cor",
"=",
"\"branco\"",
";",
"}",
"}",
"}"
] | [
26,
4
] | [
41,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
HivMetadata. | null | Concept 6246 Data de requisicao de testes de laboratório concept id | Concept 6246 Data de requisicao de testes de laboratório concept id | public Concept getDateApplicationLaboratoryConceptId() {
final String uuid =
Context.getAdministrationService()
.getGlobalProperty("eptsreports.dateApplicationTestLaboratory");
return Metadata.getConcept(uuid);
} | [
"public",
"Concept",
"getDateApplicationLaboratoryConceptId",
"(",
")",
"{",
"final",
"String",
"uuid",
"=",
"Context",
".",
"getAdministrationService",
"(",
")",
".",
"getGlobalProperty",
"(",
"\"eptsreports.dateApplicationTestLaboratory\"",
")",
";",
"return",
"Metadata",
".",
"getConcept",
"(",
"uuid",
")",
";",
"}"
] | [
745,
2
] | [
750,
3
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
QuickSort. | null | ===== Métodos de Ordenação por Longitude ===== // | ===== Métodos de Ordenação por Longitude ===== // | public void quickLongitudeCres() {
quickLongitudeCres(0, lista.size() - 1);
} | [
"public",
"void",
"quickLongitudeCres",
"(",
")",
"{",
"quickLongitudeCres",
"(",
"0",
",",
"lista",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"}"
] | [
915,
4
] | [
917,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Jogo. | null | ======= Método equals para comparação de propriedades ======= | ======= Método equals para comparação de propriedades ======= | @Override
public boolean equals(Object object) {
if (object == this)
return true;
if (!(object instanceof Jogo))
return false;
Jogo jogo = (Jogo) object;
return this.getIdJogo() == jogo.getIdJogo();
} | [
"@",
"Override",
"public",
"boolean",
"equals",
"(",
"Object",
"object",
")",
"{",
"if",
"(",
"object",
"==",
"this",
")",
"return",
"true",
";",
"if",
"(",
"!",
"(",
"object",
"instanceof",
"Jogo",
")",
")",
"return",
"false",
";",
"Jogo",
"jogo",
"=",
"(",
"Jogo",
")",
"object",
";",
"return",
"this",
".",
"getIdJogo",
"(",
")",
"==",
"jogo",
".",
"getIdJogo",
"(",
")",
";",
"}"
] | [
79,
4
] | [
89,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
DevSecurityConfiguration. | null | Configurações de autorização. | Configurações de autorização. | @Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/**").permitAll()
.and().csrf().disable();
} | [
"@",
"Override",
"protected",
"void",
"configure",
"(",
"HttpSecurity",
"http",
")",
"throws",
"Exception",
"{",
"http",
".",
"authorizeRequests",
"(",
")",
".",
"antMatchers",
"(",
"\"/**\"",
")",
".",
"permitAll",
"(",
")",
".",
"and",
"(",
")",
".",
"csrf",
"(",
")",
".",
"disable",
"(",
")",
";",
"}"
] | [
15,
4
] | [
20,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
FornecedoresDAO. | null | Metodo cadastrarFornecedores | Metodo cadastrarFornecedores | public void cadastrarFornecedores(Fornecedores obj) {
try {
//1 passo - criar o comando sql
String sql = "call novo_fornecedor(?,?,?,?,?,?,?,?,?,?,?,?,?)";
//2 passo - conectar o banco de dados e organizar o comando sql
PreparedStatement stmt = con.prepareStatement(sql);
stmt.setString(1, obj.getNome());
stmt.setString(2, obj.getCnpj());
stmt.setString(3, obj.getVendedor());
stmt.setString(4, obj.getEmail());
stmt.setString(5, obj.getTelefone());
stmt.setString(6, obj.getCelular());
stmt.setString(7, obj.getCep());
stmt.setString(8, obj.getLogradouro());
stmt.setInt(9, obj.getNumero());
stmt.setString(10, obj.getComplemento());
stmt.setString(11, obj.getBairro());
stmt.setString(12, obj.getCidade());
stmt.setString(13, obj.getUf());
//3 passo - executar o comando sql
stmt.execute();
stmt.close();
JOptionPane.showMessageDialog(null, "Cadastrado com Sucesso!");
} catch (SQLException erro) {
JOptionPane.showMessageDialog(null, "Erro: " + erro);
}
} | [
"public",
"void",
"cadastrarFornecedores",
"(",
"Fornecedores",
"obj",
")",
"{",
"try",
"{",
"//1 passo - criar o comando sql",
"String",
"sql",
"=",
"\"call novo_fornecedor(?,?,?,?,?,?,?,?,?,?,?,?,?)\"",
";",
"//2 passo - conectar o banco de dados e organizar o comando sql",
"PreparedStatement",
"stmt",
"=",
"con",
".",
"prepareStatement",
"(",
"sql",
")",
";",
"stmt",
".",
"setString",
"(",
"1",
",",
"obj",
".",
"getNome",
"(",
")",
")",
";",
"stmt",
".",
"setString",
"(",
"2",
",",
"obj",
".",
"getCnpj",
"(",
")",
")",
";",
"stmt",
".",
"setString",
"(",
"3",
",",
"obj",
".",
"getVendedor",
"(",
")",
")",
";",
"stmt",
".",
"setString",
"(",
"4",
",",
"obj",
".",
"getEmail",
"(",
")",
")",
";",
"stmt",
".",
"setString",
"(",
"5",
",",
"obj",
".",
"getTelefone",
"(",
")",
")",
";",
"stmt",
".",
"setString",
"(",
"6",
",",
"obj",
".",
"getCelular",
"(",
")",
")",
";",
"stmt",
".",
"setString",
"(",
"7",
",",
"obj",
".",
"getCep",
"(",
")",
")",
";",
"stmt",
".",
"setString",
"(",
"8",
",",
"obj",
".",
"getLogradouro",
"(",
")",
")",
";",
"stmt",
".",
"setInt",
"(",
"9",
",",
"obj",
".",
"getNumero",
"(",
")",
")",
";",
"stmt",
".",
"setString",
"(",
"10",
",",
"obj",
".",
"getComplemento",
"(",
")",
")",
";",
"stmt",
".",
"setString",
"(",
"11",
",",
"obj",
".",
"getBairro",
"(",
")",
")",
";",
"stmt",
".",
"setString",
"(",
"12",
",",
"obj",
".",
"getCidade",
"(",
")",
")",
";",
"stmt",
".",
"setString",
"(",
"13",
",",
"obj",
".",
"getUf",
"(",
")",
")",
";",
"//3 passo - executar o comando sql",
"stmt",
".",
"execute",
"(",
")",
";",
"stmt",
".",
"close",
"(",
")",
";",
"JOptionPane",
".",
"showMessageDialog",
"(",
"null",
",",
"\"Cadastrado com Sucesso!\"",
")",
";",
"}",
"catch",
"(",
"SQLException",
"erro",
")",
"{",
"JOptionPane",
".",
"showMessageDialog",
"(",
"null",
",",
"\"Erro: \"",
"+",
"erro",
")",
";",
"}",
"}"
] | [
27,
4
] | [
60,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | False | true | method_declaration |
|
DatabaseManager. | null | método executado quando se deseja recriar o banco de dados. | método executado quando se deseja recriar o banco de dados. | @Override
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) {
sqLiteDatabase.execSQL("DROP TABLE IF EXISTS CLIENTE");
} | [
"@",
"Override",
"public",
"void",
"onUpgrade",
"(",
"SQLiteDatabase",
"sqLiteDatabase",
",",
"int",
"i",
",",
"int",
"i1",
")",
"{",
"sqLiteDatabase",
".",
"execSQL",
"(",
"\"DROP TABLE IF EXISTS CLIENTE\"",
")",
";",
"}"
] | [
32,
4
] | [
35,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
DBSBean. | null | o que faz que por algum motivo o JSF envie algum resposta no momento que não deveria, principalmente com @ResquestScoped | o que faz que por algum motivo o JSF envie algum resposta no momento que não deveria, principalmente com | @PostConstruct
void pvInitializeClass() {
if (FacesContext.getCurrentInstance() == null){
Boolean xIgnorer = false;
//Desconsidera não haver FacesContext ativo quando class for DBSEager.
Annotation[] xAs = this.getClass().getAnnotations();
if(xAs.length != 0) {
for(Annotation xA : xAs) {
if (xA.annotationType().equals(DBSEager.class)){
xIgnorer = true;
break;
}
}
}
if (!xIgnorer){
wLogger.warn(this.getClass().getCanonicalName() + " chamado sem haver FacesContext.");
}
}else{
FacesContext xFC = FacesContext.getCurrentInstance();
if(xFC.getExternalContext().getSession(false) == null){
xFC.getExternalContext().getSession(true);
}
pvGetUserLocate();
}
//Se tiver anotação 'ConversationScoped', inicia a conversação
conversationBegin();
initializeClass();
} | [
"@",
"PostConstruct",
"void",
"pvInitializeClass",
"(",
")",
"{",
"if",
"(",
"FacesContext",
".",
"getCurrentInstance",
"(",
")",
"==",
"null",
")",
"{",
"Boolean",
"xIgnorer",
"=",
"false",
";",
"//Desconsidera não haver FacesContext ativo quando class for DBSEager.\r",
"Annotation",
"[",
"]",
"xAs",
"=",
"this",
".",
"getClass",
"(",
")",
".",
"getAnnotations",
"(",
")",
";",
"if",
"(",
"xAs",
".",
"length",
"!=",
"0",
")",
"{",
"for",
"(",
"Annotation",
"xA",
":",
"xAs",
")",
"{",
"if",
"(",
"xA",
".",
"annotationType",
"(",
")",
".",
"equals",
"(",
"DBSEager",
".",
"class",
")",
")",
"{",
"xIgnorer",
"=",
"true",
";",
"break",
";",
"}",
"}",
"}",
"if",
"(",
"!",
"xIgnorer",
")",
"{",
"wLogger",
".",
"warn",
"(",
"this",
".",
"getClass",
"(",
")",
".",
"getCanonicalName",
"(",
")",
"+",
"\" chamado sem haver FacesContext.\"",
")",
";",
"}",
"}",
"else",
"{",
"FacesContext",
"xFC",
"=",
"FacesContext",
".",
"getCurrentInstance",
"(",
")",
";",
"if",
"(",
"xFC",
".",
"getExternalContext",
"(",
")",
".",
"getSession",
"(",
"false",
")",
"==",
"null",
")",
"{",
"xFC",
".",
"getExternalContext",
"(",
")",
".",
"getSession",
"(",
"true",
")",
";",
"}",
"pvGetUserLocate",
"(",
")",
";",
"}",
"//Se tiver anotação 'ConversationScoped', inicia a conversação\r",
"conversationBegin",
"(",
")",
";",
"initializeClass",
"(",
")",
";",
"}"
] | [
42,
1
] | [
69,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
AcaoBotao. | null | Quando eu implemento a interface ActionListener, sou obrigado a implementar o método actionPerformed(). | Quando eu implemento a interface ActionListener, sou obrigado a implementar o método actionPerformed(). | @Override
public void actionPerformed(ActionEvent e) {
// **e** - Event Object
// O próprio swing vai invocar esse método.
// Com o ActionEvent temos acesso ao componente que disparou o evento.
// 0000000000 Antes de tudo, temos que REGISTRAR O LISTENER no botão que criamos para avisar ao java quem está ouvidno o evento do botão.
// Depois de ter uma referência na classe do TextField da caixa de texto criada.
String nome = t.getText();
JOptionPane.showMessageDialog(null, "Olá, " + nome + "! Bom te ver por aqui.", "Boas Vindas", 1);
} | [
"@",
"Override",
"public",
"void",
"actionPerformed",
"(",
"ActionEvent",
"e",
")",
"{",
"// **e** - Event Object",
"// O próprio swing vai invocar esse método.",
"// Com o ActionEvent temos acesso ao componente que disparou o evento.",
"// 0000000000 Antes de tudo, temos que REGISTRAR O LISTENER no botão que criamos para avisar ao java quem está ouvidno o evento do botão.",
"// Depois de ter uma referência na classe do TextField da caixa de texto criada.",
"String",
"nome",
"=",
"t",
".",
"getText",
"(",
")",
";",
"JOptionPane",
".",
"showMessageDialog",
"(",
"null",
",",
"\"Olá, \" ",
" ",
"ome ",
" ",
"! Bom te ver por aqui.\",",
" ",
"Boas Vindas\",",
" ",
")",
";",
"",
"}"
] | [
28,
4
] | [
38,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Testes. | null | Calcula total de pontos para um Array de cartas | Calcula total de pontos para um Array de cartas | public static int calcularPontos(Rank[] listaCartas) {
int totalPontos = 0;
// For/each para percorrer a lista
for (Rank carta : listaCartas) {
// Adiciona os pontos de cada carta ao total
totalPontos += carta.getPontos();
}
return totalPontos;
} | [
"public",
"static",
"int",
"calcularPontos",
"(",
"Rank",
"[",
"]",
"listaCartas",
")",
"{",
"int",
"totalPontos",
"=",
"0",
";",
"// For/each para percorrer a lista",
"for",
"(",
"Rank",
"carta",
":",
"listaCartas",
")",
"{",
"// Adiciona os pontos de cada carta ao total",
"totalPontos",
"+=",
"carta",
".",
"getPontos",
"(",
")",
";",
"}",
"return",
"totalPontos",
";",
"}"
] | [
7,
4
] | [
15,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Multiplicacao. | null | Método com 2 parâmetros | Método com 2 parâmetros | static int Multiplica(int a, int b)
{
return a * b;
} | [
"static",
"int",
"Multiplica",
"(",
"int",
"a",
",",
"int",
"b",
")",
"{",
"return",
"a",
"*",
"b",
";",
"}"
] | [
16,
1
] | [
19,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
EspecieController. | null | Atualiza uma especie | Atualiza uma especie | @RequestMapping(value="/especie", method=RequestMethod.PUT)
@ApiOperation(value="Atualiza uma especie")
public ResponseEntity<?> atualizaUsuario(@RequestBody Especie especie) {
Especie obj = especieService.atualizaEspecie(especie);
return ResponseEntity.ok().body(obj);
} | [
"@",
"RequestMapping",
"(",
"value",
"=",
"\"/especie\"",
",",
"method",
"=",
"RequestMethod",
".",
"PUT",
")",
"@",
"ApiOperation",
"(",
"value",
"=",
"\"Atualiza uma especie\"",
")",
"public",
"ResponseEntity",
"<",
"?",
">",
"atualizaUsuario",
"(",
"@",
"RequestBody",
"Especie",
"especie",
")",
"{",
"Especie",
"obj",
"=",
"especieService",
".",
"atualizaEspecie",
"(",
"especie",
")",
";",
"return",
"ResponseEntity",
".",
"ok",
"(",
")",
".",
"body",
"(",
"obj",
")",
";",
"}"
] | [
61,
1
] | [
66,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
TurmaService. | null | Metodo que vai Inserir ou atualizar os dados do Turma | Metodo que vai Inserir ou atualizar os dados do Turma | public void saveOrUpdate(Turma obj){
if(obj.getCodigo()== null){
dao.insert(obj);
}
else{
dao.update(obj);
}
} | [
"public",
"void",
"saveOrUpdate",
"(",
"Turma",
"obj",
")",
"{",
"if",
"(",
"obj",
".",
"getCodigo",
"(",
")",
"==",
"null",
")",
"{",
"dao",
".",
"insert",
"(",
"obj",
")",
";",
"}",
"else",
"{",
"dao",
".",
"update",
"(",
"obj",
")",
";",
"}",
"}"
] | [
22,
4
] | [
29,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
UsMonthlySummaryQueries. | null | APDF4: PDF FORMADOS E ACTIVOS COM CRIANÇA ATE UMA DATA FINAL | APDF4: PDF FORMADOS E ACTIVOS COM CRIANÇA ATE UMA DATA FINAL | public static String pdfFormatAssetAtFinalDateForChildren() {
return "select family_id from gaac_family where start_date<:endDate and voided=0 "
+ "and ((crumbled is null) or (crumbled=0) or (crumbled=1 and date_crumbled>:endDate)) and location_id=:location and family_id in "
+ "(SELECT family_id FROM person p inner join gaac_family_member ON member_id = person_id where round(datediff(:endDate,birthdate)/360) <=14 )";
} | [
"public",
"static",
"String",
"pdfFormatAssetAtFinalDateForChildren",
"(",
")",
"{",
"return",
"\"select family_id from gaac_family where start_date<:endDate and voided=0 \"",
"+",
"\"and ((crumbled is null) or (crumbled=0) or (crumbled=1 and date_crumbled>:endDate)) and location_id=:location and family_id in \"",
"+",
"\"(SELECT family_id FROM person p inner join gaac_family_member ON member_id = person_id where round(datediff(:endDate,birthdate)/360) <=14 )\"",
";",
"}"
] | [
215,
2
] | [
219,
3
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
aula05ex. | null | criei uma função recursiva acessória para ajudar no exercicio acima usando a formula de fibonnacci | criei uma função recursiva acessória para ajudar no exercicio acima usando a formula de fibonnacci | public static int fib(int n)
{
if (n <= 1)
return n;
return fib(n-1) + fib(n-2);
} | [
"public",
"static",
"int",
"fib",
"(",
"int",
"n",
")",
"{",
"if",
"(",
"n",
"<=",
"1",
")",
"return",
"n",
";",
"return",
"fib",
"(",
"n",
"-",
"1",
")",
"+",
"fib",
"(",
"n",
"-",
"2",
")",
";",
"}"
] | [
268,
4
] | [
273,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
TelaCliente. | null | evento que será usado para setar os campos da tabela (clicando com o mouse) | evento que será usado para setar os campos da tabela (clicando com o mouse) | private void tblClientesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblClientesMouseClicked
// chamando o método para setar os campos
setar_campos();
} | [
"private",
"void",
"tblClientesMouseClicked",
"(",
"java",
".",
"awt",
".",
"event",
".",
"MouseEvent",
"evt",
")",
"{",
"//GEN-FIRST:event_tblClientesMouseClicked",
"// chamando o método para setar os campos",
"setar_campos",
"(",
")",
";",
"}"
] | [
404,
4
] | [
407,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Map. | null | retorna true caso tenha colidido com a bravia, retorna false caso contrario | retorna true caso tenha colidido com a bravia, retorna false caso contrario | private boolean moveEnemy(Enemy enemy, char direction) {
System.out.println(direction); //DEBUG
int newIPos,newJPos;
switch (direction) {
case 'U':
newIPos = enemy.getIPos() - 1;
newJPos = enemy.getJPos();
mapEnemy[newIPos][newJPos] = mapEnemy[enemy.getIPos()][enemy.getJPos()];
mapEnemy[enemy.getIPos()][enemy.getJPos()] = null;
enemy.setIPos(newIPos);
enemy.setJPos(newJPos);
System.out.print(newIPos); //DEBUG
System.out.print(" ");
System.out.println(newJPos);
break;
case 'D':
newIPos = enemy.getIPos() + 1;
newJPos = enemy.getJPos();
mapEnemy[newIPos][newJPos] = mapEnemy[enemy.getIPos()][enemy.getJPos()];
mapEnemy[enemy.getIPos()][enemy.getJPos()] = null;
enemy.setIPos(newIPos);
enemy.setJPos(newJPos);
System.out.print(newIPos); //DEBUG
System.out.print(" ");
System.out.println(newJPos);
break;
case 'L':
newIPos = enemy.getIPos();
newJPos = enemy.getJPos() - 1;
mapEnemy[newIPos][newJPos] = mapEnemy[enemy.getIPos()][enemy.getJPos()];
mapEnemy[enemy.getIPos()][enemy.getJPos()] = null;
enemy.setIPos(newIPos);
enemy.setJPos(newJPos);
System.out.print(newIPos); //DEBUG
System.out.print(" ");
System.out.println(newJPos);
break;
case 'R':
newIPos = enemy.getIPos();
newJPos = enemy.getJPos() + 1;
mapEnemy[newIPos][newJPos] = mapEnemy[enemy.getIPos()][enemy.getJPos()];
mapEnemy[enemy.getIPos()][enemy.getJPos()] = null;
enemy.setIPos(newIPos);
enemy.setJPos(newJPos);
System.out.print(newIPos); //DEBUG
System.out.print(" ");
System.out.println(newJPos);
break;
default:
break;
}
if(bravia.getIPos() == enemy.getIPos() && bravia.getJPos() == enemy.getJPos()) {
return true;
}
return false;
} | [
"private",
"boolean",
"moveEnemy",
"(",
"Enemy",
"enemy",
",",
"char",
"direction",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"direction",
")",
";",
"//DEBUG",
"int",
"newIPos",
",",
"newJPos",
";",
"switch",
"(",
"direction",
")",
"{",
"case",
"'",
"'",
":",
"newIPos",
"=",
"enemy",
".",
"getIPos",
"(",
")",
"-",
"1",
";",
"newJPos",
"=",
"enemy",
".",
"getJPos",
"(",
")",
";",
"mapEnemy",
"[",
"newIPos",
"]",
"[",
"newJPos",
"]",
"=",
"mapEnemy",
"[",
"enemy",
".",
"getIPos",
"(",
")",
"]",
"[",
"enemy",
".",
"getJPos",
"(",
")",
"]",
";",
"mapEnemy",
"[",
"enemy",
".",
"getIPos",
"(",
")",
"]",
"[",
"enemy",
".",
"getJPos",
"(",
")",
"]",
"=",
"null",
";",
"enemy",
".",
"setIPos",
"(",
"newIPos",
")",
";",
"enemy",
".",
"setJPos",
"(",
"newJPos",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"newIPos",
")",
";",
"//DEBUG\t",
"System",
".",
"out",
".",
"print",
"(",
"\" \"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"newJPos",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"newIPos",
"=",
"enemy",
".",
"getIPos",
"(",
")",
"+",
"1",
";",
"newJPos",
"=",
"enemy",
".",
"getJPos",
"(",
")",
";",
"mapEnemy",
"[",
"newIPos",
"]",
"[",
"newJPos",
"]",
"=",
"mapEnemy",
"[",
"enemy",
".",
"getIPos",
"(",
")",
"]",
"[",
"enemy",
".",
"getJPos",
"(",
")",
"]",
";",
"mapEnemy",
"[",
"enemy",
".",
"getIPos",
"(",
")",
"]",
"[",
"enemy",
".",
"getJPos",
"(",
")",
"]",
"=",
"null",
";",
"enemy",
".",
"setIPos",
"(",
"newIPos",
")",
";",
"enemy",
".",
"setJPos",
"(",
"newJPos",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"newIPos",
")",
";",
"//DEBUG\t",
"System",
".",
"out",
".",
"print",
"(",
"\" \"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"newJPos",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"newIPos",
"=",
"enemy",
".",
"getIPos",
"(",
")",
";",
"newJPos",
"=",
"enemy",
".",
"getJPos",
"(",
")",
"-",
"1",
";",
"mapEnemy",
"[",
"newIPos",
"]",
"[",
"newJPos",
"]",
"=",
"mapEnemy",
"[",
"enemy",
".",
"getIPos",
"(",
")",
"]",
"[",
"enemy",
".",
"getJPos",
"(",
")",
"]",
";",
"mapEnemy",
"[",
"enemy",
".",
"getIPos",
"(",
")",
"]",
"[",
"enemy",
".",
"getJPos",
"(",
")",
"]",
"=",
"null",
";",
"enemy",
".",
"setIPos",
"(",
"newIPos",
")",
";",
"enemy",
".",
"setJPos",
"(",
"newJPos",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"newIPos",
")",
";",
"//DEBUG\t",
"System",
".",
"out",
".",
"print",
"(",
"\" \"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"newJPos",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"newIPos",
"=",
"enemy",
".",
"getIPos",
"(",
")",
";",
"newJPos",
"=",
"enemy",
".",
"getJPos",
"(",
")",
"+",
"1",
";",
"mapEnemy",
"[",
"newIPos",
"]",
"[",
"newJPos",
"]",
"=",
"mapEnemy",
"[",
"enemy",
".",
"getIPos",
"(",
")",
"]",
"[",
"enemy",
".",
"getJPos",
"(",
")",
"]",
";",
"mapEnemy",
"[",
"enemy",
".",
"getIPos",
"(",
")",
"]",
"[",
"enemy",
".",
"getJPos",
"(",
")",
"]",
"=",
"null",
";",
"enemy",
".",
"setIPos",
"(",
"newIPos",
")",
";",
"enemy",
".",
"setJPos",
"(",
"newJPos",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"newIPos",
")",
";",
"//DEBUG\t",
"System",
".",
"out",
".",
"print",
"(",
"\" \"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"newJPos",
")",
";",
"break",
";",
"default",
":",
"break",
";",
"}",
"if",
"(",
"bravia",
".",
"getIPos",
"(",
")",
"==",
"enemy",
".",
"getIPos",
"(",
")",
"&&",
"bravia",
".",
"getJPos",
"(",
")",
"==",
"enemy",
".",
"getJPos",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | [
172,
1
] | [
229,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
GerenciarArquivo. | null | Função para fechar o arquivo aberto | Função para fechar o arquivo aberto | public void fecharArquivo(int modo) {
if(modo == 1){
if (output != null)
output.close();
} else{
if(input != null)
input.close();
}
} | [
"public",
"void",
"fecharArquivo",
"(",
"int",
"modo",
")",
"{",
"if",
"(",
"modo",
"==",
"1",
")",
"{",
"if",
"(",
"output",
"!=",
"null",
")",
"output",
".",
"close",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"input",
"!=",
"null",
")",
"input",
".",
"close",
"(",
")",
";",
"}",
"}"
] | [
185,
4
] | [
193,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
WS3D_Controller. | null | A criatura inicializa gera automaticamente em sua inicialização os | A criatura inicializa gera automaticamente em sua inicialização os | private void BCreatureActionPerformed(){
try {
// Criando a criatura no World Server
Creature = proxy.createCreature(100, 450, 0, 1);
// Gerando uma lista de leflets ao iniciar a criatura
Creature.genLeaflet();
// O metodo String.valueOF = ira converter o retorno do metodo get do leaflets para tipo long - String
// Creature.deliverLeaflet(String.valueOf(leaflets.get(0).getID()));
//System.out.println("leaflet atual: "+ leaflets);
Creature.start();
WorldPoint position = Creature.getPosition();
double pitch = Creature.getPitch();
double fuel = Creature.getFuel();
Creature.move(0, 0, 0);
// Initialize the deliveryspot with creature
wd.createDeliverySpot(5, 250);
} catch (CommandExecException ex) {
System.out.println(ex.getMessage());
}
} | [
"private",
"void",
"BCreatureActionPerformed",
"(",
")",
"{",
"try",
"{",
"// Criando a criatura no World Server\r",
"Creature",
"=",
"proxy",
".",
"createCreature",
"(",
"100",
",",
"450",
",",
"0",
",",
"1",
")",
";",
"// Gerando uma lista de leflets ao iniciar a criatura\r",
"Creature",
".",
"genLeaflet",
"(",
")",
";",
"// O metodo String.valueOF = ira converter o retorno do metodo get do leaflets para tipo long - String\r",
"// Creature.deliverLeaflet(String.valueOf(leaflets.get(0).getID()));\r",
"//System.out.println(\"leaflet atual: \"+ leaflets);\r",
"Creature",
".",
"start",
"(",
")",
";",
"WorldPoint",
"position",
"=",
"Creature",
".",
"getPosition",
"(",
")",
";",
"double",
"pitch",
"=",
"Creature",
".",
"getPitch",
"(",
")",
";",
"double",
"fuel",
"=",
"Creature",
".",
"getFuel",
"(",
")",
";",
"Creature",
".",
"move",
"(",
"0",
",",
"0",
",",
"0",
")",
";",
"// Initialize the deliveryspot with creature\r",
"wd",
".",
"createDeliverySpot",
"(",
"5",
",",
"250",
")",
";",
"}",
"catch",
"(",
"CommandExecException",
"ex",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"ex",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
] | [
317,
4
] | [
341,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
PessoaResource. | null | ^Fará a publicação do evento | ^Fará a publicação do evento | @PostMapping
@ResponseStatus(HttpStatus.CREATED)
public ResponseEntity<Pessoa> criar(@Valid @RequestBody Pessoa pessoa, HttpServletResponse response) {
Pessoa pessoaSalva = pessoaRepository.save(pessoa);
publisher.publishEvent(new RecursoCriadoEvent(this, response, pessoaSalva.getId()));
return ResponseEntity.status(HttpStatus.CREATED).body(pessoaSalva);
} | [
"@",
"PostMapping",
"@",
"ResponseStatus",
"(",
"HttpStatus",
".",
"CREATED",
")",
"public",
"ResponseEntity",
"<",
"Pessoa",
">",
"criar",
"(",
"@",
"Valid",
"@",
"RequestBody",
"Pessoa",
"pessoa",
",",
"HttpServletResponse",
"response",
")",
"{",
"Pessoa",
"pessoaSalva",
"=",
"pessoaRepository",
".",
"save",
"(",
"pessoa",
")",
";",
"publisher",
".",
"publishEvent",
"(",
"new",
"RecursoCriadoEvent",
"(",
"this",
",",
"response",
",",
"pessoaSalva",
".",
"getId",
"(",
")",
")",
")",
";",
"return",
"ResponseEntity",
".",
"status",
"(",
"HttpStatus",
".",
"CREATED",
")",
".",
"body",
"(",
"pessoaSalva",
")",
";",
"}"
] | [
40,
4
] | [
46,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Peixe. | null | Sobreposição dos métodos de animal | Sobreposição dos métodos de animal | @Override
public void locomover() {
System.out.println("Nadando");
} | [
"@",
"Override",
"public",
"void",
"locomover",
"(",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Nadando\"",
")",
";",
"}"
] | [
10,
4
] | [
13,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Hero. | null | Esse método é chamado quando a tecla "espaço" é pressionada. | Esse método é chamado quando a tecla "espaço" é pressionada. | public boolean ataque(ArrayList<Elemento> listaElementos) {
Posicao posicao = new Posicao(0, 0);
Elemento elementoTemp;
switch (super.orientacao) {
case CIMA:
posicao.setPosicao(this.getPosicao().getLinha() - 1, this.getPosicao().getColuna());
break;
case BAIXO:
posicao.setPosicao(this.getPosicao().getLinha() + 1, this.getPosicao().getColuna());
break;
case ESQUERDA:
posicao.setPosicao(this.getPosicao().getLinha(), this.getPosicao().getColuna() - 1);
break;
case DIREITA:
posicao.setPosicao(this.getPosicao().getLinha(), this.getPosicao().getColuna() + 1);
break;
}
//Verifica se existe algum elemento no alcance do ataque do heroi.
for(int i = 1; i < listaElementos.size(); i++) {
elementoTemp = listaElementos.get(i);
if(elementoTemp.getPosicao().estaNaMesmaPosicao(posicao)) {
elementoTemp.contatoComAtaque(listaElementos, this.orientacao, i);
}
}
return true;
} | [
"public",
"boolean",
"ataque",
"(",
"ArrayList",
"<",
"Elemento",
">",
"listaElementos",
")",
"{",
"Posicao",
"posicao",
"=",
"new",
"Posicao",
"(",
"0",
",",
"0",
")",
";",
"Elemento",
"elementoTemp",
";",
"switch",
"(",
"super",
".",
"orientacao",
")",
"{",
"case",
"CIMA",
":",
"posicao",
".",
"setPosicao",
"(",
"this",
".",
"getPosicao",
"(",
")",
".",
"getLinha",
"(",
")",
"-",
"1",
",",
"this",
".",
"getPosicao",
"(",
")",
".",
"getColuna",
"(",
")",
")",
";",
"break",
";",
"case",
"BAIXO",
":",
"posicao",
".",
"setPosicao",
"(",
"this",
".",
"getPosicao",
"(",
")",
".",
"getLinha",
"(",
")",
"+",
"1",
",",
"this",
".",
"getPosicao",
"(",
")",
".",
"getColuna",
"(",
")",
")",
";",
"break",
";",
"case",
"ESQUERDA",
":",
"posicao",
".",
"setPosicao",
"(",
"this",
".",
"getPosicao",
"(",
")",
".",
"getLinha",
"(",
")",
",",
"this",
".",
"getPosicao",
"(",
")",
".",
"getColuna",
"(",
")",
"-",
"1",
")",
";",
"break",
";",
"case",
"DIREITA",
":",
"posicao",
".",
"setPosicao",
"(",
"this",
".",
"getPosicao",
"(",
")",
".",
"getLinha",
"(",
")",
",",
"this",
".",
"getPosicao",
"(",
")",
".",
"getColuna",
"(",
")",
"+",
"1",
")",
";",
"break",
";",
"}",
"//Verifica se existe algum elemento no alcance do ataque do heroi.",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"listaElementos",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"elementoTemp",
"=",
"listaElementos",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"elementoTemp",
".",
"getPosicao",
"(",
")",
".",
"estaNaMesmaPosicao",
"(",
"posicao",
")",
")",
"{",
"elementoTemp",
".",
"contatoComAtaque",
"(",
"listaElementos",
",",
"this",
".",
"orientacao",
",",
"i",
")",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | [
32,
1
] | [
62,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
EnviarCorreo. | null | Getter para atributo Encoding | Getter para atributo Encoding | public String getEncoding()
{
return Encoding;
} | [
"public",
"String",
"getEncoding",
"(",
")",
"{",
"return",
"Encoding",
";",
"}"
] | [
141,
4
] | [
144,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
ControleDeJogo. | null | Lista percorrida do último elemento ao primeiro para heroi sempre sobrepor todos os objetos transponíveis na tela | Lista percorrida do último elemento ao primeiro para heroi sempre sobrepor todos os objetos transponíveis na tela | public void desenhaTudo(ArrayList<Elemento> ListElem) {
for (int i = ListElem.size() - 1; i >= 0; i--) {
ListElem.get(i).autoDesenho(ListElem, i);
}
} | [
"public",
"void",
"desenhaTudo",
"(",
"ArrayList",
"<",
"Elemento",
">",
"ListElem",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"ListElem",
".",
"size",
"(",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"ListElem",
".",
"get",
"(",
"i",
")",
".",
"autoDesenho",
"(",
"ListElem",
",",
"i",
")",
";",
"}",
"}"
] | [
14,
1
] | [
18,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
ProductService. | null | verifica se um produto existe antes de adicionar no carrinho de compras. | verifica se um produto existe antes de adicionar no carrinho de compras. | public Optional checkProductExists(Product product) {
return productRepository.verifyProduct(product.getProductId(), product.getQuantity());
} | [
"public",
"Optional",
"checkProductExists",
"(",
"Product",
"product",
")",
"{",
"return",
"productRepository",
".",
"verifyProduct",
"(",
"product",
".",
"getProductId",
"(",
")",
",",
"product",
".",
"getQuantity",
"(",
")",
")",
";",
"}"
] | [
63,
4
] | [
65,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
LoginController. | null | Login de um usuário | Login de um usuário | @RequestMapping(value="/login", method=RequestMethod.POST)
@ApiOperation(value="Login de um usuário")
@ResponseStatus(HttpStatus.CREATED)
public ResponseEntity<?> loginUsuario(@RequestBody DadosLogin dados) {
Usuario obj = null;
try {
obj = loginService.authenticate(dados);
} catch (Exception e) {
e.printStackTrace();
}
return ResponseEntity.ok().body(obj);
} | [
"@",
"RequestMapping",
"(",
"value",
"=",
"\"/login\"",
",",
"method",
"=",
"RequestMethod",
".",
"POST",
")",
"@",
"ApiOperation",
"(",
"value",
"=",
"\"Login de um usuário\")",
"",
"@",
"ResponseStatus",
"(",
"HttpStatus",
".",
"CREATED",
")",
"public",
"ResponseEntity",
"<",
"?",
">",
"loginUsuario",
"(",
"@",
"RequestBody",
"DadosLogin",
"dados",
")",
"{",
"Usuario",
"obj",
"=",
"null",
";",
"try",
"{",
"obj",
"=",
"loginService",
".",
"authenticate",
"(",
"dados",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"ResponseEntity",
".",
"ok",
"(",
")",
".",
"body",
"(",
"obj",
")",
";",
"}"
] | [
23,
1
] | [
34,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
RabbitConfiguration. | null | Criação da factory | Criação da factory | @Bean
public SimpleRabbitListenerContainerFactory simpleRabbitListenerContainerFactory() {
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
factory.setConnectionFactory(connectionFactory);
factory.setMessageConverter(jackJsonMessageConverter());
return factory;
} | [
"@",
"Bean",
"public",
"SimpleRabbitListenerContainerFactory",
"simpleRabbitListenerContainerFactory",
"(",
")",
"{",
"SimpleRabbitListenerContainerFactory",
"factory",
"=",
"new",
"SimpleRabbitListenerContainerFactory",
"(",
")",
";",
"factory",
".",
"setConnectionFactory",
"(",
"connectionFactory",
")",
";",
"factory",
".",
"setMessageConverter",
"(",
"jackJsonMessageConverter",
"(",
")",
")",
";",
"return",
"factory",
";",
"}"
] | [
22,
1
] | [
30,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
UserService. | null | Busca o usuário no banco e retorna exceção se não encontrar | Busca o usuário no banco e retorna exceção se não encontrar | @Override
public UserDetails loadUserByUsername(String email) throws UsernameNotFoundException {
Optional<UserModel> user = userRepository.findByLogin(email);
return user.orElseThrow(() -> new UsernameNotFoundException("Username not found!"));
} | [
"@",
"Override",
"public",
"UserDetails",
"loadUserByUsername",
"(",
"String",
"email",
")",
"throws",
"UsernameNotFoundException",
"{",
"Optional",
"<",
"UserModel",
">",
"user",
"=",
"userRepository",
".",
"findByLogin",
"(",
"email",
")",
";",
"return",
"user",
".",
"orElseThrow",
"(",
"(",
")",
"->",
"new",
"UsernameNotFoundException",
"(",
"\"Username not found!\"",
")",
")",
";",
"}"
] | [
25,
4
] | [
29,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
TestTable. | null | String, no adornment | String, no adornment | private static String str(Op op) {
SerializationContext sCxt = new SerializationContext();
IndentedLineBuffer out = new IndentedLineBuffer();
out.setFlatMode(true);
WriterOp.output(out, op, sCxt);
String x = out.asString();
return x.trim();
} | [
"private",
"static",
"String",
"str",
"(",
"Op",
"op",
")",
"{",
"SerializationContext",
"sCxt",
"=",
"new",
"SerializationContext",
"(",
")",
";",
"IndentedLineBuffer",
"out",
"=",
"new",
"IndentedLineBuffer",
"(",
")",
";",
"out",
".",
"setFlatMode",
"(",
"true",
")",
";",
"WriterOp",
".",
"output",
"(",
"out",
",",
"op",
",",
"sCxt",
")",
";",
"String",
"x",
"=",
"out",
".",
"asString",
"(",
")",
";",
"return",
"x",
".",
"trim",
"(",
")",
";",
"}"
] | [
58,
4
] | [
65,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
ProfessorFormController. | null | Metodo responsavel para pegar os dados do Professor e popular a caixa de texto do formulario | Metodo responsavel para pegar os dados do Professor e popular a caixa de texto do formulario | public void updateFormData() {
//Testa se Entity esta nulo
if (entity == null) {
throw new IllegalStateException("Entity was null");
}
txtIdNome.setText(String.valueOf(entity.getIdnome())); //Pega o ID digitado
txtNome.setText(entity.getNome());//Pega o NOME digitado
txtTitulacao.setText(entity.getTitulacao());//Pega a TITULACAO digitado
} | [
"public",
"void",
"updateFormData",
"(",
")",
"{",
"//Testa se Entity esta nulo",
"if",
"(",
"entity",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Entity was null\"",
")",
";",
"}",
"txtIdNome",
".",
"setText",
"(",
"String",
".",
"valueOf",
"(",
"entity",
".",
"getIdnome",
"(",
")",
")",
")",
";",
"//Pega o ID digitado",
"txtNome",
".",
"setText",
"(",
"entity",
".",
"getNome",
"(",
")",
")",
";",
"//Pega o NOME digitado",
"txtTitulacao",
".",
"setText",
"(",
"entity",
".",
"getTitulacao",
"(",
")",
")",
";",
"//Pega a TITULACAO digitado",
"}"
] | [
148,
4
] | [
156,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
AreaDoAlunoController. | null | Metodo responsavel por carregar o servico e jogar o Aluno no ObservableList | Metodo responsavel por carregar o servico e jogar o Aluno no ObservableList | public void updateTableView() {
if (service == null) {
throw new IllegalStateException("Service was null");
}
List<Aluno> list = service.findyAll();
obsList = FXCollections.observableArrayList(list);
tableViewAluno.setItems(obsList);
// //Add outro listener outro observalList
// tableViewAluno.getSelectionModel().selectedItemProperty().addListener(
// (observable, odlValue, newValue) -> selecionarItemTableViewClientes(newValue));
busca();
} | [
"public",
"void",
"updateTableView",
"(",
")",
"{",
"if",
"(",
"service",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Service was null\"",
")",
";",
"}",
"List",
"<",
"Aluno",
">",
"list",
"=",
"service",
".",
"findyAll",
"(",
")",
";",
"obsList",
"=",
"FXCollections",
".",
"observableArrayList",
"(",
"list",
")",
";",
"tableViewAluno",
".",
"setItems",
"(",
"obsList",
")",
";",
"// //Add outro listener outro observalList",
"// tableViewAluno.getSelectionModel().selectedItemProperty().addListener(",
"// (observable, odlValue, newValue) -> selecionarItemTableViewClientes(newValue));",
"busca",
"(",
")",
";",
"}"
] | [
132,
4
] | [
144,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
TubaraoMadara. | null | A funcao calcula o risco incorrido ao se mover para um determinado ponto: | A funcao calcula o risco incorrido ao se mover para um determinado ponto: | public double calcRisk(Point2D point) {
double risk = 0;
// Usa antigravidade para repelir de Inimigos; também contabiliza Inimigos de alta energia sendo um risco maior
for (inimigo inimigo : Inimigos.values()) {
risk += (inimigo.energia + 50) / point.distanceSq(inimigo.loc);
}
// Repele os locais anteriores e atuais para evitar ficar muito perto de um único local
risk += 0.1 / point.distanceSq(prevLoc);
risk += 0.1 / point.distanceSq(myLoc);
return risk;
} | [
"public",
"double",
"calcRisk",
"(",
"Point2D",
"point",
")",
"{",
"double",
"risk",
"=",
"0",
";",
"// Usa antigravidade para repelir de Inimigos; também contabiliza Inimigos de alta energia sendo um risco maior",
"for",
"(",
"inimigo",
"inimigo",
":",
"Inimigos",
".",
"values",
"(",
")",
")",
"{",
"risk",
"+=",
"(",
"inimigo",
".",
"energia",
"+",
"50",
")",
"/",
"point",
".",
"distanceSq",
"(",
"inimigo",
".",
"loc",
")",
";",
"}",
"// Repele os locais anteriores e atuais para evitar ficar muito perto de um único local",
"risk",
"+=",
"0.1",
"/",
"point",
".",
"distanceSq",
"(",
"prevLoc",
")",
";",
"risk",
"+=",
"0.1",
"/",
"point",
".",
"distanceSq",
"(",
"myLoc",
")",
";",
"return",
"risk",
";",
"}"
] | [
215,
4
] | [
226,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
QuickSort. | null | ===== Métodos de Ordenação por Municipio ===== // | ===== Métodos de Ordenação por Municipio ===== // | public void quickMunicipioCres() {
quickMunicipioCres(0, lista.size() - 1);
} | [
"public",
"void",
"quickMunicipioCres",
"(",
")",
"{",
"quickMunicipioCres",
"(",
"0",
",",
"lista",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"}"
] | [
387,
4
] | [
389,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
BioterioController. | null | Atualiza um bioterio | Atualiza um bioterio | @RequestMapping(value="/usuario", method=RequestMethod.PUT)
@ApiOperation(value="Atualiza um bioterio")
public ResponseEntity<?> atualizaUsuario(@RequestBody Bioterio bioterio) {
Bioterio obj = bioterioService.atualizaBioterio(bioterio);
return ResponseEntity.ok().body(obj);
} | [
"@",
"RequestMapping",
"(",
"value",
"=",
"\"/usuario\"",
",",
"method",
"=",
"RequestMethod",
".",
"PUT",
")",
"@",
"ApiOperation",
"(",
"value",
"=",
"\"Atualiza um bioterio\"",
")",
"public",
"ResponseEntity",
"<",
"?",
">",
"atualizaUsuario",
"(",
"@",
"RequestBody",
"Bioterio",
"bioterio",
")",
"{",
"Bioterio",
"obj",
"=",
"bioterioService",
".",
"atualizaBioterio",
"(",
"bioterio",
")",
";",
"return",
"ResponseEntity",
".",
"ok",
"(",
")",
".",
"body",
"(",
"obj",
")",
";",
"}"
] | [
61,
1
] | [
66,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
BioterioController. | null | Retorna um bioterio único | Retorna um bioterio único | @RequestMapping(value="/{id}", method=RequestMethod.GET)
@ApiOperation(value="Retorna um bioterio único")
public ResponseEntity<?> listaUsuarioUnico(@PathVariable(value="id") Long id){
Optional<Bioterio> obj = bioterioService.listaBioterioUnico(id);
return ResponseEntity.ok().body(obj);
} | [
"@",
"RequestMapping",
"(",
"value",
"=",
"\"/{id}\"",
",",
"method",
"=",
"RequestMethod",
".",
"GET",
")",
"@",
"ApiOperation",
"(",
"value",
"=",
"\"Retorna um bioterio único\")",
"",
"public",
"ResponseEntity",
"<",
"?",
">",
"listaUsuarioUnico",
"(",
"@",
"PathVariable",
"(",
"value",
"=",
"\"id\"",
")",
"Long",
"id",
")",
"{",
"Optional",
"<",
"Bioterio",
">",
"obj",
"=",
"bioterioService",
".",
"listaBioterioUnico",
"(",
"id",
")",
";",
"return",
"ResponseEntity",
".",
"ok",
"(",
")",
".",
"body",
"(",
"obj",
")",
";",
"}"
] | [
37,
1
] | [
42,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
StackRA. | null | a pilha mora em a[0..N-1] | a pilha mora em a[0..N-1] | public boolean isEmpty() {
return N == 0;
} | [
"public",
"boolean",
"isEmpty",
"(",
")",
"{",
"return",
"N",
"==",
"0",
";",
"}"
] | [
17,
3
] | [
19,
4
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
aula02ex. | null | 3. Diferença entre dois numeros inteiros | 3. Diferença entre dois numeros inteiros | static int diff(int a, int b) {
return a - b;
} | [
"static",
"int",
"diff",
"(",
"int",
"a",
",",
"int",
"b",
")",
"{",
"return",
"a",
"-",
"b",
";",
"}"
] | [
55,
4
] | [
57,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Main. | null | =========== Método para inserção =========== | =========== Método para inserção =========== | private String textInput(String texto) {
System.out.println(texto);
return entrada.nextLine();
} | [
"private",
"String",
"textInput",
"(",
"String",
"texto",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"texto",
")",
";",
"return",
"entrada",
".",
"nextLine",
"(",
")",
";",
"}"
] | [
139,
1
] | [
142,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
SecurityConfiguration. | null | Configurações de Autorizações | Configurações de Autorizações | @Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers(HttpMethod.POST,"/auth").permitAll()
.antMatchers( "/notasfiscais").permitAll()
.antMatchers( "/ranking").permitAll()
.anyRequest().authenticated()
.and().csrf().disable()
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and().addFilterBefore(new AutenticacaoViaToken(tokenService, usuarioRepository), UsernamePasswordAuthenticationFilter.class);
} | [
"@",
"Override",
"protected",
"void",
"configure",
"(",
"HttpSecurity",
"http",
")",
"throws",
"Exception",
"{",
"http",
".",
"authorizeRequests",
"(",
")",
".",
"antMatchers",
"(",
"HttpMethod",
".",
"POST",
",",
"\"/auth\"",
")",
".",
"permitAll",
"(",
")",
".",
"antMatchers",
"(",
"\"/notasfiscais\"",
")",
".",
"permitAll",
"(",
")",
".",
"antMatchers",
"(",
"\"/ranking\"",
")",
".",
"permitAll",
"(",
")",
".",
"anyRequest",
"(",
")",
".",
"authenticated",
"(",
")",
".",
"and",
"(",
")",
".",
"csrf",
"(",
")",
".",
"disable",
"(",
")",
".",
"sessionManagement",
"(",
")",
".",
"sessionCreationPolicy",
"(",
"SessionCreationPolicy",
".",
"STATELESS",
")",
".",
"and",
"(",
")",
".",
"addFilterBefore",
"(",
"new",
"AutenticacaoViaToken",
"(",
"tokenService",
",",
"usuarioRepository",
")",
",",
"UsernamePasswordAuthenticationFilter",
".",
"class",
")",
";",
"}"
] | [
43,
4
] | [
53,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
ProfessorService. | null | Lista todos os objetos Professores | Lista todos os objetos Professores | public List<Professor> findyAll(){
return dao.findAll();
} | [
"public",
"List",
"<",
"Professor",
">",
"findyAll",
"(",
")",
"{",
"return",
"dao",
".",
"findAll",
"(",
")",
";",
"}"
] | [
17,
4
] | [
19,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
aula03ex. | null | Exercicios de trabalho autonomo da aula03 | Exercicios de trabalho autonomo da aula03 | public static void main(String[] args) {
// ex1 - testes
int resultado1 = idade(1992);
System.out.println("A Idade é " + resultado1);
//ex 2 - testes
int resultado2 = divisao(3, 1);
System.out.println("A divisao dos 2 numeros é " + resultado2);
//ex 3 - testes
boolean resultado3 = isEven(4);
System.out.println("O numero introduzido é par? " + resultado3);
//ex 4 - testes
boolean resultado4 = isPositive(-45);
System.out.println("O numero introduzido é positivo? " + resultado4);
//ex 5 - testes
System.out.println("Introduza algo na consola:");
devolve();
//ex 6 - testes
System.out.println("Introduza um veiculo na consola:");
// Cria scanner para receber informação da consola
Scanner keyboard = new Scanner(System.in);
// Aguarda proxima informaçao da consola
String veiculo = keyboard.nextLine();
System.out.println("O " + veiculo + " tem " + getWheels(veiculo) + " rodas.");
//ex 7 - testes
System.out.println("A nota é: " + getGrade(67));
System.out.println("A nota é: " + getGrade(102));
//ex 8 - testes
System.out.println("O mês dado é " + devolveMes(3));
//ex 9 - testes
obterSigno();
//ex10 - testes
ordenaNum ();
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"// ex1 - testes",
"int",
"resultado1",
"=",
"idade",
"(",
"1992",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"A Idade é \" ",
" ",
"esultado1)",
";",
"",
"//ex 2 - testes",
"int",
"resultado2",
"=",
"divisao",
"(",
"3",
",",
"1",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"A divisao dos 2 numeros é \" ",
" ",
"esultado2)",
";",
"",
"//ex 3 - testes",
"boolean",
"resultado3",
"=",
"isEven",
"(",
"4",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"O numero introduzido é par? \" ",
" ",
"esultado3)",
";",
"",
"//ex 4 - testes",
"boolean",
"resultado4",
"=",
"isPositive",
"(",
"-",
"45",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"O numero introduzido é positivo? \" ",
" ",
"esultado4)",
";",
"",
"//ex 5 - testes",
"System",
".",
"out",
".",
"println",
"(",
"\"Introduza algo na consola:\"",
")",
";",
"devolve",
"(",
")",
";",
"//ex 6 - testes",
"System",
".",
"out",
".",
"println",
"(",
"\"Introduza um veiculo na consola:\"",
")",
";",
"// Cria scanner para receber informação da consola",
"Scanner",
"keyboard",
"=",
"new",
"Scanner",
"(",
"System",
".",
"in",
")",
";",
"// Aguarda proxima informaçao da consola",
"String",
"veiculo",
"=",
"keyboard",
".",
"nextLine",
"(",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"O \"",
"+",
"veiculo",
"+",
"\" tem \"",
"+",
"getWheels",
"(",
"veiculo",
")",
"+",
"\" rodas.\"",
")",
";",
"//ex 7 - testes",
"System",
".",
"out",
".",
"println",
"(",
"\"A nota é: \" ",
" ",
"etGrade(",
"6",
"7)",
")",
";",
"",
"System",
".",
"out",
".",
"println",
"(",
"\"A nota é: \" ",
" ",
"etGrade(",
"1",
"02)",
")",
";",
"",
"//ex 8 - testes",
"System",
".",
"out",
".",
"println",
"(",
"\"O mês dado é \" +",
"d",
"volveMes(3",
")",
")",
";",
"",
"",
"//ex 9 - testes",
"obterSigno",
"(",
")",
";",
"//ex10 - testes",
"ordenaNum",
"(",
")",
";",
"}"
] | [
8,
4
] | [
40,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
SecurityConfiguration. | null | Configuração de autorização | Configuração de autorização | @Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers(HttpMethod.POST, "/users").permitAll()
.antMatchers(HttpMethod.POST, "/auth").permitAll()
.antMatchers(HttpMethod.GET, "/details/*").permitAll()
.antMatchers(HttpMethod.POST, "/invoices").permitAll()
.antMatchers(HttpMethod.POST, "/ranking").permitAll()
.antMatchers(HttpMethod.POST, "/retorno-pagseguro/**").permitAll()
.antMatchers(HttpMethod.POST, "/retorno-paypal/**").permitAll()
// .antMatchers("/**").permitAll()
.anyRequest().authenticated()
.and().cors()
.and().csrf().disable()
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and().addFilterBefore(new JwtRequestFilter(tokenService, userRepository),
UsernamePasswordAuthenticationFilter.class);
} | [
"@",
"Override",
"protected",
"void",
"configure",
"(",
"HttpSecurity",
"http",
")",
"throws",
"Exception",
"{",
"http",
".",
"authorizeRequests",
"(",
")",
".",
"antMatchers",
"(",
"HttpMethod",
".",
"POST",
",",
"\"/users\"",
")",
".",
"permitAll",
"(",
")",
".",
"antMatchers",
"(",
"HttpMethod",
".",
"POST",
",",
"\"/auth\"",
")",
".",
"permitAll",
"(",
")",
".",
"antMatchers",
"(",
"HttpMethod",
".",
"GET",
",",
"\"/details/*\"",
")",
".",
"permitAll",
"(",
")",
".",
"antMatchers",
"(",
"HttpMethod",
".",
"POST",
",",
"\"/invoices\"",
")",
".",
"permitAll",
"(",
")",
".",
"antMatchers",
"(",
"HttpMethod",
".",
"POST",
",",
"\"/ranking\"",
")",
".",
"permitAll",
"(",
")",
".",
"antMatchers",
"(",
"HttpMethod",
".",
"POST",
",",
"\"/retorno-pagseguro/**\"",
")",
".",
"permitAll",
"(",
")",
".",
"antMatchers",
"(",
"HttpMethod",
".",
"POST",
",",
"\"/retorno-paypal/**\"",
")",
".",
"permitAll",
"(",
")",
"//\t\t.antMatchers(\"/**\").permitAll()",
".",
"anyRequest",
"(",
")",
".",
"authenticated",
"(",
")",
".",
"and",
"(",
")",
".",
"cors",
"(",
")",
".",
"and",
"(",
")",
".",
"csrf",
"(",
")",
".",
"disable",
"(",
")",
".",
"sessionManagement",
"(",
")",
".",
"sessionCreationPolicy",
"(",
"SessionCreationPolicy",
".",
"STATELESS",
")",
".",
"and",
"(",
")",
".",
"addFilterBefore",
"(",
"new",
"JwtRequestFilter",
"(",
"tokenService",
",",
"userRepository",
")",
",",
"UsernamePasswordAuthenticationFilter",
".",
"class",
")",
";",
"}"
] | [
50,
1
] | [
67,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Serial. | null | ******** Configuração de comunicação serial WEIGHTECH WT1000N ****** | ******** Configuração de comunicação serial WEIGHTECH WT1000N ****** | public void configWT1000N() {
setBaud(9600);
setDatabits(8);
setStopbit(1);
setParity(0);
} | [
"public",
"void",
"configWT1000N",
"(",
")",
"{",
"setBaud",
"(",
"9600",
")",
";",
"setDatabits",
"(",
"8",
")",
";",
"setStopbit",
"(",
"1",
")",
";",
"setParity",
"(",
"0",
")",
";",
"}"
] | [
220,
4
] | [
225,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Casting. | null | converte um long para int | converte um long para int | public static void main(String[] args) {
// atributos
double a = 2147483;
short b = (short) a;
// sempre entre parenteses
System.out.println("double = " + a);
System.out.println("short = " + b);
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"// atributos\r",
"double",
"a",
"=",
"2147483",
";",
"short",
"b",
"=",
"(",
"short",
")",
"a",
";",
"// sempre entre parenteses\r",
"System",
".",
"out",
".",
"println",
"(",
"\"double = \"",
"+",
"a",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"short = \"",
"+",
"b",
")",
";",
"}"
] | [
2,
4
] | [
10,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
aula04. | null | Imprime na consola todos os Numeros Pares de 1 a 20 Com ciclo Do While | Imprime na consola todos os Numeros Pares de 1 a 20 Com ciclo Do While | public static void numparDoWhile(){
int n = 1;
do {
// Verifica se n é par
if (n%2==0){
System.out.println(n);
}
n++;
} while (n<=20);
} | [
"public",
"static",
"void",
"numparDoWhile",
"(",
")",
"{",
"int",
"n",
"=",
"1",
";",
"do",
"{",
"// Verifica se n é par",
"if",
"(",
"n",
"%",
"2",
"==",
"0",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"n",
")",
";",
"}",
"n",
"++",
";",
"}",
"while",
"(",
"n",
"<=",
"20",
")",
";",
"}"
] | [
34,
4
] | [
43,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Fila. | null | Refatorou para retornar um tipo gerneric | Refatorou para retornar um tipo gerneric | public T first(){
if (!this.isEmpty()){
No primeiroNo = refNoEntradaFila;
while (true){
if (primeiroNo.getRefNo() != null) {
primeiroNo = primeiroNo.getRefNo();
}else {
break;
}
}
return (T) primeiroNo.getObject();
}
return null;
} | [
"public",
"T",
"first",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"isEmpty",
"(",
")",
")",
"{",
"No",
"primeiroNo",
"=",
"refNoEntradaFila",
";",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"primeiroNo",
".",
"getRefNo",
"(",
")",
"!=",
"null",
")",
"{",
"primeiroNo",
"=",
"primeiroNo",
".",
"getRefNo",
"(",
")",
";",
"}",
"else",
"{",
"break",
";",
"}",
"}",
"return",
"(",
"T",
")",
"primeiroNo",
".",
"getObject",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] | [
20,
4
] | [
33,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
TelaOS. | null | método para cadastrar uma OS | método para cadastrar uma OS | private void emitir_os() {
String sql = "insert into tbos(tipo,situacao,equipamento,defeito,servico,tecnico,valor,idcli) values(?,?,?,?,?,?,?,?)";
try {
pst = conexao.prepareStatement(sql);
pst.setString(1, tipo);
pst.setString(2, cboOsSit.getSelectedItem().toString());
pst.setString(3, txtOsEquip.getText());
pst.setString(4, txtOsDef.getText());
pst.setString(5, txtOsServ.getText());
pst.setString(6, txtOsTec.getText());
//.replace substitui a vírgula pelo ponto
pst.setString(7, txtOsValor.getText().replace(",", "."));
pst.setString(8, txtCliId.getText());
//validação dos campos obrigatórios
if ((txtCliId.getText().isEmpty()) || (txtOsEquip.getText().isEmpty()) || (txtOsDef.getText().isEmpty())) {
JOptionPane.showMessageDialog(null, "Preencha todos os campos obrigatórios");
} else {
int adicionado = pst.executeUpdate();
if (adicionado > 0) {
JOptionPane.showMessageDialog(null, "OS emitida com sucesso");
txtCliId.setText(null);
txtOsEquip.setText(null);
txtOsDef.setText(null);
txtOsServ.setText(null);
txtOsTec.setText(null);
txtOsValor.setText(null);
}
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
} | [
"private",
"void",
"emitir_os",
"(",
")",
"{",
"String",
"sql",
"=",
"\"insert into tbos(tipo,situacao,equipamento,defeito,servico,tecnico,valor,idcli) values(?,?,?,?,?,?,?,?)\"",
";",
"try",
"{",
"pst",
"=",
"conexao",
".",
"prepareStatement",
"(",
"sql",
")",
";",
"pst",
".",
"setString",
"(",
"1",
",",
"tipo",
")",
";",
"pst",
".",
"setString",
"(",
"2",
",",
"cboOsSit",
".",
"getSelectedItem",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"pst",
".",
"setString",
"(",
"3",
",",
"txtOsEquip",
".",
"getText",
"(",
")",
")",
";",
"pst",
".",
"setString",
"(",
"4",
",",
"txtOsDef",
".",
"getText",
"(",
")",
")",
";",
"pst",
".",
"setString",
"(",
"5",
",",
"txtOsServ",
".",
"getText",
"(",
")",
")",
";",
"pst",
".",
"setString",
"(",
"6",
",",
"txtOsTec",
".",
"getText",
"(",
")",
")",
";",
"//.replace substitui a vírgula pelo ponto",
"pst",
".",
"setString",
"(",
"7",
",",
"txtOsValor",
".",
"getText",
"(",
")",
".",
"replace",
"(",
"\",\"",
",",
"\".\"",
")",
")",
";",
"pst",
".",
"setString",
"(",
"8",
",",
"txtCliId",
".",
"getText",
"(",
")",
")",
";",
"//validação dos campos obrigatórios",
"if",
"(",
"(",
"txtCliId",
".",
"getText",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"||",
"(",
"txtOsEquip",
".",
"getText",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"||",
"(",
"txtOsDef",
".",
"getText",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
")",
"{",
"JOptionPane",
".",
"showMessageDialog",
"(",
"null",
",",
"\"Preencha todos os campos obrigatórios\")",
";",
"",
"}",
"else",
"{",
"int",
"adicionado",
"=",
"pst",
".",
"executeUpdate",
"(",
")",
";",
"if",
"(",
"adicionado",
">",
"0",
")",
"{",
"JOptionPane",
".",
"showMessageDialog",
"(",
"null",
",",
"\"OS emitida com sucesso\"",
")",
";",
"txtCliId",
".",
"setText",
"(",
"null",
")",
";",
"txtOsEquip",
".",
"setText",
"(",
"null",
")",
";",
"txtOsDef",
".",
"setText",
"(",
"null",
")",
";",
"txtOsServ",
".",
"setText",
"(",
"null",
")",
";",
"txtOsTec",
".",
"setText",
"(",
"null",
")",
";",
"txtOsValor",
".",
"setText",
"(",
"null",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"JOptionPane",
".",
"showMessageDialog",
"(",
"null",
",",
"e",
")",
";",
"}",
"}"
] | [
57,
4
] | [
90,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
ProdutoDAO. | null | MÉTODOS: Inserir, Alterar, Excluir, Listar todos e Listar descrição. | MÉTODOS: Inserir, Alterar, Excluir, Listar todos e Listar descrição. | public void inserir(Produto produto) {
String sql = "INSERT INTO produto (descricao_produto, preco_produto) VALUES(?,?)";
try {
stmt = conn.prepareStatement(sql);
stmt.setString(1, produto.getDescricao_produto());
stmt.setDouble(2, produto.getPreco_produto());
stmt.execute();
stmt.close();
} catch (Exception erro) {
throw new RuntimeException("Erro 2: " + erro);
}
} | [
"public",
"void",
"inserir",
"(",
"Produto",
"produto",
")",
"{",
"String",
"sql",
"=",
"\"INSERT INTO produto (descricao_produto, preco_produto) VALUES(?,?)\"",
";",
"try",
"{",
"stmt",
"=",
"conn",
".",
"prepareStatement",
"(",
"sql",
")",
";",
"stmt",
".",
"setString",
"(",
"1",
",",
"produto",
".",
"getDescricao_produto",
"(",
")",
")",
";",
"stmt",
".",
"setDouble",
"(",
"2",
",",
"produto",
".",
"getPreco_produto",
"(",
")",
")",
";",
"stmt",
".",
"execute",
"(",
")",
";",
"stmt",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"erro",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Erro 2: \"",
"+",
"erro",
")",
";",
"}",
"}"
] | [
23,
4
] | [
34,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
JavaUtilCalendar. | null | criado na 1.1, contém campos específicos como MONTH, YEAR, HOUR, etc. | criado na 1.1, contém campos específicos como MONTH, YEAR, HOUR, etc. | public static void main(String[] args){
Calendar agora = Calendar.getInstance();
System.out.println(agora);
//java.util.GregorianCalendar[time=1624151724804,areFieldsSet=true,areAllFieldsSet=true,lenient=true,
// zone=sun.util.calendar.ZoneInfo[id="America/Sao_Paulo",
// offset=-10800000,
// dstSavings=0,
// useDaylight=false,
// transitions=93,
// lastRule=null],
// firstDayOfWeek=1,
// minimalDaysInFirstWeek=1,
// ERA=1,
// YEAR=2021,
// MONTH=5,
// WEEK_OF_YEAR=25,
// WEEK_OF_MONTH=3,
// DAY_OF_MONTH=19,
// DAY_OF_YEAR=170,
// DAY_OF_WEEK=7,
// DAY_OF_WEEK_IN_MONTH=3,
// AM_PM=1,
// HOUR=10,
// HOUR_OF_DAY=22,
// MINUTE=15,
// SECOND=24,
// MILLISECOND=804,
// ZONE_OFFSET=-10800000,
// DST_OFFSET=0]
//Manipulando:
System.out.println(agora.getTime());
agora.add(Calendar.DATE, -15);
System.out.println("15 dias atrás: "+agora.getTime());
agora.add(Calendar.MONTH, 4);
System.out.println("4 meses depois: "+agora.getTime());
agora.add(Calendar.YEAR,2);
System.out.println("2 anos depois: "+agora.getTime());
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"Calendar",
"agora",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"agora",
")",
";",
"//java.util.GregorianCalendar[time=1624151724804,areFieldsSet=true,areAllFieldsSet=true,lenient=true,",
"// zone=sun.util.calendar.ZoneInfo[id=\"America/Sao_Paulo\",",
"// offset=-10800000,",
"// dstSavings=0,",
"// useDaylight=false,",
"// transitions=93,",
"// lastRule=null],",
"// firstDayOfWeek=1,",
"// minimalDaysInFirstWeek=1,",
"// ERA=1,",
"// YEAR=2021,",
"// MONTH=5,",
"// WEEK_OF_YEAR=25,",
"// WEEK_OF_MONTH=3,",
"// DAY_OF_MONTH=19,",
"// DAY_OF_YEAR=170,",
"// DAY_OF_WEEK=7,",
"// DAY_OF_WEEK_IN_MONTH=3,",
"// AM_PM=1,",
"// HOUR=10,",
"// HOUR_OF_DAY=22,",
"// MINUTE=15,",
"// SECOND=24,",
"// MILLISECOND=804,",
"// ZONE_OFFSET=-10800000,",
"// DST_OFFSET=0]",
"//Manipulando:",
"System",
".",
"out",
".",
"println",
"(",
"agora",
".",
"getTime",
"(",
")",
")",
";",
"agora",
".",
"add",
"(",
"Calendar",
".",
"DATE",
",",
"-",
"15",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"15 dias atrás: \"+",
"a",
"gora.",
"g",
"etTime(",
")",
")",
";",
"",
"agora",
".",
"add",
"(",
"Calendar",
".",
"MONTH",
",",
"4",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"4 meses depois: \"",
"+",
"agora",
".",
"getTime",
"(",
")",
")",
";",
"agora",
".",
"add",
"(",
"Calendar",
".",
"YEAR",
",",
"2",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"2 anos depois: \"",
"+",
"agora",
".",
"getTime",
"(",
")",
")",
";",
"}"
] | [
6,
4
] | [
44,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
GerenciarArquivo. | null | Função para ler os imóveis do arquivo base | Função para ler os imóveis do arquivo base | public List<Imovel> leituraImoveis() throws Exception{
List<Imovel> imoveis = new ArrayList<>();
//Declaração de variáveis que serão utilizadas no processo de leitura
String linha, dados[];
try{
//Enquanto houver dados irá manipulá-los
while(input.hasNext()){
//Pega a linha completa do arquivo
linha = input.nextLine();
//Inserimos os dados separados pelo operador ';' em um array
dados = linha.split(";");
//Verifica o tipo de cada imóvel para tomar as decisões de acordo com o tipo
//Como o array é do tipo String, precisamos realizar a conversao dos dados
if(dados[0].equals("casa")){
Casa casa = new Casa();
//Converte o dado para float
casa.setValor(Float.parseFloat(dados[1]));
casa.setProprietario(dados[2]);
casa.setRua(dados[3]);
casa.setBairro(dados[4]);
casa.setCidade(dados[5]);
//Converte o dado para int
casa.setNumero(Integer.parseInt(dados[6]));
casa.setQuartos(Integer.parseInt(dados[7]));
casa.setBanheiros(Integer.parseInt(dados[8]));
casa.setAndares(Integer.parseInt(dados[9]));
//O arquivo contém o tipo int para designar true ou false, por isso fazemos essa validação
if(Integer.parseInt(dados[10]) == 1){
casa.setSala_jantar(true);
} else {
casa.setSala_jantar(false);
}
//Insere o imóvel na lista de imóveis
imoveis.add(casa);
//O processo descrito acima é realizado para os demais tipos de imóveis
} else if(dados[0].equals("apartamento")){
Apartamento apt = new Apartamento();
apt.setValor(Float.parseFloat(dados[1]));
apt.setProprietario(dados[2]);
apt.setRua(dados[3]);
apt.setBairro(dados[4]);
apt.setCidade(dados[5]);
apt.setNumero(Integer.parseInt(dados[6]));
apt.setQuartos(Integer.parseInt(dados[7]));
apt.setBanheiros(Integer.parseInt(dados[8]));
apt.setAndar(Integer.parseInt(dados[9]));
apt.setTaxa_condominio(Float.parseFloat(dados[10]));
if(Integer.parseInt(dados[11]) == 1){
apt.setElevador(true);
} else {
apt.setElevador(false);
}
if(Integer.parseInt(dados[12]) == 1){
apt.setSacada(true);
} else {
apt.setSacada(false);
}
imoveis.add(apt);
} else if(dados[0].equals("chacara")){
Chacara chacara = new Chacara();
chacara.setValor(Float.parseFloat(dados[1]));
chacara.setProprietario(dados[2]);
chacara.setRua(dados[3]);
chacara.setBairro(dados[4]);
chacara.setCidade(dados[5]);
chacara.setNumero(Integer.parseInt(dados[6]));
chacara.setQuartos(Integer.parseInt(dados[7]));
chacara.setBanheiros(Integer.parseInt(dados[8]));
if(Integer.parseInt(dados[9]) == 1){
chacara.setSalao_festas(true);
} else {
chacara.setSalao_festas(false);
}
if(Integer.parseInt(dados[10]) == 1){
chacara.setSalao_jogos(true);
} else {
chacara.setSalao_jogos(false);
}
if(Integer.parseInt(dados[11]) == 1){
chacara.setCampo_futebol(true);
} else {
chacara.setCampo_futebol(false);
}
if(Integer.parseInt(dados[12]) == 1){
chacara.setChurrasqueira(true);
} else {
chacara.setChurrasqueira(false);
}
if(Integer.parseInt(dados[13]) == 1){
chacara.setPiscina(true);
} else {
chacara.setPiscina(false);
}
imoveis.add(chacara);
}
}
//Erro se as informações no arquivo não estierem adequadamente formatadas
} catch(NoSuchElementException e){
throw new Exception("Informações do arquivo mal formatadas!");
}
//Erro se o Scanner foi fechado antes de dos dados serem inseridos
catch(IllegalStateException e){
throw new Exception("Erro de leitura no arquivo");
}
return imoveis;
} | [
"public",
"List",
"<",
"Imovel",
">",
"leituraImoveis",
"(",
")",
"throws",
"Exception",
"{",
"List",
"<",
"Imovel",
">",
"imoveis",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"//Declaração de variáveis que serão utilizadas no processo de leitura",
"String",
"linha",
",",
"dados",
"[",
"]",
";",
"try",
"{",
"//Enquanto houver dados irá manipulá-los",
"while",
"(",
"input",
".",
"hasNext",
"(",
")",
")",
"{",
"//Pega a linha completa do arquivo",
"linha",
"=",
"input",
".",
"nextLine",
"(",
")",
";",
"//Inserimos os dados separados pelo operador ';' em um array",
"dados",
"=",
"linha",
".",
"split",
"(",
"\";\"",
")",
";",
"//Verifica o tipo de cada imóvel para tomar as decisões de acordo com o tipo",
"//Como o array é do tipo String, precisamos realizar a conversao dos dados",
"if",
"(",
"dados",
"[",
"0",
"]",
".",
"equals",
"(",
"\"casa\"",
")",
")",
"{",
"Casa",
"casa",
"=",
"new",
"Casa",
"(",
")",
";",
"//Converte o dado para float",
"casa",
".",
"setValor",
"(",
"Float",
".",
"parseFloat",
"(",
"dados",
"[",
"1",
"]",
")",
")",
";",
"casa",
".",
"setProprietario",
"(",
"dados",
"[",
"2",
"]",
")",
";",
"casa",
".",
"setRua",
"(",
"dados",
"[",
"3",
"]",
")",
";",
"casa",
".",
"setBairro",
"(",
"dados",
"[",
"4",
"]",
")",
";",
"casa",
".",
"setCidade",
"(",
"dados",
"[",
"5",
"]",
")",
";",
"//Converte o dado para int",
"casa",
".",
"setNumero",
"(",
"Integer",
".",
"parseInt",
"(",
"dados",
"[",
"6",
"]",
")",
")",
";",
"casa",
".",
"setQuartos",
"(",
"Integer",
".",
"parseInt",
"(",
"dados",
"[",
"7",
"]",
")",
")",
";",
"casa",
".",
"setBanheiros",
"(",
"Integer",
".",
"parseInt",
"(",
"dados",
"[",
"8",
"]",
")",
")",
";",
"casa",
".",
"setAndares",
"(",
"Integer",
".",
"parseInt",
"(",
"dados",
"[",
"9",
"]",
")",
")",
";",
"//O arquivo contém o tipo int para designar true ou false, por isso fazemos essa validação",
"if",
"(",
"Integer",
".",
"parseInt",
"(",
"dados",
"[",
"10",
"]",
")",
"==",
"1",
")",
"{",
"casa",
".",
"setSala_jantar",
"(",
"true",
")",
";",
"}",
"else",
"{",
"casa",
".",
"setSala_jantar",
"(",
"false",
")",
";",
"}",
"//Insere o imóvel na lista de imóveis ",
"imoveis",
".",
"add",
"(",
"casa",
")",
";",
"//O processo descrito acima é realizado para os demais tipos de imóveis",
"}",
"else",
"if",
"(",
"dados",
"[",
"0",
"]",
".",
"equals",
"(",
"\"apartamento\"",
")",
")",
"{",
"Apartamento",
"apt",
"=",
"new",
"Apartamento",
"(",
")",
";",
"apt",
".",
"setValor",
"(",
"Float",
".",
"parseFloat",
"(",
"dados",
"[",
"1",
"]",
")",
")",
";",
"apt",
".",
"setProprietario",
"(",
"dados",
"[",
"2",
"]",
")",
";",
"apt",
".",
"setRua",
"(",
"dados",
"[",
"3",
"]",
")",
";",
"apt",
".",
"setBairro",
"(",
"dados",
"[",
"4",
"]",
")",
";",
"apt",
".",
"setCidade",
"(",
"dados",
"[",
"5",
"]",
")",
";",
"apt",
".",
"setNumero",
"(",
"Integer",
".",
"parseInt",
"(",
"dados",
"[",
"6",
"]",
")",
")",
";",
"apt",
".",
"setQuartos",
"(",
"Integer",
".",
"parseInt",
"(",
"dados",
"[",
"7",
"]",
")",
")",
";",
"apt",
".",
"setBanheiros",
"(",
"Integer",
".",
"parseInt",
"(",
"dados",
"[",
"8",
"]",
")",
")",
";",
"apt",
".",
"setAndar",
"(",
"Integer",
".",
"parseInt",
"(",
"dados",
"[",
"9",
"]",
")",
")",
";",
"apt",
".",
"setTaxa_condominio",
"(",
"Float",
".",
"parseFloat",
"(",
"dados",
"[",
"10",
"]",
")",
")",
";",
"if",
"(",
"Integer",
".",
"parseInt",
"(",
"dados",
"[",
"11",
"]",
")",
"==",
"1",
")",
"{",
"apt",
".",
"setElevador",
"(",
"true",
")",
";",
"}",
"else",
"{",
"apt",
".",
"setElevador",
"(",
"false",
")",
";",
"}",
"if",
"(",
"Integer",
".",
"parseInt",
"(",
"dados",
"[",
"12",
"]",
")",
"==",
"1",
")",
"{",
"apt",
".",
"setSacada",
"(",
"true",
")",
";",
"}",
"else",
"{",
"apt",
".",
"setSacada",
"(",
"false",
")",
";",
"}",
"imoveis",
".",
"add",
"(",
"apt",
")",
";",
"}",
"else",
"if",
"(",
"dados",
"[",
"0",
"]",
".",
"equals",
"(",
"\"chacara\"",
")",
")",
"{",
"Chacara",
"chacara",
"=",
"new",
"Chacara",
"(",
")",
";",
"chacara",
".",
"setValor",
"(",
"Float",
".",
"parseFloat",
"(",
"dados",
"[",
"1",
"]",
")",
")",
";",
"chacara",
".",
"setProprietario",
"(",
"dados",
"[",
"2",
"]",
")",
";",
"chacara",
".",
"setRua",
"(",
"dados",
"[",
"3",
"]",
")",
";",
"chacara",
".",
"setBairro",
"(",
"dados",
"[",
"4",
"]",
")",
";",
"chacara",
".",
"setCidade",
"(",
"dados",
"[",
"5",
"]",
")",
";",
"chacara",
".",
"setNumero",
"(",
"Integer",
".",
"parseInt",
"(",
"dados",
"[",
"6",
"]",
")",
")",
";",
"chacara",
".",
"setQuartos",
"(",
"Integer",
".",
"parseInt",
"(",
"dados",
"[",
"7",
"]",
")",
")",
";",
"chacara",
".",
"setBanheiros",
"(",
"Integer",
".",
"parseInt",
"(",
"dados",
"[",
"8",
"]",
")",
")",
";",
"if",
"(",
"Integer",
".",
"parseInt",
"(",
"dados",
"[",
"9",
"]",
")",
"==",
"1",
")",
"{",
"chacara",
".",
"setSalao_festas",
"(",
"true",
")",
";",
"}",
"else",
"{",
"chacara",
".",
"setSalao_festas",
"(",
"false",
")",
";",
"}",
"if",
"(",
"Integer",
".",
"parseInt",
"(",
"dados",
"[",
"10",
"]",
")",
"==",
"1",
")",
"{",
"chacara",
".",
"setSalao_jogos",
"(",
"true",
")",
";",
"}",
"else",
"{",
"chacara",
".",
"setSalao_jogos",
"(",
"false",
")",
";",
"}",
"if",
"(",
"Integer",
".",
"parseInt",
"(",
"dados",
"[",
"11",
"]",
")",
"==",
"1",
")",
"{",
"chacara",
".",
"setCampo_futebol",
"(",
"true",
")",
";",
"}",
"else",
"{",
"chacara",
".",
"setCampo_futebol",
"(",
"false",
")",
";",
"}",
"if",
"(",
"Integer",
".",
"parseInt",
"(",
"dados",
"[",
"12",
"]",
")",
"==",
"1",
")",
"{",
"chacara",
".",
"setChurrasqueira",
"(",
"true",
")",
";",
"}",
"else",
"{",
"chacara",
".",
"setChurrasqueira",
"(",
"false",
")",
";",
"}",
"if",
"(",
"Integer",
".",
"parseInt",
"(",
"dados",
"[",
"13",
"]",
")",
"==",
"1",
")",
"{",
"chacara",
".",
"setPiscina",
"(",
"true",
")",
";",
"}",
"else",
"{",
"chacara",
".",
"setPiscina",
"(",
"false",
")",
";",
"}",
"imoveis",
".",
"add",
"(",
"chacara",
")",
";",
"}",
"}",
"//Erro se as informações no arquivo não estierem adequadamente formatadas",
"}",
"catch",
"(",
"NoSuchElementException",
"e",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"Informações do arquivo mal formatadas!\");",
"",
"",
"}",
"//Erro se o Scanner foi fechado antes de dos dados serem inseridos",
"catch",
"(",
"IllegalStateException",
"e",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"Erro de leitura no arquivo\"",
")",
";",
"}",
"return",
"imoveis",
";",
"}"
] | [
73,
4
] | [
182,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
PessoaController. | null | cadastra um contato | cadastra um contato | @PostMapping(value = "/cadastrar")
public ResponseEntity<Pessoa> cadastrar(@Valid @RequestBody Pessoa pessoa){
return new ResponseEntity<Pessoa>(pessoaService.cadastrar(pessoa), HttpStatus.CREATED);
} | [
"@",
"PostMapping",
"(",
"value",
"=",
"\"/cadastrar\"",
")",
"public",
"ResponseEntity",
"<",
"Pessoa",
">",
"cadastrar",
"(",
"@",
"Valid",
"@",
"RequestBody",
"Pessoa",
"pessoa",
")",
"{",
"return",
"new",
"ResponseEntity",
"<",
"Pessoa",
">",
"(",
"pessoaService",
".",
"cadastrar",
"(",
"pessoa",
")",
",",
"HttpStatus",
".",
"CREATED",
")",
";",
"}"
] | [
20,
4
] | [
23,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
BioterioController. | null | Retorna uma lista de bioterios | Retorna uma lista de bioterios | @RequestMapping(value="/", method=RequestMethod.GET)
@ApiOperation(value="Retorna uma lista de bioterios")
public ResponseEntity<?> listaBioterios(){
List<Bioterio> obj = bioterioService.listaBioterios();
return ResponseEntity.ok().body(obj);
} | [
"@",
"RequestMapping",
"(",
"value",
"=",
"\"/\"",
",",
"method",
"=",
"RequestMethod",
".",
"GET",
")",
"@",
"ApiOperation",
"(",
"value",
"=",
"\"Retorna uma lista de bioterios\"",
")",
"public",
"ResponseEntity",
"<",
"?",
">",
"listaBioterios",
"(",
")",
"{",
"List",
"<",
"Bioterio",
">",
"obj",
"=",
"bioterioService",
".",
"listaBioterios",
"(",
")",
";",
"return",
"ResponseEntity",
".",
"ok",
"(",
")",
".",
"body",
"(",
"obj",
")",
";",
"}"
] | [
29,
1
] | [
34,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
WorkloadGenerator. | null | Alex apenas para Experimento | Alex apenas para Experimento | private void generate2() {
String sep = System.getProperty("file.separator");
String path = "config" + sep + "workloadP_BFT_SMART";
File f = new File(path);
if (!f.exists()) {
f.mkdirs();
}
path = path + sep + "workload_lista" + percent + "_" + operations.length + ".txt";
f = new File(path);
if (f.exists()) {
load(path);
} else {
try {
FileWriter fw = new FileWriter(f);
PrintWriter pw = new PrintWriter(fw);
Random rand = new Random();
int op = 0;
int num = 0;
int cnf = 0;
int ncnf = 0;
int ncnfT = 0;
int cnfT = 0;
while (num < this.operations.length) {
//0% conflitantes
while (num < this.operations.length * 0.1) {
op = BFTList.CONTAINS;
pw.println(op);
this.operations[num] = op;
num++;
}
//10% conflitantes
while (num < this.operations.length * 0.2) {
if (num < (this.operations.length * 0.2) * 0.1) {
op = BFTList.ADD;
} else {
op = BFTList.CONTAINS;
}
pw.println(op);
this.operations[num] = op;
num++;
}
//20% conflitantes
while (num < this.operations.length * 0.3) {
if (num < (this.operations.length * 0.3) * 0.2) {
op = BFTList.ADD;
} else {
op = BFTList.CONTAINS;
}
pw.println(op);
this.operations[num] = op;
num++;
}
//30% conflitantes
while (num < this.operations.length * 0.4) {
if (num < (this.operations.length * 0.4) * 0.3) {
op = BFTList.ADD;
} else {
op = BFTList.CONTAINS;
}
pw.println(op);
this.operations[num] = op;
num++;
}
//40% conflitantes
while (num < this.operations.length * 0.5) {
if (num < (this.operations.length * 0.5) * 0.4) {
op = BFTList.ADD;
} else {
op = BFTList.CONTAINS;
}
pw.println(op);
this.operations[num] = op;
num++;
}
//50% conflitantes
while (num < this.operations.length * 0.6) {
if (num < (this.operations.length * 0.6) * 0.5) {
op = BFTList.ADD;
} else {
op = BFTList.CONTAINS;
}
pw.println(op);
this.operations[num] = op;
num++;
}
//60% conflitantes
while (num < this.operations.length * 0.7) {
if (num < (this.operations.length * 0.7) * 0.6) {
op = BFTList.ADD;
} else {
op = BFTList.CONTAINS;
}
pw.println(op);
this.operations[num] = op;
num++;
}
//70% conflitantes
while (num < this.operations.length * 0.8) {
if (num < (this.operations.length * 0.8) * 0.7) {
op = BFTList.ADD;
} else {
op = BFTList.CONTAINS;
}
pw.println(op);
this.operations[num] = op;
num++;
}
//80% conflitantes
while (num < this.operations.length * 0.9) {
if (num < (this.operations.length * 0.9) * 0.8) {
op = BFTList.ADD;
} else {
op = BFTList.CONTAINS;
}
pw.println(op);
this.operations[num] = op;
num++;
}
//100%conflitantes
while (num < this.operations.length * 1) {
op = BFTList.ADD;
pw.println(op);
this.operations[num] = op;
num++;
}
/*
//50%conflitantes
ncnfT = ((100 - 50) * this.operations.length) / 100;
cnfT = (50 * this.operations.length) / 100;
while (num < this.operations.length * 0.6) {
int r = rand.nextInt(100);
if ((cnf == cnfT) || (r >= percent && ncnf < ncnfT)) {
ncnf++;
//nao conflitantes
r = rand.nextInt(2);
//if(r >= 2){
//CONTAINS
//op = BFTList.CONTAINS;
//}else
if (r >= 1) {
//SIZE
//op = BFTList.SIZE;
op = BFTList.CONTAINS;
} else {
//GET
op = BFTList.GET;
}
} else {
cnf++;
//conflitante
r = rand.nextInt(2);
if (r >= 1) {
//ADD
op = BFTList.ADD;
} else {
//REMOVE
op = BFTList.REMOVE;
}
}
pw.println(op);
this.operations[num] = op;
num++;
}
//75%conflitantes
ncnfT = ((100 - 75) * this.operations.length) / 100;
cnfT = (75 * this.operations.length) / 100;
while (num < this.operations.length * 0.8) {
int r = rand.nextInt(100);
if ((cnf == cnfT) || (r >= percent && ncnf < ncnfT)) {
ncnf++;
//nao conflitantes
r = rand.nextInt(2);
//if(r >= 2){
//CONTAINS
//op = BFTList.CONTAINS;
//}else
if (r >= 1) {
//SIZE
//op = BFTList.SIZE;
op = BFTList.CONTAINS;
} else {
//GET
op = BFTList.GET;
}
} else {
cnf++;
//conflitante
r = rand.nextInt(2);
if (r >= 1) {
//ADD
op = BFTList.ADD;
} else {
//REMOVE
op = BFTList.REMOVE;
}
}
pw.println(op);
this.operations[num] = op;
num++;
}
//25%conflitantes
ncnfT = ((100 - 25) * this.operations.length) / 100;
cnfT = (25 * this.operations.length) / 100;
while (num < this.operations.length) {
int r = rand.nextInt(100);
if ((cnf == cnfT) || (r >= percent && ncnf < ncnfT)) {
ncnf++;
//nao conflitantes
r = rand.nextInt(2);
//if(r >= 2){
//CONTAINS
//op = BFTList.CONTAINS;
//}else
if (r >= 1) {
//SIZE
//op = BFTList.SIZE;
op = BFTList.CONTAINS;
} else {
//GET
op = BFTList.GET;
}
} else {
cnf++;
//conflitante
r = rand.nextInt(2);
if (r >= 1) {
//ADD
op = BFTList.ADD;
} else {
//REMOVE
op = BFTList.REMOVE;
}
}
pw.println(op);
this.operations[num] = op;
num++;
}
*/
}
pw.flush();
fw.flush();
pw.close();
fw.close();
System.out.println("Conflitantes: " + cnf);
System.out.println("Não Conflitantes: " + ncnf);
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
} | [
"private",
"void",
"generate2",
"(",
")",
"{",
"String",
"sep",
"=",
"System",
".",
"getProperty",
"(",
"\"file.separator\"",
")",
";",
"String",
"path",
"=",
"\"config\"",
"+",
"sep",
"+",
"\"workloadP_BFT_SMART\"",
";",
"File",
"f",
"=",
"new",
"File",
"(",
"path",
")",
";",
"if",
"(",
"!",
"f",
".",
"exists",
"(",
")",
")",
"{",
"f",
".",
"mkdirs",
"(",
")",
";",
"}",
"path",
"=",
"path",
"+",
"sep",
"+",
"\"workload_lista\"",
"+",
"percent",
"+",
"\"_\"",
"+",
"operations",
".",
"length",
"+",
"\".txt\"",
";",
"f",
"=",
"new",
"File",
"(",
"path",
")",
";",
"if",
"(",
"f",
".",
"exists",
"(",
")",
")",
"{",
"load",
"(",
"path",
")",
";",
"}",
"else",
"{",
"try",
"{",
"FileWriter",
"fw",
"=",
"new",
"FileWriter",
"(",
"f",
")",
";",
"PrintWriter",
"pw",
"=",
"new",
"PrintWriter",
"(",
"fw",
")",
";",
"Random",
"rand",
"=",
"new",
"Random",
"(",
")",
";",
"int",
"op",
"=",
"0",
";",
"int",
"num",
"=",
"0",
";",
"int",
"cnf",
"=",
"0",
";",
"int",
"ncnf",
"=",
"0",
";",
"int",
"ncnfT",
"=",
"0",
";",
"int",
"cnfT",
"=",
"0",
";",
"while",
"(",
"num",
"<",
"this",
".",
"operations",
".",
"length",
")",
"{",
"//0% conflitantes",
"while",
"(",
"num",
"<",
"this",
".",
"operations",
".",
"length",
"*",
"0.1",
")",
"{",
"op",
"=",
"BFTList",
".",
"CONTAINS",
";",
"pw",
".",
"println",
"(",
"op",
")",
";",
"this",
".",
"operations",
"[",
"num",
"]",
"=",
"op",
";",
"num",
"++",
";",
"}",
"//10% conflitantes",
"while",
"(",
"num",
"<",
"this",
".",
"operations",
".",
"length",
"*",
"0.2",
")",
"{",
"if",
"(",
"num",
"<",
"(",
"this",
".",
"operations",
".",
"length",
"*",
"0.2",
")",
"*",
"0.1",
")",
"{",
"op",
"=",
"BFTList",
".",
"ADD",
";",
"}",
"else",
"{",
"op",
"=",
"BFTList",
".",
"CONTAINS",
";",
"}",
"pw",
".",
"println",
"(",
"op",
")",
";",
"this",
".",
"operations",
"[",
"num",
"]",
"=",
"op",
";",
"num",
"++",
";",
"}",
"//20% conflitantes",
"while",
"(",
"num",
"<",
"this",
".",
"operations",
".",
"length",
"*",
"0.3",
")",
"{",
"if",
"(",
"num",
"<",
"(",
"this",
".",
"operations",
".",
"length",
"*",
"0.3",
")",
"*",
"0.2",
")",
"{",
"op",
"=",
"BFTList",
".",
"ADD",
";",
"}",
"else",
"{",
"op",
"=",
"BFTList",
".",
"CONTAINS",
";",
"}",
"pw",
".",
"println",
"(",
"op",
")",
";",
"this",
".",
"operations",
"[",
"num",
"]",
"=",
"op",
";",
"num",
"++",
";",
"}",
"//30% conflitantes",
"while",
"(",
"num",
"<",
"this",
".",
"operations",
".",
"length",
"*",
"0.4",
")",
"{",
"if",
"(",
"num",
"<",
"(",
"this",
".",
"operations",
".",
"length",
"*",
"0.4",
")",
"*",
"0.3",
")",
"{",
"op",
"=",
"BFTList",
".",
"ADD",
";",
"}",
"else",
"{",
"op",
"=",
"BFTList",
".",
"CONTAINS",
";",
"}",
"pw",
".",
"println",
"(",
"op",
")",
";",
"this",
".",
"operations",
"[",
"num",
"]",
"=",
"op",
";",
"num",
"++",
";",
"}",
"//40% conflitantes",
"while",
"(",
"num",
"<",
"this",
".",
"operations",
".",
"length",
"*",
"0.5",
")",
"{",
"if",
"(",
"num",
"<",
"(",
"this",
".",
"operations",
".",
"length",
"*",
"0.5",
")",
"*",
"0.4",
")",
"{",
"op",
"=",
"BFTList",
".",
"ADD",
";",
"}",
"else",
"{",
"op",
"=",
"BFTList",
".",
"CONTAINS",
";",
"}",
"pw",
".",
"println",
"(",
"op",
")",
";",
"this",
".",
"operations",
"[",
"num",
"]",
"=",
"op",
";",
"num",
"++",
";",
"}",
"//50% conflitantes",
"while",
"(",
"num",
"<",
"this",
".",
"operations",
".",
"length",
"*",
"0.6",
")",
"{",
"if",
"(",
"num",
"<",
"(",
"this",
".",
"operations",
".",
"length",
"*",
"0.6",
")",
"*",
"0.5",
")",
"{",
"op",
"=",
"BFTList",
".",
"ADD",
";",
"}",
"else",
"{",
"op",
"=",
"BFTList",
".",
"CONTAINS",
";",
"}",
"pw",
".",
"println",
"(",
"op",
")",
";",
"this",
".",
"operations",
"[",
"num",
"]",
"=",
"op",
";",
"num",
"++",
";",
"}",
"//60% conflitantes",
"while",
"(",
"num",
"<",
"this",
".",
"operations",
".",
"length",
"*",
"0.7",
")",
"{",
"if",
"(",
"num",
"<",
"(",
"this",
".",
"operations",
".",
"length",
"*",
"0.7",
")",
"*",
"0.6",
")",
"{",
"op",
"=",
"BFTList",
".",
"ADD",
";",
"}",
"else",
"{",
"op",
"=",
"BFTList",
".",
"CONTAINS",
";",
"}",
"pw",
".",
"println",
"(",
"op",
")",
";",
"this",
".",
"operations",
"[",
"num",
"]",
"=",
"op",
";",
"num",
"++",
";",
"}",
"//70% conflitantes",
"while",
"(",
"num",
"<",
"this",
".",
"operations",
".",
"length",
"*",
"0.8",
")",
"{",
"if",
"(",
"num",
"<",
"(",
"this",
".",
"operations",
".",
"length",
"*",
"0.8",
")",
"*",
"0.7",
")",
"{",
"op",
"=",
"BFTList",
".",
"ADD",
";",
"}",
"else",
"{",
"op",
"=",
"BFTList",
".",
"CONTAINS",
";",
"}",
"pw",
".",
"println",
"(",
"op",
")",
";",
"this",
".",
"operations",
"[",
"num",
"]",
"=",
"op",
";",
"num",
"++",
";",
"}",
"//80% conflitantes",
"while",
"(",
"num",
"<",
"this",
".",
"operations",
".",
"length",
"*",
"0.9",
")",
"{",
"if",
"(",
"num",
"<",
"(",
"this",
".",
"operations",
".",
"length",
"*",
"0.9",
")",
"*",
"0.8",
")",
"{",
"op",
"=",
"BFTList",
".",
"ADD",
";",
"}",
"else",
"{",
"op",
"=",
"BFTList",
".",
"CONTAINS",
";",
"}",
"pw",
".",
"println",
"(",
"op",
")",
";",
"this",
".",
"operations",
"[",
"num",
"]",
"=",
"op",
";",
"num",
"++",
";",
"}",
"//100%conflitantes",
"while",
"(",
"num",
"<",
"this",
".",
"operations",
".",
"length",
"*",
"1",
")",
"{",
"op",
"=",
"BFTList",
".",
"ADD",
";",
"pw",
".",
"println",
"(",
"op",
")",
";",
"this",
".",
"operations",
"[",
"num",
"]",
"=",
"op",
";",
"num",
"++",
";",
"}",
"/*\n //50%conflitantes\n ncnfT = ((100 - 50) * this.operations.length) / 100;\n cnfT = (50 * this.operations.length) / 100;\n\n while (num < this.operations.length * 0.6) {\n int r = rand.nextInt(100);\n if ((cnf == cnfT) || (r >= percent && ncnf < ncnfT)) {\n ncnf++;\n //nao conflitantes\n r = rand.nextInt(2);\n //if(r >= 2){\n //CONTAINS\n //op = BFTList.CONTAINS;\n //}else\n if (r >= 1) {\n //SIZE\n //op = BFTList.SIZE;\n op = BFTList.CONTAINS;\n\n } else {\n //GET\n op = BFTList.GET;\n }\n } else {\n cnf++;\n //conflitante\n r = rand.nextInt(2);\n if (r >= 1) {\n //ADD\n op = BFTList.ADD;\n } else {\n //REMOVE\n op = BFTList.REMOVE;\n }\n }\n\n pw.println(op);\n this.operations[num] = op;\n num++;\n }\n\n //75%conflitantes\n ncnfT = ((100 - 75) * this.operations.length) / 100;\n cnfT = (75 * this.operations.length) / 100;\n\n while (num < this.operations.length * 0.8) {\n int r = rand.nextInt(100);\n if ((cnf == cnfT) || (r >= percent && ncnf < ncnfT)) {\n ncnf++;\n //nao conflitantes\n r = rand.nextInt(2);\n //if(r >= 2){\n //CONTAINS\n //op = BFTList.CONTAINS;\n //}else\n if (r >= 1) {\n //SIZE\n //op = BFTList.SIZE;\n op = BFTList.CONTAINS;\n\n } else {\n //GET\n op = BFTList.GET;\n }\n } else {\n cnf++;\n //conflitante\n r = rand.nextInt(2);\n if (r >= 1) {\n //ADD\n op = BFTList.ADD;\n } else {\n //REMOVE\n op = BFTList.REMOVE;\n }\n }\n\n pw.println(op);\n this.operations[num] = op;\n num++;\n }\n\n //25%conflitantes\n ncnfT = ((100 - 25) * this.operations.length) / 100;\n cnfT = (25 * this.operations.length) / 100;\n while (num < this.operations.length) {\n int r = rand.nextInt(100);\n if ((cnf == cnfT) || (r >= percent && ncnf < ncnfT)) {\n ncnf++;\n //nao conflitantes\n r = rand.nextInt(2);\n //if(r >= 2){\n //CONTAINS\n //op = BFTList.CONTAINS;\n //}else\n if (r >= 1) {\n //SIZE\n //op = BFTList.SIZE;\n op = BFTList.CONTAINS;\n\n } else {\n //GET\n op = BFTList.GET;\n }\n } else {\n cnf++;\n //conflitante\n r = rand.nextInt(2);\n if (r >= 1) {\n //ADD\n op = BFTList.ADD;\n } else {\n //REMOVE\n op = BFTList.REMOVE;\n }\n }\n\n pw.println(op);\n this.operations[num] = op;\n num++;\n }\n */",
"}",
"pw",
".",
"flush",
"(",
")",
";",
"fw",
".",
"flush",
"(",
")",
";",
"pw",
".",
"close",
"(",
")",
";",
"fw",
".",
"close",
"(",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Conflitantes: \"",
"+",
"cnf",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Não Conflitantes: \" ",
" ",
"cnf)",
";",
"",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"ioe",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"}"
] | [
127,
4
] | [
416,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
MissionController. | null | No corpo da resposta irá retornar a lista, busca páginada | No corpo da resposta irá retornar a lista, busca páginada | @GetMapping
public ResponseEntity<Page<MissionDTO>> findAll(Pageable pageable){
Page<MissionDTO> list = service.findAll(pageable);
return ResponseEntity.ok(list);
} | [
"@",
"GetMapping",
"public",
"ResponseEntity",
"<",
"Page",
"<",
"MissionDTO",
">",
">",
"findAll",
"(",
"Pageable",
"pageable",
")",
"{",
"Page",
"<",
"MissionDTO",
">",
"list",
"=",
"service",
".",
"findAll",
"(",
"pageable",
")",
";",
"return",
"ResponseEntity",
".",
"ok",
"(",
"list",
")",
";",
"}"
] | [
24,
4
] | [
28,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Serial. | null | Seleciona o tipo de formatação de acordo com o equipamento | Seleciona o tipo de formatação de acordo com o equipamento | public Map<String, String> selecionarDadosEquipamento() {
switch (equipamento) {
case "WT1000N":
//Retorna dados formatados do WT1000N
return Formatacao.formatarDadosWT1000N(receberDadosSerial());
case "3101C":
//Retorna dados formatados do 3101C
return Formatacao.formatarDados3101C(receberDadosSerial());
case "WT27":
//Retorna dados formatados do WT27
return Formatacao.formatarDadosWT27(receberDadosSerial());
}
return null;
} | [
"public",
"Map",
"<",
"String",
",",
"String",
">",
"selecionarDadosEquipamento",
"(",
")",
"{",
"switch",
"(",
"equipamento",
")",
"{",
"case",
"\"WT1000N\"",
":",
"//Retorna dados formatados do WT1000N\r",
"return",
"Formatacao",
".",
"formatarDadosWT1000N",
"(",
"receberDadosSerial",
"(",
")",
")",
";",
"case",
"\"3101C\"",
":",
"//Retorna dados formatados do 3101C\r",
"return",
"Formatacao",
".",
"formatarDados3101C",
"(",
"receberDadosSerial",
"(",
")",
")",
";",
"case",
"\"WT27\"",
":",
"//Retorna dados formatados do WT27\r",
"return",
"Formatacao",
".",
"formatarDadosWT27",
"(",
"receberDadosSerial",
"(",
")",
")",
";",
"}",
"return",
"null",
";",
"}"
] | [
195,
4
] | [
208,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
DesafioMeuTimeApplication. | null | Realiza a inclusão de um novo time. | Realiza a inclusão de um novo time. | @Desafio("incluirTime")
public void incluirTime(Long id, String nome, LocalDate dataCriacao, String corUniformePrincipal, String corUniformeSecundario) {
//Caso o identificador já exista, retornar br.com.codenation.desafio.exceptions.IdentificadorUtilizadoException
if(this.buscaTimePeloId(id).isPresent())
throw new IdentificadorUtilizadoException();
else
this.times.add(new Time(id, nome, dataCriacao, corUniformePrincipal, corUniformeSecundario));
} | [
"@",
"Desafio",
"(",
"\"incluirTime\"",
")",
"public",
"void",
"incluirTime",
"(",
"Long",
"id",
",",
"String",
"nome",
",",
"LocalDate",
"dataCriacao",
",",
"String",
"corUniformePrincipal",
",",
"String",
"corUniformeSecundario",
")",
"{",
"//Caso o identificador já exista, retornar br.com.codenation.desafio.exceptions.IdentificadorUtilizadoException",
"if",
"(",
"this",
".",
"buscaTimePeloId",
"(",
"id",
")",
".",
"isPresent",
"(",
")",
")",
"throw",
"new",
"IdentificadorUtilizadoException",
"(",
")",
";",
"else",
"this",
".",
"times",
".",
"add",
"(",
"new",
"Time",
"(",
"id",
",",
"nome",
",",
"dataCriacao",
",",
"corUniformePrincipal",
",",
"corUniformeSecundario",
")",
")",
";",
"}"
] | [
22,
1
] | [
29,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
JogoBarata. | null | Painel para escolher se quer jogar novamente ou quer sair do jogo | Painel para escolher se quer jogar novamente ou quer sair do jogo | public void escolha() {
int op = JOptionPane.showConfirmDialog(null, "Deseja continuar jogando?");
if (op == 0) {
conta = 0;
lContando.setText(conta + "");
segundos = 20;
lContandoTempo.setText(segundos + "");
Tempo thread = new Tempo();
thread.start();
feitoInfinito = false;
while (true) {
if (feitoInfinito) {
return;
} else {
try { Thread.sleep(850); } catch (Exception erro) {}
lBarata.setIcon(iconBarata);
x = (int) (Math.random() * 620);
y = (int) (Math.random() * 520);
lBarata.setBounds(x, y, 321, 304);
}
}
} else if (op == 1) {
System.exit(0);
} else {
System.exit(0);
}
} | [
"public",
"void",
"escolha",
"(",
")",
"{",
"int",
"op",
"=",
"JOptionPane",
".",
"showConfirmDialog",
"(",
"null",
",",
"\"Deseja continuar jogando?\"",
")",
";",
"if",
"(",
"op",
"==",
"0",
")",
"{",
"conta",
"=",
"0",
";",
"lContando",
".",
"setText",
"(",
"conta",
"+",
"\"\"",
")",
";",
"segundos",
"=",
"20",
";",
"lContandoTempo",
".",
"setText",
"(",
"segundos",
"+",
"\"\"",
")",
";",
"Tempo",
"thread",
"=",
"new",
"Tempo",
"(",
")",
";",
"thread",
".",
"start",
"(",
")",
";",
"feitoInfinito",
"=",
"false",
";",
"while",
"(",
"true",
")",
"{",
"if",
"(",
"feitoInfinito",
")",
"{",
"return",
";",
"}",
"else",
"{",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"850",
")",
";",
"}",
"catch",
"(",
"Exception",
"erro",
")",
"{",
"}",
"lBarata",
".",
"setIcon",
"(",
"iconBarata",
")",
";",
"x",
"=",
"(",
"int",
")",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"620",
")",
";",
"y",
"=",
"(",
"int",
")",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"520",
")",
";",
"lBarata",
".",
"setBounds",
"(",
"x",
",",
"y",
",",
"321",
",",
"304",
")",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"op",
"==",
"1",
")",
"{",
"System",
".",
"exit",
"(",
"0",
")",
";",
"}",
"else",
"{",
"System",
".",
"exit",
"(",
"0",
")",
";",
"}",
"}"
] | [
50,
4
] | [
76,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Login. | null | Método privado para cerrar ventana | Método privado para cerrar ventana | private void BotonCerrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonCerrarActionPerformed
// Cierra ventana cuando es clickeado el botón de cerrar ventana
System.out.println("Saliendo de ventana " + getTitle());
System.exit(0);
} | [
"private",
"void",
"BotonCerrarActionPerformed",
"(",
"java",
".",
"awt",
".",
"event",
".",
"ActionEvent",
"evt",
")",
"{",
"//GEN-FIRST:event_BotonCerrarActionPerformed",
"// Cierra ventana cuando es clickeado el botón de cerrar ventana",
"System",
".",
"out",
".",
"println",
"(",
"\"Saliendo de ventana \"",
"+",
"getTitle",
"(",
")",
")",
";",
"System",
".",
"exit",
"(",
"0",
")",
";",
"}"
] | [
519,
4
] | [
523,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
ReservaService. | null | Regra de Negócio 1: Cliente não pode ter multas não pagas | Regra de Negócio 1: Cliente não pode ter multas não pagas | public boolean verificarRegrasDeNegocio(Reserva obj) {
// Regra de Negócio 1: Cliente não pode ter multas não pagas
Collection<Cliente> devedores = clienteRepository.findDevedores();
boolean clienteDevedor = false;
for (Cliente devedor : devedores) {
if (devedor.getId() == obj.getCliente().getId()) {
clienteDevedor = true;
}
}
if (clienteDevedor) {
throw new BusinessRuleException("Este cliente deve multas anteriores!");
}
return true;
} | [
"public",
"boolean",
"verificarRegrasDeNegocio",
"(",
"Reserva",
"obj",
")",
"{",
"// Regra de Negócio 1: Cliente não pode ter multas não pagas",
"Collection",
"<",
"Cliente",
">",
"devedores",
"=",
"clienteRepository",
".",
"findDevedores",
"(",
")",
";",
"boolean",
"clienteDevedor",
"=",
"false",
";",
"for",
"(",
"Cliente",
"devedor",
":",
"devedores",
")",
"{",
"if",
"(",
"devedor",
".",
"getId",
"(",
")",
"==",
"obj",
".",
"getCliente",
"(",
")",
".",
"getId",
"(",
")",
")",
"{",
"clienteDevedor",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"clienteDevedor",
")",
"{",
"throw",
"new",
"BusinessRuleException",
"(",
"\"Este cliente deve multas anteriores!\"",
")",
";",
"}",
"return",
"true",
";",
"}"
] | [
82,
2
] | [
96,
3
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
UMCarroJa. | null | MaisPerto e MaisBarato | MaisPerto e MaisBarato | public Rental rental(Client c, Point dest, String preference, Car.CarType a)
throws UnknownCompareTypeException, NoCarAvaliableException {
Car car = cars.getCar(preference, dest, c.getPos(), a);
Rental r = new Rental(car, c, dest);
car.pendingRental(r);
return r;
} | [
"public",
"Rental",
"rental",
"(",
"Client",
"c",
",",
"Point",
"dest",
",",
"String",
"preference",
",",
"Car",
".",
"CarType",
"a",
")",
"throws",
"UnknownCompareTypeException",
",",
"NoCarAvaliableException",
"{",
"Car",
"car",
"=",
"cars",
".",
"getCar",
"(",
"preference",
",",
"dest",
",",
"c",
".",
"getPos",
"(",
")",
",",
"a",
")",
";",
"Rental",
"r",
"=",
"new",
"Rental",
"(",
"car",
",",
"c",
",",
"dest",
")",
";",
"car",
".",
"pendingRental",
"(",
"r",
")",
";",
"return",
"r",
";",
"}"
] | [
142,
4
] | [
148,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Cliente. | null | se o país tiver | se o país tiver | public Long getId() {
return id;
} | [
"public",
"Long",
"getId",
"(",
")",
"{",
"return",
"id",
";",
"}"
] | [
26,
4
] | [
28,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
TelaCliente. | null | método para pesquisar clientes pelo nome com filtro | método para pesquisar clientes pelo nome com filtro | private void pesquisar_cliente() {
String sql = "select * from tbclientes where nomecli like ?";
try {
pst = conexao.prepareStatement(sql);
//passando o conteúdo da caixa de pesquisa para o ?
//atenção ao "%" - continuação da String sql
pst.setString(1, txtCliPesquisar.getText() + "%");
rs = pst.executeQuery();
// a linha abaixo usa a biblioteca rs2xml.jar para preencher a tabela
tblClientes.setModel(DbUtils.resultSetToTableModel(rs));
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
} | [
"private",
"void",
"pesquisar_cliente",
"(",
")",
"{",
"String",
"sql",
"=",
"\"select * from tbclientes where nomecli like ?\"",
";",
"try",
"{",
"pst",
"=",
"conexao",
".",
"prepareStatement",
"(",
"sql",
")",
";",
"//passando o conteúdo da caixa de pesquisa para o ?",
"//atenção ao \"%\" - continuação da String sql",
"pst",
".",
"setString",
"(",
"1",
",",
"txtCliPesquisar",
".",
"getText",
"(",
")",
"+",
"\"%\"",
")",
";",
"rs",
"=",
"pst",
".",
"executeQuery",
"(",
")",
";",
"// a linha abaixo usa a biblioteca rs2xml.jar para preencher a tabela",
"tblClientes",
".",
"setModel",
"(",
"DbUtils",
".",
"resultSetToTableModel",
"(",
"rs",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"JOptionPane",
".",
"showMessageDialog",
"(",
"null",
",",
"e",
")",
";",
"}",
"}"
] | [
64,
4
] | [
78,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Usuario. | null | Validação de login | Validação de login | public int login (int matricula, String senha) {
if(this.matricula == matricula && this.senha == senha)
return this.origem;
else
return 0;
} | [
"public",
"int",
"login",
"(",
"int",
"matricula",
",",
"String",
"senha",
")",
"{",
"if",
"(",
"this",
".",
"matricula",
"==",
"matricula",
"&&",
"this",
".",
"senha",
"==",
"senha",
")",
"return",
"this",
".",
"origem",
";",
"else",
"return",
"0",
";",
"}"
] | [
52,
4
] | [
57,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
PontoVacinacao. | null | Adicionando um novo lote | Adicionando um novo lote | public void adicionarLote() {
Scanner scan = new Scanner(System.in);
int qtde;
do {
System.out.println("\n Quantidade de vacinas: ");
qtde = scan.nextInt();
if(qtde>3500)
System.out.println("Quantidade invalida, digite novamente (LIMITE 3500)");
}while(qtde>3500);
//Adicionando um novo lote, com id igual a quantidade de lotes no array,
//data de chegada de hj e quantidade de vacinas passadas pelo usuario
getLotesVacinas().add(new Lote(getLotesVacinas().size(), LocalDate.now(), qtde));
} | [
"public",
"void",
"adicionarLote",
"(",
")",
"{",
"Scanner",
"scan",
"=",
"new",
"Scanner",
"(",
"System",
".",
"in",
")",
";",
"int",
"qtde",
";",
"do",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\\n Quantidade de vacinas: \"",
")",
";",
"qtde",
"=",
"scan",
".",
"nextInt",
"(",
")",
";",
"if",
"(",
"qtde",
">",
"3500",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"Quantidade invalida, digite novamente (LIMITE 3500)\"",
")",
";",
"}",
"while",
"(",
"qtde",
">",
"3500",
")",
";",
"//Adicionando um novo lote, com id igual a quantidade de lotes no array, ",
"//data de chegada de hj e quantidade de vacinas passadas pelo usuario",
"getLotesVacinas",
"(",
")",
".",
"add",
"(",
"new",
"Lote",
"(",
"getLotesVacinas",
"(",
")",
".",
"size",
"(",
")",
",",
"LocalDate",
".",
"now",
"(",
")",
",",
"qtde",
")",
")",
";",
"}"
] | [
90,
1
] | [
102,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
PacientesResources. | null | trazendo um produto pela id | trazendo um produto pela id | @GetMapping("/pacientes/{id}")
@ApiOperation(value="Trazer unico Paciente")
public Pacientes listarUnicoPacientes(@PathVariable(value="id") long id){
return pacienteRepository.findById(id);
} | [
"@",
"GetMapping",
"(",
"\"/pacientes/{id}\"",
")",
"@",
"ApiOperation",
"(",
"value",
"=",
"\"Trazer unico Paciente\"",
")",
"public",
"Pacientes",
"listarUnicoPacientes",
"(",
"@",
"PathVariable",
"(",
"value",
"=",
"\"id\"",
")",
"long",
"id",
")",
"{",
"return",
"pacienteRepository",
".",
"findById",
"(",
"id",
")",
";",
"}"
] | [
39,
1
] | [
44,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
DesafioMeuTimeApplication. | null | Retorna o identificador do jogador com maior salário do time. Usar o menor identificador como critério de desempate. | Retorna o identificador do jogador com maior salário do time. Usar o menor identificador como critério de desempate. | @Desafio("buscarJogadorMaiorSalario")
public Long buscarJogadorMaiorSalario(Long idTime) {
//Caso o time informado não exista, retornar br.com.codenation.desafio.exceptions.TimeNaoEncontradoException
Time t = this.buscaTimePeloId(idTime).orElseThrow(TimeNaoEncontradoException::new);
return t.getJogadores()
.stream()
.sorted(Comparator.comparing(Jogador::getId))
.max(Comparator.comparing(Jogador::getSalario))
.get()
.getId();
} | [
"@",
"Desafio",
"(",
"\"buscarJogadorMaiorSalario\"",
")",
"public",
"Long",
"buscarJogadorMaiorSalario",
"(",
"Long",
"idTime",
")",
"{",
"//Caso o time informado não exista, retornar br.com.codenation.desafio.exceptions.TimeNaoEncontradoException",
"Time",
"t",
"=",
"this",
".",
"buscaTimePeloId",
"(",
"idTime",
")",
".",
"orElseThrow",
"(",
"TimeNaoEncontradoException",
"::",
"new",
")",
";",
"return",
"t",
".",
"getJogadores",
"(",
")",
".",
"stream",
"(",
")",
".",
"sorted",
"(",
"Comparator",
".",
"comparing",
"(",
"Jogador",
"::",
"getId",
")",
")",
".",
"max",
"(",
"Comparator",
".",
"comparing",
"(",
"Jogador",
"::",
"getSalario",
")",
")",
".",
"get",
"(",
")",
".",
"getId",
"(",
")",
";",
"}"
] | [
159,
1
] | [
170,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
JWTAuthorizationFilter. | null | intercepta uma requisição | intercepta uma requisição | @Override
protected void doFilterInternal(HttpServletRequest request,
HttpServletResponse response,
FilterChain chain) throws IOException, ServletException {
//pega o token
String header = request.getHeader("Authorization");
if (header != null && header.startsWith("Bearer ")) {
UsernamePasswordAuthenticationToken auth = getAuthentication(header.substring(7));
if (auth != null) {
SecurityContextHolder.getContext().setAuthentication(auth);
}
}
//continua a requisição se o token for válido
chain.doFilter(request, response);
} | [
"@",
"Override",
"protected",
"void",
"doFilterInternal",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"FilterChain",
"chain",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"//pega o token",
"String",
"header",
"=",
"request",
".",
"getHeader",
"(",
"\"Authorization\"",
")",
";",
"if",
"(",
"header",
"!=",
"null",
"&&",
"header",
".",
"startsWith",
"(",
"\"Bearer \"",
")",
")",
"{",
"UsernamePasswordAuthenticationToken",
"auth",
"=",
"getAuthentication",
"(",
"header",
".",
"substring",
"(",
"7",
")",
")",
";",
"if",
"(",
"auth",
"!=",
"null",
")",
"{",
"SecurityContextHolder",
".",
"getContext",
"(",
")",
".",
"setAuthentication",
"(",
"auth",
")",
";",
"}",
"}",
"//continua a requisição se o token for válido",
"chain",
".",
"doFilter",
"(",
"request",
",",
"response",
")",
";",
"}"
] | [
29,
1
] | [
44,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Conjunto. | null | Pertinencia de um conjunto em outro conjunto | Pertinencia de um conjunto em outro conjunto | public boolean pertinencia_conjunto(Conjunto conj) {
return true;
} | [
"public",
"boolean",
"pertinencia_conjunto",
"(",
"Conjunto",
"conj",
")",
"{",
"return",
"true",
";",
"}"
] | [
56,
4
] | [
58,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
EmpresaActivity. | null | Verificando a opção selecionada no menu pelo usuário | Verificando a opção selecionada no menu pelo usuário | @Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()){
case R.id.menuSair:
deslogarUsuario();
break;
case R.id.menuConfiguracoes:
abrirCOnfiguracoes();
break;
case R.id.menuNovoProduto:
abrirNovoProduto();
break;
case R.id.menuPedidos:
abrirPedidos();
break;
}
return super.onOptionsItemSelected(item);
} | [
"@",
"Override",
"public",
"boolean",
"onOptionsItemSelected",
"(",
"@",
"NonNull",
"MenuItem",
"item",
")",
"{",
"switch",
"(",
"item",
".",
"getItemId",
"(",
")",
")",
"{",
"case",
"R",
".",
"id",
".",
"menuSair",
":",
"deslogarUsuario",
"(",
")",
";",
"break",
";",
"case",
"R",
".",
"id",
".",
"menuConfiguracoes",
":",
"abrirCOnfiguracoes",
"(",
")",
";",
"break",
";",
"case",
"R",
".",
"id",
".",
"menuNovoProduto",
":",
"abrirNovoProduto",
"(",
")",
";",
"break",
";",
"case",
"R",
".",
"id",
".",
"menuPedidos",
":",
"abrirPedidos",
"(",
")",
";",
"break",
";",
"}",
"return",
"super",
".",
"onOptionsItemSelected",
"(",
"item",
")",
";",
"}"
] | [
98,
4
] | [
116,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Desenhador. | null | /*private, entao eh usaddo soh aqui dentro | /*private, entao eh usaddo soh aqui dentro | private static Graphics getGraphicsDaTela() {
return tCenarioOndeSeDesenha.getGraphicsBuffer();
} | [
"private",
"static",
"Graphics",
"getGraphicsDaTela",
"(",
")",
"{",
"return",
"tCenarioOndeSeDesenha",
".",
"getGraphicsBuffer",
"(",
")",
";",
"}"
] | [
23,
4
] | [
25,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Jogo. | null | método privado e interno para extração de informações do arquivo: | método privado e interno para extração de informações do arquivo: | private void configuraPartidaRetomada(String frase, int linha) {
int tam = frase.length(); //armazenando o tamanho da linha (para diferenciação entre posições ocupadas ou não)
if (linha <= 4) { //casos especiais: quatro primeiras linhas do arquivo
switch(linha) {
case 1: //linha 1
jogadores[0] = new Jogador(frase.substring(0, tam)); //extraindo nome do jogador 1
break;
case 2: //linha 1
jogadores[1] = new Jogador(frase.substring(0, tam)); //extraindo nome do jogador 2
break;
case 3: //linha 3
setSituacao(frase.charAt(0)-48); //extraindo situação do jogo
break;
case 4: //linha 4
setJogada(frase.charAt(0)-48); //extraindo jogada (de quem é a vez) do jogo
break;
}
} else { //demais linhas do arquivo
int l = frase.charAt(0)-48; //extraindo coordenada da linha da posição
char c = frase.charAt(2); //extraindo coordenada da coluna da posição
if (tam == 6) { //linhas que representam posições ocupadas (apresentam o desenho da peça):
String peca = frase.substring(4, 6); //extraindo o desenho da peça
tabuleiro.distribuicaoAtual(l, c, peca); //criando a posição no tabuleiro e inserindo a peça
} else if (tam == 3) { //linhas que representam posições livres (não apresentam o desenho da peça):
tabuleiro.distribuicaoAtual(l, c); //apenas criando a posição no tabuleiro (não há peça)
}
}
} | [
"private",
"void",
"configuraPartidaRetomada",
"(",
"String",
"frase",
",",
"int",
"linha",
")",
"{",
"int",
"tam",
"=",
"frase",
".",
"length",
"(",
")",
";",
"//armazenando o tamanho da linha (para diferenciação entre posições ocupadas ou não) ",
"if",
"(",
"linha",
"<=",
"4",
")",
"{",
"//casos especiais: quatro primeiras linhas do arquivo",
"switch",
"(",
"linha",
")",
"{",
"case",
"1",
":",
"//linha 1",
"jogadores",
"[",
"0",
"]",
"=",
"new",
"Jogador",
"(",
"frase",
".",
"substring",
"(",
"0",
",",
"tam",
")",
")",
";",
"//extraindo nome do jogador 1",
"break",
";",
"case",
"2",
":",
"//linha 1",
"jogadores",
"[",
"1",
"]",
"=",
"new",
"Jogador",
"(",
"frase",
".",
"substring",
"(",
"0",
",",
"tam",
")",
")",
";",
"//extraindo nome do jogador 2",
"break",
";",
"case",
"3",
":",
"//linha 3",
"setSituacao",
"(",
"frase",
".",
"charAt",
"(",
"0",
")",
"-",
"48",
")",
";",
"//extraindo situação do jogo",
"break",
";",
"case",
"4",
":",
"//linha 4",
"setJogada",
"(",
"frase",
".",
"charAt",
"(",
"0",
")",
"-",
"48",
")",
";",
"//extraindo jogada (de quem é a vez) do jogo",
"break",
";",
"}",
"}",
"else",
"{",
"//demais linhas do arquivo",
"int",
"l",
"=",
"frase",
".",
"charAt",
"(",
"0",
")",
"-",
"48",
";",
"//extraindo coordenada da linha da posição",
"char",
"c",
"=",
"frase",
".",
"charAt",
"(",
"2",
")",
";",
"//extraindo coordenada da coluna da posição",
"if",
"(",
"tam",
"==",
"6",
")",
"{",
"//linhas que representam posições ocupadas (apresentam o desenho da peça):",
"String",
"peca",
"=",
"frase",
".",
"substring",
"(",
"4",
",",
"6",
")",
";",
"//extraindo o desenho da peça",
"tabuleiro",
".",
"distribuicaoAtual",
"(",
"l",
",",
"c",
",",
"peca",
")",
";",
"//criando a posição no tabuleiro e inserindo a peça",
"}",
"else",
"if",
"(",
"tam",
"==",
"3",
")",
"{",
"//linhas que representam posições livres (não apresentam o desenho da peça):",
"tabuleiro",
".",
"distribuicaoAtual",
"(",
"l",
",",
"c",
")",
";",
"//apenas criando a posição no tabuleiro (não há peça)",
"}",
"}",
"}"
] | [
406,
4
] | [
434,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
DesafioMeuTimeApplication. | null | Retorna o salário do jogador. | Retorna o salário do jogador. | @Desafio("buscarSalarioDoJogador")
public BigDecimal buscarSalarioDoJogador(Long idJogador) {
//Caso o jogador informado não exista, retornar br.com.codenation.desafio.exceptions.JogadorNaoEncontradoException
Jogador j = this.buscaJogadorPeloId(idJogador).orElseThrow(JogadorNaoEncontradoException::new);
return j.getSalario();
} | [
"@",
"Desafio",
"(",
"\"buscarSalarioDoJogador\"",
")",
"public",
"BigDecimal",
"buscarSalarioDoJogador",
"(",
"Long",
"idJogador",
")",
"{",
"//Caso o jogador informado não exista, retornar br.com.codenation.desafio.exceptions.JogadorNaoEncontradoException",
"Jogador",
"j",
"=",
"this",
".",
"buscaJogadorPeloId",
"(",
"idJogador",
")",
".",
"orElseThrow",
"(",
"JogadorNaoEncontradoException",
"::",
"new",
")",
";",
"return",
"j",
".",
"getSalario",
"(",
")",
";",
"}"
] | [
173,
1
] | [
179,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
PecaXadrez. | null | Para evitar que as peças ultrapassem os limites do tabuleiro | Para evitar que as peças ultrapassem os limites do tabuleiro | public int maxX(){
return 8;
} | [
"public",
"int",
"maxX",
"(",
")",
"{",
"return",
"8",
";",
"}"
] | [
22,
4
] | [
24,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Main. | null | =========== Método para pesquisar Usuários pelo nome =========== | =========== Método para pesquisar Usuários pelo nome =========== | private void pesquisar() {
try {
Scanner entrada = new Scanner(System.in);
System.out.print("Pesquisar por nome: ");
String nome = entrada.nextLine();
Cadastro.dao.UsuarioDAO.pesquisar(nome);
for (Usuario usuario : usuarios) {
System.out.println(usuario);
}
} catch (SQLException exception) {
System.out.println("Erro ao Pesquisar: " + exception);
}
} | [
"private",
"void",
"pesquisar",
"(",
")",
"{",
"try",
"{",
"Scanner",
"entrada",
"=",
"new",
"Scanner",
"(",
"System",
".",
"in",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"\"Pesquisar por nome: \"",
")",
";",
"String",
"nome",
"=",
"entrada",
".",
"nextLine",
"(",
")",
";",
"Cadastro",
".",
"dao",
".",
"UsuarioDAO",
".",
"pesquisar",
"(",
"nome",
")",
";",
"for",
"(",
"Usuario",
"usuario",
":",
"usuarios",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"usuario",
")",
";",
"}",
"}",
"catch",
"(",
"SQLException",
"exception",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Erro ao Pesquisar: \"",
"+",
"exception",
")",
";",
"}",
"}"
] | [
108,
1
] | [
121,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
EnviarCorreo. | null | Getter para atributo ServerSMTP | Getter para atributo ServerSMTP | public String getServerSMTP()
{
return ServerSMTP;
} | [
"public",
"String",
"getServerSMTP",
"(",
")",
"{",
"return",
"ServerSMTP",
";",
"}"
] | [
129,
4
] | [
132,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
FilmeService. | null | Regra de Negócio 2: Filme deve possuir, no mínimo, uma participação de artista | Regra de Negócio 2: Filme deve possuir, no mínimo, uma participação de artista | public boolean verificarRegrasDeNegocio(Filme obj) {
boolean minimoDiretores = false;
boolean minimoArtistas = false;
// Regra de Negócio 1: Filme deve possuir, no mínimo, um diretor
if(obj.getDiretores() != null)
if(obj.getDiretores().size() >= 1)
minimoDiretores = true;
else
throw new BusinessRuleException("O filme deve possuir, no mínimo, um diretor!");
// Regra de Negócio 2: Filme deve possuir, no mínimo, uma participação de artista
if(obj.getParticipacoes() != null)
if(obj.getParticipacoes().size() >= 1)
minimoArtistas = true;
else
throw new BusinessRuleException("O filme deve possuir, no mínimo, uma participação de artista!");
if(minimoDiretores && minimoArtistas)
return true;
else
return false;
} | [
"public",
"boolean",
"verificarRegrasDeNegocio",
"(",
"Filme",
"obj",
")",
"{",
"boolean",
"minimoDiretores",
"=",
"false",
";",
"boolean",
"minimoArtistas",
"=",
"false",
";",
"// Regra de Negócio 1: Filme deve possuir, no mínimo, um diretor",
"if",
"(",
"obj",
".",
"getDiretores",
"(",
")",
"!=",
"null",
")",
"if",
"(",
"obj",
".",
"getDiretores",
"(",
")",
".",
"size",
"(",
")",
">=",
"1",
")",
"minimoDiretores",
"=",
"true",
";",
"else",
"throw",
"new",
"BusinessRuleException",
"(",
"\"O filme deve possuir, no mínimo, um diretor!\")",
";",
"",
"// Regra de Negócio 2: Filme deve possuir, no mínimo, uma participação de artista",
"if",
"(",
"obj",
".",
"getParticipacoes",
"(",
")",
"!=",
"null",
")",
"if",
"(",
"obj",
".",
"getParticipacoes",
"(",
")",
".",
"size",
"(",
")",
">=",
"1",
")",
"minimoArtistas",
"=",
"true",
";",
"else",
"throw",
"new",
"BusinessRuleException",
"(",
"\"O filme deve possuir, no mínimo, uma participação de artista!\");",
"",
"",
"if",
"(",
"minimoDiretores",
"&&",
"minimoArtistas",
")",
"return",
"true",
";",
"else",
"return",
"false",
";",
"}"
] | [
81,
2
] | [
103,
3
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
MainActivity. | null | limpa todos os campos e adiciona o Id novo para inserção | limpa todos os campos e adiciona o Id novo para inserção | public void novo(View view){
EditText id = findViewById(R.id.id_cliente);
EditText nome = findViewById(R.id.nome);
EditText cpf = findViewById(R.id.cpf);
EditText data_nasc = findViewById(R.id.data_nasc);
id.setText((new Integer(totalClientes+1)).toString());
nome.setText("");
cpf.setText("");
data_nasc.setText("");
} | [
"public",
"void",
"novo",
"(",
"View",
"view",
")",
"{",
"EditText",
"id",
"=",
"findViewById",
"(",
"R",
".",
"id",
".",
"id_cliente",
")",
";",
"EditText",
"nome",
"=",
"findViewById",
"(",
"R",
".",
"id",
".",
"nome",
")",
";",
"EditText",
"cpf",
"=",
"findViewById",
"(",
"R",
".",
"id",
".",
"cpf",
")",
";",
"EditText",
"data_nasc",
"=",
"findViewById",
"(",
"R",
".",
"id",
".",
"data_nasc",
")",
";",
"id",
".",
"setText",
"(",
"(",
"new",
"Integer",
"(",
"totalClientes",
"+",
"1",
")",
")",
".",
"toString",
"(",
")",
")",
";",
"nome",
".",
"setText",
"(",
"\"\"",
")",
";",
"cpf",
".",
"setText",
"(",
"\"\"",
")",
";",
"data_nasc",
".",
"setText",
"(",
"\"\"",
")",
";",
"}"
] | [
102,
4
] | [
112,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
ProdutoDAO. | null | Parâmetros dinâmicos com Criteria | Parâmetros dinâmicos com Criteria | public List<Produto> buscarPorParametrosCriteria(String nome, BigDecimal preco, LocalDate dataCadastro) {
CriteriaBuilder criteriaBuilder = em.getCriteriaBuilder();
CriteriaQuery<Produto> query = criteriaBuilder.createQuery(Produto.class);
Root<Produto> from = query.from(Produto.class);
Predicate filters = criteriaBuilder.and();
if(nome != null && !nome.trim().isEmpty())
filters = criteriaBuilder.and(filters, criteriaBuilder.equal(from.get("nome"), nome));
if(preco != null)
filters = criteriaBuilder.and(filters, criteriaBuilder.equal(from.get("preco"), preco));
if(dataCadastro != null)
filters = criteriaBuilder.and(filters, criteriaBuilder.equal(from.get("dataCadastro"), dataCadastro));
query.where(filters);
return em.createQuery(query).getResultList();
} | [
"public",
"List",
"<",
"Produto",
">",
"buscarPorParametrosCriteria",
"(",
"String",
"nome",
",",
"BigDecimal",
"preco",
",",
"LocalDate",
"dataCadastro",
")",
"{",
"CriteriaBuilder",
"criteriaBuilder",
"=",
"em",
".",
"getCriteriaBuilder",
"(",
")",
";",
"CriteriaQuery",
"<",
"Produto",
">",
"query",
"=",
"criteriaBuilder",
".",
"createQuery",
"(",
"Produto",
".",
"class",
")",
";",
"Root",
"<",
"Produto",
">",
"from",
"=",
"query",
".",
"from",
"(",
"Produto",
".",
"class",
")",
";",
"Predicate",
"filters",
"=",
"criteriaBuilder",
".",
"and",
"(",
")",
";",
"if",
"(",
"nome",
"!=",
"null",
"&&",
"!",
"nome",
".",
"trim",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"filters",
"=",
"criteriaBuilder",
".",
"and",
"(",
"filters",
",",
"criteriaBuilder",
".",
"equal",
"(",
"from",
".",
"get",
"(",
"\"nome\"",
")",
",",
"nome",
")",
")",
";",
"if",
"(",
"preco",
"!=",
"null",
")",
"filters",
"=",
"criteriaBuilder",
".",
"and",
"(",
"filters",
",",
"criteriaBuilder",
".",
"equal",
"(",
"from",
".",
"get",
"(",
"\"preco\"",
")",
",",
"preco",
")",
")",
";",
"if",
"(",
"dataCadastro",
"!=",
"null",
")",
"filters",
"=",
"criteriaBuilder",
".",
"and",
"(",
"filters",
",",
"criteriaBuilder",
".",
"equal",
"(",
"from",
".",
"get",
"(",
"\"dataCadastro\"",
")",
",",
"dataCadastro",
")",
")",
";",
"query",
".",
"where",
"(",
"filters",
")",
";",
"return",
"em",
".",
"createQuery",
"(",
"query",
")",
".",
"getResultList",
"(",
")",
";",
"}"
] | [
83,
1
] | [
102,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
TelaCadastrarPacienteController. | null | ---> Esse método vai ter a acão de quando clicarmos/selecionarmos um registro da tabela esse metodo vai atualizar o formulario acima para poder editar o usuarios | ---> Esse método vai ter a acão de quando clicarmos/selecionarmos um registro da tabela esse metodo vai atualizar o formulario acima para poder editar o usuarios | @Override
public void setCamposFormulario() {
if (!tableView.getItems().isEmpty()) {
objetoSelecionado = tableView.getItems().get(tableView.getSelectionModel().getSelectedIndex());
}
//--> aqui vamos preencher os campos que queremos que seja preenchido ao selecionar o registro na tabela
txtCodigo.setText(Integer.toString(objetoSelecionado.getCodigo()));
txtNome.setText(objetoSelecionado.getNome());
txtCpf.setText(objetoSelecionado.getCpf());
txtNumeroSus.setText(objetoSelecionado.getNumSus());
dpNascimento.setValue(objetoSelecionado.getDataNascimento());
cbEstado.setValue(objetoSelecionado.getEstado());
txtCidade.setText(objetoSelecionado.getCidade());
txtRua.setText(objetoSelecionado.getRua());
txtBairro.setText(objetoSelecionado.getBairro());
txtEmail.setText(objetoSelecionado.getEmail());
txtTelefone.setText(objetoSelecionado.getTelefone());
} | [
"@",
"Override",
"public",
"void",
"setCamposFormulario",
"(",
")",
"{",
"if",
"(",
"!",
"tableView",
".",
"getItems",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"objetoSelecionado",
"=",
"tableView",
".",
"getItems",
"(",
")",
".",
"get",
"(",
"tableView",
".",
"getSelectionModel",
"(",
")",
".",
"getSelectedIndex",
"(",
")",
")",
";",
"}",
"//--> aqui vamos preencher os campos que queremos que seja preenchido ao selecionar o registro na tabela",
"txtCodigo",
".",
"setText",
"(",
"Integer",
".",
"toString",
"(",
"objetoSelecionado",
".",
"getCodigo",
"(",
")",
")",
")",
";",
"txtNome",
".",
"setText",
"(",
"objetoSelecionado",
".",
"getNome",
"(",
")",
")",
";",
"txtCpf",
".",
"setText",
"(",
"objetoSelecionado",
".",
"getCpf",
"(",
")",
")",
";",
"txtNumeroSus",
".",
"setText",
"(",
"objetoSelecionado",
".",
"getNumSus",
"(",
")",
")",
";",
"dpNascimento",
".",
"setValue",
"(",
"objetoSelecionado",
".",
"getDataNascimento",
"(",
")",
")",
";",
"cbEstado",
".",
"setValue",
"(",
"objetoSelecionado",
".",
"getEstado",
"(",
")",
")",
";",
"txtCidade",
".",
"setText",
"(",
"objetoSelecionado",
".",
"getCidade",
"(",
")",
")",
";",
"txtRua",
".",
"setText",
"(",
"objetoSelecionado",
".",
"getRua",
"(",
")",
")",
";",
"txtBairro",
".",
"setText",
"(",
"objetoSelecionado",
".",
"getBairro",
"(",
")",
")",
";",
"txtEmail",
".",
"setText",
"(",
"objetoSelecionado",
".",
"getEmail",
"(",
")",
")",
";",
"txtTelefone",
".",
"setText",
"(",
"objetoSelecionado",
".",
"getTelefone",
"(",
")",
")",
";",
"}"
] | [
218,
4
] | [
236,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
SecurityConfigurations. | null | Configurações de Autenticação (controlede acesso, logind etc) | Configurações de Autenticação (controlede acesso, logind etc) | @Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(autenticacaoService).passwordEncoder(new BCryptPasswordEncoder());
} | [
"@",
"Override",
"protected",
"void",
"configure",
"(",
"AuthenticationManagerBuilder",
"auth",
")",
"throws",
"Exception",
"{",
"auth",
".",
"userDetailsService",
"(",
"autenticacaoService",
")",
".",
"passwordEncoder",
"(",
"new",
"BCryptPasswordEncoder",
"(",
")",
")",
";",
"}"
] | [
36,
4
] | [
39,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
VdfSloth. | null | foi o q que funcionou melhor | foi o q que funcionou melhor | public static BigInteger mod_op(BigInteger x, int t) {
for (int i = 0; i < t; i++) {
x = mod_sqrt_op(x, p);
}
return x;
} | [
"public",
"static",
"BigInteger",
"mod_op",
"(",
"BigInteger",
"x",
",",
"int",
"t",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"t",
";",
"i",
"++",
")",
"{",
"x",
"=",
"mod_sqrt_op",
"(",
"x",
",",
"p",
")",
";",
"}",
"return",
"x",
";",
"}"
] | [
11,
4
] | [
16,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.