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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Tela. | null | finaliza a partida para o player2 | finaliza a partida para o player2 | public void finalizaP2(){
switch(id){
case 1:
valor = JOptionPane.showOptionDialog(this, "Você perdeu!", "Fim de Jogo!",JOptionPane.PLAIN_MESSAGE, JOptionPane.PLAIN_MESSAGE,null, opcoes,opcoes[0]);
break;
case 2:
valor = JOptionPane.showOptionDialog(this, "Você ganhou!", "Fim de Jogo!",JOptionPane.PLAIN_MESSAGE, JOptionPane.PLAIN_MESSAGE,null, opcoes,opcoes[0]);
break;
}
valor();
} | [
"public",
"void",
"finalizaP2",
"(",
")",
"{",
"switch",
"(",
"id",
")",
"{",
"case",
"1",
":",
"valor",
"=",
"JOptionPane",
".",
"showOptionDialog",
"(",
"this",
",",
"\"Você perdeu!\",",
" ",
"Fim de Jogo!\",",
"J",
"OptionPane.",
"P",
"LAIN_MESSAGE,",
" ",
"OptionPane.",
"P",
"LAIN_MESSAGE,",
"n",
"ull,",
" ",
"pcoes,",
"o",
"pcoes[",
"0",
"]",
")",
";",
"",
"break",
";",
"case",
"2",
":",
"valor",
"=",
"JOptionPane",
".",
"showOptionDialog",
"(",
"this",
",",
"\"Você ganhou!\",",
" ",
"Fim de Jogo!\",",
"J",
"OptionPane.",
"P",
"LAIN_MESSAGE,",
" ",
"OptionPane.",
"P",
"LAIN_MESSAGE,",
"n",
"ull,",
" ",
"pcoes,",
"o",
"pcoes[",
"0",
"]",
")",
";",
"",
"break",
";",
"}",
"valor",
"(",
")",
";",
"}"
] | [
178,
4
] | [
188,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
SecurityConfig. | null | configuração de autorizaçao | configuração de autorizaçao | @Override
protected void configure(HttpSecurity http) throws Exception {
// if (Arrays.asList(env.getActiveProfiles()).contains("test")) {
// http.headers().frameOptions().disable();
// }
//
// http.cors().and().csrf().disable();
http
.authorizeRequests()
.antMatchers(PUBLIC_MACHERS).permitAll()
.antMatchers(HttpMethod.POST, PUBLIC_MACHERS_POST).permitAll()
.anyRequest().authenticated()
.and().csrf().disable()
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.addFilterBefore(new AutenticacaoViaTokenFilther(tokenService, usuarioRepository), UsernamePasswordAuthenticationFilter.class);
// http
// .authorizeRequests()
// .antMatchers(PUBLIC_MACHERS).permitAll()
// .antMatchers(PUBLIC_MACHERS_GET).permitAll()
// .anyRequest().authenticated()
// .and().formLogin();
} | [
"@",
"Override",
"protected",
"void",
"configure",
"(",
"HttpSecurity",
"http",
")",
"throws",
"Exception",
"{",
"// if (Arrays.asList(env.getActiveProfiles()).contains(\"test\")) {",
"// http.headers().frameOptions().disable();",
"// }",
"//",
"// http.cors().and().csrf().disable();",
"http",
".",
"authorizeRequests",
"(",
")",
".",
"antMatchers",
"(",
"PUBLIC_MACHERS",
")",
".",
"permitAll",
"(",
")",
".",
"antMatchers",
"(",
"HttpMethod",
".",
"POST",
",",
"PUBLIC_MACHERS_POST",
")",
".",
"permitAll",
"(",
")",
".",
"anyRequest",
"(",
")",
".",
"authenticated",
"(",
")",
".",
"and",
"(",
")",
".",
"csrf",
"(",
")",
".",
"disable",
"(",
")",
".",
"sessionManagement",
"(",
")",
".",
"sessionCreationPolicy",
"(",
"SessionCreationPolicy",
".",
"STATELESS",
")",
".",
"and",
"(",
")",
".",
"addFilterBefore",
"(",
"new",
"AutenticacaoViaTokenFilther",
"(",
"tokenService",
",",
"usuarioRepository",
")",
",",
"UsernamePasswordAuthenticationFilter",
".",
"class",
")",
";",
"// \thttp",
"// \t\t.authorizeRequests()",
"// \t\t.antMatchers(PUBLIC_MACHERS).permitAll()",
"// \t\t.antMatchers(PUBLIC_MACHERS_GET).permitAll()",
"// \t\t.anyRequest().authenticated()",
"// \t\t.and().formLogin();",
"}"
] | [
52,
4
] | [
78,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
FuncoesTopicos. | null | Adiciona a cidade apenas se ela não estiver na lista | Adiciona a cidade apenas se ela não estiver na lista | private static void listaCidades(){
for (Imovel imovel : imoveis){
if(!estaNaLista(imovel.getCidade()))
cidades.add(imovel.getCidade());
}
} | [
"private",
"static",
"void",
"listaCidades",
"(",
")",
"{",
"for",
"(",
"Imovel",
"imovel",
":",
"imoveis",
")",
"{",
"if",
"(",
"!",
"estaNaLista",
"(",
"imovel",
".",
"getCidade",
"(",
")",
")",
")",
"cidades",
".",
"add",
"(",
"imovel",
".",
"getCidade",
"(",
")",
")",
";",
"}",
"}"
] | [
32,
4
] | [
37,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Main. | null | /*texto com substituição de substring armazenado em output.txt | /*texto com substituição de substring armazenado em output.txt | public static void main(String[] args){
String inputFileName = "casosTeste"+File.separator+"textFile1.txt";
try {
PrintWriter pWriter = new PrintWriter("casosTeste"+File.separator+"output.txt");
File fInput = new File(inputFileName);
FileReader fReader = new FileReader(fInput);
BufferedReader bReader = new BufferedReader(fReader);
String origTxtLine = bReader.readLine();
do{
pWriter.println(origTxtLine.replaceAll("muito","pouco"));
origTxtLine = bReader.readLine();
}while(origTxtLine != null);
bReader.close();
pWriter.close();
} catch (IOException e){
e.printStackTrace();
}
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"String",
"inputFileName",
"=",
"\"casosTeste\"",
"+",
"File",
".",
"separator",
"+",
"\"textFile1.txt\"",
";",
"try",
"{",
"PrintWriter",
"pWriter",
"=",
"new",
"PrintWriter",
"(",
"\"casosTeste\"",
"+",
"File",
".",
"separator",
"+",
"\"output.txt\"",
")",
";",
"File",
"fInput",
"=",
"new",
"File",
"(",
"inputFileName",
")",
";",
"FileReader",
"fReader",
"=",
"new",
"FileReader",
"(",
"fInput",
")",
";",
"BufferedReader",
"bReader",
"=",
"new",
"BufferedReader",
"(",
"fReader",
")",
";",
"String",
"origTxtLine",
"=",
"bReader",
".",
"readLine",
"(",
")",
";",
"do",
"{",
"pWriter",
".",
"println",
"(",
"origTxtLine",
".",
"replaceAll",
"(",
"\"muito\"",
",",
"\"pouco\"",
")",
")",
";",
"origTxtLine",
"=",
"bReader",
".",
"readLine",
"(",
")",
";",
"}",
"while",
"(",
"origTxtLine",
"!=",
"null",
")",
";",
"bReader",
".",
"close",
"(",
")",
";",
"pWriter",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] | [
11,
4
] | [
34,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
SecurityConfiguration. | null | Configurações de autenticação. | Configurações de autenticação. | @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",
"(",
")",
")",
";",
"}"
] | [
41,
4
] | [
44,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
PessoaResource. | null | Fará a atualização de um recurso | Fará a atualização de um recurso | @PutMapping("/{id}")
public ResponseEntity<Pessoa> atualizar(@PathVariable UUID id, @Valid @RequestBody Pessoa pessoa) {
Pessoa pessoaEntity = pessoaService.atualizar(id, pessoa);
return ResponseEntity.ok(pessoaEntity);
} | [
"@",
"PutMapping",
"(",
"\"/{id}\"",
")",
"public",
"ResponseEntity",
"<",
"Pessoa",
">",
"atualizar",
"(",
"@",
"PathVariable",
"UUID",
"id",
",",
"@",
"Valid",
"@",
"RequestBody",
"Pessoa",
"pessoa",
")",
"{",
"Pessoa",
"pessoaEntity",
"=",
"pessoaService",
".",
"atualizar",
"(",
"id",
",",
"pessoa",
")",
";",
"return",
"ResponseEntity",
".",
"ok",
"(",
"pessoaEntity",
")",
";",
"}"
] | [
61,
4
] | [
65,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
App. | null | Conexão da página 3 utilizando método POST | Conexão da página 3 utilizando método POST | public static List<String> getListaURLsPag3() {
List<String> URLs = new ArrayList<String>();
try {
Document document = Jsoup.connect("https://www.infomoney.com.br/mercados/?infinity=scrolling")
.header(" Content-Type " , "application/x-www-form-urlencoded; charset=UTF-8")
.header("X-Requested-With","XMLHttpRequest")
.header("Accept", " */* ")
.header(" Accept-Encoding " , " gzip, deflate, br")
.header(" Accept-Language " , " en-US,en;q=0.5")
.header(" Connection " , " keep-alive")
.header(" Content-Length " , " 3520 ")
.header(" Host " , " www.infomoney.com.br")
.header(" Origin " , " https://www.infomoney.com.br")
.header(" Referer " , " https://www.infomoney.com.br/mercados/")
.header(" Sec-Fetch-Dest " , " empty ")
.header(" Sec-Fetch-Mode " , " cors ")
.header(" Sec-Fetch-Site " , " same-origin ")
.header(" TE " , " trailers ")
.header(" User-Agent " , " Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0 ")
.header(" X-Requested-With " , " XMLHttpRequest ")
.cookie(" __gads ", "ID=cac347f4ea00c827-22e6985cd7b30077:T=1623028684:S=ALNI_Mb08vi05DvJ9rNX40VI7XTtkDZxtg")
.cookie(" _ga ","GA1.3.664574251.1623028681")
.cookie(" _gasessionid", "20210607044333681623112196534" )
.cookie(" cto_bundle ","4F9X119TZnBnTyUyQjlUUG5HVjBrZVJUY2h0STAyczU1SHZYUUIzUTJXc1JXSldjQ1lpRTBRVjRlVzFYbGZiTFVBVFZJcHJsOUJFSUVCJTJGZUUxcVhzQmVGV3lMMGQyWUJxaDJnZ0t4YkZ1MVFINGdlaU0lMkJXcDVqVzJLdHdsY2U2U2VBNlFnUDZocDBIR2E1bmJJTEoxa1VGT0NiYkElM0QlM0Q")
.data("action","infinite_scroll")
.data("page","3")
.data("currentday","")
.data("charset","UTF-8")
.data("order","DESC")
.ignoreContentType(true)
.post();
App parserInfo = new App(document);
parserInfo.document.append(document.html());
URLs= parserInfo.getURLInfoPagePost();
} catch (IOException e) {
e.printStackTrace();
}
return URLs;
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getListaURLsPag3",
"(",
")",
"{",
"List",
"<",
"String",
">",
"URLs",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"try",
"{",
"Document",
"document",
"=",
"Jsoup",
".",
"connect",
"(",
"\"https://www.infomoney.com.br/mercados/?infinity=scrolling\"",
")",
".",
"header",
"(",
"\"\tContent-Type\t\"",
",",
"\"application/x-www-form-urlencoded; charset=UTF-8\"",
")",
".",
"header",
"(",
"\"X-Requested-With\"",
",",
"\"XMLHttpRequest\"",
")",
".",
"header",
"(",
"\"Accept\"",
",",
"\" */* \"",
")",
".",
"header",
"(",
"\"\tAccept-Encoding\t\"",
",",
"\"\tgzip, deflate, br\"",
")",
".",
"header",
"(",
"\"\tAccept-Language\t\"",
",",
"\"\ten-US,en;q=0.5\"",
")",
".",
"header",
"(",
"\"\tConnection\t\"",
",",
"\"\tkeep-alive\"",
")",
".",
"header",
"(",
"\"\tContent-Length\t\"",
",",
"\"\t3520\t\"",
")",
".",
"header",
"(",
"\"\tHost\t\"",
",",
"\"\twww.infomoney.com.br\"",
")",
".",
"header",
"(",
"\"\tOrigin\t\"",
",",
"\"\thttps://www.infomoney.com.br\"",
")",
".",
"header",
"(",
"\"\tReferer\t\"",
",",
"\"\thttps://www.infomoney.com.br/mercados/\"",
")",
".",
"header",
"(",
"\"\tSec-Fetch-Dest\t\"",
",",
"\"\tempty\t\"",
")",
".",
"header",
"(",
"\"\tSec-Fetch-Mode\t\"",
",",
"\"\tcors\t\"",
")",
".",
"header",
"(",
"\"\tSec-Fetch-Site\t\"",
",",
"\"\tsame-origin\t\"",
")",
".",
"header",
"(",
"\"\tTE\t\"",
",",
"\"\ttrailers\t\"",
")",
".",
"header",
"(",
"\"\tUser-Agent\t\"",
",",
"\"\tMozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0\t\"",
")",
".",
"header",
"(",
"\"\tX-Requested-With\t\"",
",",
"\"\tXMLHttpRequest\t\"",
")",
".",
"cookie",
"(",
"\"\t__gads\t\"",
",",
"\"ID=cac347f4ea00c827-22e6985cd7b30077:T=1623028684:S=ALNI_Mb08vi05DvJ9rNX40VI7XTtkDZxtg\"",
")",
".",
"cookie",
"(",
"\"\t_ga\t\"",
",",
"\"GA1.3.664574251.1623028681\"",
")",
".",
"cookie",
"(",
"\"\t_gasessionid\"",
",",
"\"20210607044333681623112196534\"",
")",
".",
"cookie",
"(",
"\"\tcto_bundle\t\"",
",",
"\"4F9X119TZnBnTyUyQjlUUG5HVjBrZVJUY2h0STAyczU1SHZYUUIzUTJXc1JXSldjQ1lpRTBRVjRlVzFYbGZiTFVBVFZJcHJsOUJFSUVCJTJGZUUxcVhzQmVGV3lMMGQyWUJxaDJnZ0t4YkZ1MVFINGdlaU0lMkJXcDVqVzJLdHdsY2U2U2VBNlFnUDZocDBIR2E1bmJJTEoxa1VGT0NiYkElM0QlM0Q\"",
")",
".",
"data",
"(",
"\"action\"",
",",
"\"infinite_scroll\"",
")",
".",
"data",
"(",
"\"page\"",
",",
"\"3\"",
")",
".",
"data",
"(",
"\"currentday\"",
",",
"\"\"",
")",
".",
"data",
"(",
"\"charset\"",
",",
"\"UTF-8\"",
")",
".",
"data",
"(",
"\"order\"",
",",
"\"DESC\"",
")",
".",
"ignoreContentType",
"(",
"true",
")",
".",
"post",
"(",
")",
";",
"App",
"parserInfo",
"=",
"new",
"App",
"(",
"document",
")",
";",
"parserInfo",
".",
"document",
".",
"append",
"(",
"document",
".",
"html",
"(",
")",
")",
";",
"URLs",
"=",
"parserInfo",
".",
"getURLInfoPagePost",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"URLs",
";",
"}"
] | [
97,
1
] | [
143,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Iteracoes. | null | /*Verificar se tem o nome Nadia no array de nomes | /*Verificar se tem o nome Nadia no array de nomes | public static void imprimirNomesFiltrados(String... nomes) {
String nomesParaImprimir = "";
for (String nome : nomes) {
if (nome.equals("Nadia")) {
nomesParaImprimir += " " + nome;
}
}
System.out.println("For: " + nomesParaImprimir);
/*Utilizando Java API*/
String nomesParaImprimirDaStream = Stream.of(nomes)
.filter(nome -> nome.equals("Nadia"))
.collect(Collectors.joining()); //coloca um espaço entre as strings
System.out.println("Stream: " + nomesParaImprimirDaStream);
} | [
"public",
"static",
"void",
"imprimirNomesFiltrados",
"(",
"String",
"...",
"nomes",
")",
"{",
"String",
"nomesParaImprimir",
"=",
"\"\"",
";",
"for",
"(",
"String",
"nome",
":",
"nomes",
")",
"{",
"if",
"(",
"nome",
".",
"equals",
"(",
"\"Nadia\"",
")",
")",
"{",
"nomesParaImprimir",
"+=",
"\" \"",
"+",
"nome",
";",
"}",
"}",
"System",
".",
"out",
".",
"println",
"(",
"\"For: \"",
"+",
"nomesParaImprimir",
")",
";",
"/*Utilizando Java API*/",
"String",
"nomesParaImprimirDaStream",
"=",
"Stream",
".",
"of",
"(",
"nomes",
")",
".",
"filter",
"(",
"nome",
"->",
"nome",
".",
"equals",
"(",
"\"Nadia\"",
")",
")",
".",
"collect",
"(",
"Collectors",
".",
"joining",
"(",
")",
")",
";",
"//coloca um espaço entre as strings",
"System",
".",
"out",
".",
"println",
"(",
"\"Stream: \"",
"+",
"nomesParaImprimirDaStream",
")",
";",
"}"
] | [
28,
4
] | [
48,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
JogoBarata. | null | /* Método de matar a barata com o click do mouse, também faz a barata mudar
de lugar, a medida que o mouse entra no campo do componente/barata | /* Método de matar a barata com o click do mouse, também faz a barata mudar
de lugar, a medida que o mouse entra no campo do componente/barata | public void matarBarata() {
lBarata.addMouseListener(new MouseListener() {
@Override
public void mouseClicked(MouseEvent e) {
++conta;
lContando.setText(conta + "");
lBarata.setIcon(iconBarataMorta);
}
@Override
public void mousePressed(MouseEvent e) {}
@Override
public void mouseReleased(MouseEvent e) {}
@Override
public void mouseEntered(MouseEvent e) {
lBarata.setIcon(iconBarata);
x = (int) (Math.random() * 620);
y = (int) (Math.random() * 520);
lBarata.setBounds(x, y, 321, 304);
}
@Override
public void mouseExited(MouseEvent e) {}
});
/* Esse looping faz com que a barata fique trocando de lugar aleatoriamente
* e infinitamente assim que começa, a não ser que seja feitoInfinito == true */
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);
}
}
} | [
"public",
"void",
"matarBarata",
"(",
")",
"{",
"lBarata",
".",
"addMouseListener",
"(",
"new",
"MouseListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"mouseClicked",
"(",
"MouseEvent",
"e",
")",
"{",
"++",
"conta",
";",
"lContando",
".",
"setText",
"(",
"conta",
"+",
"\"\"",
")",
";",
"lBarata",
".",
"setIcon",
"(",
"iconBarataMorta",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"mousePressed",
"(",
"MouseEvent",
"e",
")",
"{",
"}",
"@",
"Override",
"public",
"void",
"mouseReleased",
"(",
"MouseEvent",
"e",
")",
"{",
"}",
"@",
"Override",
"public",
"void",
"mouseEntered",
"(",
"MouseEvent",
"e",
")",
"{",
"lBarata",
".",
"setIcon",
"(",
"iconBarata",
")",
";",
"x",
"=",
"(",
"int",
")",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"620",
")",
";",
"y",
"=",
"(",
"int",
")",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"520",
")",
";",
"lBarata",
".",
"setBounds",
"(",
"x",
",",
"y",
",",
"321",
",",
"304",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"mouseExited",
"(",
"MouseEvent",
"e",
")",
"{",
"}",
"}",
")",
";",
"/* Esse looping faz com que a barata fique trocando de lugar aleatoriamente\n \t * e infinitamente assim que começa, a não ser que seja feitoInfinito == true */",
"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",
")",
";",
"}",
"}",
"}"
] | [
114,
4
] | [
154,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
ProdutoService. | null | Programacao com uso de Method Query do JPA no nível Repository | Programacao com uso de Method Query do JPA no nível Repository | public Page<Produto> search(String nome, List<Integer> ids, Integer page, Integer linesPerPage, String orderBy, String direction) {
List<Categoria> categorias = categoriaRepository.findAllById(ids);
PageRequest pageRequest = PageRequest.of(page, linesPerPage, Direction.valueOf(direction), orderBy);
return repo.findDistinctByNomeContainingAndCategoriasIn(nome, categorias, pageRequest);
} | [
"public",
"Page",
"<",
"Produto",
">",
"search",
"(",
"String",
"nome",
",",
"List",
"<",
"Integer",
">",
"ids",
",",
"Integer",
"page",
",",
"Integer",
"linesPerPage",
",",
"String",
"orderBy",
",",
"String",
"direction",
")",
"{",
"List",
"<",
"Categoria",
">",
"categorias",
"=",
"categoriaRepository",
".",
"findAllById",
"(",
"ids",
")",
";",
"PageRequest",
"pageRequest",
"=",
"PageRequest",
".",
"of",
"(",
"page",
",",
"linesPerPage",
",",
"Direction",
".",
"valueOf",
"(",
"direction",
")",
",",
"orderBy",
")",
";",
"return",
"repo",
".",
"findDistinctByNomeContainingAndCategoriasIn",
"(",
"nome",
",",
"categorias",
",",
"pageRequest",
")",
";",
"}"
] | [
33,
1
] | [
37,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
ProdutosController. | null | depois de associar, atualizar o produto com a nova imagem. | depois de associar, atualizar o produto com a nova imagem. | @PostMapping("/{id}/imagens")
@Transactional
public ResponseEntity<?> salvaImagens(@PathVariable("id") Long id,
@Valid ImagensDto request,
@AuthenticationPrincipal UsuarioLogado usuarioLogado){
Produtos produto = manager.find(Produtos.class, id);
Optional<Usuario> dono = usuarioRepository.findByLogin(usuarioLogado.getUsername());
if(!produto.pertenceAoUsuario(dono)){
throw new ResponseStatusException(HttpStatus.FORBIDDEN);
}
Set<String> links = uploaderFake.envia(request.getImagens());
produto.associaImagens(links);
manager.merge(produto);
return ResponseEntity.ok().build();
} | [
"@",
"PostMapping",
"(",
"\"/{id}/imagens\"",
")",
"@",
"Transactional",
"public",
"ResponseEntity",
"<",
"?",
">",
"salvaImagens",
"(",
"@",
"PathVariable",
"(",
"\"id\"",
")",
"Long",
"id",
",",
"@",
"Valid",
"ImagensDto",
"request",
",",
"@",
"AuthenticationPrincipal",
"UsuarioLogado",
"usuarioLogado",
")",
"{",
"Produtos",
"produto",
"=",
"manager",
".",
"find",
"(",
"Produtos",
".",
"class",
",",
"id",
")",
";",
"Optional",
"<",
"Usuario",
">",
"dono",
"=",
"usuarioRepository",
".",
"findByLogin",
"(",
"usuarioLogado",
".",
"getUsername",
"(",
")",
")",
";",
"if",
"(",
"!",
"produto",
".",
"pertenceAoUsuario",
"(",
"dono",
")",
")",
"{",
"throw",
"new",
"ResponseStatusException",
"(",
"HttpStatus",
".",
"FORBIDDEN",
")",
";",
"}",
"Set",
"<",
"String",
">",
"links",
"=",
"uploaderFake",
".",
"envia",
"(",
"request",
".",
"getImagens",
"(",
")",
")",
";",
"produto",
".",
"associaImagens",
"(",
"links",
")",
";",
"manager",
".",
"merge",
"(",
"produto",
")",
";",
"return",
"ResponseEntity",
".",
"ok",
"(",
")",
".",
"build",
"(",
")",
";",
"}"
] | [
67,
4
] | [
82,
1
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Habitacion. | null | Getter para atributo Estado | Getter para atributo Estado | public String getEstado()
{
return Estado;
} | [
"public",
"String",
"getEstado",
"(",
")",
"{",
"return",
"Estado",
";",
"}"
] | [
87,
4
] | [
90,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Jogo. | null | método privado e interno para inicialização dos jogadores: | método privado e interno para inicialização dos jogadores: | private void inicializaJogadores(String str1, String str2) {
Peca pecasIndividuais[] = new Peca[16]; //vetor auxiliar de peças, também com 16 elementos
for (int i = 0; i < 16; i++) {
pecasIndividuais[i] = pecas[i]; //atribuindo no vetor auxiliar as 16 primeiras peças do vetor de 32 elementos
}
this.jogadores[0] = new Jogador(str1, pecasIndividuais); //instanciando o jogador 1, atribuindo nome e vetor de peças do mesmo
for (int i = 0; i < 16; i++) {
pecasIndividuais[i] = pecas[i+16]; //atribuindo no vetor auxiliar as 16 últimas peças do vetor de 32 elementos
}
this.jogadores[1] = new Jogador(str2, pecasIndividuais); //instanciando o jogador 2, atribuindo nome e vetor de peças do mesmo
} | [
"private",
"void",
"inicializaJogadores",
"(",
"String",
"str1",
",",
"String",
"str2",
")",
"{",
"Peca",
"pecasIndividuais",
"[",
"]",
"=",
"new",
"Peca",
"[",
"16",
"]",
";",
"//vetor auxiliar de peças, também com 16 elementos",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"16",
";",
"i",
"++",
")",
"{",
"pecasIndividuais",
"[",
"i",
"]",
"=",
"pecas",
"[",
"i",
"]",
";",
"//atribuindo no vetor auxiliar as 16 primeiras peças do vetor de 32 elementos",
"}",
"this",
".",
"jogadores",
"[",
"0",
"]",
"=",
"new",
"Jogador",
"(",
"str1",
",",
"pecasIndividuais",
")",
";",
"//instanciando o jogador 1, atribuindo nome e vetor de peças do mesmo",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"16",
";",
"i",
"++",
")",
"{",
"pecasIndividuais",
"[",
"i",
"]",
"=",
"pecas",
"[",
"i",
"+",
"16",
"]",
";",
"//atribuindo no vetor auxiliar as 16 últimas peças do vetor de 32 elementos",
"}",
"this",
".",
"jogadores",
"[",
"1",
"]",
"=",
"new",
"Jogador",
"(",
"str2",
",",
"pecasIndividuais",
")",
";",
"//instanciando o jogador 2, atribuindo nome e vetor de peças do mesmo",
"}"
] | [
71,
4
] | [
82,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Map. | null | * Retorna a distancia entre dois pontos do mapa, -1 caso nao eh possivel chegar ** | * Retorna a distancia entre dois pontos do mapa, -1 caso nao eh possivel chegar ** | private int distanceToCell(int iSource, int jSource, int iDest, int jDest) {
/*** preparar ambiente e variaveis para BFS ***/
boolean visited[][] = new boolean[mapHeight][mapWidth];
for(int i=0;i < mapHeight; i++) {
for(int j=0; j < mapWidth; j++) {
if(mapCell[i][j].isWalkableBravia()) {
visited[i][j] = false;
}else {
visited[i][j] = true;
}
}
}
visited[iDest][jDest] = false;
visited[iSource][jSource] = true;
QElement source = new QElement(iSource,jSource,0);
Queue<QElement> q = new LinkedList<QElement>(); //Queue eh uma interface, precisa instaciar ela em algo pra usar
/*** comeca a BFS ***/
q.add(source);
while(!q.isEmpty()) {
QElement p = q.poll(); //pega o primeiro e ja o exclui
if(p.getIPos() == iDest && p.getJPos() == jDest) { //encontrou o destino
return p.getDistance();
}
//moving up
if(p.getIPos() - 1 >= 0 && visited[p.getIPos()-1][p.getJPos()] == false) {
q.add(new QElement(p.getIPos()-1,p.getJPos(),p.getDistance()+1));
visited[p.getIPos() - 1][p.getJPos()] = true;
}
//moving down
if(p.getIPos() + 1 < mapHeight && visited[p.getIPos()+1][p.getJPos()] == false) {
q.add(new QElement(p.getIPos()+1,p.getJPos(),p.getDistance()+1));
visited[p.getIPos() + 1][p.getJPos()] = true;
}
//moving left
if(p.getJPos() - 1 >= 0 && visited[p.getIPos()][p.getJPos()-1] == false) {
q.add(new QElement(p.getIPos(),p.getJPos()-1,p.getDistance()+1));
visited[p.getIPos()][p.getJPos()-1] = true;
}
//moving right
if(p.getJPos() + 1 < mapWidth && visited[p.getIPos()][p.getJPos()+1] == false) {
q.add(new QElement(p.getIPos(),p.getJPos()+1,p.getDistance()+1));
visited[p.getIPos()][p.getJPos()+1] = true;
}
}
return -1; //terminou a queue e nao encontrou caminho para Dest.
} | [
"private",
"int",
"distanceToCell",
"(",
"int",
"iSource",
",",
"int",
"jSource",
",",
"int",
"iDest",
",",
"int",
"jDest",
")",
"{",
"/*** preparar ambiente e variaveis para BFS ***/",
"boolean",
"visited",
"[",
"]",
"[",
"]",
"=",
"new",
"boolean",
"[",
"mapHeight",
"]",
"[",
"mapWidth",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"mapHeight",
";",
"i",
"++",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"mapWidth",
";",
"j",
"++",
")",
"{",
"if",
"(",
"mapCell",
"[",
"i",
"]",
"[",
"j",
"]",
".",
"isWalkableBravia",
"(",
")",
")",
"{",
"visited",
"[",
"i",
"]",
"[",
"j",
"]",
"=",
"false",
";",
"}",
"else",
"{",
"visited",
"[",
"i",
"]",
"[",
"j",
"]",
"=",
"true",
";",
"}",
"}",
"}",
"visited",
"[",
"iDest",
"]",
"[",
"jDest",
"]",
"=",
"false",
";",
"visited",
"[",
"iSource",
"]",
"[",
"jSource",
"]",
"=",
"true",
";",
"QElement",
"source",
"=",
"new",
"QElement",
"(",
"iSource",
",",
"jSource",
",",
"0",
")",
";",
"Queue",
"<",
"QElement",
">",
"q",
"=",
"new",
"LinkedList",
"<",
"QElement",
">",
"(",
")",
";",
"//Queue eh uma interface, precisa instaciar ela em algo pra usar",
"/*** comeca a BFS ***/",
"q",
".",
"add",
"(",
"source",
")",
";",
"while",
"(",
"!",
"q",
".",
"isEmpty",
"(",
")",
")",
"{",
"QElement",
"p",
"=",
"q",
".",
"poll",
"(",
")",
";",
"//pega o primeiro e ja o exclui",
"if",
"(",
"p",
".",
"getIPos",
"(",
")",
"==",
"iDest",
"&&",
"p",
".",
"getJPos",
"(",
")",
"==",
"jDest",
")",
"{",
"//encontrou o destino",
"return",
"p",
".",
"getDistance",
"(",
")",
";",
"}",
"//moving up",
"if",
"(",
"p",
".",
"getIPos",
"(",
")",
"-",
"1",
">=",
"0",
"&&",
"visited",
"[",
"p",
".",
"getIPos",
"(",
")",
"-",
"1",
"]",
"[",
"p",
".",
"getJPos",
"(",
")",
"]",
"==",
"false",
")",
"{",
"q",
".",
"add",
"(",
"new",
"QElement",
"(",
"p",
".",
"getIPos",
"(",
")",
"-",
"1",
",",
"p",
".",
"getJPos",
"(",
")",
",",
"p",
".",
"getDistance",
"(",
")",
"+",
"1",
")",
")",
";",
"visited",
"[",
"p",
".",
"getIPos",
"(",
")",
"-",
"1",
"]",
"[",
"p",
".",
"getJPos",
"(",
")",
"]",
"=",
"true",
";",
"}",
"//moving down",
"if",
"(",
"p",
".",
"getIPos",
"(",
")",
"+",
"1",
"<",
"mapHeight",
"&&",
"visited",
"[",
"p",
".",
"getIPos",
"(",
")",
"+",
"1",
"]",
"[",
"p",
".",
"getJPos",
"(",
")",
"]",
"==",
"false",
")",
"{",
"q",
".",
"add",
"(",
"new",
"QElement",
"(",
"p",
".",
"getIPos",
"(",
")",
"+",
"1",
",",
"p",
".",
"getJPos",
"(",
")",
",",
"p",
".",
"getDistance",
"(",
")",
"+",
"1",
")",
")",
";",
"visited",
"[",
"p",
".",
"getIPos",
"(",
")",
"+",
"1",
"]",
"[",
"p",
".",
"getJPos",
"(",
")",
"]",
"=",
"true",
";",
"}",
"//moving left",
"if",
"(",
"p",
".",
"getJPos",
"(",
")",
"-",
"1",
">=",
"0",
"&&",
"visited",
"[",
"p",
".",
"getIPos",
"(",
")",
"]",
"[",
"p",
".",
"getJPos",
"(",
")",
"-",
"1",
"]",
"==",
"false",
")",
"{",
"q",
".",
"add",
"(",
"new",
"QElement",
"(",
"p",
".",
"getIPos",
"(",
")",
",",
"p",
".",
"getJPos",
"(",
")",
"-",
"1",
",",
"p",
".",
"getDistance",
"(",
")",
"+",
"1",
")",
")",
";",
"visited",
"[",
"p",
".",
"getIPos",
"(",
")",
"]",
"[",
"p",
".",
"getJPos",
"(",
")",
"-",
"1",
"]",
"=",
"true",
";",
"}",
"//moving right",
"if",
"(",
"p",
".",
"getJPos",
"(",
")",
"+",
"1",
"<",
"mapWidth",
"&&",
"visited",
"[",
"p",
".",
"getIPos",
"(",
")",
"]",
"[",
"p",
".",
"getJPos",
"(",
")",
"+",
"1",
"]",
"==",
"false",
")",
"{",
"q",
".",
"add",
"(",
"new",
"QElement",
"(",
"p",
".",
"getIPos",
"(",
")",
",",
"p",
".",
"getJPos",
"(",
")",
"+",
"1",
",",
"p",
".",
"getDistance",
"(",
")",
"+",
"1",
")",
")",
";",
"visited",
"[",
"p",
".",
"getIPos",
"(",
")",
"]",
"[",
"p",
".",
"getJPos",
"(",
")",
"+",
"1",
"]",
"=",
"true",
";",
"}",
"}",
"return",
"-",
"1",
";",
"//terminou a queue e nao encontrou caminho para Dest.",
"}"
] | [
86,
1
] | [
136,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
POIServiceTests. | null | Testes em create | Testes em create | @Test
public void create() throws POIException {
final Double mOne = Double.valueOf(-1);
final Double dValue = Double.valueOf(1435674.003);
assertThrows(POIException.class, () -> {
poiService.create(null);
});
assertThrows(POIException.class, () -> {
POIDTO dto = new POIDTO(null, null, null);
poiService.create(dto);
});
assertThrows(POIException.class, () -> {
POIDTO dto = new POIDTO(null, mOne, null);
poiService.create(dto);
});
assertThrows(POIException.class, () -> {
POIDTO dto = new POIDTO(null, null, mOne);
poiService.create(dto);
});
assertThrows(POIException.class, () -> {
POIDTO dto = new POIDTO("A", null, null);
poiService.create(dto);
});
assertThrows(POIException.class, () -> {
POIDTO dto = new POIDTO("B", mOne, null);
poiService.create(dto);
});
assertThrows(POIException.class, () -> {
POIDTO dto = new POIDTO("C", null, mOne);
poiService.create(dto);
});
assertThrows(POIException.class, () -> {
POIDTO dto = new POIDTO("D", mOne, dValue);
poiService.create(dto);
});
assertThrows(POIException.class, () -> {
POIDTO dto = new POIDTO("E", dValue, mOne);
poiService.create(dto);
});
assertThrows(POIException.class, () -> {
POIDTO dto = new POIDTO("", dValue, dValue);
poiService.create(dto);
});
// Desabilitado para base em atividade
/*
* POIDTO dtoO = new POIDTO("F", dValue, dValue);
* assertNotNull(poiService.create(dtoO)); assertThrows(POIException.class, () ->
* { POIDTO dto = new POIDTO("F", dValue, dValue); poiService.create(dto); });
* dtoO = new POIDTO("G", 0D, 10D); assertNotNull(poiService.create(dtoO)); dtoO
* = new POIDTO("H", 10D, 0D); assertNotNull(poiService.create(dtoO));
*/
} | [
"@",
"Test",
"public",
"void",
"create",
"(",
")",
"throws",
"POIException",
"{",
"final",
"Double",
"mOne",
"=",
"Double",
".",
"valueOf",
"(",
"-",
"1",
")",
";",
"final",
"Double",
"dValue",
"=",
"Double",
".",
"valueOf",
"(",
"1435674.003",
")",
";",
"assertThrows",
"(",
"POIException",
".",
"class",
",",
"(",
")",
"->",
"{",
"poiService",
".",
"create",
"(",
"null",
")",
";",
"}",
")",
";",
"assertThrows",
"(",
"POIException",
".",
"class",
",",
"(",
")",
"->",
"{",
"POIDTO",
"dto",
"=",
"new",
"POIDTO",
"(",
"null",
",",
"null",
",",
"null",
")",
";",
"poiService",
".",
"create",
"(",
"dto",
")",
";",
"}",
")",
";",
"assertThrows",
"(",
"POIException",
".",
"class",
",",
"(",
")",
"->",
"{",
"POIDTO",
"dto",
"=",
"new",
"POIDTO",
"(",
"null",
",",
"mOne",
",",
"null",
")",
";",
"poiService",
".",
"create",
"(",
"dto",
")",
";",
"}",
")",
";",
"assertThrows",
"(",
"POIException",
".",
"class",
",",
"(",
")",
"->",
"{",
"POIDTO",
"dto",
"=",
"new",
"POIDTO",
"(",
"null",
",",
"null",
",",
"mOne",
")",
";",
"poiService",
".",
"create",
"(",
"dto",
")",
";",
"}",
")",
";",
"assertThrows",
"(",
"POIException",
".",
"class",
",",
"(",
")",
"->",
"{",
"POIDTO",
"dto",
"=",
"new",
"POIDTO",
"(",
"\"A\"",
",",
"null",
",",
"null",
")",
";",
"poiService",
".",
"create",
"(",
"dto",
")",
";",
"}",
")",
";",
"assertThrows",
"(",
"POIException",
".",
"class",
",",
"(",
")",
"->",
"{",
"POIDTO",
"dto",
"=",
"new",
"POIDTO",
"(",
"\"B\"",
",",
"mOne",
",",
"null",
")",
";",
"poiService",
".",
"create",
"(",
"dto",
")",
";",
"}",
")",
";",
"assertThrows",
"(",
"POIException",
".",
"class",
",",
"(",
")",
"->",
"{",
"POIDTO",
"dto",
"=",
"new",
"POIDTO",
"(",
"\"C\"",
",",
"null",
",",
"mOne",
")",
";",
"poiService",
".",
"create",
"(",
"dto",
")",
";",
"}",
")",
";",
"assertThrows",
"(",
"POIException",
".",
"class",
",",
"(",
")",
"->",
"{",
"POIDTO",
"dto",
"=",
"new",
"POIDTO",
"(",
"\"D\"",
",",
"mOne",
",",
"dValue",
")",
";",
"poiService",
".",
"create",
"(",
"dto",
")",
";",
"}",
")",
";",
"assertThrows",
"(",
"POIException",
".",
"class",
",",
"(",
")",
"->",
"{",
"POIDTO",
"dto",
"=",
"new",
"POIDTO",
"(",
"\"E\"",
",",
"dValue",
",",
"mOne",
")",
";",
"poiService",
".",
"create",
"(",
"dto",
")",
";",
"}",
")",
";",
"assertThrows",
"(",
"POIException",
".",
"class",
",",
"(",
")",
"->",
"{",
"POIDTO",
"dto",
"=",
"new",
"POIDTO",
"(",
"\"\"",
",",
"dValue",
",",
"dValue",
")",
";",
"poiService",
".",
"create",
"(",
"dto",
")",
";",
"}",
")",
";",
"// Desabilitado para base em atividade",
"/*\n\t\t * POIDTO dtoO = new POIDTO(\"F\", dValue, dValue);\n\t\t * assertNotNull(poiService.create(dtoO)); assertThrows(POIException.class, () ->\n\t\t * { POIDTO dto = new POIDTO(\"F\", dValue, dValue); poiService.create(dto); });\n\t\t * dtoO = new POIDTO(\"G\", 0D, 10D); assertNotNull(poiService.create(dtoO)); dtoO\n\t\t * = new POIDTO(\"H\", 10D, 0D); assertNotNull(poiService.create(dtoO));\n\t\t */",
"}"
] | [
29,
1
] | [
80,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
FuncoesTopicos. | null | Função que filtra imoveis abaixo do valor passado | Função que filtra imoveis abaixo do valor passado | public static List<Imovel> q3FiltraPeloValor(int valor) {
List<Imovel> resultado = new ArrayList<>();
//Utiliza o iterador imovel para percorrer a lista
for (Imovel imovel : imoveis) {
//Se o valor do imóvel atual for menor ou igual adicona esse imovel na lista de retorno
if (imovel.getValor() <= valor) {
resultado.add(imovel);
}
}
return resultado;
} | [
"public",
"static",
"List",
"<",
"Imovel",
">",
"q3FiltraPeloValor",
"(",
"int",
"valor",
")",
"{",
"List",
"<",
"Imovel",
">",
"resultado",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"//Utiliza o iterador imovel para percorrer a lista",
"for",
"(",
"Imovel",
"imovel",
":",
"imoveis",
")",
"{",
"//Se o valor do imóvel atual for menor ou igual adicona esse imovel na lista de retorno",
"if",
"(",
"imovel",
".",
"getValor",
"(",
")",
"<=",
"valor",
")",
"{",
"resultado",
".",
"add",
"(",
"imovel",
")",
";",
"}",
"}",
"return",
"resultado",
";",
"}"
] | [
62,
4
] | [
72,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Jogador. | null | Adiciona um golo marcado | Adiciona um golo marcado | public void addGoal(){
numGolos++;
} | [
"public",
"void",
"addGoal",
"(",
")",
"{",
"numGolos",
"++",
";",
"}"
] | [
31,
4
] | [
33,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
TelaUsuario. | null | método responsável pela remoção de usuários | método responsável pela remoção de usuários | private void remover() {
//a estrutura abaixo confirma a remoção do usuário
int confirma = JOptionPane.showConfirmDialog(null, "Tem certeza que deseja remover este usuário ?", "Atenção", JOptionPane.YES_NO_OPTION);
if (confirma == JOptionPane.YES_OPTION) {
String sql = "delete from tbusuario where iduser=?";
try {
pst = conexao.prepareStatement(sql);
pst.setString(1, txtUsuId.getText());
int apagado = pst.executeUpdate();
if (apagado > 0) {
JOptionPane.showMessageDialog(null, "Usuário Removido com sucesso");
txtUsuId.setText(null);
txtUsuNome.setText(null);
txtUsuFone.setText(null);
txtUsuLogin.setText(null);
txtUsuSenha.setText(null);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
}
} | [
"private",
"void",
"remover",
"(",
")",
"{",
"//a estrutura abaixo confirma a remoção do usuário",
"int",
"confirma",
"=",
"JOptionPane",
".",
"showConfirmDialog",
"(",
"null",
",",
"\"Tem certeza que deseja remover este usuário ?\",",
" ",
"Atenção\", J",
"O",
"tionPane.YE",
"S",
"_NO_OPTION);",
"",
"",
"if",
"(",
"confirma",
"==",
"JOptionPane",
".",
"YES_OPTION",
")",
"{",
"String",
"sql",
"=",
"\"delete from tbusuario where iduser=?\"",
";",
"try",
"{",
"pst",
"=",
"conexao",
".",
"prepareStatement",
"(",
"sql",
")",
";",
"pst",
".",
"setString",
"(",
"1",
",",
"txtUsuId",
".",
"getText",
"(",
")",
")",
";",
"int",
"apagado",
"=",
"pst",
".",
"executeUpdate",
"(",
")",
";",
"if",
"(",
"apagado",
">",
"0",
")",
"{",
"JOptionPane",
".",
"showMessageDialog",
"(",
"null",
",",
"\"Usuário Removido com sucesso\")",
";",
"",
"txtUsuId",
".",
"setText",
"(",
"null",
")",
";",
"txtUsuNome",
".",
"setText",
"(",
"null",
")",
";",
"txtUsuFone",
".",
"setText",
"(",
"null",
")",
";",
"txtUsuLogin",
".",
"setText",
"(",
"null",
")",
";",
"txtUsuSenha",
".",
"setText",
"(",
"null",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"JOptionPane",
".",
"showMessageDialog",
"(",
"null",
",",
"e",
")",
";",
"}",
"}",
"}"
] | [
133,
4
] | [
155,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
SecurityConfiguration. | null | aqui usamos os algoritmos de hash | aqui usamos os algoritmos de hash | @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",
"(",
")",
")",
";",
"}"
] | [
39,
2
] | [
42,
3
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Serial. | null | Padrão de String para cada equipamento | Padrão de String para cada equipamento | private String padraoString() {
String padrao = null;
switch (equipamento) {
case "WT1000N":
padrao = "0,0000000,0000000,0000000";
break;
case "3101C":
padrao = "PB: 00000 T: 00000";
break;
case "WT27":
padrao = "EB,B: 000000,T:000000,L: 000000";
break;
}
return padrao;
} | [
"private",
"String",
"padraoString",
"(",
")",
"{",
"String",
"padrao",
"=",
"null",
";",
"switch",
"(",
"equipamento",
")",
"{",
"case",
"\"WT1000N\"",
":",
"padrao",
"=",
"\"0,0000000,0000000,0000000\"",
";",
"break",
";",
"case",
"\"3101C\"",
":",
"padrao",
"=",
"\"PB: 00000 T: 00000\"",
";",
"break",
";",
"case",
"\"WT27\"",
":",
"padrao",
"=",
"\"EB,B: 000000,T:000000,L: 000000\"",
";",
"break",
";",
"}",
"return",
"padrao",
";",
"}"
] | [
178,
4
] | [
192,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
SecurityConfigurations. | null | Configurações de Autorização (diz quem pode acessar cada url, perfis de aceso etc) | Configurações de Autorização (diz quem pode acessar cada url, perfis de aceso etc) | @Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers(HttpMethod.POST,"/usuario")
.permitAll()
.antMatchers(HttpMethod.POST,"/auth")
.permitAll()
.antMatchers(HttpMethod.POST,"/nota-fiscal")
.permitAll()
.antMatchers(HttpMethod.POST,"/ranking-vendedores")
.permitAll()
.anyRequest()
.authenticated()
.and().csrf().disable()
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and().addFilterBefore(new AutenticacaoTokenFilter(usuarioRepository, tokenService), UsernamePasswordAuthenticationFilter.class);
} | [
"@",
"Override",
"protected",
"void",
"configure",
"(",
"HttpSecurity",
"http",
")",
"throws",
"Exception",
"{",
"http",
".",
"authorizeRequests",
"(",
")",
".",
"antMatchers",
"(",
"HttpMethod",
".",
"POST",
",",
"\"/usuario\"",
")",
".",
"permitAll",
"(",
")",
".",
"antMatchers",
"(",
"HttpMethod",
".",
"POST",
",",
"\"/auth\"",
")",
".",
"permitAll",
"(",
")",
".",
"antMatchers",
"(",
"HttpMethod",
".",
"POST",
",",
"\"/nota-fiscal\"",
")",
".",
"permitAll",
"(",
")",
".",
"antMatchers",
"(",
"HttpMethod",
".",
"POST",
",",
"\"/ranking-vendedores\"",
")",
".",
"permitAll",
"(",
")",
".",
"anyRequest",
"(",
")",
".",
"authenticated",
"(",
")",
".",
"and",
"(",
")",
".",
"csrf",
"(",
")",
".",
"disable",
"(",
")",
".",
"sessionManagement",
"(",
")",
".",
"sessionCreationPolicy",
"(",
"SessionCreationPolicy",
".",
"STATELESS",
")",
".",
"and",
"(",
")",
".",
"addFilterBefore",
"(",
"new",
"AutenticacaoTokenFilter",
"(",
"usuarioRepository",
",",
"tokenService",
")",
",",
"UsernamePasswordAuthenticationFilter",
".",
"class",
")",
";",
"}"
] | [
42,
4
] | [
66,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
CaixaService. | null | pega o caixa aberto do usuário informado | pega o caixa aberto do usuário informado | public Optional<Caixa> buscaCaixaUsuario(String usuario) {
Usuario usu = usuarios.buscaUsuario(usuario);
Optional<Caixa> caixaOptional = Optional.ofNullable(caixas.findByCaixaAbertoUsuario(usu.getCodigo()));
return caixaOptional;
} | [
"public",
"Optional",
"<",
"Caixa",
">",
"buscaCaixaUsuario",
"(",
"String",
"usuario",
")",
"{",
"Usuario",
"usu",
"=",
"usuarios",
".",
"buscaUsuario",
"(",
"usuario",
")",
";",
"Optional",
"<",
"Caixa",
">",
"caixaOptional",
"=",
"Optional",
".",
"ofNullable",
"(",
"caixas",
".",
"findByCaixaAbertoUsuario",
"(",
"usu",
".",
"getCodigo",
"(",
")",
")",
")",
";",
"return",
"caixaOptional",
";",
"}"
] | [
179,
1
] | [
183,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
LBSTree. | null | Percorrer os nodos na arvore em ordem | Percorrer os nodos na arvore em ordem | protected void inOrder(LBSTreeNode treeRef) {
if (treeRef != null) {
treeString = treeString + "(";
inOrder(treeRef.linkLeft);
treeString = treeString + " " + treeRef.item + " ";
inOrder(treeRef.linkRight);
treeString = treeString + ")";
}
} | [
"protected",
"void",
"inOrder",
"(",
"LBSTreeNode",
"treeRef",
")",
"{",
"if",
"(",
"treeRef",
"!=",
"null",
")",
"{",
"treeString",
"=",
"treeString",
"+",
"\"(\"",
";",
"inOrder",
"(",
"treeRef",
".",
"linkLeft",
")",
";",
"treeString",
"=",
"treeString",
"+",
"\" \"",
"+",
"treeRef",
".",
"item",
"+",
"\" \"",
";",
"inOrder",
"(",
"treeRef",
".",
"linkRight",
")",
";",
"treeString",
"=",
"treeString",
"+",
"\")\"",
";",
"}",
"}"
] | [
143,
1
] | [
151,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
CarController. | null | /*Para retornar imagem em dados brutos usar:
produces = MediaType.APPLICATION_OCTET_STREAM_VALUE | /*Para retornar imagem em dados brutos usar:
produces = MediaType.APPLICATION_OCTET_STREAM_VALUE | @GetMapping(value = "/{id}/image-car",
produces = MediaType.IMAGE_JPEG_VALUE)
public byte[] getImageWithMediaType(@PathVariable Long id) {
Car car = carService.findById(id);
return car.getImage();
} | [
"@",
"GetMapping",
"(",
"value",
"=",
"\"/{id}/image-car\"",
",",
"produces",
"=",
"MediaType",
".",
"IMAGE_JPEG_VALUE",
")",
"public",
"byte",
"[",
"]",
"getImageWithMediaType",
"(",
"@",
"PathVariable",
"Long",
"id",
")",
"{",
"Car",
"car",
"=",
"carService",
".",
"findById",
"(",
"id",
")",
";",
"return",
"car",
".",
"getImage",
"(",
")",
";",
"}"
] | [
52,
4
] | [
57,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
PessoaService. | null | busca todos os telefones das pessoas | busca todos os telefones das pessoas | public List<Pessoa> getJsonCompleto(List<Pessoa> pessoas, boolean ativos) {
pessoas.stream().forEach(p -> {
if (ativos) {
p.setTelefones(telefoneService.getTelefonesAtivos(p.getId()));
} else {
p.setTelefones(telefoneService.getTelefonesDesativados(p.getId()));
}
});
return pessoas;
} | [
"public",
"List",
"<",
"Pessoa",
">",
"getJsonCompleto",
"(",
"List",
"<",
"Pessoa",
">",
"pessoas",
",",
"boolean",
"ativos",
")",
"{",
"pessoas",
".",
"stream",
"(",
")",
".",
"forEach",
"(",
"p",
"->",
"{",
"if",
"(",
"ativos",
")",
"{",
"p",
".",
"setTelefones",
"(",
"telefoneService",
".",
"getTelefonesAtivos",
"(",
"p",
".",
"getId",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"p",
".",
"setTelefones",
"(",
"telefoneService",
".",
"getTelefonesDesativados",
"(",
"p",
".",
"getId",
"(",
")",
")",
")",
";",
"}",
"}",
")",
";",
"return",
"pessoas",
";",
"}"
] | [
95,
4
] | [
106,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
PersonController. | null | toda requisição de página é acessado atrevés de uma oprç get | toda requisição de página é acessado atrevés de uma oprç get | @PostMapping
@ResponseStatus(HttpStatus.CREATED)
public MessageResponseDTO createPerson(@RequestBody @Valid PersonDTO personDTO){ //informa que esta vindo de uma requisicao do tipo pessoa
return personService.createPerson(personDTO);
} | [
"@",
"PostMapping",
"@",
"ResponseStatus",
"(",
"HttpStatus",
".",
"CREATED",
")",
"public",
"MessageResponseDTO",
"createPerson",
"(",
"@",
"RequestBody",
"@",
"Valid",
"PersonDTO",
"personDTO",
")",
"{",
"//informa que esta vindo de uma requisicao do tipo pessoa",
"return",
"personService",
".",
"createPerson",
"(",
"personDTO",
")",
";",
"}"
] | [
26,
4
] | [
30,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Crud. | null | Atualizar um registro | Atualizar um registro | public void update(T entidade, int id) {
// Modelando o objeto em memória
Entidade novo = new Entidade(entidade);
try {
// Apagando o objeto antigo da memória
this.garbagecolector.create(novo.length, this.arquivoIndiceDireto.read(id));
// Setando a nova ID da entidade
novo.objeto.setId(id);
// Procurando a melhor posição de inserção para o novo objeto
long melhorPos = this.garbagecolector.read(novo.length());
if (melhorPos == -1) melhorPos = this.arquivo.length();
this.arquivo.seek(melhorPos);
// Escrever a entidade no disco
this.arquivo.writeLong(novo.objeto.toByteArray().length);
this.arquivo.write(novo.objeto.toByteArray());
// Atualizando os outros indices
this.arquivoIndiceDireto.update(id, melhorPos);
this.arquivoIndiceIndireto.update(novo.objeto.chaveSecundaria(), id);
this.garbagecolector.delete(melhorPos);
} catch(Exception e) { e.printStackTrace(); }
} | [
"public",
"void",
"update",
"(",
"T",
"entidade",
",",
"int",
"id",
")",
"{",
"// Modelando o objeto em memória",
"Entidade",
"novo",
"=",
"new",
"Entidade",
"(",
"entidade",
")",
";",
"try",
"{",
"// Apagando o objeto antigo da memória",
"this",
".",
"garbagecolector",
".",
"create",
"(",
"novo",
".",
"length",
",",
"this",
".",
"arquivoIndiceDireto",
".",
"read",
"(",
"id",
")",
")",
";",
"// Setando a nova ID da entidade",
"novo",
".",
"objeto",
".",
"setId",
"(",
"id",
")",
";",
"// Procurando a melhor posição de inserção para o novo objeto",
"long",
"melhorPos",
"=",
"this",
".",
"garbagecolector",
".",
"read",
"(",
"novo",
".",
"length",
"(",
")",
")",
";",
"if",
"(",
"melhorPos",
"==",
"-",
"1",
")",
"melhorPos",
"=",
"this",
".",
"arquivo",
".",
"length",
"(",
")",
";",
"this",
".",
"arquivo",
".",
"seek",
"(",
"melhorPos",
")",
";",
"// Escrever a entidade no disco",
"this",
".",
"arquivo",
".",
"writeLong",
"(",
"novo",
".",
"objeto",
".",
"toByteArray",
"(",
")",
".",
"length",
")",
";",
"this",
".",
"arquivo",
".",
"write",
"(",
"novo",
".",
"objeto",
".",
"toByteArray",
"(",
")",
")",
";",
"// Atualizando os outros indices",
"this",
".",
"arquivoIndiceDireto",
".",
"update",
"(",
"id",
",",
"melhorPos",
")",
";",
"this",
".",
"arquivoIndiceIndireto",
".",
"update",
"(",
"novo",
".",
"objeto",
".",
"chaveSecundaria",
"(",
")",
",",
"id",
")",
";",
"this",
".",
"garbagecolector",
".",
"delete",
"(",
"melhorPos",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] | [
110,
4
] | [
135,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
DoubleRecursiveLinkedListImpl. | null | retorna a soma de todos os elementos da lista | retorna a soma de todos os elementos da lista | @Override
public int soma() {
return this.soma(this.head);
} | [
"@",
"Override",
"public",
"int",
"soma",
"(",
")",
"{",
"return",
"this",
".",
"soma",
"(",
"this",
".",
"head",
")",
";",
"}"
] | [
58,
1
] | [
61,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
App. | null | Conexão da página 2 utilizando Método POST | Conexão da página 2 utilizando Método POST | public static List<String> getListaURLsPag2() {
List<String> URLs = new ArrayList<String>();
try {
Document document = Jsoup.connect("https://www.infomoney.com.br/mercados/?infinity=scrolling")
.header(" Content-Type " , "application/x-www-form-urlencoded; charset=UTF-8")
.header("X-Requested-With","XMLHttpRequest")
.header("Accept", " */* ")
.header(" Accept-Encoding " , " gzip, deflate, br")
.header(" Accept-Language " , " en-US,en;q=0.5")
.header(" Connection " , " keep-alive")
.header(" Content-Length " , " 3520 ")
.header(" Host " , " www.infomoney.com.br")
.header(" Origin " , " https://www.infomoney.com.br")
.header(" Referer " , " https://www.infomoney.com.br/mercados/")
.header(" Sec-Fetch-Dest " , " empty ")
.header(" Sec-Fetch-Mode " , " cors ")
.header(" Sec-Fetch-Site " , " same-origin ")
.header(" TE " , " trailers ")
.header(" User-Agent " , " Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0 ")
.header(" X-Requested-With " , " XMLHttpRequest ")
.cookie(" __gads ", "ID=cac347f4ea00c827-22e6985cd7b30077:T=1623028684:S=ALNI_Mb08vi05DvJ9rNX40VI7XTtkDZxtg")
.cookie(" _ga ","GA1.3.664574251.1623028681")
.cookie(" _gasessionid", "20210607044333681623112196534" )
.cookie(" cto_bundle ","4F9X119TZnBnTyUyQjlUUG5HVjBrZVJUY2h0STAyczU1SHZYUUIzUTJXc1JXSldjQ1lpRTBRVjRlVzFYbGZiTFVBVFZJcHJsOUJFSUVCJTJGZUUxcVhzQmVGV3lMMGQyWUJxaDJnZ0t4YkZ1MVFINGdlaU0lMkJXcDVqVzJLdHdsY2U2U2VBNlFnUDZocDBIR2E1bmJJTEoxa1VGT0NiYkElM0QlM0Q")
.data("action","infinite_scroll")
.data("page","2")
.data("currentday","")
.data("charset","UTF-8")
.data("order","DESC")
.ignoreContentType(true)
.post();
App parserInfo = new App(document);
parserInfo.document.append(document.html());
URLs= parserInfo.getURLInfoPagePost();
} catch (IOException e) {
e.printStackTrace();
}
return URLs;
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getListaURLsPag2",
"(",
")",
"{",
"List",
"<",
"String",
">",
"URLs",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"try",
"{",
"Document",
"document",
"=",
"Jsoup",
".",
"connect",
"(",
"\"https://www.infomoney.com.br/mercados/?infinity=scrolling\"",
")",
".",
"header",
"(",
"\"\tContent-Type\t\"",
",",
"\"application/x-www-form-urlencoded; charset=UTF-8\"",
")",
".",
"header",
"(",
"\"X-Requested-With\"",
",",
"\"XMLHttpRequest\"",
")",
".",
"header",
"(",
"\"Accept\"",
",",
"\" */* \"",
")",
".",
"header",
"(",
"\"\tAccept-Encoding\t\"",
",",
"\"\tgzip, deflate, br\"",
")",
".",
"header",
"(",
"\"\tAccept-Language\t\"",
",",
"\"\ten-US,en;q=0.5\"",
")",
".",
"header",
"(",
"\"\tConnection\t\"",
",",
"\"\tkeep-alive\"",
")",
".",
"header",
"(",
"\"\tContent-Length\t\"",
",",
"\"\t3520\t\"",
")",
".",
"header",
"(",
"\"\tHost\t\"",
",",
"\"\twww.infomoney.com.br\"",
")",
".",
"header",
"(",
"\"\tOrigin\t\"",
",",
"\"\thttps://www.infomoney.com.br\"",
")",
".",
"header",
"(",
"\"\tReferer\t\"",
",",
"\"\thttps://www.infomoney.com.br/mercados/\"",
")",
".",
"header",
"(",
"\"\tSec-Fetch-Dest\t\"",
",",
"\"\tempty\t\"",
")",
".",
"header",
"(",
"\"\tSec-Fetch-Mode\t\"",
",",
"\"\tcors\t\"",
")",
".",
"header",
"(",
"\"\tSec-Fetch-Site\t\"",
",",
"\"\tsame-origin\t\"",
")",
".",
"header",
"(",
"\"\tTE\t\"",
",",
"\"\ttrailers\t\"",
")",
".",
"header",
"(",
"\"\tUser-Agent\t\"",
",",
"\"\tMozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0\t\"",
")",
".",
"header",
"(",
"\"\tX-Requested-With\t\"",
",",
"\"\tXMLHttpRequest\t\"",
")",
".",
"cookie",
"(",
"\"\t__gads\t\"",
",",
"\"ID=cac347f4ea00c827-22e6985cd7b30077:T=1623028684:S=ALNI_Mb08vi05DvJ9rNX40VI7XTtkDZxtg\"",
")",
".",
"cookie",
"(",
"\"\t_ga\t\"",
",",
"\"GA1.3.664574251.1623028681\"",
")",
".",
"cookie",
"(",
"\"\t_gasessionid\"",
",",
"\"20210607044333681623112196534\"",
")",
".",
"cookie",
"(",
"\"\tcto_bundle\t\"",
",",
"\"4F9X119TZnBnTyUyQjlUUG5HVjBrZVJUY2h0STAyczU1SHZYUUIzUTJXc1JXSldjQ1lpRTBRVjRlVzFYbGZiTFVBVFZJcHJsOUJFSUVCJTJGZUUxcVhzQmVGV3lMMGQyWUJxaDJnZ0t4YkZ1MVFINGdlaU0lMkJXcDVqVzJLdHdsY2U2U2VBNlFnUDZocDBIR2E1bmJJTEoxa1VGT0NiYkElM0QlM0Q\"",
")",
".",
"data",
"(",
"\"action\"",
",",
"\"infinite_scroll\"",
")",
".",
"data",
"(",
"\"page\"",
",",
"\"2\"",
")",
".",
"data",
"(",
"\"currentday\"",
",",
"\"\"",
")",
".",
"data",
"(",
"\"charset\"",
",",
"\"UTF-8\"",
")",
".",
"data",
"(",
"\"order\"",
",",
"\"DESC\"",
")",
".",
"ignoreContentType",
"(",
"true",
")",
".",
"post",
"(",
")",
";",
"App",
"parserInfo",
"=",
"new",
"App",
"(",
"document",
")",
";",
"parserInfo",
".",
"document",
".",
"append",
"(",
"document",
".",
"html",
"(",
")",
")",
";",
"URLs",
"=",
"parserInfo",
".",
"getURLInfoPagePost",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"URLs",
";",
"}"
] | [
48,
1
] | [
94,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
aula02ex. | null | 10. Perimetro de um circulo com raio r | 10. Perimetro de um circulo com raio r | static double circleperimeter(int r) {
return 2 * Math.PI * r;
} | [
"static",
"double",
"circleperimeter",
"(",
"int",
"r",
")",
"{",
"return",
"2",
"*",
"Math",
".",
"PI",
"*",
"r",
";",
"}"
] | [
90,
4
] | [
92,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
TelaOS. | null | método para imprimir uma os | método para imprimir uma os | private void imprimir_os(){
// imprimindo uma os
int confirma = JOptionPane.showConfirmDialog(null,"Confirma a impressão desta OS?","Atenção",JOptionPane.YES_NO_OPTION);
if (confirma == JOptionPane.YES_OPTION){
//emitindo o relatório com o framework JasperReports
try {
//usando a clsse HashMap para criar um filtro
HashMap filtro = new HashMap();
filtro.put("os",Integer.parseInt(txtOs.getText()));
//Usando a classe JasperPrint para preparar a impressão de um relatório
JasperPrint print = JasperFillManager.fillReport("C:/reports/os.jasper",filtro,conexao);
//a linha abaixo exibe o relatório através da classe JasperViewer
JasperViewer.viewReport(print,false);
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
}
} | [
"private",
"void",
"imprimir_os",
"(",
")",
"{",
"// imprimindo uma os",
"int",
"confirma",
"=",
"JOptionPane",
".",
"showConfirmDialog",
"(",
"null",
",",
"\"Confirma a impressão desta OS?\",",
"\"",
"Atenção\",JO",
"p",
"tionPane.YE",
"S",
"_NO_OPTION);",
"",
"",
"if",
"(",
"confirma",
"==",
"JOptionPane",
".",
"YES_OPTION",
")",
"{",
"//emitindo o relatório com o framework JasperReports",
"try",
"{",
"//usando a clsse HashMap para criar um filtro",
"HashMap",
"filtro",
"=",
"new",
"HashMap",
"(",
")",
";",
"filtro",
".",
"put",
"(",
"\"os\"",
",",
"Integer",
".",
"parseInt",
"(",
"txtOs",
".",
"getText",
"(",
")",
")",
")",
";",
"//Usando a classe JasperPrint para preparar a impressão de um relatório",
"JasperPrint",
"print",
"=",
"JasperFillManager",
".",
"fillReport",
"(",
"\"C:/reports/os.jasper\"",
",",
"filtro",
",",
"conexao",
")",
";",
"//a linha abaixo exibe o relatório através da classe JasperViewer",
"JasperViewer",
".",
"viewReport",
"(",
"print",
",",
"false",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"JOptionPane",
".",
"showMessageDialog",
"(",
"null",
",",
"e",
")",
";",
"}",
"}",
"}"
] | [
207,
4
] | [
224,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
QuickSort. | null | ===== Métodos de Ordenação por Precipitação ===== // | ===== Métodos de Ordenação por Precipitação ===== // | public void quickPrecipitacaoCres() {
quickPrecipitacaoCres(0, lista.size() - 1);
} | [
"public",
"void",
"quickPrecipitacaoCres",
"(",
")",
"{",
"quickPrecipitacaoCres",
"(",
"0",
",",
"lista",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"}"
] | [
651,
4
] | [
653,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
LivroControllerTest. | null | ------------------- testes para método de detalhes livro por ID ---------------- | ------------------- testes para método de detalhes livro por ID ---------------- | @Test
@Transactional
public void deveriaretornar200ComosDetalhesDoLivroDoID() throws Exception {
Autor autor = new Autor("Christian Rodrigues","[email protected]","Autor de romance", LocalDateTime.now());
Categoria categoria = new Categoria("Romance");
Livro livro = new Livro("Amor incondicional","sumario","resumo", BigDecimal.valueOf(5000.0),
101,"978–65–012–5227–77",
LocalDate.of(2022, 1, 8),autor,categoria);
manager.persist(autor);
manager.persist(categoria);
manager.persist(livro);
URI uri = new URI("/livro/1");
mockMvc.perform(
MockMvcRequestBuilders
.get(uri)
).andExpect(MockMvcResultMatchers.status().is(200));
} | [
"@",
"Test",
"@",
"Transactional",
"public",
"void",
"deveriaretornar200ComosDetalhesDoLivroDoID",
"(",
")",
"throws",
"Exception",
"{",
"Autor",
"autor",
"=",
"new",
"Autor",
"(",
"\"Christian Rodrigues\"",
",",
"\"[email protected]\"",
",",
"\"Autor de romance\"",
",",
"LocalDateTime",
".",
"now",
"(",
")",
")",
";",
"Categoria",
"categoria",
"=",
"new",
"Categoria",
"(",
"\"Romance\"",
")",
";",
"Livro",
"livro",
"=",
"new",
"Livro",
"(",
"\"Amor incondicional\"",
",",
"\"sumario\"",
",",
"\"resumo\"",
",",
"BigDecimal",
".",
"valueOf",
"(",
"5000.0",
")",
",",
"101",
",",
"\"978–65–012–5227–77\",",
"",
"LocalDate",
".",
"of",
"(",
"2022",
",",
"1",
",",
"8",
")",
",",
"autor",
",",
"categoria",
")",
";",
"manager",
".",
"persist",
"(",
"autor",
")",
";",
"manager",
".",
"persist",
"(",
"categoria",
")",
";",
"manager",
".",
"persist",
"(",
"livro",
")",
";",
"URI",
"uri",
"=",
"new",
"URI",
"(",
"\"/livro/1\"",
")",
";",
"mockMvc",
".",
"perform",
"(",
"MockMvcRequestBuilders",
".",
"get",
"(",
"uri",
")",
")",
".",
"andExpect",
"(",
"MockMvcResultMatchers",
".",
"status",
"(",
")",
".",
"is",
"(",
"200",
")",
")",
";",
"}"
] | [
102,
4
] | [
119,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
SelectionSort. | null | --- Ordenar por Dias sem chuva ---\\ | --- Ordenar por Dias sem chuva ---\\ | public long ordenarDiasCres(){
int ini = 0;
int men; //número a ser comparado
int sch; //indice que vai procurar
int chg; //indice de onde vai mudar
tempo1 = System.currentTimeMillis();
while (ini < lista.size() - 1) { //esse loop "while" basicamente escolhe o menor elemento
chg = ini;
men = lista.get(ini).getDiasSemChuva(); //pega a data que vai comparar
Informacoes menorInfo = lista.get(ini); //guardar O OBJETO com a menor informação, "objto auxiliar"
sch = ini + 1; //Muda índice de busca
while (sch < lista.size()) {
if (lista.get(sch).getDiasSemChuva() < men) { //compara os valores de data
chg = sch;
men = lista.get(sch).getDiasSemChuva();
menorInfo = lista.get(sch);
}
sch++;;
}
lista.set(chg, lista.get(ini));
lista.set(ini, menorInfo); //troca OS OBJETOS
ini++;
}
tempo2 = System.currentTimeMillis();
return tempo2 - tempo1;
} | [
"public",
"long",
"ordenarDiasCres",
"(",
")",
"{",
"int",
"ini",
"=",
"0",
";",
"int",
"men",
";",
"//número a ser comparado",
"int",
"sch",
";",
"//indice que vai procurar",
"int",
"chg",
";",
"//indice de onde vai mudar",
"tempo1",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"while",
"(",
"ini",
"<",
"lista",
".",
"size",
"(",
")",
"-",
"1",
")",
"{",
"//esse loop \"while\" basicamente escolhe o menor elemento",
"chg",
"=",
"ini",
";",
"men",
"=",
"lista",
".",
"get",
"(",
"ini",
")",
".",
"getDiasSemChuva",
"(",
")",
";",
"//pega a data que vai comparar",
"Informacoes",
"menorInfo",
"=",
"lista",
".",
"get",
"(",
"ini",
")",
";",
"//guardar O OBJETO com a menor informação, \"objto auxiliar\"",
"sch",
"=",
"ini",
"+",
"1",
";",
"//Muda índice de busca",
"while",
"(",
"sch",
"<",
"lista",
".",
"size",
"(",
")",
")",
"{",
"if",
"(",
"lista",
".",
"get",
"(",
"sch",
")",
".",
"getDiasSemChuva",
"(",
")",
"<",
"men",
")",
"{",
"//compara os valores de data",
"chg",
"=",
"sch",
";",
"men",
"=",
"lista",
".",
"get",
"(",
"sch",
")",
".",
"getDiasSemChuva",
"(",
")",
";",
"menorInfo",
"=",
"lista",
".",
"get",
"(",
"sch",
")",
";",
"}",
"sch",
"++",
";",
";",
"}",
"lista",
".",
"set",
"(",
"chg",
",",
"lista",
".",
"get",
"(",
"ini",
")",
")",
";",
"lista",
".",
"set",
"(",
"ini",
",",
"menorInfo",
")",
";",
"//troca OS OBJETOS",
"ini",
"++",
";",
"}",
"tempo2",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"return",
"tempo2",
"-",
"tempo1",
";",
"}"
] | [
357,
4
] | [
382,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
RulesManager. | null | pega todas as ocorrencias da regra do parametro rule dentro da regra ruleAux | pega todas as ocorrencias da regra do parametro rule dentro da regra ruleAux | private List<RuleOcurrence> getListOfOcurrences(Rule rule, Rule ruleAux, HashMap<Integer, String> hashOfRevisions) {
List<RuleOcurrence> listOfOcurrences = new LinkedList();
//procuro por todas os subitems do parametro
ItemSet littleItemSet = ruleAux.getSequence().get(0);
System.out.println("I irá de 0 até: " + (ruleAux.getSequence().size() - (rule.getSequence().size() - 1)));
for (int i = 0; i < (ruleAux.getSequence().size() - (rule.getSequence().size() - 1)); i++) {
ItemSet itemSet = ruleAux.getSequence().get(i);
if (itemSet.isSubItem(littleItemSet)) {
List<RuleOcurrence> auxList = getListOfOcurrences(ruleAux.getSequence(), rule.getSequence(), i + 1, 1, hashOfRevisions);
if (auxList.isEmpty()) {
break;
} else {
for (RuleOcurrence ruleOcurrence : auxList) {
ruleOcurrence.addRevisionInHead(hashOfRevisions.get(i));
}
listOfOcurrences.addAll(auxList);
}
}
}
return listOfOcurrences;
} | [
"private",
"List",
"<",
"RuleOcurrence",
">",
"getListOfOcurrences",
"(",
"Rule",
"rule",
",",
"Rule",
"ruleAux",
",",
"HashMap",
"<",
"Integer",
",",
"String",
">",
"hashOfRevisions",
")",
"{",
"List",
"<",
"RuleOcurrence",
">",
"listOfOcurrences",
"=",
"new",
"LinkedList",
"(",
")",
";",
"//procuro por todas os subitems do parametro",
"ItemSet",
"littleItemSet",
"=",
"ruleAux",
".",
"getSequence",
"(",
")",
".",
"get",
"(",
"0",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"I irá de 0 até: \" +",
"(",
"u",
"leAux.g",
"e",
"tSequence()",
".",
"s",
"i",
"ze()",
" ",
"-",
"(",
"u",
"le.g",
"e",
"tSequence()",
".",
"s",
"i",
"ze()",
" ",
"-",
"1",
")",
")",
";",
"",
"",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"(",
"ruleAux",
".",
"getSequence",
"(",
")",
".",
"size",
"(",
")",
"-",
"(",
"rule",
".",
"getSequence",
"(",
")",
".",
"size",
"(",
")",
"-",
"1",
")",
")",
";",
"i",
"++",
")",
"{",
"ItemSet",
"itemSet",
"=",
"ruleAux",
".",
"getSequence",
"(",
")",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"itemSet",
".",
"isSubItem",
"(",
"littleItemSet",
")",
")",
"{",
"List",
"<",
"RuleOcurrence",
">",
"auxList",
"=",
"getListOfOcurrences",
"(",
"ruleAux",
".",
"getSequence",
"(",
")",
",",
"rule",
".",
"getSequence",
"(",
")",
",",
"i",
"+",
"1",
",",
"1",
",",
"hashOfRevisions",
")",
";",
"if",
"(",
"auxList",
".",
"isEmpty",
"(",
")",
")",
"{",
"break",
";",
"}",
"else",
"{",
"for",
"(",
"RuleOcurrence",
"ruleOcurrence",
":",
"auxList",
")",
"{",
"ruleOcurrence",
".",
"addRevisionInHead",
"(",
"hashOfRevisions",
".",
"get",
"(",
"i",
")",
")",
";",
"}",
"listOfOcurrences",
".",
"addAll",
"(",
"auxList",
")",
";",
"}",
"}",
"}",
"return",
"listOfOcurrences",
";",
"}"
] | [
234,
4
] | [
255,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
FXMLProcessosManutencoesDialogController. | null | Carrega os dados do comboBox de veiculos | Carrega os dados do comboBox de veiculos | public void carregarComboBoxVeiculos(){
observableListVeiculos = FXCollections.observableArrayList(veiculos);
comboBoxVeiculo.setItems(observableListVeiculos);
} | [
"public",
"void",
"carregarComboBoxVeiculos",
"(",
")",
"{",
"observableListVeiculos",
"=",
"FXCollections",
".",
"observableArrayList",
"(",
"veiculos",
")",
";",
"comboBoxVeiculo",
".",
"setItems",
"(",
"observableListVeiculos",
")",
";",
"}"
] | [
126,
4
] | [
129,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
TokenManager. | null | Verificação se token é valido | Verificação se token é valido | public boolean isTokenValido(String token) {
try {
Jwts.parser().setSigningKey(chave).parseClaimsJws(token);
return true;
} catch (Exception e) {
return false;
}
} | [
"public",
"boolean",
"isTokenValido",
"(",
"String",
"token",
")",
"{",
"try",
"{",
"Jwts",
".",
"parser",
"(",
")",
".",
"setSigningKey",
"(",
"chave",
")",
".",
"parseClaimsJws",
"(",
"token",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}"
] | [
37,
4
] | [
45,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Lote. | null | Subitrai um da quantidade de vacinas | Subitrai um da quantidade de vacinas | public void removeVacinaFechada() {
setQtdeDeVacinasFechadas(getQtdeDeVacinasFechadas()-1);
} | [
"public",
"void",
"removeVacinaFechada",
"(",
")",
"{",
"setQtdeDeVacinasFechadas",
"(",
"getQtdeDeVacinasFechadas",
"(",
")",
"-",
"1",
")",
";",
"}"
] | [
77,
1
] | [
79,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
AssociadoController. | null | só esta declarada para o Spring realizar a injeção no construtor do votoService | só esta declarada para o Spring realizar a injeção no construtor do votoService | @GetMapping
@Cacheable(value="buscarTodosAssociados")
public List<Associado> buscarTodos(){
return associadoRepository.findAll();
} | [
"@",
"GetMapping",
"@",
"Cacheable",
"(",
"value",
"=",
"\"buscarTodosAssociados\"",
")",
"public",
"List",
"<",
"Associado",
">",
"buscarTodos",
"(",
")",
"{",
"return",
"associadoRepository",
".",
"findAll",
"(",
")",
";",
"}"
] | [
41,
4
] | [
45,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Usuario. | null | Setter para atributo Rol | Setter para atributo Rol | public void setRol(String RolAAsignar)
{
Rol = RolAAsignar;
} | [
"public",
"void",
"setRol",
"(",
"String",
"RolAAsignar",
")",
"{",
"Rol",
"=",
"RolAAsignar",
";",
"}"
] | [
94,
4
] | [
97,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Reservacion. | null | Setter para atributo ClienteID | Setter para atributo ClienteID | public void setClienteID(String ClienteIDAAsignar)
{
ClienteID = ClienteIDAAsignar;
} | [
"public",
"void",
"setClienteID",
"(",
"String",
"ClienteIDAAsignar",
")",
"{",
"ClienteID",
"=",
"ClienteIDAAsignar",
";",
"}"
] | [
75,
4
] | [
78,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
jantar. | null | declaração do objeto garfos | declaração do objeto garfos | public void init( ) {
setForeground(Color.black);
setBackground(Color.lightGray);
setFont(new Font("Dialog",Font.BOLD,12));
setLayout(null);
fil0 = new Panel();
fil0.setLayout(null);
fil0.setForeground(Color.black);
fil0.setBackground(Color.yellow);
fil0.setFont(new Font("Dialog",Font.BOLD,12));
fil1 = new Panel(); fil1.setLayout(null);
fil1.setForeground(Color.black);
fil1.setBackground(Color.yellow);
fil1.setFont(new Font("Dialog",Font.BOLD,12));
fil2 = new Panel(); fil2.setLayout(null);
fil2.setForeground(Color.black);
fil2.setBackground(Color.yellow);
fil2.setFont(new Font("Dialog",Font.BOLD,12));
fil3 = new Panel(); fil3.setLayout(null);
fil3.setForeground(Color.black);
fil3.setBackground(Color.yellow);
fil3.setFont(new Font("Dialog",Font.BOLD,12));
fil4 = new Panel(); fil4.setLayout(null);
fil4.setForeground(Color.black);
fil4.setBackground(Color.yellow);
fil4.setFont(new Font("Dialog",Font.BOLD,12));
Label1 = new Label("0 ",Label.LEFT);
Label1.setFont(new Font("Dialog",Font.BOLD,12));
Label2 = new Label("1 ",Label.LEFT);
Label2.setFont(new Font("Dialog",Font.BOLD,12));
Label3 = new Label("2 ",Label.LEFT);
Label3.setFont(new Font("Dialog",Font.BOLD,12));
Label4 = new Label("3 ",Label.LEFT);
Label4.setFont(new Font("Dialog",Font.BOLD,12));
Label5 = new Label("4 ",Label.LEFT);
Label5.setFont(new Font("Dialog",Font.BOLD,12));
add(Label5); add(Label4); add(Label3);
add(Label2); add(Label1); add(fil4);
add(fil3); add(fil2); add(fil1);
add(fil0);
InitialPositionSet( );
fork = new garfos( ); // cria objeto garfos
f0 = new filosofo(0,this); // cria processos (threads) filósofos
f1 = new filosofo(1,this);
f2 = new filosofo(2,this);
f3 = new filosofo(3,this);
f4 = new filosofo(4,this);
f0.start( ); // inicializa cada processo filósofo
f1.start( );
f2.start( );
f3.start( );
f4.start( );
} | [
"public",
"void",
"init",
"(",
")",
"{",
"setForeground",
"(",
"Color",
".",
"black",
")",
";",
"setBackground",
"(",
"Color",
".",
"lightGray",
")",
";",
"setFont",
"(",
"new",
"Font",
"(",
"\"Dialog\"",
",",
"Font",
".",
"BOLD",
",",
"12",
")",
")",
";",
"setLayout",
"(",
"null",
")",
";",
"fil0",
"=",
"new",
"Panel",
"(",
")",
";",
"fil0",
".",
"setLayout",
"(",
"null",
")",
";",
"fil0",
".",
"setForeground",
"(",
"Color",
".",
"black",
")",
";",
"fil0",
".",
"setBackground",
"(",
"Color",
".",
"yellow",
")",
";",
"fil0",
".",
"setFont",
"(",
"new",
"Font",
"(",
"\"Dialog\"",
",",
"Font",
".",
"BOLD",
",",
"12",
")",
")",
";",
"fil1",
"=",
"new",
"Panel",
"(",
")",
";",
"fil1",
".",
"setLayout",
"(",
"null",
")",
";",
"fil1",
".",
"setForeground",
"(",
"Color",
".",
"black",
")",
";",
"fil1",
".",
"setBackground",
"(",
"Color",
".",
"yellow",
")",
";",
"fil1",
".",
"setFont",
"(",
"new",
"Font",
"(",
"\"Dialog\"",
",",
"Font",
".",
"BOLD",
",",
"12",
")",
")",
";",
"fil2",
"=",
"new",
"Panel",
"(",
")",
";",
"fil2",
".",
"setLayout",
"(",
"null",
")",
";",
"fil2",
".",
"setForeground",
"(",
"Color",
".",
"black",
")",
";",
"fil2",
".",
"setBackground",
"(",
"Color",
".",
"yellow",
")",
";",
"fil2",
".",
"setFont",
"(",
"new",
"Font",
"(",
"\"Dialog\"",
",",
"Font",
".",
"BOLD",
",",
"12",
")",
")",
";",
"fil3",
"=",
"new",
"Panel",
"(",
")",
";",
"fil3",
".",
"setLayout",
"(",
"null",
")",
";",
"fil3",
".",
"setForeground",
"(",
"Color",
".",
"black",
")",
";",
"fil3",
".",
"setBackground",
"(",
"Color",
".",
"yellow",
")",
";",
"fil3",
".",
"setFont",
"(",
"new",
"Font",
"(",
"\"Dialog\"",
",",
"Font",
".",
"BOLD",
",",
"12",
")",
")",
";",
"fil4",
"=",
"new",
"Panel",
"(",
")",
";",
"fil4",
".",
"setLayout",
"(",
"null",
")",
";",
"fil4",
".",
"setForeground",
"(",
"Color",
".",
"black",
")",
";",
"fil4",
".",
"setBackground",
"(",
"Color",
".",
"yellow",
")",
";",
"fil4",
".",
"setFont",
"(",
"new",
"Font",
"(",
"\"Dialog\"",
",",
"Font",
".",
"BOLD",
",",
"12",
")",
")",
";",
"Label1",
"=",
"new",
"Label",
"(",
"\"0 \"",
",",
"Label",
".",
"LEFT",
")",
";",
"Label1",
".",
"setFont",
"(",
"new",
"Font",
"(",
"\"Dialog\"",
",",
"Font",
".",
"BOLD",
",",
"12",
")",
")",
";",
"Label2",
"=",
"new",
"Label",
"(",
"\"1 \"",
",",
"Label",
".",
"LEFT",
")",
";",
"Label2",
".",
"setFont",
"(",
"new",
"Font",
"(",
"\"Dialog\"",
",",
"Font",
".",
"BOLD",
",",
"12",
")",
")",
";",
"Label3",
"=",
"new",
"Label",
"(",
"\"2 \"",
",",
"Label",
".",
"LEFT",
")",
";",
"Label3",
".",
"setFont",
"(",
"new",
"Font",
"(",
"\"Dialog\"",
",",
"Font",
".",
"BOLD",
",",
"12",
")",
")",
";",
"Label4",
"=",
"new",
"Label",
"(",
"\"3 \"",
",",
"Label",
".",
"LEFT",
")",
";",
"Label4",
".",
"setFont",
"(",
"new",
"Font",
"(",
"\"Dialog\"",
",",
"Font",
".",
"BOLD",
",",
"12",
")",
")",
";",
"Label5",
"=",
"new",
"Label",
"(",
"\"4 \"",
",",
"Label",
".",
"LEFT",
")",
";",
"Label5",
".",
"setFont",
"(",
"new",
"Font",
"(",
"\"Dialog\"",
",",
"Font",
".",
"BOLD",
",",
"12",
")",
")",
";",
"add",
"(",
"Label5",
")",
";",
"add",
"(",
"Label4",
")",
";",
"add",
"(",
"Label3",
")",
";",
"add",
"(",
"Label2",
")",
";",
"add",
"(",
"Label1",
")",
";",
"add",
"(",
"fil4",
")",
";",
"add",
"(",
"fil3",
")",
";",
"add",
"(",
"fil2",
")",
";",
"add",
"(",
"fil1",
")",
";",
"add",
"(",
"fil0",
")",
";",
"InitialPositionSet",
"(",
")",
";",
"fork",
"=",
"new",
"garfos",
"(",
")",
";",
"// cria objeto garfos",
"f0",
"=",
"new",
"filosofo",
"(",
"0",
",",
"this",
")",
";",
"// cria processos (threads) filósofos",
"f1",
"=",
"new",
"filosofo",
"(",
"1",
",",
"this",
")",
";",
"f2",
"=",
"new",
"filosofo",
"(",
"2",
",",
"this",
")",
";",
"f3",
"=",
"new",
"filosofo",
"(",
"3",
",",
"this",
")",
";",
"f4",
"=",
"new",
"filosofo",
"(",
"4",
",",
"this",
")",
";",
"f0",
".",
"start",
"(",
")",
";",
"// inicializa cada processo filósofo",
"f1",
".",
"start",
"(",
")",
";",
"f2",
".",
"start",
"(",
")",
";",
"f3",
".",
"start",
"(",
")",
";",
"f4",
".",
"start",
"(",
")",
";",
"}"
] | [
20,
4
] | [
72,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Testes. | null | Testa cada dia e verifica se é fim de semana usando a funçao definida no enum WeekDays | Testa cada dia e verifica se é fim de semana usando a funçao definida no enum WeekDays | public static void eFimdeSemana(WeekDays day) {
// Testa se o enum é fim de semana
if (day.isWeekEnd()) {
System.out.println(day.name() + " é fim de Semana");
} else {
System.out.println(day.name() + " é um dia da Semana");
}
} | [
"public",
"static",
"void",
"eFimdeSemana",
"(",
"WeekDays",
"day",
")",
"{",
"// Testa se o enum é fim de semana\r",
"if",
"(",
"day",
".",
"isWeekEnd",
"(",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"day",
".",
"name",
"(",
")",
"+",
"\" é fim de Semana\")",
";",
"\r",
"}",
"else",
"{",
"System",
".",
"out",
".",
"println",
"(",
"day",
".",
"name",
"(",
")",
"+",
"\" é um dia da Semana\")",
";",
"\r",
"}",
"}"
] | [
6,
4
] | [
13,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Personagem. | null | método que implementa o tiro do personagem | método que implementa o tiro do personagem | public void atira() {
//cada personagem tem uma posição inicial para o tiro
switch(id){
case 1:
tiros.add(new Tiro(x + largura - 5, (y + altura / 2) - 1));
break;
case 2:
tiros.add(new Tiro(x - 3, (y + altura / 2) - 1));
break;
}
} | [
"public",
"void",
"atira",
"(",
")",
"{",
"//cada personagem tem uma posição inicial para o tiro",
"switch",
"(",
"id",
")",
"{",
"case",
"1",
":",
"tiros",
".",
"add",
"(",
"new",
"Tiro",
"(",
"x",
"+",
"largura",
"-",
"5",
",",
"(",
"y",
"+",
"altura",
"/",
"2",
")",
"-",
"1",
")",
")",
";",
"break",
";",
"case",
"2",
":",
"tiros",
".",
"add",
"(",
"new",
"Tiro",
"(",
"x",
"-",
"3",
",",
"(",
"y",
"+",
"altura",
"/",
"2",
")",
"-",
"1",
")",
")",
";",
"break",
";",
"}",
"}"
] | [
103,
4
] | [
113,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Pessoa. | null | 3º passo: um get para cada atributo (me dá) | 3º passo: um get para cada atributo (me dá) | public String getNome() {
return nome;
} | [
"public",
"String",
"getNome",
"(",
")",
"{",
"return",
"nome",
";",
"}"
] | [
22,
4
] | [
24,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Language. | null | o equals e hashcode são padrão. Pode ser aqui o problema | o equals e hashcode são padrão. Pode ser aqui o problema | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Language)) return false;
Language language = (Language) o;
return Objects.equals(getName(), language.getName());
} | [
"@",
"Override",
"public",
"boolean",
"equals",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"this",
"==",
"o",
")",
"return",
"true",
";",
"if",
"(",
"!",
"(",
"o",
"instanceof",
"Language",
")",
")",
"return",
"false",
";",
"Language",
"language",
"=",
"(",
"Language",
")",
"o",
";",
"return",
"Objects",
".",
"equals",
"(",
"getName",
"(",
")",
",",
"language",
".",
"getName",
"(",
")",
")",
";",
"}"
] | [
29,
4
] | [
35,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Lixo. | null | Procurar o endereço do melhor candidato a substituir outro arquivo exluido
@param tamRegistro Ler no banco de dados o melhor candidato para sobreescrever esse lixo
@return Endereço do melhor candidato para substituir o registro antigo, -1 caso não há (escreva no final do arquivo)
| Procurar o endereço do melhor candidato a substituir outro arquivo exluido | public long read(int tamRegistro) {
Pagina pagina = new Pagina();
long enderecoRegistro = -1;
double porcentagem = -1;
double porcentagemMelhorRegistro = 0;
// Lendo o arquivo sequencialmente procurando a melhor posição para substituir algum lixo
try {
this.arquivo.seek(this.tamMetadados); // Pular o metadado do arquivo
while(this.arquivo.getFilePointer() < this.arquivo.length()) {
// Ler a página seguinte
pagina.lerProximaPagina();
// Testar o tamanho do registro apenas se ele for um registro livre para uma nova inserção
if(pagina.tamanhoRegistro != -1) {
// Testar os tamanhos dos registros para encontrar aquele que melhor se adequa a situação
porcentagem = 100.0 * tamRegistro / pagina.tamanhoRegistro;
if(porcentagem >= this.PORCENTAGEMSOBREESCRITA && porcentagem <= 100) {
// Melhor caso, os dois registro possuem o mesmo tamanho
if(tamRegistro == pagina.tamanhoRegistro) {
// Se for encontrado algum registro de mesmo tamanho do que vai ser substituido, pare a pesquisa usaremos ele
enderecoRegistro = pagina.enderecoRegistro;
// Ir para o final do arquivo
this.arquivo.seek(this.arquivo.length());
// Caso o tamanho não seja igual procuremos o que for o mais proximo possivel
// Verificando se o novo candidato é melhor que o anterior para trocar
} else if(porcentagemMelhorRegistro < porcentagem) {
porcentagemMelhorRegistro = porcentagem;
enderecoRegistro = pagina.enderecoRegistro;
}
}
}
//System.out.println((int)porcentagemMelhorRegistro + "% " + (int)porcentagem + "%");
}
} catch(Exception e ) { e.printStackTrace(); }
pagina = null;
return enderecoRegistro;
} | [
"public",
"long",
"read",
"(",
"int",
"tamRegistro",
")",
"{",
"Pagina",
"pagina",
"=",
"new",
"Pagina",
"(",
")",
";",
"long",
"enderecoRegistro",
"=",
"-",
"1",
";",
"double",
"porcentagem",
"=",
"-",
"1",
";",
"double",
"porcentagemMelhorRegistro",
"=",
"0",
";",
"// Lendo o arquivo sequencialmente procurando a melhor posição para substituir algum lixo",
"try",
"{",
"this",
".",
"arquivo",
".",
"seek",
"(",
"this",
".",
"tamMetadados",
")",
";",
"// Pular o metadado do arquivo",
"while",
"(",
"this",
".",
"arquivo",
".",
"getFilePointer",
"(",
")",
"<",
"this",
".",
"arquivo",
".",
"length",
"(",
")",
")",
"{",
"// Ler a página seguinte",
"pagina",
".",
"lerProximaPagina",
"(",
")",
";",
"// Testar o tamanho do registro apenas se ele for um registro livre para uma nova inserção",
"if",
"(",
"pagina",
".",
"tamanhoRegistro",
"!=",
"-",
"1",
")",
"{",
"// Testar os tamanhos dos registros para encontrar aquele que melhor se adequa a situação",
"porcentagem",
"=",
"100.0",
"*",
"tamRegistro",
"/",
"pagina",
".",
"tamanhoRegistro",
";",
"if",
"(",
"porcentagem",
">=",
"this",
".",
"PORCENTAGEMSOBREESCRITA",
"&&",
"porcentagem",
"<=",
"100",
")",
"{",
"// Melhor caso, os dois registro possuem o mesmo tamanho",
"if",
"(",
"tamRegistro",
"==",
"pagina",
".",
"tamanhoRegistro",
")",
"{",
"// Se for encontrado algum registro de mesmo tamanho do que vai ser substituido, pare a pesquisa usaremos ele",
"enderecoRegistro",
"=",
"pagina",
".",
"enderecoRegistro",
";",
"// Ir para o final do arquivo",
"this",
".",
"arquivo",
".",
"seek",
"(",
"this",
".",
"arquivo",
".",
"length",
"(",
")",
")",
";",
"// Caso o tamanho não seja igual procuremos o que for o mais proximo possivel",
"// Verificando se o novo candidato é melhor que o anterior para trocar",
"}",
"else",
"if",
"(",
"porcentagemMelhorRegistro",
"<",
"porcentagem",
")",
"{",
"porcentagemMelhorRegistro",
"=",
"porcentagem",
";",
"enderecoRegistro",
"=",
"pagina",
".",
"enderecoRegistro",
";",
"}",
"}",
"}",
"//System.out.println((int)porcentagemMelhorRegistro + \"% \" + (int)porcentagem + \"%\");",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"pagina",
"=",
"null",
";",
"return",
"enderecoRegistro",
";",
"}"
] | [
94,
4
] | [
138,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
BioterioController. | null | Salva um bioterio | Salva um bioterio | @RequestMapping(value="/bioterio", method=RequestMethod.POST)
@ApiOperation(value="Salva um bioterio")
@ResponseStatus(HttpStatus.CREATED)
public ResponseEntity<?> salvaUsuario(@RequestBody Bioterio bioterio) {
Bioterio obj = bioterioService.salvaBioterio(bioterio);
return ResponseEntity.ok().body(obj);
} | [
"@",
"RequestMapping",
"(",
"value",
"=",
"\"/bioterio\"",
",",
"method",
"=",
"RequestMethod",
".",
"POST",
")",
"@",
"ApiOperation",
"(",
"value",
"=",
"\"Salva um bioterio\"",
")",
"@",
"ResponseStatus",
"(",
"HttpStatus",
".",
"CREATED",
")",
"public",
"ResponseEntity",
"<",
"?",
">",
"salvaUsuario",
"(",
"@",
"RequestBody",
"Bioterio",
"bioterio",
")",
"{",
"Bioterio",
"obj",
"=",
"bioterioService",
".",
"salvaBioterio",
"(",
"bioterio",
")",
";",
"return",
"ResponseEntity",
".",
"ok",
"(",
")",
".",
"body",
"(",
"obj",
")",
";",
"}"
] | [
45,
1
] | [
51,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
MetodosEx. | null | esse metodo vai retornar um valor manipulaver e execuatr um calculo | esse metodo vai retornar um valor manipulaver e execuatr um calculo | public static int calcular (int valor1, int valor2){
int resultado = 0;
resultado = valor1 + valor2;
return resultado;
} | [
"public",
"static",
"int",
"calcular",
"(",
"int",
"valor1",
",",
"int",
"valor2",
")",
"{",
"int",
"resultado",
"=",
"0",
";",
"resultado",
"=",
"valor1",
"+",
"valor2",
";",
"return",
"resultado",
";",
"}"
] | [
27,
4
] | [
32,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Usuario. | null | Get nome do nome | Get nome do nome | public String getNome() {
return this.nome;
} | [
"public",
"String",
"getNome",
"(",
")",
"{",
"return",
"this",
".",
"nome",
";",
"}"
] | [
62,
4
] | [
64,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
MainTest. | null | primeiro realiza os testes no documento disponibilizado sobre o programa, e posteriormente os novos testes criados | primeiro realiza os testes no documento disponibilizado sobre o programa, e posteriormente os novos testes criados | @Test
public void testPDF1(){
int[] test_B = new int[]{500, 700};
int[] test_C = new int[]{700, 500, 500};
//checa se as respostas estão corretas para um dado teste, converte os caracteres para valores inteiros para que o assertEquals funcione
assertEquals(Character.getNumericValue('N'), Character.getNumericValue(Main.distances(test_B, test_C)));
} | [
"@",
"Test",
"public",
"void",
"testPDF1",
"(",
")",
"{",
"int",
"[",
"]",
"test_B",
"=",
"new",
"int",
"[",
"]",
"{",
"500",
",",
"700",
"}",
";",
"int",
"[",
"]",
"test_C",
"=",
"new",
"int",
"[",
"]",
"{",
"700",
",",
"500",
",",
"500",
"}",
";",
"//checa se as respostas estão corretas para um dado teste, converte os caracteres para valores inteiros para que o assertEquals funcione",
"assertEquals",
"(",
"Character",
".",
"getNumericValue",
"(",
"'",
"'",
")",
",",
"Character",
".",
"getNumericValue",
"(",
"Main",
".",
"distances",
"(",
"test_B",
",",
"test_C",
")",
")",
")",
";",
"}"
] | [
9,
1
] | [
16,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
App. | null | INFORMAÇÃO DE CADA PÁGINA | INFORMAÇÃO DE CADA PÁGINA | private void getInfo(String URL) {
Elements elements = document.getElementsByClass("container"); //col-md-10 col-xl-8 m-auto
getInfoPage(elements.eq(2),URL);
} | [
"private",
"void",
"getInfo",
"(",
"String",
"URL",
")",
"{",
"Elements",
"elements",
"=",
"document",
".",
"getElementsByClass",
"(",
"\"container\"",
")",
";",
"//col-md-10 col-xl-8 m-auto",
"getInfoPage",
"(",
"elements",
".",
"eq",
"(",
"2",
")",
",",
"URL",
")",
";",
"}"
] | [
181,
1
] | [
185,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Elemento. | null | Remove elementos transponíveis da tela | Remove elementos transponíveis da tela | public void contatoTransponivel(ArrayList<Elemento> listaElementos) {
listaElementos.remove(this);
return;
} | [
"public",
"void",
"contatoTransponivel",
"(",
"ArrayList",
"<",
"Elemento",
">",
"listaElementos",
")",
"{",
"listaElementos",
".",
"remove",
"(",
"this",
")",
";",
"return",
";",
"}"
] | [
75,
1
] | [
78,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
AppUsers. | null | adicionar um novo utilizador | adicionar um novo utilizador | public void insereAppUsers(AppUser utilizador) {
allAppUsers.add(utilizador);
} | [
"public",
"void",
"insereAppUsers",
"(",
"AppUser",
"utilizador",
")",
"{",
"allAppUsers",
".",
"add",
"(",
"utilizador",
")",
";",
"}"
] | [
27,
4
] | [
29,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
ProdutosDAO. | null | Metodo que retorna o estoque atual de um produto | Metodo que retorna o estoque atual de um produto | public int retornaEstoqueAtual(int id) {
try {
int qtd_estoque = 0;
String sql = "SELECT qtd_estoque from produto where id = ?";
PreparedStatement stmt = con.prepareStatement(sql);
stmt.setInt(1, id);
ResultSet rs = stmt.executeQuery();
if (rs.next()) {
qtd_estoque = (rs.getInt("qtd_estoque"));
}
return qtd_estoque;
} catch (SQLException e) {
throw new RuntimeException(e);
}
} | [
"public",
"int",
"retornaEstoqueAtual",
"(",
"int",
"id",
")",
"{",
"try",
"{",
"int",
"qtd_estoque",
"=",
"0",
";",
"String",
"sql",
"=",
"\"SELECT qtd_estoque from produto where id = ?\"",
";",
"PreparedStatement",
"stmt",
"=",
"con",
".",
"prepareStatement",
"(",
"sql",
")",
";",
"stmt",
".",
"setInt",
"(",
"1",
",",
"id",
")",
";",
"ResultSet",
"rs",
"=",
"stmt",
".",
"executeQuery",
"(",
")",
";",
"if",
"(",
"rs",
".",
"next",
"(",
")",
")",
"{",
"qtd_estoque",
"=",
"(",
"rs",
".",
"getInt",
"(",
"\"qtd_estoque\"",
")",
")",
";",
"}",
"return",
"qtd_estoque",
";",
"}",
"catch",
"(",
"SQLException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}"
] | [
293,
4
] | [
312,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
AlunoFormController. | null | Metodo notify, vai emitir o evento dataChange para todos os listeners | Metodo notify, vai emitir o evento dataChange para todos os listeners | private void notifyDataChangeListeners() {//Para cada objeto dataChange
for (DataChangeListener listener : dataChangeListeners) {
listener.onDataChanged();
}
} | [
"private",
"void",
"notifyDataChangeListeners",
"(",
")",
"{",
"//Para cada objeto dataChange",
"for",
"(",
"DataChangeListener",
"listener",
":",
"dataChangeListeners",
")",
"{",
"listener",
".",
"onDataChanged",
"(",
")",
";",
"}",
"}"
] | [
91,
4
] | [
95,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Syntactic. | null | Adiciona a derivação na pilha | Adiciona a derivação na pilha | public void addDerivation(ArrayList derivation) {
if (derivation == null) {
return;
}
Collections.reverse(derivation);
for (Object d : derivation) {
stack.add(0, new Integer(d.toString()));
}
printStack();
} | [
"public",
"void",
"addDerivation",
"(",
"ArrayList",
"derivation",
")",
"{",
"if",
"(",
"derivation",
"==",
"null",
")",
"{",
"return",
";",
"}",
"Collections",
".",
"reverse",
"(",
"derivation",
")",
";",
"for",
"(",
"Object",
"d",
":",
"derivation",
")",
"{",
"stack",
".",
"add",
"(",
"0",
",",
"new",
"Integer",
"(",
"d",
".",
"toString",
"(",
")",
")",
")",
";",
"}",
"printStack",
"(",
")",
";",
"}"
] | [
107,
4
] | [
120,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
BotaoAcao. | null | método da Classe ActionListener com parâmetro Classe ActionEvent, as duas do pacote java.awt.event | método da Classe ActionListener com parâmetro Classe ActionEvent, as duas do pacote java.awt.event | public void actionPerformed(ActionEvent e) {
// Podemos executar qualquer código aqui dentro, quando o botão for clicado
if (e.getSource() == botao) {
JOptionPane.showMessageDialog(null, "Aprendendo a usar o ActionListener");
}
if (e.getSource() == botao2) {
System.exit(0);
}
} | [
"public",
"void",
"actionPerformed",
"(",
"ActionEvent",
"e",
")",
"{",
"// Podemos executar qualquer código aqui dentro, quando o botão for clicado",
"if",
"(",
"e",
".",
"getSource",
"(",
")",
"==",
"botao",
")",
"{",
"JOptionPane",
".",
"showMessageDialog",
"(",
"null",
",",
"\"Aprendendo a usar o ActionListener\"",
")",
";",
"}",
"if",
"(",
"e",
".",
"getSource",
"(",
")",
"==",
"botao2",
")",
"{",
"System",
".",
"exit",
"(",
"0",
")",
";",
"}",
"}"
] | [
11,
4
] | [
20,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
ListMealsFragment. | null | Método que recupera as refeições localmente | Método que recupera as refeições localmente | private boolean doLocalTable(){
DiaRefeicaoDAO diaRefeicaoDAO = new DiaRefeicaoDAO(getContext());
List<DiaRefeicao> list = diaRefeicaoDAO.findAll();
if(list == null)
return false;
else{
montaTabela(list);
return true;
}
} | [
"private",
"boolean",
"doLocalTable",
"(",
")",
"{",
"DiaRefeicaoDAO",
"diaRefeicaoDAO",
"=",
"new",
"DiaRefeicaoDAO",
"(",
"getContext",
"(",
")",
")",
";",
"List",
"<",
"DiaRefeicao",
">",
"list",
"=",
"diaRefeicaoDAO",
".",
"findAll",
"(",
")",
";",
"if",
"(",
"list",
"==",
"null",
")",
"return",
"false",
";",
"else",
"{",
"montaTabela",
"(",
"list",
")",
";",
"return",
"true",
";",
"}",
"}"
] | [
116,
4
] | [
128,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Main. | null | Dimensoes e etc da tela | Dimensoes e etc da tela | private void initialize() {
Inativo ina = new Inativo();
ina.start();
Usuario u1 = new Usuario();
frame = new JFrame();
frame.getContentPane().setBackground(Color.DARK_GRAY);
frame.setBounds(100, 100, 699, 448);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.getContentPane().setLayout(null);
frame.setAlwaysOnTop(false);
nomecomp = new JTextField();
nomecomp.setBounds(10, 55, 140, 23);
frame.getContentPane().add(nomecomp);
nomecomp.setColumns(10);
JLabel txtNome = new JLabel("Nome Compromisso");
txtNome.setBounds(10, 30, 147, 15);
txtNome.setFont(new Font("Tahoma", Font.BOLD, 15));
txtNome.setForeground(Color.WHITE);
frame.getContentPane().add(txtNome);
horacomeco = new JTextField();
horacomeco.setBounds(10, 125, 22, 20);
frame.getContentPane().add(horacomeco);
horacomeco.setColumns(10);
JLabel lblNewLabel_1 = new JLabel("Nome Tarefa");
lblNewLabel_1.setBounds(188, 30, 112, 15);
lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 15));
lblNewLabel_1.setForeground(Color.WHITE);
frame.getContentPane().add(lblNewLabel_1);
JLabel lblNewLabel_2 = new JLabel("Dura\u00E7\u00E3o");
lblNewLabel_2.setBounds(188, 83, 99, 14);
lblNewLabel_2.setFont(new Font("Tahoma", Font.BOLD, 15));
lblNewLabel_2.setForeground(Color.WHITE);
frame.getContentPane().add(lblNewLabel_2);
nometar = new JTextField();
nometar.setBounds(188, 55, 140, 23);
nometar.setColumns(10);
frame.getContentPane().add(nometar);
duracaotar = new JTextField();
duracaotar.setBounds(188, 108, 80, 23);
duracaotar.setColumns(10);
frame.getContentPane().add(duracaotar);
//BOTAO DE ADD TAREFA
JButton addtar = new JButton("ADICIONAR");
addtar.setBounds(192, 243, 129, 47);
addtar.setFont(new Font("Tahoma", Font.BOLD, 11));
addtar.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
Tarefa t = new Tarefa(nometar.getText(), duracaotar.getText());
u1.setTarefa(t); //add tarefa
} catch (Exception f) {
JOptionPane.showMessageDialog(null, "Digite valores v�lidos");
}
OkFrame fr = new OkFrame();
fr.show();
}
});
frame.getContentPane().add(addtar);
JLabel lblNewLabel = new JLabel("Minutos");
lblNewLabel.setBounds(104, 105, 46, 14);
lblNewLabel.setForeground(Color.WHITE);
lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 11));
frame.getContentPane().add(lblNewLabel);
JLabel lblNewLabel_3 = new JLabel("Hora");
lblNewLabel_3.setBounds(10, 105, 46, 14);
lblNewLabel_3.setForeground(Color.WHITE);
lblNewLabel_3.setFont(new Font("Tahoma", Font.BOLD, 11));
frame.getContentPane().add(lblNewLabel_3);
minutocomeco = new JTextField();
minutocomeco.setBounds(104, 125, 22, 20);
minutocomeco.setColumns(10);
frame.getContentPane().add(minutocomeco);
horafim = new JTextField();
horafim.setBounds(10, 195, 22, 20);
horafim.setColumns(10);
frame.getContentPane().add(horafim);
minutofim = new JTextField();
minutofim.setBounds(104, 195, 22, 20);
minutofim.setColumns(10);
frame.getContentPane().add(minutofim);
JLabel lblNewLabel_3_1 = new JLabel("H F");
lblNewLabel_3_1.setBounds(10, 175, 46, 14);
lblNewLabel_3_1.setForeground(Color.WHITE);
lblNewLabel_3_1.setFont(new Font("Tahoma", Font.BOLD, 11));
frame.getContentPane().add(lblNewLabel_3_1);
JLabel lblNewLabel_3_2 = new JLabel("M F");
lblNewLabel_3_2.setBounds(104, 175, 46, 14);
lblNewLabel_3_2.setForeground(Color.WHITE);
lblNewLabel_3_2.setFont(new Font("Tahoma", Font.BOLD, 11));
frame.getContentPane().add(lblNewLabel_3_2);
//BOTAO DE ADD COMPROMISSO
JButton addcomp = new JButton("ADICIONAR");
addcomp.setBounds(10, 243, 129, 47);
addcomp.setFont(new Font("Tahoma", Font.BOLD, 11));
addcomp.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int hc, mc, hf, mf;
try {
hc = Integer.parseInt(horacomeco.getText());
mc = Integer.parseInt(minutocomeco.getText());
hf = Integer.parseInt(horafim.getText());
mf = Integer.parseInt(minutofim.getText());
Compromisso c = new Compromisso(nomecomp.getText(), hc, mc, hf, mf);
u1.setCompromisso(c); //add compromisso
} catch (Exception f) {
JOptionPane.showMessageDialog(null, "Digite valores v�lidos");
}
OkFrame fr = new OkFrame();
fr.show();
}
});
frame.getContentPane().add(addcomp);
JButton btnNewButton_1 = new JButton("CRONOMETRO");
btnNewButton_1.setBounds(10, 326, 327, 71);
btnNewButton_1.setFont(new Font("Tahoma", Font.BOLD, 21));
btnNewButton_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Cronometro crono = new Cronometro();
crono.show();
}
});
frame.getContentPane().add(btnNewButton_1);
JButton btnNewButton_2 = new JButton("PRINT");
btnNewButton_2.setBounds(346, 29, 327, 62);
btnNewButton_2.setFont(new Font("Tahoma", Font.BOLD, 11));
btnNewButton_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String xyz = "";
xyz = "Lista de compromissos: \n"+u1.getStringC()+"\nLista de tarefas: \n"+u1.getStringT();
JTextArea tf = new JTextArea();
tf.setLayout(null);
tf.setVisible(true);
tf.setText(xyz);
frame.getContentPane().add(tf);
tf.setBounds(346, 109, 327, 206);
}
});
frame.getContentPane().add(btnNewButton_2);
Component verticalStrut = Box.createVerticalStrut(20);
verticalStrut.setBounds(166, 29, 12, 261);
frame.getContentPane().add(verticalStrut);
JButton btnNewButton_1_1 = new JButton("INATIVIDADE");
btnNewButton_1_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int i = ina.callback();
JOptionPane.showMessageDialog(null, "Voce ficou inativo por: "+i*5+" minutos");
}
});
btnNewButton_1_1.setFont(new Font("Tahoma", Font.BOLD, 21));
btnNewButton_1_1.setBounds(346, 326, 327, 71);
frame.getContentPane().add(btnNewButton_1_1);
JLabel lblNewLabel_4 = new JLabel("Come\u00E7o:");
lblNewLabel_4.setFont(new Font("Tahoma", Font.BOLD, 11));
lblNewLabel_4.setForeground(Color.WHITE);
lblNewLabel_4.setBounds(10, 85, 66, 14);
frame.getContentPane().add(lblNewLabel_4);
JLabel lblNewLabel_4_1 = new JLabel("Fim: ");
lblNewLabel_4_1.setForeground(Color.WHITE);
lblNewLabel_4_1.setFont(new Font("Tahoma", Font.BOLD, 11));
lblNewLabel_4_1.setBounds(10, 155, 66, 14);
frame.getContentPane().add(lblNewLabel_4_1);
} | [
"private",
"void",
"initialize",
"(",
")",
"{",
"Inativo",
"ina",
"=",
"new",
"Inativo",
"(",
")",
";",
"ina",
".",
"start",
"(",
")",
";",
"Usuario",
"u1",
"=",
"new",
"Usuario",
"(",
")",
";",
"frame",
"=",
"new",
"JFrame",
"(",
")",
";",
"frame",
".",
"getContentPane",
"(",
")",
".",
"setBackground",
"(",
"Color",
".",
"DARK_GRAY",
")",
";",
"frame",
".",
"setBounds",
"(",
"100",
",",
"100",
",",
"699",
",",
"448",
")",
";",
"frame",
".",
"setDefaultCloseOperation",
"(",
"JFrame",
".",
"DISPOSE_ON_CLOSE",
")",
";",
"frame",
".",
"getContentPane",
"(",
")",
".",
"setLayout",
"(",
"null",
")",
";",
"frame",
".",
"setAlwaysOnTop",
"(",
"false",
")",
";",
"nomecomp",
"=",
"new",
"JTextField",
"(",
")",
";",
"nomecomp",
".",
"setBounds",
"(",
"10",
",",
"55",
",",
"140",
",",
"23",
")",
";",
"frame",
".",
"getContentPane",
"(",
")",
".",
"add",
"(",
"nomecomp",
")",
";",
"nomecomp",
".",
"setColumns",
"(",
"10",
")",
";",
"JLabel",
"txtNome",
"=",
"new",
"JLabel",
"(",
"\"Nome Compromisso\"",
")",
";",
"txtNome",
".",
"setBounds",
"(",
"10",
",",
"30",
",",
"147",
",",
"15",
")",
";",
"txtNome",
".",
"setFont",
"(",
"new",
"Font",
"(",
"\"Tahoma\"",
",",
"Font",
".",
"BOLD",
",",
"15",
")",
")",
";",
"txtNome",
".",
"setForeground",
"(",
"Color",
".",
"WHITE",
")",
";",
"frame",
".",
"getContentPane",
"(",
")",
".",
"add",
"(",
"txtNome",
")",
";",
"horacomeco",
"=",
"new",
"JTextField",
"(",
")",
";",
"horacomeco",
".",
"setBounds",
"(",
"10",
",",
"125",
",",
"22",
",",
"20",
")",
";",
"frame",
".",
"getContentPane",
"(",
")",
".",
"add",
"(",
"horacomeco",
")",
";",
"horacomeco",
".",
"setColumns",
"(",
"10",
")",
";",
"JLabel",
"lblNewLabel_1",
"=",
"new",
"JLabel",
"(",
"\"Nome Tarefa\"",
")",
";",
"lblNewLabel_1",
".",
"setBounds",
"(",
"188",
",",
"30",
",",
"112",
",",
"15",
")",
";",
"lblNewLabel_1",
".",
"setFont",
"(",
"new",
"Font",
"(",
"\"Tahoma\"",
",",
"Font",
".",
"BOLD",
",",
"15",
")",
")",
";",
"lblNewLabel_1",
".",
"setForeground",
"(",
"Color",
".",
"WHITE",
")",
";",
"frame",
".",
"getContentPane",
"(",
")",
".",
"add",
"(",
"lblNewLabel_1",
")",
";",
"JLabel",
"lblNewLabel_2",
"=",
"new",
"JLabel",
"(",
"\"Dura\\u00E7\\u00E3o\"",
")",
";",
"lblNewLabel_2",
".",
"setBounds",
"(",
"188",
",",
"83",
",",
"99",
",",
"14",
")",
";",
"lblNewLabel_2",
".",
"setFont",
"(",
"new",
"Font",
"(",
"\"Tahoma\"",
",",
"Font",
".",
"BOLD",
",",
"15",
")",
")",
";",
"lblNewLabel_2",
".",
"setForeground",
"(",
"Color",
".",
"WHITE",
")",
";",
"frame",
".",
"getContentPane",
"(",
")",
".",
"add",
"(",
"lblNewLabel_2",
")",
";",
"nometar",
"=",
"new",
"JTextField",
"(",
")",
";",
"nometar",
".",
"setBounds",
"(",
"188",
",",
"55",
",",
"140",
",",
"23",
")",
";",
"nometar",
".",
"setColumns",
"(",
"10",
")",
";",
"frame",
".",
"getContentPane",
"(",
")",
".",
"add",
"(",
"nometar",
")",
";",
"duracaotar",
"=",
"new",
"JTextField",
"(",
")",
";",
"duracaotar",
".",
"setBounds",
"(",
"188",
",",
"108",
",",
"80",
",",
"23",
")",
";",
"duracaotar",
".",
"setColumns",
"(",
"10",
")",
";",
"frame",
".",
"getContentPane",
"(",
")",
".",
"add",
"(",
"duracaotar",
")",
";",
"//BOTAO DE ADD TAREFA\r",
"JButton",
"addtar",
"=",
"new",
"JButton",
"(",
"\"ADICIONAR\"",
")",
";",
"addtar",
".",
"setBounds",
"(",
"192",
",",
"243",
",",
"129",
",",
"47",
")",
";",
"addtar",
".",
"setFont",
"(",
"new",
"Font",
"(",
"\"Tahoma\"",
",",
"Font",
".",
"BOLD",
",",
"11",
")",
")",
";",
"addtar",
".",
"addActionListener",
"(",
"new",
"ActionListener",
"(",
")",
"{",
"public",
"void",
"actionPerformed",
"(",
"ActionEvent",
"e",
")",
"{",
"try",
"{",
"Tarefa",
"t",
"=",
"new",
"Tarefa",
"(",
"nometar",
".",
"getText",
"(",
")",
",",
"duracaotar",
".",
"getText",
"(",
")",
")",
";",
"u1",
".",
"setTarefa",
"(",
"t",
")",
";",
"//add tarefa\r",
"}",
"catch",
"(",
"Exception",
"f",
")",
"{",
"JOptionPane",
".",
"showMessageDialog",
"(",
"null",
",",
"\"Digite valores v�lidos\");",
"\r",
"",
"}",
"OkFrame",
"fr",
"=",
"new",
"OkFrame",
"(",
")",
";",
"fr",
".",
"show",
"(",
")",
";",
"}",
"}",
")",
";",
"frame",
".",
"getContentPane",
"(",
")",
".",
"add",
"(",
"addtar",
")",
";",
"JLabel",
"lblNewLabel",
"=",
"new",
"JLabel",
"(",
"\"Minutos\"",
")",
";",
"lblNewLabel",
".",
"setBounds",
"(",
"104",
",",
"105",
",",
"46",
",",
"14",
")",
";",
"lblNewLabel",
".",
"setForeground",
"(",
"Color",
".",
"WHITE",
")",
";",
"lblNewLabel",
".",
"setFont",
"(",
"new",
"Font",
"(",
"\"Tahoma\"",
",",
"Font",
".",
"BOLD",
",",
"11",
")",
")",
";",
"frame",
".",
"getContentPane",
"(",
")",
".",
"add",
"(",
"lblNewLabel",
")",
";",
"JLabel",
"lblNewLabel_3",
"=",
"new",
"JLabel",
"(",
"\"Hora\"",
")",
";",
"lblNewLabel_3",
".",
"setBounds",
"(",
"10",
",",
"105",
",",
"46",
",",
"14",
")",
";",
"lblNewLabel_3",
".",
"setForeground",
"(",
"Color",
".",
"WHITE",
")",
";",
"lblNewLabel_3",
".",
"setFont",
"(",
"new",
"Font",
"(",
"\"Tahoma\"",
",",
"Font",
".",
"BOLD",
",",
"11",
")",
")",
";",
"frame",
".",
"getContentPane",
"(",
")",
".",
"add",
"(",
"lblNewLabel_3",
")",
";",
"minutocomeco",
"=",
"new",
"JTextField",
"(",
")",
";",
"minutocomeco",
".",
"setBounds",
"(",
"104",
",",
"125",
",",
"22",
",",
"20",
")",
";",
"minutocomeco",
".",
"setColumns",
"(",
"10",
")",
";",
"frame",
".",
"getContentPane",
"(",
")",
".",
"add",
"(",
"minutocomeco",
")",
";",
"horafim",
"=",
"new",
"JTextField",
"(",
")",
";",
"horafim",
".",
"setBounds",
"(",
"10",
",",
"195",
",",
"22",
",",
"20",
")",
";",
"horafim",
".",
"setColumns",
"(",
"10",
")",
";",
"frame",
".",
"getContentPane",
"(",
")",
".",
"add",
"(",
"horafim",
")",
";",
"minutofim",
"=",
"new",
"JTextField",
"(",
")",
";",
"minutofim",
".",
"setBounds",
"(",
"104",
",",
"195",
",",
"22",
",",
"20",
")",
";",
"minutofim",
".",
"setColumns",
"(",
"10",
")",
";",
"frame",
".",
"getContentPane",
"(",
")",
".",
"add",
"(",
"minutofim",
")",
";",
"JLabel",
"lblNewLabel_3_1",
"=",
"new",
"JLabel",
"(",
"\"H F\"",
")",
";",
"lblNewLabel_3_1",
".",
"setBounds",
"(",
"10",
",",
"175",
",",
"46",
",",
"14",
")",
";",
"lblNewLabel_3_1",
".",
"setForeground",
"(",
"Color",
".",
"WHITE",
")",
";",
"lblNewLabel_3_1",
".",
"setFont",
"(",
"new",
"Font",
"(",
"\"Tahoma\"",
",",
"Font",
".",
"BOLD",
",",
"11",
")",
")",
";",
"frame",
".",
"getContentPane",
"(",
")",
".",
"add",
"(",
"lblNewLabel_3_1",
")",
";",
"JLabel",
"lblNewLabel_3_2",
"=",
"new",
"JLabel",
"(",
"\"M F\"",
")",
";",
"lblNewLabel_3_2",
".",
"setBounds",
"(",
"104",
",",
"175",
",",
"46",
",",
"14",
")",
";",
"lblNewLabel_3_2",
".",
"setForeground",
"(",
"Color",
".",
"WHITE",
")",
";",
"lblNewLabel_3_2",
".",
"setFont",
"(",
"new",
"Font",
"(",
"\"Tahoma\"",
",",
"Font",
".",
"BOLD",
",",
"11",
")",
")",
";",
"frame",
".",
"getContentPane",
"(",
")",
".",
"add",
"(",
"lblNewLabel_3_2",
")",
";",
"//BOTAO DE ADD COMPROMISSO\r",
"JButton",
"addcomp",
"=",
"new",
"JButton",
"(",
"\"ADICIONAR\"",
")",
";",
"addcomp",
".",
"setBounds",
"(",
"10",
",",
"243",
",",
"129",
",",
"47",
")",
";",
"addcomp",
".",
"setFont",
"(",
"new",
"Font",
"(",
"\"Tahoma\"",
",",
"Font",
".",
"BOLD",
",",
"11",
")",
")",
";",
"addcomp",
".",
"addActionListener",
"(",
"new",
"ActionListener",
"(",
")",
"{",
"public",
"void",
"actionPerformed",
"(",
"ActionEvent",
"e",
")",
"{",
"int",
"hc",
",",
"mc",
",",
"hf",
",",
"mf",
";",
"try",
"{",
"hc",
"=",
"Integer",
".",
"parseInt",
"(",
"horacomeco",
".",
"getText",
"(",
")",
")",
";",
"mc",
"=",
"Integer",
".",
"parseInt",
"(",
"minutocomeco",
".",
"getText",
"(",
")",
")",
";",
"hf",
"=",
"Integer",
".",
"parseInt",
"(",
"horafim",
".",
"getText",
"(",
")",
")",
";",
"mf",
"=",
"Integer",
".",
"parseInt",
"(",
"minutofim",
".",
"getText",
"(",
")",
")",
";",
"Compromisso",
"c",
"=",
"new",
"Compromisso",
"(",
"nomecomp",
".",
"getText",
"(",
")",
",",
"hc",
",",
"mc",
",",
"hf",
",",
"mf",
")",
";",
"u1",
".",
"setCompromisso",
"(",
"c",
")",
";",
"//add compromisso\r",
"}",
"catch",
"(",
"Exception",
"f",
")",
"{",
"JOptionPane",
".",
"showMessageDialog",
"(",
"null",
",",
"\"Digite valores v�lidos\");",
"\r",
"",
"}",
"OkFrame",
"fr",
"=",
"new",
"OkFrame",
"(",
")",
";",
"fr",
".",
"show",
"(",
")",
";",
"}",
"}",
")",
";",
"frame",
".",
"getContentPane",
"(",
")",
".",
"add",
"(",
"addcomp",
")",
";",
"JButton",
"btnNewButton_1",
"=",
"new",
"JButton",
"(",
"\"CRONOMETRO\"",
")",
";",
"btnNewButton_1",
".",
"setBounds",
"(",
"10",
",",
"326",
",",
"327",
",",
"71",
")",
";",
"btnNewButton_1",
".",
"setFont",
"(",
"new",
"Font",
"(",
"\"Tahoma\"",
",",
"Font",
".",
"BOLD",
",",
"21",
")",
")",
";",
"btnNewButton_1",
".",
"addActionListener",
"(",
"new",
"ActionListener",
"(",
")",
"{",
"public",
"void",
"actionPerformed",
"(",
"ActionEvent",
"e",
")",
"{",
"Cronometro",
"crono",
"=",
"new",
"Cronometro",
"(",
")",
";",
"crono",
".",
"show",
"(",
")",
";",
"}",
"}",
")",
";",
"frame",
".",
"getContentPane",
"(",
")",
".",
"add",
"(",
"btnNewButton_1",
")",
";",
"JButton",
"btnNewButton_2",
"=",
"new",
"JButton",
"(",
"\"PRINT\"",
")",
";",
"btnNewButton_2",
".",
"setBounds",
"(",
"346",
",",
"29",
",",
"327",
",",
"62",
")",
";",
"btnNewButton_2",
".",
"setFont",
"(",
"new",
"Font",
"(",
"\"Tahoma\"",
",",
"Font",
".",
"BOLD",
",",
"11",
")",
")",
";",
"btnNewButton_2",
".",
"addActionListener",
"(",
"new",
"ActionListener",
"(",
")",
"{",
"public",
"void",
"actionPerformed",
"(",
"ActionEvent",
"e",
")",
"{",
"String",
"xyz",
"=",
"\"\"",
";",
"xyz",
"=",
"\"Lista de compromissos: \\n\"",
"+",
"u1",
".",
"getStringC",
"(",
")",
"+",
"\"\\nLista de tarefas: \\n\"",
"+",
"u1",
".",
"getStringT",
"(",
")",
";",
"JTextArea",
"tf",
"=",
"new",
"JTextArea",
"(",
")",
";",
"tf",
".",
"setLayout",
"(",
"null",
")",
";",
"tf",
".",
"setVisible",
"(",
"true",
")",
";",
"tf",
".",
"setText",
"(",
"xyz",
")",
";",
"frame",
".",
"getContentPane",
"(",
")",
".",
"add",
"(",
"tf",
")",
";",
"tf",
".",
"setBounds",
"(",
"346",
",",
"109",
",",
"327",
",",
"206",
")",
";",
"}",
"}",
")",
";",
"frame",
".",
"getContentPane",
"(",
")",
".",
"add",
"(",
"btnNewButton_2",
")",
";",
"Component",
"verticalStrut",
"=",
"Box",
".",
"createVerticalStrut",
"(",
"20",
")",
";",
"verticalStrut",
".",
"setBounds",
"(",
"166",
",",
"29",
",",
"12",
",",
"261",
")",
";",
"frame",
".",
"getContentPane",
"(",
")",
".",
"add",
"(",
"verticalStrut",
")",
";",
"JButton",
"btnNewButton_1_1",
"=",
"new",
"JButton",
"(",
"\"INATIVIDADE\"",
")",
";",
"btnNewButton_1_1",
".",
"addActionListener",
"(",
"new",
"ActionListener",
"(",
")",
"{",
"public",
"void",
"actionPerformed",
"(",
"ActionEvent",
"e",
")",
"{",
"int",
"i",
"=",
"ina",
".",
"callback",
"(",
")",
";",
"JOptionPane",
".",
"showMessageDialog",
"(",
"null",
",",
"\"Voce ficou inativo por: \"",
"+",
"i",
"*",
"5",
"+",
"\" minutos\"",
")",
";",
"}",
"}",
")",
";",
"btnNewButton_1_1",
".",
"setFont",
"(",
"new",
"Font",
"(",
"\"Tahoma\"",
",",
"Font",
".",
"BOLD",
",",
"21",
")",
")",
";",
"btnNewButton_1_1",
".",
"setBounds",
"(",
"346",
",",
"326",
",",
"327",
",",
"71",
")",
";",
"frame",
".",
"getContentPane",
"(",
")",
".",
"add",
"(",
"btnNewButton_1_1",
")",
";",
"JLabel",
"lblNewLabel_4",
"=",
"new",
"JLabel",
"(",
"\"Come\\u00E7o:\"",
")",
";",
"lblNewLabel_4",
".",
"setFont",
"(",
"new",
"Font",
"(",
"\"Tahoma\"",
",",
"Font",
".",
"BOLD",
",",
"11",
")",
")",
";",
"lblNewLabel_4",
".",
"setForeground",
"(",
"Color",
".",
"WHITE",
")",
";",
"lblNewLabel_4",
".",
"setBounds",
"(",
"10",
",",
"85",
",",
"66",
",",
"14",
")",
";",
"frame",
".",
"getContentPane",
"(",
")",
".",
"add",
"(",
"lblNewLabel_4",
")",
";",
"JLabel",
"lblNewLabel_4_1",
"=",
"new",
"JLabel",
"(",
"\"Fim: \"",
")",
";",
"lblNewLabel_4_1",
".",
"setForeground",
"(",
"Color",
".",
"WHITE",
")",
";",
"lblNewLabel_4_1",
".",
"setFont",
"(",
"new",
"Font",
"(",
"\"Tahoma\"",
",",
"Font",
".",
"BOLD",
",",
"11",
")",
")",
";",
"lblNewLabel_4_1",
".",
"setBounds",
"(",
"10",
",",
"155",
",",
"66",
",",
"14",
")",
";",
"frame",
".",
"getContentPane",
"(",
")",
".",
"add",
"(",
"lblNewLabel_4_1",
")",
";",
"}"
] | [
55,
1
] | [
244,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
aula04ex. | null | utilizando o For. | utilizando o For. | public static void somaFor(){
int soma = 0;
for (int i =0; i<=100; i++){
soma = soma + i;
}
System.out.println(soma);
} | [
"public",
"static",
"void",
"somaFor",
"(",
")",
"{",
"int",
"soma",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<=",
"100",
";",
"i",
"++",
")",
"{",
"soma",
"=",
"soma",
"+",
"i",
";",
"}",
"System",
".",
"out",
".",
"println",
"(",
"soma",
")",
";",
"}"
] | [
42,
4
] | [
48,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
PessoaController. | null | faz busca por nome dos contatos ativos | faz busca por nome dos contatos ativos | @GetMapping("/getContatosAtivos_nome")
public ResponseEntity<List<Pessoa>> getContatosAtivos_nome(@RequestParam String nome){
return new ResponseEntity<List<Pessoa>>(pessoaService.getContatosAtivos_nome(nome), HttpStatus.OK);
} | [
"@",
"GetMapping",
"(",
"\"/getContatosAtivos_nome\"",
")",
"public",
"ResponseEntity",
"<",
"List",
"<",
"Pessoa",
">",
">",
"getContatosAtivos_nome",
"(",
"@",
"RequestParam",
"String",
"nome",
")",
"{",
"return",
"new",
"ResponseEntity",
"<",
"List",
"<",
"Pessoa",
">",
">",
"(",
"pessoaService",
".",
"getContatosAtivos_nome",
"(",
"nome",
")",
",",
"HttpStatus",
".",
"OK",
")",
";",
"}"
] | [
32,
4
] | [
35,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Rule. | null | se a regra do parametro é uma subregra deste objeto | se a regra do parametro é uma subregra deste objeto | public boolean isSubRule(Rule rule){
boolean flag = true;
int sequenceAux = 0;
for(int i = 0; i < rule.getSequence().size(); i++){
ItemSet itemSet = rule.sequence.get(i);
boolean exist = false;
for(int j = sequenceAux; j < this.sequence.size(); j++){
ItemSet myItemSet = this.sequence.get(j);
if(myItemSet.isSubItem(itemSet)){
sequenceAux = j+1;
exist = true;
break;
}
}
if(!exist){
flag = false;
break;
}
}
return flag;
} | [
"public",
"boolean",
"isSubRule",
"(",
"Rule",
"rule",
")",
"{",
"boolean",
"flag",
"=",
"true",
";",
"int",
"sequenceAux",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"rule",
".",
"getSequence",
"(",
")",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"ItemSet",
"itemSet",
"=",
"rule",
".",
"sequence",
".",
"get",
"(",
"i",
")",
";",
"boolean",
"exist",
"=",
"false",
";",
"for",
"(",
"int",
"j",
"=",
"sequenceAux",
";",
"j",
"<",
"this",
".",
"sequence",
".",
"size",
"(",
")",
";",
"j",
"++",
")",
"{",
"ItemSet",
"myItemSet",
"=",
"this",
".",
"sequence",
".",
"get",
"(",
"j",
")",
";",
"if",
"(",
"myItemSet",
".",
"isSubItem",
"(",
"itemSet",
")",
")",
"{",
"sequenceAux",
"=",
"j",
"+",
"1",
";",
"exist",
"=",
"true",
";",
"break",
";",
"}",
"}",
"if",
"(",
"!",
"exist",
")",
"{",
"flag",
"=",
"false",
";",
"break",
";",
"}",
"}",
"return",
"flag",
";",
"}"
] | [
55,
4
] | [
77,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Parque. | null | Método que devolve a quantidade total de minutos atribuídos | Método que devolve a quantidade total de minutos atribuídos | public int totalMinutos()
{
return this.lugares.values()
.stream()
.mapToInt(l -> l.getMinutos())
.sum();
} | [
"public",
"int",
"totalMinutos",
"(",
")",
"{",
"return",
"this",
".",
"lugares",
".",
"values",
"(",
")",
".",
"stream",
"(",
")",
".",
"mapToInt",
"(",
"l",
"->",
"l",
".",
"getMinutos",
"(",
")",
")",
".",
"sum",
"(",
")",
";",
"}"
] | [
77,
2
] | [
83,
3
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
AppUsers. | null | retorna o numero de utilizadores | retorna o numero de utilizadores | public String numeroAppUsers () {
return allAppUsers.size() + "";
} | [
"public",
"String",
"numeroAppUsers",
"(",
")",
"{",
"return",
"allAppUsers",
".",
"size",
"(",
")",
"+",
"\"\"",
";",
"}"
] | [
32,
4
] | [
34,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Menu. | null | Apresentar o menu | Apresentar o menu | private void show() {
System.out.println("\n**** Menu"+nome+" *** ");
for (int i=0; i<this.opcoes.size(); i++) {
System.out.print(i+1);
System.out.print(" - ");
System.out.println(this.disponivel.get(i).validate()?this.opcoes.get(i):"---");
}
System.out.println("0 - Sair");
} | [
"private",
"void",
"show",
"(",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"\\n**** Menu\"",
"+",
"nome",
"+",
"\" *** \"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"opcoes",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"i",
"+",
"1",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"\" - \"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"this",
".",
"disponivel",
".",
"get",
"(",
"i",
")",
".",
"validate",
"(",
")",
"?",
"this",
".",
"opcoes",
".",
"get",
"(",
"i",
")",
":",
"\"---\"",
")",
";",
"}",
"System",
".",
"out",
".",
"println",
"(",
"\"0 - Sair\"",
")",
";",
"}"
] | [
140,
4
] | [
148,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Mamifero. | null | (Polimorfismo)Sobreposição com a mesma assinatura dos métodos de animal | (Polimorfismo)Sobreposição com a mesma assinatura dos métodos de animal | @Override
public void locomover() {
System.out.println("Correndo");
} | [
"@",
"Override",
"public",
"void",
"locomover",
"(",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Correndo\"",
")",
";",
"}"
] | [
12,
4
] | [
15,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Car. | null | Registar um proprietario no carro | Registar um proprietario no carro | public void registoProprietario(Person pessoa, int mesRegisto, int anoRegisto, String matricula) {
setProprietario(pessoa);
setMesRegisto(mesRegisto);
setAnoRegisto(anoRegisto);
setMatricula(matricula);
} | [
"public",
"void",
"registoProprietario",
"(",
"Person",
"pessoa",
",",
"int",
"mesRegisto",
",",
"int",
"anoRegisto",
",",
"String",
"matricula",
")",
"{",
"setProprietario",
"(",
"pessoa",
")",
";",
"setMesRegisto",
"(",
"mesRegisto",
")",
";",
"setAnoRegisto",
"(",
"anoRegisto",
")",
";",
"setMatricula",
"(",
"matricula",
")",
";",
"}"
] | [
134,
4
] | [
139,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Cartao. | null | Utilizando o algoritmo de LUHN para validar o número dos cartões | Utilizando o algoritmo de LUHN para validar o número dos cartões | public boolean ValidaNUM_Cartao(String numeroCartao) {
int somaPar = 0;
int somaImpar = 0;
int aux = 0;
//PARES
for (int j = numeroCartao.length() - 2; j >= 0; j = j - 2) {
aux = Integer.parseInt(numeroCartao.charAt(j) + "");
somaPar = somaPar + somaDigitos(aux * 2);
}
//IMPARES
for (int i = numeroCartao.length() - 1; i >= 0; i = i - 2) {
aux = Integer.parseInt(numeroCartao.charAt(i) + "");
somaImpar = somaImpar + aux;
}
if ((somaPar + somaImpar) % 10 == 0) {
return true;
} else {
return false;
}
} | [
"public",
"boolean",
"ValidaNUM_Cartao",
"(",
"String",
"numeroCartao",
")",
"{",
"int",
"somaPar",
"=",
"0",
";",
"int",
"somaImpar",
"=",
"0",
";",
"int",
"aux",
"=",
"0",
";",
"//PARES",
"for",
"(",
"int",
"j",
"=",
"numeroCartao",
".",
"length",
"(",
")",
"-",
"2",
";",
"j",
">=",
"0",
";",
"j",
"=",
"j",
"-",
"2",
")",
"{",
"aux",
"=",
"Integer",
".",
"parseInt",
"(",
"numeroCartao",
".",
"charAt",
"(",
"j",
")",
"+",
"\"\"",
")",
";",
"somaPar",
"=",
"somaPar",
"+",
"somaDigitos",
"(",
"aux",
"*",
"2",
")",
";",
"}",
"//IMPARES",
"for",
"(",
"int",
"i",
"=",
"numeroCartao",
".",
"length",
"(",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"=",
"i",
"-",
"2",
")",
"{",
"aux",
"=",
"Integer",
".",
"parseInt",
"(",
"numeroCartao",
".",
"charAt",
"(",
"i",
")",
"+",
"\"\"",
")",
";",
"somaImpar",
"=",
"somaImpar",
"+",
"aux",
";",
"}",
"if",
"(",
"(",
"somaPar",
"+",
"somaImpar",
")",
"%",
"10",
"==",
"0",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}"
] | [
103,
4
] | [
127,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
UsuarioService. | null | Este método verifica se os dados fornecidos no formulário de login batem com os de algum usuário inserido no banco de dados. | Este método verifica se os dados fornecidos no formulário de login batem com os de algum usuário inserido no banco de dados. | @Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
Usuario usuario = usuarioRepository.findByEmail(username)
.orElseThrow(() -> new UsernameNotFoundException("Usuario não encontrado"));
return new User(
usuario.getEmail(),
usuario.getSenha(),
AuthorityUtils.createAuthorityList(usuario.getPerfil())
);
} | [
"@",
"Override",
"public",
"UserDetails",
"loadUserByUsername",
"(",
"String",
"username",
")",
"throws",
"UsernameNotFoundException",
"{",
"Usuario",
"usuario",
"=",
"usuarioRepository",
".",
"findByEmail",
"(",
"username",
")",
".",
"orElseThrow",
"(",
"(",
")",
"->",
"new",
"UsernameNotFoundException",
"(",
"\"Usuario não encontrado\")",
")",
";",
"\r",
"return",
"new",
"User",
"(",
"usuario",
".",
"getEmail",
"(",
")",
",",
"usuario",
".",
"getSenha",
"(",
")",
",",
"AuthorityUtils",
".",
"createAuthorityList",
"(",
"usuario",
".",
"getPerfil",
"(",
")",
")",
")",
";",
"}"
] | [
23,
2
] | [
34,
3
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
SecurityConfiguration. | null | Configurações de Autenticação | Configurações de Autenticação | @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",
"(",
")",
")",
";",
"}"
] | [
37,
4
] | [
40,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Rei. | null | método que retorna o código/representação da peça: | método que retorna o código/representação da peça: | @Override
public String desenho() {
if (this.getCor().equals("preto")) { //caso sua cor seja preta
return "Kb";
} else { //caso sua cor seja branco
return "Kw";
}
} | [
"@",
"Override",
"public",
"String",
"desenho",
"(",
")",
"{",
"if",
"(",
"this",
".",
"getCor",
"(",
")",
".",
"equals",
"(",
"\"preto\"",
")",
")",
"{",
"//caso sua cor seja preta",
"return",
"\"Kb\"",
";",
"}",
"else",
"{",
"//caso sua cor seja branco",
"return",
"\"Kw\"",
";",
"}",
"}"
] | [
12,
4
] | [
19,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
FramePrincipal. | null | método ativado ao clicar o botão que se conecta a partida | método ativado ao clicar o botão que se conecta a partida | private void BotaoClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotaoClienteActionPerformed
//inicia o jogo para o jogador 2
novaTela(2);
//desabilita os botões, para que não interfiram na nova tela
BotaoServer.setEnabled(false);
BotaoCliente.setEnabled(false);
} | [
"private",
"void",
"BotaoClienteActionPerformed",
"(",
"java",
".",
"awt",
".",
"event",
".",
"ActionEvent",
"evt",
")",
"{",
"//GEN-FIRST:event_BotaoClienteActionPerformed",
"//inicia o jogo para o jogador 2",
"novaTela",
"(",
"2",
")",
";",
"//desabilita os botões, para que não interfiram na nova tela",
"BotaoServer",
".",
"setEnabled",
"(",
"false",
")",
";",
"BotaoCliente",
".",
"setEnabled",
"(",
"false",
")",
";",
"}"
] | [
81,
4
] | [
87,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
RepositorioIntituicaoBDR. | null | Metodos do crud | Metodos do crud | @Override
public void cadastrarInstituicao(Instituicao instituicao)
throws SQLException {
System.out.println("Chegando ao repositorio cadastrarIntituicao");
PreparedStatement stmt = null;
ResultSet resultSet = null;
String sql = "";
try {
sql = "INSERT INTO Instituicao(id_reserva,nome,cnpj,tipo) VALUES (?, ?, ?, ?)";
if (database == Database.ORACLE) {
stmt = this.connection.prepareStatement(sql,
new String[] { "id_instituicao" });
} else {
stmt = this.connection.prepareStatement(sql,
Statement.RETURN_GENERATED_KEYS);
}
stmt.setInt(1, instituicao.getReserva().getIdReserva());
stmt.setString(2, instituicao.getNome());
stmt.setString(3, instituicao.getCnpj());
stmt.setString(4, instituicao.getTipo());
stmt.execute();
resultSet = stmt.getGeneratedKeys();
System.out.println("INSERT CONCLUIDO COM SUCESSO");
} finally {
stmt.close();
}
} | [
"@",
"Override",
"public",
"void",
"cadastrarInstituicao",
"(",
"Instituicao",
"instituicao",
")",
"throws",
"SQLException",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Chegando ao repositorio cadastrarIntituicao\"",
")",
";",
"PreparedStatement",
"stmt",
"=",
"null",
";",
"ResultSet",
"resultSet",
"=",
"null",
";",
"String",
"sql",
"=",
"\"\"",
";",
"try",
"{",
"sql",
"=",
"\"INSERT INTO Instituicao(id_reserva,nome,cnpj,tipo) VALUES (?, ?, ?, ?)\"",
";",
"if",
"(",
"database",
"==",
"Database",
".",
"ORACLE",
")",
"{",
"stmt",
"=",
"this",
".",
"connection",
".",
"prepareStatement",
"(",
"sql",
",",
"new",
"String",
"[",
"]",
"{",
"\"id_instituicao\"",
"}",
")",
";",
"}",
"else",
"{",
"stmt",
"=",
"this",
".",
"connection",
".",
"prepareStatement",
"(",
"sql",
",",
"Statement",
".",
"RETURN_GENERATED_KEYS",
")",
";",
"}",
"stmt",
".",
"setInt",
"(",
"1",
",",
"instituicao",
".",
"getReserva",
"(",
")",
".",
"getIdReserva",
"(",
")",
")",
";",
"stmt",
".",
"setString",
"(",
"2",
",",
"instituicao",
".",
"getNome",
"(",
")",
")",
";",
"stmt",
".",
"setString",
"(",
"3",
",",
"instituicao",
".",
"getCnpj",
"(",
")",
")",
";",
"stmt",
".",
"setString",
"(",
"4",
",",
"instituicao",
".",
"getTipo",
"(",
")",
")",
";",
"stmt",
".",
"execute",
"(",
")",
";",
"resultSet",
"=",
"stmt",
".",
"getGeneratedKeys",
"(",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"INSERT CONCLUIDO COM SUCESSO\"",
")",
";",
"}",
"finally",
"{",
"stmt",
".",
"close",
"(",
")",
";",
"}",
"}"
] | [
34,
1
] | [
66,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Crud. | null | /* Método de leitura de uma entidade usando Hash direto
@return Entidade
Gera exceção caso não encontre a entidade desejada
| /* Método de leitura de uma entidade usando Hash direto
| public T read(int id) throws Exception {
T entidade = null;
// Procurando a ID da entidade no índice direto, nao achar gera uma exceção
long posPesquisa = this.arquivoIndiceDireto.read(id);
if(posPesquisa != -1) this.arquivo.seek(posPesquisa);
else return null;
long tamEntidade = this.arquivo.readLong(); // Ler tamanho da entidade
byte[] registro = new byte[(int)tamEntidade]; // Criar um byte array do registro
this.arquivo.read(registro); // Ler a entidade do disco
entidade = this.constructor.newInstance(); // Criando um objeto na memória para receber a entidade
entidade.fromByteArray(registro); // Recebendo os dados da entidade
return entidade;
} | [
"public",
"T",
"read",
"(",
"int",
"id",
")",
"throws",
"Exception",
"{",
"T",
"entidade",
"=",
"null",
";",
"// Procurando a ID da entidade no índice direto, nao achar gera uma exceção",
"long",
"posPesquisa",
"=",
"this",
".",
"arquivoIndiceDireto",
".",
"read",
"(",
"id",
")",
";",
"if",
"(",
"posPesquisa",
"!=",
"-",
"1",
")",
"this",
".",
"arquivo",
".",
"seek",
"(",
"posPesquisa",
")",
";",
"else",
"return",
"null",
";",
"long",
"tamEntidade",
"=",
"this",
".",
"arquivo",
".",
"readLong",
"(",
")",
";",
"// Ler tamanho da entidade",
"byte",
"[",
"]",
"registro",
"=",
"new",
"byte",
"[",
"(",
"int",
")",
"tamEntidade",
"]",
";",
"// Criar um byte array do registro",
"this",
".",
"arquivo",
".",
"read",
"(",
"registro",
")",
";",
"// Ler a entidade do disco",
"entidade",
"=",
"this",
".",
"constructor",
".",
"newInstance",
"(",
")",
";",
"// Criando um objeto na memória para receber a entidade",
"entidade",
".",
"fromByteArray",
"(",
"registro",
")",
";",
"// Recebendo os dados da entidade",
"return",
"entidade",
";",
"}"
] | [
91,
4
] | [
107,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Tela. | null | Eu peguei ambos da internet, então não sou capaz de opinar | Eu peguei ambos da internet, então não sou capaz de opinar | @Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
Desenha(g);
Toolkit.getDefaultToolkit().sync();
} | [
"@",
"Override",
"public",
"void",
"paintComponent",
"(",
"Graphics",
"g",
")",
"{",
"super",
".",
"paintComponent",
"(",
"g",
")",
";",
"Desenha",
"(",
"g",
")",
";",
"Toolkit",
".",
"getDefaultToolkit",
"(",
")",
".",
"sync",
"(",
")",
";",
"}"
] | [
58,
4
] | [
63,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
clienteController. | null | Serviço para verificar o saldo dessa conta corrente | Serviço para verificar o saldo dessa conta corrente | @GetMapping("/v1/saldo/{numeroConta}")
public ResponseEntity<Object> saldo (@PathVariable("numeroConta") String numeroConta){
try {
Double numeroContaA = Double.parseDouble(numeroConta);
Cliente clienteSaldo = clienteRepository.getOne(numeroContaA);
return ResponseEntity.ok(clienteSaldo.getSaldoConta());
} catch (Exception e) {
e.printStackTrace();
return ResponseEntity.status(500).body(null);
}
} | [
"@",
"GetMapping",
"(",
"\"/v1/saldo/{numeroConta}\"",
")",
"public",
"ResponseEntity",
"<",
"Object",
">",
"saldo",
"(",
"@",
"PathVariable",
"(",
"\"numeroConta\"",
")",
"String",
"numeroConta",
")",
"{",
"try",
"{",
"Double",
"numeroContaA",
"=",
"Double",
".",
"parseDouble",
"(",
"numeroConta",
")",
";",
"Cliente",
"clienteSaldo",
"=",
"clienteRepository",
".",
"getOne",
"(",
"numeroContaA",
")",
";",
"return",
"ResponseEntity",
".",
"ok",
"(",
"clienteSaldo",
".",
"getSaldoConta",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"return",
"ResponseEntity",
".",
"status",
"(",
"500",
")",
".",
"body",
"(",
"null",
")",
";",
"}",
"}"
] | [
52,
4
] | [
62,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Animal. | null | Getters que serão necessários na classe PetShop. | Getters que serão necessários na classe PetShop. | public String getNome() {
return nome;
} | [
"public",
"String",
"getNome",
"(",
")",
"{",
"return",
"nome",
";",
"}"
] | [
38,
1
] | [
40,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
SparqlUpdateInsertStepMeta. | null | especificados pelas estas variaveis desta classe Meta | especificados pelas estas variaveis desta classe Meta | public int getFieldType(Field field) {
if (field == Field.PORT)
return ValueMetaInterface.TYPE_INTEGER;
if (field == Field.OUT_CODE)
return ValueMetaInterface.TYPE_INTEGER;
else if (field == Field.CLEAR_GRAPH)
return ValueMetaInterface.TYPE_BOOLEAN;
else
return ValueMetaInterface.TYPE_STRING;
} | [
"public",
"int",
"getFieldType",
"(",
"Field",
"field",
")",
"{",
"if",
"(",
"field",
"==",
"Field",
".",
"PORT",
")",
"return",
"ValueMetaInterface",
".",
"TYPE_INTEGER",
";",
"if",
"(",
"field",
"==",
"Field",
".",
"OUT_CODE",
")",
"return",
"ValueMetaInterface",
".",
"TYPE_INTEGER",
";",
"else",
"if",
"(",
"field",
"==",
"Field",
".",
"CLEAR_GRAPH",
")",
"return",
"ValueMetaInterface",
".",
"TYPE_BOOLEAN",
";",
"else",
"return",
"ValueMetaInterface",
".",
"TYPE_STRING",
";",
"}"
] | [
156,
1
] | [
165,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Estacionamento. | null | Retorna true ou false informando se determinado carro está estacionado ou não | Retorna true ou false informando se determinado carro está estacionado ou não | public boolean carroEstacionado(Carro carro) {
return this.estacionamento.contains(carro);
} | [
"public",
"boolean",
"carroEstacionado",
"(",
"Carro",
"carro",
")",
"{",
"return",
"this",
".",
"estacionamento",
".",
"contains",
"(",
"carro",
")",
";",
"}"
] | [
56,
4
] | [
58,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
PaginaInicial. | null | Botao Lista Utilizadores | Botao Lista Utilizadores | private void AdicionarAmigoPanelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_AdicionarAmigoPanelMouseClicked
jLabel4.setForeground(new Color(255, 255, 255));
jLabel7.setForeground(new Color(255, 255, 255));
jLabel8.setForeground(new Color(255, 136, 37));
jLabel3.setIcon(new ImageIcon("./src/projetosd/Icons/home_40px.png"));
jLabel5.setIcon(new ImageIcon("./src/projetosd/Icons/friends_45px.png"));
jLabel6.setIcon(new ImageIcon("./src/projetosd/Icons/add_user_group_man_man_40px_Orange.png"));
try {
RegistoInterface regInt = (RegistoInterface) LocateRegistry.getRegistry(InetAddress.getByName("DESKTOP-BJABO8J").getHostAddress()).lookup(SERVICE_NAME);
system.getEntireAppUsers().setAppUsers(regInt.getUsers(system.getOnGoingUser(), 0, ""));
} catch (Exception Exept) {
System.out.println("Error: " + Exept);
}
PreencherTabelaPedidos();
PreencherTabelaUsers();
PaginaInicial.setVisible(false);
ListaAmigos.setVisible(false);
AdicionarAmigos.setVisible(true);
} | [
"private",
"void",
"AdicionarAmigoPanelMouseClicked",
"(",
"java",
".",
"awt",
".",
"event",
".",
"MouseEvent",
"evt",
")",
"{",
"//GEN-FIRST:event_AdicionarAmigoPanelMouseClicked",
"jLabel4",
".",
"setForeground",
"(",
"new",
"Color",
"(",
"255",
",",
"255",
",",
"255",
")",
")",
";",
"jLabel7",
".",
"setForeground",
"(",
"new",
"Color",
"(",
"255",
",",
"255",
",",
"255",
")",
")",
";",
"jLabel8",
".",
"setForeground",
"(",
"new",
"Color",
"(",
"255",
",",
"136",
",",
"37",
")",
")",
";",
"jLabel3",
".",
"setIcon",
"(",
"new",
"ImageIcon",
"(",
"\"./src/projetosd/Icons/home_40px.png\"",
")",
")",
";",
"jLabel5",
".",
"setIcon",
"(",
"new",
"ImageIcon",
"(",
"\"./src/projetosd/Icons/friends_45px.png\"",
")",
")",
";",
"jLabel6",
".",
"setIcon",
"(",
"new",
"ImageIcon",
"(",
"\"./src/projetosd/Icons/add_user_group_man_man_40px_Orange.png\"",
")",
")",
";",
"try",
"{",
"RegistoInterface",
"regInt",
"=",
"(",
"RegistoInterface",
")",
"LocateRegistry",
".",
"getRegistry",
"(",
"InetAddress",
".",
"getByName",
"(",
"\"DESKTOP-BJABO8J\"",
")",
".",
"getHostAddress",
"(",
")",
")",
".",
"lookup",
"(",
"SERVICE_NAME",
")",
";",
"system",
".",
"getEntireAppUsers",
"(",
")",
".",
"setAppUsers",
"(",
"regInt",
".",
"getUsers",
"(",
"system",
".",
"getOnGoingUser",
"(",
")",
",",
"0",
",",
"\"\"",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"Exept",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Error: \"",
"+",
"Exept",
")",
";",
"}",
"PreencherTabelaPedidos",
"(",
")",
";",
"PreencherTabelaUsers",
"(",
")",
";",
"PaginaInicial",
".",
"setVisible",
"(",
"false",
")",
";",
"ListaAmigos",
".",
"setVisible",
"(",
"false",
")",
";",
"AdicionarAmigos",
".",
"setVisible",
"(",
"true",
")",
";",
"}"
] | [
776,
4
] | [
801,
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 For | Imprime na consola todos os Numeros Pares de 1 a 20 Com ciclo For | public static void numparFor(){
for (int n =1; n<=20; n++){
// Verifica se n é par
if (n%2==0){
System.out.println(n);
}
}
} | [
"public",
"static",
"void",
"numparFor",
"(",
")",
"{",
"for",
"(",
"int",
"n",
"=",
"1",
";",
"n",
"<=",
"20",
";",
"n",
"++",
")",
"{",
"// Verifica se n é par",
"if",
"(",
"n",
"%",
"2",
"==",
"0",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"n",
")",
";",
"}",
"}",
"}"
] | [
46,
4
] | [
53,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
LBSTree. | null | Converter conteudo da classe para String ccom caminhamento em ordem | Converter conteudo da classe para String ccom caminhamento em ordem | public String toString() {
treeString = "";
inOrder(raiz);
return(treeString);
} | [
"public",
"String",
"toString",
"(",
")",
"{",
"treeString",
"=",
"\"\"",
";",
"inOrder",
"(",
"raiz",
")",
";",
"return",
"(",
"treeString",
")",
";",
"}"
] | [
195,
1
] | [
199,
2
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Serial. | null | ******** Configuração de comunicação serial WEIGHTECH WT27 ****** | ******** Configuração de comunicação serial WEIGHTECH WT27 ****** | public void configWT27() {
setBaud(9600);
setDatabits(8);
setStopbit(1);
setParity(0);
} | [
"public",
"void",
"configWT27",
"(",
")",
"{",
"setBaud",
"(",
"9600",
")",
";",
"setDatabits",
"(",
"8",
")",
";",
"setStopbit",
"(",
"1",
")",
";",
"setParity",
"(",
"0",
")",
";",
"}"
] | [
230,
4
] | [
235,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
teste2. | null | função que limpa o programa e deixa ele como executado da primeira vez | função que limpa o programa e deixa ele como executado da primeira vez | private void limpaDados(){
texNome.setText("");
texCPF.setText("");
radMasc.setSelected(true);
chkIng.setSelected(false);
chkMat.setSelected(false);
chkPro.setSelected(false);
cmbNiv.setSelectedIndex(0);
} | [
"private",
"void",
"limpaDados",
"(",
")",
"{",
"texNome",
".",
"setText",
"(",
"\"\"",
")",
";",
"texCPF",
".",
"setText",
"(",
"\"\"",
")",
";",
"radMasc",
".",
"setSelected",
"(",
"true",
")",
";",
"chkIng",
".",
"setSelected",
"(",
"false",
")",
";",
"chkMat",
".",
"setSelected",
"(",
"false",
")",
";",
"chkPro",
".",
"setSelected",
"(",
"false",
")",
";",
"cmbNiv",
".",
"setSelectedIndex",
"(",
"0",
")",
";",
"}"
] | [
212,
2
] | [
220,
3
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Tabuleiro. | null | método público, invocado pela classe Jogo, que verifica a possível movimentação de uma peça: | método público, invocado pela classe Jogo, que verifica a possível movimentação de uma peça: | public boolean movimentaPeca(int linhaOrigem, char colunaOrigem, int linhaDestino, char colunaDestino, String cor, boolean troca) {
int c1 = (int) (colunaOrigem - 97); //cast da coluna origem para int
int c2 = (int) (colunaDestino - 97); //cast da coluna destino para int
//verificação inicial: se ambas as posições (origem e destino) estão dentro do tabuleiro
if (limitesTabuleiro(this.tabuleiro[linhaOrigem][c1], this.tabuleiro[linhaDestino][c2])) {
//verificação se a posição de origem está ocupada:
if (!this.tabuleiro[linhaOrigem][c1].getStatus()) {
//verificação se a peça presente na posição de origem pertence ao jogador:
if (this.tabuleiro[linhaOrigem][c1].getPeca().getCor() == cor) {
//verificação de qual o tipo de peça presente na posição origem:
if (this.tabuleiro[linhaOrigem][c1].getPeca() instanceof Cavalo) { //caso a peça a ser movimentada seja um cavalo (não é necessário verificar caminho)
//movimento "de comer" ou "de andar":
if (this.tabuleiro[linhaDestino][c2].getStatus() || (!this.tabuleiro[linhaDestino][c2].getStatus() && this.tabuleiro[linhaDestino][c2].getPeca().getCor() != cor)) {
//caso o método checaMovimento da peça retorne verdadeiro, a troca é possível (mas depende do parâmetro troca):
if (troca) {
if (this.tabuleiro[linhaOrigem][c1].getPeca().checaMovimento(linhaOrigem, colunaOrigem, linhaDestino, colunaDestino)) {
this.trocaPecas(this.tabuleiro[linhaOrigem][c1], this.tabuleiro[linhaDestino][c2]); //invocando método de troca de peças
return true;
} else {
//mensagem de erro, caso o jogador tente mover uma peça que não pertença a sua equipe:
System.out.println("Movimento inválido: movimentação não respeita os padrões da peça em questão.");
return false;
}
} else {
return this.tabuleiro[linhaOrigem][c1].getPeca().checaMovimento(linhaOrigem, colunaOrigem, linhaDestino, colunaDestino);
}
}
} else if (this.tabuleiro[linhaOrigem][c1].getPeca() instanceof Peao) { //caso a peça a ser movimentada seja um peão
//movimento "de comer" ou "de andar" - com características do peão:
if ((c2 - c1 == 0 && this.tabuleiro[linhaDestino][c2].getStatus()) || ((c2 - c1 == 1 || c2 - c1 == -1) && !this.tabuleiro[linhaDestino][c2].getStatus() && this.tabuleiro[linhaDestino][c2].getPeca().getCor() != cor)) { //movimento vertical
//caso o método checaMovimento da peça retorne verdadeiro, a troca é possível (mas depende do parâmetro troca):
if (troca) {
if (this.tabuleiro[linhaOrigem][c1].getPeca().checaMovimento(linhaOrigem, colunaOrigem, linhaDestino, colunaDestino)) {
this.trocaPecas(this.tabuleiro[linhaOrigem][c1], this.tabuleiro[linhaDestino][c2]); //invocando método de troca de peças
return true;
} else {
//mensagem de erro, caso o jogador tente mover uma peça que não pertença a sua equipe:
System.out.println("Movimento inválido: movimentação não respeita os padrões da peça em questão.");
return false;
}
} else {
return this.tabuleiro[linhaOrigem][c1].getPeca().checaMovimento(linhaOrigem, colunaOrigem, linhaDestino, colunaDestino);
}
} else {
if (troca) {
System.out.println("Movimento inválido: movimentação não respeita os padrões da peça em questão.");
}
return false;
}
} else { //demais peças (Rei, Rainha, Bispo e Torre), é preciso verificar se o caminho está livre:
//movimento "de comer" ou "de andar":
if (this.tabuleiro[linhaDestino][c2].getStatus() || (!this.tabuleiro[linhaDestino][c2].getStatus() && this.tabuleiro[linhaDestino][c2].getPeca().getCor() != cor)) {
//percorredno o caminho do movimento, caso haja uma peça presente, o movimento não pode ocorrer (retorno é falso):
if (c2 - c1 == 0 && linhaDestino - linhaOrigem != 0) { //movimento vertical
if (linhaOrigem > linhaDestino) { //movimento vertical para baixo
for (int i = linhaOrigem-1; i > linhaDestino; i--) {
if (!this.tabuleiro[i][c1].getStatus()) {
if (troca) {
System.out.println("Movimento inválido: o caminho para a movimentação está bloqueado.");
}
return false;
}
}
} else { //movimento vertical para cima
for (int i = linhaOrigem+1; i < linhaDestino; i++) {
if (!this.tabuleiro[i][c1].getStatus()) {
if (troca) {
System.out.println("Movimento inválido: o caminho para a movimentação está bloqueado.");
}
return false;
}
}
}
} else if (c2 - c1 != 0 && linhaDestino - linhaOrigem == 0) { //movimento horizontal
if (c1 > c2) { //movimento horizontal para a esquerda
for (int i = c1-1; i > c2; i--) {
if (!this.tabuleiro[linhaOrigem][i].getStatus()) {
if (troca) {
System.out.println("Movimento inválido: o caminho para a movimentação está bloqueado.");
}
return false;
}
}
} else { //movimento horizontal para a direita
for (int i = c1+1; i < c2; i++) {
if (!this.tabuleiro[linhaOrigem][i].getStatus()) {
if (troca) {
System.out.println("Movimento inválido: o caminho para a movimentação está bloqueado.");
}
return false;
}
}
}
} else if ((c2 - c1 == linhaDestino - linhaOrigem) || (c2 - c1 == -(linhaDestino - linhaOrigem))) { //movimento diagonal
if (linhaDestino - linhaOrigem > 0) { //movimento diagonal para cima
if (c2 - c1 > 0) { //movimento diagonal para cima e para a direita
for (int i = linhaOrigem+1, j = c1+1; i < linhaDestino; i++, j++) {
if (!this.tabuleiro[i][j].getStatus()) {
if (troca) {
System.out.println("Movimento inválido: o caminho para a movimentação está bloqueado.");
}
return false;
}
}
} else { //movimento diagonal para cima e para esquerda
for (int i = linhaOrigem+1, j = c1-1; i < linhaDestino; i++, j--) {
if (!this.tabuleiro[i][j].getStatus()) {
if (troca) {
System.out.println("Movimento inválido: o caminho para a movimentação está bloqueado.");
}
return false;
}
}
}
} else { //movimento diagonal para baixo
if (c2 - c1 > 0) { //movimento diagonal para baixo e para a direita
for (int i = linhaOrigem-1, j = c1+1; i > linhaDestino; i--, j++) {
if (!this.tabuleiro[i][j].getStatus()) {
if (troca) {
System.out.println("Movimento inválido: o caminho para a movimentação está bloqueado.");
}
return false;
}
}
} else { //movimento diagonal para baixo e para a esquerda
for (int i = linhaOrigem-1, j = c1-1; i > linhaDestino; i--, j--) {
if (!this.tabuleiro[i][j].getStatus()) {
if (troca) {
System.out.println("Movimento inválido: o caminho para a movimentação está bloqueado.");
}
return false;
}
}
}
}
}
//caso o caminho esteja livre (não houve retorno false em nenhum dos casos anteriores):
//apenas verifica-se a possiblidade do movimento da peça e a possível troca de peças
if (troca) {
if (this.tabuleiro[linhaOrigem][c1].getPeca().checaMovimento(linhaOrigem, colunaOrigem, linhaDestino, colunaDestino)) {
this.trocaPecas(this.tabuleiro[linhaOrigem][c1], this.tabuleiro[linhaDestino][c2]); //invocando método de troca de peças
return true;
} else {
//mensagem de erro, caso o jogador tente mover uma peça que não pertença a sua equipe:
System.out.println("Movimento inválido: movimentação não respeita os padrões da peça em questão.");
return false;
}
} else {
return this.tabuleiro[linhaOrigem][c1].getPeca().checaMovimento(linhaOrigem, colunaOrigem, linhaDestino, colunaDestino);
}
}
}
} else {
//mensagem de erro, caso o jogador tente mover uma peça que não pertença a sua equipe:
System.out.println("Movimento inválido: a peça desejada não faz parte da sua equipe.");
return false;
}
} else {
//mensagem de erro, caso a posição origem do movimento esteja vazia:
System.out.println("Movimento inválido: posição origem vazia.");
return false;
}
}
return false;
} | [
"public",
"boolean",
"movimentaPeca",
"(",
"int",
"linhaOrigem",
",",
"char",
"colunaOrigem",
",",
"int",
"linhaDestino",
",",
"char",
"colunaDestino",
",",
"String",
"cor",
",",
"boolean",
"troca",
")",
"{",
"int",
"c1",
"=",
"(",
"int",
")",
"(",
"colunaOrigem",
"-",
"97",
")",
";",
"//cast da coluna origem para int",
"int",
"c2",
"=",
"(",
"int",
")",
"(",
"colunaDestino",
"-",
"97",
")",
";",
"//cast da coluna destino para int",
"//verificação inicial: se ambas as posições (origem e destino) estão dentro do tabuleiro",
"if",
"(",
"limitesTabuleiro",
"(",
"this",
".",
"tabuleiro",
"[",
"linhaOrigem",
"]",
"[",
"c1",
"]",
",",
"this",
".",
"tabuleiro",
"[",
"linhaDestino",
"]",
"[",
"c2",
"]",
")",
")",
"{",
"//verificação se a posição de origem está ocupada:",
"if",
"(",
"!",
"this",
".",
"tabuleiro",
"[",
"linhaOrigem",
"]",
"[",
"c1",
"]",
".",
"getStatus",
"(",
")",
")",
"{",
"//verificação se a peça presente na posição de origem pertence ao jogador:",
"if",
"(",
"this",
".",
"tabuleiro",
"[",
"linhaOrigem",
"]",
"[",
"c1",
"]",
".",
"getPeca",
"(",
")",
".",
"getCor",
"(",
")",
"==",
"cor",
")",
"{",
"//verificação de qual o tipo de peça presente na posição origem:",
"if",
"(",
"this",
".",
"tabuleiro",
"[",
"linhaOrigem",
"]",
"[",
"c1",
"]",
".",
"getPeca",
"(",
")",
"instanceof",
"Cavalo",
")",
"{",
"//caso a peça a ser movimentada seja um cavalo (não é necessário verificar caminho)",
"//movimento \"de comer\" ou \"de andar\":",
"if",
"(",
"this",
".",
"tabuleiro",
"[",
"linhaDestino",
"]",
"[",
"c2",
"]",
".",
"getStatus",
"(",
")",
"||",
"(",
"!",
"this",
".",
"tabuleiro",
"[",
"linhaDestino",
"]",
"[",
"c2",
"]",
".",
"getStatus",
"(",
")",
"&&",
"this",
".",
"tabuleiro",
"[",
"linhaDestino",
"]",
"[",
"c2",
"]",
".",
"getPeca",
"(",
")",
".",
"getCor",
"(",
")",
"!=",
"cor",
")",
")",
"{",
"//caso o método checaMovimento da peça retorne verdadeiro, a troca é possível (mas depende do parâmetro troca):",
"if",
"(",
"troca",
")",
"{",
"if",
"(",
"this",
".",
"tabuleiro",
"[",
"linhaOrigem",
"]",
"[",
"c1",
"]",
".",
"getPeca",
"(",
")",
".",
"checaMovimento",
"(",
"linhaOrigem",
",",
"colunaOrigem",
",",
"linhaDestino",
",",
"colunaDestino",
")",
")",
"{",
"this",
".",
"trocaPecas",
"(",
"this",
".",
"tabuleiro",
"[",
"linhaOrigem",
"]",
"[",
"c1",
"]",
",",
"this",
".",
"tabuleiro",
"[",
"linhaDestino",
"]",
"[",
"c2",
"]",
")",
";",
"//invocando método de troca de peças",
"return",
"true",
";",
"}",
"else",
"{",
"//mensagem de erro, caso o jogador tente mover uma peça que não pertença a sua equipe:",
"System",
".",
"out",
".",
"println",
"(",
"\"Movimento inválido: movimentação não respeita os padrões da peça em questão.\");",
"",
"",
"return",
"false",
";",
"}",
"}",
"else",
"{",
"return",
"this",
".",
"tabuleiro",
"[",
"linhaOrigem",
"]",
"[",
"c1",
"]",
".",
"getPeca",
"(",
")",
".",
"checaMovimento",
"(",
"linhaOrigem",
",",
"colunaOrigem",
",",
"linhaDestino",
",",
"colunaDestino",
")",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"this",
".",
"tabuleiro",
"[",
"linhaOrigem",
"]",
"[",
"c1",
"]",
".",
"getPeca",
"(",
")",
"instanceof",
"Peao",
")",
"{",
"//caso a peça a ser movimentada seja um peão",
"//movimento \"de comer\" ou \"de andar\" - com características do peão:",
"if",
"(",
"(",
"c2",
"-",
"c1",
"==",
"0",
"&&",
"this",
".",
"tabuleiro",
"[",
"linhaDestino",
"]",
"[",
"c2",
"]",
".",
"getStatus",
"(",
")",
")",
"||",
"(",
"(",
"c2",
"-",
"c1",
"==",
"1",
"||",
"c2",
"-",
"c1",
"==",
"-",
"1",
")",
"&&",
"!",
"this",
".",
"tabuleiro",
"[",
"linhaDestino",
"]",
"[",
"c2",
"]",
".",
"getStatus",
"(",
")",
"&&",
"this",
".",
"tabuleiro",
"[",
"linhaDestino",
"]",
"[",
"c2",
"]",
".",
"getPeca",
"(",
")",
".",
"getCor",
"(",
")",
"!=",
"cor",
")",
")",
"{",
"//movimento vertical",
"//caso o método checaMovimento da peça retorne verdadeiro, a troca é possível (mas depende do parâmetro troca):",
"if",
"(",
"troca",
")",
"{",
"if",
"(",
"this",
".",
"tabuleiro",
"[",
"linhaOrigem",
"]",
"[",
"c1",
"]",
".",
"getPeca",
"(",
")",
".",
"checaMovimento",
"(",
"linhaOrigem",
",",
"colunaOrigem",
",",
"linhaDestino",
",",
"colunaDestino",
")",
")",
"{",
"this",
".",
"trocaPecas",
"(",
"this",
".",
"tabuleiro",
"[",
"linhaOrigem",
"]",
"[",
"c1",
"]",
",",
"this",
".",
"tabuleiro",
"[",
"linhaDestino",
"]",
"[",
"c2",
"]",
")",
";",
"//invocando método de troca de peças",
"return",
"true",
";",
"}",
"else",
"{",
"//mensagem de erro, caso o jogador tente mover uma peça que não pertença a sua equipe:",
"System",
".",
"out",
".",
"println",
"(",
"\"Movimento inválido: movimentação não respeita os padrões da peça em questão.\");",
"",
"",
"return",
"false",
";",
"}",
"}",
"else",
"{",
"return",
"this",
".",
"tabuleiro",
"[",
"linhaOrigem",
"]",
"[",
"c1",
"]",
".",
"getPeca",
"(",
")",
".",
"checaMovimento",
"(",
"linhaOrigem",
",",
"colunaOrigem",
",",
"linhaDestino",
",",
"colunaDestino",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"troca",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Movimento inválido: movimentação não respeita os padrões da peça em questão.\");",
"",
"",
"}",
"return",
"false",
";",
"}",
"}",
"else",
"{",
"//demais peças (Rei, Rainha, Bispo e Torre), é preciso verificar se o caminho está livre:",
"//movimento \"de comer\" ou \"de andar\":",
"if",
"(",
"this",
".",
"tabuleiro",
"[",
"linhaDestino",
"]",
"[",
"c2",
"]",
".",
"getStatus",
"(",
")",
"||",
"(",
"!",
"this",
".",
"tabuleiro",
"[",
"linhaDestino",
"]",
"[",
"c2",
"]",
".",
"getStatus",
"(",
")",
"&&",
"this",
".",
"tabuleiro",
"[",
"linhaDestino",
"]",
"[",
"c2",
"]",
".",
"getPeca",
"(",
")",
".",
"getCor",
"(",
")",
"!=",
"cor",
")",
")",
"{",
"//percorredno o caminho do movimento, caso haja uma peça presente, o movimento não pode ocorrer (retorno é falso):",
"if",
"(",
"c2",
"-",
"c1",
"==",
"0",
"&&",
"linhaDestino",
"-",
"linhaOrigem",
"!=",
"0",
")",
"{",
"//movimento vertical",
"if",
"(",
"linhaOrigem",
">",
"linhaDestino",
")",
"{",
"//movimento vertical para baixo",
"for",
"(",
"int",
"i",
"=",
"linhaOrigem",
"-",
"1",
";",
"i",
">",
"linhaDestino",
";",
"i",
"--",
")",
"{",
"if",
"(",
"!",
"this",
".",
"tabuleiro",
"[",
"i",
"]",
"[",
"c1",
"]",
".",
"getStatus",
"(",
")",
")",
"{",
"if",
"(",
"troca",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Movimento inválido: o caminho para a movimentação está bloqueado.\"); ",
"",
"",
"}",
"return",
"false",
";",
"}",
"}",
"}",
"else",
"{",
"//movimento vertical para cima",
"for",
"(",
"int",
"i",
"=",
"linhaOrigem",
"+",
"1",
";",
"i",
"<",
"linhaDestino",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"this",
".",
"tabuleiro",
"[",
"i",
"]",
"[",
"c1",
"]",
".",
"getStatus",
"(",
")",
")",
"{",
"if",
"(",
"troca",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Movimento inválido: o caminho para a movimentação está bloqueado.\"); ",
"",
"",
"}",
"return",
"false",
";",
"}",
"}",
"}",
"}",
"else",
"if",
"(",
"c2",
"-",
"c1",
"!=",
"0",
"&&",
"linhaDestino",
"-",
"linhaOrigem",
"==",
"0",
")",
"{",
"//movimento horizontal",
"if",
"(",
"c1",
">",
"c2",
")",
"{",
"//movimento horizontal para a esquerda",
"for",
"(",
"int",
"i",
"=",
"c1",
"-",
"1",
";",
"i",
">",
"c2",
";",
"i",
"--",
")",
"{",
"if",
"(",
"!",
"this",
".",
"tabuleiro",
"[",
"linhaOrigem",
"]",
"[",
"i",
"]",
".",
"getStatus",
"(",
")",
")",
"{",
"if",
"(",
"troca",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Movimento inválido: o caminho para a movimentação está bloqueado.\"); ",
"",
"",
"}",
"return",
"false",
";",
"}",
"}",
"}",
"else",
"{",
"//movimento horizontal para a direita",
"for",
"(",
"int",
"i",
"=",
"c1",
"+",
"1",
";",
"i",
"<",
"c2",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"this",
".",
"tabuleiro",
"[",
"linhaOrigem",
"]",
"[",
"i",
"]",
".",
"getStatus",
"(",
")",
")",
"{",
"if",
"(",
"troca",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Movimento inválido: o caminho para a movimentação está bloqueado.\"); ",
"",
"",
"}",
"return",
"false",
";",
"}",
"}",
"}",
"}",
"else",
"if",
"(",
"(",
"c2",
"-",
"c1",
"==",
"linhaDestino",
"-",
"linhaOrigem",
")",
"||",
"(",
"c2",
"-",
"c1",
"==",
"-",
"(",
"linhaDestino",
"-",
"linhaOrigem",
")",
")",
")",
"{",
"//movimento diagonal",
"if",
"(",
"linhaDestino",
"-",
"linhaOrigem",
">",
"0",
")",
"{",
"//movimento diagonal para cima",
"if",
"(",
"c2",
"-",
"c1",
">",
"0",
")",
"{",
"//movimento diagonal para cima e para a direita",
"for",
"(",
"int",
"i",
"=",
"linhaOrigem",
"+",
"1",
",",
"j",
"=",
"c1",
"+",
"1",
";",
"i",
"<",
"linhaDestino",
";",
"i",
"++",
",",
"j",
"++",
")",
"{",
"if",
"(",
"!",
"this",
".",
"tabuleiro",
"[",
"i",
"]",
"[",
"j",
"]",
".",
"getStatus",
"(",
")",
")",
"{",
"if",
"(",
"troca",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Movimento inválido: o caminho para a movimentação está bloqueado.\"); ",
"",
"",
"}",
"return",
"false",
";",
"}",
"}",
"}",
"else",
"{",
"//movimento diagonal para cima e para esquerda",
"for",
"(",
"int",
"i",
"=",
"linhaOrigem",
"+",
"1",
",",
"j",
"=",
"c1",
"-",
"1",
";",
"i",
"<",
"linhaDestino",
";",
"i",
"++",
",",
"j",
"--",
")",
"{",
"if",
"(",
"!",
"this",
".",
"tabuleiro",
"[",
"i",
"]",
"[",
"j",
"]",
".",
"getStatus",
"(",
")",
")",
"{",
"if",
"(",
"troca",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Movimento inválido: o caminho para a movimentação está bloqueado.\"); ",
"",
"",
"}",
"return",
"false",
";",
"}",
"}",
"}",
"}",
"else",
"{",
"//movimento diagonal para baixo",
"if",
"(",
"c2",
"-",
"c1",
">",
"0",
")",
"{",
"//movimento diagonal para baixo e para a direita",
"for",
"(",
"int",
"i",
"=",
"linhaOrigem",
"-",
"1",
",",
"j",
"=",
"c1",
"+",
"1",
";",
"i",
">",
"linhaDestino",
";",
"i",
"--",
",",
"j",
"++",
")",
"{",
"if",
"(",
"!",
"this",
".",
"tabuleiro",
"[",
"i",
"]",
"[",
"j",
"]",
".",
"getStatus",
"(",
")",
")",
"{",
"if",
"(",
"troca",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Movimento inválido: o caminho para a movimentação está bloqueado.\"); ",
"",
"",
"}",
"return",
"false",
";",
"}",
"}",
"}",
"else",
"{",
"//movimento diagonal para baixo e para a esquerda",
"for",
"(",
"int",
"i",
"=",
"linhaOrigem",
"-",
"1",
",",
"j",
"=",
"c1",
"-",
"1",
";",
"i",
">",
"linhaDestino",
";",
"i",
"--",
",",
"j",
"--",
")",
"{",
"if",
"(",
"!",
"this",
".",
"tabuleiro",
"[",
"i",
"]",
"[",
"j",
"]",
".",
"getStatus",
"(",
")",
")",
"{",
"if",
"(",
"troca",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Movimento inválido: o caminho para a movimentação está bloqueado.\"); ",
"",
"",
"}",
"return",
"false",
";",
"}",
"}",
"}",
"}",
"}",
"//caso o caminho esteja livre (não houve retorno false em nenhum dos casos anteriores):",
"//apenas verifica-se a possiblidade do movimento da peça e a possível troca de peças",
"if",
"(",
"troca",
")",
"{",
"if",
"(",
"this",
".",
"tabuleiro",
"[",
"linhaOrigem",
"]",
"[",
"c1",
"]",
".",
"getPeca",
"(",
")",
".",
"checaMovimento",
"(",
"linhaOrigem",
",",
"colunaOrigem",
",",
"linhaDestino",
",",
"colunaDestino",
")",
")",
"{",
"this",
".",
"trocaPecas",
"(",
"this",
".",
"tabuleiro",
"[",
"linhaOrigem",
"]",
"[",
"c1",
"]",
",",
"this",
".",
"tabuleiro",
"[",
"linhaDestino",
"]",
"[",
"c2",
"]",
")",
";",
"//invocando método de troca de peças",
"return",
"true",
";",
"}",
"else",
"{",
"//mensagem de erro, caso o jogador tente mover uma peça que não pertença a sua equipe:",
"System",
".",
"out",
".",
"println",
"(",
"\"Movimento inválido: movimentação não respeita os padrões da peça em questão.\");",
"",
"",
"return",
"false",
";",
"}",
"}",
"else",
"{",
"return",
"this",
".",
"tabuleiro",
"[",
"linhaOrigem",
"]",
"[",
"c1",
"]",
".",
"getPeca",
"(",
")",
".",
"checaMovimento",
"(",
"linhaOrigem",
",",
"colunaOrigem",
",",
"linhaDestino",
",",
"colunaDestino",
")",
";",
"}",
"}",
"}",
"}",
"else",
"{",
"//mensagem de erro, caso o jogador tente mover uma peça que não pertença a sua equipe:",
"System",
".",
"out",
".",
"println",
"(",
"\"Movimento inválido: a peça desejada não faz parte da sua equipe.\");",
"",
"",
"return",
"false",
";",
"}",
"}",
"else",
"{",
"//mensagem de erro, caso a posição origem do movimento esteja vazia:",
"System",
".",
"out",
".",
"println",
"(",
"\"Movimento inválido: posição origem vazia.\");",
"",
"",
"return",
"false",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | [
286,
4
] | [
450,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
TelaUsuario. | null | método para adicionar usuários | método para adicionar usuários | private void adicionar() {
String sql = "insert into tbusuario(iduser,usuario,fone,login,senha,perfil) values(?,?,?,?,?,?)";
try {
pst = conexao.prepareStatement(sql);
pst.setString(1, txtUsuId.getText());
pst.setString(2, txtUsuNome.getText());
pst.setString(3, txtUsuFone.getText());
pst.setString(4, txtUsuLogin.getText());
pst.setString(5, txtUsuSenha.getText());
pst.setString(6, cboUsuPerfil.getSelectedItem().toString());
//validação dos campos obrigatórios
if ((txtUsuId.getText().isEmpty()) || (txtUsuNome.getText().isEmpty()) || (txtUsuLogin.getText().isEmpty()) || (txtUsuSenha.getText().isEmpty())) {
JOptionPane.showMessageDialog(null, "Preencha todos os campos obrigatórios");
} else {
//a linha abaixo atualiza a tabela usuario com os dados do formulário
//a etrutura abaixo é usada para confirmar a inserção dos dados na tabela
int adicionado = pst.executeUpdate();
//a linha abaixo serve de apoio ao entendimento da lógica
//System.out.println(adicionado);
if (adicionado > 0) {
JOptionPane.showMessageDialog(null, "Usuário adicionado com sucesso");
txtUsuId.setText(null);
txtUsuNome.setText(null);
txtUsuFone.setText(null);
txtUsuLogin.setText(null);
txtUsuSenha.setText(null);
}
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
} | [
"private",
"void",
"adicionar",
"(",
")",
"{",
"String",
"sql",
"=",
"\"insert into tbusuario(iduser,usuario,fone,login,senha,perfil) values(?,?,?,?,?,?)\"",
";",
"try",
"{",
"pst",
"=",
"conexao",
".",
"prepareStatement",
"(",
"sql",
")",
";",
"pst",
".",
"setString",
"(",
"1",
",",
"txtUsuId",
".",
"getText",
"(",
")",
")",
";",
"pst",
".",
"setString",
"(",
"2",
",",
"txtUsuNome",
".",
"getText",
"(",
")",
")",
";",
"pst",
".",
"setString",
"(",
"3",
",",
"txtUsuFone",
".",
"getText",
"(",
")",
")",
";",
"pst",
".",
"setString",
"(",
"4",
",",
"txtUsuLogin",
".",
"getText",
"(",
")",
")",
";",
"pst",
".",
"setString",
"(",
"5",
",",
"txtUsuSenha",
".",
"getText",
"(",
")",
")",
";",
"pst",
".",
"setString",
"(",
"6",
",",
"cboUsuPerfil",
".",
"getSelectedItem",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"//validação dos campos obrigatórios",
"if",
"(",
"(",
"txtUsuId",
".",
"getText",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"||",
"(",
"txtUsuNome",
".",
"getText",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"||",
"(",
"txtUsuLogin",
".",
"getText",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"||",
"(",
"txtUsuSenha",
".",
"getText",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
")",
"{",
"JOptionPane",
".",
"showMessageDialog",
"(",
"null",
",",
"\"Preencha todos os campos obrigatórios\")",
";",
"",
"}",
"else",
"{",
"//a linha abaixo atualiza a tabela usuario com os dados do formulário",
"//a etrutura abaixo é usada para confirmar a inserção dos dados na tabela",
"int",
"adicionado",
"=",
"pst",
".",
"executeUpdate",
"(",
")",
";",
"//a linha abaixo serve de apoio ao entendimento da lógica",
"//System.out.println(adicionado);",
"if",
"(",
"adicionado",
">",
"0",
")",
"{",
"JOptionPane",
".",
"showMessageDialog",
"(",
"null",
",",
"\"Usuário adicionado com sucesso\")",
";",
"",
"txtUsuId",
".",
"setText",
"(",
"null",
")",
";",
"txtUsuNome",
".",
"setText",
"(",
"null",
")",
";",
"txtUsuFone",
".",
"setText",
"(",
"null",
")",
";",
"txtUsuLogin",
".",
"setText",
"(",
"null",
")",
";",
"txtUsuSenha",
".",
"setText",
"(",
"null",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"JOptionPane",
".",
"showMessageDialog",
"(",
"null",
",",
"e",
")",
";",
"}",
"}"
] | [
61,
4
] | [
94,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
TurmaController. | null | Remocao do Department | Remocao do Department | private void removeEntity(Turma obj) {
Optional<ButtonType> result = Alerts.showConfirmation("Confirmation", "Are you sure that you want remove?");
if (result.get() == ButtonType.OK) {
if (service == null) {
throw new IllegalStateException("Service was null");
}
try {
service.remove(obj);
updateTableView();
} catch (db.DbIntegrityException e) {
e.printStackTrace();
Alerts.showAlert("Error removing object", null, e.getMessage(), Alert.AlertType.ERROR);
}
}
} | [
"private",
"void",
"removeEntity",
"(",
"Turma",
"obj",
")",
"{",
"Optional",
"<",
"ButtonType",
">",
"result",
"=",
"Alerts",
".",
"showConfirmation",
"(",
"\"Confirmation\"",
",",
"\"Are you sure that you want remove?\"",
")",
";",
"if",
"(",
"result",
".",
"get",
"(",
")",
"==",
"ButtonType",
".",
"OK",
")",
"{",
"if",
"(",
"service",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Service was null\"",
")",
";",
"}",
"try",
"{",
"service",
".",
"remove",
"(",
"obj",
")",
";",
"updateTableView",
"(",
")",
";",
"}",
"catch",
"(",
"db",
".",
"DbIntegrityException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"Alerts",
".",
"showAlert",
"(",
"\"Error removing object\"",
",",
"null",
",",
"e",
".",
"getMessage",
"(",
")",
",",
"Alert",
".",
"AlertType",
".",
"ERROR",
")",
";",
"}",
"}",
"}"
] | [
176,
4
] | [
191,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
TubaraoMadara. | null | A funcao calcula o angulo entre 2 pontos: | A funcao calcula o angulo entre 2 pontos: | public double calcangulo(Point2D p, Point2D q) {
return Math.atan2(q.getX() - p.getX(), q.getY() - p.getY());
} | [
"public",
"double",
"calcangulo",
"(",
"Point2D",
"p",
",",
"Point2D",
"q",
")",
"{",
"return",
"Math",
".",
"atan2",
"(",
"q",
".",
"getX",
"(",
")",
"-",
"p",
".",
"getX",
"(",
")",
",",
"q",
".",
"getY",
"(",
")",
"-",
"p",
".",
"getY",
"(",
")",
")",
";",
"}"
] | [
235,
4
] | [
237,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Jogo. | null | método privado e interno para inicialização dos atributos do Jogo: | método privado e interno para inicialização dos atributos do Jogo: | private void inicializaAtributos() {
this.setSituacao(1); //define a situação do jogo como "início"
this.setJogada(0); //define a "vez" como do jogador 1
this.jogadores = new Jogador[2]; //inicializa o vetor de jogadores
} | [
"private",
"void",
"inicializaAtributos",
"(",
")",
"{",
"this",
".",
"setSituacao",
"(",
"1",
")",
";",
"//define a situação do jogo como \"início\"",
"this",
".",
"setJogada",
"(",
"0",
")",
";",
"//define a \"vez\" como do jogador 1",
"this",
".",
"jogadores",
"=",
"new",
"Jogador",
"[",
"2",
"]",
";",
"//inicializa o vetor de jogadores",
"}"
] | [
33,
4
] | [
37,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Operacoes. | null | O codigo do time eh passado como parametro | O codigo do time eh passado como parametro | public void excluir(int codigo){
//Realiza a conexao com o banco de dados
Conexao conn = new Conexao();
Connection cntn = conn.getConnection();
//Comando SQL para exclusão de um time na tabela baseado no id do time
String sql = "delete from times_de_futebol where id_time=?";
try {
//Uso do PreparedStatement para realizar a exclusao
PreparedStatement ps = cntn.prepareStatement(sql);
ps.setInt(1, codigo);
//Executa a operacao
ps.executeUpdate();
////Exibe uma mensagem na tela para informar que a exclusao foi realizada
JOptionPane.showMessageDialog(null, "excluído com sucesso");
//PreparedStatement encerrado
ps.close();
//Conexao com o o banco encerrada
cntn.close();
//Captura da excecao
} catch (SQLException ex) {
//Exibe uma mensagem na tela para informar que ocorreu um erro ao alterar
JOptionPane.showMessageDialog(null, "problemas para excluir " + ex);
}
} | [
"public",
"void",
"excluir",
"(",
"int",
"codigo",
")",
"{",
"//Realiza a conexao com o banco de dados",
"Conexao",
"conn",
"=",
"new",
"Conexao",
"(",
")",
";",
"Connection",
"cntn",
"=",
"conn",
".",
"getConnection",
"(",
")",
";",
"//Comando SQL para exclusão de um time na tabela baseado no id do time",
"String",
"sql",
"=",
"\"delete from times_de_futebol where id_time=?\"",
";",
"try",
"{",
"//Uso do PreparedStatement para realizar a exclusao",
"PreparedStatement",
"ps",
"=",
"cntn",
".",
"prepareStatement",
"(",
"sql",
")",
";",
"ps",
".",
"setInt",
"(",
"1",
",",
"codigo",
")",
";",
"//Executa a operacao",
"ps",
".",
"executeUpdate",
"(",
")",
";",
"////Exibe uma mensagem na tela para informar que a exclusao foi realizada",
"JOptionPane",
".",
"showMessageDialog",
"(",
"null",
",",
"\"excluído com sucesso\")",
";",
"",
"//PreparedStatement encerrado",
"ps",
".",
"close",
"(",
")",
";",
"//Conexao com o o banco encerrada",
"cntn",
".",
"close",
"(",
")",
";",
"//Captura da excecao",
"}",
"catch",
"(",
"SQLException",
"ex",
")",
"{",
"//Exibe uma mensagem na tela para informar que ocorreu um erro ao alterar",
"JOptionPane",
".",
"showMessageDialog",
"(",
"null",
",",
"\"problemas para excluir \"",
"+",
"ex",
")",
";",
"}",
"}"
] | [
150,
4
] | [
175,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Filme. | null | Reescrevendo toString | Reescrevendo toString | @Override
public String toString() {
return this.nome + " - " + this.ano;
} | [
"@",
"Override",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"this",
".",
"nome",
"+",
"\" - \"",
"+",
"this",
".",
"ano",
";",
"}"
] | [
32,
4
] | [
35,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | False | true | method_declaration |
|
QuickSort. | null | ===== Métodos de Ordenação por Satelite ===== // | ===== Métodos de Ordenação por Satelite ===== // | public void quickSateliteCres() {
quickSateliteCres(0, lista.size() - 1);
} | [
"public",
"void",
"quickSateliteCres",
"(",
")",
"{",
"quickSateliteCres",
"(",
"0",
",",
"lista",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"}"
] | [
123,
4
] | [
125,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
aula03ex. | null | 3. Criar uma função que devolve verdadeiro se o número dado for par.(Ex:isEven(6)->true) | 3. Criar uma função que devolve verdadeiro se o número dado for par.(Ex:isEven(6)->true) | public static boolean isEven(int a) {
return a % 2 == 0;
} | [
"public",
"static",
"boolean",
"isEven",
"(",
"int",
"a",
")",
"{",
"return",
"a",
"%",
"2",
"==",
"0",
";",
"}"
] | [
62,
4
] | [
64,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
ArtistaController. | null | /* Este método altera um Artista esperando receber dois parâmetros no Request:
artista: objeto Artista no formato de String JSON
artistaImagem: File
| /* Este método altera um Artista esperando receber dois parâmetros no Request:
artista: objeto Artista no formato de String JSON
artistaImagem: File
| @RequestMapping(method = RequestMethod.POST)
public ResponseEntity<Artista> insert(@Valid @RequestBody Artista obj, BindingResult br) {
if (br.hasErrors())
throw new ConstraintException(br.getAllErrors().get(0).getDefaultMessage());
obj = service.insert(obj);
return ResponseEntity.ok().body(obj);
} | [
"@",
"RequestMapping",
"(",
"method",
"=",
"RequestMethod",
".",
"POST",
")",
"public",
"ResponseEntity",
"<",
"Artista",
">",
"insert",
"(",
"@",
"Valid",
"@",
"RequestBody",
"Artista",
"obj",
",",
"BindingResult",
"br",
")",
"{",
"if",
"(",
"br",
".",
"hasErrors",
"(",
")",
")",
"throw",
"new",
"ConstraintException",
"(",
"br",
".",
"getAllErrors",
"(",
")",
".",
"get",
"(",
"0",
")",
".",
"getDefaultMessage",
"(",
")",
")",
";",
"obj",
"=",
"service",
".",
"insert",
"(",
"obj",
")",
";",
"return",
"ResponseEntity",
".",
"ok",
"(",
")",
".",
"body",
"(",
"obj",
")",
";",
"}"
] | [
85,
4
] | [
91,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Room. | null | Remover aluno de uma sala | Remover aluno de uma sala | public void removeAluno(Student aluno){
// Obtenho o numero do aluno a remover
int numAluno = aluno.getNumAluno();
// Percorro a array da sala que guarda os alunos (listaAlunos)
for (int i = 0; i<alunosActuais; i++){
// Se o num aluno a remover for igual ao numero aluno da posiçao actual da lista, remove esse aluno
if (numAluno == listaAlunos[i].getNumAluno()){
listaAlunos[i] = null;
}
}
} | [
"public",
"void",
"removeAluno",
"(",
"Student",
"aluno",
")",
"{",
"// Obtenho o numero do aluno a remover",
"int",
"numAluno",
"=",
"aluno",
".",
"getNumAluno",
"(",
")",
";",
"// Percorro a array da sala que guarda os alunos (listaAlunos)",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"alunosActuais",
";",
"i",
"++",
")",
"{",
"// Se o num aluno a remover for igual ao numero aluno da posiçao actual da lista, remove esse aluno",
"if",
"(",
"numAluno",
"==",
"listaAlunos",
"[",
"i",
"]",
".",
"getNumAluno",
"(",
")",
")",
"{",
"listaAlunos",
"[",
"i",
"]",
"=",
"null",
";",
"}",
"}",
"}"
] | [
66,
4
] | [
76,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
TurmaFormController. | null | Carrega os objetos associados, criar a lista e carrega a Turma | Carrega os objetos associados, criar a lista e carrega a Turma | public void loadAssociatedObjects() {
if (professorService == null) {
throw new IllegalStateException("ProfessorService was null");
}
List<Professor> list = professorService.findyAll();
obsList = FXCollections.observableArrayList(list);//Joga a lista de Department no observableList
comboBoxProfessor.setItems(obsList);
} | [
"public",
"void",
"loadAssociatedObjects",
"(",
")",
"{",
"if",
"(",
"professorService",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"ProfessorService was null\"",
")",
";",
"}",
"List",
"<",
"Professor",
">",
"list",
"=",
"professorService",
".",
"findyAll",
"(",
")",
";",
"obsList",
"=",
"FXCollections",
".",
"observableArrayList",
"(",
"list",
")",
";",
"//Joga a lista de Department no observableList",
"comboBoxProfessor",
".",
"setItems",
"(",
"obsList",
")",
";",
"}"
] | [
209,
4
] | [
216,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
SalaDeAula. | null | Métodos static não podem acessar atributos que pertencem a instância/objeto. | Métodos static não podem acessar atributos que pertencem a instância/objeto. | static void ensinar() {
System.out.println(professor + " ensinando.");
} | [
"static",
"void",
"ensinar",
"(",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"professor",
"+",
"\" ensinando.\"",
")",
";",
"}"
] | [
14,
4
] | [
16,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
Robo. | null | Esse método é chamado quando o robo entra em contato com o heroi | Esse método é chamado quando o robo entra em contato com o heroi | @Override
public boolean contactHero(Animado heroi, ArrayList<Elemento> listaElementos) {
int vidasHeroi = Desenhador.getTelaDoJogo().getVidasHeroi();
//Diminui o numero de vidas do heroi se elas foram > 0, caso contrário chama o game over
if(vidasHeroi > 0) {
listaElementos = Desenhador.getTelaDoJogo().setFase();
Desenhador.getTelaDoJogo().setVidasHeroi(vidasHeroi - 1);
}
else {
System.out.println("Game over...");
System.exit(0);
}
return true;
} | [
"@",
"Override",
"public",
"boolean",
"contactHero",
"(",
"Animado",
"heroi",
",",
"ArrayList",
"<",
"Elemento",
">",
"listaElementos",
")",
"{",
"int",
"vidasHeroi",
"=",
"Desenhador",
".",
"getTelaDoJogo",
"(",
")",
".",
"getVidasHeroi",
"(",
")",
";",
"//Diminui o numero de vidas do heroi se elas foram > 0, caso contrário chama o game over",
"if",
"(",
"vidasHeroi",
">",
"0",
")",
"{",
"listaElementos",
"=",
"Desenhador",
".",
"getTelaDoJogo",
"(",
")",
".",
"setFase",
"(",
")",
";",
"Desenhador",
".",
"getTelaDoJogo",
"(",
")",
".",
"setVidasHeroi",
"(",
"vidasHeroi",
"-",
"1",
")",
";",
"}",
"else",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Game over...\"",
")",
";",
"System",
".",
"exit",
"(",
"0",
")",
";",
"}",
"return",
"true",
";",
"}"
] | [
67,
1
] | [
81,
5
] | null | java | pt | ['pt', 'pt', 'pt'] | True | true | method_declaration |
|
BuscaUsuarioController. | null | Esta método é para remover um usuário. | Esta método é para remover um usuário. | @SuppressWarnings("unchecked")
@GetMapping("/remover/{id}")
public String remover(
@PathVariable("id") Integer idUsuario, HttpSession sessao, RedirectAttributes attr
) {
usuarioRepository.deleteById(idUsuario);
attr.addFlashAttribute("msgSucesso", "Removido com sucesso!");
return "redirect:/usuarios/buscar";
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"GetMapping",
"(",
"\"/remover/{id}\"",
")",
"public",
"String",
"remover",
"(",
"@",
"PathVariable",
"(",
"\"id\"",
")",
"Integer",
"idUsuario",
",",
"HttpSession",
"sessao",
",",
"RedirectAttributes",
"attr",
")",
"{",
"usuarioRepository",
".",
"deleteById",
"(",
"idUsuario",
")",
";",
"attr",
".",
"addFlashAttribute",
"(",
"\"msgSucesso\"",
",",
"\"Removido com sucesso!\"",
")",
";",
"return",
"\"redirect:/usuarios/buscar\"",
";",
"}"
] | [
54,
2
] | [
64,
3
] | 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.