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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
JwtUtil. | null | Método para validar el token enviado por el cliente | Método para validar el token enviado por el cliente | static Authentication getAuthentication(HttpServletRequest request) {
// Obtenemos el token que viene en el encabezado de la peticion
String token = request.getHeader("Authorization");
// si hay un token presente, entonces lo validamos
if (token != null) {
String user = Jwts.parser()
.setSigningKey("P@tit0")
.parseClaimsJws(token.replace("Bearer", "")) //este metodo es el que valida
.getBody()
.getSubject();
// Recordamos que para las demás peticiones que no sean /login
// no requerimos una autenticacion por username/password
// por este motivo podemos devolver un UsernamePasswordAuthenticationToken sin password
return user != null ?
new UsernamePasswordAuthenticationToken(user, null, emptyList()) :
null;
}
return null;
} | [
"static",
"Authentication",
"getAuthentication",
"(",
"HttpServletRequest",
"request",
")",
"{",
"// Obtenemos el token que viene en el encabezado de la peticion",
"String",
"token",
"=",
"request",
".",
"getHeader",
"(",
"\"Authorization\"",
")",
";",
"// si hay un token presente, entonces lo validamos",
"if",
"(",
"token",
"!=",
"null",
")",
"{",
"String",
"user",
"=",
"Jwts",
".",
"parser",
"(",
")",
".",
"setSigningKey",
"(",
"\"P@tit0\"",
")",
".",
"parseClaimsJws",
"(",
"token",
".",
"replace",
"(",
"\"Bearer\"",
",",
"\"\"",
")",
")",
"//este metodo es el que valida",
".",
"getBody",
"(",
")",
".",
"getSubject",
"(",
")",
";",
"// Recordamos que para las demás peticiones que no sean /login",
"// no requerimos una autenticacion por username/password",
"// por este motivo podemos devolver un UsernamePasswordAuthenticationToken sin password",
"return",
"user",
"!=",
"null",
"?",
"new",
"UsernamePasswordAuthenticationToken",
"(",
"user",
",",
"null",
",",
"emptyList",
"(",
")",
")",
":",
"null",
";",
"}",
"return",
"null",
";",
"}"
] | [
45,
4
] | [
66,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
GXWebReport. | null | M�todos para la implementaci�n de reportes din�micos | M�todos para la implementaci�n de reportes din�micos | protected void loadReportMetadata(String name)
{
reportMetadata = new GXReportMetadata(name, reportHandler);
reportMetadata.load();
} | [
"protected",
"void",
"loadReportMetadata",
"(",
"String",
"name",
")",
"{",
"reportMetadata",
"=",
"new",
"GXReportMetadata",
"(",
"name",
",",
"reportHandler",
")",
";",
"reportMetadata",
".",
"load",
"(",
")",
";",
"}"
] | [
126,
1
] | [
130,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
JsonReader. | null | Extrae los países en una lista de String | Extrae los países en una lista de String | public List<String> extraePais(JSONArray listaAutores){
List<String> listaPaises = new ArrayList<String>();
Iterator<JSONObject> iterator = listaAutores.iterator();
while (iterator.hasNext()) {
JSONObject it = iterator.next();
JSONObject aff = (JSONObject) it.get("affiliation");
JSONObject loc = (JSONObject) aff.get("location");
if(loc != null){
String pais = (String) loc.get("country");
if(pais != null){
List<String> lista = removeDuplicates(pais);
for (String npais : lista)
if(!npais.equals(""))
listaPaises.add(npais);
}
}
}
//Elimina los países repetidos (comentar si se quieren aumentar sus pesos)
//listaPaises = listaPaises.stream().distinct().collect(Collectors.toList());
return listaPaises;
} | [
"public",
"List",
"<",
"String",
">",
"extraePais",
"(",
"JSONArray",
"listaAutores",
")",
"{",
"List",
"<",
"String",
">",
"listaPaises",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"Iterator",
"<",
"JSONObject",
">",
"iterator",
"=",
"listaAutores",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"JSONObject",
"it",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"JSONObject",
"aff",
"=",
"(",
"JSONObject",
")",
"it",
".",
"get",
"(",
"\"affiliation\"",
")",
";",
"JSONObject",
"loc",
"=",
"(",
"JSONObject",
")",
"aff",
".",
"get",
"(",
"\"location\"",
")",
";",
"if",
"(",
"loc",
"!=",
"null",
")",
"{",
"String",
"pais",
"=",
"(",
"String",
")",
"loc",
".",
"get",
"(",
"\"country\"",
")",
";",
"if",
"(",
"pais",
"!=",
"null",
")",
"{",
"List",
"<",
"String",
">",
"lista",
"=",
"removeDuplicates",
"(",
"pais",
")",
";",
"for",
"(",
"String",
"npais",
":",
"lista",
")",
"if",
"(",
"!",
"npais",
".",
"equals",
"(",
"\"\"",
")",
")",
"listaPaises",
".",
"add",
"(",
"npais",
")",
";",
"}",
"}",
"}",
"//Elimina los países repetidos (comentar si se quieren aumentar sus pesos)",
"//listaPaises = listaPaises.stream().distinct().collect(Collectors.toList());",
"return",
"listaPaises",
";",
"}"
] | [
157,
2
] | [
177,
3
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
FormQuimica. | null | metodos get y set | metodos get y set | public String getNombre() {
return nombre;
} | [
"public",
"String",
"getNombre",
"(",
")",
"{",
"return",
"nombre",
";",
"}"
] | [
24,
1
] | [
26,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
BaseMockControllerTest. | null | Metodos EstadisticoService por defecto | Metodos EstadisticoService por defecto | protected void givenEstadisticoService(Estadistico estadistico) {
given(this.estadisticoService.findById(any(Integer.class))).willReturn(Optional.of(estadistico));
given(this.estadisticoService.findByFirstName(any(String.class))).willReturn(Lists.newArrayList(estadistico));
} | [
"protected",
"void",
"givenEstadisticoService",
"(",
"Estadistico",
"estadistico",
")",
"{",
"given",
"(",
"this",
".",
"estadisticoService",
".",
"findById",
"(",
"any",
"(",
"Integer",
".",
"class",
")",
")",
")",
".",
"willReturn",
"(",
"Optional",
".",
"of",
"(",
"estadistico",
")",
")",
";",
"given",
"(",
"this",
".",
"estadisticoService",
".",
"findByFirstName",
"(",
"any",
"(",
"String",
".",
"class",
")",
")",
")",
".",
"willReturn",
"(",
"Lists",
".",
"newArrayList",
"(",
"estadistico",
")",
")",
";",
"}"
] | [
384,
1
] | [
387,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Instruction. | null | Método usado para la copia de instrucciones (InstructionCopier) | Método usado para la copia de instrucciones (InstructionCopier) | public void setRAW(int RAW) {
this.RAW = RAW;
} | [
"public",
"void",
"setRAW",
"(",
"int",
"RAW",
")",
"{",
"this",
".",
"RAW",
"=",
"RAW",
";",
"}"
] | [
353,
4
] | [
355,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Ejercicio3. | null | Reportar el resultado | Reportar el resultado | public static void reportarResultado(int doble, int triple){
System.out.println("El doble es: "+doble+" El triple es: "+triple);
} | [
"public",
"static",
"void",
"reportarResultado",
"(",
"int",
"doble",
",",
"int",
"triple",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"El doble es: \"",
"+",
"doble",
"+",
"\" El triple es: \"",
"+",
"triple",
")",
";",
"}"
] | [
47,
4
] | [
49,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
VentaProyecto. | null | Firma con los parámetros especificados | Firma con los parámetros especificados | public String compararInversion(int pTiempo, double pMonto, double pInteres){
//Cargar parámetros en atributos
this.tiempo = pTiempo;
this.monto = pMonto;
this.interes = pInteres;
//Aprovechar el comportamiento de comparación sobre atributos
return this.compararInversion();
} | [
"public",
"String",
"compararInversion",
"(",
"int",
"pTiempo",
",",
"double",
"pMonto",
",",
"double",
"pInteres",
")",
"{",
"//Cargar parámetros en atributos",
"this",
".",
"tiempo",
"=",
"pTiempo",
";",
"this",
".",
"monto",
"=",
"pMonto",
";",
"this",
".",
"interes",
"=",
"pInteres",
";",
"//Aprovechar el comportamiento de comparación sobre atributos",
"return",
"this",
".",
"compararInversion",
"(",
")",
";",
"}"
] | [
48,
4
] | [
58,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
EstRepetitive. | null | /* Estos son metodos | /* Estos son metodos | public static void saludo() {
System.out.print("Ingrese su nombre:");
String nombre=objTeclado.next();//Leer nombre
System.out.println("Hola: "+nombre+" Como estas?");
System.out.println("Suma:"+ (a) );
} | [
"public",
"static",
"void",
"saludo",
"(",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"Ingrese su nombre:\"",
")",
";",
"String",
"nombre",
"=",
"objTeclado",
".",
"next",
"(",
")",
";",
"//Leer nombre",
"System",
".",
"out",
".",
"println",
"(",
"\"Hola: \"",
"+",
"nombre",
"+",
"\" Como estas?\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Suma:\"",
"+",
"(",
"a",
")",
")",
";",
"}"
] | [
15,
4
] | [
20,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ControladoraHotel. | null | metodo para crear empleados y el usuario | metodo para crear empleados y el usuario | public void crearEmpleadoUsuario(String nombre, String apellido, String dni, Date fechaNac, String cargo, String direccion, String usuario, String contrasenia) {
//instanciamos las clases-entidad que necesitamos
Empleado empleado = new Empleado();
Usuario user = new Usuario(usuario, contrasenia);
empleado.setUsuario(user);
empleado.setNombre(nombre);
empleado.setApellido(apellido);
empleado.setDni(dni);
empleado.setFecha_nac(fechaNac);
empleado.setCargo(cargo);
empleado.setDireccion(direccion);
controlPersistencia.crearEmpleadoUsuario(empleado);
} | [
"public",
"void",
"crearEmpleadoUsuario",
"(",
"String",
"nombre",
",",
"String",
"apellido",
",",
"String",
"dni",
",",
"Date",
"fechaNac",
",",
"String",
"cargo",
",",
"String",
"direccion",
",",
"String",
"usuario",
",",
"String",
"contrasenia",
")",
"{",
"//instanciamos las clases-entidad que necesitamos",
"Empleado",
"empleado",
"=",
"new",
"Empleado",
"(",
")",
";",
"Usuario",
"user",
"=",
"new",
"Usuario",
"(",
"usuario",
",",
"contrasenia",
")",
";",
"empleado",
".",
"setUsuario",
"(",
"user",
")",
";",
"empleado",
".",
"setNombre",
"(",
"nombre",
")",
";",
"empleado",
".",
"setApellido",
"(",
"apellido",
")",
";",
"empleado",
".",
"setDni",
"(",
"dni",
")",
";",
"empleado",
".",
"setFecha_nac",
"(",
"fechaNac",
")",
";",
"empleado",
".",
"setCargo",
"(",
"cargo",
")",
";",
"empleado",
".",
"setDireccion",
"(",
"direccion",
")",
";",
"controlPersistencia",
".",
"crearEmpleadoUsuario",
"(",
"empleado",
")",
";",
"}"
] | [
123,
4
] | [
139,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
IncomingCryptoRegistry. | null | Da los Specialist de las que están en TBN y SN | Da los Specialist de las que están en TBN y SN | public Set<SpecialistAndCryptoStatus> getSpecialists() throws InvalidParameterException {//throws CantReadSpecialistsException
try {
DatabaseTable registryTable = this.database.getTable(IncomingCryptoDataBaseConstants.INCOMING_CRYPTO_REGISTRY_TABLE_NAME);
DatabaseTableRecord r;
List<Transaction<CryptoTransaction>> transactionList = getResponsibleTransactionsPendingAction();
Set<SpecialistAndCryptoStatus> specialistAndCryptoStatuses = new HashSet<>();
for(Transaction<CryptoTransaction> transaction : transactionList) {
// We look for the record to update
registryTable.setUUIDFilter(IncomingCryptoDataBaseConstants.INCOMING_CRYPTO_REGISTRY_TABLE_ID_COLUMN.columnName, transaction.getTransactionID(), DatabaseFilterType.EQUAL);
registryTable.loadToMemory();
List<DatabaseTableRecord> records = registryTable.getRecords();
if (records.size() != 1) {
String message = "Unexpected number of transactions found";
String context = "The number of transactions found was: "+records.size()+ " and we expected 1";
FermatException e = new ExpectedTransactionNotFoundException(message,null,context,"");
errorManager.reportUnexpectedPluginException(Plugins.BITDUBAI_INCOMING_CRYPTO_TRANSACTION, UnexpectedPluginExceptionSeverity.DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN, e);
//TODO: MANAGE EXCEPTION
} else {
r = records.get(0);
Specialist s = Specialist.getByCode(r.getStringValue(IncomingCryptoDataBaseConstants.INCOMING_CRYPTO_REGISTRY_TABLE_SPECIALIST_COLUMN.columnName));
CryptoStatus c = CryptoStatus.getByCode(r.getStringValue(IncomingCryptoDataBaseConstants.INCOMING_CRYPTO_REGISTRY_TABLE_CRYPTO_STATUS_COLUMN.columnName));
specialistAndCryptoStatuses.add(new SpecialistAndCryptoStatus(s,c));
}
registryTable.clearAllFilters();
}
return specialistAndCryptoStatuses;
} catch (CantLoadTableToMemoryException cantLoadTableToMemory) {
errorManager.reportUnexpectedPluginException(Plugins.BITDUBAI_INCOMING_CRYPTO_TRANSACTION, UnexpectedPluginExceptionSeverity.DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN, cantLoadTableToMemory);
//TODO: MANAGE EXCEPTION
} catch (Exception exception) {
errorManager.reportUnexpectedPluginException(Plugins.BITDUBAI_INCOMING_CRYPTO_TRANSACTION, UnexpectedPluginExceptionSeverity.DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN, exception);
}
//TODO METODO CON RETURN NULL - OJO: solo INFORMATIVO de ayuda VISUAL para DEBUG - Eliminar si molesta
return null;
} | [
"public",
"Set",
"<",
"SpecialistAndCryptoStatus",
">",
"getSpecialists",
"(",
")",
"throws",
"InvalidParameterException",
"{",
"//throws CantReadSpecialistsException",
"try",
"{",
"DatabaseTable",
"registryTable",
"=",
"this",
".",
"database",
".",
"getTable",
"(",
"IncomingCryptoDataBaseConstants",
".",
"INCOMING_CRYPTO_REGISTRY_TABLE_NAME",
")",
";",
"DatabaseTableRecord",
"r",
";",
"List",
"<",
"Transaction",
"<",
"CryptoTransaction",
">",
">",
"transactionList",
"=",
"getResponsibleTransactionsPendingAction",
"(",
")",
";",
"Set",
"<",
"SpecialistAndCryptoStatus",
">",
"specialistAndCryptoStatuses",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"for",
"(",
"Transaction",
"<",
"CryptoTransaction",
">",
"transaction",
":",
"transactionList",
")",
"{",
"// We look for the record to update",
"registryTable",
".",
"setUUIDFilter",
"(",
"IncomingCryptoDataBaseConstants",
".",
"INCOMING_CRYPTO_REGISTRY_TABLE_ID_COLUMN",
".",
"columnName",
",",
"transaction",
".",
"getTransactionID",
"(",
")",
",",
"DatabaseFilterType",
".",
"EQUAL",
")",
";",
"registryTable",
".",
"loadToMemory",
"(",
")",
";",
"List",
"<",
"DatabaseTableRecord",
">",
"records",
"=",
"registryTable",
".",
"getRecords",
"(",
")",
";",
"if",
"(",
"records",
".",
"size",
"(",
")",
"!=",
"1",
")",
"{",
"String",
"message",
"=",
"\"Unexpected number of transactions found\"",
";",
"String",
"context",
"=",
"\"The number of transactions found was: \"",
"+",
"records",
".",
"size",
"(",
")",
"+",
"\" and we expected 1\"",
";",
"FermatException",
"e",
"=",
"new",
"ExpectedTransactionNotFoundException",
"(",
"message",
",",
"null",
",",
"context",
",",
"\"\"",
")",
";",
"errorManager",
".",
"reportUnexpectedPluginException",
"(",
"Plugins",
".",
"BITDUBAI_INCOMING_CRYPTO_TRANSACTION",
",",
"UnexpectedPluginExceptionSeverity",
".",
"DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN",
",",
"e",
")",
";",
"//TODO: MANAGE EXCEPTION",
"}",
"else",
"{",
"r",
"=",
"records",
".",
"get",
"(",
"0",
")",
";",
"Specialist",
"s",
"=",
"Specialist",
".",
"getByCode",
"(",
"r",
".",
"getStringValue",
"(",
"IncomingCryptoDataBaseConstants",
".",
"INCOMING_CRYPTO_REGISTRY_TABLE_SPECIALIST_COLUMN",
".",
"columnName",
")",
")",
";",
"CryptoStatus",
"c",
"=",
"CryptoStatus",
".",
"getByCode",
"(",
"r",
".",
"getStringValue",
"(",
"IncomingCryptoDataBaseConstants",
".",
"INCOMING_CRYPTO_REGISTRY_TABLE_CRYPTO_STATUS_COLUMN",
".",
"columnName",
")",
")",
";",
"specialistAndCryptoStatuses",
".",
"add",
"(",
"new",
"SpecialistAndCryptoStatus",
"(",
"s",
",",
"c",
")",
")",
";",
"}",
"registryTable",
".",
"clearAllFilters",
"(",
")",
";",
"}",
"return",
"specialistAndCryptoStatuses",
";",
"}",
"catch",
"(",
"CantLoadTableToMemoryException",
"cantLoadTableToMemory",
")",
"{",
"errorManager",
".",
"reportUnexpectedPluginException",
"(",
"Plugins",
".",
"BITDUBAI_INCOMING_CRYPTO_TRANSACTION",
",",
"UnexpectedPluginExceptionSeverity",
".",
"DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN",
",",
"cantLoadTableToMemory",
")",
";",
"//TODO: MANAGE EXCEPTION",
"}",
"catch",
"(",
"Exception",
"exception",
")",
"{",
"errorManager",
".",
"reportUnexpectedPluginException",
"(",
"Plugins",
".",
"BITDUBAI_INCOMING_CRYPTO_TRANSACTION",
",",
"UnexpectedPluginExceptionSeverity",
".",
"DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN",
",",
"exception",
")",
";",
"}",
"//TODO METODO CON RETURN NULL - OJO: solo INFORMATIVO de ayuda VISUAL para DEBUG - Eliminar si molesta",
"return",
"null",
";",
"}"
] | [
469,
4
] | [
515,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CrearCuenta. | null | Método para cuando se presiona CampoUsuario con el mouse | Método para cuando se presiona CampoUsuario con el mouse | private void CampoNombreUsuarioMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_CampoNombreUsuarioMousePressed
// Obtener contenido
String Contenido = this.CampoNombreUsuario.getText();
Color ColorActual = this.CampoNombreUsuario.getForeground();
Color ColorEscrito = new Color(51, 51, 51);
// Verifica si no tiene nada seteado aún
if(Contenido.equals("Nombre de Usuario"))
{
// Elimina contenido
this.CampoNombreUsuario.setText("");
}
if(ColorActual != ColorEscrito)
{
this.CampoNombreUsuario.setForeground(ColorEscrito);
}
} | [
"private",
"void",
"CampoNombreUsuarioMousePressed",
"(",
"java",
".",
"awt",
".",
"event",
".",
"MouseEvent",
"evt",
")",
"{",
"//GEN-FIRST:event_CampoNombreUsuarioMousePressed",
"// Obtener contenido",
"String",
"Contenido",
"=",
"this",
".",
"CampoNombreUsuario",
".",
"getText",
"(",
")",
";",
"Color",
"ColorActual",
"=",
"this",
".",
"CampoNombreUsuario",
".",
"getForeground",
"(",
")",
";",
"Color",
"ColorEscrito",
"=",
"new",
"Color",
"(",
"51",
",",
"51",
",",
"51",
")",
";",
"// Verifica si no tiene nada seteado aún",
"if",
"(",
"Contenido",
".",
"equals",
"(",
"\"Nombre de Usuario\"",
")",
")",
"{",
"// Elimina contenido",
"this",
".",
"CampoNombreUsuario",
".",
"setText",
"(",
"\"\"",
")",
";",
"}",
"if",
"(",
"ColorActual",
"!=",
"ColorEscrito",
")",
"{",
"this",
".",
"CampoNombreUsuario",
".",
"setForeground",
"(",
"ColorEscrito",
")",
";",
"}",
"}"
] | [
828,
4
] | [
843,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
VideosController. | null | metodos propios -------------------------------------------------------- | metodos propios -------------------------------------------------------- | @CrossOrigin(origins = "http://localhost:4200")
@GetMapping("/getVideosUsuario/{idPubl}")
public ResponseEntity<List<Videos>> getVideosUsuario(@PathVariable Integer idUsu) {
ArrayList<Videos> listaVideos = new ArrayList<>();
listaVideos = (ArrayList<Videos>) service.findVideosUsuario(idUsu);
listaVideos = quitarListas(listaVideos);
return new ResponseEntity<List<Videos>>(listaVideos, HttpStatus.OK);
} | [
"@",
"CrossOrigin",
"(",
"origins",
"=",
"\"http://localhost:4200\"",
")",
"@",
"GetMapping",
"(",
"\"/getVideosUsuario/{idPubl}\"",
")",
"public",
"ResponseEntity",
"<",
"List",
"<",
"Videos",
">",
">",
"getVideosUsuario",
"(",
"@",
"PathVariable",
"Integer",
"idUsu",
")",
"{",
"ArrayList",
"<",
"Videos",
">",
"listaVideos",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"listaVideos",
"=",
"(",
"ArrayList",
"<",
"Videos",
">",
")",
"service",
".",
"findVideosUsuario",
"(",
"idUsu",
")",
";",
"listaVideos",
"=",
"quitarListas",
"(",
"listaVideos",
")",
";",
"return",
"new",
"ResponseEntity",
"<",
"List",
"<",
"Videos",
">",
">",
"(",
"listaVideos",
",",
"HttpStatus",
".",
"OK",
")",
";",
"}"
] | [
307,
1
] | [
316,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Startup. | null | Función principal | Función principal | public static void main(String[] args)
{
// Arranque de programa
System.out.println("Iniciando programa...");
System.out.println("Creando ventana Login");
// Obteniendo resoluciónd de pantalla
Dimension TamanoVentana = Toolkit.getDefaultToolkit().getScreenSize();
// Obteniendo Ancho
double Ancho = TamanoVentana.getWidth();
// Obteniendo Altura
double Altura = TamanoVentana.getHeight();
// Instanciar objeto ventana
Ventana TamanoVentanaAAsignar = new Ventana();
// Instanciar objeto Registro
Registro Registros = new Registro();
RegistroCRUD RegistroInicial = new RegistroCRUD();
Registros = RegistroInicial.Cargar();
// Asignamos valores a objeto
TamanoVentanaAAsignar.setMaxAncho(Ancho);
TamanoVentanaAAsignar.setMaxAltura(Altura);
TamanoVentanaAAsignar.setAncho(480);
TamanoVentanaAAsignar.setAltura(600);
System.out.println(RegistroInicial.getRegistroTemp());
System.out.println("Resolución de pantalla - Ancho : " +
TamanoVentanaAAsignar.getMaxAncho() +
" px Alto : " +
TamanoVentanaAAsignar.getMaxAncho() +
" px");
// Crear instancia de ventana Menu
Login VentanaLogin = new Login(TamanoVentanaAAsignar, Registros);
System.out.println("Arrancando ventana Login");
// Activar nueva ventana durante el arranque
VentanaLogin.setVisible(true);
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"// Arranque de programa",
"System",
".",
"out",
".",
"println",
"(",
"\"Iniciando programa...\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Creando ventana Login\"",
")",
";",
"// Obteniendo resoluciónd de pantalla",
"Dimension",
"TamanoVentana",
"=",
"Toolkit",
".",
"getDefaultToolkit",
"(",
")",
".",
"getScreenSize",
"(",
")",
";",
"// Obteniendo Ancho",
"double",
"Ancho",
"=",
"TamanoVentana",
".",
"getWidth",
"(",
")",
";",
"// Obteniendo Altura",
"double",
"Altura",
"=",
"TamanoVentana",
".",
"getHeight",
"(",
")",
";",
"// Instanciar objeto ventana",
"Ventana",
"TamanoVentanaAAsignar",
"=",
"new",
"Ventana",
"(",
")",
";",
"// Instanciar objeto Registro",
"Registro",
"Registros",
"=",
"new",
"Registro",
"(",
")",
";",
"RegistroCRUD",
"RegistroInicial",
"=",
"new",
"RegistroCRUD",
"(",
")",
";",
"Registros",
"=",
"RegistroInicial",
".",
"Cargar",
"(",
")",
";",
"// Asignamos valores a objeto",
"TamanoVentanaAAsignar",
".",
"setMaxAncho",
"(",
"Ancho",
")",
";",
"TamanoVentanaAAsignar",
".",
"setMaxAltura",
"(",
"Altura",
")",
";",
"TamanoVentanaAAsignar",
".",
"setAncho",
"(",
"480",
")",
";",
"TamanoVentanaAAsignar",
".",
"setAltura",
"(",
"600",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"RegistroInicial",
".",
"getRegistroTemp",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Resolución de pantalla - Ancho : \" ",
"",
"TamanoVentanaAAsignar",
".",
"getMaxAncho",
"(",
")",
"+",
"\" px Alto : \"",
"+",
"TamanoVentanaAAsignar",
".",
"getMaxAncho",
"(",
")",
"+",
"\" px\"",
")",
";",
"// Crear instancia de ventana Menu",
"Login",
"VentanaLogin",
"=",
"new",
"Login",
"(",
"TamanoVentanaAAsignar",
",",
"Registros",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Arrancando ventana Login\"",
")",
";",
"// Activar nueva ventana durante el arranque",
"VentanaLogin",
".",
"setVisible",
"(",
"true",
")",
";",
"}"
] | [
50,
4
] | [
84,
5
] | null | java | es | ['es', 'es', 'es'] | False | true | method_declaration |
|
App. | null | en resumen el proxy viene a ser un intermediario entre el cliente y el objeto final o destino | en resumen el proxy viene a ser un intermediario entre el cliente y el objeto final o destino | public static void main(String[] args) {
Cuenta c= new Cuenta(1, "sakuragui", 100);
//se declara la interface y se agrega la clase implementacion CuentaBancoImplB o CuentaBancoImpl
ICuenta cuentaProxy= new CuentaProxy(new CuentaBancoImplB());
cuentaProxy.mostrarSaldo(c);
c=cuentaProxy.depositarDinero(c, 50);
c=cuentaProxy.retirarDinero(c, 20);
cuentaProxy.mostrarSaldo(c);
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"Cuenta",
"c",
"=",
"new",
"Cuenta",
"(",
"1",
",",
"\"sakuragui\"",
",",
"100",
")",
";",
"//se declara la interface y se agrega la clase implementacion CuentaBancoImplB o CuentaBancoImpl\r",
"ICuenta",
"cuentaProxy",
"=",
"new",
"CuentaProxy",
"(",
"new",
"CuentaBancoImplB",
"(",
")",
")",
";",
"cuentaProxy",
".",
"mostrarSaldo",
"(",
"c",
")",
";",
"c",
"=",
"cuentaProxy",
".",
"depositarDinero",
"(",
"c",
",",
"50",
")",
";",
"c",
"=",
"cuentaProxy",
".",
"retirarDinero",
"(",
"c",
",",
"20",
")",
";",
"cuentaProxy",
".",
"mostrarSaldo",
"(",
"c",
")",
";",
"}"
] | [
6,
1
] | [
17,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CommentController. | null | Devuelve todos los comentarios, solo el campo body | Devuelve todos los comentarios, solo el campo body | @GetMapping
public List<String> getBodies() {
return commentService.ListBody();
} | [
"@",
"GetMapping",
"public",
"List",
"<",
"String",
">",
"getBodies",
"(",
")",
"{",
"return",
"commentService",
".",
"ListBody",
"(",
")",
";",
"}"
] | [
31,
4
] | [
34,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Main. | null | llamamos al frame , i.e el inicio del juego | llamamos al frame , i.e el inicio del juego | public static void main(String[] args){
/* Comienza nuestro jego */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new InicioFrame().setVisible(true);
}
});
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"/* Comienza nuestro jego */",
"java",
".",
"awt",
".",
"EventQueue",
".",
"invokeLater",
"(",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"new",
"InicioFrame",
"(",
")",
".",
"setVisible",
"(",
"true",
")",
";",
"}",
"}",
")",
";",
"}"
] | [
19,
4
] | [
26,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Receta. | null | modo = 2 al venir del controlador pasamos este parametro para indicar al metodo del autor que No debe mostrar recetas | modo = 2 al venir del controlador pasamos este parametro para indicar al metodo del autor que No debe mostrar recetas | public String toJson(int modo){
ArrayNode respuesta = Json.newArray();
ObjectNode receta = Json.newObject();
ObjectNode ingredientes = Json.newObject();
receta.set("nombre", Json.toJson(this.nombre));
receta.set("descripcion",Json.toJson(this.descripcion));
if(modo != 3)
{
if(this.autor != null){
receta.set("autor", Json.parse(this.autor.toJson(modo).replace("/\\/g", "")));
}
}
if(this.tipo != null){
receta.set("tipo", Json.parse(this.tipo.toJson().replace("/\\/g", "")));
}
if(this.ingredientes.size() > 0){
for(int i =0;i<this.ingredientes.size();i++)
{
ingredientes.set("ingrediente"+(i+1), Json.parse(this.ingredientes.get(i).toJson().replace("/\\/g", "")));
}
receta.set("ingredientes", ingredientes);
}
respuesta.add(receta);
return respuesta.toString();
} | [
"public",
"String",
"toJson",
"(",
"int",
"modo",
")",
"{",
"ArrayNode",
"respuesta",
"=",
"Json",
".",
"newArray",
"(",
")",
";",
"ObjectNode",
"receta",
"=",
"Json",
".",
"newObject",
"(",
")",
";",
"ObjectNode",
"ingredientes",
"=",
"Json",
".",
"newObject",
"(",
")",
";",
"receta",
".",
"set",
"(",
"\"nombre\"",
",",
"Json",
".",
"toJson",
"(",
"this",
".",
"nombre",
")",
")",
";",
"receta",
".",
"set",
"(",
"\"descripcion\"",
",",
"Json",
".",
"toJson",
"(",
"this",
".",
"descripcion",
")",
")",
";",
"if",
"(",
"modo",
"!=",
"3",
")",
"{",
"if",
"(",
"this",
".",
"autor",
"!=",
"null",
")",
"{",
"receta",
".",
"set",
"(",
"\"autor\"",
",",
"Json",
".",
"parse",
"(",
"this",
".",
"autor",
".",
"toJson",
"(",
"modo",
")",
".",
"replace",
"(",
"\"/\\\\/g\"",
",",
"\"\"",
")",
")",
")",
";",
"}",
"}",
"if",
"(",
"this",
".",
"tipo",
"!=",
"null",
")",
"{",
"receta",
".",
"set",
"(",
"\"tipo\"",
",",
"Json",
".",
"parse",
"(",
"this",
".",
"tipo",
".",
"toJson",
"(",
")",
".",
"replace",
"(",
"\"/\\\\/g\"",
",",
"\"\"",
")",
")",
")",
";",
"}",
"if",
"(",
"this",
".",
"ingredientes",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"ingredientes",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"ingredientes",
".",
"set",
"(",
"\"ingrediente\"",
"+",
"(",
"i",
"+",
"1",
")",
",",
"Json",
".",
"parse",
"(",
"this",
".",
"ingredientes",
".",
"get",
"(",
"i",
")",
".",
"toJson",
"(",
")",
".",
"replace",
"(",
"\"/\\\\/g\"",
",",
"\"\"",
")",
")",
")",
";",
"}",
"receta",
".",
"set",
"(",
"\"ingredientes\"",
",",
"ingredientes",
")",
";",
"}",
"respuesta",
".",
"add",
"(",
"receta",
")",
";",
"return",
"respuesta",
".",
"toString",
"(",
")",
";",
"}"
] | [
125,
4
] | [
154,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
DeviceTest. | null | CP1: Cuando indicamos que un dispositivo se enciende, el dispositivo debe quedar encendido. | CP1: Cuando indicamos que un dispositivo se enciende, el dispositivo debe quedar encendido. | @Test
public void Given_A_Device_When_TurnOn_Method_Is_Called_Then_The_Device_Is_TurnOn() {
//When
device.turnOn();
//Then
assertTrue(device.getTurnedOn());
} | [
"@",
"Test",
"public",
"void",
"Given_A_Device_When_TurnOn_Method_Is_Called_Then_The_Device_Is_TurnOn",
"(",
")",
"{",
"//When",
"device",
".",
"turnOn",
"(",
")",
";",
"//Then",
"assertTrue",
"(",
"device",
".",
"getTurnedOn",
"(",
")",
")",
";",
"}"
] | [
20,
4
] | [
27,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
EmpresaTest. | null | Agregamos soporte para Jornada Parcial (por ahora, sin horas extra) | Agregamos soporte para Jornada Parcial (por ahora, sin horas extra) | @Test
public void laEmpresaDebePoderObtenerElSueldoDeUnPlantaPermanenteTiempoParcialConParejaSinHijesConAntiguedad13SinHorasTrabajadas() {
Empresa miEmpresa = new Empresa();
EmpleadeAbstracte miEmpleadePlantaPermanenteTiempoParcialConParejaSinHijesConAntiguedad13SinHorasTrabajadas = new EmpleadePorHoras(
"Juanito Espuma", Planta.PERMANENTE, CON_PAREJA, SIN_HIJES, ANTIGUEDAD_13, SIN_HORAS_TRABAJADAS);
miEmpresa.contratar(miEmpleadePlantaPermanenteTiempoParcialConParejaSinHijesConAntiguedad13SinHorasTrabajadas);
// El Cálculo para Tiempo Parcial:
// Sueldo Básico' + Salario Familiar + Antigüedad
//
// Sueldo Básico' = min[1000, 1/3 *1000 + (horas_trabajadas * 10)]
// Salario Familar = 200.0 * hije + 100.0 si tiene pareja registrada
// Antigüedad: min [2000, 100 * Año)
// Valor de la Hora Trabajada: 10
// En nuestro caso,
// HT = 0;
// A = 13,
// SF = 100
//
// Luego,
// S = SB' + SF + A
// S = min(SB, 1/3 SB + HT*H) + SF + min(ANTIG_MAX, AA*A)
// S = min(1000, 1/3*1000 + 0*10) + 100 + min(2000, 100*13)
// S = min(1000, 333.333) + 100 + min(2000, 1300)
// S = 333.333 + 100 + 1300
// S = 1733.333
assertEquals(1733.3333333333333, miEmpresa.obtTotalDeSueldos());
} | [
"@",
"Test",
"public",
"void",
"laEmpresaDebePoderObtenerElSueldoDeUnPlantaPermanenteTiempoParcialConParejaSinHijesConAntiguedad13SinHorasTrabajadas",
"(",
")",
"{",
"Empresa",
"miEmpresa",
"=",
"new",
"Empresa",
"(",
")",
";",
"EmpleadeAbstracte",
"miEmpleadePlantaPermanenteTiempoParcialConParejaSinHijesConAntiguedad13SinHorasTrabajadas",
"=",
"new",
"EmpleadePorHoras",
"(",
"\"Juanito Espuma\"",
",",
"Planta",
".",
"PERMANENTE",
",",
"CON_PAREJA",
",",
"SIN_HIJES",
",",
"ANTIGUEDAD_13",
",",
"SIN_HORAS_TRABAJADAS",
")",
";",
"miEmpresa",
".",
"contratar",
"(",
"miEmpleadePlantaPermanenteTiempoParcialConParejaSinHijesConAntiguedad13SinHorasTrabajadas",
")",
";",
"// El Cálculo para Tiempo Parcial:",
"// Sueldo Básico' + Salario Familiar + Antigüedad",
"//",
"// Sueldo Básico' = min[1000, 1/3 *1000 + (horas_trabajadas * 10)]",
"// Salario Familar = 200.0 * hije + 100.0 si tiene pareja registrada",
"// Antigüedad: min [2000, 100 * Año)",
"// Valor de la Hora Trabajada: 10",
"// En nuestro caso,",
"// HT = 0;",
"// A = 13,",
"// SF = 100",
"//",
"// Luego,",
"// S = SB' + SF + A",
"// S = min(SB, 1/3 SB + HT*H) + SF + min(ANTIG_MAX, AA*A)",
"// S = min(1000, 1/3*1000 + 0*10) + 100 + min(2000, 100*13)",
"// S = min(1000, 333.333) + 100 + min(2000, 1300)",
"// S = 333.333 + 100 + 1300",
"// S = 1733.333",
"assertEquals",
"(",
"1733.3333333333333",
",",
"miEmpresa",
".",
"obtTotalDeSueldos",
"(",
")",
")",
";",
"}"
] | [
496,
1
] | [
524,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
MainActivity. | null | metodo para el boton consultar | metodo para el boton consultar | public void Consultar(View Consultar) {
AdminSQLiteOpenHelper admin = new AdminSQLiteOpenHelper(this, "administracion", null, 1);
SQLiteDatabase base = admin.getWritableDatabase();
String codigo = et_codigo.getText().toString();
if (!codigo.isEmpty()) {
Cursor fila = base.rawQuery("select descripcion, precio from articulos where codigo =" + codigo ,null);
if (fila.moveToFirst()) {
et_nombre.setText(fila.getString(0));
et_precio.setText(fila.getString(1));
base.close();
} else {
Toast.makeText(this, "NO EXISTE EL PRODUCTO", Toast.LENGTH_LONG).show();
base.close();
}
} else {
Toast.makeText(this, "INTRODUCIR CODIGO DEL ARTICULO", Toast.LENGTH_LONG).show();
}
} | [
"public",
"void",
"Consultar",
"(",
"View",
"Consultar",
")",
"{",
"AdminSQLiteOpenHelper",
"admin",
"=",
"new",
"AdminSQLiteOpenHelper",
"(",
"this",
",",
"\"administracion\"",
",",
"null",
",",
"1",
")",
";",
"SQLiteDatabase",
"base",
"=",
"admin",
".",
"getWritableDatabase",
"(",
")",
";",
"String",
"codigo",
"=",
"et_codigo",
".",
"getText",
"(",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"!",
"codigo",
".",
"isEmpty",
"(",
")",
")",
"{",
"Cursor",
"fila",
"=",
"base",
".",
"rawQuery",
"(",
"\"select descripcion, precio from articulos where codigo =\"",
"+",
"codigo",
",",
"null",
")",
";",
"if",
"(",
"fila",
".",
"moveToFirst",
"(",
")",
")",
"{",
"et_nombre",
".",
"setText",
"(",
"fila",
".",
"getString",
"(",
"0",
")",
")",
";",
"et_precio",
".",
"setText",
"(",
"fila",
".",
"getString",
"(",
"1",
")",
")",
";",
"base",
".",
"close",
"(",
")",
";",
"}",
"else",
"{",
"Toast",
".",
"makeText",
"(",
"this",
",",
"\"NO EXISTE EL PRODUCTO\"",
",",
"Toast",
".",
"LENGTH_LONG",
")",
".",
"show",
"(",
")",
";",
"base",
".",
"close",
"(",
")",
";",
"}",
"}",
"else",
"{",
"Toast",
".",
"makeText",
"(",
"this",
",",
"\"INTRODUCIR CODIGO DEL ARTICULO\"",
",",
"Toast",
".",
"LENGTH_LONG",
")",
".",
"show",
"(",
")",
";",
"}",
"}"
] | [
61,
4
] | [
83,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Agenda. | null | metodo muestraContactoXNombre(String | metodo muestraContactoXNombre(String | private ArrayList muestraContactoXNombre() {
ArrayList nombreContacto11 = new ArrayList();
// retornamos el nombre del contacto
return nombreContacto11;
} | [
"private",
"ArrayList",
"muestraContactoXNombre",
"(",
")",
"{",
"ArrayList",
"nombreContacto11",
"=",
"new",
"ArrayList",
"(",
")",
";",
"// retornamos el nombre del contacto",
"return",
"nombreContacto11",
";",
"}"
] | [
57,
1
] | [
66,
2
] | null | java | es | ['es', 'es', 'es'] | False | true | method_declaration |
|
Corredor. | null | /*Orden natural simple basado, por ejemplo, en uno de los atributos primitivos como el dorsal
usa interface Comparable y se modifica la clase modelo original.
se debe reescribir el método compareTo en la clase modelo definiendo cómo se quiere ordenar | /*Orden natural simple basado, por ejemplo, en uno de los atributos primitivos como el dorsal
usa interface Comparable y se modifica la clase modelo original.
se debe reescribir el método compareTo en la clase modelo definiendo cómo se quiere ordenar | @Override
public int compareTo(Corredor c) {
if(this.dorsal < c.dorsal) {
return -1;
}else {
if (this.dorsal > c.dorsal) {
return 1;
}
return 0;
}
} | [
"@",
"Override",
"public",
"int",
"compareTo",
"(",
"Corredor",
"c",
")",
"{",
"if",
"(",
"this",
".",
"dorsal",
"<",
"c",
".",
"dorsal",
")",
"{",
"return",
"-",
"1",
";",
"}",
"else",
"{",
"if",
"(",
"this",
".",
"dorsal",
">",
"c",
".",
"dorsal",
")",
"{",
"return",
"1",
";",
"}",
"return",
"0",
";",
"}",
"}"
] | [
41,
1
] | [
55,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
VideosApiResource. | null | Método que devuelve todos los vídeos del nombre de un determinado anime | Método que devuelve todos los vídeos del nombre de un determinado anime | @GET
@Path("/titleAnime")
@Produces("application/json")
public Collection<Video> getAllVideosByTitle(@QueryParam("title") String title) {
Collection<Video> res = repository.getAnimeVideosByName(title);
if (res == null) {
throw new NotFoundException("No se encuentra ningún vídeo.");
}
return res;
} | [
"@",
"GET",
"@",
"Path",
"(",
"\"/titleAnime\"",
")",
"@",
"Produces",
"(",
"\"application/json\"",
")",
"public",
"Collection",
"<",
"Video",
">",
"getAllVideosByTitle",
"(",
"@",
"QueryParam",
"(",
"\"title\"",
")",
"String",
"title",
")",
"{",
"Collection",
"<",
"Video",
">",
"res",
"=",
"repository",
".",
"getAnimeVideosByName",
"(",
"title",
")",
";",
"if",
"(",
"res",
"==",
"null",
")",
"{",
"throw",
"new",
"NotFoundException",
"(",
"\"No se encuentra ningún vídeo.\");",
"",
"",
"}",
"return",
"res",
";",
"}"
] | [
54,
1
] | [
63,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CrearCuenta. | null | Método para cuando se enfoca en ApellidoMaterno | Método para cuando se enfoca en ApellidoMaterno | private void CampoApellidoMaternoFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_CampoApellidoMaternoFocusGained
// Obtiene contenido de campo
String Contenido = this.CampoApellidoMaterno.getText();
// Obtiene color de campo
Color ColorActual = this.CampoApellidoMaterno.getForeground();
// Color cuando no se ha escrito nada
Color ColorNoEscrito = new Color(102, 102, 102);
// Color cuando se va a escribir algo
Color ColorEscribir = new Color(51, 51, 51);
// Verifica contenido y color de campo son los predeterminados
if(Contenido.equals("Apellido Materno") &&
(ColorActual == ColorNoEscrito))
{
// Limpiamos contenido
this.CampoApellidoMaterno.setText("");
this.CampoApellidoMaterno.setForeground(ColorEscribir);
}
else
{
this.CampoApellidoMaterno.setForeground(ColorEscribir);
}
} | [
"private",
"void",
"CampoApellidoMaternoFocusGained",
"(",
"java",
".",
"awt",
".",
"event",
".",
"FocusEvent",
"evt",
")",
"{",
"//GEN-FIRST:event_CampoApellidoMaternoFocusGained",
"// Obtiene contenido de campo",
"String",
"Contenido",
"=",
"this",
".",
"CampoApellidoMaterno",
".",
"getText",
"(",
")",
";",
"// Obtiene color de campo",
"Color",
"ColorActual",
"=",
"this",
".",
"CampoApellidoMaterno",
".",
"getForeground",
"(",
")",
";",
"// Color cuando no se ha escrito nada",
"Color",
"ColorNoEscrito",
"=",
"new",
"Color",
"(",
"102",
",",
"102",
",",
"102",
")",
";",
"// Color cuando se va a escribir algo",
"Color",
"ColorEscribir",
"=",
"new",
"Color",
"(",
"51",
",",
"51",
",",
"51",
")",
";",
"// Verifica contenido y color de campo son los predeterminados",
"if",
"(",
"Contenido",
".",
"equals",
"(",
"\"Apellido Materno\"",
")",
"&&",
"(",
"ColorActual",
"==",
"ColorNoEscrito",
")",
")",
"{",
"// Limpiamos contenido",
"this",
".",
"CampoApellidoMaterno",
".",
"setText",
"(",
"\"\"",
")",
";",
"this",
".",
"CampoApellidoMaterno",
".",
"setForeground",
"(",
"ColorEscribir",
")",
";",
"}",
"else",
"{",
"this",
".",
"CampoApellidoMaterno",
".",
"setForeground",
"(",
"ColorEscribir",
")",
";",
"}",
"}"
] | [
1044,
4
] | [
1065,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
JDBCUtilities. | null | Método complementario -> sqlite si no existe la base de datos, la crea (vacía) | Método complementario -> sqlite si no existe la base de datos, la crea (vacía) | public static boolean estaVacia(){
File archivo = new File(JDBCUtilities.UBICACION_BD);
return archivo.length() == 0;
} | [
"public",
"static",
"boolean",
"estaVacia",
"(",
")",
"{",
"File",
"archivo",
"=",
"new",
"File",
"(",
"JDBCUtilities",
".",
"UBICACION_BD",
")",
";",
"return",
"archivo",
".",
"length",
"(",
")",
"==",
"0",
";",
"}"
] | [
22,
4
] | [
25,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
TokenServiceImpl. | null | las diferentes instancias. | las diferentes instancias. | @Override
public void revokeToken(String jti) {
LOGGER.trace("Revoking token {} ", JokoUtils.formatLogString(jti));
tokenRepository.deleteById(jti);
LOGGER.trace("Token revoked: {}", jti);
} | [
"@",
"Override",
"public",
"void",
"revokeToken",
"(",
"String",
"jti",
")",
"{",
"LOGGER",
".",
"trace",
"(",
"\"Revoking token {} \"",
",",
"JokoUtils",
".",
"formatLogString",
"(",
"jti",
")",
")",
";",
"tokenRepository",
".",
"deleteById",
"(",
"jti",
")",
";",
"LOGGER",
".",
"trace",
"(",
"\"Token revoked: {}\"",
",",
"jti",
")",
";",
"}"
] | [
269,
4
] | [
274,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
EscogerSonido. | null | Busca y devuelve la Uri con el nombre de la canción/sonido elegido | Busca y devuelve la Uri con el nombre de la canción/sonido elegido | private Uri localizarSonido(String nombreSonido) {
int s = 0;
for (int i = 0; i < sonidoList.size(); i++) {
if (sonidoList.get(i).getNombre().equals(nombreSonido)) {
s = i;
}
}
return sonidoList.get(s).getUri();
} | [
"private",
"Uri",
"localizarSonido",
"(",
"String",
"nombreSonido",
")",
"{",
"int",
"s",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"sonidoList",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"sonidoList",
".",
"get",
"(",
"i",
")",
".",
"getNombre",
"(",
")",
".",
"equals",
"(",
"nombreSonido",
")",
")",
"{",
"s",
"=",
"i",
";",
"}",
"}",
"return",
"sonidoList",
".",
"get",
"(",
"s",
")",
".",
"getUri",
"(",
")",
";",
"}"
] | [
156,
4
] | [
164,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
MiAnalizador. | null | Construir el diccionario de sinónimos manualmente | Construir el diccionario de sinónimos manualmente | private SynonymMap buildSynonymMap(){
SynonymMap.Builder builder = new SynonymMap.Builder(true);
builder.add(new CharsRef("eeuu"), new CharsRef("usa"), true);
builder.add(new CharsRef("usa"), new CharsRef("eeuu"), true);
builder.add(new CharsRef("uk"), new CharsRef("united kingdom"), true);
builder.add(new CharsRef("pr china"), new CharsRef("china"), true);
builder.add(new CharsRef("china"), new CharsRef("pr china"), true);
builder.add(new CharsRef("covid"), new CharsRef("covid-19"), true);
builder.add(new CharsRef("covid"), new CharsRef("covid 19"), true);
SynonymMap map = null;
try {
map = builder.build();
} catch (IOException e) {
e.printStackTrace();
}
return map;
} | [
"private",
"SynonymMap",
"buildSynonymMap",
"(",
")",
"{",
"SynonymMap",
".",
"Builder",
"builder",
"=",
"new",
"SynonymMap",
".",
"Builder",
"(",
"true",
")",
";",
"builder",
".",
"add",
"(",
"new",
"CharsRef",
"(",
"\"eeuu\"",
")",
",",
"new",
"CharsRef",
"(",
"\"usa\"",
")",
",",
"true",
")",
";",
"builder",
".",
"add",
"(",
"new",
"CharsRef",
"(",
"\"usa\"",
")",
",",
"new",
"CharsRef",
"(",
"\"eeuu\"",
")",
",",
"true",
")",
";",
"builder",
".",
"add",
"(",
"new",
"CharsRef",
"(",
"\"uk\"",
")",
",",
"new",
"CharsRef",
"(",
"\"united kingdom\"",
")",
",",
"true",
")",
";",
"builder",
".",
"add",
"(",
"new",
"CharsRef",
"(",
"\"pr china\"",
")",
",",
"new",
"CharsRef",
"(",
"\"china\"",
")",
",",
"true",
")",
";",
"builder",
".",
"add",
"(",
"new",
"CharsRef",
"(",
"\"china\"",
")",
",",
"new",
"CharsRef",
"(",
"\"pr china\"",
")",
",",
"true",
")",
";",
"builder",
".",
"add",
"(",
"new",
"CharsRef",
"(",
"\"covid\"",
")",
",",
"new",
"CharsRef",
"(",
"\"covid-19\"",
")",
",",
"true",
")",
";",
"builder",
".",
"add",
"(",
"new",
"CharsRef",
"(",
"\"covid\"",
")",
",",
"new",
"CharsRef",
"(",
"\"covid 19\"",
")",
",",
"true",
")",
";",
"SynonymMap",
"map",
"=",
"null",
";",
"try",
"{",
"map",
"=",
"builder",
".",
"build",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"map",
";",
"}"
] | [
55,
2
] | [
71,
3
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
FileConnection. | null | En File viene la ruta completa al archivo (sin inclu�r el drive host)
@param file ruta completa al archivo (sin inclu�r el drive host)
| En File viene la ruta completa al archivo (sin inclu�r el drive host)
@param file ruta completa al archivo (sin inclu�r el drive host) | public HTTPResponse Get(String file, String query, NVPair[] headers) throws IOException, ModuleException
{
if(file.startsWith("/"))file = file.substring(1);
return new FileResponse(filesDir + file);
} | [
"public",
"HTTPResponse",
"Get",
"(",
"String",
"file",
",",
"String",
"query",
",",
"NVPair",
"[",
"]",
"headers",
")",
"throws",
"IOException",
",",
"ModuleException",
"{",
"if",
"(",
"file",
".",
"startsWith",
"(",
"\"/\"",
")",
")",
"file",
"=",
"file",
".",
"substring",
"(",
"1",
")",
";",
"return",
"new",
"FileResponse",
"(",
"filesDir",
"+",
"file",
")",
";",
"}"
] | [
55,
4
] | [
59,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
UsuarioService. | null | buscar usuario para el login | buscar usuario para el login | public Usuario findUsuLogin(String emailent, String contrasenya) {
Usuario usu = new Usuario();
Integer idUsu = 0;
idUsu = repository.findUsuLogin(emailent, contrasenya);
System.out.println("id usuario para entrar: " + idUsu);
if(idUsu > 0) {
usu.setIdUsu(idUsu);
}
return usu;
} | [
"public",
"Usuario",
"findUsuLogin",
"(",
"String",
"emailent",
",",
"String",
"contrasenya",
")",
"{",
"Usuario",
"usu",
"=",
"new",
"Usuario",
"(",
")",
";",
"Integer",
"idUsu",
"=",
"0",
";",
"idUsu",
"=",
"repository",
".",
"findUsuLogin",
"(",
"emailent",
",",
"contrasenya",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"id usuario para entrar: \"",
"+",
"idUsu",
")",
";",
"if",
"(",
"idUsu",
">",
"0",
")",
"{",
"usu",
".",
"setIdUsu",
"(",
"idUsu",
")",
";",
"}",
"return",
"usu",
";",
"}"
] | [
125,
2
] | [
140,
3
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
DataSource. | null | Indica si debo usar el pool de conexiones de GX | Indica si debo usar el pool de conexiones de GX | public boolean useGXConnectionPool()
{
// Si no estoy usando un datasource del motor de servlets
// o si estoy en 3 capas HTTP stateful, debo usar el pool nuestro
return(!usesJdbcDataSource() ||
com.genexus.Preferences.getDefaultPreferences().getREMOTE_CALLS() == com.genexus.Preferences.ORB_HTTP_STATEFUL);
} | [
"public",
"boolean",
"useGXConnectionPool",
"(",
")",
"{",
"// Si no estoy usando un datasource del motor de servlets",
"// o si estoy en 3 capas HTTP stateful, debo usar el pool nuestro",
"return",
"(",
"!",
"usesJdbcDataSource",
"(",
")",
"||",
"com",
".",
"genexus",
".",
"Preferences",
".",
"getDefaultPreferences",
"(",
")",
".",
"getREMOTE_CALLS",
"(",
")",
"==",
"com",
".",
"genexus",
".",
"Preferences",
".",
"ORB_HTTP_STATEFUL",
")",
";",
"}"
] | [
413,
1
] | [
419,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
RequerimientoNotas. | null | Lógica (calcular el promedio ajustado) | Lógica (calcular el promedio ajustado) | public static double calcularPromedioAjustado(int n1, int n2, int n3, int n4, int n5){
//Declarar la variable que recibirá la respuesta
double promedioAjustado = 0;
//2) Identificar la peor nota y la vamos a almacenar
int peorNota = n1;
if(peorNota > n2){
peorNota = n2;
}
if(peorNota > n3){
peorNota = n3;
}
if(peorNota > n4){
peorNota = n4;
}
if(peorNota > n5){
peorNota = n5;
}
//3) Calcular el promedio ajustado, quitando la peor nota identificada
promedioAjustado = (double)(n1+n2+n3+n4+n5-peorNota)/4;
promedioAjustado = (promedioAjustado*5)/100;
//Retornar el resultado
return promedioAjustado;
} | [
"public",
"static",
"double",
"calcularPromedioAjustado",
"(",
"int",
"n1",
",",
"int",
"n2",
",",
"int",
"n3",
",",
"int",
"n4",
",",
"int",
"n5",
")",
"{",
"//Declarar la variable que recibirá la respuesta",
"double",
"promedioAjustado",
"=",
"0",
";",
"//2) Identificar la peor nota y la vamos a almacenar",
"int",
"peorNota",
"=",
"n1",
";",
"if",
"(",
"peorNota",
">",
"n2",
")",
"{",
"peorNota",
"=",
"n2",
";",
"}",
"if",
"(",
"peorNota",
">",
"n3",
")",
"{",
"peorNota",
"=",
"n3",
";",
"}",
"if",
"(",
"peorNota",
">",
"n4",
")",
"{",
"peorNota",
"=",
"n4",
";",
"}",
"if",
"(",
"peorNota",
">",
"n5",
")",
"{",
"peorNota",
"=",
"n5",
";",
"}",
"//3) Calcular el promedio ajustado, quitando la peor nota identificada",
"promedioAjustado",
"=",
"(",
"double",
")",
"(",
"n1",
"+",
"n2",
"+",
"n3",
"+",
"n4",
"+",
"n5",
"-",
"peorNota",
")",
"/",
"4",
";",
"promedioAjustado",
"=",
"(",
"promedioAjustado",
"*",
"5",
")",
"/",
"100",
";",
"//Retornar el resultado",
"return",
"promedioAjustado",
";",
"}"
] | [
13,
4
] | [
40,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
VistaRequerimientosReto4. | null | Listar los bancos | Listar los bancos | public static void requerimiento3(){
//Encabezado
System.out.println("-----Ranking Descendente Bancos (Área Proyectos)-------");
try{
System.out.println("Banco_Vinculado Area_Promedio");
ArrayList<BancoRankeadoAreaPromedio> bancos = controlador.consultarBancosRankeadosAreaPromedio();
for (BancoRankeadoAreaPromedio banco : bancos) {
System.out.printf("%s %f %n",
banco.getBancoVinculado(),
banco.getAreaPromedio()
);
}
}catch(SQLException e){
System.err.println("Ha ocurrido un error!"+e.getMessage());
}
} | [
"public",
"static",
"void",
"requerimiento3",
"(",
")",
"{",
"//Encabezado",
"System",
".",
"out",
".",
"println",
"(",
"\"-----Ranking Descendente Bancos (Área Proyectos)-------\")",
";",
" ",
"try",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Banco_Vinculado Area_Promedio\"",
")",
";",
"ArrayList",
"<",
"BancoRankeadoAreaPromedio",
">",
"bancos",
"=",
"controlador",
".",
"consultarBancosRankeadosAreaPromedio",
"(",
")",
";",
"for",
"(",
"BancoRankeadoAreaPromedio",
"banco",
":",
"bancos",
")",
"{",
"System",
".",
"out",
".",
"printf",
"(",
"\"%s %f %n\"",
",",
"banco",
".",
"getBancoVinculado",
"(",
")",
",",
"banco",
".",
"getAreaPromedio",
"(",
")",
")",
";",
"}",
"}",
"catch",
"(",
"SQLException",
"e",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"Ha ocurrido un error!\"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
] | [
44,
4
] | [
67,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CropOverlayView. | null | Metodo para dibujar puntos en los vertices del rectangulo
ayuda a tomarlos como puntos de referencia al recortar la imagen
| Metodo para dibujar puntos en los vertices del rectangulo
ayuda a tomarlos como puntos de referencia al recortar la imagen
| private void drawVertex(Canvas canvas) {
Paint paint = new Paint();
paint.setColor(Color.WHITE);
paint.setStyle(Paint.Style.FILL);
canvas.drawCircle(topLeft.x, topLeft.y, vertexSize, paint);
canvas.drawCircle(topRight.x, topRight.y, vertexSize, paint);
canvas.drawCircle(bottomLeft.x, bottomLeft.y, vertexSize, paint);
canvas.drawCircle(bottomRight.x, bottomRight.y, vertexSize, paint);
} | [
"private",
"void",
"drawVertex",
"(",
"Canvas",
"canvas",
")",
"{",
"Paint",
"paint",
"=",
"new",
"Paint",
"(",
")",
";",
"paint",
".",
"setColor",
"(",
"Color",
".",
"WHITE",
")",
";",
"paint",
".",
"setStyle",
"(",
"Paint",
".",
"Style",
".",
"FILL",
")",
";",
"canvas",
".",
"drawCircle",
"(",
"topLeft",
".",
"x",
",",
"topLeft",
".",
"y",
",",
"vertexSize",
",",
"paint",
")",
";",
"canvas",
".",
"drawCircle",
"(",
"topRight",
".",
"x",
",",
"topRight",
".",
"y",
",",
"vertexSize",
",",
"paint",
")",
";",
"canvas",
".",
"drawCircle",
"(",
"bottomLeft",
".",
"x",
",",
"bottomLeft",
".",
"y",
",",
"vertexSize",
",",
"paint",
")",
";",
"canvas",
".",
"drawCircle",
"(",
"bottomRight",
".",
"x",
",",
"bottomRight",
".",
"y",
",",
"vertexSize",
",",
"paint",
")",
";",
"}"
] | [
158,
4
] | [
169,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Login. | null | Método para cuando se enfoca en CampoUsuario | Método para cuando se enfoca en CampoUsuario | private void CampoUsuarioFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_CampoUsuarioFocusGained
// Obtiene contenido de campo
String Contenido = this.CampoUsuario.getText();
// Obtiene color de campo
Color ColorActual = this.CampoUsuario.getForeground();
// Color cuando no se ha escrito nada
Color ColorNoEscrito = new Color(102, 102, 102);
// Color cuando se va a escribir algo
Color ColorEscribir = new Color(51, 51, 51);
// Verifica contenido y color de campo son los predeterminados
if(Contenido.equals("Nombre de Usuario") &&
(ColorActual == ColorNoEscrito))
{
// Limpiamos contenido
this.CampoUsuario.setText("");
this.CampoUsuario.setForeground(ColorEscribir);
}
else
{
this.CampoUsuario.setForeground(ColorEscribir);
}
} | [
"private",
"void",
"CampoUsuarioFocusGained",
"(",
"java",
".",
"awt",
".",
"event",
".",
"FocusEvent",
"evt",
")",
"{",
"//GEN-FIRST:event_CampoUsuarioFocusGained",
"// Obtiene contenido de campo",
"String",
"Contenido",
"=",
"this",
".",
"CampoUsuario",
".",
"getText",
"(",
")",
";",
"// Obtiene color de campo",
"Color",
"ColorActual",
"=",
"this",
".",
"CampoUsuario",
".",
"getForeground",
"(",
")",
";",
"// Color cuando no se ha escrito nada",
"Color",
"ColorNoEscrito",
"=",
"new",
"Color",
"(",
"102",
",",
"102",
",",
"102",
")",
";",
"// Color cuando se va a escribir algo",
"Color",
"ColorEscribir",
"=",
"new",
"Color",
"(",
"51",
",",
"51",
",",
"51",
")",
";",
"// Verifica contenido y color de campo son los predeterminados",
"if",
"(",
"Contenido",
".",
"equals",
"(",
"\"Nombre de Usuario\"",
")",
"&&",
"(",
"ColorActual",
"==",
"ColorNoEscrito",
")",
")",
"{",
"// Limpiamos contenido",
"this",
".",
"CampoUsuario",
".",
"setText",
"(",
"\"\"",
")",
";",
"this",
".",
"CampoUsuario",
".",
"setForeground",
"(",
"ColorEscribir",
")",
";",
"}",
"else",
"{",
"this",
".",
"CampoUsuario",
".",
"setForeground",
"(",
"ColorEscribir",
")",
";",
"}",
"}"
] | [
589,
4
] | [
610,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
PrestamoController. | null | LISTANDO TODOS LOS PRESTAMOS | LISTANDO TODOS LOS PRESTAMOS | @GetMapping
public List<Prestamo> listarPrestamos(){
return prService.listarTodosPrestamo();
} | [
"@",
"GetMapping",
"public",
"List",
"<",
"Prestamo",
">",
"listarPrestamos",
"(",
")",
"{",
"return",
"prService",
".",
"listarTodosPrestamo",
"(",
")",
";",
"}"
] | [
73,
1
] | [
76,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
MainActivity. | null | metodo para el boton GUARDAR PREFERENCIAS | metodo para el boton GUARDAR PREFERENCIAS | public void Guardar(View Guardar){
SharedPreferences NuevosDatos = getSharedPreferences("datos", Context.MODE_PRIVATE);
SharedPreferences.Editor DatosGuardados = NuevosDatos.edit();
DatosGuardados.putString("mail", et_SP.getText().toString());
DatosGuardados.commit();
finish();
} | [
"public",
"void",
"Guardar",
"(",
"View",
"Guardar",
")",
"{",
"SharedPreferences",
"NuevosDatos",
"=",
"getSharedPreferences",
"(",
"\"datos\"",
",",
"Context",
".",
"MODE_PRIVATE",
")",
";",
"SharedPreferences",
".",
"Editor",
"DatosGuardados",
"=",
"NuevosDatos",
".",
"edit",
"(",
")",
";",
"DatosGuardados",
".",
"putString",
"(",
"\"mail\"",
",",
"et_SP",
".",
"getText",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"DatosGuardados",
".",
"commit",
"(",
")",
";",
"finish",
"(",
")",
";",
"}"
] | [
29,
4
] | [
35,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Gestor. | null | Metodo para mostrar todas las contraseñas | Metodo para mostrar todas las contraseñas | public void mostrar() {
String cadena = "";
for (Password a : arreglo) {
cadena = cadena + "\n" + a + "->" + ((a.esFuerte() ? "Contraseña Fuerte" : "Contraseña Debil"));
}
JOptionPane.showMessageDialog(null, cadena, "Mostrando Contraseñas", 1);
} | [
"public",
"void",
"mostrar",
"(",
")",
"{",
"String",
"cadena",
"=",
"\"\"",
";",
"for",
"(",
"Password",
"a",
":",
"arreglo",
")",
"{",
"cadena",
"=",
"cadena",
"+",
"\"\\n\"",
"+",
"a",
"+",
"\"->\"",
"+",
"(",
"(",
"a",
".",
"esFuerte",
"(",
")",
"?",
"\"Contraseña Fuerte\" ",
" ",
"Contraseña Debil\"))",
";",
"",
"",
"}",
"JOptionPane",
".",
"showMessageDialog",
"(",
"null",
",",
"cadena",
",",
"\"Mostrando Contraseñas\",",
" ",
")",
";",
"",
"}"
] | [
70,
4
] | [
76,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
GameScreenAssetSystem. | null | Carga los sprites | Carga los sprites | private void loadSprites() {
final Json json = new Json();
spriteLibrary = json.fromJson(SpriteLibrary.class, Gdx.files.internal("sprites.json"));
for (SpriteData sprite : spriteLibrary.sprites) {
Animation animation = add(sprite.id, sprite.x, sprite.y, sprite.width, sprite.height, sprite.countX, sprite.countY, this.tileset,
sprite.milliseconds * 0.001f);
if (!sprite.repeat) {
animation.setPlayMode(Animation.PlayMode.NORMAL);
} else animation.setPlayMode(Animation.PlayMode.LOOP);
}
} | [
"private",
"void",
"loadSprites",
"(",
")",
"{",
"final",
"Json",
"json",
"=",
"new",
"Json",
"(",
")",
";",
"spriteLibrary",
"=",
"json",
".",
"fromJson",
"(",
"SpriteLibrary",
".",
"class",
",",
"Gdx",
".",
"files",
".",
"internal",
"(",
"\"sprites.json\"",
")",
")",
";",
"for",
"(",
"SpriteData",
"sprite",
":",
"spriteLibrary",
".",
"sprites",
")",
"{",
"Animation",
"animation",
"=",
"add",
"(",
"sprite",
".",
"id",
",",
"sprite",
".",
"x",
",",
"sprite",
".",
"y",
",",
"sprite",
".",
"width",
",",
"sprite",
".",
"height",
",",
"sprite",
".",
"countX",
",",
"sprite",
".",
"countY",
",",
"this",
".",
"tileset",
",",
"sprite",
".",
"milliseconds",
"*",
"0.001f",
")",
";",
"if",
"(",
"!",
"sprite",
".",
"repeat",
")",
"{",
"animation",
".",
"setPlayMode",
"(",
"Animation",
".",
"PlayMode",
".",
"NORMAL",
")",
";",
"}",
"else",
"animation",
".",
"setPlayMode",
"(",
"Animation",
".",
"PlayMode",
".",
"LOOP",
")",
";",
"}",
"}"
] | [
109,
1
] | [
119,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Gestor. | null | Metodo para agregar una Contraseña | Metodo para agregar una Contraseña | public void addPassword(Password p) {
arreglo.add(p);
JOptionPane.showMessageDialog(null, "Contraseña Agregada Correctamente", "Agregada", 1);
contador++;
} | [
"public",
"void",
"addPassword",
"(",
"Password",
"p",
")",
"{",
"arreglo",
".",
"add",
"(",
"p",
")",
";",
"JOptionPane",
".",
"showMessageDialog",
"(",
"null",
",",
"\"Contraseña Agregada Correctamente\",",
" ",
"Agregada\",",
" ",
")",
";",
"",
"contador",
"++",
";",
"}"
] | [
63,
4
] | [
67,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Poblacion. | null | Comparar mi metodo con la otra forma. | Comparar mi metodo con la otra forma. | public void generarPoblacionSinRepetir(int n_genes){
Individuo cromosoma;
int [] posiciones = new int[n_genes];
int [] c_posiciones;
int [] genesOrdenados;
int pos;
for(int l = 0; l < sizePoblacion; l++){
for (int i=0;i<n_genes;i++){
do{
pos = rnd.nextInt((n_genes*100) + 1);
if(seRepite(posiciones,pos)){
pos = 0;
}
}while(pos == 0);
posiciones[i] = pos;
}
cromosoma = new Individuo(10);
c_posiciones = posiciones.clone();
genesOrdenados = posiciones.clone();
Arrays.sort(posiciones);
for(int k = 0;k<n_genes;k++){
genesOrdenados[k] = devolverPosicion(c_posiciones, posiciones[k]);
//System.out.println((k+1)+"=> "+ c_posiciones[k] + " => "+posiciones[k] + " => "+genesOrdenados[k]);
}
cromosoma.setGenes(genesOrdenados);
individuos[l] = cromosoma;
}
} | [
"public",
"void",
"generarPoblacionSinRepetir",
"(",
"int",
"n_genes",
")",
"{",
"Individuo",
"cromosoma",
";",
"int",
"[",
"]",
"posiciones",
"=",
"new",
"int",
"[",
"n_genes",
"]",
";",
"int",
"[",
"]",
"c_posiciones",
";",
"int",
"[",
"]",
"genesOrdenados",
";",
"int",
"pos",
";",
"for",
"(",
"int",
"l",
"=",
"0",
";",
"l",
"<",
"sizePoblacion",
";",
"l",
"++",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n_genes",
";",
"i",
"++",
")",
"{",
"do",
"{",
"pos",
"=",
"rnd",
".",
"nextInt",
"(",
"(",
"n_genes",
"*",
"100",
")",
"+",
"1",
")",
";",
"if",
"(",
"seRepite",
"(",
"posiciones",
",",
"pos",
")",
")",
"{",
"pos",
"=",
"0",
";",
"}",
"}",
"while",
"(",
"pos",
"==",
"0",
")",
";",
"posiciones",
"[",
"i",
"]",
"=",
"pos",
";",
"}",
"cromosoma",
"=",
"new",
"Individuo",
"(",
"10",
")",
";",
"c_posiciones",
"=",
"posiciones",
".",
"clone",
"(",
")",
";",
"genesOrdenados",
"=",
"posiciones",
".",
"clone",
"(",
")",
";",
"Arrays",
".",
"sort",
"(",
"posiciones",
")",
";",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"n_genes",
";",
"k",
"++",
")",
"{",
"genesOrdenados",
"[",
"k",
"]",
"=",
"devolverPosicion",
"(",
"c_posiciones",
",",
"posiciones",
"[",
"k",
"]",
")",
";",
"//System.out.println((k+1)+\"=> \"+ c_posiciones[k] + \" => \"+posiciones[k] + \" => \"+genesOrdenados[k]);\r",
"}",
"cromosoma",
".",
"setGenes",
"(",
"genesOrdenados",
")",
";",
"individuos",
"[",
"l",
"]",
"=",
"cromosoma",
";",
"}",
"}"
] | [
34,
8
] | [
64,
9
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ControladoraHotel. | null | si coincide con el usuario y contraseña que recibio del fomrulario | si coincide con el usuario y contraseña que recibio del fomrulario | public boolean verificarUsuario(String usuario, String contrasenia) {
List<Usuario> lista_usuarios = controlPersistencia.traerUsuario();
//recorremos la lista en caso de que no sea null
//porque si no hay usuarios registrados en la BD, devuelve null
//cuando recorramos la lista con el for habra un error y se cortara el programa
if (lista_usuarios != null) {
//las listas las recorremos con for
// verificara que cada usuario tarido de la base de datos coincida con el usuario y contrasenia
//que tenemos por parametro
for (Usuario user : lista_usuarios) {
//hacemos las comparaciones como Strings (tener en cuenta que la constrasenia esta sin encriptar)
if (user.getNombre_usuario().equals(usuario) && user.getContrasenia().equals(contrasenia)) {
//aqui cortamos la ejecucion de la busqueda con for cuando hay coincidencia y que no busque mas
//asi el metodo devuelve true
return true;
}
}
}
//el metodo retorna false si no despues de recorrer el for no encontro coincidencia
return false;
} | [
"public",
"boolean",
"verificarUsuario",
"(",
"String",
"usuario",
",",
"String",
"contrasenia",
")",
"{",
"List",
"<",
"Usuario",
">",
"lista_usuarios",
"=",
"controlPersistencia",
".",
"traerUsuario",
"(",
")",
";",
"//recorremos la lista en caso de que no sea null",
"//porque si no hay usuarios registrados en la BD, devuelve null",
"//cuando recorramos la lista con el for habra un error y se cortara el programa",
"if",
"(",
"lista_usuarios",
"!=",
"null",
")",
"{",
"//las listas las recorremos con for",
"// verificara que cada usuario tarido de la base de datos coincida con el usuario y contrasenia",
"//que tenemos por parametro",
"for",
"(",
"Usuario",
"user",
":",
"lista_usuarios",
")",
"{",
"//hacemos las comparaciones como Strings (tener en cuenta que la constrasenia esta sin encriptar)",
"if",
"(",
"user",
".",
"getNombre_usuario",
"(",
")",
".",
"equals",
"(",
"usuario",
")",
"&&",
"user",
".",
"getContrasenia",
"(",
")",
".",
"equals",
"(",
"contrasenia",
")",
")",
"{",
"//aqui cortamos la ejecucion de la busqueda con for cuando hay coincidencia y que no busque mas",
"//asi el metodo devuelve true",
"return",
"true",
";",
"}",
"}",
"}",
"//el metodo retorna false si no despues de recorrer el for no encontro coincidencia",
"return",
"false",
";",
"}"
] | [
580,
4
] | [
603,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ProyectoMiyamotoRepositoryImplement. | null | Métodos de imágenes | Métodos de imágenes | public Collection<Imagen> getAllAnimeImagenes() {
Collection<Imagen> imagenes = new HashSet<>();
for (Anime a : getAllAnimes()) {
imagenes.addAll(a.getImagenes());
}
return imagenes;
} | [
"public",
"Collection",
"<",
"Imagen",
">",
"getAllAnimeImagenes",
"(",
")",
"{",
"Collection",
"<",
"Imagen",
">",
"imagenes",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"for",
"(",
"Anime",
"a",
":",
"getAllAnimes",
"(",
")",
")",
"{",
"imagenes",
".",
"addAll",
"(",
"a",
".",
"getImagenes",
"(",
")",
")",
";",
"}",
"return",
"imagenes",
";",
"}"
] | [
151,
1
] | [
157,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
AnswerTests. | null | No debe validar si la description es mayor de 200, menor de 3, vacia | No debe validar si la description es mayor de 200, menor de 3, vacia | @ParameterizedTest
@ValueSource(strings = {
"Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto",//
"Es",//
""
})
void shouldNotValidateDescription(final String text) {
LocaleContextHolder.setLocale(Locale.ENGLISH);
Answer answer = this.generateAnswer();
answer.setDescription(text);
Validator validator = this.createValidator();
Set<ConstraintViolation<Answer>> constraintViolations = validator.validate(answer);
Assertions.assertThat(constraintViolations.size()).isEqualTo(1);
ConstraintViolation<Answer> violation = constraintViolations.iterator().next();
Assertions.assertThat(violation.getPropertyPath().toString()).isEqualTo("description");
Assertions.assertThat(violation.getMessage()).isEqualTo("size must be between 3 and 200");
} | [
"@",
"ParameterizedTest",
"@",
"ValueSource",
"(",
"strings",
"=",
"{",
"\"Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto\"",
",",
"//",
"\"Es\"",
",",
"//",
"\"\"",
"}",
")",
"void",
"shouldNotValidateDescription",
"(",
"final",
"String",
"text",
")",
"{",
"LocaleContextHolder",
".",
"setLocale",
"(",
"Locale",
".",
"ENGLISH",
")",
";",
"Answer",
"answer",
"=",
"this",
".",
"generateAnswer",
"(",
")",
";",
"answer",
".",
"setDescription",
"(",
"text",
")",
";",
"Validator",
"validator",
"=",
"this",
".",
"createValidator",
"(",
")",
";",
"Set",
"<",
"ConstraintViolation",
"<",
"Answer",
">",
">",
"constraintViolations",
"=",
"validator",
".",
"validate",
"(",
"answer",
")",
";",
"Assertions",
".",
"assertThat",
"(",
"constraintViolations",
".",
"size",
"(",
")",
")",
".",
"isEqualTo",
"(",
"1",
")",
";",
"ConstraintViolation",
"<",
"Answer",
">",
"violation",
"=",
"constraintViolations",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
";",
"Assertions",
".",
"assertThat",
"(",
"violation",
".",
"getPropertyPath",
"(",
")",
".",
"toString",
"(",
")",
")",
".",
"isEqualTo",
"(",
"\"description\"",
")",
";",
"Assertions",
".",
"assertThat",
"(",
"violation",
".",
"getMessage",
"(",
")",
")",
".",
"isEqualTo",
"(",
"\"size must be between 3 and 200\"",
")",
";",
"}"
] | [
110,
1
] | [
128,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ControladoraInformacion. | null | METODO PARA CALCULAR LA VELOCIDAD INICIAL DE AMBOS CUERPOS | METODO PARA CALCULAR LA VELOCIDAD INICIAL DE AMBOS CUERPOS | @FXML
public void calcularvi(ActionEvent event) {
try {
double velocidadInicial1 = Double.parseDouble(vivica.getText());
double velocidadInicial2 = Double.parseDouble(vivicb.getText());
double masa1 = Double.parseDouble(vimca.getText());
double masa2 = Double.parseDouble(vimcb.getText());
// *********************************************
double resultado1 = persona.vfc1(masa1, masa2, velocidadInicial1, velocidadInicial2);
double resultado2 = persona.vfc2(masa1, masa2, velocidadInicial1, velocidadInicial2, resultado1);
// *********************************************
String resultado1Mostrar = String.valueOf(resultado1);
String resultado2Mostrar = String.valueOf(resultado2);
// *********************************************
vivfca.setText(resultado1Mostrar);
vivfcb.setText(resultado2Mostrar);
persona.agregarCalculo(velocidadInicial1, resultado1, masa1, velocidadInicial2, resultado2, masa2);
} catch(NumberFormatException e1) {
Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle("Informacion importante");
alert.setHeaderText(null);
alert.setContentText("Datos invalidos, por favor revise las siguientes opciones: \n" +
"\n 1. La informacion no debe de tener ninguna letra." +
"\n 2. Si utiliza decimales, por favor separelos con un punto." +
"\n 3. Ningun campo puede estar vacio");
alert.showAndWait();
} catch(NullPointerException e2) {
Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle("Informacion importante");
alert.setHeaderText(null);
alert.setContentText("Por favor llene todos los datos requeridos");
alert.showAndWait();
}
} | [
"@",
"FXML",
"public",
"void",
"calcularvi",
"(",
"ActionEvent",
"event",
")",
"{",
"try",
"{",
"double",
"velocidadInicial1",
"=",
"Double",
".",
"parseDouble",
"(",
"vivica",
".",
"getText",
"(",
")",
")",
";",
"double",
"velocidadInicial2",
"=",
"Double",
".",
"parseDouble",
"(",
"vivicb",
".",
"getText",
"(",
")",
")",
";",
"double",
"masa1",
"=",
"Double",
".",
"parseDouble",
"(",
"vimca",
".",
"getText",
"(",
")",
")",
";",
"double",
"masa2",
"=",
"Double",
".",
"parseDouble",
"(",
"vimcb",
".",
"getText",
"(",
")",
")",
";",
"// *********************************************",
"double",
"resultado1",
"=",
"persona",
".",
"vfc1",
"(",
"masa1",
",",
"masa2",
",",
"velocidadInicial1",
",",
"velocidadInicial2",
")",
";",
"double",
"resultado2",
"=",
"persona",
".",
"vfc2",
"(",
"masa1",
",",
"masa2",
",",
"velocidadInicial1",
",",
"velocidadInicial2",
",",
"resultado1",
")",
";",
"// *********************************************",
"String",
"resultado1Mostrar",
"=",
"String",
".",
"valueOf",
"(",
"resultado1",
")",
";",
"String",
"resultado2Mostrar",
"=",
"String",
".",
"valueOf",
"(",
"resultado2",
")",
";",
"// *********************************************",
"vivfca",
".",
"setText",
"(",
"resultado1Mostrar",
")",
";",
"vivfcb",
".",
"setText",
"(",
"resultado2Mostrar",
")",
";",
"persona",
".",
"agregarCalculo",
"(",
"velocidadInicial1",
",",
"resultado1",
",",
"masa1",
",",
"velocidadInicial2",
",",
"resultado2",
",",
"masa2",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e1",
")",
"{",
"Alert",
"alert",
"=",
"new",
"Alert",
"(",
"AlertType",
".",
"INFORMATION",
")",
";",
"alert",
".",
"setTitle",
"(",
"\"Informacion importante\"",
")",
";",
"alert",
".",
"setHeaderText",
"(",
"null",
")",
";",
"alert",
".",
"setContentText",
"(",
"\"Datos invalidos, por favor revise las siguientes opciones: \\n\"",
"+",
"\"\\n 1. La informacion no debe de tener ninguna letra.\"",
"+",
"\"\\n 2. Si utiliza decimales, por favor separelos con un punto.\"",
"+",
"\"\\n 3. Ningun campo puede estar vacio\"",
")",
";",
"alert",
".",
"showAndWait",
"(",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"e2",
")",
"{",
"Alert",
"alert",
"=",
"new",
"Alert",
"(",
"AlertType",
".",
"INFORMATION",
")",
";",
"alert",
".",
"setTitle",
"(",
"\"Informacion importante\"",
")",
";",
"alert",
".",
"setHeaderText",
"(",
"null",
")",
";",
"alert",
".",
"setContentText",
"(",
"\"Por favor llene todos los datos requeridos\"",
")",
";",
"alert",
".",
"showAndWait",
"(",
")",
";",
"}",
"}"
] | [
181,
1
] | [
237,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
NoticiasApiResource. | null | Método que devuelve una noticia con una determinada id | Método que devuelve una noticia con una determinada id | @GET
@Path("/{id}")
@Produces("application/json")
public Noticia getNoticiaById(@PathParam("id") String id) {
Noticia noticia = repository.getNoticiaById(id);
if (noticia == null) {
throw new BadRequestException("La noticia solicitada no existe.");
}
return noticia;
} | [
"@",
"GET",
"@",
"Path",
"(",
"\"/{id}\"",
")",
"@",
"Produces",
"(",
"\"application/json\"",
")",
"public",
"Noticia",
"getNoticiaById",
"(",
"@",
"PathParam",
"(",
"\"id\"",
")",
"String",
"id",
")",
"{",
"Noticia",
"noticia",
"=",
"repository",
".",
"getNoticiaById",
"(",
"id",
")",
";",
"if",
"(",
"noticia",
"==",
"null",
")",
"{",
"throw",
"new",
"BadRequestException",
"(",
"\"La noticia solicitada no existe.\"",
")",
";",
"}",
"return",
"noticia",
";",
"}"
] | [
67,
1
] | [
76,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Mesa. | null | Comprueba que el movimiento se puede realizar hacia el monton exterior | Comprueba que el movimiento se puede realizar hacia el monton exterior | public boolean movimientoOportunoFuera(int x, int y){
boolean movimiento = false;
if((montonInterior[(x-5)/4][(x-5)%4].peek().getNum() == montonExterior[y]
.peek().getNum() + 1) && montonInterior[(x-5)/4][(x-5)%4].peek()
.getPalo() == montonExterior[y].peek().getPalo()){
movimiento = true;
}
return movimiento;
} | [
"public",
"boolean",
"movimientoOportunoFuera",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"boolean",
"movimiento",
"=",
"false",
";",
"if",
"(",
"(",
"montonInterior",
"[",
"(",
"x",
"-",
"5",
")",
"/",
"4",
"]",
"[",
"(",
"x",
"-",
"5",
")",
"%",
"4",
"]",
".",
"peek",
"(",
")",
".",
"getNum",
"(",
")",
"==",
"montonExterior",
"[",
"y",
"]",
".",
"peek",
"(",
")",
".",
"getNum",
"(",
")",
"+",
"1",
")",
"&&",
"montonInterior",
"[",
"(",
"x",
"-",
"5",
")",
"/",
"4",
"]",
"[",
"(",
"x",
"-",
"5",
")",
"%",
"4",
"]",
".",
"peek",
"(",
")",
".",
"getPalo",
"(",
")",
"==",
"montonExterior",
"[",
"y",
"]",
".",
"peek",
"(",
")",
".",
"getPalo",
"(",
")",
")",
"{",
"movimiento",
"=",
"true",
";",
"}",
"return",
"movimiento",
";",
"}"
] | [
101,
4
] | [
113,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
RcvAdapterAlarmas. | null | Para poder pasar al metodo de Swip (en TabFragmentAlarmas) y poder borrar esa alarma en concreto. Pasamos su posicion. | Para poder pasar al metodo de Swip (en TabFragmentAlarmas) y poder borrar esa alarma en concreto. Pasamos su posicion. | public Object getAlarmaAt(int position) {
return dataSet.get(position);
} | [
"public",
"Object",
"getAlarmaAt",
"(",
"int",
"position",
")",
"{",
"return",
"dataSet",
".",
"get",
"(",
"position",
")",
";",
"}"
] | [
77,
4
] | [
79,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
NewsController. | null | Listar todos los comentarios de un post | Listar todos los comentarios de un post | @GetMapping("/{id}/comments")
public List<Comment> listComments(@PathVariable Long id) {
return commentService.listComments(id);
} | [
"@",
"GetMapping",
"(",
"\"/{id}/comments\"",
")",
"public",
"List",
"<",
"Comment",
">",
"listComments",
"(",
"@",
"PathVariable",
"Long",
"id",
")",
"{",
"return",
"commentService",
".",
"listComments",
"(",
"id",
")",
";",
"}"
] | [
44,
4
] | [
47,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ThirdActivity. | null | método genérico, se puede usar con permisos de cualquier tipo, no solo de teléfono | método genérico, se puede usar con permisos de cualquier tipo, no solo de teléfono | private boolean checkPermission(String permission){
int result = this.checkCallingOrSelfPermission(permission);
return result == PackageManager.PERMISSION_GRANTED;
} | [
"private",
"boolean",
"checkPermission",
"(",
"String",
"permission",
")",
"{",
"int",
"result",
"=",
"this",
".",
"checkCallingOrSelfPermission",
"(",
"permission",
")",
";",
"return",
"result",
"==",
"PackageManager",
".",
"PERMISSION_GRANTED",
";",
"}"
] | [
197,
4
] | [
200,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
StudentController. | null | Esto crea un post misma url pero le mandas el json | Esto crea un post misma url pero le mandas el json | @PostMapping("/home")
public Object createHome(@RequestBody Object home) {
System.out.println("create");
return home;
} | [
"@",
"PostMapping",
"(",
"\"/home\"",
")",
"public",
"Object",
"createHome",
"(",
"@",
"RequestBody",
"Object",
"home",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"create\"",
")",
";",
"return",
"home",
";",
"}"
] | [
40,
1
] | [
44,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
NGSIToCarto. | null | 3 : El procesador esta anotado con la anotacion @TriggerWhenEmpty | 3 : El procesador esta anotado con la anotacion | @Override
public void onTrigger(ProcessContext context, ProcessSessionFactory sessionFactory) throws ProcessException {
final Boolean rollbackOnFailure = context.getProperty(RollbackOnFailure.ROLLBACK_ON_FAILURE).asBoolean();
final FunctionContext functionContext = new FunctionContext(rollbackOnFailure);
functionContext.obtainKeys = false;
RollbackOnFailure.onTrigger(context, sessionFactory, functionContext, getLogger(), session -> process.onTrigger(context, session, functionContext));
} | [
"@",
"Override",
"public",
"void",
"onTrigger",
"(",
"ProcessContext",
"context",
",",
"ProcessSessionFactory",
"sessionFactory",
")",
"throws",
"ProcessException",
"{",
"final",
"Boolean",
"rollbackOnFailure",
"=",
"context",
".",
"getProperty",
"(",
"RollbackOnFailure",
".",
"ROLLBACK_ON_FAILURE",
")",
".",
"asBoolean",
"(",
")",
";",
"final",
"FunctionContext",
"functionContext",
"=",
"new",
"FunctionContext",
"(",
"rollbackOnFailure",
")",
";",
"functionContext",
".",
"obtainKeys",
"=",
"false",
";",
"RollbackOnFailure",
".",
"onTrigger",
"(",
"context",
",",
"sessionFactory",
",",
"functionContext",
",",
"getLogger",
"(",
")",
",",
"session",
"->",
"process",
".",
"onTrigger",
"(",
"context",
",",
"session",
",",
"functionContext",
")",
")",
";",
"}"
] | [
807,
4
] | [
813,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
NGSIToCarto. | null | Se crea el parámetro que puede ser leído por Carto a partir de los datos geográficos | Se crea el parámetro que puede ser leído por Carto a partir de los datos geográficos | public final ImmutablePair<String, Boolean> getGeomWebmercator(String attrType, String attrValue, boolean SwapCoordiantes){
ImmutablePair<String, Boolean> localizacion = new ImmutablePair<>("", true );
if(attrType.equals("geo:point")){
String[] split = attrValue.split(",");
if(SwapCoordiantes){
return new ImmutablePair("ST_SetSRID(ST_MakePoint(" + split[1].trim() /*+ "::float"*/ + "," + split[0].trim() /*+ "::float"*/ + "), 3857)", true);
} else {
return new ImmutablePair("ST_SetSRID(ST_MakePoint(" + split[0].trim() /*+ "::float"*/ + "," + split[1].trim() /*+ "::float"*/ + "), 3857)", true);
}
}
else if(attrType.equals("geo:json")){
return new ImmutablePair("ST_GeomFromGeoJSON(" + attrValue + ")", true);
}
return new ImmutablePair<>(attrValue, false);
} | [
"public",
"final",
"ImmutablePair",
"<",
"String",
",",
"Boolean",
">",
"getGeomWebmercator",
"(",
"String",
"attrType",
",",
"String",
"attrValue",
",",
"boolean",
"SwapCoordiantes",
")",
"{",
"ImmutablePair",
"<",
"String",
",",
"Boolean",
">",
"localizacion",
"=",
"new",
"ImmutablePair",
"<>",
"(",
"\"\"",
",",
"true",
")",
";",
"if",
"(",
"attrType",
".",
"equals",
"(",
"\"geo:point\"",
")",
")",
"{",
"String",
"[",
"]",
"split",
"=",
"attrValue",
".",
"split",
"(",
"\",\"",
")",
";",
"if",
"(",
"SwapCoordiantes",
")",
"{",
"return",
"new",
"ImmutablePair",
"(",
"\"ST_SetSRID(ST_MakePoint(\"",
"+",
"split",
"[",
"1",
"]",
".",
"trim",
"(",
")",
"/*+ \"::float\"*/",
"+",
"\",\"",
"+",
"split",
"[",
"0",
"]",
".",
"trim",
"(",
")",
"/*+ \"::float\"*/",
"+",
"\"), 3857)\"",
",",
"true",
")",
";",
"}",
"else",
"{",
"return",
"new",
"ImmutablePair",
"(",
"\"ST_SetSRID(ST_MakePoint(\"",
"+",
"split",
"[",
"0",
"]",
".",
"trim",
"(",
")",
"/*+ \"::float\"*/",
"+",
"\",\"",
"+",
"split",
"[",
"1",
"]",
".",
"trim",
"(",
")",
"/*+ \"::float\"*/",
"+",
"\"), 3857)\"",
",",
"true",
")",
";",
"}",
"}",
"else",
"if",
"(",
"attrType",
".",
"equals",
"(",
"\"geo:json\"",
")",
")",
"{",
"return",
"new",
"ImmutablePair",
"(",
"\"ST_GeomFromGeoJSON(\"",
"+",
"attrValue",
"+",
"\")\"",
",",
"true",
")",
";",
"}",
"return",
"new",
"ImmutablePair",
"<>",
"(",
"attrValue",
",",
"false",
")",
";",
"}"
] | [
266,
4
] | [
285,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Registro. | null | Método InsertarReservaciones | Método InsertarReservaciones | public void InsertarReservaciones(Reservacion ReservacionAAsignar)
{
RegistroReservaciones.add(ReservacionAAsignar);
} | [
"public",
"void",
"InsertarReservaciones",
"(",
"Reservacion",
"ReservacionAAsignar",
")",
"{",
"RegistroReservaciones",
".",
"add",
"(",
"ReservacionAAsignar",
")",
";",
"}"
] | [
126,
4
] | [
129,
5
] | null | java | es | ['es', 'es', 'es'] | False | true | method_declaration |
|
AssetUserActorPluginRoot. | null | TODO al confirmarse el registro del Actor cambia su estado local a CONNECTED | TODO al confirmarse el registro del Actor cambia su estado local a CONNECTED | @Override
public void handleCompleteClientAssetUserActorRegistrationNotificationEvent(ActorAssetUser actorAssetUser) {
System.out.println("***************************************************************");
System.out.println("Actor Asset User se Registro " + actorAssetUser.getName());
try {
//TODO Cambiar luego por la publicKey Linked proveniente de Identity
this.assetUserActorDao.updateAssetUserDAPConnectionStateOrCrpytoAddress(
actorAssetUser.getPublicKey(),
DAPConnectionState.REGISTERED_ONLINE,
actorAssetUser.getCryptoAddress());
} catch (CantUpdateAssetUserConnectionException e) {
e.printStackTrace();
}
System.out.println("***************************************************************");
} | [
"@",
"Override",
"public",
"void",
"handleCompleteClientAssetUserActorRegistrationNotificationEvent",
"(",
"ActorAssetUser",
"actorAssetUser",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"***************************************************************\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Actor Asset User se Registro \"",
"+",
"actorAssetUser",
".",
"getName",
"(",
")",
")",
";",
"try",
"{",
"//TODO Cambiar luego por la publicKey Linked proveniente de Identity",
"this",
".",
"assetUserActorDao",
".",
"updateAssetUserDAPConnectionStateOrCrpytoAddress",
"(",
"actorAssetUser",
".",
"getPublicKey",
"(",
")",
",",
"DAPConnectionState",
".",
"REGISTERED_ONLINE",
",",
"actorAssetUser",
".",
"getCryptoAddress",
"(",
")",
")",
";",
"}",
"catch",
"(",
"CantUpdateAssetUserConnectionException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"System",
".",
"out",
".",
"println",
"(",
"\"***************************************************************\"",
")",
";",
"}"
] | [
281,
4
] | [
295,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Gestor. | null | Metodo para verificar si esta vacia nuestro ArrayList | Metodo para verificar si esta vacia nuestro ArrayList | public boolean noEstaVacia() {
return (contador != -1);
} | [
"public",
"boolean",
"noEstaVacia",
"(",
")",
"{",
"return",
"(",
"contador",
"!=",
"-",
"1",
")",
";",
"}"
] | [
79,
4
] | [
81,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Validation. | null | Metodo para validar la cantidad a a pagar en pagos en linea | Metodo para validar la cantidad a a pagar en pagos en linea | public boolean lessThanOrEqualTo(BigDecimal txtPago, BigDecimal Totales){
boolean vFlag = false;
/*System.out.println(txtPago);
System.out.println("big decimal total"+Totales.setScale(2, RoundingMode.HALF_EVEN));
System.out.println("El pago introducido es mayor a la cantidad a pagar "+(txtPago.compareTo(Totales.setScale(2, RoundingMode.HALF_EVEN)) > 0));
System.out.println("El pago introducido es menor a la cantidad a pagar "+(txtPago.compareTo(Totales.setScale(2, RoundingMode.HALF_EVEN)) < 0));
System.out.println("El pago introducido es igual a la cantidad a pagar "+(txtPago.compareTo(new BigDecimal("0.01")) < 0));*/
if(txtPago.compareTo(Totales.setScale(2, RoundingMode.HALF_EVEN)) > 0 || txtPago.compareTo(new BigDecimal("0.01")) < 0 ){
vFlag = true;
}else if(txtPago.compareTo(Totales.setScale(2, RoundingMode.HALF_EVEN)) < 0) {
vFlag = false;
}
return vFlag;
} | [
"public",
"boolean",
"lessThanOrEqualTo",
"(",
"BigDecimal",
"txtPago",
",",
"BigDecimal",
"Totales",
")",
"{",
"boolean",
"vFlag",
"=",
"false",
";",
"/*System.out.println(txtPago);\n System.out.println(\"big decimal total\"+Totales.setScale(2, RoundingMode.HALF_EVEN));\n System.out.println(\"El pago introducido es mayor a la cantidad a pagar \"+(txtPago.compareTo(Totales.setScale(2, RoundingMode.HALF_EVEN)) > 0));\n System.out.println(\"El pago introducido es menor a la cantidad a pagar \"+(txtPago.compareTo(Totales.setScale(2, RoundingMode.HALF_EVEN)) < 0));\n System.out.println(\"El pago introducido es igual a la cantidad a pagar \"+(txtPago.compareTo(new BigDecimal(\"0.01\")) < 0));*/",
"if",
"(",
"txtPago",
".",
"compareTo",
"(",
"Totales",
".",
"setScale",
"(",
"2",
",",
"RoundingMode",
".",
"HALF_EVEN",
")",
")",
">",
"0",
"||",
"txtPago",
".",
"compareTo",
"(",
"new",
"BigDecimal",
"(",
"\"0.01\"",
")",
")",
"<",
"0",
")",
"{",
"vFlag",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"txtPago",
".",
"compareTo",
"(",
"Totales",
".",
"setScale",
"(",
"2",
",",
"RoundingMode",
".",
"HALF_EVEN",
")",
")",
"<",
"0",
")",
"{",
"vFlag",
"=",
"false",
";",
"}",
"return",
"vFlag",
";",
"}"
] | [
74,
4
] | [
87,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
GXConnection. | null | Metodos agregados en el JDK1.4 | Metodos agregados en el JDK1.4 | public void setHoldability(int x) throws SQLException
{
con.setHoldability(x);
} | [
"public",
"void",
"setHoldability",
"(",
"int",
"x",
")",
"throws",
"SQLException",
"{",
"con",
".",
"setHoldability",
"(",
"x",
")",
";",
"}"
] | [
1510,
1
] | [
1513,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Login. | null | Implementación método acerca de la App | Implementación método acerca de la App | public void acerca_app(View view){
i = new Intent(Login.this, SobreLaApp.class);
startActivity(i);
} | [
"public",
"void",
"acerca_app",
"(",
"View",
"view",
")",
"{",
"i",
"=",
"new",
"Intent",
"(",
"Login",
".",
"this",
",",
"SobreLaApp",
".",
"class",
")",
";",
"startActivity",
"(",
"i",
")",
";",
"}"
] | [
219,
4
] | [
222,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Triangulo. | null | los get solo se utilizan para mostrar el valor del atributo | los get solo se utilizan para mostrar el valor del atributo | public double getBase() {
return base;
} | [
"public",
"double",
"getBase",
"(",
")",
"{",
"return",
"base",
";",
"}"
] | [
40,
2
] | [
42,
3
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
NoticiasApiResource. | null | Método que devuelve todas las noticias del nombre de un determinado anime | Método que devuelve todas las noticias del nombre de un determinado anime | @GET
@Path("/titleAnime")
@Produces("application/json")
public Collection<Noticia> getAllNoticiasByTitle(@QueryParam("title") String title) {
Collection<Noticia> res = repository.getAnimeNoticiasByName(title);
if (res == null) {
throw new NotFoundException("No se encuentra ninguna noticia.");
}
return res;
} | [
"@",
"GET",
"@",
"Path",
"(",
"\"/titleAnime\"",
")",
"@",
"Produces",
"(",
"\"application/json\"",
")",
"public",
"Collection",
"<",
"Noticia",
">",
"getAllNoticiasByTitle",
"(",
"@",
"QueryParam",
"(",
"\"title\"",
")",
"String",
"title",
")",
"{",
"Collection",
"<",
"Noticia",
">",
"res",
"=",
"repository",
".",
"getAnimeNoticiasByName",
"(",
"title",
")",
";",
"if",
"(",
"res",
"==",
"null",
")",
"{",
"throw",
"new",
"NotFoundException",
"(",
"\"No se encuentra ninguna noticia.\"",
")",
";",
"}",
"return",
"res",
";",
"}"
] | [
55,
1
] | [
64,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
WalletManagerModulePluginRoot. | null | TODO: Analizar este metodo deberia reemplazarce por el metodo getInstalledWallets de la interface WalletManagerModule que ya esta implementado (Natalia) | TODO: Analizar este metodo deberia reemplazarce por el metodo getInstalledWallets de la interface WalletManagerModule que ya esta implementado (Natalia) | @Override
public List<InstalledWallet> getUserWallets() {
// Harcoded para testear el circuito más arriba
InstalledWallet installedWallet= new WalletManagerModuleInstalledWallet(WalletCategory.REFERENCE_WALLET,
WalletType.REFERENCE,
new ArrayList<InstalledSkin>(),
new ArrayList<InstalledLanguage>(),
"reference_wallet_icon",
"Bitcoin Wallet",
"reference_wallet",
"wallet_platform_identifier",
new Version(1,0,0)
);
List<InstalledWallet> lstInstalledWallet = new ArrayList<InstalledWallet>();
lstInstalledWallet.add(installedWallet);
return lstInstalledWallet;
} | [
"@",
"Override",
"public",
"List",
"<",
"InstalledWallet",
">",
"getUserWallets",
"(",
")",
"{",
"// Harcoded para testear el circuito más arriba",
"InstalledWallet",
"installedWallet",
"=",
"new",
"WalletManagerModuleInstalledWallet",
"(",
"WalletCategory",
".",
"REFERENCE_WALLET",
",",
"WalletType",
".",
"REFERENCE",
",",
"new",
"ArrayList",
"<",
"InstalledSkin",
">",
"(",
")",
",",
"new",
"ArrayList",
"<",
"InstalledLanguage",
">",
"(",
")",
",",
"\"reference_wallet_icon\"",
",",
"\"Bitcoin Wallet\"",
",",
"\"reference_wallet\"",
",",
"\"wallet_platform_identifier\"",
",",
"new",
"Version",
"(",
"1",
",",
"0",
",",
"0",
")",
")",
";",
"List",
"<",
"InstalledWallet",
">",
"lstInstalledWallet",
"=",
"new",
"ArrayList",
"<",
"InstalledWallet",
">",
"(",
")",
";",
"lstInstalledWallet",
".",
"add",
"(",
"installedWallet",
")",
";",
"return",
"lstInstalledWallet",
";",
"}"
] | [
454,
8
] | [
471,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ClaseBBDD. | null | Para el resto de procedencias: SELECT * FROM jugadores WHERE posicion LIKE ? AND procedencia = ? | Para el resto de procedencias: SELECT * FROM jugadores WHERE posicion LIKE ? AND procedencia = ? | public String selectJugadores(String procedencia, String posicion) throws SQLException {
//Nos conectamos a nuestra BBDD
Connection connect = conexion();
//Creamos un resultSet a partir de la query del statement
Statement st = connect.createStatement();
String query = "";
if (procedencia.equals("Todas")) {
query = "SELECT * FROM jugadores WHERE posicion LIKE '%" + posicion + "%'";
} else {
query = "SELECT * FROM jugadores WHERE posicion LIKE '%" + posicion + "%'" + " AND procedencia = '" + procedencia + "'";
}
ResultSet rs = st.executeQuery(query);
//Creamos un ArrayList, donde almacenaremos los results del resultSet
ArrayList<String> listaSelect = new ArrayList<String>();
while (rs.next()) {
String nombre = rs.getString(2);
procedencia = rs.getString(3);
posicion = rs.getString(6);
String fila = String.format("%-22s %-22s %-10s\n", nombre, procedencia, posicion); //formateamos los datos obtenidos del resultSet en filas
listaSelect.add(fila);
}
connect.close();
String resultado = String.format("%-22s %-22s %-10s\n", "NOMBRE", "PROCEDENCIA", "POSICION");
// Iterando, añadimos al string resultado, cada una de las líneas de nuestro arrayList
Iterator<String> iterator = listaSelect.iterator();
while (iterator.hasNext()) {
resultado += iterator.next();
}
return resultado;
} | [
"public",
"String",
"selectJugadores",
"(",
"String",
"procedencia",
",",
"String",
"posicion",
")",
"throws",
"SQLException",
"{",
"//Nos conectamos a nuestra BBDD\r",
"Connection",
"connect",
"=",
"conexion",
"(",
")",
";",
"//Creamos un resultSet a partir de la query del statement\r",
"Statement",
"st",
"=",
"connect",
".",
"createStatement",
"(",
")",
";",
"String",
"query",
"=",
"\"\"",
";",
"if",
"(",
"procedencia",
".",
"equals",
"(",
"\"Todas\"",
")",
")",
"{",
"query",
"=",
"\"SELECT * FROM jugadores WHERE posicion LIKE '%\"",
"+",
"posicion",
"+",
"\"%'\"",
";",
"}",
"else",
"{",
"query",
"=",
"\"SELECT * FROM jugadores WHERE posicion LIKE '%\"",
"+",
"posicion",
"+",
"\"%'\"",
"+",
"\" AND procedencia = '\"",
"+",
"procedencia",
"+",
"\"'\"",
";",
"}",
"ResultSet",
"rs",
"=",
"st",
".",
"executeQuery",
"(",
"query",
")",
";",
"//Creamos un ArrayList, donde almacenaremos los results del resultSet\r",
"ArrayList",
"<",
"String",
">",
"listaSelect",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"while",
"(",
"rs",
".",
"next",
"(",
")",
")",
"{",
"String",
"nombre",
"=",
"rs",
".",
"getString",
"(",
"2",
")",
";",
"procedencia",
"=",
"rs",
".",
"getString",
"(",
"3",
")",
";",
"posicion",
"=",
"rs",
".",
"getString",
"(",
"6",
")",
";",
"String",
"fila",
"=",
"String",
".",
"format",
"(",
"\"%-22s %-22s %-10s\\n\"",
",",
"nombre",
",",
"procedencia",
",",
"posicion",
")",
";",
"//formateamos los datos obtenidos del resultSet en filas\r",
"listaSelect",
".",
"add",
"(",
"fila",
")",
";",
"}",
"connect",
".",
"close",
"(",
")",
";",
"String",
"resultado",
"=",
"String",
".",
"format",
"(",
"\"%-22s %-22s %-10s\\n\"",
",",
"\"NOMBRE\"",
",",
"\"PROCEDENCIA\"",
",",
"\"POSICION\"",
")",
";",
"// Iterando, añadimos al string resultado, cada una de las líneas de nuestro arrayList\r",
"Iterator",
"<",
"String",
">",
"iterator",
"=",
"listaSelect",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"resultado",
"+=",
"iterator",
".",
"next",
"(",
")",
";",
"}",
"return",
"resultado",
";",
"}"
] | [
143,
3
] | [
182,
4
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
PromedioNotas. | null | 3) Hallar el promedio ajustado (descartar la peor de las notas) -> 0 a 5 (decimal) | 3) Hallar el promedio ajustado (descartar la peor de las notas) -> 0 a 5 (decimal) | public static double calcularPromedioAjustado(int nota1, int nota2, int nota3, int nota4, int nota5){
int peorNota = obtenerPeorNota(nota1, nota2, nota3, nota4, nota5);
int sumatoria = 0;
double promedioAjustado = 0;
sumatoria = (nota1+nota2+nota3+nota4+nota5)-peorNota;
promedioAjustado = (double)sumatoria/4;
return promedioAjustado;
} | [
"public",
"static",
"double",
"calcularPromedioAjustado",
"(",
"int",
"nota1",
",",
"int",
"nota2",
",",
"int",
"nota3",
",",
"int",
"nota4",
",",
"int",
"nota5",
")",
"{",
"int",
"peorNota",
"=",
"obtenerPeorNota",
"(",
"nota1",
",",
"nota2",
",",
"nota3",
",",
"nota4",
",",
"nota5",
")",
";",
"int",
"sumatoria",
"=",
"0",
";",
"double",
"promedioAjustado",
"=",
"0",
";",
"sumatoria",
"=",
"(",
"nota1",
"+",
"nota2",
"+",
"nota3",
"+",
"nota4",
"+",
"nota5",
")",
"-",
"peorNota",
";",
"promedioAjustado",
"=",
"(",
"double",
")",
"sumatoria",
"/",
"4",
";",
"return",
"promedioAjustado",
";",
"}"
] | [
46,
4
] | [
60,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Suma. | null | Creamos el metodo que nos va a hacer la suma | Creamos el metodo que nos va a hacer la suma | public void Operacion(){
r = v1+v2;
} | [
"public",
"void",
"Operacion",
"(",
")",
"{",
"r",
"=",
"v1",
"+",
"v2",
";",
"}"
] | [
14,
4
] | [
17,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
HiloCliente. | null | ejecución del hilo h | ejecución del hilo h | public void run() {
try {
System.out.println("Conexión con Servidor Ok: " + socketCliente.toString());
this.lblConexionCliente.setText(". . . . . . . . . . . . . . . . . . . . . conexión ON");
this.lblConexionCliente.setForeground(Color.decode("#00913f"));
this.btnConexionCliente.setEnabled(false);
recibir = new BufferedReader(new InputStreamReader(socketCliente.getInputStream()));
enviar = new PrintWriter(socketCliente.getOutputStream(), true);
/*vamos recibiendo desde el servidor el stock actulizado según se añadan o retiren Aguacates*/
while (!salir) {
txtConsultar.setText(recibir.readLine());
}
} catch (Exception ex) {
} finally {
try {
socketCliente.close();
System.out.println("Puerto de conexión cerrado");
} catch (Exception ex) {
}
}
} | [
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Conexión con Servidor Ok: \" ",
" ",
"ocketCliente.",
"t",
"oString(",
")",
")",
";",
"\r",
"this",
".",
"lblConexionCliente",
".",
"setText",
"(",
"\". . . . . . . . . . . . . . . . . . . . . conexión ON\")",
";",
"\r",
"this",
".",
"lblConexionCliente",
".",
"setForeground",
"(",
"Color",
".",
"decode",
"(",
"\"#00913f\"",
")",
")",
";",
"this",
".",
"btnConexionCliente",
".",
"setEnabled",
"(",
"false",
")",
";",
"recibir",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"socketCliente",
".",
"getInputStream",
"(",
")",
")",
")",
";",
"enviar",
"=",
"new",
"PrintWriter",
"(",
"socketCliente",
".",
"getOutputStream",
"(",
")",
",",
"true",
")",
";",
"/*vamos recibiendo desde el servidor el stock actulizado según se añadan o retiren Aguacates*/\r",
"while",
"(",
"!",
"salir",
")",
"{",
"txtConsultar",
".",
"setText",
"(",
"recibir",
".",
"readLine",
"(",
")",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"}",
"finally",
"{",
"try",
"{",
"socketCliente",
".",
"close",
"(",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Puerto de conexión cerrado\")",
";",
"\r",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"}",
"}",
"}"
] | [
65,
4
] | [
89,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
BitcoinCryptoVaultPluginRoot. | null | TODO Franklin, aqui falta la gestion de excepciones genericas | TODO Franklin, aqui falta la gestion de excepciones genericas | @Override
public void start() throws CantStartPluginException {
/**
* I get the userPublicKey from the deviceUserManager
*/
String userPublicKey;
try {
userPublicKey = deviceUserManager.getLoggedInDeviceUser().getPublicKey();
} catch (CantGetLoggedInDeviceUserException e) {
errorManager.reportUnexpectedPluginException(Plugins.BITDUBAI_BITCOIN_CRYPTO_VAULT, UnexpectedPluginExceptionSeverity.DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN, e);
throw new CantStartPluginException(CantStartPluginException.DEFAULT_MESSAGE, e, "Cant get LoggedIn Device User", "");
}
/**
* I will try to open the database first, if it doesn't exists, then I create it
*/
try {
database = pluginDatabaseSystem.openDatabase(pluginId, userPublicKey);
} catch (CantOpenDatabaseException e) {
/**
* The database could not be opened, let try to create it instead.
*/
try {
CryptoVaultDatabaseFactory cryptoVaultDatabaseFactory = new CryptoVaultDatabaseFactory();
cryptoVaultDatabaseFactory.setPluginDatabaseSystem(pluginDatabaseSystem);
cryptoVaultDatabaseFactory.setErrorManager(errorManager);
database = cryptoVaultDatabaseFactory.createDatabase(pluginId, userPublicKey);
} catch (CantCreateDatabaseException e1) {
/**
* something went wrong creating the db, I can't handle this.
*/
errorManager.reportUnexpectedPluginException(Plugins.BITDUBAI_BITCOIN_CRYPTO_VAULT, UnexpectedPluginExceptionSeverity.DISABLES_THIS_PLUGIN, e);
}
} catch (DatabaseNotFoundException e) {
/**
* The database doesn't exists, lets create it.
*/
try {
CryptoVaultDatabaseFactory cryptoVaultDatabaseFactory = new CryptoVaultDatabaseFactory();
cryptoVaultDatabaseFactory.setPluginDatabaseSystem(pluginDatabaseSystem);
cryptoVaultDatabaseFactory.setErrorManager(errorManager);
database = cryptoVaultDatabaseFactory.createDatabase(pluginId, userPublicKey);
} catch (CantCreateDatabaseException e1) {
/**
* something went wrong creating the db, I can't handle this.
*/
errorManager.reportUnexpectedPluginException(Plugins.BITDUBAI_BITCOIN_CRYPTO_VAULT, UnexpectedPluginExceptionSeverity.DISABLES_THIS_PLUGIN, e);
}
}
/**
* I will start the loading creation of the wallet from the user Id
*/
try {
vault = new BitcoinCryptoVault(
userPublicKey,
eventManager,
errorManager,
logManager,
pluginId,
pluginFileSystem,
database
);
vault.loadOrCreateVault();
/**
* Once the vault is loaded or created, I will connect it to Bitcoin network to recieve pending transactions
*/
try {
vault.connectVault();
} catch (CantConnectToBitcoinNetwork cantConnectToBitcoinNetwork) {
errorManager.reportUnexpectedPluginException(Plugins.BITDUBAI_BITCOIN_CRYPTO_VAULT, UnexpectedPluginExceptionSeverity.DISABLES_THIS_PLUGIN, cantConnectToBitcoinNetwork);
throw new CantStartPluginException("Error trying to start CryptoVault plugin.", cantConnectToBitcoinNetwork, null, "I couldn't connect to the Bitcoin network.");
}
} catch (CantCreateCryptoWalletException cantCreateCryptoWalletException ) {
/**
* If I couldnt create the Vault, I cant go on.
*/
errorManager.reportUnexpectedPluginException(Plugins.BITDUBAI_BITCOIN_CRYPTO_VAULT, UnexpectedPluginExceptionSeverity.DISABLES_THIS_PLUGIN, cantCreateCryptoWalletException );
throw new CantStartPluginException("Error trying to start CryptoVault plugin.", cantCreateCryptoWalletException, null, "Probably not enought space available to save the vault.");
}
/**
* now I will start the TransactionNotificationAgent to monitor
*/
transactionNotificationAgent = new TransactionNotificationAgent(eventManager, errorManager, logManager, database);
try {
transactionNotificationAgent.start();
} catch (CantStartAgentException cantStartAgentException ) {
/**
* If I couldn't start the agent, I still will continue with the vault
*/
errorManager.reportUnexpectedPluginException(Plugins.BITDUBAI_BITCOIN_CRYPTO_VAULT, UnexpectedPluginExceptionSeverity.DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN, cantStartAgentException );
}
// test method
//sendTestBitcoins();
/**
* the service is started.
*/
this.serviceStatus = ServiceStatus.STARTED;
logManager.log(BitcoinCryptoVaultPluginRoot.getLogLevelByClass(this.getClass().getName()), "CryptoVault started.", null, null);
} | [
"@",
"Override",
"public",
"void",
"start",
"(",
")",
"throws",
"CantStartPluginException",
"{",
"/**\n * I get the userPublicKey from the deviceUserManager\n */",
"String",
"userPublicKey",
";",
"try",
"{",
"userPublicKey",
"=",
"deviceUserManager",
".",
"getLoggedInDeviceUser",
"(",
")",
".",
"getPublicKey",
"(",
")",
";",
"}",
"catch",
"(",
"CantGetLoggedInDeviceUserException",
"e",
")",
"{",
"errorManager",
".",
"reportUnexpectedPluginException",
"(",
"Plugins",
".",
"BITDUBAI_BITCOIN_CRYPTO_VAULT",
",",
"UnexpectedPluginExceptionSeverity",
".",
"DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN",
",",
"e",
")",
";",
"throw",
"new",
"CantStartPluginException",
"(",
"CantStartPluginException",
".",
"DEFAULT_MESSAGE",
",",
"e",
",",
"\"Cant get LoggedIn Device User\"",
",",
"\"\"",
")",
";",
"}",
"/**\n * I will try to open the database first, if it doesn't exists, then I create it\n */",
"try",
"{",
"database",
"=",
"pluginDatabaseSystem",
".",
"openDatabase",
"(",
"pluginId",
",",
"userPublicKey",
")",
";",
"}",
"catch",
"(",
"CantOpenDatabaseException",
"e",
")",
"{",
"/**\n * The database could not be opened, let try to create it instead.\n */",
"try",
"{",
"CryptoVaultDatabaseFactory",
"cryptoVaultDatabaseFactory",
"=",
"new",
"CryptoVaultDatabaseFactory",
"(",
")",
";",
"cryptoVaultDatabaseFactory",
".",
"setPluginDatabaseSystem",
"(",
"pluginDatabaseSystem",
")",
";",
"cryptoVaultDatabaseFactory",
".",
"setErrorManager",
"(",
"errorManager",
")",
";",
"database",
"=",
"cryptoVaultDatabaseFactory",
".",
"createDatabase",
"(",
"pluginId",
",",
"userPublicKey",
")",
";",
"}",
"catch",
"(",
"CantCreateDatabaseException",
"e1",
")",
"{",
"/**\n * something went wrong creating the db, I can't handle this.\n */",
"errorManager",
".",
"reportUnexpectedPluginException",
"(",
"Plugins",
".",
"BITDUBAI_BITCOIN_CRYPTO_VAULT",
",",
"UnexpectedPluginExceptionSeverity",
".",
"DISABLES_THIS_PLUGIN",
",",
"e",
")",
";",
"}",
"}",
"catch",
"(",
"DatabaseNotFoundException",
"e",
")",
"{",
"/**\n * The database doesn't exists, lets create it.\n */",
"try",
"{",
"CryptoVaultDatabaseFactory",
"cryptoVaultDatabaseFactory",
"=",
"new",
"CryptoVaultDatabaseFactory",
"(",
")",
";",
"cryptoVaultDatabaseFactory",
".",
"setPluginDatabaseSystem",
"(",
"pluginDatabaseSystem",
")",
";",
"cryptoVaultDatabaseFactory",
".",
"setErrorManager",
"(",
"errorManager",
")",
";",
"database",
"=",
"cryptoVaultDatabaseFactory",
".",
"createDatabase",
"(",
"pluginId",
",",
"userPublicKey",
")",
";",
"}",
"catch",
"(",
"CantCreateDatabaseException",
"e1",
")",
"{",
"/**\n * something went wrong creating the db, I can't handle this.\n */",
"errorManager",
".",
"reportUnexpectedPluginException",
"(",
"Plugins",
".",
"BITDUBAI_BITCOIN_CRYPTO_VAULT",
",",
"UnexpectedPluginExceptionSeverity",
".",
"DISABLES_THIS_PLUGIN",
",",
"e",
")",
";",
"}",
"}",
"/**\n * I will start the loading creation of the wallet from the user Id\n */",
"try",
"{",
"vault",
"=",
"new",
"BitcoinCryptoVault",
"(",
"userPublicKey",
",",
"eventManager",
",",
"errorManager",
",",
"logManager",
",",
"pluginId",
",",
"pluginFileSystem",
",",
"database",
")",
";",
"vault",
".",
"loadOrCreateVault",
"(",
")",
";",
"/**\n * Once the vault is loaded or created, I will connect it to Bitcoin network to recieve pending transactions\n */",
"try",
"{",
"vault",
".",
"connectVault",
"(",
")",
";",
"}",
"catch",
"(",
"CantConnectToBitcoinNetwork",
"cantConnectToBitcoinNetwork",
")",
"{",
"errorManager",
".",
"reportUnexpectedPluginException",
"(",
"Plugins",
".",
"BITDUBAI_BITCOIN_CRYPTO_VAULT",
",",
"UnexpectedPluginExceptionSeverity",
".",
"DISABLES_THIS_PLUGIN",
",",
"cantConnectToBitcoinNetwork",
")",
";",
"throw",
"new",
"CantStartPluginException",
"(",
"\"Error trying to start CryptoVault plugin.\"",
",",
"cantConnectToBitcoinNetwork",
",",
"null",
",",
"\"I couldn't connect to the Bitcoin network.\"",
")",
";",
"}",
"}",
"catch",
"(",
"CantCreateCryptoWalletException",
"cantCreateCryptoWalletException",
")",
"{",
"/**\n * If I couldnt create the Vault, I cant go on.\n */",
"errorManager",
".",
"reportUnexpectedPluginException",
"(",
"Plugins",
".",
"BITDUBAI_BITCOIN_CRYPTO_VAULT",
",",
"UnexpectedPluginExceptionSeverity",
".",
"DISABLES_THIS_PLUGIN",
",",
"cantCreateCryptoWalletException",
")",
";",
"throw",
"new",
"CantStartPluginException",
"(",
"\"Error trying to start CryptoVault plugin.\"",
",",
"cantCreateCryptoWalletException",
",",
"null",
",",
"\"Probably not enought space available to save the vault.\"",
")",
";",
"}",
"/**\n * now I will start the TransactionNotificationAgent to monitor\n */",
"transactionNotificationAgent",
"=",
"new",
"TransactionNotificationAgent",
"(",
"eventManager",
",",
"errorManager",
",",
"logManager",
",",
"database",
")",
";",
"try",
"{",
"transactionNotificationAgent",
".",
"start",
"(",
")",
";",
"}",
"catch",
"(",
"CantStartAgentException",
"cantStartAgentException",
")",
"{",
"/**\n * If I couldn't start the agent, I still will continue with the vault\n */",
"errorManager",
".",
"reportUnexpectedPluginException",
"(",
"Plugins",
".",
"BITDUBAI_BITCOIN_CRYPTO_VAULT",
",",
"UnexpectedPluginExceptionSeverity",
".",
"DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN",
",",
"cantStartAgentException",
")",
";",
"}",
"// test method",
"//sendTestBitcoins();",
"/**\n * the service is started.\n */",
"this",
".",
"serviceStatus",
"=",
"ServiceStatus",
".",
"STARTED",
";",
"logManager",
".",
"log",
"(",
"BitcoinCryptoVaultPluginRoot",
".",
"getLogLevelByClass",
"(",
"this",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
",",
"\"CryptoVault started.\"",
",",
"null",
",",
"null",
")",
";",
"}"
] | [
200,
4
] | [
316,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
BuscarDatosUsuario. | null | Obtener usuario por id, usado en el controlador de amigos de usuario | Obtener usuario por id, usado en el controlador de amigos de usuario | public Usuario obtenerUsuarioId(int idUsu) {
Usuario usu = new Usuario();
usu = service.getUsuarioById(idUsu);
return usu;
} | [
"public",
"Usuario",
"obtenerUsuarioId",
"(",
"int",
"idUsu",
")",
"{",
"Usuario",
"usu",
"=",
"new",
"Usuario",
"(",
")",
";",
"usu",
"=",
"service",
".",
"getUsuarioById",
"(",
"idUsu",
")",
";",
"return",
"usu",
";",
"}"
] | [
41,
1
] | [
46,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
BaseMockControllerTest. | null | Metodos PruebaCondicionFisicaService por defecto | Metodos PruebaCondicionFisicaService por defecto | protected void givenPruebaCondicionFisicaService(PruebaCondicionFisica prueba) {
given(this.pruebaService.findById(any(Integer.class))).willReturn(Optional.of(prueba));
given(this.pruebaService.findByJugadorAndTipoPrueba(any(Jugador.class), any(TipoPrueba.class))).willReturn(Lists.newArrayList(prueba));
} | [
"protected",
"void",
"givenPruebaCondicionFisicaService",
"(",
"PruebaCondicionFisica",
"prueba",
")",
"{",
"given",
"(",
"this",
".",
"pruebaService",
".",
"findById",
"(",
"any",
"(",
"Integer",
".",
"class",
")",
")",
")",
".",
"willReturn",
"(",
"Optional",
".",
"of",
"(",
"prueba",
")",
")",
";",
"given",
"(",
"this",
".",
"pruebaService",
".",
"findByJugadorAndTipoPrueba",
"(",
"any",
"(",
"Jugador",
".",
"class",
")",
",",
"any",
"(",
"TipoPrueba",
".",
"class",
")",
")",
")",
".",
"willReturn",
"(",
"Lists",
".",
"newArrayList",
"(",
"prueba",
")",
")",
";",
"}"
] | [
390,
1
] | [
393,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ProductosApiResource. | null | Método que devuelve todos los productos del nombre de un determinado anime | Método que devuelve todos los productos del nombre de un determinado anime | @GET
@Path("/titleAnime")
@Produces("application/json")
public Collection<Producto> getAllProductosByTitle(@QueryParam("title") String title) {
Collection<Producto> res = repository.getAnimeProductosByName(title);
if (res == null) {
throw new NotFoundException("No se encuentra ningún producto.");
}
return res;
} | [
"@",
"GET",
"@",
"Path",
"(",
"\"/titleAnime\"",
")",
"@",
"Produces",
"(",
"\"application/json\"",
")",
"public",
"Collection",
"<",
"Producto",
">",
"getAllProductosByTitle",
"(",
"@",
"QueryParam",
"(",
"\"title\"",
")",
"String",
"title",
")",
"{",
"Collection",
"<",
"Producto",
">",
"res",
"=",
"repository",
".",
"getAnimeProductosByName",
"(",
"title",
")",
";",
"if",
"(",
"res",
"==",
"null",
")",
"{",
"throw",
"new",
"NotFoundException",
"(",
"\"No se encuentra ningún producto.\")",
";",
"",
"}",
"return",
"res",
";",
"}"
] | [
55,
1
] | [
64,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ControladorVistas. | null | Enlace a cola de llenado | Enlace a cola de llenado | public void setColaDeLlenado(ColaDeLlenado miColaDeLlenado) {
this.miColaDeLlenado = miColaDeLlenado;
} | [
"public",
"void",
"setColaDeLlenado",
"(",
"ColaDeLlenado",
"miColaDeLlenado",
")",
"{",
"this",
".",
"miColaDeLlenado",
"=",
"miColaDeLlenado",
";",
"}"
] | [
92,
4
] | [
94,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
RequerimientoNotas. | null | Armar el mensaje del requerimiento | Armar el mensaje del requerimiento | public static void generarMensajePromedio(String codigo, double promedioAjustado){
//4) Armar el mensaje de salida como se solicita en el requerimiento
System.out.println("El promedio ajustado del estudiante "+codigo+" es: "+promedioAjustado);
} | [
"public",
"static",
"void",
"generarMensajePromedio",
"(",
"String",
"codigo",
",",
"double",
"promedioAjustado",
")",
"{",
"//4) Armar el mensaje de salida como se solicita en el requerimiento",
"System",
".",
"out",
".",
"println",
"(",
"\"El promedio ajustado del estudiante \"",
"+",
"codigo",
"+",
"\" es: \"",
"+",
"promedioAjustado",
")",
";",
"}"
] | [
43,
4
] | [
46,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Cooldown. | null | Devueve el cooldown con un intervalo de tipo FloatSupplier | Devueve el cooldown con un intervalo de tipo FloatSupplier | public static Cooldown withInterval(FloatSupplier interval) {
return new Cooldown(interval);
} | [
"public",
"static",
"Cooldown",
"withInterval",
"(",
"FloatSupplier",
"interval",
")",
"{",
"return",
"new",
"Cooldown",
"(",
"interval",
")",
";",
"}"
] | [
43,
1
] | [
45,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
RutaAG. | null | Recibe dos arreglos, que deben contener los mismos elementos sin repetir. | Recibe dos arreglos, que deben contener los mismos elementos sin repetir. | public static int [] cruzaPorCX2(int [] dad, int [] mom ){
int [] son = new int [dad.length];
son [0] = mom [0];
int index = 1; // Inicia en 1 porque la posicion 0 ya contiene un valor.
int sonValue = son[0];
int counter;
while (index < son.length ){
counter = 1;
sonValue = mom[getIndex(dad,sonValue)]; // Primero optiene la pocision en el arreglo dad, jala el valor que se encuenta en esa posicion de mom, y lo asigna a sonValue.
while(contains(son,sonValue,index)){ // Si sonValue ya se encuentra en el arreglo, busca un valor que no lo contenga.
sonValue= mom[getIndex(dad,dad[counter])];
counter++;
}
son[index] = sonValue; // asigna el valor en la posicion actual del indice.
index+=1;
}
return son;
} | [
"public",
"static",
"int",
"[",
"]",
"cruzaPorCX2",
"(",
"int",
"[",
"]",
"dad",
",",
"int",
"[",
"]",
"mom",
")",
"{",
"int",
"[",
"]",
"son",
"=",
"new",
"int",
"[",
"dad",
".",
"length",
"]",
";",
"son",
"[",
"0",
"]",
"=",
"mom",
"[",
"0",
"]",
";",
"int",
"index",
"=",
"1",
";",
"// Inicia en 1 porque la posicion 0 ya contiene un valor.\r",
"int",
"sonValue",
"=",
"son",
"[",
"0",
"]",
";",
"int",
"counter",
";",
"while",
"(",
"index",
"<",
"son",
".",
"length",
")",
"{",
"counter",
"=",
"1",
";",
"sonValue",
"=",
"mom",
"[",
"getIndex",
"(",
"dad",
",",
"sonValue",
")",
"]",
";",
"// Primero optiene la pocision en el arreglo dad, jala el valor que se encuenta en esa posicion de mom, y lo asigna a sonValue.\r",
"while",
"(",
"contains",
"(",
"son",
",",
"sonValue",
",",
"index",
")",
")",
"{",
"// Si sonValue ya se encuentra en el arreglo, busca un valor que no lo contenga.\r",
"sonValue",
"=",
"mom",
"[",
"getIndex",
"(",
"dad",
",",
"dad",
"[",
"counter",
"]",
")",
"]",
";",
"counter",
"++",
";",
"}",
"son",
"[",
"index",
"]",
"=",
"sonValue",
";",
"// asigna el valor en la posicion actual del indice.\r",
"index",
"+=",
"1",
";",
"}",
"return",
"son",
";",
"}"
] | [
77,
4
] | [
95,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
DeviceTest. | null | CP2: Cuando indicamos que un dispositivo se debe apagar, el dispositivo debe quedar apagado. | CP2: Cuando indicamos que un dispositivo se debe apagar, el dispositivo debe quedar apagado. | @Test
public void Given_A_Device_When_TurnOff_Method_Is_Called_Then_The_Device_Is_TurnOff() {
//When
device.turnOff();
//Then
assertFalse(device.getTurnedOn());
} | [
"@",
"Test",
"public",
"void",
"Given_A_Device_When_TurnOff_Method_Is_Called_Then_The_Device_Is_TurnOff",
"(",
")",
"{",
"//When",
"device",
".",
"turnOff",
"(",
")",
";",
"//Then",
"assertFalse",
"(",
"device",
".",
"getTurnedOn",
"(",
")",
")",
";",
"}"
] | [
30,
4
] | [
37,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
BaseDeDatos. | null | Mostrar algun todos los registros sin llamar. | Mostrar algun todos los registros sin llamar. | public String[][] consultarRegistrosSinLlamar(String tipoLugar, int numero) {
try {
//Crea un objeto SQLServerStatement que genera objetos.
Statement consulta = conexion.createStatement();
String SQL;
String SQLCant;
//Consulta sacar cod_lugar.
ResultSet lugar = consulta.executeQuery("SELECT COD_LUGAR FROM LUGAR WHERE TIPO_LUGAR = '" + tipoLugar + "' AND NUMERO_LUGAR = " + numero);
while (lugar.next()) {
cod_lugar = lugar.getInt("COD_LUGAR");
}
if (tipoLugar.equals("ASESOR")) {
SQL = "SELECT * FROM REGISTRO where registro.llamado = 'false' and fecha_registro = to_date(SYSDATE, 'dd/mm/yy') and motivo_consulta like '%Consulta Asesor%'";
SQLCant = "SELECT count(*) FROM REGISTRO where registro.llamado = 'false' and fecha_registro = to_date(SYSDATE, 'dd/mm/yy') and motivo_consulta like '%Consulta Asesor%'";
} else {
SQL = "SELECT * FROM REGISTRO where registro.llamado = 'false' and fecha_registro = to_date(SYSDATE, 'dd/mm/yy') and motivo_consulta not like '%Consulta Asesor%'";
SQLCant = "SELECT count(*) FROM REGISTRO where registro.llamado = 'false' and fecha_registro = to_date(SYSDATE, 'dd/mm/yy') and motivo_consulta not like '%Consulta Asesor%'";
}
//Hacemos una consulta para guardar la cantidad de filas en la tabla registro.
ResultSet cantidadFilas = consulta.executeQuery(SQLCant);
//guardamos el dato obtenido de la base de datos
while (cantidadFilas.next()) {
cant = cantidadFilas.getInt("count(*)");
}
System.out.println("Cantidad: " + cant); //Debug de la cantidad.
//Creamos un vector de dos dimensiones con la cantidad de filas y columnas ya establecidas
String[][] consultaArray = new String[cant][6];
int num = 0;
//Obtiene el resultado de la busqueda de todos las filas de la base de datos.
ResultSet resultado = consulta.executeQuery(SQL);
System.out.println(SQL);
//En cada registro seleccionado asignamos sus valores dentro del vector consultaArray-
while (resultado.next()) {
consultaArray[num][0] = resultado.getString("cod_registro");
consultaArray[num][1] = resultado.getString("cod_lugar");
consultaArray[num][2] = resultado.getString("hora_llegada");
consultaArray[num][3] = resultado.getString("turno");
consultaArray[num][4] = resultado.getString("motivo_consulta");
consultaArray[num][5] = resultado.getString("tipo_usuario");
num++;//Sumar para empezar por la siguiente fila
}
System.out.println("El numero llego hasta: " + num); //Debug del numero.
num = 0; //Asignamos el numero de nuevo a 0.
return consultaArray;
} catch (Exception ex) {
//DO SOMETHING
return null; //No retornamos ningun valor.
}
} | [
"public",
"String",
"[",
"]",
"[",
"]",
"consultarRegistrosSinLlamar",
"(",
"String",
"tipoLugar",
",",
"int",
"numero",
")",
"{",
"try",
"{",
"//Crea un objeto SQLServerStatement que genera objetos.",
"Statement",
"consulta",
"=",
"conexion",
".",
"createStatement",
"(",
")",
";",
"String",
"SQL",
";",
"String",
"SQLCant",
";",
"//Consulta sacar cod_lugar.",
"ResultSet",
"lugar",
"=",
"consulta",
".",
"executeQuery",
"(",
"\"SELECT COD_LUGAR FROM LUGAR WHERE TIPO_LUGAR = '\"",
"+",
"tipoLugar",
"+",
"\"' AND NUMERO_LUGAR = \"",
"+",
"numero",
")",
";",
"while",
"(",
"lugar",
".",
"next",
"(",
")",
")",
"{",
"cod_lugar",
"=",
"lugar",
".",
"getInt",
"(",
"\"COD_LUGAR\"",
")",
";",
"}",
"if",
"(",
"tipoLugar",
".",
"equals",
"(",
"\"ASESOR\"",
")",
")",
"{",
"SQL",
"=",
"\"SELECT * FROM REGISTRO where registro.llamado = 'false' and fecha_registro = to_date(SYSDATE, 'dd/mm/yy') and motivo_consulta like '%Consulta Asesor%'\"",
";",
"SQLCant",
"=",
"\"SELECT count(*) FROM REGISTRO where registro.llamado = 'false' and fecha_registro = to_date(SYSDATE, 'dd/mm/yy') and motivo_consulta like '%Consulta Asesor%'\"",
";",
"}",
"else",
"{",
"SQL",
"=",
"\"SELECT * FROM REGISTRO where registro.llamado = 'false' and fecha_registro = to_date(SYSDATE, 'dd/mm/yy') and motivo_consulta not like '%Consulta Asesor%'\"",
";",
"SQLCant",
"=",
"\"SELECT count(*) FROM REGISTRO where registro.llamado = 'false' and fecha_registro = to_date(SYSDATE, 'dd/mm/yy') and motivo_consulta not like '%Consulta Asesor%'\"",
";",
"}",
"//Hacemos una consulta para guardar la cantidad de filas en la tabla registro.",
"ResultSet",
"cantidadFilas",
"=",
"consulta",
".",
"executeQuery",
"(",
"SQLCant",
")",
";",
"//guardamos el dato obtenido de la base de datos",
"while",
"(",
"cantidadFilas",
".",
"next",
"(",
")",
")",
"{",
"cant",
"=",
"cantidadFilas",
".",
"getInt",
"(",
"\"count(*)\"",
")",
";",
"}",
"System",
".",
"out",
".",
"println",
"(",
"\"Cantidad: \"",
"+",
"cant",
")",
";",
"//Debug de la cantidad.",
"//Creamos un vector de dos dimensiones con la cantidad de filas y columnas ya establecidas",
"String",
"[",
"]",
"[",
"]",
"consultaArray",
"=",
"new",
"String",
"[",
"cant",
"]",
"[",
"6",
"]",
";",
"int",
"num",
"=",
"0",
";",
"//Obtiene el resultado de la busqueda de todos las filas de la base de datos.",
"ResultSet",
"resultado",
"=",
"consulta",
".",
"executeQuery",
"(",
"SQL",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"SQL",
")",
";",
"//En cada registro seleccionado asignamos sus valores dentro del vector consultaArray-",
"while",
"(",
"resultado",
".",
"next",
"(",
")",
")",
"{",
"consultaArray",
"[",
"num",
"]",
"[",
"0",
"]",
"=",
"resultado",
".",
"getString",
"(",
"\"cod_registro\"",
")",
";",
"consultaArray",
"[",
"num",
"]",
"[",
"1",
"]",
"=",
"resultado",
".",
"getString",
"(",
"\"cod_lugar\"",
")",
";",
"consultaArray",
"[",
"num",
"]",
"[",
"2",
"]",
"=",
"resultado",
".",
"getString",
"(",
"\"hora_llegada\"",
")",
";",
"consultaArray",
"[",
"num",
"]",
"[",
"3",
"]",
"=",
"resultado",
".",
"getString",
"(",
"\"turno\"",
")",
";",
"consultaArray",
"[",
"num",
"]",
"[",
"4",
"]",
"=",
"resultado",
".",
"getString",
"(",
"\"motivo_consulta\"",
")",
";",
"consultaArray",
"[",
"num",
"]",
"[",
"5",
"]",
"=",
"resultado",
".",
"getString",
"(",
"\"tipo_usuario\"",
")",
";",
"num",
"++",
";",
"//Sumar para empezar por la siguiente fila",
"}",
"System",
".",
"out",
".",
"println",
"(",
"\"El numero llego hasta: \"",
"+",
"num",
")",
";",
"//Debug del numero.",
"num",
"=",
"0",
";",
"//Asignamos el numero de nuevo a 0.",
"return",
"consultaArray",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"//DO SOMETHING",
"return",
"null",
";",
"//No retornamos ningun valor.",
"}",
"}"
] | [
220,
4
] | [
273,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CacheValue. | null | Setea el tiempo de expiración (en segundos)
o 0 para indicar que no expira por tiempo
| Setea el tiempo de expiración (en segundos)
o 0 para indicar que no expira por tiempo
| public void setExpiryTime(int expiryTimeSeconds)
{
this.expiryTime = expiryTimeSeconds;
} | [
"public",
"void",
"setExpiryTime",
"(",
"int",
"expiryTimeSeconds",
")",
"{",
"this",
".",
"expiryTime",
"=",
"expiryTimeSeconds",
";",
"}"
] | [
51,
1
] | [
54,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
PreguntaTest. | null | El siguiente test es para aumentar el test coverage | El siguiente test es para aumentar el test coverage | @Test
public void test01GetConsignaFunciona () {
Opcion opcionCorrectaUno = new Opcion("Seeee");
Opcion opcionCorrectaDos = new Opcion("Clarin");
Opcion opcionCorrectaTres = new Opcion("Por su pollo");
Opcion opcionIncorrecta = new Opcion("Nop");
ArrayList<Opcion> opcionesApresentar = new ArrayList<>();
opcionesApresentar.add(opcionCorrectaUno);
opcionesApresentar.add(opcionCorrectaDos);
opcionesApresentar.add(opcionCorrectaTres);
opcionesApresentar.add(opcionIncorrecta);
ArrayList<Opcion> opcionesCorrectas = new ArrayList<>();
opcionesCorrectas.add(opcionCorrectaUno);
opcionesCorrectas.add(opcionCorrectaDos);
opcionesCorrectas.add(opcionCorrectaTres);
ListaOpcionesParaPregunta listaOpcionesParaPregunta = new ListaOpcionesParaPregunta(opcionesApresentar,opcionesCorrectas);
Pregunta unaPregunta = new Pregunta("¿Es bueno Hacer Tests?",new PreguntaMultipleChoice(), listaOpcionesParaPregunta);
assertEquals("¿Es bueno Hacer Tests?", unaPregunta.getConsigna());
} | [
"@",
"Test",
"public",
"void",
"test01GetConsignaFunciona",
"(",
")",
"{",
"Opcion",
"opcionCorrectaUno",
"=",
"new",
"Opcion",
"(",
"\"Seeee\"",
")",
";",
"Opcion",
"opcionCorrectaDos",
"=",
"new",
"Opcion",
"(",
"\"Clarin\"",
")",
";",
"Opcion",
"opcionCorrectaTres",
"=",
"new",
"Opcion",
"(",
"\"Por su pollo\"",
")",
";",
"Opcion",
"opcionIncorrecta",
"=",
"new",
"Opcion",
"(",
"\"Nop\"",
")",
";",
"ArrayList",
"<",
"Opcion",
">",
"opcionesApresentar",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"opcionesApresentar",
".",
"add",
"(",
"opcionCorrectaUno",
")",
";",
"opcionesApresentar",
".",
"add",
"(",
"opcionCorrectaDos",
")",
";",
"opcionesApresentar",
".",
"add",
"(",
"opcionCorrectaTres",
")",
";",
"opcionesApresentar",
".",
"add",
"(",
"opcionIncorrecta",
")",
";",
"ArrayList",
"<",
"Opcion",
">",
"opcionesCorrectas",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"opcionesCorrectas",
".",
"add",
"(",
"opcionCorrectaUno",
")",
";",
"opcionesCorrectas",
".",
"add",
"(",
"opcionCorrectaDos",
")",
";",
"opcionesCorrectas",
".",
"add",
"(",
"opcionCorrectaTres",
")",
";",
"ListaOpcionesParaPregunta",
"listaOpcionesParaPregunta",
"=",
"new",
"ListaOpcionesParaPregunta",
"(",
"opcionesApresentar",
",",
"opcionesCorrectas",
")",
";",
"Pregunta",
"unaPregunta",
"=",
"new",
"Pregunta",
"(",
"\"¿Es bueno Hacer Tests?\",",
"n",
"ew ",
"reguntaMultipleChoice(",
")",
",",
" ",
"istaOpcionesParaPregunta)",
";",
"",
"assertEquals",
"(",
"\"¿Es bueno Hacer Tests?\",",
" ",
"naPregunta.",
"g",
"etConsigna(",
")",
")",
";",
"",
"}"
] | [
12,
4
] | [
35,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
JDBCUtilities. | null | Función para validar si estamos en una base de datos vacía -> SQLite | Función para validar si estamos en una base de datos vacía -> SQLite | public static boolean estaVacia(){
File archivo = new File(JDBCUtilities.UBICACION_BD);
//Salida de diagnóstico
System.out.println("Líneas identificadas: "+archivo.length());
return archivo.length() == 0;
} | [
"public",
"static",
"boolean",
"estaVacia",
"(",
")",
"{",
"File",
"archivo",
"=",
"new",
"File",
"(",
"JDBCUtilities",
".",
"UBICACION_BD",
")",
";",
"//Salida de diagnóstico",
"System",
".",
"out",
".",
"println",
"(",
"\"Líneas identificadas: \"+",
"a",
"rchivo.",
"l",
"ength(",
")",
")",
";",
"",
"return",
"archivo",
".",
"length",
"(",
")",
"==",
"0",
";",
"}"
] | [
23,
4
] | [
30,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CrudProducto. | null | Es un getLista pero se suele tener un buscar todos independiente | Es un getLista pero se suele tener un buscar todos independiente | public Producto [] findAll() {
return lista;
} | [
"public",
"Producto",
"[",
"]",
"findAll",
"(",
")",
"{",
"return",
"lista",
";",
"}"
] | [
108,
1
] | [
110,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
FotosController. | null | Metodos propios ------------------------------------------------ | Metodos propios ------------------------------------------------ | @CrossOrigin(origins = "http://localhost:4200")
@GetMapping("/getFotosUsuario/{idUsu}")
public ResponseEntity<List<Fotos>> getFotosUsuario(@PathVariable Integer idUsu) {
ArrayList<Fotos> listaFotos = new ArrayList<Fotos>();
listaFotos = (ArrayList<Fotos>) service.findFotosUsuario(idUsu);
listaFotos = quitarListas(listaFotos);
return new ResponseEntity<List<Fotos>>(listaFotos, HttpStatus.OK);
} | [
"@",
"CrossOrigin",
"(",
"origins",
"=",
"\"http://localhost:4200\"",
")",
"@",
"GetMapping",
"(",
"\"/getFotosUsuario/{idUsu}\"",
")",
"public",
"ResponseEntity",
"<",
"List",
"<",
"Fotos",
">",
">",
"getFotosUsuario",
"(",
"@",
"PathVariable",
"Integer",
"idUsu",
")",
"{",
"ArrayList",
"<",
"Fotos",
">",
"listaFotos",
"=",
"new",
"ArrayList",
"<",
"Fotos",
">",
"(",
")",
";",
"listaFotos",
"=",
"(",
"ArrayList",
"<",
"Fotos",
">",
")",
"service",
".",
"findFotosUsuario",
"(",
"idUsu",
")",
";",
"listaFotos",
"=",
"quitarListas",
"(",
"listaFotos",
")",
";",
"return",
"new",
"ResponseEntity",
"<",
"List",
"<",
"Fotos",
">",
">",
"(",
"listaFotos",
",",
"HttpStatus",
".",
"OK",
")",
";",
"}"
] | [
357,
1
] | [
366,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Mesa. | null | Calcula el numero de cartas del monton exterior | Calcula el numero de cartas del monton exterior | public int getNumCartasMontonExterior(){
int num = 0;
for(int i = 0; i < montonExterior.length; i++){
num += montonExterior[i].size();
}
return num;
} | [
"public",
"int",
"getNumCartasMontonExterior",
"(",
")",
"{",
"int",
"num",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"montonExterior",
".",
"length",
";",
"i",
"++",
")",
"{",
"num",
"+=",
"montonExterior",
"[",
"i",
"]",
".",
"size",
"(",
")",
";",
"}",
"return",
"num",
";",
"}"
] | [
72,
4
] | [
80,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
MainActivity. | null | Estos metodos se encargaran del sonido al salirse de la app. | Estos metodos se encargaran del sonido al salirse de la app. | @Override
protected void onPause() {
super.onPause();
if(mediaPlayer.isPlaying() && !mute){
mediaPlayer.pause();
length = mediaPlayer.getCurrentPosition();
}
} | [
"@",
"Override",
"protected",
"void",
"onPause",
"(",
")",
"{",
"super",
".",
"onPause",
"(",
")",
";",
"if",
"(",
"mediaPlayer",
".",
"isPlaying",
"(",
")",
"&&",
"!",
"mute",
")",
"{",
"mediaPlayer",
".",
"pause",
"(",
")",
";",
"length",
"=",
"mediaPlayer",
".",
"getCurrentPosition",
"(",
")",
";",
"}",
"}"
] | [
142,
4
] | [
150,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
DatosGuardados. | null | metodo para el boton regresar | metodo para el boton regresar | public void Regresar(View Regresar){
Intent volver = new Intent(this, MainActivity.class);
startActivity(volver);
} | [
"public",
"void",
"Regresar",
"(",
"View",
"Regresar",
")",
"{",
"Intent",
"volver",
"=",
"new",
"Intent",
"(",
"this",
",",
"MainActivity",
".",
"class",
")",
";",
"startActivity",
"(",
"volver",
")",
";",
"}"
] | [
26,
4
] | [
29,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Materia. | null | Calcular el promedio ajustado | Calcular el promedio ajustado | public void calcularPromedioAjustado(){
//Obtener peor nota
this.obtenerPeorNota();
//Recorrer las notas para obtener la sumatoria
double sumatoria = 0;
for (Nota nota : notasQuizes) {
sumatoria += nota.getEscala5();
}
//this.promedioAjustado = Math.round((sumatoria - this.peorNota.getEscala5()) / (this.notasQuizes.size()-1));
this.promedioAjustado = (sumatoria - this.peorNota.getEscala5()) / (this.notasQuizes.size()-1);
} | [
"public",
"void",
"calcularPromedioAjustado",
"(",
")",
"{",
"//Obtener peor nota",
"this",
".",
"obtenerPeorNota",
"(",
")",
";",
"//Recorrer las notas para obtener la sumatoria",
"double",
"sumatoria",
"=",
"0",
";",
"for",
"(",
"Nota",
"nota",
":",
"notasQuizes",
")",
"{",
"sumatoria",
"+=",
"nota",
".",
"getEscala5",
"(",
")",
";",
"}",
"//this.promedioAjustado = Math.round((sumatoria - this.peorNota.getEscala5()) / (this.notasQuizes.size()-1)); ",
"this",
".",
"promedioAjustado",
"=",
"(",
"sumatoria",
"-",
"this",
".",
"peorNota",
".",
"getEscala5",
"(",
")",
")",
"/",
"(",
"this",
".",
"notasQuizes",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"}"
] | [
44,
4
] | [
57,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CrudLimpieza. | null | Buscar todos los productos por nombre de forma clásica | Buscar todos los productos por nombre de forma clásica | public List<ProductosLimpieza> buscarProductos(String nombre) {
List<ProductosLimpieza> temp = new ArrayList<ProductosLimpieza>();
for (int i = 0; i < stockLimpieza.size(); i++) {
if (stockLimpieza.get(i).getNombre().equalsIgnoreCase(nombre))
temp.add(stockLimpieza.get(i));
}
return temp;
} | [
"public",
"List",
"<",
"ProductosLimpieza",
">",
"buscarProductos",
"(",
"String",
"nombre",
")",
"{",
"List",
"<",
"ProductosLimpieza",
">",
"temp",
"=",
"new",
"ArrayList",
"<",
"ProductosLimpieza",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"stockLimpieza",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"stockLimpieza",
".",
"get",
"(",
"i",
")",
".",
"getNombre",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"nombre",
")",
")",
"temp",
".",
"add",
"(",
"stockLimpieza",
".",
"get",
"(",
"i",
")",
")",
";",
"}",
"return",
"temp",
";",
"}"
] | [
75,
1
] | [
83,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
WifiCommunicationPluginRoot. | null | recibe prefijo de red y retorna mask de la red | recibe prefijo de red y retorna mask de la red | private static InetAddress getIPv4LocalNetMask(InetAddress ip, int netPrefix) {
try {
// Since this is for IPv4, it's 32 bits, so set the sign value of
// the int to "negative"...
int shiftby = (1<<31);
// For the number of bits of the prefix -1 (we already set the sign bit)
for (int i=netPrefix-1; i>0; i--) {
// Shift the sign right... Java makes the sign bit sticky on a shift...
// So no need to "set it back up"...
shiftby = (shiftby >> 1);
}
// Transform the resulting value in xxx.xxx.xxx.xxx format, like if
/// it was a standard address...
String maskString = Integer.toString((shiftby >> 24) & 255) + "." + Integer.toString((shiftby >> 16) & 255) + "." + Integer.toString((shiftby >> 8) & 255) + "." + Integer.toString(shiftby & 255);
// Return the address thus created...
return InetAddress.getByName(maskString);
}
catch(Exception e){
e.printStackTrace();
}
// Something went wrong here...
return null;
} | [
"private",
"static",
"InetAddress",
"getIPv4LocalNetMask",
"(",
"InetAddress",
"ip",
",",
"int",
"netPrefix",
")",
"{",
"try",
"{",
"// Since this is for IPv4, it's 32 bits, so set the sign value of",
"// the int to \"negative\"...",
"int",
"shiftby",
"=",
"(",
"1",
"<<",
"31",
")",
";",
"// For the number of bits of the prefix -1 (we already set the sign bit)",
"for",
"(",
"int",
"i",
"=",
"netPrefix",
"-",
"1",
";",
"i",
">",
"0",
";",
"i",
"--",
")",
"{",
"// Shift the sign right... Java makes the sign bit sticky on a shift...",
"// So no need to \"set it back up\"...",
"shiftby",
"=",
"(",
"shiftby",
">>",
"1",
")",
";",
"}",
"// Transform the resulting value in xxx.xxx.xxx.xxx format, like if",
"/// it was a standard address...",
"String",
"maskString",
"=",
"Integer",
".",
"toString",
"(",
"(",
"shiftby",
">>",
"24",
")",
"&",
"255",
")",
"+",
"\".\"",
"+",
"Integer",
".",
"toString",
"(",
"(",
"shiftby",
">>",
"16",
")",
"&",
"255",
")",
"+",
"\".\"",
"+",
"Integer",
".",
"toString",
"(",
"(",
"shiftby",
">>",
"8",
")",
"&",
"255",
")",
"+",
"\".\"",
"+",
"Integer",
".",
"toString",
"(",
"shiftby",
"&",
"255",
")",
";",
"// Return the address thus created...",
"return",
"InetAddress",
".",
"getByName",
"(",
"maskString",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"// Something went wrong here...",
"return",
"null",
";",
"}"
] | [
450,
1
] | [
475,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
BoxPhysicsSystem. | null | Agrega el oyente de contacto a la lista de oyentes | Agrega el oyente de contacto a la lista de oyentes | public void register(BoxContactListener contactListener) {
contactListeners.add(contactListener);
} | [
"public",
"void",
"register",
"(",
"BoxContactListener",
"contactListener",
")",
"{",
"contactListeners",
".",
"add",
"(",
"contactListener",
")",
";",
"}"
] | [
40,
1
] | [
42,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
SlideController. | null | /*listado de slides con la imagen y el orden del mismo | /*listado de slides con la imagen y el orden del mismo | @GetMapping
public List<Slide> listSlides(){
return slideService.listSlides();
} | [
"@",
"GetMapping",
"public",
"List",
"<",
"Slide",
">",
"listSlides",
"(",
")",
"{",
"return",
"slideService",
".",
"listSlides",
"(",
")",
";",
"}"
] | [
21,
4
] | [
24,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
InterfazGrafica. | null | Se puede incluir el main en la clase | Se puede incluir el main en la clase | public static void main (String args[]) throws ClassNotFoundException, SQLException{
String driver = "oracle.jdbc.driver.OracleDriver";
String ip = "";
String usuario = "";
String password = "";
// Leer la ip, el usuario y la contraseña del fichero config.dat y
Scanner readConfig = null;
try {
readConfig = new Scanner(new File("config.dat"));
while(readConfig.hasNextLine()){
usuario = readConfig.nextLine();
password = readConfig.nextLine();
ip = readConfig.nextLine();
}
} catch (FileNotFoundException e) {
System.out.println("Archivo no encontrado " + e.getMessage());
}
readConfig.close();
String url = "jdbc:oracle:thin:@" + ip + ":1521:xe";
ClaseBBDD miBBDD = new ClaseBBDD(driver, url, usuario, password);
InterfazGrafica gui = new InterfazGrafica(miBBDD);
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"args",
"[",
"]",
")",
"throws",
"ClassNotFoundException",
",",
"SQLException",
"{",
"String",
"driver",
"=",
"\"oracle.jdbc.driver.OracleDriver\"",
";",
"String",
"ip",
"=",
"\"\"",
";",
"String",
"usuario",
"=",
"\"\"",
";",
"String",
"password",
"=",
"\"\"",
";",
"// Leer la ip, el usuario y la contraseña del fichero config.dat y\r",
"Scanner",
"readConfig",
"=",
"null",
";",
"try",
"{",
"readConfig",
"=",
"new",
"Scanner",
"(",
"new",
"File",
"(",
"\"config.dat\"",
")",
")",
";",
"while",
"(",
"readConfig",
".",
"hasNextLine",
"(",
")",
")",
"{",
"usuario",
"=",
"readConfig",
".",
"nextLine",
"(",
")",
";",
"password",
"=",
"readConfig",
".",
"nextLine",
"(",
")",
";",
"ip",
"=",
"readConfig",
".",
"nextLine",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"FileNotFoundException",
"e",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Archivo no encontrado \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"readConfig",
".",
"close",
"(",
")",
";",
"String",
"url",
"=",
"\"jdbc:oracle:thin:@\"",
"+",
"ip",
"+",
"\":1521:xe\"",
";",
"ClaseBBDD",
"miBBDD",
"=",
"new",
"ClaseBBDD",
"(",
"driver",
",",
"url",
",",
"usuario",
",",
"password",
")",
";",
"InterfazGrafica",
"gui",
"=",
"new",
"InterfazGrafica",
"(",
"miBBDD",
")",
";",
"}"
] | [
24,
3
] | [
51,
4
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
InventarioBBDD. | null | Metodo de consulta a la base de datos | Metodo de consulta a la base de datos | @Override
public int numeroProductos(String tienda, String producto) {
return BBDD.stocs.get(tienda).get(producto);
} | [
"@",
"Override",
"public",
"int",
"numeroProductos",
"(",
"String",
"tienda",
",",
"String",
"producto",
")",
"{",
"return",
"BBDD",
".",
"stocs",
".",
"get",
"(",
"tienda",
")",
".",
"get",
"(",
"producto",
")",
";",
"}"
] | [
7,
1
] | [
10,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CrudLimpieza. | null | buscar producto cuyo string contenga parcialmente el nombre dado con stream | buscar producto cuyo string contenga parcialmente el nombre dado con stream | public Stream<ProductosLimpieza> buscarProductosContienenStream(String nombre) {
return stockLimpieza
.parallelStream() //Otra forma de generar un stream en paralelo.
.filter(x -> x.getNombre().toUpperCase().contains(nombre.toUpperCase()));
} | [
"public",
"Stream",
"<",
"ProductosLimpieza",
">",
"buscarProductosContienenStream",
"(",
"String",
"nombre",
")",
"{",
"return",
"stockLimpieza",
".",
"parallelStream",
"(",
")",
"//Otra forma de generar un stream en paralelo.",
".",
"filter",
"(",
"x",
"->",
"x",
".",
"getNombre",
"(",
")",
".",
"toUpperCase",
"(",
")",
".",
"contains",
"(",
"nombre",
".",
"toUpperCase",
"(",
")",
")",
")",
";",
"}"
] | [
110,
1
] | [
114,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Registro. | null | Método para insertar lista o arreglo de reservaciones | Método para insertar lista o arreglo de reservaciones | public void InsertarListaReservaciones(ArrayList<Reservacion> ListaReservaciones)
{
RegistroReservaciones = new ArrayList<>(ListaReservaciones);
} | [
"public",
"void",
"InsertarListaReservaciones",
"(",
"ArrayList",
"<",
"Reservacion",
">",
"ListaReservaciones",
")",
"{",
"RegistroReservaciones",
"=",
"new",
"ArrayList",
"<>",
"(",
"ListaReservaciones",
")",
";",
"}"
] | [
120,
4
] | [
123,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
IncomingIntraUserRegistry. | null | Las coloca en (A,TBN) | Las coloca en (A,TBN) | public void acknowledgeTransactions(List<Transaction<CryptoTransaction>> transactionList) throws IncomingIntraUserCantAcknowledgeTransactionException { // throws CantAcknowledgeTransactionException
try {
for (Transaction<CryptoTransaction> transaction : transactionList)
if (this.incomingIntraUserDao.isANewTransaction(transaction))
this.incomingIntraUserDao.saveTransactionAsAcknowledgedToBeNotified(transaction);
} catch (CantInsertRecordException | CantLoadTableToMemoryException e) {
throw new IncomingIntraUserCantAcknowledgeTransactionException("Database errors ocurred",e,"","");
} catch (Exception e) {
throw new IncomingIntraUserCantAcknowledgeTransactionException("An unexpected exception ocurred",FermatException.wrapException(e),"","");
}
} | [
"public",
"void",
"acknowledgeTransactions",
"(",
"List",
"<",
"Transaction",
"<",
"CryptoTransaction",
">",
">",
"transactionList",
")",
"throws",
"IncomingIntraUserCantAcknowledgeTransactionException",
"{",
"// throws CantAcknowledgeTransactionException",
"try",
"{",
"for",
"(",
"Transaction",
"<",
"CryptoTransaction",
">",
"transaction",
":",
"transactionList",
")",
"if",
"(",
"this",
".",
"incomingIntraUserDao",
".",
"isANewTransaction",
"(",
"transaction",
")",
")",
"this",
".",
"incomingIntraUserDao",
".",
"saveTransactionAsAcknowledgedToBeNotified",
"(",
"transaction",
")",
";",
"}",
"catch",
"(",
"CantInsertRecordException",
"|",
"CantLoadTableToMemoryException",
"e",
")",
"{",
"throw",
"new",
"IncomingIntraUserCantAcknowledgeTransactionException",
"(",
"\"Database errors ocurred\"",
",",
"e",
",",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"IncomingIntraUserCantAcknowledgeTransactionException",
"(",
"\"An unexpected exception ocurred\"",
",",
"FermatException",
".",
"wrapException",
"(",
"e",
")",
",",
"\"\"",
",",
"\"\"",
")",
";",
"}",
"}"
] | [
104,
4
] | [
114,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
PeliculasDOM. | null | Escribir la información del arbol DOM en memoria a un documento xml | Escribir la información del arbol DOM en memoria a un documento xml | private void printToFile() {
try {
OutputFormat format = new OutputFormat(dom);
format.setIndenting(true);
XMLSerializer serializer = new XMLSerializer(
new FileOutputStream(new File("../peliculas.xml")), format);
serializer.serialize(dom);
} catch (IOException ie) {
ie.printStackTrace();
}
} | [
"private",
"void",
"printToFile",
"(",
")",
"{",
"try",
"{",
"OutputFormat",
"format",
"=",
"new",
"OutputFormat",
"(",
"dom",
")",
";",
"format",
".",
"setIndenting",
"(",
"true",
")",
";",
"XMLSerializer",
"serializer",
"=",
"new",
"XMLSerializer",
"(",
"new",
"FileOutputStream",
"(",
"new",
"File",
"(",
"\"../peliculas.xml\"",
")",
")",
",",
"format",
")",
";",
"serializer",
".",
"serialize",
"(",
"dom",
")",
";",
"}",
"catch",
"(",
"IOException",
"ie",
")",
"{",
"ie",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] | [
304,
4
] | [
318,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
implUsuario. | null | Este metodo lo utilizamos para validar el acceso o no | Este metodo lo utilizamos para validar el acceso o no | public Usuario LoginReportePersonaUnico(String slogin, String spassword){
Usuario u = new Usuario();
try {
sql=" select * from usuario where usuario_nombreusuario='"+slogin+"' and usuario_pasword='"+spassword+"' ";
System.out.println("consulta:"+sql);
stmt=cx.conectaMysql().createStatement();
rset=stmt.executeQuery(sql);
u.setAcceso(false);
if(rset.next()){
System.out.println("dentro del ifff de la consulta:");
u.setNombre(rset.getString(2));
u.setCategoria(rset.getString(6));
u.setNombreUsuario(rset.getString(7));
u.setPasword(rset.getString(8));
u.setAcceso(true);
}
} catch (SQLException ex) {
ex.getMessage();
System.out.println("errrorrrrr:"+ex.getMessage());
}
return u;
} | [
"public",
"Usuario",
"LoginReportePersonaUnico",
"(",
"String",
"slogin",
",",
"String",
"spassword",
")",
"{",
"Usuario",
"u",
"=",
"new",
"Usuario",
"(",
")",
";",
"try",
"{",
"sql",
"=",
"\" select * from usuario where usuario_nombreusuario='\"",
"+",
"slogin",
"+",
"\"' and usuario_pasword='\"",
"+",
"spassword",
"+",
"\"' \"",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"consulta:\"",
"+",
"sql",
")",
";",
"stmt",
"=",
"cx",
".",
"conectaMysql",
"(",
")",
".",
"createStatement",
"(",
")",
";",
"rset",
"=",
"stmt",
".",
"executeQuery",
"(",
"sql",
")",
";",
"u",
".",
"setAcceso",
"(",
"false",
")",
";",
"if",
"(",
"rset",
".",
"next",
"(",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"dentro del ifff de la consulta:\"",
")",
";",
"u",
".",
"setNombre",
"(",
"rset",
".",
"getString",
"(",
"2",
")",
")",
";",
"u",
".",
"setCategoria",
"(",
"rset",
".",
"getString",
"(",
"6",
")",
")",
";",
"u",
".",
"setNombreUsuario",
"(",
"rset",
".",
"getString",
"(",
"7",
")",
")",
";",
"u",
".",
"setPasword",
"(",
"rset",
".",
"getString",
"(",
"8",
")",
")",
";",
"u",
".",
"setAcceso",
"(",
"true",
")",
";",
"}",
"}",
"catch",
"(",
"SQLException",
"ex",
")",
"{",
"ex",
".",
"getMessage",
"(",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"errrorrrrr:\"",
"+",
"ex",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"return",
"u",
";",
"}"
] | [
57,
4
] | [
78,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CrearCuenta. | null | Método para cuando se presiona en CampoDireccion con el mouse | Método para cuando se presiona en CampoDireccion con el mouse | private void CampoDireccionMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_CampoDireccionMousePressed
// Obtener contenido
String Contenido = this.CampoDireccion.getText();
Color ColorActual = this.CampoDireccion.getForeground();
Color ColorEscrito = new Color(51, 51, 51);
// Verifica si no tiene nada seteado aún
if(Contenido.equals("Dirección"))
{
// Elimina contenido
this.CampoDireccion.setText("");
}
if(ColorActual != ColorEscrito)
{
this.CampoDireccion.setForeground(ColorEscrito);
}
} | [
"private",
"void",
"CampoDireccionMousePressed",
"(",
"java",
".",
"awt",
".",
"event",
".",
"MouseEvent",
"evt",
")",
"{",
"//GEN-FIRST:event_CampoDireccionMousePressed",
"// Obtener contenido",
"String",
"Contenido",
"=",
"this",
".",
"CampoDireccion",
".",
"getText",
"(",
")",
";",
"Color",
"ColorActual",
"=",
"this",
".",
"CampoDireccion",
".",
"getForeground",
"(",
")",
";",
"Color",
"ColorEscrito",
"=",
"new",
"Color",
"(",
"51",
",",
"51",
",",
"51",
")",
";",
"// Verifica si no tiene nada seteado aún",
"if",
"(",
"Contenido",
".",
"equals",
"(",
"\"Dirección\")",
")",
"",
"{",
"// Elimina contenido",
"this",
".",
"CampoDireccion",
".",
"setText",
"(",
"\"\"",
")",
";",
"}",
"if",
"(",
"ColorActual",
"!=",
"ColorEscrito",
")",
"{",
"this",
".",
"CampoDireccion",
".",
"setForeground",
"(",
"ColorEscrito",
")",
";",
"}",
"}"
] | [
1092,
4
] | [
1107,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ServerPreferences. | null | Obtiene el nombre del proc a llamar al desconectarse un usuario | Obtiene el nombre del proc a llamar al desconectarse un usuario | public String getOnDisconnectProcName()
{
return iniFile.getProperty(defaultSection, "OnDisconnect", null);
} | [
"public",
"String",
"getOnDisconnectProcName",
"(",
")",
"{",
"return",
"iniFile",
".",
"getProperty",
"(",
"defaultSection",
",",
"\"OnDisconnect\"",
",",
"null",
")",
";",
"}"
] | [
132,
1
] | [
135,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CrudProducto. | null | /*Método que modifica el precio de un producto
Se pasa como parámetros el código del producto que queremos modificar y el nuevo precio
(ambos cosas dse le pedirán al usuario por teclado en el main,
se busca dentro del método el producto por código y se le "setea" el precio
Podría devolver boolean si todo es correcto o algún índice
pero en nuestro caso, en este programa tan sencillo no es necesario | /*Método que modifica el precio de un producto
Se pasa como parámetros el código del producto que queremos modificar y el nuevo precio
(ambos cosas dse le pedirán al usuario por teclado en el main,
se busca dentro del método el producto por código y se le "setea" el precio
Podría devolver boolean si todo es correcto o algún índice
pero en nuestro caso, en este programa tan sencillo no es necesario | public void editPrecio(String codigo, float precioN) {
int index = findByIdV2(codigo);
if (index >= 0) {
lista[index].setPrecioUnitario(precioN);
}
} | [
"public",
"void",
"editPrecio",
"(",
"String",
"codigo",
",",
"float",
"precioN",
")",
"{",
"int",
"index",
"=",
"findByIdV2",
"(",
"codigo",
")",
";",
"if",
"(",
"index",
">=",
"0",
")",
"{",
"lista",
"[",
"index",
"]",
".",
"setPrecioUnitario",
"(",
"precioN",
")",
";",
"}",
"}"
] | [
39,
1
] | [
46,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.