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
Panadero.
null
/*El panadero debe de poder reportar la cantidad de pan que elabora por semana
/*El panadero debe de poder reportar la cantidad de pan que elabora por semana
public Integer obtenerTotalPanElaborado() { int i,j,suma=0; for(i=0;i<=5;j++) { for(j=0;j<=6;j++) { if(panesSemana[i][j]!=null) { //obtenemos la cantidad elaborada de Pan //recorremos cada posicion , extraemos la cantidad pan y la sumamos suma+=panesSemana[i][j].getCantidadElaborada(); } } } return suma; }
[ "public", "Integer", "obtenerTotalPanElaborado", "(", ")", "{", "int", "i", ",", "j", ",", "suma", "=", "0", ";", "for", "(", "i", "=", "0", ";", "i", "<=", "5", ";", "j", "++", ")", "{", "for", "(", "j", "=", "0", ";", "j", "<=", "6", ";", "j", "++", ")", "{", "if", "(", "panesSemana", "[", "i", "]", "[", "j", "]", "!=", "null", ")", "{", "//obtenemos la cantidad elaborada de Pan", "//recorremos cada posicion , extraemos la cantidad pan y la sumamos", "suma", "+=", "panesSemana", "[", "i", "]", "[", "j", "]", ".", "getCantidadElaborada", "(", ")", ";", "}", "}", "}", "return", "suma", ";", "}" ]
[ 22, 1 ]
[ 39, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
AnimesApiResource.
null
Método que elimina una noticia de un anime
Método que elimina una noticia de un anime
@DELETE @Path("/noticia/{idAnime}/{idNoticia}") @Consumes("application/json") public Response deleteNoticiaAnime(@PathParam("idAnime") String idAnime, @PathParam("idNoticia") String idNoticia) { if (idNoticia == null) { throw new NotFoundException("La noticia no fue encontrada"); } else { repository.deleteNoticiaAnime(idAnime, idNoticia); } return Response.noContent().build(); }
[ "@", "DELETE", "@", "Path", "(", "\"/noticia/{idAnime}/{idNoticia}\"", ")", "@", "Consumes", "(", "\"application/json\"", ")", "public", "Response", "deleteNoticiaAnime", "(", "@", "PathParam", "(", "\"idAnime\"", ")", "String", "idAnime", ",", "@", "PathParam", "(", "\"idNoticia\"", ")", "String", "idNoticia", ")", "{", "if", "(", "idNoticia", "==", "null", ")", "{", "throw", "new", "NotFoundException", "(", "\"La noticia no fue encontrada\"", ")", ";", "}", "else", "{", "repository", ".", "deleteNoticiaAnime", "(", "idAnime", ",", "idNoticia", ")", ";", "}", "return", "Response", ".", "noContent", "(", ")", ".", "build", "(", ")", ";", "}" ]
[ 156, 1 ]
[ 167, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Producto.
null
/*Estudiaremos este método en el tema 5, pero de momento podemos usarlo. Sirve para definir y ver si el objeto que llama y el que se le pasa, son iguales, en este caso, solo son iguales si coinciden el código, el nombre y el precio unitario, las tres cosas
/*Estudiaremos este método en el tema 5, pero de momento podemos usarlo. Sirve para definir y ver si el objeto que llama y el que se le pasa, son iguales, en este caso, solo son iguales si coinciden el código, el nombre y el precio unitario, las tres cosas
public int compareTo(Producto o) { if (this.codigo.equalsIgnoreCase(o.getCodigo()) && this.nombre.equalsIgnoreCase(o.getNombre()) && this.precioUnitario == o.getPrecioUnitario()) { return 0; }else { return 1; } }
[ "public", "int", "compareTo", "(", "Producto", "o", ")", "{", "if", "(", "this", ".", "codigo", ".", "equalsIgnoreCase", "(", "o", ".", "getCodigo", "(", ")", ")", "&&", "this", ".", "nombre", ".", "equalsIgnoreCase", "(", "o", ".", "getNombre", "(", ")", ")", "&&", "this", ".", "precioUnitario", "==", "o", ".", "getPrecioUnitario", "(", ")", ")", "{", "return", "0", ";", "}", "else", "{", "return", "1", ";", "}", "}" ]
[ 53, 1 ]
[ 61, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
LLFunciones.
null
Agregamos el encapsulamientode manera privada de los metodos
Agregamos el encapsulamientode manera privada de los metodos
private void Llenado(){ //Agreamos estructura condicional con las especifiaciones que nos dio la empresa para su lavadora if(kilos <= 12){ //Si se cumple esta condicion automaticamente nuestro "llenadoCompleto cambia a 1 ", que significa que se lleno completamente llenadoCompleto = 1; System.out.println("LLENANDO..."); System.out.println("Lenado Completo."); }else{ System.out.println("La carga de ropa excede el total de soporte de este equipo, reduce la carga"); } }
[ "private", "void", "Llenado", "(", ")", "{", "//Agreamos estructura condicional con las especifiaciones que nos dio la empresa para su lavadora\r", "if", "(", "kilos", "<=", "12", ")", "{", "//Si se cumple esta condicion automaticamente nuestro \"llenadoCompleto cambia a 1 \", que significa que se lleno completamente\r", "llenadoCompleto", "=", "1", ";", "System", ".", "out", ".", "println", "(", "\"LLENANDO...\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"Lenado Completo.\"", ")", ";", "}", "else", "{", "System", ".", "out", ".", "println", "(", "\"La carga de ropa excede el total de soporte de este equipo, reduce la carga\"", ")", ";", "}", "}" ]
[ 19, 4 ]
[ 29, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
ControladorProyectosConstruccion.
null
Requerimiento 1 -> Listar todos los líderes
Requerimiento 1 -> Listar todos los líderes
public ArrayList<Lider> consultarTodosLideres() throws SQLException{ return this.liderDao.consultarTodos(); }
[ "public", "ArrayList", "<", "Lider", ">", "consultarTodosLideres", "(", ")", "throws", "SQLException", "{", "return", "this", ".", "liderDao", ".", "consultarTodos", "(", ")", ";", "}" ]
[ 26, 4 ]
[ 28, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Juego.
null
Revisar el tablero para establecer si hay ganador, empate, o aún no ha terminado el juego
Revisar el tablero para establecer si hay ganador, empate, o aún no ha terminado el juego
public ParametroLogico revisarTablero(){ //Realizar las sumatorias de las filas ArrayList<Integer> sumatoriasFilas = new ArrayList<Integer>(); for (int i = 0; i < Tablero.NUM_FILAS; i++) { sumatoriasFilas.add( sumatoriaCasillas(obtenerFila(i)) ); } //Realizar las sumatorias de las columnas ArrayList<Integer> sumatoriasColumnas = new ArrayList<Integer>(); for (int j = 0; j < Tablero.NUM_COLUMNAS; j++) { sumatoriasColumnas.add( sumatoriaCasillas(obtenerColumna(j)) ); } //Ralizar las sumatorias de las diagonales int sumatoriaDiagonal = sumatoriaCasillas(obtenerDiagonal()); int sumatoriaDiagonalInversa = sumatoriaCasillas(obtenerDiagonalInversa()); //Ganador //Si JugadorO Gana if( sumatoriasFilas.contains(ParametroLogico.LINEA_JUGADOR_O.getValorLogico()) || sumatoriasColumnas.contains(ParametroLogico.LINEA_JUGADOR_O.getValorLogico()) || sumatoriaDiagonal == ParametroLogico.LINEA_JUGADOR_O.getValorLogico() || sumatoriaDiagonalInversa == ParametroLogico.LINEA_JUGADOR_O.getValorLogico() ){ //Retornamos el valor lógico del jugador return ParametroLogico.JUGADOR_O; } //Si JugadorX Gana if( sumatoriasFilas.contains(ParametroLogico.LINEA_JUGADOR_X.getValorLogico()) || sumatoriasColumnas.contains(ParametroLogico.LINEA_JUGADOR_X.getValorLogico()) || sumatoriaDiagonal == ParametroLogico.LINEA_JUGADOR_X.getValorLogico() || sumatoriaDiagonalInversa == ParametroLogico.LINEA_JUGADOR_X.getValorLogico() ){ //Retornamos el valor lógico del jugador return ParametroLogico.JUGADOR_X; } //Empate int sumatoriaCompleta = this.sumatoriaTablero(); if( sumatoriaCompleta == ParametroLogico.EMPATE_INICIANDO_O.getValorLogico() || sumatoriaCompleta == ParametroLogico.EMPATE_INICIANDO_X.getValorLogico() ){ return ParametroLogico.PARTIDA_EMPATADA; } //No hay ganador y no hay empate return ParametroLogico.SIN_GANADOR; }
[ "public", "ParametroLogico", "revisarTablero", "(", ")", "{", "//Realizar las sumatorias de las filas", "ArrayList", "<", "Integer", ">", "sumatoriasFilas", "=", "new", "ArrayList", "<", "Integer", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "Tablero", ".", "NUM_FILAS", ";", "i", "++", ")", "{", "sumatoriasFilas", ".", "add", "(", "sumatoriaCasillas", "(", "obtenerFila", "(", "i", ")", ")", ")", ";", "}", "//Realizar las sumatorias de las columnas", "ArrayList", "<", "Integer", ">", "sumatoriasColumnas", "=", "new", "ArrayList", "<", "Integer", ">", "(", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "Tablero", ".", "NUM_COLUMNAS", ";", "j", "++", ")", "{", "sumatoriasColumnas", ".", "add", "(", "sumatoriaCasillas", "(", "obtenerColumna", "(", "j", ")", ")", ")", ";", "}", "//Ralizar las sumatorias de las diagonales", "int", "sumatoriaDiagonal", "=", "sumatoriaCasillas", "(", "obtenerDiagonal", "(", ")", ")", ";", "int", "sumatoriaDiagonalInversa", "=", "sumatoriaCasillas", "(", "obtenerDiagonalInversa", "(", ")", ")", ";", "//Ganador", "//Si JugadorO Gana", "if", "(", "sumatoriasFilas", ".", "contains", "(", "ParametroLogico", ".", "LINEA_JUGADOR_O", ".", "getValorLogico", "(", ")", ")", "||", "sumatoriasColumnas", ".", "contains", "(", "ParametroLogico", ".", "LINEA_JUGADOR_O", ".", "getValorLogico", "(", ")", ")", "||", "sumatoriaDiagonal", "==", "ParametroLogico", ".", "LINEA_JUGADOR_O", ".", "getValorLogico", "(", ")", "||", "sumatoriaDiagonalInversa", "==", "ParametroLogico", ".", "LINEA_JUGADOR_O", ".", "getValorLogico", "(", ")", ")", "{", "//Retornamos el valor lógico del jugador", "return", "ParametroLogico", ".", "JUGADOR_O", ";", "}", "//Si JugadorX Gana", "if", "(", "sumatoriasFilas", ".", "contains", "(", "ParametroLogico", ".", "LINEA_JUGADOR_X", ".", "getValorLogico", "(", ")", ")", "||", "sumatoriasColumnas", ".", "contains", "(", "ParametroLogico", ".", "LINEA_JUGADOR_X", ".", "getValorLogico", "(", ")", ")", "||", "sumatoriaDiagonal", "==", "ParametroLogico", ".", "LINEA_JUGADOR_X", ".", "getValorLogico", "(", ")", "||", "sumatoriaDiagonalInversa", "==", "ParametroLogico", ".", "LINEA_JUGADOR_X", ".", "getValorLogico", "(", ")", ")", "{", "//Retornamos el valor lógico del jugador", "return", "ParametroLogico", ".", "JUGADOR_X", ";", "}", "//Empate", "int", "sumatoriaCompleta", "=", "this", ".", "sumatoriaTablero", "(", ")", ";", "if", "(", "sumatoriaCompleta", "==", "ParametroLogico", ".", "EMPATE_INICIANDO_O", ".", "getValorLogico", "(", ")", "||", "sumatoriaCompleta", "==", "ParametroLogico", ".", "EMPATE_INICIANDO_X", ".", "getValorLogico", "(", ")", ")", "{", "return", "ParametroLogico", ".", "PARTIDA_EMPATADA", ";", "}", "//No hay ganador y no hay empate", "return", "ParametroLogico", ".", "SIN_GANADOR", ";", "}" ]
[ 94, 4 ]
[ 145, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Coordenada.
null
getter que nos traiga la coordenada
getter que nos traiga la coordenada
public float getX() { return this.x; }
[ "public", "float", "getX", "(", ")", "{", "return", "this", ".", "x", ";", "}" ]
[ 45, 1 ]
[ 48, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
PermissionUtils.
null
Clase que ayuda a manejar los servicios necesarios para tomar fotografias
Clase que ayuda a manejar los servicios necesarios para tomar fotografias
public static boolean checkPermissionFirst(Context context, int requestCode, String[] permission) { List<String> permissions = new ArrayList<String>(); for (String per : permission) { int permissionCode = ActivityCompat.checkSelfPermission(context, per); if (permissionCode != PackageManager.PERMISSION_GRANTED) { permissions.add(per); } } if (!permissions.isEmpty()) { ActivityCompat.requestPermissions((Activity) context, permissions.toArray(new String[permissions.size()]), requestCode); return false; } else { return true; } }
[ "public", "static", "boolean", "checkPermissionFirst", "(", "Context", "context", ",", "int", "requestCode", ",", "String", "[", "]", "permission", ")", "{", "List", "<", "String", ">", "permissions", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "String", "per", ":", "permission", ")", "{", "int", "permissionCode", "=", "ActivityCompat", ".", "checkSelfPermission", "(", "context", ",", "per", ")", ";", "if", "(", "permissionCode", "!=", "PackageManager", ".", "PERMISSION_GRANTED", ")", "{", "permissions", ".", "add", "(", "per", ")", ";", "}", "}", "if", "(", "!", "permissions", ".", "isEmpty", "(", ")", ")", "{", "ActivityCompat", ".", "requestPermissions", "(", "(", "Activity", ")", "context", ",", "permissions", ".", "toArray", "(", "new", "String", "[", "permissions", ".", "size", "(", ")", "]", ")", ",", "requestCode", ")", ";", "return", "false", ";", "}", "else", "{", "return", "true", ";", "}", "}" ]
[ 18, 4 ]
[ 32, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Ejercicio3.
null
Binevenida y saludo al usuario recogiendo el nombre
Binevenida y saludo al usuario recogiendo el nombre
public static void saludo(){ //Bienvenida System.out.println("Bienvenido al Ejercicio3!!"); //Recoger el nombre para generar el saludo Scanner sc = new Scanner(System.in); System.out.println("Ingresa el nombre: "); String nombre = sc.nextLine(); //Presentar el saludo System.out.println("Hola "+nombre); }
[ "public", "static", "void", "saludo", "(", ")", "{", "//Bienvenida", "System", ".", "out", ".", "println", "(", "\"Bienvenido al Ejercicio3!!\"", ")", ";", "//Recoger el nombre para generar el saludo", "Scanner", "sc", "=", "new", "Scanner", "(", "System", ".", "in", ")", ";", "System", ".", "out", ".", "println", "(", "\"Ingresa el nombre: \"", ")", ";", "String", "nombre", "=", "sc", ".", "nextLine", "(", ")", ";", "//Presentar el saludo", "System", ".", "out", ".", "println", "(", "\"Hola \"", "+", "nombre", ")", ";", "}" ]
[ 23, 4 ]
[ 36, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
PeliculasDOM.
null
Agregar nuevas películas al documento
Agregar nuevas películas al documento
private void agregarPelicula() { //Variables locales String respuesta = "S"; String categoria; String titulo; String director; int anyo; int duracion; String medida; //Obtenemos el elemento raiz <peliculas> Element raizPeliculasEle = dom.getDocumentElement(); do{ Scanner sc = new Scanner(System.in); System.out.println("Introduce la categoría de la película:"); categoria = sc.nextLine(); System.out.println("Introduce el título de la película:"); titulo = sc.nextLine(); System.out.println("Introduce el director de la película:"); director = sc.nextLine(); System.out.println("Introduce el año de la película:"); anyo = Integer.parseInt(sc.nextLine()); System.out.println("Introduce la duración de la película:"); duracion = Integer.parseInt(sc.nextLine()); System.out.println("Introduce la unidad de medida de la duración de la película:"); medida = sc.nextLine(); Pelicula p = new Pelicula(categoria, titulo, director, anyo, duracion, medida); Element peliculaEle = crearElementoPelicula(p); raizPeliculasEle.appendChild(peliculaEle); System.out.println("Desea insertar información de otra película? (S/N)"); respuesta = sc.nextLine(); } while (respuesta == "S"); }
[ "private", "void", "agregarPelicula", "(", ")", "{", "//Variables locales", "String", "respuesta", "=", "\"S\"", ";", "String", "categoria", ";", "String", "titulo", ";", "String", "director", ";", "int", "anyo", ";", "int", "duracion", ";", "String", "medida", ";", "//Obtenemos el elemento raiz <peliculas>", "Element", "raizPeliculasEle", "=", "dom", ".", "getDocumentElement", "(", ")", ";", "do", "{", "Scanner", "sc", "=", "new", "Scanner", "(", "System", ".", "in", ")", ";", "System", ".", "out", ".", "println", "(", "\"Introduce la categoría de la película:\");", "", "", "categoria", "=", "sc", ".", "nextLine", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"Introduce el título de la película:\");", "", "", "titulo", "=", "sc", ".", "nextLine", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"Introduce el director de la película:\")", ";", "", "director", "=", "sc", ".", "nextLine", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"Introduce el año de la película:\");", "", "", "anyo", "=", "Integer", ".", "parseInt", "(", "sc", ".", "nextLine", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"Introduce la duración de la película:\");", "", "", "duracion", "=", "Integer", ".", "parseInt", "(", "sc", ".", "nextLine", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"Introduce la unidad de medida de la duración de la película:\");", "", "", "medida", "=", "sc", ".", "nextLine", "(", ")", ";", "Pelicula", "p", "=", "new", "Pelicula", "(", "categoria", ",", "titulo", ",", "director", ",", "anyo", ",", "duracion", ",", "medida", ")", ";", "Element", "peliculaEle", "=", "crearElementoPelicula", "(", "p", ")", ";", "raizPeliculasEle", ".", "appendChild", "(", "peliculaEle", ")", ";", "System", ".", "out", ".", "println", "(", "\"Desea insertar información de otra película? (S/N)\");", "", "", "respuesta", "=", "sc", ".", "nextLine", "(", ")", ";", "}", "while", "(", "respuesta", "==", "\"S\"", ")", ";", "}" ]
[ 195, 4 ]
[ 232, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Mascota.
null
otros métodos:
otros métodos:
public void Comer(){ System.out.println("La mascota está comiendo"); }
[ "public", "void", "Comer", "(", ")", "{", "System", ".", "out", ".", "println", "(", "\"La mascota está comiendo\")", ";", "\r", "}" ]
[ 113, 4 ]
[ 115, 5 ]
null
java
es
['es', 'es', 'es']
False
true
method_declaration
Usuario.
null
Método que va a extraer la información del Administrador.
Método que va a extraer la información del Administrador.
public void buscarDatosAdmin() { ResultSet resultado = null; try { // Establecer conexión. Class.forName("org.sqlite.JDBC"); conexion = DriverManager.getConnection("jdbc:sqlite:db/administracion_citas.db"); if (conexion != null) { System.out.println("Conectado."); } PreparedStatement query = conexion.prepareStatement("SELECT user, password FROM Usuarios WHERE id = 1"); resultado = query.executeQuery(); this.user = resultado.getString("user"); this.password = resultado.getString("password"); query.close(); conexion.close(); } catch (Exception e) { System.err.println(e.getMessage()); } }
[ "public", "void", "buscarDatosAdmin", "(", ")", "{", "ResultSet", "resultado", "=", "null", ";", "try", "{", "// Establecer conexión.", "Class", ".", "forName", "(", "\"org.sqlite.JDBC\"", ")", ";", "conexion", "=", "DriverManager", ".", "getConnection", "(", "\"jdbc:sqlite:db/administracion_citas.db\"", ")", ";", "if", "(", "conexion", "!=", "null", ")", "{", "System", ".", "out", ".", "println", "(", "\"Conectado.\"", ")", ";", "}", "PreparedStatement", "query", "=", "conexion", ".", "prepareStatement", "(", "\"SELECT user, password FROM Usuarios WHERE id = 1\"", ")", ";", "resultado", "=", "query", ".", "executeQuery", "(", ")", ";", "this", ".", "user", "=", "resultado", ".", "getString", "(", "\"user\"", ")", ";", "this", ".", "password", "=", "resultado", ".", "getString", "(", "\"password\"", ")", ";", "query", ".", "close", "(", ")", ";", "conexion", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "err", ".", "println", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}" ]
[ 18, 4 ]
[ 42, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Producto.
null
metodo aplicar descuento
metodo aplicar descuento
public double aplicarDescuento(double porcDescuento) { double den=100.0; double resul=0.0; if (rebajado) { resul=pvp-(pvp*porcDescuento)/den; }else { resul=pvp; } return resul; }
[ "public", "double", "aplicarDescuento", "(", "double", "porcDescuento", ")", "{", "double", "den", "=", "100.0", ";", "double", "resul", "=", "0.0", ";", "if", "(", "rebajado", ")", "{", "resul", "=", "pvp", "-", "(", "pvp", "*", "porcDescuento", ")", "/", "den", ";", "}", "else", "{", "resul", "=", "pvp", ";", "}", "return", "resul", ";", "}" ]
[ 58, 1 ]
[ 74, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Triangulo.
null
este es una prueba de metodo con sobrecarga (mirar en apuntes metodos sobrecarga)
este es una prueba de metodo con sobrecarga (mirar en apuntes metodos sobrecarga)
public double calcularArea (double cantidad) { double dos=2.0; return ((base*altura)/dos)- cantidad; }
[ "public", "double", "calcularArea", "(", "double", "cantidad", ")", "{", "double", "dos", "=", "2.0", ";", "return", "(", "(", "base", "*", "altura", ")", "/", "dos", ")", "-", "cantidad", ";", "}" ]
[ 92, 2 ]
[ 97, 3 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Ejercicio1ArrayList.
null
/*MAXIMOS Y MINIMOS
/*MAXIMOS Y MINIMOS
public static void MaxMin() { Numeros.sort(null); JOptionPane.showMessageDialog(null, Numeros.get(0)+" y "+Numeros.get((Numeros.size()-1))); }
[ "public", "static", "void", "MaxMin", "(", ")", "{", "Numeros", ".", "sort", "(", "null", ")", ";", "JOptionPane", ".", "showMessageDialog", "(", "null", ",", "Numeros", ".", "get", "(", "0", ")", "+", "\" y \"", "+", "Numeros", ".", "get", "(", "(", "Numeros", ".", "size", "(", ")", "-", "1", ")", ")", ")", ";", "}" ]
[ 48, 4 ]
[ 52, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
MaterialConstruccionDao.
null
Consultar todos los materiales de construcción
Consultar todos los materiales de construcción
public ArrayList<MaterialConstruccion> consultarTodos() throws SQLException { //Preparar la colección que tendrá la respuesta ArrayList<MaterialConstruccion> respuesta = new ArrayList<MaterialConstruccion>(); //Declarar la conexión Connection conexion = null; //Intentar conectarnos y extraer la información de la base de datos para el requerimiento //Lógica -> Consulta SQL try{ //Conectarse conexion = JDBCUtilities.getConnection(); String consulta = "SELECT * FROM MaterialConstruccion;"; //Construir objeto que realizará la consulta PreparedStatement statement = conexion.prepareStatement(consulta); //Realizar propiamente la consulta ResultSet resultSet = statement.executeQuery(); //Recorrerlo mientras tenga posiciones, o registros while(resultSet.next()){ MaterialConstruccion material = new MaterialConstruccion(); material.setIdMaterialConstruccion(resultSet.getInt(1)); material.setNombreMaterial(resultSet.getString(2)); material.setImportado(resultSet.getString(3)); material.setPrecioUnidad(resultSet.getInt(4)); respuesta.add(material); } resultSet.close(); statement.close(); }catch(SQLException e){ System.err.println("Error consultando todos los materiales de construcción!! " + e); }finally{ if(conexion != null){ conexion.close(); } } //Retornar la colección de materiales de producción nacional return respuesta; }
[ "public", "ArrayList", "<", "MaterialConstruccion", ">", "consultarTodos", "(", ")", "throws", "SQLException", "{", "//Preparar la colección que tendrá la respuesta", "ArrayList", "<", "MaterialConstruccion", ">", "respuesta", "=", "new", "ArrayList", "<", "MaterialConstruccion", ">", "(", ")", ";", "//Declarar la conexión", "Connection", "conexion", "=", "null", ";", "//Intentar conectarnos y extraer la información de la base de datos para el requerimiento", "//Lógica -> Consulta SQL", "try", "{", "//Conectarse", "conexion", "=", "JDBCUtilities", ".", "getConnection", "(", ")", ";", "String", "consulta", "=", "\"SELECT * FROM MaterialConstruccion;\"", ";", "//Construir objeto que realizará la consulta", "PreparedStatement", "statement", "=", "conexion", ".", "prepareStatement", "(", "consulta", ")", ";", "//Realizar propiamente la consulta", "ResultSet", "resultSet", "=", "statement", ".", "executeQuery", "(", ")", ";", "//Recorrerlo mientras tenga posiciones, o registros", "while", "(", "resultSet", ".", "next", "(", ")", ")", "{", "MaterialConstruccion", "material", "=", "new", "MaterialConstruccion", "(", ")", ";", "material", ".", "setIdMaterialConstruccion", "(", "resultSet", ".", "getInt", "(", "1", ")", ")", ";", "material", ".", "setNombreMaterial", "(", "resultSet", ".", "getString", "(", "2", ")", ")", ";", "material", ".", "setImportado", "(", "resultSet", ".", "getString", "(", "3", ")", ")", ";", "material", ".", "setPrecioUnidad", "(", "resultSet", ".", "getInt", "(", "4", ")", ")", ";", "respuesta", ".", "add", "(", "material", ")", ";", "}", "resultSet", ".", "close", "(", ")", ";", "statement", ".", "close", "(", ")", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"Error consultando todos los materiales de construcción!! \" ", " ", ")", ";", "", "}", "finally", "{", "if", "(", "conexion", "!=", "null", ")", "{", "conexion", ".", "close", "(", ")", ";", "}", "}", "//Retornar la colección de materiales de producción nacional", "return", "respuesta", ";", "}" ]
[ 17, 4 ]
[ 67, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
ControladoraHotel.
null
sirve para mostrar en pantalla la fecha que traigo de la DB
sirve para mostrar en pantalla la fecha que traigo de la DB
public String DateAString(Date fecha) { SimpleDateFormat formatoFecha = new SimpleDateFormat("dd-MM-yyyy"); return formatoFecha.format(fecha); }
[ "public", "String", "DateAString", "(", "Date", "fecha", ")", "{", "SimpleDateFormat", "formatoFecha", "=", "new", "SimpleDateFormat", "(", "\"dd-MM-yyyy\"", ")", ";", "return", "formatoFecha", ".", "format", "(", "fecha", ")", ";", "}" ]
[ 439, 4 ]
[ 442, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
JugadorO.
null
Implementación del método abstracto
Implementación del método abstracto
public void ejecutarEstrategiaEspecifica(Tablero tablero){ //Alternar entre elegir esquina inferior derecha o completamente aleatorio //Selección aleatoria de la estrategia double estrategiaElegida = Math.random();//Aleatorio entre 0.0 y 1.0 if(estrategiaElegida > 0.5 ){ super.ejecutarEstrategiaAleatoria(tablero); //System.out.println("Aleatorio elegido"); }else{ super.realizarMovimiento(this.elegirCasillaID(tablero), tablero); //System.out.println("ID elegido"); } }
[ "public", "void", "ejecutarEstrategiaEspecifica", "(", "Tablero", "tablero", ")", "{", "//Alternar entre elegir esquina inferior derecha o completamente aleatorio", "//Selección aleatoria de la estrategia ", "double", "estrategiaElegida", "=", "Math", ".", "random", "(", ")", ";", "//Aleatorio entre 0.0 y 1.0", "if", "(", "estrategiaElegida", ">", "0.5", ")", "{", "super", ".", "ejecutarEstrategiaAleatoria", "(", "tablero", ")", ";", "//System.out.println(\"Aleatorio elegido\");", "}", "else", "{", "super", ".", "realizarMovimiento", "(", "this", ".", "elegirCasillaID", "(", "tablero", ")", ",", "tablero", ")", ";", "//System.out.println(\"ID elegido\");", "}", "}" ]
[ 35, 4 ]
[ 49, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
CommonUtil.
null
Debe ignorar los caracteres invalidos
Debe ignorar los caracteres invalidos
public static long lval(String text) { if (text == null) return 0; text = text.trim(); try { return new Long(text).longValue(); } catch (Exception e) { StringBuffer out = new StringBuffer(); boolean first = true; int len = text.length(); for (int i = 0; i < len; i++) { char c = text.charAt(i); if (c >= '0' && c <= '9') { out.append(c); } else if (c == '-' && first) { out.append('-'); first = false; } else { break; } } try { return new Long(out.toString()).longValue(); } catch (Exception ex) { return 0; } } }
[ "public", "static", "long", "lval", "(", "String", "text", ")", "{", "if", "(", "text", "==", "null", ")", "return", "0", ";", "text", "=", "text", ".", "trim", "(", ")", ";", "try", "{", "return", "new", "Long", "(", "text", ")", ".", "longValue", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "StringBuffer", "out", "=", "new", "StringBuffer", "(", ")", ";", "boolean", "first", "=", "true", ";", "int", "len", "=", "text", ".", "length", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "char", "c", "=", "text", ".", "charAt", "(", "i", ")", ";", "if", "(", "c", ">=", "'", "'", "&&", "c", "<=", "'", "'", ")", "{", "out", ".", "append", "(", "c", ")", ";", "}", "else", "if", "(", "c", "==", "'", "'", "&&", "first", ")", "{", "out", ".", "append", "(", "'", "'", ")", ";", "first", "=", "false", ";", "}", "else", "{", "break", ";", "}", "}", "try", "{", "return", "new", "Long", "(", "out", ".", "toString", "(", ")", ")", ".", "longValue", "(", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "return", "0", ";", "}", "}", "}" ]
[ 1178, 1 ]
[ 1223, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Registro.
null
Getter para RegistroHabitaciones por posición
Getter para RegistroHabitaciones por posición
public Habitacion getHabitacion(int Posicion) { return RegistroHabitaciones.get(Posicion); }
[ "public", "Habitacion", "getHabitacion", "(", "int", "Posicion", ")", "{", "return", "RegistroHabitaciones", ".", "get", "(", "Posicion", ")", ";", "}" ]
[ 266, 4 ]
[ 269, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
CrearCuenta.
null
Método para cuando se hace click en BotonRegistrarse
Método para cuando se hace click en BotonRegistrarse
private void BotonRegistrarseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonRegistrarseActionPerformed // Verifica si todos los campos están llenos String NombreUsuario, Contrasena, Nombre, AP, AM, Direccion, Telefono; int x, Mayor; Mayor = 0; Boolean Existente; Existente = false; NombreUsuario = this.CampoNombreUsuario.getText(); Contrasena = this.CampoContrasena.getText(); Nombre = this.CampoNombre.getText(); AP = this.CampoApellidoPaterno.getText(); AM = this.CampoApellidoMaterno.getText(); Direccion = this.CampoDireccion.getText(); Telefono = this.CampoTelefono.getText(); if(NombreUsuario.equals("Nombre de Usuario") || NombreUsuario.equals("")) { JOptionPane.showMessageDialog(null, "Faltan campos por llenar"); } else { if(Contrasena.equals("Contraseña") || Contrasena.equals("")) { JOptionPane.showMessageDialog(null, "Faltan campos por llenar"); } else { if(Nombre.equals("Nombre(s)") || Nombre.equals("")) { JOptionPane.showMessageDialog(null, "Faltan campos por llenar"); } else { if(AP.equals("Apellido Paterno") || AP.equals("")) { JOptionPane.showMessageDialog(null, "Faltan campos por llenar"); } else { if(AM.equals("Apellido Materno") || AM.equals("")) { JOptionPane.showMessageDialog(null, "Faltan campos por llenar"); } else { if(Direccion.equals("Dirección") || Direccion.equals("")) { JOptionPane.showMessageDialog(null, "Faltan campos por llenar"); } else { if(Telefono.equals("Teléfono") || Telefono.equals("")) { JOptionPane.showMessageDialog(null, "Faltan campos por llenar"); } else { if(RegistrosVentana.getTamanoUsuarios() > 0) { for(x = 0; x < RegistrosVentana.getTamanoUsuarios(); x++) { if(NombreUsuario.equals(RegistrosVentana.getUsuario(x).getUsername())) { Existente = true; } if(Mayor < Integer.parseInt(RegistrosVentana.getUsuario(x).getID())) { Mayor = Integer.parseInt(RegistrosVentana.getUsuario(x).getID()); } } } else { Existente = true; Mayor = 0; } if(Existente) { JOptionPane.showMessageDialog(null, "Nombre de Usuario ya está registrado"); } else { Usuario UsuarioARegistrar; UsuarioARegistrar = new Usuario(); UsuarioARegistrar.setID(Integer.toString(Mayor + 1)); UsuarioARegistrar.setUsername(NombreUsuario); UsuarioARegistrar.setContrasena(Hashing.Hash(ContrasenaTemp)); UsuarioARegistrar.setRol("Cliente"); UsuarioARegistrar.setNombre(Nombre); UsuarioARegistrar.setApellidoPaterno(AP); UsuarioARegistrar.setApellidoMaterno(AM); UsuarioARegistrar.setDireccion(Direccion); UsuarioARegistrar.setTelefono(Telefono); RegistrosVentana.InsertarUsuarios(UsuarioARegistrar); JOptionPane.showMessageDialog(null, "Se ha registrado nueva cuenta " + NombreUsuario + " con éxito"); Login LoginVentana = new Login(TamanoVentana, RegistrosVentana); LoginVentana.setVisible(true); dispose(); } } } } } } } } }
[ "private", "void", "BotonRegistrarseActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "//GEN-FIRST:event_BotonRegistrarseActionPerformed", "// Verifica si todos los campos están llenos", "String", "NombreUsuario", ",", "Contrasena", ",", "Nombre", ",", "AP", ",", "AM", ",", "Direccion", ",", "Telefono", ";", "int", "x", ",", "Mayor", ";", "Mayor", "=", "0", ";", "Boolean", "Existente", ";", "Existente", "=", "false", ";", "NombreUsuario", "=", "this", ".", "CampoNombreUsuario", ".", "getText", "(", ")", ";", "Contrasena", "=", "this", ".", "CampoContrasena", ".", "getText", "(", ")", ";", "Nombre", "=", "this", ".", "CampoNombre", ".", "getText", "(", ")", ";", "AP", "=", "this", ".", "CampoApellidoPaterno", ".", "getText", "(", ")", ";", "AM", "=", "this", ".", "CampoApellidoMaterno", ".", "getText", "(", ")", ";", "Direccion", "=", "this", ".", "CampoDireccion", ".", "getText", "(", ")", ";", "Telefono", "=", "this", ".", "CampoTelefono", ".", "getText", "(", ")", ";", "if", "(", "NombreUsuario", ".", "equals", "(", "\"Nombre de Usuario\"", ")", "||", "NombreUsuario", ".", "equals", "(", "\"\"", ")", ")", "{", "JOptionPane", ".", "showMessageDialog", "(", "null", ",", "\"Faltan campos por llenar\"", ")", ";", "}", "else", "{", "if", "(", "Contrasena", ".", "equals", "(", "\"Contraseña\")", " ", "| ", "ontrasena.", "e", "quals(", "\"", "\")", ")", "", "{", "JOptionPane", ".", "showMessageDialog", "(", "null", ",", "\"Faltan campos por llenar\"", ")", ";", "}", "else", "{", "if", "(", "Nombre", ".", "equals", "(", "\"Nombre(s)\"", ")", "||", "Nombre", ".", "equals", "(", "\"\"", ")", ")", "{", "JOptionPane", ".", "showMessageDialog", "(", "null", ",", "\"Faltan campos por llenar\"", ")", ";", "}", "else", "{", "if", "(", "AP", ".", "equals", "(", "\"Apellido Paterno\"", ")", "||", "AP", ".", "equals", "(", "\"\"", ")", ")", "{", "JOptionPane", ".", "showMessageDialog", "(", "null", ",", "\"Faltan campos por llenar\"", ")", ";", "}", "else", "{", "if", "(", "AM", ".", "equals", "(", "\"Apellido Materno\"", ")", "||", "AM", ".", "equals", "(", "\"\"", ")", ")", "{", "JOptionPane", ".", "showMessageDialog", "(", "null", ",", "\"Faltan campos por llenar\"", ")", ";", "}", "else", "{", "if", "(", "Direccion", ".", "equals", "(", "\"Dirección\")", " ", "| ", "ireccion.", "e", "quals(", "\"", "\")", ")", "", "{", "JOptionPane", ".", "showMessageDialog", "(", "null", ",", "\"Faltan campos por llenar\"", ")", ";", "}", "else", "{", "if", "(", "Telefono", ".", "equals", "(", "\"Teléfono\")", " ", "| ", "elefono.", "e", "quals(", "\"", "\")", ")", "", "{", "JOptionPane", ".", "showMessageDialog", "(", "null", ",", "\"Faltan campos por llenar\"", ")", ";", "}", "else", "{", "if", "(", "RegistrosVentana", ".", "getTamanoUsuarios", "(", ")", ">", "0", ")", "{", "for", "(", "x", "=", "0", ";", "x", "<", "RegistrosVentana", ".", "getTamanoUsuarios", "(", ")", ";", "x", "++", ")", "{", "if", "(", "NombreUsuario", ".", "equals", "(", "RegistrosVentana", ".", "getUsuario", "(", "x", ")", ".", "getUsername", "(", ")", ")", ")", "{", "Existente", "=", "true", ";", "}", "if", "(", "Mayor", "<", "Integer", ".", "parseInt", "(", "RegistrosVentana", ".", "getUsuario", "(", "x", ")", ".", "getID", "(", ")", ")", ")", "{", "Mayor", "=", "Integer", ".", "parseInt", "(", "RegistrosVentana", ".", "getUsuario", "(", "x", ")", ".", "getID", "(", ")", ")", ";", "}", "}", "}", "else", "{", "Existente", "=", "true", ";", "Mayor", "=", "0", ";", "}", "if", "(", "Existente", ")", "{", "JOptionPane", ".", "showMessageDialog", "(", "null", ",", "\"Nombre de Usuario ya está registrado\")", ";", "", "}", "else", "{", "Usuario", "UsuarioARegistrar", ";", "UsuarioARegistrar", "=", "new", "Usuario", "(", ")", ";", "UsuarioARegistrar", ".", "setID", "(", "Integer", ".", "toString", "(", "Mayor", "+", "1", ")", ")", ";", "UsuarioARegistrar", ".", "setUsername", "(", "NombreUsuario", ")", ";", "UsuarioARegistrar", ".", "setContrasena", "(", "Hashing", ".", "Hash", "(", "ContrasenaTemp", ")", ")", ";", "UsuarioARegistrar", ".", "setRol", "(", "\"Cliente\"", ")", ";", "UsuarioARegistrar", ".", "setNombre", "(", "Nombre", ")", ";", "UsuarioARegistrar", ".", "setApellidoPaterno", "(", "AP", ")", ";", "UsuarioARegistrar", ".", "setApellidoMaterno", "(", "AM", ")", ";", "UsuarioARegistrar", ".", "setDireccion", "(", "Direccion", ")", ";", "UsuarioARegistrar", ".", "setTelefono", "(", "Telefono", ")", ";", "RegistrosVentana", ".", "InsertarUsuarios", "(", "UsuarioARegistrar", ")", ";", "JOptionPane", ".", "showMessageDialog", "(", "null", ",", "\"Se ha registrado nueva cuenta \"", "+", "NombreUsuario", "+", "\" con éxito\")", ";", "", "Login", "LoginVentana", "=", "new", "Login", "(", "TamanoVentana", ",", "RegistrosVentana", ")", ";", "LoginVentana", ".", "setVisible", "(", "true", ")", ";", "dispose", "(", ")", ";", "}", "}", "}", "}", "}", "}", "}", "}", "}" ]
[ 595, 4 ]
[ 701, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
ExcelCells.
null
la paleta de colores que tiene un maximo de 40h-10h posiciones.
la paleta de colores que tiene un maximo de 40h-10h posiciones.
public void setColor(long value) // 05/07/05 B@tero { if (readonly) { m_errAccess.setErrDes("Can not modify a readonly document"); m_errAccess.setErrCod((short) 13); return; } try { for (int i = 1; i <= cntCells; i++) { HSSFCellStyle cellStyle = pCells[i].getCellStyle(); HSSFFont fontCell = pWorkbook.getFontAt(cellStyle.getFontIndexAsInt()); HSSFCellStyle newStyle = null; HSSFFont newFont = null; HSSFColor newColor = null; int val = (int) value; int red = val >> 16 & 0xff; int green = val >> 8 & 0xff; int blue = val & 0xff; HSSFPalette palette = pWorkbook.getCustomPalette(); HSSFColor fontColor = palette.getColor(fontCell.getColor()); if (value < 0) { if (fontColor == null) { // System.out.println("Automatic color."); if ((red + green + blue) != 0) { HSSFColor foundColor = palette.findColor((byte) red, (byte) green, (byte) blue); if (foundColor == null) { for (short j = 9; j <= 63; j++) { foundColor = palette.getColor(j); if (foundColor == null) { newColor = palette.addColor((byte) red, (byte) green, (byte) blue); j = 64; } } if (newColor == null) { newColor = palette.findSimilarColor((byte) red, (byte) green, (byte) blue); palette.setColorAtIndex(newColor.getIndex(), (byte) red, (byte) green, (byte) blue); } } else { newColor = foundColor; } newFont = getInternalFont(fontCell.getBold(), newColor.getIndex(), fontCell.getFontHeight(), fontCell.getFontName(), fontCell.getItalic(), fontCell.getStrikeout(), fontCell.getTypeOffset(), fontCell.getUnderline()); copyPropertiesFont(newFont, fontCell); newFont.setColor(newColor.getIndex()); newStyle = stylesCache.getCellStyle(newFont); copyPropertiesStyle(newStyle, cellStyle); newStyle.setFont(newFont); pCells[i].setCellStyle(newStyle); } } else { short triplet[] = fontColor.getTriplet(); if (triplet[0] != red || triplet[1] != green || triplet[2] != blue) { HSSFColor foundColor = palette.findColor((byte) red, (byte) green, (byte) blue); if (foundColor == null) { for (short j = 9; j <= 63; j++) { foundColor = palette.getColor(j); if (foundColor == null) { newColor = palette.addColor((byte) red, (byte) green, (byte) blue); j = 64; } } if (newColor == null) { newColor = palette.findSimilarColor((byte) red, (byte) green, (byte) blue); palette.setColorAtIndex(newColor.getIndex(), (byte) red, (byte) green, (byte) blue); } } else { newColor = foundColor; } newFont = getInternalFont(fontCell.getBold(), newColor.getIndex(), fontCell.getFontHeight(), fontCell.getFontName(), fontCell.getItalic(), fontCell.getStrikeout(), fontCell.getTypeOffset(), fontCell.getUnderline()); copyPropertiesFont(newFont, fontCell); newFont.setColor(newColor.getIndex()); newStyle = stylesCache.getCellStyle(newFont); copyPropertiesStyle(newStyle, cellStyle); newStyle.setFont(newFont); pCells[i].setCellStyle(newStyle); } } } else { // Es el ofset que hay que sumar para que el colorIndex quede igual // al de la implementacion anterior de excel value = value + 7; if (fontColor != null) { if (fontColor.getIndex() != value) { newFont = getInternalFont(fontCell.getBold(), (short) value, fontCell.getFontHeight(), fontCell.getFontName(), fontCell.getItalic(), fontCell.getStrikeout(), fontCell.getTypeOffset(), fontCell.getUnderline()); copyPropertiesFont(newFont, fontCell); newFont.setColor((short) value); newStyle = stylesCache.getCellStyle(newFont); copyPropertiesStyle(newStyle, cellStyle); newStyle.setFont(newFont); pCells[i].setCellStyle(newStyle); } } else { newFont = getInternalFont(fontCell.getBold(), (short) value, fontCell.getFontHeight(), fontCell.getFontName(), fontCell.getItalic(), fontCell.getStrikeout(), fontCell.getTypeOffset(), fontCell.getUnderline()); copyPropertiesFont(newFont, fontCell); newFont.setColor((short) value); newStyle = stylesCache.getCellStyle(newFont); copyPropertiesStyle(newStyle, cellStyle); newStyle.setFont(newFont); pCells[i].setCellStyle(newStyle); } } } } catch (Exception e) { m_errAccess.setErrDes("Invalid font properties"); m_errAccess.setErrCod((short) 6); } }
[ "public", "void", "setColor", "(", "long", "value", ")", "// 05/07/05 B@tero", "{", "if", "(", "readonly", ")", "{", "m_errAccess", ".", "setErrDes", "(", "\"Can not modify a readonly document\"", ")", ";", "m_errAccess", ".", "setErrCod", "(", "(", "short", ")", "13", ")", ";", "return", ";", "}", "try", "{", "for", "(", "int", "i", "=", "1", ";", "i", "<=", "cntCells", ";", "i", "++", ")", "{", "HSSFCellStyle", "cellStyle", "=", "pCells", "[", "i", "]", ".", "getCellStyle", "(", ")", ";", "HSSFFont", "fontCell", "=", "pWorkbook", ".", "getFontAt", "(", "cellStyle", ".", "getFontIndexAsInt", "(", ")", ")", ";", "HSSFCellStyle", "newStyle", "=", "null", ";", "HSSFFont", "newFont", "=", "null", ";", "HSSFColor", "newColor", "=", "null", ";", "int", "val", "=", "(", "int", ")", "value", ";", "int", "red", "=", "val", ">>", "16", "&", "0xff", ";", "int", "green", "=", "val", ">>", "8", "&", "0xff", ";", "int", "blue", "=", "val", "&", "0xff", ";", "HSSFPalette", "palette", "=", "pWorkbook", ".", "getCustomPalette", "(", ")", ";", "HSSFColor", "fontColor", "=", "palette", ".", "getColor", "(", "fontCell", ".", "getColor", "(", ")", ")", ";", "if", "(", "value", "<", "0", ")", "{", "if", "(", "fontColor", "==", "null", ")", "{", "// System.out.println(\"Automatic color.\");", "if", "(", "(", "red", "+", "green", "+", "blue", ")", "!=", "0", ")", "{", "HSSFColor", "foundColor", "=", "palette", ".", "findColor", "(", "(", "byte", ")", "red", ",", "(", "byte", ")", "green", ",", "(", "byte", ")", "blue", ")", ";", "if", "(", "foundColor", "==", "null", ")", "{", "for", "(", "short", "j", "=", "9", ";", "j", "<=", "63", ";", "j", "++", ")", "{", "foundColor", "=", "palette", ".", "getColor", "(", "j", ")", ";", "if", "(", "foundColor", "==", "null", ")", "{", "newColor", "=", "palette", ".", "addColor", "(", "(", "byte", ")", "red", ",", "(", "byte", ")", "green", ",", "(", "byte", ")", "blue", ")", ";", "j", "=", "64", ";", "}", "}", "if", "(", "newColor", "==", "null", ")", "{", "newColor", "=", "palette", ".", "findSimilarColor", "(", "(", "byte", ")", "red", ",", "(", "byte", ")", "green", ",", "(", "byte", ")", "blue", ")", ";", "palette", ".", "setColorAtIndex", "(", "newColor", ".", "getIndex", "(", ")", ",", "(", "byte", ")", "red", ",", "(", "byte", ")", "green", ",", "(", "byte", ")", "blue", ")", ";", "}", "}", "else", "{", "newColor", "=", "foundColor", ";", "}", "newFont", "=", "getInternalFont", "(", "fontCell", ".", "getBold", "(", ")", ",", "newColor", ".", "getIndex", "(", ")", ",", "fontCell", ".", "getFontHeight", "(", ")", ",", "fontCell", ".", "getFontName", "(", ")", ",", "fontCell", ".", "getItalic", "(", ")", ",", "fontCell", ".", "getStrikeout", "(", ")", ",", "fontCell", ".", "getTypeOffset", "(", ")", ",", "fontCell", ".", "getUnderline", "(", ")", ")", ";", "copyPropertiesFont", "(", "newFont", ",", "fontCell", ")", ";", "newFont", ".", "setColor", "(", "newColor", ".", "getIndex", "(", ")", ")", ";", "newStyle", "=", "stylesCache", ".", "getCellStyle", "(", "newFont", ")", ";", "copyPropertiesStyle", "(", "newStyle", ",", "cellStyle", ")", ";", "newStyle", ".", "setFont", "(", "newFont", ")", ";", "pCells", "[", "i", "]", ".", "setCellStyle", "(", "newStyle", ")", ";", "}", "}", "else", "{", "short", "triplet", "[", "]", "=", "fontColor", ".", "getTriplet", "(", ")", ";", "if", "(", "triplet", "[", "0", "]", "!=", "red", "||", "triplet", "[", "1", "]", "!=", "green", "||", "triplet", "[", "2", "]", "!=", "blue", ")", "{", "HSSFColor", "foundColor", "=", "palette", ".", "findColor", "(", "(", "byte", ")", "red", ",", "(", "byte", ")", "green", ",", "(", "byte", ")", "blue", ")", ";", "if", "(", "foundColor", "==", "null", ")", "{", "for", "(", "short", "j", "=", "9", ";", "j", "<=", "63", ";", "j", "++", ")", "{", "foundColor", "=", "palette", ".", "getColor", "(", "j", ")", ";", "if", "(", "foundColor", "==", "null", ")", "{", "newColor", "=", "palette", ".", "addColor", "(", "(", "byte", ")", "red", ",", "(", "byte", ")", "green", ",", "(", "byte", ")", "blue", ")", ";", "j", "=", "64", ";", "}", "}", "if", "(", "newColor", "==", "null", ")", "{", "newColor", "=", "palette", ".", "findSimilarColor", "(", "(", "byte", ")", "red", ",", "(", "byte", ")", "green", ",", "(", "byte", ")", "blue", ")", ";", "palette", ".", "setColorAtIndex", "(", "newColor", ".", "getIndex", "(", ")", ",", "(", "byte", ")", "red", ",", "(", "byte", ")", "green", ",", "(", "byte", ")", "blue", ")", ";", "}", "}", "else", "{", "newColor", "=", "foundColor", ";", "}", "newFont", "=", "getInternalFont", "(", "fontCell", ".", "getBold", "(", ")", ",", "newColor", ".", "getIndex", "(", ")", ",", "fontCell", ".", "getFontHeight", "(", ")", ",", "fontCell", ".", "getFontName", "(", ")", ",", "fontCell", ".", "getItalic", "(", ")", ",", "fontCell", ".", "getStrikeout", "(", ")", ",", "fontCell", ".", "getTypeOffset", "(", ")", ",", "fontCell", ".", "getUnderline", "(", ")", ")", ";", "copyPropertiesFont", "(", "newFont", ",", "fontCell", ")", ";", "newFont", ".", "setColor", "(", "newColor", ".", "getIndex", "(", ")", ")", ";", "newStyle", "=", "stylesCache", ".", "getCellStyle", "(", "newFont", ")", ";", "copyPropertiesStyle", "(", "newStyle", ",", "cellStyle", ")", ";", "newStyle", ".", "setFont", "(", "newFont", ")", ";", "pCells", "[", "i", "]", ".", "setCellStyle", "(", "newStyle", ")", ";", "}", "}", "}", "else", "{", "// Es el ofset que hay que sumar para que el colorIndex quede igual", "// al de la implementacion anterior de excel", "value", "=", "value", "+", "7", ";", "if", "(", "fontColor", "!=", "null", ")", "{", "if", "(", "fontColor", ".", "getIndex", "(", ")", "!=", "value", ")", "{", "newFont", "=", "getInternalFont", "(", "fontCell", ".", "getBold", "(", ")", ",", "(", "short", ")", "value", ",", "fontCell", ".", "getFontHeight", "(", ")", ",", "fontCell", ".", "getFontName", "(", ")", ",", "fontCell", ".", "getItalic", "(", ")", ",", "fontCell", ".", "getStrikeout", "(", ")", ",", "fontCell", ".", "getTypeOffset", "(", ")", ",", "fontCell", ".", "getUnderline", "(", ")", ")", ";", "copyPropertiesFont", "(", "newFont", ",", "fontCell", ")", ";", "newFont", ".", "setColor", "(", "(", "short", ")", "value", ")", ";", "newStyle", "=", "stylesCache", ".", "getCellStyle", "(", "newFont", ")", ";", "copyPropertiesStyle", "(", "newStyle", ",", "cellStyle", ")", ";", "newStyle", ".", "setFont", "(", "newFont", ")", ";", "pCells", "[", "i", "]", ".", "setCellStyle", "(", "newStyle", ")", ";", "}", "}", "else", "{", "newFont", "=", "getInternalFont", "(", "fontCell", ".", "getBold", "(", ")", ",", "(", "short", ")", "value", ",", "fontCell", ".", "getFontHeight", "(", ")", ",", "fontCell", ".", "getFontName", "(", ")", ",", "fontCell", ".", "getItalic", "(", ")", ",", "fontCell", ".", "getStrikeout", "(", ")", ",", "fontCell", ".", "getTypeOffset", "(", ")", ",", "fontCell", ".", "getUnderline", "(", ")", ")", ";", "copyPropertiesFont", "(", "newFont", ",", "fontCell", ")", ";", "newFont", ".", "setColor", "(", "(", "short", ")", "value", ")", ";", "newStyle", "=", "stylesCache", ".", "getCellStyle", "(", "newFont", ")", ";", "copyPropertiesStyle", "(", "newStyle", ",", "cellStyle", ")", ";", "newStyle", ".", "setFont", "(", "newFont", ")", ";", "pCells", "[", "i", "]", ".", "setCellStyle", "(", "newStyle", ")", ";", "}", "}", "}", "}", "catch", "(", "Exception", "e", ")", "{", "m_errAccess", ".", "setErrDes", "(", "\"Invalid font properties\"", ")", ";", "m_errAccess", ".", "setErrCod", "(", "(", "short", ")", "6", ")", ";", "}", "}" ]
[ 616, 1 ]
[ 751, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Registro.
null
Método EliminarUsuarios por posición
Método EliminarUsuarios por posición
public Usuario EliminarUsuarios(int Posicion) { return RegistroUsuarios.remove(Posicion); }
[ "public", "Usuario", "EliminarUsuarios", "(", "int", "Posicion", ")", "{", "return", "RegistroUsuarios", ".", "remove", "(", "Posicion", ")", ";", "}" ]
[ 147, 4 ]
[ 150, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
JsonReader.
null
Funciones para extraer los atributos de la clase
Funciones para extraer los atributos de la clase
public int getTamanio(){ return tamanio; }
[ "public", "int", "getTamanio", "(", ")", "{", "return", "tamanio", ";", "}" ]
[ 52, 2 ]
[ 54, 3 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
ControladoraHotel.
null
devuleve una lista de habitaciones filtrada por fechas disponibles
devuleve una lista de habitaciones filtrada por fechas disponibles
public List<Habitacion> traerHabitacionDisponible(Date fecha_averiguar_inicio, Date fecha_averiguar_fin, int cant_personas) { //creamos una lista que contendra las habitaciones disponibles List<Habitacion> lista_habitacion = traerHabitacionDisponiblePorCantLimite(cant_personas); //en esta lista guarda las habitaciones disponibles List< Habitacion> lista_filtrada = new ArrayList(); for (Habitacion habitacion : lista_habitacion) { List<Reserva> listaR = habitacion.getLista_reservas(); boolean registrar = true; if (listaR.isEmpty()) { lista_filtrada.add(habitacion); } else { for (Reserva reserva : listaR) { if (hayDisponibilidad(fecha_averiguar_inicio, fecha_averiguar_fin, reserva.getFecha_ingreso(), reserva.getFecha_egreso())) { if (registrar) { lista_filtrada.add(habitacion); registrar = false; } } } } } return lista_filtrada; }
[ "public", "List", "<", "Habitacion", ">", "traerHabitacionDisponible", "(", "Date", "fecha_averiguar_inicio", ",", "Date", "fecha_averiguar_fin", ",", "int", "cant_personas", ")", "{", "//creamos una lista que contendra las habitaciones disponibles", "List", "<", "Habitacion", ">", "lista_habitacion", "=", "traerHabitacionDisponiblePorCantLimite", "(", "cant_personas", ")", ";", "//en esta lista guarda las habitaciones disponibles", "List", "<", "Habitacion", ">", "lista_filtrada", "=", "new", "ArrayList", "(", ")", ";", "for", "(", "Habitacion", "habitacion", ":", "lista_habitacion", ")", "{", "List", "<", "Reserva", ">", "listaR", "=", "habitacion", ".", "getLista_reservas", "(", ")", ";", "boolean", "registrar", "=", "true", ";", "if", "(", "listaR", ".", "isEmpty", "(", ")", ")", "{", "lista_filtrada", ".", "add", "(", "habitacion", ")", ";", "}", "else", "{", "for", "(", "Reserva", "reserva", ":", "listaR", ")", "{", "if", "(", "hayDisponibilidad", "(", "fecha_averiguar_inicio", ",", "fecha_averiguar_fin", ",", "reserva", ".", "getFecha_ingreso", "(", ")", ",", "reserva", ".", "getFecha_egreso", "(", ")", ")", ")", "{", "if", "(", "registrar", ")", "{", "lista_filtrada", ".", "add", "(", "habitacion", ")", ";", "registrar", "=", "false", ";", "}", "}", "}", "}", "}", "return", "lista_filtrada", ";", "}" ]
[ 301, 4 ]
[ 334, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
FotosController.
null
buscar archivos de un usuario
buscar archivos de un usuario
@CrossOrigin(origins = "http://localhost:4200") @GetMapping("/getArchivosFotoUsuario/{idUsu}") public ResponseEntity<List<EnviarArchivosGen>> getArchivosFotoUsuario(@PathVariable Integer idUsu) { System.out.println("Id de usuario: " + idUsu); List<EnviarArchivosGen> listaImagenes = new ArrayList<EnviarArchivosGen>(); GestionarArchivos gesArch = new GestionarArchivos(); //Obtener fotos ArrayList<Fotos> listaFotos = new ArrayList<Fotos>(); try { listaFotos = (ArrayList<Fotos>) service.findFotosUsuario(idUsu); } catch(Exception e) { System.out.println("Problema al buscar las fotos de un usuario: " + e.toString()); } listaFotos = quitarListas(listaFotos); for(Fotos fot: listaFotos) { EnviarArchivosGen envGen = new EnviarArchivosGen(); envGen.setObj(fot); String filesPath = context.getRealPath("/ficheros/img/" + fot.getIdFoto() + "-" + idUsu + "-" + fot.getFotoString()); File fich = new File(filesPath); if(!fich.isDirectory()) { envGen.setFicheroCompletoString(gesArch.obtenerUnFichImg(fich)); listaImagenes.add(envGen); } } return new ResponseEntity<List<EnviarArchivosGen>>(listaImagenes, HttpStatus.OK); }
[ "@", "CrossOrigin", "(", "origins", "=", "\"http://localhost:4200\"", ")", "@", "GetMapping", "(", "\"/getArchivosFotoUsuario/{idUsu}\"", ")", "public", "ResponseEntity", "<", "List", "<", "EnviarArchivosGen", ">", ">", "getArchivosFotoUsuario", "(", "@", "PathVariable", "Integer", "idUsu", ")", "{", "System", ".", "out", ".", "println", "(", "\"Id de usuario: \"", "+", "idUsu", ")", ";", "List", "<", "EnviarArchivosGen", ">", "listaImagenes", "=", "new", "ArrayList", "<", "EnviarArchivosGen", ">", "(", ")", ";", "GestionarArchivos", "gesArch", "=", "new", "GestionarArchivos", "(", ")", ";", "//Obtener fotos\r", "ArrayList", "<", "Fotos", ">", "listaFotos", "=", "new", "ArrayList", "<", "Fotos", ">", "(", ")", ";", "try", "{", "listaFotos", "=", "(", "ArrayList", "<", "Fotos", ">", ")", "service", ".", "findFotosUsuario", "(", "idUsu", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "out", ".", "println", "(", "\"Problema al buscar las fotos de un usuario: \"", "+", "e", ".", "toString", "(", ")", ")", ";", "}", "listaFotos", "=", "quitarListas", "(", "listaFotos", ")", ";", "for", "(", "Fotos", "fot", ":", "listaFotos", ")", "{", "EnviarArchivosGen", "envGen", "=", "new", "EnviarArchivosGen", "(", ")", ";", "envGen", ".", "setObj", "(", "fot", ")", ";", "String", "filesPath", "=", "context", ".", "getRealPath", "(", "\"/ficheros/img/\"", "+", "fot", ".", "getIdFoto", "(", ")", "+", "\"-\"", "+", "idUsu", "+", "\"-\"", "+", "fot", ".", "getFotoString", "(", ")", ")", ";", "File", "fich", "=", "new", "File", "(", "filesPath", ")", ";", "if", "(", "!", "fich", ".", "isDirectory", "(", ")", ")", "{", "envGen", ".", "setFicheroCompletoString", "(", "gesArch", ".", "obtenerUnFichImg", "(", "fich", ")", ")", ";", "listaImagenes", ".", "add", "(", "envGen", ")", ";", "}", "}", "return", "new", "ResponseEntity", "<", "List", "<", "EnviarArchivosGen", ">", ">", "(", "listaImagenes", ",", "HttpStatus", ".", "OK", ")", ";", "}" ]
[ 249, 1 ]
[ 285, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Registro.
null
Setter para atributo RegistroHabitaciones por posición
Setter para atributo RegistroHabitaciones por posición
public Habitacion setHabitacion(int Posicion, Habitacion ClienteAAsignar) { return RegistroHabitaciones.set(Posicion, ClienteAAsignar); }
[ "public", "Habitacion", "setHabitacion", "(", "int", "Posicion", ",", "Habitacion", "ClienteAAsignar", ")", "{", "return", "RegistroHabitaciones", ".", "set", "(", "Posicion", ",", "ClienteAAsignar", ")", ";", "}" ]
[ 285, 4 ]
[ 288, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Login.
null
Método para cuando se desenfoca de CampoUsuario
Método para cuando se desenfoca de CampoUsuario
private void CampoUsuarioFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_CampoUsuarioFocusLost // 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")) { if(Contenido.equals("")) { this.CampoUsuario.setText("Nombre de Usuario"); if(ColorActual != ColorNoEscrito) { this.CampoUsuario.setForeground(ColorNoEscrito); } } } }
[ "private", "void", "CampoUsuarioFocusLost", "(", "java", ".", "awt", ".", "event", ".", "FocusEvent", "evt", ")", "{", "//GEN-FIRST:event_CampoUsuarioFocusLost", "// 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\"", ")", ")", "{", "if", "(", "Contenido", ".", "equals", "(", "\"\"", ")", ")", "{", "this", ".", "CampoUsuario", ".", "setText", "(", "\"Nombre de Usuario\"", ")", ";", "if", "(", "ColorActual", "!=", "ColorNoEscrito", ")", "{", "this", ".", "CampoUsuario", ".", "setForeground", "(", "ColorNoEscrito", ")", ";", "}", "}", "}", "}" ]
[ 613, 4 ]
[ 634, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Ejercicio5.
null
Determinar si es par o impar el valor ingresado y reportar en consola.
Determinar si es par o impar el valor ingresado y reportar en consola.
public static boolean esPar(int numero){ boolean valorDeVerdad = true; if(numero % 2 == 0){ valorDeVerdad = true; }else{ valorDeVerdad = false; } return valorDeVerdad; }
[ "public", "static", "boolean", "esPar", "(", "int", "numero", ")", "{", "boolean", "valorDeVerdad", "=", "true", ";", "if", "(", "numero", "%", "2", "==", "0", ")", "{", "valorDeVerdad", "=", "true", ";", "}", "else", "{", "valorDeVerdad", "=", "false", ";", "}", "return", "valorDeVerdad", ";", "}" ]
[ 7, 4 ]
[ 19, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
NoticiasApiResource.
null
Método que devuelve todas las noticias
Método que devuelve todas las noticias
@GET @Produces("application/json") public Collection<Noticia> getAllNoticias() { return repository.getAllAnimeNoticias(); }
[ "@", "GET", "@", "Produces", "(", "\"application/json\"", ")", "public", "Collection", "<", "Noticia", ">", "getAllNoticias", "(", ")", "{", "return", "repository", ".", "getAllAnimeNoticias", "(", ")", ";", "}" ]
[ 36, 1 ]
[ 40, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
GestionPeliculas.
null
Método para mostrar las peliculas de nuestra lista
Método para mostrar las peliculas de nuestra lista
public void showMovies() { if (contador != -1) { String cadena = ""; for (PeliculaClass i : lista) { cadena += i + "\n"; } JOptionPane.showMessageDialog(null, "MOVIES\n" + cadena, "Registro Peliculas", 1, new ImageIcon("recursos/net.png")); } else { JOptionPane.showMessageDialog(null, "Registro Vacio", "No hay peliculas registradas", 2); } }
[ "public", "void", "showMovies", "(", ")", "{", "if", "(", "contador", "!=", "-", "1", ")", "{", "String", "cadena", "=", "\"\"", ";", "for", "(", "PeliculaClass", "i", ":", "lista", ")", "{", "cadena", "+=", "i", "+", "\"\\n\"", ";", "}", "JOptionPane", ".", "showMessageDialog", "(", "null", ",", "\"MOVIES\\n\"", "+", "cadena", ",", "\"Registro Peliculas\"", ",", "1", ",", "new", "ImageIcon", "(", "\"recursos/net.png\"", ")", ")", ";", "}", "else", "{", "JOptionPane", ".", "showMessageDialog", "(", "null", ",", "\"Registro Vacio\"", ",", "\"No hay peliculas registradas\"", ",", "2", ")", ";", "}", "}" ]
[ 39, 4 ]
[ 49, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
LLFunciones.
null
Este metodo sera el unico al cual se podra tener acceso con la funcion public
Este metodo sera el unico al cual se podra tener acceso con la funcion public
public void CicloFinalizado(){ //Agregamos funcionalidades Secado(); if(SecadoCompleto == 1){ System.out.println("Proceso de Lavado Completo,poravor retira tu ropa."); } }
[ "public", "void", "CicloFinalizado", "(", ")", "{", "//Agregamos funcionalidades \r", "Secado", "(", ")", ";", "if", "(", "SecadoCompleto", "==", "1", ")", "{", "System", ".", "out", ".", "println", "(", "\"Proceso de Lavado Completo,poravor retira tu ropa.\"", ")", ";", "}", "}" ]
[ 60, 4 ]
[ 66, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
VideosApiResource.
null
Método que devuelve todos los vídeos
Método que devuelve todos los vídeos
@GET @Produces("application/json") public Collection<Video> getAllVideos() { return repository.getAllAnimeVideos(); }
[ "@", "GET", "@", "Produces", "(", "\"application/json\"", ")", "public", "Collection", "<", "Video", ">", "getAllVideos", "(", ")", "{", "return", "repository", ".", "getAllAnimeVideos", "(", ")", ";", "}" ]
[ 35, 1 ]
[ 39, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
MainActivity.
null
metodo para el boton guardar
metodo para el boton guardar
public void Guardar(View Guardar){ try{ OutputStreamWriter datos = new OutputStreamWriter(openFileOutput("bitacora.txt", Activity.MODE_PRIVATE)); datos.write(et1.getText().toString()); datos.flush(); datos.close(); }catch (IOException e){ } Toast.makeText(this, "DATOS GUARDADOS CORRECTAMENTE", Toast.LENGTH_SHORT).show(); finish(); }
[ "public", "void", "Guardar", "(", "View", "Guardar", ")", "{", "try", "{", "OutputStreamWriter", "datos", "=", "new", "OutputStreamWriter", "(", "openFileOutput", "(", "\"bitacora.txt\"", ",", "Activity", ".", "MODE_PRIVATE", ")", ")", ";", "datos", ".", "write", "(", "et1", ".", "getText", "(", ")", ".", "toString", "(", ")", ")", ";", "datos", ".", "flush", "(", ")", ";", "datos", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "}", "Toast", ".", "makeText", "(", "this", ",", "\"DATOS GUARDADOS CORRECTAMENTE\"", ",", "Toast", ".", "LENGTH_SHORT", ")", ".", "show", "(", ")", ";", "finish", "(", ")", ";", "}" ]
[ 60, 4 ]
[ 72, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
AnimesApiResource.
null
Método que devuelve todos los animes
Método que devuelve todos los animes
@GET @Produces("application/json") public Collection<Anime> getAllAnimes() { return repository.getAllAnimes(); }
[ "@", "GET", "@", "Produces", "(", "\"application/json\"", ")", "public", "Collection", "<", "Anime", ">", "getAllAnimes", "(", ")", "{", "return", "repository", ".", "getAllAnimes", "(", ")", ";", "}" ]
[ 50, 1 ]
[ 54, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
CrearCuenta.
null
Método para cuando se enfoca en CampoNombre
Método para cuando se enfoca en CampoNombre
private void CampoNombreFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_CampoNombreFocusGained // Obtiene contenido de campo String Contenido = this.CampoNombre.getText(); // Obtiene color de campo Color ColorActual = this.CampoNombre.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(s)") && (ColorActual == ColorNoEscrito)) { // Limpiamos contenido this.CampoNombre.setText(""); this.CampoNombre.setForeground(ColorEscribir); } else { this.CampoNombre.setForeground(ColorEscribir); } }
[ "private", "void", "CampoNombreFocusGained", "(", "java", ".", "awt", ".", "event", ".", "FocusEvent", "evt", ")", "{", "//GEN-FIRST:event_CampoNombreFocusGained", "// Obtiene contenido de campo", "String", "Contenido", "=", "this", ".", "CampoNombre", ".", "getText", "(", ")", ";", "// Obtiene color de campo", "Color", "ColorActual", "=", "this", ".", "CampoNombre", ".", "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(s)\"", ")", "&&", "(", "ColorActual", "==", "ColorNoEscrito", ")", ")", "{", "// Limpiamos contenido", "this", ".", "CampoNombre", ".", "setText", "(", "\"\"", ")", ";", "this", ".", "CampoNombre", ".", "setForeground", "(", "ColorEscribir", ")", ";", "}", "else", "{", "this", ".", "CampoNombre", ".", "setForeground", "(", "ColorEscribir", ")", ";", "}", "}" ]
[ 912, 4 ]
[ 933, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
EmpTransp.
null
1) Algo pasa que no calcula el costo de servicio correctamente y arroja siempre cero
1) Algo pasa que no calcula el costo de servicio correctamente y arroja siempre cero
public String rentaCamionTurista(int cantPasajeros, int km){ StringBuilder cad; cad = new StringBuilder(); int i; for(i = 0; i < totalCamiones; i++){ if(camiones[i] instanceof Turismo){ //camiones[i].setDisponibilidad(false); cad = cad.append(camiones[i].toString()); cad = cad.append("\nCosto de servicio: "+((Turismo)camiones[i]).calculaCostoServicio(km, cantPasajeros)); } } return cad.toString(); }
[ "public", "String", "rentaCamionTurista", "(", "int", "cantPasajeros", ",", "int", "km", ")", "{", "StringBuilder", "cad", ";", "cad", "=", "new", "StringBuilder", "(", ")", ";", "int", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "totalCamiones", ";", "i", "++", ")", "{", "if", "(", "camiones", "[", "i", "]", "instanceof", "Turismo", ")", "{", "//camiones[i].setDisponibilidad(false);\r", "cad", "=", "cad", ".", "append", "(", "camiones", "[", "i", "]", ".", "toString", "(", ")", ")", ";", "cad", "=", "cad", ".", "append", "(", "\"\\nCosto de servicio: \"", "+", "(", "(", "Turismo", ")", "camiones", "[", "i", "]", ")", ".", "calculaCostoServicio", "(", "km", ",", "cantPasajeros", ")", ")", ";", "}", "}", "return", "cad", ".", "toString", "(", ")", ";", "}" ]
[ 80, 4 ]
[ 93, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
CommonUtil.
null
Resetea los milisegundos de un date
Resetea los milisegundos de un date
public static Date resetMillis(Date dt) { return new Date(dt.getTime() - (dt.getTime()%1000)); }
[ "public", "static", "Date", "resetMillis", "(", "Date", "dt", ")", "{", "return", "new", "Date", "(", "dt", ".", "getTime", "(", ")", "-", "(", "dt", ".", "getTime", "(", ")", "%", "1000", ")", ")", ";", "}" ]
[ 772, 1 ]
[ 775, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
MainActivity.
null
cambiar el icono y las prefenrencias sobre el ajuste del sonido
cambiar el icono y las prefenrencias sobre el ajuste del sonido
public void muteTemp(View view){ if(mediaPlayer.isPlaying()){ mediaPlayer.pause(); sonido = true; sharedPref.edit().putBoolean(Ajustes.KEY_MUTE_MUSIC,true).apply(); muteButton.setImageResource(R.drawable.ic_volume_off_black_24dp); }else{ mediaPlayer.start(); sonido = false; sharedPref.edit().putBoolean(Ajustes.KEY_MUTE_MUSIC,false).apply(); muteButton.setImageResource(R.drawable.ic_volume_up_black_24dp); } }
[ "public", "void", "muteTemp", "(", "View", "view", ")", "{", "if", "(", "mediaPlayer", ".", "isPlaying", "(", ")", ")", "{", "mediaPlayer", ".", "pause", "(", ")", ";", "sonido", "=", "true", ";", "sharedPref", ".", "edit", "(", ")", ".", "putBoolean", "(", "Ajustes", ".", "KEY_MUTE_MUSIC", ",", "true", ")", ".", "apply", "(", ")", ";", "muteButton", ".", "setImageResource", "(", "R", ".", "drawable", ".", "ic_volume_off_black_24dp", ")", ";", "}", "else", "{", "mediaPlayer", ".", "start", "(", ")", ";", "sonido", "=", "false", ";", "sharedPref", ".", "edit", "(", ")", ".", "putBoolean", "(", "Ajustes", ".", "KEY_MUTE_MUSIC", ",", "false", ")", ".", "apply", "(", ")", ";", "muteButton", ".", "setImageResource", "(", "R", ".", "drawable", ".", "ic_volume_up_black_24dp", ")", ";", "}", "}" ]
[ 126, 4 ]
[ 138, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Nota.
null
2c)Getters -> Consultar los atributos de la clase.
2c)Getters -> Consultar los atributos de la clase.
public int getCodigo() { return codigo; }
[ "public", "int", "getCodigo", "(", ")", "{", "return", "codigo", ";", "}" ]
[ 129, 4 ]
[ 131, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
CropOverlayView.
null
Metodo para asignar el bitmap (foto capturada) al overlay y resetear los puntos de referencia Invocar al metodo invalidate() de View para repintar la pantalla
Metodo para asignar el bitmap (foto capturada) al overlay y resetear los puntos de referencia Invocar al metodo invalidate() de View para repintar la pantalla
public void setBitmap(Bitmap bitmap) { this.bitmap = bitmap; resetPoints(); invalidate(); }
[ "public", "void", "setBitmap", "(", "Bitmap", "bitmap", ")", "{", "this", ".", "bitmap", "=", "bitmap", ";", "resetPoints", "(", ")", ";", "invalidate", "(", ")", ";", "}" ]
[ 58, 4 ]
[ 62, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
CrearCuenta.
null
Método para cuando se presiona en CampoTelefono con el mouse
Método para cuando se presiona en CampoTelefono con el mouse
private void CampoTelefonoMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_CampoTelefonoMousePressed // Obtener contenido String Contenido = this.CampoTelefono.getText(); Color ColorActual = this.CampoTelefono.getForeground(); Color ColorEscrito = new Color(51, 51, 51); // Verifica si no tiene nada seteado aún if(Contenido.equals("Teléfono")) { // Elimina contenido this.CampoTelefono.setText(""); } if(ColorActual != ColorEscrito) { this.CampoTelefono.setForeground(ColorEscrito); } }
[ "private", "void", "CampoTelefonoMousePressed", "(", "java", ".", "awt", ".", "event", ".", "MouseEvent", "evt", ")", "{", "//GEN-FIRST:event_CampoTelefonoMousePressed", "// Obtener contenido", "String", "Contenido", "=", "this", ".", "CampoTelefono", ".", "getText", "(", ")", ";", "Color", "ColorActual", "=", "this", ".", "CampoTelefono", ".", "getForeground", "(", ")", ";", "Color", "ColorEscrito", "=", "new", "Color", "(", "51", ",", "51", ",", "51", ")", ";", "// Verifica si no tiene nada seteado aún", "if", "(", "Contenido", ".", "equals", "(", "\"Teléfono\")", ")", "", "{", "// Elimina contenido", "this", ".", "CampoTelefono", ".", "setText", "(", "\"\"", ")", ";", "}", "if", "(", "ColorActual", "!=", "ColorEscrito", ")", "{", "this", ".", "CampoTelefono", ".", "setForeground", "(", "ColorEscrito", ")", ";", "}", "}" ]
[ 1158, 4 ]
[ 1173, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
AmigosUsuController.
null
Buscar por los ids de usuario (metodo propio, el que esta por defecto falla)
Buscar por los ids de usuario (metodo propio, el que esta por defecto falla)
@CrossOrigin(origins = "http://localhost:4200") @GetMapping("/getAmigosUsuPorIds/{idSol}/{usuIdRecept}") public ResponseEntity<AmigosUsu> getAmigosUsuPorIds(@PathVariable int idSol, @PathVariable int usuIdRecept) { ArrayList<AmigosUsu> listaAmigosUsu = new ArrayList<AmigosUsu>(); AmigosUsu amUsu = new AmigosUsu(); AmigosUsu amUsuDev = new AmigosUsu(); amUsu = service.findAmigoUsuIds(idSol, usuIdRecept); listaAmigosUsu.add(amUsu); if (amUsu != null) { listaAmigosUsu = quitarListasUsu(listaAmigosUsu); amUsuDev = listaAmigosUsu.get(0); } return new ResponseEntity<AmigosUsu>(amUsuDev, HttpStatus.OK); }
[ "@", "CrossOrigin", "(", "origins", "=", "\"http://localhost:4200\"", ")", "@", "GetMapping", "(", "\"/getAmigosUsuPorIds/{idSol}/{usuIdRecept}\"", ")", "public", "ResponseEntity", "<", "AmigosUsu", ">", "getAmigosUsuPorIds", "(", "@", "PathVariable", "int", "idSol", ",", "@", "PathVariable", "int", "usuIdRecept", ")", "{", "ArrayList", "<", "AmigosUsu", ">", "listaAmigosUsu", "=", "new", "ArrayList", "<", "AmigosUsu", ">", "(", ")", ";", "AmigosUsu", "amUsu", "=", "new", "AmigosUsu", "(", ")", ";", "AmigosUsu", "amUsuDev", "=", "new", "AmigosUsu", "(", ")", ";", "amUsu", "=", "service", ".", "findAmigoUsuIds", "(", "idSol", ",", "usuIdRecept", ")", ";", "listaAmigosUsu", ".", "add", "(", "amUsu", ")", ";", "if", "(", "amUsu", "!=", "null", ")", "{", "listaAmigosUsu", "=", "quitarListasUsu", "(", "listaAmigosUsu", ")", ";", "amUsuDev", "=", "listaAmigosUsu", ".", "get", "(", "0", ")", ";", "}", "return", "new", "ResponseEntity", "<", "AmigosUsu", ">", "(", "amUsuDev", ",", "HttpStatus", ".", "OK", ")", ";", "}" ]
[ 179, 1 ]
[ 199, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
DatabaseRecordTest.
null
/* Comprobamos los setVariableValue y setSelectField
/* Comprobamos los setVariableValue y setSelectField
@Test public void setVariableValue_setSelectField(){ recordGeneral_1.setSelectField("Columna_General_1"); recordGeneral_2.setVariableValue("Columna_General_2", "Valor_General"); assertThat(recordGeneral_1.getStringValue("Columna_General_1")).isEqualTo(null); assertThat(recordGeneral_2.getStringValue("Columna_General_2")).isNotEqualTo("Valor_General_2"); }
[ "@", "Test", "public", "void", "setVariableValue_setSelectField", "(", ")", "{", "recordGeneral_1", ".", "setSelectField", "(", "\"Columna_General_1\"", ")", ";", "recordGeneral_2", ".", "setVariableValue", "(", "\"Columna_General_2\"", ",", "\"Valor_General\"", ")", ";", "assertThat", "(", "recordGeneral_1", ".", "getStringValue", "(", "\"Columna_General_1\"", ")", ")", ".", "isEqualTo", "(", "null", ")", ";", "assertThat", "(", "recordGeneral_2", ".", "getStringValue", "(", "\"Columna_General_2\"", ")", ")", ".", "isNotEqualTo", "(", "\"Valor_General_2\"", ")", ";", "}" ]
[ 36, 1 ]
[ 43, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Tablero.
null
Tablero entrega la colección de las casillas que están vacías
Tablero entrega la colección de las casillas que están vacías
public ArrayList<Casilla> obtenerCasillasVacias(){ //Declarar la colección ArrayList<Casilla> casillasLibres = new ArrayList<Casilla>(); //Recorrer todo el tablero for (int i = 0; i < Tablero.NUM_FILAS; i++) { for (int j = 0; j < Tablero.NUM_COLUMNAS; j++) { //Filtrar las casillas que están libres para retornaralas if(casillas[i][j].getLibre()){ casillasLibres.add(casillas[i][j]); } } } //Retornar colección de casillas libres return casillasLibres; }
[ "public", "ArrayList", "<", "Casilla", ">", "obtenerCasillasVacias", "(", ")", "{", "//Declarar la colección", "ArrayList", "<", "Casilla", ">", "casillasLibres", "=", "new", "ArrayList", "<", "Casilla", ">", "(", ")", ";", "//Recorrer todo el tablero", "for", "(", "int", "i", "=", "0", ";", "i", "<", "Tablero", ".", "NUM_FILAS", ";", "i", "++", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "Tablero", ".", "NUM_COLUMNAS", ";", "j", "++", ")", "{", "//Filtrar las casillas que están libres para retornaralas", "if", "(", "casillas", "[", "i", "]", "[", "j", "]", ".", "getLibre", "(", ")", ")", "{", "casillasLibres", ".", "add", "(", "casillas", "[", "i", "]", "[", "j", "]", ")", ";", "}", "}", "}", "//Retornar colección de casillas libres", "return", "casillasLibres", ";", "}" ]
[ 26, 4 ]
[ 44, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
WsGamesHandler.
null
Se ejecuta cuando se ha establecido la conexión con el cliente
Se ejecuta cuando se ha establecido la conexión con el cliente
@Override public void afterConnectionEstablished(WebSocketSession session) throws Exception { }
[ "@", "Override", "public", "void", "afterConnectionEstablished", "(", "WebSocketSession", "session", ")", "throws", "Exception", "{", "}" ]
[ 30, 1 ]
[ 33, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Pipeline.
null
Método que devuelve true si el tipo de predicción es taken
Método que devuelve true si el tipo de predicción es taken
private boolean predictTaken() { return TIPUSPREDICCIO == predictionType.TAKEN || (TIPUSPREDICCIO == predictionType.ONEBIT && BranchManager.getOnebitPredictor() == 1) || (TIPUSPREDICCIO == predictionType.TWOBIT && BranchManager.getTwobitPredictor() > 1); }
[ "private", "boolean", "predictTaken", "(", ")", "{", "return", "TIPUSPREDICCIO", "==", "predictionType", ".", "TAKEN", "||", "(", "TIPUSPREDICCIO", "==", "predictionType", ".", "ONEBIT", "&&", "BranchManager", ".", "getOnebitPredictor", "(", ")", "==", "1", ")", "||", "(", "TIPUSPREDICCIO", "==", "predictionType", ".", "TWOBIT", "&&", "BranchManager", ".", "getTwobitPredictor", "(", ")", ">", "1", ")", ";", "}" ]
[ 361, 4 ]
[ 365, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
ModelProveedorMotor.
null
Retorma arreglo con campos de la clase
Retorma arreglo con campos de la clase
public Object[] toArray(){ Object[] data = {nombre, direccion, telefono}; return data; }
[ "public", "Object", "[", "]", "toArray", "(", ")", "{", "Object", "[", "]", "data", "=", "{", "nombre", ",", "direccion", ",", "telefono", "}", ";", "return", "data", ";", "}" ]
[ 58, 4 ]
[ 61, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
ConnectionAdmin.
null
Se conecta a una Base de datos de una instancia de MongoDB Cloud
Se conecta a una Base de datos de una instancia de MongoDB Cloud
public boolean connectMongo() { mongoClient = MongoClients.create(urlConexion); //get database database = mongoClient.getDatabase(nombreBD); return (mongoClient!=null & database!=null); }
[ "public", "boolean", "connectMongo", "(", ")", "{", "mongoClient", "=", "MongoClients", ".", "create", "(", "urlConexion", ")", ";", "//get database", "database", "=", "mongoClient", ".", "getDatabase", "(", "nombreBD", ")", ";", "return", "(", "mongoClient", "!=", "null", "&", "database", "!=", "null", ")", ";", "}" ]
[ 81, 1 ]
[ 89, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
JsonReader.
null
Devuelve las listas como un solo String separado por ","
Devuelve las listas como un solo String separado por ","
public String getPaises(){ String joined = String.join(", ", paises); if(joined.equals("")) joined = "Unknown"; return joined; }
[ "public", "String", "getPaises", "(", ")", "{", "String", "joined", "=", "String", ".", "join", "(", "\", \"", ",", "paises", ")", ";", "if", "(", "joined", ".", "equals", "(", "\"\"", ")", ")", "joined", "=", "\"Unknown\"", ";", "return", "joined", ";", "}" ]
[ 92, 2 ]
[ 97, 3 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
CommonUtil.
null
Transforma un encoding name en nombre canónico (establecido por iana, domain Encoding en genexus) al nombre esperado por jdk
Transforma un encoding name en nombre canónico (establecido por iana, domain Encoding en genexus) al nombre esperado por jdk
public static String normalizeEncodingName(String enc) { // when no encoding find use is0-8859 as default in java std, used in several places. return normalizeEncodingName(enc, "ISO-8859-1"); }
[ "public", "static", "String", "normalizeEncodingName", "(", "String", "enc", ")", "{", "// when no encoding find use is0-8859 as default in java std, used in several places.", "return", "normalizeEncodingName", "(", "enc", ",", "\"ISO-8859-1\"", ")", ";", "}" ]
[ 2051, 1 ]
[ 2055, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
SSLManager.
null
Obtiene una instancia de ISSLConnection Este metodo se llama directamente desde SMTPSession y POP3Session @param uniqueInstance Indica si se quiere obtener la instancia como un singleton @see SMTPSession y POP3Session @return ISSLConnection
Obtiene una instancia de ISSLConnection Este metodo se llama directamente desde SMTPSession y POP3Session
public static ISSLConnection getSSLConnection(boolean uniqueInstance) { if(uniqueInstance) { if (sslConnection != null)return (ISSLConnection) sslConnection.clone(); } else { sslConnection = null; } //Si se quiere usar TLS retorno enseguida la conexion if(Boolean.getBoolean("HTTPClient.sslUseTLS")) { try { sslConnection = new TLSConnection(); return sslConnection; }catch(Throwable TLSNotAvailable){ TLSNotAvailable.printStackTrace(); } } // Primero probamos con JSSE if(!Boolean.getBoolean("HTTPClient.sslDontUseJSSE")) { try { sslConnection = new JSSESSLConnection(); }catch(Throwable JSSENotAvailable){ ; } } // Sino, retornamos un DefaultSSLConnection (es decir, conexiones sin SSL) if(sslConnection == null) sslConnection = new DefaultSSLConnection(); return (ISSLConnection)sslConnection.clone(); }
[ "public", "static", "ISSLConnection", "getSSLConnection", "(", "boolean", "uniqueInstance", ")", "{", "if", "(", "uniqueInstance", ")", "{", "if", "(", "sslConnection", "!=", "null", ")", "return", "(", "ISSLConnection", ")", "sslConnection", ".", "clone", "(", ")", ";", "}", "else", "{", "sslConnection", "=", "null", ";", "}", "//Si se quiere usar TLS retorno enseguida la conexion", "if", "(", "Boolean", ".", "getBoolean", "(", "\"HTTPClient.sslUseTLS\"", ")", ")", "{", "try", "{", "sslConnection", "=", "new", "TLSConnection", "(", ")", ";", "return", "sslConnection", ";", "}", "catch", "(", "Throwable", "TLSNotAvailable", ")", "{", "TLSNotAvailable", ".", "printStackTrace", "(", ")", ";", "}", "}", "// Primero probamos con JSSE", "if", "(", "!", "Boolean", ".", "getBoolean", "(", "\"HTTPClient.sslDontUseJSSE\"", ")", ")", "{", "try", "{", "sslConnection", "=", "new", "JSSESSLConnection", "(", ")", ";", "}", "catch", "(", "Throwable", "JSSENotAvailable", ")", "{", ";", "}", "}", "// Sino, retornamos un DefaultSSLConnection (es decir, conexiones sin SSL)", "if", "(", "sslConnection", "==", "null", ")", "sslConnection", "=", "new", "DefaultSSLConnection", "(", ")", ";", "return", "(", "ISSLConnection", ")", "sslConnection", ".", "clone", "(", ")", ";", "}" ]
[ 30, 2 ]
[ 64, 3 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
TransaccionesService.
null
Transacciones de DPF
Transacciones de DPF
private List<Pfmdp> getListaDpf(List<Gbage> listaPersonas){ List<Pfmdp> listaDpf = new ArrayList<>(); for(Gbage persona: listaPersonas){ List<Pfmdp> pfmdpList = pfmdpRepository.findByPfmdpcage(persona.getGbagecage()); listaDpf.addAll(pfmdpList); } return listaDpf; }
[ "private", "List", "<", "Pfmdp", ">", "getListaDpf", "(", "List", "<", "Gbage", ">", "listaPersonas", ")", "{", "List", "<", "Pfmdp", ">", "listaDpf", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Gbage", "persona", ":", "listaPersonas", ")", "{", "List", "<", "Pfmdp", ">", "pfmdpList", "=", "pfmdpRepository", ".", "findByPfmdpcage", "(", "persona", ".", "getGbagecage", "(", ")", ")", ";", "listaDpf", ".", "addAll", "(", "pfmdpList", ")", ";", "}", "return", "listaDpf", ";", "}" ]
[ 206, 4 ]
[ 214, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Login.
null
Configuración de opciones de navegación
Configuración de opciones de navegación
@Override public boolean onOptionsItemSelected(MenuItem opcion){ int id=opcion.getItemId(); //Ejecuta el metodo acerca_app switch (id) { case R.id.info_app: acerca_app(null); return true; case R.id.verdoc: documento(null); return true; } //Selección de la opción return super.onOptionsItemSelected(opcion); }
[ "@", "Override", "public", "boolean", "onOptionsItemSelected", "(", "MenuItem", "opcion", ")", "{", "int", "id", "=", "opcion", ".", "getItemId", "(", ")", ";", "//Ejecuta el metodo acerca_app", "switch", "(", "id", ")", "{", "case", "R", ".", "id", ".", "info_app", ":", "acerca_app", "(", "null", ")", ";", "return", "true", ";", "case", "R", ".", "id", ".", "verdoc", ":", "documento", "(", "null", ")", ";", "return", "true", ";", "}", "//Selección de la opción", "return", "super", ".", "onOptionsItemSelected", "(", "opcion", ")", ";", "}" ]
[ 225, 4 ]
[ 238, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Contacto.
null
devuelve el telefono
devuelve el telefono
public String getTelefono() { return telefono; }
[ "public", "String", "getTelefono", "(", ")", "{", "return", "telefono", ";", "}" ]
[ 72, 1 ]
[ 74, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
AmigosUsuService.
null
Buscar amigos del usuario
Buscar amigos del usuario
public List<AmigosUsu> findAmigosUsuario(Integer idUsuSolicitud, Integer idUsuRecep) { // Usuario usuSol = new Usuario(); // Usuario usuRecept = new Usuario(); // usuSol.setIdUsu(idUsuSolicitud); // usuRecept.setIdUsu(idUsuRecep); ArrayList<AmigosUsu> listaAmUsu = new ArrayList<AmigosUsu>(); listaAmUsu = (ArrayList<AmigosUsu>) repository.findAmigosUsuario(idUsuSolicitud, idUsuRecep); return listaAmUsu; }
[ "public", "List", "<", "AmigosUsu", ">", "findAmigosUsuario", "(", "Integer", "idUsuSolicitud", ",", "Integer", "idUsuRecep", ")", "{", "// Usuario usuSol = new Usuario();\r", "// Usuario usuRecept = new Usuario();\r", "// usuSol.setIdUsu(idUsuSolicitud);\r", "// usuRecept.setIdUsu(idUsuRecep);\r", "ArrayList", "<", "AmigosUsu", ">", "listaAmUsu", "=", "new", "ArrayList", "<", "AmigosUsu", ">", "(", ")", ";", "listaAmUsu", "=", "(", "ArrayList", "<", "AmigosUsu", ">", ")", "repository", ".", "findAmigosUsuario", "(", "idUsuSolicitud", ",", "idUsuRecep", ")", ";", "return", "listaAmUsu", ";", "}" ]
[ 66, 1 ]
[ 77, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Suma.
null
creamos metodo para poder imprimir el restulado
creamos metodo para poder imprimir el restulado
public void Imprimir(){ //mandamos a llamar al metodo que hace la suma Operacion(); System.out.println("El resultado de la suma es: " + r); }
[ "public", "void", "Imprimir", "(", ")", "{", "//mandamos a llamar al metodo que hace la suma\r", "Operacion", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"El resultado de la suma es: \"", "+", "r", ")", ";", "}" ]
[ 19, 4 ]
[ 23, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
CrearCuenta.
null
Método para cuando se está escribiendo en CampoContrasena
Método para cuando se está escribiendo en CampoContrasena
private void CampoContrasenaKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_CampoContrasenaKeyTyped // Obtiene contenido actual de Contraseña String Contenido = this.CampoContrasena.getText(); String ContenidoReemplazar; ContenidoReemplazar = ""; if(Contenido.equals("")) { ContrasenaTemp = ""; } if(evt.getKeyChar() >= ' ' && evt.getKeyChar() <= '■') { ContrasenaTemp += evt.getKeyChar(); } else { if(evt.getKeyChar() == '\b') { ContrasenaTemp = ContrasenaTemp.substring(0, ContrasenaTemp.length() - 1); } } // Contador int x; for(x = 0; x < Contenido.length(); x++) { ContenidoReemplazar += "•"; } if(!Contenido.equals("Contraseña")) { this.CampoContrasena.setText(ContenidoReemplazar); } }
[ "private", "void", "CampoContrasenaKeyTyped", "(", "java", ".", "awt", ".", "event", ".", "KeyEvent", "evt", ")", "{", "//GEN-FIRST:event_CampoContrasenaKeyTyped", "// Obtiene contenido actual de Contraseña", "String", "Contenido", "=", "this", ".", "CampoContrasena", ".", "getText", "(", ")", ";", "String", "ContenidoReemplazar", ";", "ContenidoReemplazar", "=", "\"\"", ";", "if", "(", "Contenido", ".", "equals", "(", "\"\"", ")", ")", "{", "ContrasenaTemp", "=", "\"\"", ";", "}", "if", "(", "evt", ".", "getKeyChar", "(", ")", ">=", "'", "'", "&&", "evt", ".", "getKeyChar", "(", ")", "<=", "'", "", "", "{", "ContrasenaTemp", "+=", "evt", ".", "getKeyChar", "(", ")", ";", "}", "else", "{", "if", "(", "evt", ".", "getKeyChar", "(", ")", "==", "'", "'", ")", "{", "ContrasenaTemp", "=", "ContrasenaTemp", ".", "substring", "(", "0", ",", "ContrasenaTemp", ".", "length", "(", ")", "-", "1", ")", ";", "}", "}", "// Contador", "int", "x", ";", "for", "(", "x", "=", "0", ";", "x", "<", "Contenido", ".", "length", "(", ")", ";", "x", "++", ")", "{", "ContenidoReemplazar", "+=", "\"•\";", "", "}", "if", "(", "!", "Contenido", ".", "equals", "(", "\"Contraseña\")", ")", "", "{", "this", ".", "CampoContrasena", ".", "setText", "(", "ContenidoReemplazar", ")", ";", "}", "}" ]
[ 727, 4 ]
[ 758, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Ejercicio2.
null
Función que recoge precio de venta y cantidad del producto
Función que recoge precio de venta y cantidad del producto
public static int[] leerInfoProducto(){ //Arreglo que recibe información int[] arregloInfoProducto = new int[2]; //Construcción del scanner Scanner lector = new Scanner(System.in); //Recoger precio del producto System.out.println("Ingrese el precio del producto-> "); arregloInfoProducto[0] = lector.nextInt(); //Recoger cantidad del producto System.out.println("Ingrese la cantidad del producto-> "); arregloInfoProducto[1] = lector.nextInt(); //Cierre del scanner (no es obligatorio) lector.close(); //Retornamos la información coleccionada en un arreglo (lista Python rígida) return arregloInfoProducto; }
[ "public", "static", "int", "[", "]", "leerInfoProducto", "(", ")", "{", "//Arreglo que recibe información", "int", "[", "]", "arregloInfoProducto", "=", "new", "int", "[", "2", "]", ";", "//Construcción del scanner", "Scanner", "lector", "=", "new", "Scanner", "(", "System", ".", "in", ")", ";", "//Recoger precio del producto ", "System", ".", "out", ".", "println", "(", "\"Ingrese el precio del producto-> \"", ")", ";", "arregloInfoProducto", "[", "0", "]", "=", "lector", ".", "nextInt", "(", ")", ";", "//Recoger cantidad del producto", "System", ".", "out", ".", "println", "(", "\"Ingrese la cantidad del producto-> \"", ")", ";", "arregloInfoProducto", "[", "1", "]", "=", "lector", ".", "nextInt", "(", ")", ";", "//Cierre del scanner (no es obligatorio)", "lector", ".", "close", "(", ")", ";", "//Retornamos la información coleccionada en un arreglo (lista Python rígida)", "return", "arregloInfoProducto", ";", "}" ]
[ 19, 4 ]
[ 40, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Tablero.
null
Indicar si está lleno o no el tablero -> Jugador, Juego
Indicar si está lleno o no el tablero -> Jugador, Juego
public boolean estaLleno(){ ArrayList<Casilla> casillasLibres = this.obtenerCasillasVacias(); if(casillasLibres.isEmpty()){ return true;//Está lleno porque casillasLibres no tiene elementos }else{ return false;//Hay desde 1 hasta 9 posibles casillasLibres } }
[ "public", "boolean", "estaLleno", "(", ")", "{", "ArrayList", "<", "Casilla", ">", "casillasLibres", "=", "this", ".", "obtenerCasillasVacias", "(", ")", ";", "if", "(", "casillasLibres", ".", "isEmpty", "(", ")", ")", "{", "return", "true", ";", "//Está lleno porque casillasLibres no tiene elementos", "}", "else", "{", "return", "false", ";", "//Hay desde 1 hasta 9 posibles casillasLibres", "}", "}" ]
[ 47, 4 ]
[ 54, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Imprimir.
null
Método para imprimir una lista de productos
Método para imprimir una lista de productos
public void imprimirProductosLista (List<ProductosLimpieza> lp) { lp.forEach(x -> System.out.println(x)); }
[ "public", "void", "imprimirProductosLista", "(", "List", "<", "ProductosLimpieza", ">", "lp", ")", "{", "lp", ".", "forEach", "(", "x", "->", "System", ".", "out", ".", "println", "(", "x", ")", ")", ";", "}" ]
[ 37, 0 ]
[ 39, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Dados.
null
Devuelve el numero del dado en el indice pedido
Devuelve el numero del dado en el indice pedido
public int getDado(int indiceDelDado){ return conjuntoDados.get(indiceDelDado); }
[ "public", "int", "getDado", "(", "int", "indiceDelDado", ")", "{", "return", "conjuntoDados", ".", "get", "(", "indiceDelDado", ")", ";", "}" ]
[ 29, 4 ]
[ 31, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
LLFunciones.
null
Creamos el primer metodo privado para que los programadores no puedana cceder
Creamos el primer metodo privado para que los programadores no puedana cceder
private void Llenado() { if(kilos <= 12){ llenadoCompleto = 1; System.out.println("Llenando..."); System.out.println("Lenado completo"); }else { System.out.println("La carga de ropa es muy pesada, reduce la carga"); } }
[ "private", "void", "Llenado", "(", ")", "{", "if", "(", "kilos", "<=", "12", ")", "{", "llenadoCompleto", "=", "1", ";", "System", ".", "out", ".", "println", "(", "\"Llenando...\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"Lenado completo\"", ")", ";", "}", "else", "{", "System", ".", "out", ".", "println", "(", "\"La carga de ropa es muy pesada, reduce la carga\"", ")", ";", "}", "}" ]
[ 20, 1 ]
[ 29, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
ControladoraHotel.
null
utiliza la funcion compareTo de fecha para deterctar si la fecha de alta de una reserva esta en el rango de fechas desde y hasta
utiliza la funcion compareTo de fecha para deterctar si la fecha de alta de una reserva esta en el rango de fechas desde y hasta
public List<Reserva> traerReservaEmpleadoPorFecha(Date fecha_desde, Date fecha_hasta, List<Reserva> lista_reserva) { List<Reserva> lista_filtrada = new ArrayList<Reserva>(); for (Reserva res : lista_reserva) { if (res.getFecha_alta_reserva().compareTo(fecha_desde) >= 0 && res.getFecha_alta_reserva().compareTo(fecha_hasta) <= 0) { lista_filtrada.add(res); } } return lista_filtrada; }
[ "public", "List", "<", "Reserva", ">", "traerReservaEmpleadoPorFecha", "(", "Date", "fecha_desde", ",", "Date", "fecha_hasta", ",", "List", "<", "Reserva", ">", "lista_reserva", ")", "{", "List", "<", "Reserva", ">", "lista_filtrada", "=", "new", "ArrayList", "<", "Reserva", ">", "(", ")", ";", "for", "(", "Reserva", "res", ":", "lista_reserva", ")", "{", "if", "(", "res", ".", "getFecha_alta_reserva", "(", ")", ".", "compareTo", "(", "fecha_desde", ")", ">=", "0", "&&", "res", ".", "getFecha_alta_reserva", "(", ")", ".", "compareTo", "(", "fecha_hasta", ")", "<=", "0", ")", "{", "lista_filtrada", ".", "add", "(", "res", ")", ";", "}", "}", "return", "lista_filtrada", ";", "}" ]
[ 231, 4 ]
[ 243, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
EmpresaTest.
null
Test de regresión: probamos sobrepasar el máximo posible de antigüedad
Test de regresión: probamos sobrepasar el máximo posible de antigüedad
@Test public void laEmpresaDebePoderObtenerElSueldoDeUneGerenteConParejaSinHijesConAntiguedad37() { Empresa miEmpresa1 = new Empresa(); EmpleadeAbstracte miGerenteConParejaSinHijesConAntiguedad20 = new Gerente("Ana De la Cumbre", CON_PAREJA, SIN_HIJES, ANTIGUEDAD_20); miEmpresa1.contratar(miGerenteConParejaSinHijesConAntiguedad20); Empresa miEmpresa2 = new Empresa(); EmpleadeAbstracte miGerenteConParejaSinHijesConAntiguedad37 = new Gerente("Ana De la Cumbre", CON_PAREJA, SIN_HIJES, ANTIGUEDAD_37); miEmpresa2.contratar(miGerenteConParejaSinHijesConAntiguedad37); // El Cálculo para Gerente: // Sueldo Básico + Salario Familiar + Antigüedad + Asig. por Personal a Cargo // // Sueldo Básico = 1000.0 // Salario Familar = 200.0 * hije + 100.0 si tiene pareja registrada // Antigüedad: 100 * Año, max: 2000. // Asig. por Personal a Cargo: 2000 (fijo) // Si A > 20, el resultado debería ser igual a si A == 20. assertEquals(miEmpresa1.obtTotalDeSueldos(), miEmpresa2.obtTotalDeSueldos()); }
[ "@", "Test", "public", "void", "laEmpresaDebePoderObtenerElSueldoDeUneGerenteConParejaSinHijesConAntiguedad37", "(", ")", "{", "Empresa", "miEmpresa1", "=", "new", "Empresa", "(", ")", ";", "EmpleadeAbstracte", "miGerenteConParejaSinHijesConAntiguedad20", "=", "new", "Gerente", "(", "\"Ana De la Cumbre\"", ",", "CON_PAREJA", ",", "SIN_HIJES", ",", "ANTIGUEDAD_20", ")", ";", "miEmpresa1", ".", "contratar", "(", "miGerenteConParejaSinHijesConAntiguedad20", ")", ";", "Empresa", "miEmpresa2", "=", "new", "Empresa", "(", ")", ";", "EmpleadeAbstracte", "miGerenteConParejaSinHijesConAntiguedad37", "=", "new", "Gerente", "(", "\"Ana De la Cumbre\"", ",", "CON_PAREJA", ",", "SIN_HIJES", ",", "ANTIGUEDAD_37", ")", ";", "miEmpresa2", ".", "contratar", "(", "miGerenteConParejaSinHijesConAntiguedad37", ")", ";", "// El Cálculo para Gerente:", "// Sueldo Básico + Salario Familiar + Antigüedad + Asig. por Personal a Cargo", "//", "// Sueldo Básico = 1000.0", "// Salario Familar = 200.0 * hije + 100.0 si tiene pareja registrada", "// Antigüedad: 100 * Año, max: 2000.", "// Asig. por Personal a Cargo: 2000 (fijo)", "// Si A > 20, el resultado debería ser igual a si A == 20.", "assertEquals", "(", "miEmpresa1", ".", "obtTotalDeSueldos", "(", ")", ",", "miEmpresa2", ".", "obtTotalDeSueldos", "(", ")", ")", ";", "}" ]
[ 470, 1 ]
[ 493, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
WifiCommunicationPluginRoot.
null
toma direccion ip local y mask
toma direccion ip local y mask
private static void printParameter(NetworkInterface ni) { List<InterfaceAddress> list = ni.getInterfaceAddresses(); Iterator<InterfaceAddress> it = list.iterator(); while (it.hasNext()) { InterfaceAddress ia = it.next(); String dir = ia.getAddress().toString(); dir = dir.replace("/", ""); if (ia.getNetworkPrefixLength() > 8 && ia.getNetworkPrefixLength() < 32) { direccion = dir; //toma el broadcast de dicha interface InetAddress broad = getIPv4LocalNetMask(ia.getAddress(), ia.getNetworkPrefixLength()); maskara = broad.getHostAddress(); //System.out.println(" Network Prefijo= " + ia.getNetworkPrefixLength()); //System.out.println(""); } } }
[ "private", "static", "void", "printParameter", "(", "NetworkInterface", "ni", ")", "{", "List", "<", "InterfaceAddress", ">", "list", "=", "ni", ".", "getInterfaceAddresses", "(", ")", ";", "Iterator", "<", "InterfaceAddress", ">", "it", "=", "list", ".", "iterator", "(", ")", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "InterfaceAddress", "ia", "=", "it", ".", "next", "(", ")", ";", "String", "dir", "=", "ia", ".", "getAddress", "(", ")", ".", "toString", "(", ")", ";", "dir", "=", "dir", ".", "replace", "(", "\"/\"", ",", "\"\"", ")", ";", "if", "(", "ia", ".", "getNetworkPrefixLength", "(", ")", ">", "8", "&&", "ia", ".", "getNetworkPrefixLength", "(", ")", "<", "32", ")", "{", "direccion", "=", "dir", ";", "//toma el broadcast de dicha interface", "InetAddress", "broad", "=", "getIPv4LocalNetMask", "(", "ia", ".", "getAddress", "(", ")", ",", "ia", ".", "getNetworkPrefixLength", "(", ")", ")", ";", "maskara", "=", "broad", ".", "getHostAddress", "(", ")", ";", "//System.out.println(\" Network Prefijo= \" + ia.getNetworkPrefixLength());", "//System.out.println(\"\");", "}", "}", "}" ]
[ 412, 1 ]
[ 445, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
AutorController.
null
LISTANDO TODOS LOS AUTORES
LISTANDO TODOS LOS AUTORES
@GetMapping("/listarautores") public List<Autor> listarAutores(){ return aService.listarTodosAutores(); }
[ "@", "GetMapping", "(", "\"/listarautores\"", ")", "public", "List", "<", "Autor", ">", "listarAutores", "(", ")", "{", "return", "aService", ".", "listarTodosAutores", "(", ")", ";", "}" ]
[ 89, 1 ]
[ 92, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
BasicSecuritySystemTest.
null
para alcanzar la estabilidad.
para alcanzar la estabilidad.
@Test public void Given_An_SecuritySystem_With_An_Not_Stable_ElectricSystem_When_Perform_Method_Is_Called_Then_All_Devices_Are_TurnedOff(){ //Given when(electricSystem.isStable()).thenReturn(false); //When securitySystem.perform(); //Then Mockito.verify(device1).turnOff(); Mockito.verify(device2).turnOff(); }
[ "@", "Test", "public", "void", "Given_An_SecuritySystem_With_An_Not_Stable_ElectricSystem_When_Perform_Method_Is_Called_Then_All_Devices_Are_TurnedOff", "(", ")", "{", "//Given", "when", "(", "electricSystem", ".", "isStable", "(", ")", ")", ".", "thenReturn", "(", "false", ")", ";", "//When", "securitySystem", ".", "perform", "(", ")", ";", "//Then", "Mockito", ".", "verify", "(", "device1", ")", ".", "turnOff", "(", ")", ";", "Mockito", ".", "verify", "(", "device2", ")", ".", "turnOff", "(", ")", ";", "}" ]
[ 37, 4 ]
[ 49, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Cita.
null
Método que da de alta una cita con fecha, hora y motivo.
Método que da de alta una cita con fecha, hora y motivo.
public void crearCita() { try { // Establecer conexión. Class.forName("org.sqlite.JDBC"); conexion = DriverManager.getConnection("jdbc:sqlite:db/administracion_citas.db"); if (conexion != null) { System.out.println("Conectado."); } // Crear enunciado. Statement enunciado; enunciado = conexion.createStatement(); // Insertar datos. enunciado.execute("INSERT INTO Citas (fecha, hora, motivo_cita) VALUES('" + this.fecha + "','" + this.hora + "','" + this.motivoCita + "');'"); System.out.println("Se ha registrado una cita correctamente."); conexion.close(); enunciado.close(); } catch (Exception e) { System.err.println(e.getMessage()); } }
[ "public", "void", "crearCita", "(", ")", "{", "try", "{", "// Establecer conexión.", "Class", ".", "forName", "(", "\"org.sqlite.JDBC\"", ")", ";", "conexion", "=", "DriverManager", ".", "getConnection", "(", "\"jdbc:sqlite:db/administracion_citas.db\"", ")", ";", "if", "(", "conexion", "!=", "null", ")", "{", "System", ".", "out", ".", "println", "(", "\"Conectado.\"", ")", ";", "}", "// Crear enunciado.", "Statement", "enunciado", ";", "enunciado", "=", "conexion", ".", "createStatement", "(", ")", ";", "// Insertar datos.", "enunciado", ".", "execute", "(", "\"INSERT INTO Citas (fecha, hora, motivo_cita) VALUES('\"", "+", "this", ".", "fecha", "+", "\"','\"", "+", "this", ".", "hora", "+", "\"','\"", "+", "this", ".", "motivoCita", "+", "\"');'\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"Se ha registrado una cita correctamente.\"", ")", ";", "conexion", ".", "close", "(", ")", ";", "enunciado", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "err", ".", "println", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}" ]
[ 32, 4 ]
[ 57, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
CacheValue.
null
Retorna una estimación del 'tamaño' de este cacheValue En 2 capas, el tamaño del CacheValue lo contamos como la cantidad de filas multiplicado por la cantidad de columnas En 3 capas, lo contamos como un decimo de la cantidad de bytes que ocupa
Retorna una estimación del 'tamaño' de este cacheValue En 2 capas, el tamaño del CacheValue lo contamos como la cantidad de filas multiplicado por la cantidad de columnas En 3 capas, lo contamos como un decimo de la cantidad de bytes que ocupa
public long getSize() { return cachedSize; }
[ "public", "long", "getSize", "(", ")", "{", "return", "cachedSize", ";", "}" ]
[ 202, 1 ]
[ 205, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Registro.
null
Setter para atributo RegistroReservaciones por posición
Setter para atributo RegistroReservaciones por posición
public Reservacion setReservacion(int Posicion, Reservacion VehiculoAAsignar) { return RegistroReservaciones.set(Posicion, VehiculoAAsignar); }
[ "public", "Reservacion", "setReservacion", "(", "int", "Posicion", ",", "Reservacion", "VehiculoAAsignar", ")", "{", "return", "RegistroReservaciones", ".", "set", "(", "Posicion", ",", "VehiculoAAsignar", ")", ";", "}" ]
[ 291, 4 ]
[ 294, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Nota.
null
3) Getters y Setters -> los atributos que son privados
3) Getters y Setters -> los atributos que son privados
public int getEscala100() { return escala100; }
[ "public", "int", "getEscala100", "(", ")", "{", "return", "escala100", ";", "}" ]
[ 58, 4 ]
[ 60, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
vistaMapas.
null
método para pintar los barcos
método para pintar los barcos
public void pintarConBarco1(String[][] mapa, Barco b1, int fila, int columna, int sentido) { for (int i = 0; i < mapa.length; i++) { for (int j = 0; j < mapa[i].length; j++) { if (i == fila && j == columna) { for (int tam = 0; tam < b1.getTam(); tam++, j++) { System.out.print(b1.getTipo() + " "); } j = j - 1; } else { System.out.print(mapa[i][j] + " "); } } System.out.println(""); } }
[ "public", "void", "pintarConBarco1", "(", "String", "[", "]", "[", "]", "mapa", ",", "Barco", "b1", ",", "int", "fila", ",", "int", "columna", ",", "int", "sentido", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "mapa", ".", "length", ";", "i", "++", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "mapa", "[", "i", "]", ".", "length", ";", "j", "++", ")", "{", "if", "(", "i", "==", "fila", "&&", "j", "==", "columna", ")", "{", "for", "(", "int", "tam", "=", "0", ";", "tam", "<", "b1", ".", "getTam", "(", ")", ";", "tam", "++", ",", "j", "++", ")", "{", "System", ".", "out", ".", "print", "(", "b1", ".", "getTipo", "(", ")", "+", "\" \"", ")", ";", "}", "j", "=", "j", "-", "1", ";", "}", "else", "{", "System", ".", "out", ".", "print", "(", "mapa", "[", "i", "]", "[", "j", "]", "+", "\" \"", ")", ";", "}", "}", "System", ".", "out", ".", "println", "(", "\"\"", ")", ";", "}", "}" ]
[ 31, 1 ]
[ 65, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
CropImageView.
null
Se establece el bitmap de la fotografia a ambos elementos
Se establece el bitmap de la fotografia a ambos elementos
public void setImageBitmap(Bitmap bitmap) { mImageView.setImageBitmap(bitmap); mCropOverlayView.setBitmap(bitmap); }
[ "public", "void", "setImageBitmap", "(", "Bitmap", "bitmap", ")", "{", "mImageView", ".", "setImageBitmap", "(", "bitmap", ")", ";", "mCropOverlayView", ".", "setBitmap", "(", "bitmap", ")", ";", "}" ]
[ 45, 4 ]
[ 48, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
UsuarioService.
null
/* select para buscar nuevos amigos por ciudad
/* select para buscar nuevos amigos por ciudad
public List<Usuario> findNuevosAmigosCiudad(String ciudad) { ArrayList<Usuario> listaNuevosAmCiudad = new ArrayList<Usuario>(); listaNuevosAmCiudad = (ArrayList<Usuario>) repository.findNuevosAmigosCiudad(ciudad); return listaNuevosAmCiudad; }
[ "public", "List", "<", "Usuario", ">", "findNuevosAmigosCiudad", "(", "String", "ciudad", ")", "{", "ArrayList", "<", "Usuario", ">", "listaNuevosAmCiudad", "=", "new", "ArrayList", "<", "Usuario", ">", "(", ")", ";", "listaNuevosAmCiudad", "=", "(", "ArrayList", "<", "Usuario", ">", ")", "repository", ".", "findNuevosAmigosCiudad", "(", "ciudad", ")", ";", "return", "listaNuevosAmCiudad", ";", "}" ]
[ 170, 2 ]
[ 174, 3 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Context.
null
TODO Para stringtemplate TopicsPlugin de nuestros tipos DDS.
TODO Para stringtemplate TopicsPlugin de nuestros tipos DDS.
public String getNewRandomName() { String name = "type_" + ++m_randomGenName; m_randomGenNames.push(name); return name; }
[ "public", "String", "getNewRandomName", "(", ")", "{", "String", "name", "=", "\"type_\"", "+", "++", "m_randomGenName", ";", "m_randomGenNames", ".", "push", "(", "name", ")", ";", "return", "name", ";", "}" ]
[ 89, 4 ]
[ 94, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
ControladoraHotel.
null
metodo para saber si hay disponibilidad de habitacion
metodo para saber si hay disponibilidad de habitacion
private boolean hayDisponibilidad(Date fecha_averiguar_inicio, Date fecha_averiguar_fin, Date fecha_ocupado_inicio, Date fecha_ocupado_fin) { //System.out.println("FOI ---> " + fecha_ocupado_inicio); //System.out.println("FOF --> " + fecha_ocupado_fin); //comparamos las fechas con los metodos de date before y after if ((fecha_averiguar_inicio.before(fecha_ocupado_inicio) && fecha_averiguar_inicio.before(fecha_ocupado_fin) && fecha_averiguar_fin.before(fecha_ocupado_inicio) && fecha_averiguar_fin.before(fecha_ocupado_fin)) || (fecha_averiguar_inicio.after(fecha_ocupado_inicio) && fecha_averiguar_inicio.after(fecha_ocupado_fin) && fecha_averiguar_fin.after(fecha_ocupado_inicio) && fecha_averiguar_fin.after(fecha_ocupado_fin))) { //System.out.println("HAY DISPONIBLE"); return true; } else { //System.out.println("NO HAY DISPONIBLE"); return false; } }
[ "private", "boolean", "hayDisponibilidad", "(", "Date", "fecha_averiguar_inicio", ",", "Date", "fecha_averiguar_fin", ",", "Date", "fecha_ocupado_inicio", ",", "Date", "fecha_ocupado_fin", ")", "{", "//System.out.println(\"FOI ---> \" + fecha_ocupado_inicio);", "//System.out.println(\"FOF --> \" + fecha_ocupado_fin);", "//comparamos las fechas con los metodos de date before y after", "if", "(", "(", "fecha_averiguar_inicio", ".", "before", "(", "fecha_ocupado_inicio", ")", "&&", "fecha_averiguar_inicio", ".", "before", "(", "fecha_ocupado_fin", ")", "&&", "fecha_averiguar_fin", ".", "before", "(", "fecha_ocupado_inicio", ")", "&&", "fecha_averiguar_fin", ".", "before", "(", "fecha_ocupado_fin", ")", ")", "||", "(", "fecha_averiguar_inicio", ".", "after", "(", "fecha_ocupado_inicio", ")", "&&", "fecha_averiguar_inicio", ".", "after", "(", "fecha_ocupado_fin", ")", "&&", "fecha_averiguar_fin", ".", "after", "(", "fecha_ocupado_inicio", ")", "&&", "fecha_averiguar_fin", ".", "after", "(", "fecha_ocupado_fin", ")", ")", ")", "{", "//System.out.println(\"HAY DISPONIBLE\");", "return", "true", ";", "}", "else", "{", "//System.out.println(\"NO HAY DISPONIBLE\");", "return", "false", ";", "}", "}" ]
[ 472, 4 ]
[ 491, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
FotosController.
null
recibir una foto nueva que subimos
recibir una foto nueva que subimos
@CrossOrigin(origins = "http://localhost:4200") @PostMapping("/addArchivoFoto/{idUsuFot}") public ResponseEntity<Respon> postSubirArchivoFoto(@RequestPart("file") MultipartFile file, @PathVariable Integer idUsuFot) { String mensajeOperacion = ""; GestionarArchivos gesArch = new GestionarArchivos(); if(file != null && idUsuFot != null) { if(idUsuFot > 0) { Fotos foto = new Fotos(); //Crear objeto foto foto = crearObjetoFotoBD(file, idUsuFot); //Obtener el objeto foto creado if(foto != null) { //Guardar fichero String filesPath = context.getRealPath("/ficheros/img/" + foto.getIdFoto() + "-" + foto.getUsuarioFotos().getIdUsu() + "-" + file.getOriginalFilename().toLowerCase()); File fichGuardar = new File(filesPath); //ruta anterior //File fichGuardar = new File("./ficheros/img/", foto.getIdFoto() + "-" + foto.getUsuarioFotos().getIdUsu() + "-" + file.getOriginalFilename().toLowerCase()); //Guardar archivo System.out.println("Fichero foto: " + fichGuardar.getPath() + " " + fichGuardar.getName()); mensajeOperacion = gesArch.guardarArchivo(fichGuardar, file); } else { mensajeOperacion = "foto no creada en BD"; } } else { mensajeOperacion = "El id de usuario tiene que ser mayor a 0"; } } else { mensajeOperacion = "El fichero y el id de usuario no pueden estar vacios"; } //Respuesta Respon resp = new Respon(); resp.setRespuesta(mensajeOperacion); return new ResponseEntity<Respon>(resp, HttpStatus.OK); }
[ "@", "CrossOrigin", "(", "origins", "=", "\"http://localhost:4200\"", ")", "@", "PostMapping", "(", "\"/addArchivoFoto/{idUsuFot}\"", ")", "public", "ResponseEntity", "<", "Respon", ">", "postSubirArchivoFoto", "(", "@", "RequestPart", "(", "\"file\"", ")", "MultipartFile", "file", ",", "@", "PathVariable", "Integer", "idUsuFot", ")", "{", "String", "mensajeOperacion", "=", "\"\"", ";", "GestionarArchivos", "gesArch", "=", "new", "GestionarArchivos", "(", ")", ";", "if", "(", "file", "!=", "null", "&&", "idUsuFot", "!=", "null", ")", "{", "if", "(", "idUsuFot", ">", "0", ")", "{", "Fotos", "foto", "=", "new", "Fotos", "(", ")", ";", "//Crear objeto foto\r", "foto", "=", "crearObjetoFotoBD", "(", "file", ",", "idUsuFot", ")", ";", "//Obtener el objeto foto creado\r", "if", "(", "foto", "!=", "null", ")", "{", "//Guardar fichero\r", "String", "filesPath", "=", "context", ".", "getRealPath", "(", "\"/ficheros/img/\"", "+", "foto", ".", "getIdFoto", "(", ")", "+", "\"-\"", "+", "foto", ".", "getUsuarioFotos", "(", ")", ".", "getIdUsu", "(", ")", "+", "\"-\"", "+", "file", ".", "getOriginalFilename", "(", ")", ".", "toLowerCase", "(", ")", ")", ";", "File", "fichGuardar", "=", "new", "File", "(", "filesPath", ")", ";", "//ruta anterior //File fichGuardar = new File(\"./ficheros/img/\", foto.getIdFoto() + \"-\" + foto.getUsuarioFotos().getIdUsu() + \"-\" + file.getOriginalFilename().toLowerCase());\r", "//Guardar archivo\r", "System", ".", "out", ".", "println", "(", "\"Fichero foto: \"", "+", "fichGuardar", ".", "getPath", "(", ")", "+", "\" \"", "+", "fichGuardar", ".", "getName", "(", ")", ")", ";", "mensajeOperacion", "=", "gesArch", ".", "guardarArchivo", "(", "fichGuardar", ",", "file", ")", ";", "}", "else", "{", "mensajeOperacion", "=", "\"foto no creada en BD\"", ";", "}", "}", "else", "{", "mensajeOperacion", "=", "\"El id de usuario tiene que ser mayor a 0\"", ";", "}", "}", "else", "{", "mensajeOperacion", "=", "\"El fichero y el id de usuario no pueden estar vacios\"", ";", "}", "//Respuesta\r", "Respon", "resp", "=", "new", "Respon", "(", ")", ";", "resp", ".", "setRespuesta", "(", "mensajeOperacion", ")", ";", "return", "new", "ResponseEntity", "<", "Respon", ">", "(", "resp", ",", "HttpStatus", ".", "OK", ")", ";", "}" ]
[ 130, 1 ]
[ 176, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Clasico.
null
Creación de la barra superior, para que aparezca la ruedita de configuración
Creación de la barra superior, para que aparezca la ruedita de configuración
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu_config, menu); return true; }
[ "@", "Override", "public", "boolean", "onCreateOptionsMenu", "(", "Menu", "menu", ")", "{", "MenuInflater", "inflater", "=", "getMenuInflater", "(", ")", ";", "inflater", ".", "inflate", "(", "R", ".", "menu", ".", "menu_config", ",", "menu", ")", ";", "return", "true", ";", "}" ]
[ 58, 4 ]
[ 63, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Registro.
null
Getter para RegistroUsuarios por posición
Getter para RegistroUsuarios por posición
public Usuario getUsuario(int Posicion) { return RegistroUsuarios.get(Posicion); }
[ "public", "Usuario", "getUsuario", "(", "int", "Posicion", ")", "{", "return", "RegistroUsuarios", ".", "get", "(", "Posicion", ")", ";", "}" ]
[ 260, 4 ]
[ 263, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Juego.
null
Sumatoria de una colección en general
Sumatoria de una colección en general
public int sumatoriaCasillas(ArrayList<Casilla> coleccion){ int sumatoria = 0; for (Casilla casilla : coleccion) { sumatoria += casilla.getValorLogico(); } return sumatoria; }
[ "public", "int", "sumatoriaCasillas", "(", "ArrayList", "<", "Casilla", ">", "coleccion", ")", "{", "int", "sumatoria", "=", "0", ";", "for", "(", "Casilla", "casilla", ":", "coleccion", ")", "{", "sumatoria", "+=", "casilla", ".", "getValorLogico", "(", ")", ";", "}", "return", "sumatoria", ";", "}" ]
[ 83, 4 ]
[ 89, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Login.
null
Método para cuando se hace click en BotonCrearCuenta
Método para cuando se hace click en BotonCrearCuenta
private void BotonCrearCuentaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonCrearCuentaActionPerformed // Mostrar modal de CrearCuenta CrearCuenta CrearCuentaVentana; CrearCuentaVentana = new CrearCuenta(this, true, TamanoVentana, RegistrosVentana); //CrearCuentaVentana.getContentPane().add(panel); CrearCuentaVentana.pack(); CrearCuentaVentana.setLocationRelativeTo(null); CrearCuentaVentana.setVisible(true); dispose(); }
[ "private", "void", "BotonCrearCuentaActionPerformed", "(", "java", ".", "awt", ".", "event", ".", "ActionEvent", "evt", ")", "{", "//GEN-FIRST:event_BotonCrearCuentaActionPerformed", "// Mostrar modal de CrearCuenta", "CrearCuenta", "CrearCuentaVentana", ";", "CrearCuentaVentana", "=", "new", "CrearCuenta", "(", "this", ",", "true", ",", "TamanoVentana", ",", "RegistrosVentana", ")", ";", "//CrearCuentaVentana.getContentPane().add(panel);", "CrearCuentaVentana", ".", "pack", "(", ")", ";", "CrearCuentaVentana", ".", "setLocationRelativeTo", "(", "null", ")", ";", "CrearCuentaVentana", ".", "setVisible", "(", "true", ")", ";", "dispose", "(", ")", ";", "}" ]
[ 558, 4 ]
[ 568, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
AndroidDatabaseTable.
null
testear haber si funciona así de abstracto o hay que hacerlo más especifico
testear haber si funciona así de abstracto o hay que hacerlo más especifico
@Override public DatabaseTableRecord getRecordFromPk(String pk) throws Exception { SQLiteDatabase database = null; try { database = this.database.getReadableDatabase(); Cursor c = database.rawQuery(" SELECT * from " + tableName + " WHERE pk=" + pk, null); List<String> columns = getColumns(database); DatabaseTableRecord tableRecord1 = new AndroidDatabaseRecord(); if (c.moveToFirst()) { /** - * Get columns name to read values of files * */ List<DatabaseRecord> recordValues = new ArrayList<>(); for (int i = 0; i < columns.size(); ++i) { DatabaseRecord recordValue = new AndroidRecord(); recordValue.setName(columns.get(i)); recordValue.setValue(c.getString(c.getColumnIndex(columns.get(i)))); recordValue.setChange(false); recordValues.add(recordValue); } tableRecord1.setValues(recordValues); if (c.moveToNext()) { //si pasa esto es porque hay algo mal throw new Exception(); //TODO:Se deberia lanzar una FermatException } } else { //TODO METODO CON RETURN NULL - OJO: solo INFORMATIVO de ayuda VISUAL para DEBUG - Eliminar si molesta return null; } c.close(); return tableRecord1; } catch (Exception e) { //TODO METODO CON RETURN NULL - OJO: solo INFORMATIVO de ayuda VISUAL para DEBUG - Eliminar si molesta return null; } finally { if (database != null) database.close(); } }
[ "@", "Override", "public", "DatabaseTableRecord", "getRecordFromPk", "(", "String", "pk", ")", "throws", "Exception", "{", "SQLiteDatabase", "database", "=", "null", ";", "try", "{", "database", "=", "this", ".", "database", ".", "getReadableDatabase", "(", ")", ";", "Cursor", "c", "=", "database", ".", "rawQuery", "(", "\" SELECT * from \"", "+", "tableName", "+", "\" WHERE pk=\"", "+", "pk", ",", "null", ")", ";", "List", "<", "String", ">", "columns", "=", "getColumns", "(", "database", ")", ";", "DatabaseTableRecord", "tableRecord1", "=", "new", "AndroidDatabaseRecord", "(", ")", ";", "if", "(", "c", ".", "moveToFirst", "(", ")", ")", "{", "/**\n - * Get columns name to read values of files\n *\n */", "List", "<", "DatabaseRecord", ">", "recordValues", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "columns", ".", "size", "(", ")", ";", "++", "i", ")", "{", "DatabaseRecord", "recordValue", "=", "new", "AndroidRecord", "(", ")", ";", "recordValue", ".", "setName", "(", "columns", ".", "get", "(", "i", ")", ")", ";", "recordValue", ".", "setValue", "(", "c", ".", "getString", "(", "c", ".", "getColumnIndex", "(", "columns", ".", "get", "(", "i", ")", ")", ")", ")", ";", "recordValue", ".", "setChange", "(", "false", ")", ";", "recordValues", ".", "add", "(", "recordValue", ")", ";", "}", "tableRecord1", ".", "setValues", "(", "recordValues", ")", ";", "if", "(", "c", ".", "moveToNext", "(", ")", ")", "{", "//si pasa esto es porque hay algo mal", "throw", "new", "Exception", "(", ")", ";", "//TODO:Se deberia lanzar una FermatException", "}", "}", "else", "{", "//TODO METODO CON RETURN NULL - OJO: solo INFORMATIVO de ayuda VISUAL para DEBUG - Eliminar si molesta", "return", "null", ";", "}", "c", ".", "close", "(", ")", ";", "return", "tableRecord1", ";", "}", "catch", "(", "Exception", "e", ")", "{", "//TODO METODO CON RETURN NULL - OJO: solo INFORMATIVO de ayuda VISUAL para DEBUG - Eliminar si molesta", "return", "null", ";", "}", "finally", "{", "if", "(", "database", "!=", "null", ")", "database", ".", "close", "(", ")", ";", "}", "}" ]
[ 627, 4 ]
[ 671, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Login.
null
Método cuandos presiona el mouse en CampoUsuario
Método cuandos presiona el mouse en CampoUsuario
private void CampoUsuarioMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_CampoUsuarioMousePressed // Obtener contenido String Contenido = this.CampoUsuario.getText(); Color ColorActual = this.CampoUsuario.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.CampoUsuario.setText(""); } if(ColorActual != ColorEscrito) { this.CampoUsuario.setForeground(ColorEscrito); } }
[ "private", "void", "CampoUsuarioMousePressed", "(", "java", ".", "awt", ".", "event", ".", "MouseEvent", "evt", ")", "{", "//GEN-FIRST:event_CampoUsuarioMousePressed", "// Obtener contenido", "String", "Contenido", "=", "this", ".", "CampoUsuario", ".", "getText", "(", ")", ";", "Color", "ColorActual", "=", "this", ".", "CampoUsuario", ".", "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", ".", "CampoUsuario", ".", "setText", "(", "\"\"", ")", ";", "}", "if", "(", "ColorActual", "!=", "ColorEscrito", ")", "{", "this", ".", "CampoUsuario", ".", "setForeground", "(", "ColorEscrito", ")", ";", "}", "}" ]
[ 571, 4 ]
[ 586, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
ComentarioService.
null
Buscar comentarios de una publicacion
Buscar comentarios de una publicacion
public List<Comentario> findComentariosPublicacion(Integer idPublicacion) { ArrayList<Comentario> listaComment = new ArrayList<Comentario>(); listaComment = (ArrayList<Comentario>) repository.findComentariosPublicacion(idPublicacion); return listaComment; }
[ "public", "List", "<", "Comentario", ">", "findComentariosPublicacion", "(", "Integer", "idPublicacion", ")", "{", "ArrayList", "<", "Comentario", ">", "listaComment", "=", "new", "ArrayList", "<", "Comentario", ">", "(", ")", ";", "listaComment", "=", "(", "ArrayList", "<", "Comentario", ">", ")", "repository", ".", "findComentariosPublicacion", "(", "idPublicacion", ")", ";", "return", "listaComment", ";", "}" ]
[ 63, 1 ]
[ 69, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
CropOverlayView.
null
Metodo que ayuda a unir los vertices con una linea entre ellos
Metodo que ayuda a unir los vertices con una linea entre ellos
private void drawEdge(Canvas canvas) { Paint paint = new Paint(); paint.setColor(Color.WHITE); paint.setStrokeWidth(3); paint.setAntiAlias(true); canvas.drawLine(topLeft.x, topLeft.y, topRight.x, topRight.y, paint); canvas.drawLine(topLeft.x, topLeft.y, bottomLeft.x, bottomLeft.y, paint); canvas.drawLine(bottomRight.x, bottomRight.y, topRight.x, topRight.y, paint); canvas.drawLine(bottomRight.x, bottomRight.y, bottomLeft.x, bottomLeft.y, paint); }
[ "private", "void", "drawEdge", "(", "Canvas", "canvas", ")", "{", "Paint", "paint", "=", "new", "Paint", "(", ")", ";", "paint", ".", "setColor", "(", "Color", ".", "WHITE", ")", ";", "paint", ".", "setStrokeWidth", "(", "3", ")", ";", "paint", ".", "setAntiAlias", "(", "true", ")", ";", "canvas", ".", "drawLine", "(", "topLeft", ".", "x", ",", "topLeft", ".", "y", ",", "topRight", ".", "x", ",", "topRight", ".", "y", ",", "paint", ")", ";", "canvas", ".", "drawLine", "(", "topLeft", ".", "x", ",", "topLeft", ".", "y", ",", "bottomLeft", ".", "x", ",", "bottomLeft", ".", "y", ",", "paint", ")", ";", "canvas", ".", "drawLine", "(", "bottomRight", ".", "x", ",", "bottomRight", ".", "y", ",", "topRight", ".", "x", ",", "topRight", ".", "y", ",", "paint", ")", ";", "canvas", ".", "drawLine", "(", "bottomRight", ".", "x", ",", "bottomRight", ".", "y", ",", "bottomLeft", ".", "x", ",", "bottomLeft", ".", "y", ",", "paint", ")", ";", "}" ]
[ 175, 4 ]
[ 185, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
DictionarioLoterias.
null
Genera un numero de loteria que no se haya vendido
Genera un numero de loteria que no se haya vendido
private Integer GenerarNumero(TipoBoleto tipoBoleto){ Integer num = null; while (num == null){ num = new Integer(ThreadLocalRandom.current().nextInt(1, 1000000)); if (dictionarioLoterias.isEmpty() || dictionarioLoterias.get(GetHashKeyFechaHoy()).isEmpty()){ dictionarioLoterias.put(GetHashKeyFechaHoy(), CrearDictionario(tipoBoleto,num)); }else if (dictionarioLoterias.get(GetHashKeyFechaHoy()).get(tipoBoleto) == null){ List<Integer> lista = new ArrayList<Integer>(); lista.add(num); dictionarioLoterias.get(GetHashKeyFechaHoy()).put(tipoBoleto,lista); }else if (!dictionarioLoterias.get(GetHashKeyFechaHoy()).get(tipoBoleto).contains(num)){ dictionarioLoterias.get(GetHashKeyFechaHoy()).get(tipoBoleto).add(num); } } return num; }
[ "private", "Integer", "GenerarNumero", "(", "TipoBoleto", "tipoBoleto", ")", "{", "Integer", "num", "=", "null", ";", "while", "(", "num", "==", "null", ")", "{", "num", "=", "new", "Integer", "(", "ThreadLocalRandom", ".", "current", "(", ")", ".", "nextInt", "(", "1", ",", "1000000", ")", ")", ";", "if", "(", "dictionarioLoterias", ".", "isEmpty", "(", ")", "||", "dictionarioLoterias", ".", "get", "(", "GetHashKeyFechaHoy", "(", ")", ")", ".", "isEmpty", "(", ")", ")", "{", "dictionarioLoterias", ".", "put", "(", "GetHashKeyFechaHoy", "(", ")", ",", "CrearDictionario", "(", "tipoBoleto", ",", "num", ")", ")", ";", "}", "else", "if", "(", "dictionarioLoterias", ".", "get", "(", "GetHashKeyFechaHoy", "(", ")", ")", ".", "get", "(", "tipoBoleto", ")", "==", "null", ")", "{", "List", "<", "Integer", ">", "lista", "=", "new", "ArrayList", "<", "Integer", ">", "(", ")", ";", "lista", ".", "add", "(", "num", ")", ";", "dictionarioLoterias", ".", "get", "(", "GetHashKeyFechaHoy", "(", ")", ")", ".", "put", "(", "tipoBoleto", ",", "lista", ")", ";", "}", "else", "if", "(", "!", "dictionarioLoterias", ".", "get", "(", "GetHashKeyFechaHoy", "(", ")", ")", ".", "get", "(", "tipoBoleto", ")", ".", "contains", "(", "num", ")", ")", "{", "dictionarioLoterias", ".", "get", "(", "GetHashKeyFechaHoy", "(", ")", ")", ".", "get", "(", "tipoBoleto", ")", ".", "add", "(", "num", ")", ";", "}", "}", "return", "num", ";", "}" ]
[ 82, 1 ]
[ 110, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
CrudLimpieza.
null
Método para ordenar la lista por orden natural (precio)
Método para ordenar la lista por orden natural (precio)
public void ordenarLista () { Collections.sort(stockLimpieza); }
[ "public", "void", "ordenarLista", "(", ")", "{", "Collections", ".", "sort", "(", "stockLimpieza", ")", ";", "}" ]
[ 145, 1 ]
[ 147, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
VideosApiResource.
null
Método que devuelve un vídeo con una determinada id
Método que devuelve un vídeo con una determinada id
@GET @Path("/{id}") @Produces("application/json") public Video getVideoById(@PathParam("id") String id) { Video video = repository.getVideoById(id); if (video == null) { throw new BadRequestException("La vídeo solicitado no existe."); } return video; }
[ "@", "GET", "@", "Path", "(", "\"/{id}\"", ")", "@", "Produces", "(", "\"application/json\"", ")", "public", "Video", "getVideoById", "(", "@", "PathParam", "(", "\"id\"", ")", "String", "id", ")", "{", "Video", "video", "=", "repository", ".", "getVideoById", "(", "id", ")", ";", "if", "(", "video", "==", "null", ")", "{", "throw", "new", "BadRequestException", "(", "\"La vídeo solicitado no existe.\")", ";", "", "}", "return", "video", ";", "}" ]
[ 66, 1 ]
[ 75, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Nota.
null
Conversión de notas que fueron creadas vacías y actualizadas parcialmente
Conversión de notas que fueron creadas vacías y actualizadas parcialmente
public void convertirNota5_100(){ this.escala100 = (int)(this.escala5 * 20); }
[ "public", "void", "convertirNota5_100", "(", ")", "{", "this", ".", "escala100", "=", "(", "int", ")", "(", "this", ".", "escala5", "*", "20", ")", ";", "}" ]
[ 71, 4 ]
[ 73, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Agenda.
null
modifica el propietario
modifica el propietario
public void setPropietario(String propietario) { this.propietario = propietario; }
[ "public", "void", "setPropietario", "(", "String", "propietario", ")", "{", "this", ".", "propietario", "=", "propietario", ";", "}" ]
[ 92, 1 ]
[ 94, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Agenda.
null
devuelve el telefonopropietario
devuelve el telefonopropietario
public String getTelefonoPropietario() { return telefonoPropietario; }
[ "public", "String", "getTelefonoPropietario", "(", ")", "{", "return", "telefonoPropietario", ";", "}" ]
[ 98, 1 ]
[ 100, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
ElectricSystemTest.
null
actual de la red es la suma de los consumos de los dispositivos cuando se encuentran encendidos.
actual de la red es la suma de los consumos de los dispositivos cuando se encuentran encendidos.
@Test public void Given_A_ElectricalSystem_With_Two_Devices_TurnedOn_When_GetCurrentConsumption_Method_Is_Called_Then_Return_80() { //Given ElectricSystem electricSystem = new ElectricSystem(maximumPowerAllowedStable); electricSystem.addDevice(turnedOnDevice1); electricSystem.addDevice(turnedOnDevice2); Integer expectedConsumption = turnedOnDevice1Consumption + turnedOnDevice2Consumption; //When Integer result = electricSystem.getCurrentConsumption(); //Then assertEquals(expectedConsumption, result); }
[ "@", "Test", "public", "void", "Given_A_ElectricalSystem_With_Two_Devices_TurnedOn_When_GetCurrentConsumption_Method_Is_Called_Then_Return_80", "(", ")", "{", "//Given", "ElectricSystem", "electricSystem", "=", "new", "ElectricSystem", "(", "maximumPowerAllowedStable", ")", ";", "electricSystem", ".", "addDevice", "(", "turnedOnDevice1", ")", ";", "electricSystem", ".", "addDevice", "(", "turnedOnDevice2", ")", ";", "Integer", "expectedConsumption", "=", "turnedOnDevice1Consumption", "+", "turnedOnDevice2Consumption", ";", "//When", "Integer", "result", "=", "electricSystem", ".", "getCurrentConsumption", "(", ")", ";", "//Then", "assertEquals", "(", "expectedConsumption", ",", "result", ")", ";", "}" ]
[ 74, 4 ]
[ 87, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
NumberUtils.
null
/* funciones para convertir los numeros a literales
/* funciones para convertir los numeros a literales
private static String getUnidades(String numero) {// 1 - 9 //si tuviera algun 0 antes se lo quita -> 09 = 9 o 009=9 String num = numero.substring(numero.length() - 1); return UNIDADES[Integer.parseInt(num)]; }
[ "private", "static", "String", "getUnidades", "(", "String", "numero", ")", "{", "// 1 - 9", "//si tuviera algun 0 antes se lo quita -> 09 = 9 o 009=9", "String", "num", "=", "numero", ".", "substring", "(", "numero", ".", "length", "(", ")", "-", "1", ")", ";", "return", "UNIDADES", "[", "Integer", ".", "parseInt", "(", "num", ")", "]", ";", "}" ]
[ 61, 4 ]
[ 65, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
ProyectoRankeadoComprasDao.
null
Obtener los 5 proyectos rankeados según las compras
Obtener los 5 proyectos rankeados según las compras
public ArrayList<ProyectoRankeadoCompras> topProyectosComprasGranito() throws SQLException { //. //. //. }
[ "public", "ArrayList", "<", "ProyectoRankeadoCompras", ">", "topProyectosComprasGranito", "(", ")", "throws", "SQLException", "{", "//.\r", "//.\r", "//.\r", "}" ]
[ 175, 4 ]
[ 180, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
CrearCuenta.
null
Método para cuando CampoContrasena gana enfoque
Método para cuando CampoContrasena gana enfoque
private void CampoContrasenaFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_CampoContrasenaFocusGained // Obtiene contenido de campo String Contenido = this.CampoContrasena.getText(); // Obtiene color de campo Color ColorActual = this.CampoContrasena.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("Contraseña") && (ColorActual == ColorNoEscrito)) { // Limpiamos contenido this.CampoContrasena.setText(""); this.CampoContrasena.setForeground(ColorEscribir); } else { this.CampoContrasena.setForeground(ColorEscribir); } }
[ "private", "void", "CampoContrasenaFocusGained", "(", "java", ".", "awt", ".", "event", ".", "FocusEvent", "evt", ")", "{", "//GEN-FIRST:event_CampoContrasenaFocusGained", "// Obtiene contenido de campo", "String", "Contenido", "=", "this", ".", "CampoContrasena", ".", "getText", "(", ")", ";", "// Obtiene color de campo", "Color", "ColorActual", "=", "this", ".", "CampoContrasena", ".", "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", "(", "\"Contraseña\")", " ", "& ", "(", "ColorActual", "==", "ColorNoEscrito", ")", ")", "{", "// Limpiamos contenido", "this", ".", "CampoContrasena", ".", "setText", "(", "\"\"", ")", ";", "this", ".", "CampoContrasena", ".", "setForeground", "(", "ColorEscribir", ")", ";", "}", "else", "{", "this", ".", "CampoContrasena", ".", "setForeground", "(", "ColorEscribir", ")", ";", "}", "}" ]
[ 761, 4 ]
[ 782, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
ControladoraHotel.
null
devuleve una lista de habitaciones filtrada por la cantidad limite de personas permitidas
devuleve una lista de habitaciones filtrada por la cantidad limite de personas permitidas
public List<Habitacion> traerHabitacionDisponiblePorCantLimite(int cant_personas) { List<Habitacion> lista_hab = traerHabitacion(); List<Habitacion> lista_filtrada = new ArrayList<Habitacion>(); for (Habitacion hab : lista_hab) { if (cant_personas <= hab.getTipo_habitacion().getCantidad_limite()) { lista_filtrada.add(hab); } } System.out.println("ACAAA trae el filtro por persnas " + lista_filtrada.isEmpty()); return lista_filtrada; }
[ "public", "List", "<", "Habitacion", ">", "traerHabitacionDisponiblePorCantLimite", "(", "int", "cant_personas", ")", "{", "List", "<", "Habitacion", ">", "lista_hab", "=", "traerHabitacion", "(", ")", ";", "List", "<", "Habitacion", ">", "lista_filtrada", "=", "new", "ArrayList", "<", "Habitacion", ">", "(", ")", ";", "for", "(", "Habitacion", "hab", ":", "lista_hab", ")", "{", "if", "(", "cant_personas", "<=", "hab", ".", "getTipo_habitacion", "(", ")", ".", "getCantidad_limite", "(", ")", ")", "{", "lista_filtrada", ".", "add", "(", "hab", ")", ";", "}", "}", "System", ".", "out", ".", "println", "(", "\"ACAAA trae el filtro por persnas \"", "+", "lista_filtrada", ".", "isEmpty", "(", ")", ")", ";", "return", "lista_filtrada", ";", "}" ]
[ 286, 4 ]
[ 298, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Main.
null
Recorremos los arrays para contar cuantos entregados hay, tambien los devolvemos
Recorremos los arrays para contar cuantos entregados hay, tambien los devolvemos
public static int seriesEntregadas(Serie listaSeries[]){ int entregados = 0; for(int i = 0; i < listaSeries.length; i++){ if(listaSeries[i].isEntregado()){ entregados+=1; listaSeries[i].devolver(); } } return entregados; }
[ "public", "static", "int", "seriesEntregadas", "(", "Serie", "listaSeries", "[", "]", ")", "{", "int", "entregados", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "listaSeries", ".", "length", ";", "i", "++", ")", "{", "if", "(", "listaSeries", "[", "i", "]", ".", "isEntregado", "(", ")", ")", "{", "entregados", "+=", "1", ";", "listaSeries", "[", "i", "]", ".", "devolver", "(", ")", ";", "}", "}", "return", "entregados", ";", "}" ]
[ 41, 4 ]
[ 50, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
PantallaCoche.
null
Se asegura de que el coche esté quieto o lo frena si no lo está.
Se asegura de que el coche esté quieto o lo frena si no lo está.
private void frenarCoche() { // Como no se puede mover, la aceleración es 0 y las fuerzas // de rozamiento hacen que el coche se vaya frenando progresivamente. aceleracion = 0; // Como trabajamos con flotantes, tenemos que establecer un límite // de seguridad ya que los cálculos nunca tendrán buena precisión. if (Math.abs(velocidad) > 0.5f) velocidad *= 0.95f; else velocidad = 0; }
[ "private", "void", "frenarCoche", "(", ")", "{", "// Como no se puede mover, la aceleración es 0 y las fuerzas", "// de rozamiento hacen que el coche se vaya frenando progresivamente.", "aceleracion", "=", "0", ";", "// Como trabajamos con flotantes, tenemos que establecer un límite", "// de seguridad ya que los cálculos nunca tendrán buena precisión.", "if", "(", "Math", ".", "abs", "(", "velocidad", ")", ">", "0.5f", ")", "velocidad", "*=", "0.95f", ";", "else", "velocidad", "=", "0", ";", "}" ]
[ 192, 1 ]
[ 202, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Ejercicio3.
null
Función o método que calcula el doble
Función o método que calcula el doble
public static int doble(int numero){ int doble = 0; doble = numero * 2; return doble; }
[ "public", "static", "int", "doble", "(", "int", "numero", ")", "{", "int", "doble", "=", "0", ";", "doble", "=", "numero", "*", "2", ";", "return", "doble", ";", "}" ]
[ 7, 4 ]
[ 11, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration