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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
WifiCommunicationPluginRoot. | null | toma la lista de ip locales | toma la lista de ip locales | private static List<String> ip_network(){
List<String> lista_red = new ArrayList<String>();
Enumeration<NetworkInterface> en = null;
try {
en = NetworkInterface.getNetworkInterfaces();
} catch (SocketException e) {
e.printStackTrace();
}
while (en.hasMoreElements()) {
NetworkInterface ni = en.nextElement();
printParameter(ni);
}
int bloque1,bloque2,bloque3,bloque4;
int bloquemas1,bloquemas2,bloquemas3,bloquemas4;
int ini1 = 0,ini2 = 0,ini3 = 0,ini4 = 0;
int fin1 = 0,fin2 = 0,fin3 = 0,fin4 = 0;
String dir= direccion.trim();
String mas= maskara.trim();
if(dir != null){
System.out.println("Source "+dir);
System.out.println("---------------");
String[] parts = dir.split(Pattern.quote("."));
String[] parts_mask = mas.split(Pattern.quote("."));
bloque1= Integer.parseInt(parts[0]);
bloque2=Integer.parseInt(parts[1]);
bloque3=Integer.parseInt(parts[2]);
bloque4=Integer.parseInt(parts[3]);
bloquemas1=Integer.parseInt(parts_mask[0]);
bloquemas2=Integer.parseInt(parts_mask[1]);
bloquemas3=Integer.parseInt(parts_mask[2]);
bloquemas4=Integer.parseInt(parts_mask[3]);
//bloquemas4=240;
if(bloquemas1==255){
ini1=bloque1;
fin1=bloque1;
if(bloquemas2==255){
ini2=bloque2;
fin2=bloque2;
if(bloquemas3==255){
ini3=bloque3;
fin3=bloque3;
//barra 24
if(bloquemas4==255){
//quiere decir que es broadcast
}else{
if(bloquemas4==0){
ini4=1;
fin4=254;
}else{
//es una subnet
int red= bloquemas4 & bloque4;
ini4 = red + 1;
fin4 = (red + (255-bloquemas4)) - 1;
}
}
}else{
//sino del bloquemas3
//barra 16
if(bloquemas3==0){
//barra 16
ini3=0; fin3=255;
ini4=1; fin4=254;
}else{
int red= bloquemas3 & bloque3;
ini3 = red;
fin3 = (red + (255-bloquemas3));
ini4=1; fin4=254;
}
}
}else{
if(bloquemas2==0){
ini2=0; fin2=255;
ini3=0; fin3=255;
ini4=1; fin4=254;
}else{
int red= bloquemas2 & bloque2;
ini2 = red;
fin2 = (red + (255-bloquemas2));
ini3=0; fin3=255;
ini4=1; fin4=254;
}
}
}
String cad1,cad2,cad3;
String destino;
for(int bloq_1=ini1;bloq_1<=fin1;bloq_1++){
cad1 = bloq_1+".";
for(int bloq_2=ini2;bloq_2<=fin2;bloq_2++){
cad2 = bloq_2+".";
for(int bloq_3=ini3;bloq_3<=fin3;bloq_3++){
cad3= bloq_3+".";
for(int bloq_4=ini4;bloq_4<=fin4;bloq_4++){
destino=cad1+cad2+cad3+bloq_4;
if(!destino.equals(dir)){
//aqui agrega la direcciones locales de red
lista_red.add(destino);
}
}
cad3=null;
}
cad2=null;
}
cad1=null;
}
}
return lista_red;
} | [
"private",
"static",
"List",
"<",
"String",
">",
"ip_network",
"(",
")",
"{",
"List",
"<",
"String",
">",
"lista_red",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"Enumeration",
"<",
"NetworkInterface",
">",
"en",
"=",
"null",
";",
"try",
"{",
"en",
"=",
"NetworkInterface",
".",
"getNetworkInterfaces",
"(",
")",
";",
"}",
"catch",
"(",
"SocketException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"while",
"(",
"en",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"NetworkInterface",
"ni",
"=",
"en",
".",
"nextElement",
"(",
")",
";",
"printParameter",
"(",
"ni",
")",
";",
"}",
"int",
"bloque1",
",",
"bloque2",
",",
"bloque3",
",",
"bloque4",
";",
"int",
"bloquemas1",
",",
"bloquemas2",
",",
"bloquemas3",
",",
"bloquemas4",
";",
"int",
"ini1",
"=",
"0",
",",
"ini2",
"=",
"0",
",",
"ini3",
"=",
"0",
",",
"ini4",
"=",
"0",
";",
"int",
"fin1",
"=",
"0",
",",
"fin2",
"=",
"0",
",",
"fin3",
"=",
"0",
",",
"fin4",
"=",
"0",
";",
"String",
"dir",
"=",
"direccion",
".",
"trim",
"(",
")",
";",
"String",
"mas",
"=",
"maskara",
".",
"trim",
"(",
")",
";",
"if",
"(",
"dir",
"!=",
"null",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Source \"",
"+",
"dir",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"---------------\"",
")",
";",
"String",
"[",
"]",
"parts",
"=",
"dir",
".",
"split",
"(",
"Pattern",
".",
"quote",
"(",
"\".\"",
")",
")",
";",
"String",
"[",
"]",
"parts_mask",
"=",
"mas",
".",
"split",
"(",
"Pattern",
".",
"quote",
"(",
"\".\"",
")",
")",
";",
"bloque1",
"=",
"Integer",
".",
"parseInt",
"(",
"parts",
"[",
"0",
"]",
")",
";",
"bloque2",
"=",
"Integer",
".",
"parseInt",
"(",
"parts",
"[",
"1",
"]",
")",
";",
"bloque3",
"=",
"Integer",
".",
"parseInt",
"(",
"parts",
"[",
"2",
"]",
")",
";",
"bloque4",
"=",
"Integer",
".",
"parseInt",
"(",
"parts",
"[",
"3",
"]",
")",
";",
"bloquemas1",
"=",
"Integer",
".",
"parseInt",
"(",
"parts_mask",
"[",
"0",
"]",
")",
";",
"bloquemas2",
"=",
"Integer",
".",
"parseInt",
"(",
"parts_mask",
"[",
"1",
"]",
")",
";",
"bloquemas3",
"=",
"Integer",
".",
"parseInt",
"(",
"parts_mask",
"[",
"2",
"]",
")",
";",
"bloquemas4",
"=",
"Integer",
".",
"parseInt",
"(",
"parts_mask",
"[",
"3",
"]",
")",
";",
"//bloquemas4=240;",
"if",
"(",
"bloquemas1",
"==",
"255",
")",
"{",
"ini1",
"=",
"bloque1",
";",
"fin1",
"=",
"bloque1",
";",
"if",
"(",
"bloquemas2",
"==",
"255",
")",
"{",
"ini2",
"=",
"bloque2",
";",
"fin2",
"=",
"bloque2",
";",
"if",
"(",
"bloquemas3",
"==",
"255",
")",
"{",
"ini3",
"=",
"bloque3",
";",
"fin3",
"=",
"bloque3",
";",
"//barra 24",
"if",
"(",
"bloquemas4",
"==",
"255",
")",
"{",
"//quiere decir que es broadcast",
"}",
"else",
"{",
"if",
"(",
"bloquemas4",
"==",
"0",
")",
"{",
"ini4",
"=",
"1",
";",
"fin4",
"=",
"254",
";",
"}",
"else",
"{",
"//es una subnet",
"int",
"red",
"=",
"bloquemas4",
"&",
"bloque4",
";",
"ini4",
"=",
"red",
"+",
"1",
";",
"fin4",
"=",
"(",
"red",
"+",
"(",
"255",
"-",
"bloquemas4",
")",
")",
"-",
"1",
";",
"}",
"}",
"}",
"else",
"{",
"//sino del bloquemas3",
"//barra 16",
"if",
"(",
"bloquemas3",
"==",
"0",
")",
"{",
"//barra 16",
"ini3",
"=",
"0",
";",
"fin3",
"=",
"255",
";",
"ini4",
"=",
"1",
";",
"fin4",
"=",
"254",
";",
"}",
"else",
"{",
"int",
"red",
"=",
"bloquemas3",
"&",
"bloque3",
";",
"ini3",
"=",
"red",
";",
"fin3",
"=",
"(",
"red",
"+",
"(",
"255",
"-",
"bloquemas3",
")",
")",
";",
"ini4",
"=",
"1",
";",
"fin4",
"=",
"254",
";",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"bloquemas2",
"==",
"0",
")",
"{",
"ini2",
"=",
"0",
";",
"fin2",
"=",
"255",
";",
"ini3",
"=",
"0",
";",
"fin3",
"=",
"255",
";",
"ini4",
"=",
"1",
";",
"fin4",
"=",
"254",
";",
"}",
"else",
"{",
"int",
"red",
"=",
"bloquemas2",
"&",
"bloque2",
";",
"ini2",
"=",
"red",
";",
"fin2",
"=",
"(",
"red",
"+",
"(",
"255",
"-",
"bloquemas2",
")",
")",
";",
"ini3",
"=",
"0",
";",
"fin3",
"=",
"255",
";",
"ini4",
"=",
"1",
";",
"fin4",
"=",
"254",
";",
"}",
"}",
"}",
"String",
"cad1",
",",
"cad2",
",",
"cad3",
";",
"String",
"destino",
";",
"for",
"(",
"int",
"bloq_1",
"=",
"ini1",
";",
"bloq_1",
"<=",
"fin1",
";",
"bloq_1",
"++",
")",
"{",
"cad1",
"=",
"bloq_1",
"+",
"\".\"",
";",
"for",
"(",
"int",
"bloq_2",
"=",
"ini2",
";",
"bloq_2",
"<=",
"fin2",
";",
"bloq_2",
"++",
")",
"{",
"cad2",
"=",
"bloq_2",
"+",
"\".\"",
";",
"for",
"(",
"int",
"bloq_3",
"=",
"ini3",
";",
"bloq_3",
"<=",
"fin3",
";",
"bloq_3",
"++",
")",
"{",
"cad3",
"=",
"bloq_3",
"+",
"\".\"",
";",
"for",
"(",
"int",
"bloq_4",
"=",
"ini4",
";",
"bloq_4",
"<=",
"fin4",
";",
"bloq_4",
"++",
")",
"{",
"destino",
"=",
"cad1",
"+",
"cad2",
"+",
"cad3",
"+",
"bloq_4",
";",
"if",
"(",
"!",
"destino",
".",
"equals",
"(",
"dir",
")",
")",
"{",
"//aqui agrega la direcciones locales de red",
"lista_red",
".",
"add",
"(",
"destino",
")",
";",
"}",
"}",
"cad3",
"=",
"null",
";",
"}",
"cad2",
"=",
"null",
";",
"}",
"cad1",
"=",
"null",
";",
"}",
"}",
"return",
"lista_red",
";",
"}"
] | [
182,
1
] | [
408,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Paciente. | null | Método que muestra la lista de pacientes. | Método que muestra la lista de pacientes. | public void mostrarPacientes() {
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 * FROM Pacientes");
resultado = query.executeQuery();
while(resultado.next()) {
System.out.print("ID: ");
System.out.println(resultado.getInt("id"));
System.out.print("Nombre: ");
System.out.println(resultado.getString("nombre"));
System.out.println("==========");
}
query.close();
conexion.close();
} catch (Exception e) {
System.err.println(e.getMessage());
}
} | [
"public",
"void",
"mostrarPacientes",
"(",
")",
"{",
"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 * FROM Pacientes\"",
")",
";",
"resultado",
"=",
"query",
".",
"executeQuery",
"(",
")",
";",
"while",
"(",
"resultado",
".",
"next",
"(",
")",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"ID: \"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"resultado",
".",
"getInt",
"(",
"\"id\"",
")",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"\"Nombre: \"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"resultado",
".",
"getString",
"(",
"\"nombre\"",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"==========\"",
")",
";",
"}",
"query",
".",
"close",
"(",
")",
";",
"conexion",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
] | [
52,
4
] | [
84,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
InterfazConsola. | null | Punto de entrada de toda la aplicación | Punto de entrada de toda la aplicación | public static void main(String[] args) {
//Al iniciar la aplicación construimos la interfaz (consola)
InterfazConsola interfaz = new InterfazConsola();
//Funcionamiento -> Comportamiento que definamos de la interfaz
interfaz.ejecutarMainloop();
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"//Al iniciar la aplicación construimos la interfaz (consola)",
"InterfazConsola",
"interfaz",
"=",
"new",
"InterfazConsola",
"(",
")",
";",
"//Funcionamiento -> Comportamiento que definamos de la interfaz",
"interfaz",
".",
"ejecutarMainloop",
"(",
")",
";",
"}"
] | [
134,
4
] | [
142,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
TemporaryFiles. | null | Realiza el cleanup de los archivos temporales
| Realiza el cleanup de los archivos temporales
| public void cleanup()
{
for(Enumeration enum1 = files.elements(); enum1.hasMoreElements();)
nativeCode.removeFile((String)enum1.nextElement());
files.removeAllElements();
}
/** Obtiene un nombre temporal y lo inserta en la lista
* @param Extension del archivo temporal (sin el .)
* @return Nombre del archivo temporal
*/
public String getTemporaryFile(String extension)
{
String tempFile;
extension = "." + extension;
do tempFile = "" + ((int)(Math.random() * 1e8)) + extension;
while(new File(tempFile).exists());
addFile(tempFile);
return tempFile;
}
/** Obtiene un nombre temporal a partir del nombre y extensi�n pasados como par�metros
* y lo inserta en la lista
* @param filename Nombre temporal tentativo
* @param extension Extension del archivo temporal (sin el .)
* @return Nombre del archivo temporal
*/
public String getTemporaryFile(String filename, String extension)
{
extension = "." + extension;
String tempFile = filename + extension; // Primero intentamos con el nombre del archivo
int expCounter = 1;
File file = new File(tempFile);
while(file.exists()) // Luego intentamos con un PRNG incremental en el tama�o
{
tempFile = filename + ((int)(Math.random() * expCounter)) + extension;
expCounter *= 2;
expCounter %= 1e8;
file = new File(tempFile);
file.delete(); // Intento eliminarlo (si no est� lockeado)
}
addFile(tempFile);
return tempFile;
}
/** Agrega un archivo a la lista de TemporaryFiles
* @param Nombre del archivo
*/
public void addFile(String file)
{
files.addElement(file);
}
/** Elimina un archivo de la lista
* @param Nombre del archivo a eliminar
* @return true si se elimino el archivo de la lista
*/
public boolean removeFileFromList(String file)
{
return files.removeElement(file);
}
/** Obtiene una copia del vector de archivos temporales
* @return una copia del Vector de archivos temporales
*/
@SuppressWarnings("unchecked")
public Vector<String> getFiles()
{
return (Vector<String>)files.clone();
}
} | [
"public",
"void",
"cleanup",
"(",
")",
"{",
"for",
"(",
"Enumeration",
"enum1",
"=",
"files",
".",
"elements",
"(",
")",
";",
"enum1",
".",
"hasMoreElements",
"(",
")",
";",
")",
"nativeCode",
".",
"removeFile",
"(",
"(",
"String",
")",
"enum1",
".",
"nextElement",
"(",
")",
")",
";",
"files",
".",
"removeAllElements",
"(",
")",
";",
"}",
"/** Obtiene un nombre temporal y lo inserta en la lista\n * @param Extension del archivo temporal (sin el .)\n * @return Nombre del archivo temporal \n */",
"public",
"String",
"getTemporaryFile",
"(",
"String",
"extension",
")",
"{",
"String",
"tempFile",
";",
"extension",
"=",
"\".\"",
"+",
"extension",
";",
"do",
"tempFile",
"=",
"\"\"",
"+",
"(",
"(",
"int",
")",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"1e8",
")",
")",
"+",
"extension",
";",
"while",
"(",
"new",
"File",
"(",
"tempFile",
")",
".",
"exists",
"(",
")",
")",
";",
"addFile",
"(",
"tempFile",
")",
";",
"return",
"tempFile",
";",
"}",
"/** Obtiene un nombre temporal a partir del nombre y extensi�n pasados como par�metros\n * y lo inserta en la lista\n * @param filename Nombre temporal tentativo\n * @param extension Extension del archivo temporal (sin el .)\n * @return Nombre del archivo temporal\n */",
"public",
"String",
"getTemporaryFile",
"",
"(",
"String",
"filename",
",",
"String",
"extension",
")",
"{",
"extension",
"=",
"\".\"",
"+",
"extension",
";",
"String",
"tempFile",
"=",
"filename",
"+",
"extension",
";",
"// Primero intentamos con el nombre del archivo",
"int",
"expCounter",
"=",
"1",
";",
"File",
"file",
"=",
"new",
"File",
"(",
"tempFile",
")",
";",
"while",
"(",
"file",
".",
"exists",
"(",
")",
")",
"// Luego intentamos con un PRNG incremental en el tama�o",
"{",
"tempFile",
"=",
"filename",
"+",
"(",
"(",
"int",
")",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"expCounter",
")",
")",
"+",
"extension",
";",
"expCounter",
"*=",
"2",
";",
"expCounter",
"%=",
"1e8",
";",
"file",
"=",
"new",
"File",
"(",
"tempFile",
")",
";",
"file",
".",
"delete",
"(",
")",
";",
"// Intento eliminarlo (si no est� lockeado)",
"}",
"addFile",
"(",
"tempFile",
")",
";",
"return",
"tempFile",
";",
"}",
"/** Agrega un archivo a la lista de TemporaryFiles\n * @param Nombre del archivo\n */",
"public",
"void",
"addFile",
"",
"(",
"String",
"file",
")",
"{",
"files",
".",
"addElement",
"(",
"file",
")",
";",
"}",
"/** Elimina un archivo de la lista\n * @param Nombre del archivo a eliminar\n * @return true si se elimino el archivo de la lista\n */",
"public",
"boolean",
"removeFileFromList",
"",
"(",
"String",
"file",
")",
"{",
"return",
"files",
".",
"removeElement",
"(",
"file",
")",
";",
"}",
"/** Obtiene una copia del vector de archivos temporales\n * @return una copia del Vector de archivos temporales\n */",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Vector",
"<",
"String",
">",
"getFiles",
"",
"(",
")",
"{",
"return",
"(",
"Vector",
"<",
"String",
">",
")",
"files",
".",
"clone",
"(",
")",
";",
"}",
"}"
] | [
29,
4
] | [
100,
1
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Mesa. | null | Le da al jugador la carta del monton de la pos (x,y) | Le da al jugador la carta del monton de la pos (x,y) | public Carta getCartaMonton(int x, int y) throws Exception{
if(montonInterior[x][y].isEmpty()){
throw new Exception("No se puede coger una carta de un monton vacio");
}else{
return montonInterior[x][y].pop();
}
} | [
"public",
"Carta",
"getCartaMonton",
"(",
"int",
"x",
",",
"int",
"y",
")",
"throws",
"Exception",
"{",
"if",
"(",
"montonInterior",
"[",
"x",
"]",
"[",
"y",
"]",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"No se puede coger una carta de un monton vacio\"",
")",
";",
"}",
"else",
"{",
"return",
"montonInterior",
"[",
"x",
"]",
"[",
"y",
"]",
".",
"pop",
"(",
")",
";",
"}",
"}"
] | [
211,
4
] | [
218,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CropOverlayView. | null | Metodo que se encarga de realizar el recorte de la fotografia
tomando como parametros los puntos de referencia de la seleccion previa
creando un nuevo bitmap "stretch" el cual se le envia como onFinish al croplistener
| Metodo que se encarga de realizar el recorte de la fotografia
tomando como parametros los puntos de referencia de la seleccion previa
creando un nuevo bitmap "stretch" el cual se le envia como onFinish al croplistener
| public void crop(CropListener cropListener, boolean needStretch) {
if (topLeft == null) return;
// calcular el tamañano del bitmap en un nuevo canvas
float scaleX = bitmap.getWidth() * 1.0f / getWidth();
float scaleY = bitmap.getHeight() * 1.0f / getHeight();
float maxScale = Math.max(scaleX, scaleY);
// volver a calcular las coordenadas en el mapa de bits original
Point bitmapTopLeft = new Point((int) ((topLeft.x - minX) * maxScale), (int) ((topLeft.y - minY) * maxScale));
Point bitmapTopRight = new Point((int) ((topRight.x - minX) * maxScale), (int) ((topRight.y - minY) * maxScale));
Point bitmapBottomLeft = new Point((int) ((bottomLeft.x - minX) * maxScale), (int) ((bottomLeft.y - minY) * maxScale));
Point bitmapBottomRight = new Point((int) ((bottomRight.x - minX) * maxScale), (int) ((bottomRight.y - minY) * maxScale));
Bitmap output = Bitmap.createBitmap(bitmap.getWidth()+1, bitmap.getHeight()+1, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(output);
Paint paint = new Paint();
Path path = new Path();
path.moveTo(bitmapTopLeft.x, bitmapTopLeft.y);
path.lineTo(bitmapTopRight.x, bitmapTopRight.y);
path.lineTo(bitmapBottomRight.x, bitmapBottomRight.y);
path.lineTo(bitmapBottomLeft.x, bitmapBottomLeft.y);
path.close();
canvas.drawPath(path, paint);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
canvas.drawBitmap(bitmap, 0, 0, paint);
Rect cropRect = new Rect(
Math.min(bitmapTopLeft.x, bitmapBottomLeft.x),
Math.min(bitmapTopLeft.y, bitmapTopRight.y),
Math.max(bitmapBottomRight.x, bitmapTopRight.x),
Math.max(bitmapBottomRight.y, bitmapBottomLeft.y));
if(cropRect.width() <= 0 || cropRect.height() <= 0) { //用户裁剪的宽或高为0
cropListener.onFinish(null);
return;
}
Bitmap cut = Bitmap.createBitmap(
output,
cropRect.left,
cropRect.top,
cropRect.width(),
cropRect.height()
);
if (!needStretch) {
cropListener.onFinish(cut);
} else {
Point cutTopLeft = new Point();
Point cutTopRight = new Point();
Point cutBottomLeft = new Point();
Point cutBottomRight = new Point();
cutTopLeft.x = bitmapTopLeft.x > bitmapBottomLeft.x ? bitmapTopLeft.x - bitmapBottomLeft.x : 0;
cutTopLeft.y = bitmapTopLeft.y > bitmapTopRight.y ? bitmapTopLeft.y - bitmapTopRight.y : 0;
cutTopRight.x = bitmapTopRight.x > bitmapBottomRight.x ? cropRect.width() : cropRect.width() - Math.abs(bitmapBottomRight.x - bitmapTopRight.x);
cutTopRight.y = bitmapTopLeft.y > bitmapTopRight.y ? 0 : Math.abs(bitmapTopLeft.y - bitmapTopRight.y);
cutBottomLeft.x = bitmapTopLeft.x > bitmapBottomLeft.x ? 0 : Math.abs(bitmapTopLeft.x - bitmapBottomLeft.x);
cutBottomLeft.y = bitmapBottomLeft.y > bitmapBottomRight.y ? cropRect.height() : cropRect.height() - Math.abs(bitmapBottomRight.y - bitmapBottomLeft.y);
cutBottomRight.x = bitmapTopRight.x > bitmapBottomRight.x ? cropRect.width() - Math.abs(bitmapBottomRight.x - bitmapTopRight.x) : cropRect.width();
cutBottomRight.y = bitmapBottomLeft.y > bitmapBottomRight.y ? cropRect.height() - Math.abs(bitmapBottomRight.y - bitmapBottomLeft.y) : cropRect.height();
float width = cut.getWidth();
float height = cut.getHeight();
float[] src = new float[]{cutTopLeft.x, cutTopLeft.y, cutTopRight.x, cutTopRight.y, cutBottomRight.x, cutBottomRight.y, cutBottomLeft.x, cutBottomLeft.y};
float[] dst = new float[]{0, 0, width, 0, width, height, 0, height};
Matrix matrix = new Matrix();
matrix.setPolyToPoly(src, 0, dst, 0, 4);
Bitmap stretch = Bitmap.createBitmap(cut.getWidth(), cut.getHeight(), Bitmap.Config.ARGB_8888);
Canvas stretchCanvas = new Canvas(stretch);
// stretchCanvas.drawBitmap(cut, matrix, null);
stretchCanvas.concat(matrix);
stretchCanvas.drawBitmapMesh(cut, WIDTH_BLOCK, HEIGHT_BLOCK, generateVertices(cut.getWidth(), cut.getHeight()), 0, null, 0, null);
cropListener.onFinish(stretch);
}
} | [
"public",
"void",
"crop",
"(",
"CropListener",
"cropListener",
",",
"boolean",
"needStretch",
")",
"{",
"if",
"(",
"topLeft",
"==",
"null",
")",
"return",
";",
"// calcular el tamañano del bitmap en un nuevo canvas",
"float",
"scaleX",
"=",
"bitmap",
".",
"getWidth",
"(",
")",
"*",
"1.0f",
"/",
"getWidth",
"(",
")",
";",
"float",
"scaleY",
"=",
"bitmap",
".",
"getHeight",
"(",
")",
"*",
"1.0f",
"/",
"getHeight",
"(",
")",
";",
"float",
"maxScale",
"=",
"Math",
".",
"max",
"(",
"scaleX",
",",
"scaleY",
")",
";",
"// volver a calcular las coordenadas en el mapa de bits original",
"Point",
"bitmapTopLeft",
"=",
"new",
"Point",
"(",
"(",
"int",
")",
"(",
"(",
"topLeft",
".",
"x",
"-",
"minX",
")",
"*",
"maxScale",
")",
",",
"(",
"int",
")",
"(",
"(",
"topLeft",
".",
"y",
"-",
"minY",
")",
"*",
"maxScale",
")",
")",
";",
"Point",
"bitmapTopRight",
"=",
"new",
"Point",
"(",
"(",
"int",
")",
"(",
"(",
"topRight",
".",
"x",
"-",
"minX",
")",
"*",
"maxScale",
")",
",",
"(",
"int",
")",
"(",
"(",
"topRight",
".",
"y",
"-",
"minY",
")",
"*",
"maxScale",
")",
")",
";",
"Point",
"bitmapBottomLeft",
"=",
"new",
"Point",
"(",
"(",
"int",
")",
"(",
"(",
"bottomLeft",
".",
"x",
"-",
"minX",
")",
"*",
"maxScale",
")",
",",
"(",
"int",
")",
"(",
"(",
"bottomLeft",
".",
"y",
"-",
"minY",
")",
"*",
"maxScale",
")",
")",
";",
"Point",
"bitmapBottomRight",
"=",
"new",
"Point",
"(",
"(",
"int",
")",
"(",
"(",
"bottomRight",
".",
"x",
"-",
"minX",
")",
"*",
"maxScale",
")",
",",
"(",
"int",
")",
"(",
"(",
"bottomRight",
".",
"y",
"-",
"minY",
")",
"*",
"maxScale",
")",
")",
";",
"Bitmap",
"output",
"=",
"Bitmap",
".",
"createBitmap",
"(",
"bitmap",
".",
"getWidth",
"(",
")",
"+",
"1",
",",
"bitmap",
".",
"getHeight",
"(",
")",
"+",
"1",
",",
"Bitmap",
".",
"Config",
".",
"ARGB_8888",
")",
";",
"Canvas",
"canvas",
"=",
"new",
"Canvas",
"(",
"output",
")",
";",
"Paint",
"paint",
"=",
"new",
"Paint",
"(",
")",
";",
"Path",
"path",
"=",
"new",
"Path",
"(",
")",
";",
"path",
".",
"moveTo",
"(",
"bitmapTopLeft",
".",
"x",
",",
"bitmapTopLeft",
".",
"y",
")",
";",
"path",
".",
"lineTo",
"(",
"bitmapTopRight",
".",
"x",
",",
"bitmapTopRight",
".",
"y",
")",
";",
"path",
".",
"lineTo",
"(",
"bitmapBottomRight",
".",
"x",
",",
"bitmapBottomRight",
".",
"y",
")",
";",
"path",
".",
"lineTo",
"(",
"bitmapBottomLeft",
".",
"x",
",",
"bitmapBottomLeft",
".",
"y",
")",
";",
"path",
".",
"close",
"(",
")",
";",
"canvas",
".",
"drawPath",
"(",
"path",
",",
"paint",
")",
";",
"paint",
".",
"setXfermode",
"(",
"new",
"PorterDuffXfermode",
"(",
"PorterDuff",
".",
"Mode",
".",
"SRC_IN",
")",
")",
";",
"canvas",
".",
"drawBitmap",
"(",
"bitmap",
",",
"0",
",",
"0",
",",
"paint",
")",
";",
"Rect",
"cropRect",
"=",
"new",
"Rect",
"(",
"Math",
".",
"min",
"(",
"bitmapTopLeft",
".",
"x",
",",
"bitmapBottomLeft",
".",
"x",
")",
",",
"Math",
".",
"min",
"(",
"bitmapTopLeft",
".",
"y",
",",
"bitmapTopRight",
".",
"y",
")",
",",
"Math",
".",
"max",
"(",
"bitmapBottomRight",
".",
"x",
",",
"bitmapTopRight",
".",
"x",
")",
",",
"Math",
".",
"max",
"(",
"bitmapBottomRight",
".",
"y",
",",
"bitmapBottomLeft",
".",
"y",
")",
")",
";",
"if",
"(",
"cropRect",
".",
"width",
"(",
")",
"<=",
"0",
"||",
"cropRect",
".",
"height",
"(",
")",
"<=",
"0",
")",
"{",
"//用户裁剪的宽或高为0",
"cropListener",
".",
"onFinish",
"(",
"null",
")",
";",
"return",
";",
"}",
"Bitmap",
"cut",
"=",
"Bitmap",
".",
"createBitmap",
"(",
"output",
",",
"cropRect",
".",
"left",
",",
"cropRect",
".",
"top",
",",
"cropRect",
".",
"width",
"(",
")",
",",
"cropRect",
".",
"height",
"(",
")",
")",
";",
"if",
"(",
"!",
"needStretch",
")",
"{",
"cropListener",
".",
"onFinish",
"(",
"cut",
")",
";",
"}",
"else",
"{",
"Point",
"cutTopLeft",
"=",
"new",
"Point",
"(",
")",
";",
"Point",
"cutTopRight",
"=",
"new",
"Point",
"(",
")",
";",
"Point",
"cutBottomLeft",
"=",
"new",
"Point",
"(",
")",
";",
"Point",
"cutBottomRight",
"=",
"new",
"Point",
"(",
")",
";",
"cutTopLeft",
".",
"x",
"=",
"bitmapTopLeft",
".",
"x",
">",
"bitmapBottomLeft",
".",
"x",
"?",
"bitmapTopLeft",
".",
"x",
"-",
"bitmapBottomLeft",
".",
"x",
":",
"0",
";",
"cutTopLeft",
".",
"y",
"=",
"bitmapTopLeft",
".",
"y",
">",
"bitmapTopRight",
".",
"y",
"?",
"bitmapTopLeft",
".",
"y",
"-",
"bitmapTopRight",
".",
"y",
":",
"0",
";",
"cutTopRight",
".",
"x",
"=",
"bitmapTopRight",
".",
"x",
">",
"bitmapBottomRight",
".",
"x",
"?",
"cropRect",
".",
"width",
"(",
")",
":",
"cropRect",
".",
"width",
"(",
")",
"-",
"Math",
".",
"abs",
"(",
"bitmapBottomRight",
".",
"x",
"-",
"bitmapTopRight",
".",
"x",
")",
";",
"cutTopRight",
".",
"y",
"=",
"bitmapTopLeft",
".",
"y",
">",
"bitmapTopRight",
".",
"y",
"?",
"0",
":",
"Math",
".",
"abs",
"(",
"bitmapTopLeft",
".",
"y",
"-",
"bitmapTopRight",
".",
"y",
")",
";",
"cutBottomLeft",
".",
"x",
"=",
"bitmapTopLeft",
".",
"x",
">",
"bitmapBottomLeft",
".",
"x",
"?",
"0",
":",
"Math",
".",
"abs",
"(",
"bitmapTopLeft",
".",
"x",
"-",
"bitmapBottomLeft",
".",
"x",
")",
";",
"cutBottomLeft",
".",
"y",
"=",
"bitmapBottomLeft",
".",
"y",
">",
"bitmapBottomRight",
".",
"y",
"?",
"cropRect",
".",
"height",
"(",
")",
":",
"cropRect",
".",
"height",
"(",
")",
"-",
"Math",
".",
"abs",
"(",
"bitmapBottomRight",
".",
"y",
"-",
"bitmapBottomLeft",
".",
"y",
")",
";",
"cutBottomRight",
".",
"x",
"=",
"bitmapTopRight",
".",
"x",
">",
"bitmapBottomRight",
".",
"x",
"?",
"cropRect",
".",
"width",
"(",
")",
"-",
"Math",
".",
"abs",
"(",
"bitmapBottomRight",
".",
"x",
"-",
"bitmapTopRight",
".",
"x",
")",
":",
"cropRect",
".",
"width",
"(",
")",
";",
"cutBottomRight",
".",
"y",
"=",
"bitmapBottomLeft",
".",
"y",
">",
"bitmapBottomRight",
".",
"y",
"?",
"cropRect",
".",
"height",
"(",
")",
"-",
"Math",
".",
"abs",
"(",
"bitmapBottomRight",
".",
"y",
"-",
"bitmapBottomLeft",
".",
"y",
")",
":",
"cropRect",
".",
"height",
"(",
")",
";",
"float",
"width",
"=",
"cut",
".",
"getWidth",
"(",
")",
";",
"float",
"height",
"=",
"cut",
".",
"getHeight",
"(",
")",
";",
"float",
"[",
"]",
"src",
"=",
"new",
"float",
"[",
"]",
"{",
"cutTopLeft",
".",
"x",
",",
"cutTopLeft",
".",
"y",
",",
"cutTopRight",
".",
"x",
",",
"cutTopRight",
".",
"y",
",",
"cutBottomRight",
".",
"x",
",",
"cutBottomRight",
".",
"y",
",",
"cutBottomLeft",
".",
"x",
",",
"cutBottomLeft",
".",
"y",
"}",
";",
"float",
"[",
"]",
"dst",
"=",
"new",
"float",
"[",
"]",
"{",
"0",
",",
"0",
",",
"width",
",",
"0",
",",
"width",
",",
"height",
",",
"0",
",",
"height",
"}",
";",
"Matrix",
"matrix",
"=",
"new",
"Matrix",
"(",
")",
";",
"matrix",
".",
"setPolyToPoly",
"(",
"src",
",",
"0",
",",
"dst",
",",
"0",
",",
"4",
")",
";",
"Bitmap",
"stretch",
"=",
"Bitmap",
".",
"createBitmap",
"(",
"cut",
".",
"getWidth",
"(",
")",
",",
"cut",
".",
"getHeight",
"(",
")",
",",
"Bitmap",
".",
"Config",
".",
"ARGB_8888",
")",
";",
"Canvas",
"stretchCanvas",
"=",
"new",
"Canvas",
"(",
"stretch",
")",
";",
"// stretchCanvas.drawBitmap(cut, matrix, null);",
"stretchCanvas",
".",
"concat",
"(",
"matrix",
")",
";",
"stretchCanvas",
".",
"drawBitmapMesh",
"(",
"cut",
",",
"WIDTH_BLOCK",
",",
"HEIGHT_BLOCK",
",",
"generateVertices",
"(",
"cut",
".",
"getWidth",
"(",
")",
",",
"cut",
".",
"getHeight",
"(",
")",
")",
",",
"0",
",",
"null",
",",
"0",
",",
"null",
")",
";",
"cropListener",
".",
"onFinish",
"(",
"stretch",
")",
";",
"}",
"}"
] | [
352,
4
] | [
441,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
PetService. | null | Funcion para comprobar si hay mas de una reserva en un mismo periodo de tiempo | Funcion para comprobar si hay mas de una reserva en un mismo periodo de tiempo | @Transactional(readOnly = true)
public Boolean duplicatedBooking(Booking booking) {
List<Booking> lb = bookingRepository.findByPetId(booking.getPet().getId());
LocalDate inicioN = booking.getStartDate();
LocalDate finN = booking.getFinishDate();
Boolean duplicated = false;
for (int i = 0; i < lb.size(); i++) {
Booking b = lb.get(i);
LocalDate inicioA = b.getStartDate();
LocalDate finA = b.getFinishDate();
if((inicioN.isEqual(inicioA) || ((inicioN.isAfter(inicioA)) && inicioN.isBefore(finA)))
|| (finN.isEqual(finA) || (finN.isAfter(inicioA) && finN.isBefore(finA))) ||
(inicioA.isAfter(inicioN) && inicioA.isBefore(finN)) || (finA.isAfter(inicioN) && finA.isBefore(finN))){
duplicated = true;
break;
}
}
return duplicated;
} | [
"@",
"Transactional",
"(",
"readOnly",
"=",
"true",
")",
"public",
"Boolean",
"duplicatedBooking",
"(",
"Booking",
"booking",
")",
"{",
"List",
"<",
"Booking",
">",
"lb",
"=",
"bookingRepository",
".",
"findByPetId",
"(",
"booking",
".",
"getPet",
"(",
")",
".",
"getId",
"(",
")",
")",
";",
"LocalDate",
"inicioN",
"=",
"booking",
".",
"getStartDate",
"(",
")",
";",
"LocalDate",
"finN",
"=",
"booking",
".",
"getFinishDate",
"(",
")",
";",
"Boolean",
"duplicated",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"lb",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"Booking",
"b",
"=",
"lb",
".",
"get",
"(",
"i",
")",
";",
"LocalDate",
"inicioA",
"=",
"b",
".",
"getStartDate",
"(",
")",
";",
"LocalDate",
"finA",
"=",
"b",
".",
"getFinishDate",
"(",
")",
";",
"if",
"(",
"(",
"inicioN",
".",
"isEqual",
"(",
"inicioA",
")",
"||",
"(",
"(",
"inicioN",
".",
"isAfter",
"(",
"inicioA",
")",
")",
"&&",
"inicioN",
".",
"isBefore",
"(",
"finA",
")",
")",
")",
"||",
"(",
"finN",
".",
"isEqual",
"(",
"finA",
")",
"||",
"(",
"finN",
".",
"isAfter",
"(",
"inicioA",
")",
"&&",
"finN",
".",
"isBefore",
"(",
"finA",
")",
")",
")",
"||",
"(",
"inicioA",
".",
"isAfter",
"(",
"inicioN",
")",
"&&",
"inicioA",
".",
"isBefore",
"(",
"finN",
")",
")",
"||",
"(",
"finA",
".",
"isAfter",
"(",
"inicioN",
")",
"&&",
"finA",
".",
"isBefore",
"(",
"finN",
")",
")",
")",
"{",
"duplicated",
"=",
"true",
";",
"break",
";",
"}",
"}",
"return",
"duplicated",
";",
"}"
] | [
97,
1
] | [
116,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ControladoraHotel. | null | trae todas las habitaciones de la persistencia y las devuelve en forma de lista | trae todas las habitaciones de la persistencia y las devuelve en forma de lista | public List<Reserva> traerReserva() {
return controlPersistencia.traerReserva();
} | [
"public",
"List",
"<",
"Reserva",
">",
"traerReserva",
"(",
")",
"{",
"return",
"controlPersistencia",
".",
"traerReserva",
"(",
")",
";",
"}"
] | [
190,
4
] | [
192,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
KaldiActivity. | null | Lo que hice fue guardar el texto transcripto hasta ese motomento para volver a mostrarlo luego | Lo que hice fue guardar el texto transcripto hasta ese motomento para volver a mostrarlo luego | @Override
protected void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString("texto", TextoCompleto);
outState.putInt("status", statusUi);
if(statusUi==4){
outState.putBoolean("reset",true);
}
} | [
"@",
"Override",
"protected",
"void",
"onSaveInstanceState",
"(",
"@",
"NonNull",
"Bundle",
"outState",
")",
"{",
"super",
".",
"onSaveInstanceState",
"(",
"outState",
")",
";",
"outState",
".",
"putString",
"(",
"\"texto\"",
",",
"TextoCompleto",
")",
";",
"outState",
".",
"putInt",
"(",
"\"status\"",
",",
"statusUi",
")",
";",
"if",
"(",
"statusUi",
"==",
"4",
")",
"{",
"outState",
".",
"putBoolean",
"(",
"\"reset\"",
",",
"true",
")",
";",
"}",
"}"
] | [
553,
4
] | [
561,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
DeviceTest. | null | CP5: Cuando tenemos un dispositivo apagado, el consumo actual debe ser cero. | CP5: Cuando tenemos un dispositivo apagado, el consumo actual debe ser cero. | @Test
public void Given_A_TurnedOff_Device_When_GetCurrentConsumption_Method_Is_Called_Then_Return_Zero(){
//Given
Integer expectedCurrentConsumption = 0;
device.turnOff();
//When
Integer result = device.getCurrentConsumption();
//Then
assertEquals(expectedCurrentConsumption,result);
} | [
"@",
"Test",
"public",
"void",
"Given_A_TurnedOff_Device_When_GetCurrentConsumption_Method_Is_Called_Then_Return_Zero",
"(",
")",
"{",
"//Given",
"Integer",
"expectedCurrentConsumption",
"=",
"0",
";",
"device",
".",
"turnOff",
"(",
")",
";",
"//When",
"Integer",
"result",
"=",
"device",
".",
"getCurrentConsumption",
"(",
")",
";",
"//Then",
"assertEquals",
"(",
"expectedCurrentConsumption",
",",
"result",
")",
";",
"}"
] | [
68,
4
] | [
79,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ControladoraHotel. | null | devuelve el monto total del precio de una habitacion segun su tipo y la cantidad de dias de la reserva | devuelve el monto total del precio de una habitacion segun su tipo y la cantidad de dias de la reserva | public double damePrecioTotal(Date fecha_ingreso, Date fecha_egreso, double precio_noche) {
int cant_dias_reserva = dameCantidadDias(fecha_ingreso, fecha_egreso);
double precio_total = cant_dias_reserva * precio_noche;
return precio_total;
} | [
"public",
"double",
"damePrecioTotal",
"(",
"Date",
"fecha_ingreso",
",",
"Date",
"fecha_egreso",
",",
"double",
"precio_noche",
")",
"{",
"int",
"cant_dias_reserva",
"=",
"dameCantidadDias",
"(",
"fecha_ingreso",
",",
"fecha_egreso",
")",
";",
"double",
"precio_total",
"=",
"cant_dias_reserva",
"*",
"precio_noche",
";",
"return",
"precio_total",
";",
"}"
] | [
552,
4
] | [
556,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
KaldiActivity. | null | yo fui agregando funciones. Las comento | yo fui agregando funciones. Las comento | private void setUiState(int state) {
switch (state) {
case STATE_START:
//Cuando arranca pone preparando sistema.
resultView.setText(R.string.preparing);
// Propiedad para que scrolee
resultView.setMovementMethod(new ScrollingMovementMethod());
// Se deshabilita el boton reconocer, porque todavía no está andando el VOSK
findViewById(R.id.recognize_mic).setEnabled(false);
// Se guarda el estado "START" por si el usuario rota el celular
statusUi=1;
break;
case STATE_READY:
//Cuando está listo pone "presione en la oreja.."
if(statusUi!=4){
resultView.setText(R.string.ready);
//Se habilita el botón
findViewById(R.id.recognize_mic).setEnabled(true);
// Se guarda el estado "READY" por si el usuario rota el celular
statusUi=2;}
break;
case STATE_DONE:
// Cuando el usuario termina la captura
recMic = findViewById(R.id.recognize_mic);
//Se habilitan los botones de compartir y se vuelve a mostrar la oreja en el de reconocer
recMic.setEnabled(true);
recMic.setImageResource(R.drawable.ic_microfono);
recMic.setContentDescription(getString(R.string.button_start_listening));
shareText = findViewById(R.id.compartir);
shareText.setVisibility(View.VISIBLE);
statusUi=3;
resetApp = false;
Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
vibrator.vibrate(150);
break;
case STATE_FILE:
//No usado
resultView.setText(getString(R.string.starting));
findViewById(R.id.recognize_mic).setEnabled(false);
break;
case STATE_MIC:
//Acá se entra cuando se está reconociendo.
// Le agregue el iff con resetApp por si el usuario rotó el celular durante una transcripción
if(!resetApp){
resultView.setText("");
}
// Habilitamos el botón de reconocer y le ponemos el ícono pausa.
recMic = findViewById(R.id.recognize_mic);
recMic.setEnabled(true);
recMic.setImageResource(R.drawable.ic_pausa);
// Cambiar texto descriptivo
recMic.setContentDescription(getString(R.string.button_stop_listening));
Vibrator vibrator2 = (Vibrator) getSystemService(VIBRATOR_SERVICE);
vibrator2.vibrate(150);
statusUi=4;
break;
}
} | [
"private",
"void",
"setUiState",
"(",
"int",
"state",
")",
"{",
"switch",
"(",
"state",
")",
"{",
"case",
"STATE_START",
":",
"//Cuando arranca pone preparando sistema.",
"resultView",
".",
"setText",
"(",
"R",
".",
"string",
".",
"preparing",
")",
";",
"// Propiedad para que scrolee",
"resultView",
".",
"setMovementMethod",
"(",
"new",
"ScrollingMovementMethod",
"(",
")",
")",
";",
"// Se deshabilita el boton reconocer, porque todavía no está andando el VOSK",
"findViewById",
"(",
"R",
".",
"id",
".",
"recognize_mic",
")",
".",
"setEnabled",
"(",
"false",
")",
";",
"// Se guarda el estado \"START\" por si el usuario rota el celular",
"statusUi",
"=",
"1",
";",
"break",
";",
"case",
"STATE_READY",
":",
"//Cuando está listo pone \"presione en la oreja..\"",
"if",
"(",
"statusUi",
"!=",
"4",
")",
"{",
"resultView",
".",
"setText",
"(",
"R",
".",
"string",
".",
"ready",
")",
";",
"//Se habilita el botón",
"findViewById",
"(",
"R",
".",
"id",
".",
"recognize_mic",
")",
".",
"setEnabled",
"(",
"true",
")",
";",
"// Se guarda el estado \"READY\" por si el usuario rota el celular",
"statusUi",
"=",
"2",
";",
"}",
"break",
";",
"case",
"STATE_DONE",
":",
"// Cuando el usuario termina la captura",
"recMic",
"=",
"findViewById",
"(",
"R",
".",
"id",
".",
"recognize_mic",
")",
";",
"//Se habilitan los botones de compartir y se vuelve a mostrar la oreja en el de reconocer",
"recMic",
".",
"setEnabled",
"(",
"true",
")",
";",
"recMic",
".",
"setImageResource",
"(",
"R",
".",
"drawable",
".",
"ic_microfono",
")",
";",
"recMic",
".",
"setContentDescription",
"(",
"getString",
"(",
"R",
".",
"string",
".",
"button_start_listening",
")",
")",
";",
"shareText",
"=",
"findViewById",
"(",
"R",
".",
"id",
".",
"compartir",
")",
";",
"shareText",
".",
"setVisibility",
"(",
"View",
".",
"VISIBLE",
")",
";",
"statusUi",
"=",
"3",
";",
"resetApp",
"=",
"false",
";",
"Vibrator",
"vibrator",
"=",
"(",
"Vibrator",
")",
"getSystemService",
"(",
"VIBRATOR_SERVICE",
")",
";",
"vibrator",
".",
"vibrate",
"(",
"150",
")",
";",
"break",
";",
"case",
"STATE_FILE",
":",
"//No usado",
"resultView",
".",
"setText",
"(",
"getString",
"(",
"R",
".",
"string",
".",
"starting",
")",
")",
";",
"findViewById",
"(",
"R",
".",
"id",
".",
"recognize_mic",
")",
".",
"setEnabled",
"(",
"false",
")",
";",
"break",
";",
"case",
"STATE_MIC",
":",
"//Acá se entra cuando se está reconociendo.",
"// Le agregue el iff con resetApp por si el usuario rotó el celular durante una transcripción",
"if",
"(",
"!",
"resetApp",
")",
"{",
"resultView",
".",
"setText",
"(",
"\"\"",
")",
";",
"}",
"// Habilitamos el botón de reconocer y le ponemos el ícono pausa.",
"recMic",
"=",
"findViewById",
"(",
"R",
".",
"id",
".",
"recognize_mic",
")",
";",
"recMic",
".",
"setEnabled",
"(",
"true",
")",
";",
"recMic",
".",
"setImageResource",
"(",
"R",
".",
"drawable",
".",
"ic_pausa",
")",
";",
"// Cambiar texto descriptivo",
"recMic",
".",
"setContentDescription",
"(",
"getString",
"(",
"R",
".",
"string",
".",
"button_stop_listening",
")",
")",
";",
"Vibrator",
"vibrator2",
"=",
"(",
"Vibrator",
")",
"getSystemService",
"(",
"VIBRATOR_SERVICE",
")",
";",
"vibrator2",
".",
"vibrate",
"(",
"150",
")",
";",
"statusUi",
"=",
"4",
";",
"break",
";",
"}",
"}"
] | [
460,
4
] | [
520,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CrearCuenta. | null | Método para cuando se presiona CampoApellidoPaterno con el mouse | Método para cuando se presiona CampoApellidoPaterno con el mouse | private void CampoApellidoPaternoMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_CampoApellidoPaternoMousePressed
// Obtener contenido
String Contenido = this.CampoApellidoPaterno.getText();
Color ColorActual = this.CampoApellidoPaterno.getForeground();
Color ColorEscrito = new Color(51, 51, 51);
// Verifica si no tiene nada seteado aún
if(Contenido.equals("Apellido Paterno"))
{
// Elimina contenido
this.CampoApellidoPaterno.setText("");
}
if(ColorActual != ColorEscrito)
{
this.CampoApellidoPaterno.setForeground(ColorEscrito);
}
} | [
"private",
"void",
"CampoApellidoPaternoMousePressed",
"(",
"java",
".",
"awt",
".",
"event",
".",
"MouseEvent",
"evt",
")",
"{",
"//GEN-FIRST:event_CampoApellidoPaternoMousePressed",
"// Obtener contenido",
"String",
"Contenido",
"=",
"this",
".",
"CampoApellidoPaterno",
".",
"getText",
"(",
")",
";",
"Color",
"ColorActual",
"=",
"this",
".",
"CampoApellidoPaterno",
".",
"getForeground",
"(",
")",
";",
"Color",
"ColorEscrito",
"=",
"new",
"Color",
"(",
"51",
",",
"51",
",",
"51",
")",
";",
"// Verifica si no tiene nada seteado aún",
"if",
"(",
"Contenido",
".",
"equals",
"(",
"\"Apellido Paterno\"",
")",
")",
"{",
"// Elimina contenido",
"this",
".",
"CampoApellidoPaterno",
".",
"setText",
"(",
"\"\"",
")",
";",
"}",
"if",
"(",
"ColorActual",
"!=",
"ColorEscrito",
")",
"{",
"this",
".",
"CampoApellidoPaterno",
".",
"setForeground",
"(",
"ColorEscrito",
")",
";",
"}",
"}"
] | [
960,
4
] | [
975,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ConfigFileFinder. | null | Agrega una ruta de prepend donde buscar un cfg como �ltimo recurso
Si el prepend es un archivo, lo abre como ultimo recurso, y sino intenta
abrir el prepend + fileName pasado al getConfigFile
| Agrega una ruta de prepend donde buscar un cfg como �ltimo recurso
Si el prepend es un archivo, lo abre como ultimo recurso, y sino intenta
abrir el prepend + fileName pasado al getConfigFile
| public static void setConfigFilePrepend(String prepend)
{
prependDirectory = prepend;
} | [
"public",
"static",
"void",
"setConfigFilePrepend",
"(",
"String",
"prepend",
")",
"{",
"prependDirectory",
"=",
"prepend",
";",
"}"
] | [
49,
1
] | [
52,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ClaseBBDD. | null | Realiza y devuelve la conexión con la BBDD | Realiza y devuelve la conexión con la BBDD | private Connection conexion() throws SQLException {
Connection conn = DriverManager.getConnection(url, usuario, password);
return conn;
} | [
"private",
"Connection",
"conexion",
"(",
")",
"throws",
"SQLException",
"{",
"Connection",
"conn",
"=",
"DriverManager",
".",
"getConnection",
"(",
"url",
",",
"usuario",
",",
"password",
")",
";",
"return",
"conn",
";",
"}"
] | [
26,
3
] | [
31,
4
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
AppModule. | null | las contribuciones hechas en contributeApplication | las contribuciones hechas en contributeApplication | public static Application buildApplication(Collection<Object> singletons) {
return new Application(singletons);
} | [
"public",
"static",
"Application",
"buildApplication",
"(",
"Collection",
"<",
"Object",
">",
"singletons",
")",
"{",
"return",
"new",
"Application",
"(",
"singletons",
")",
";",
"}"
] | [
67,
1
] | [
69,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ClaseBBDD. | null | Devuelve un string con las estadísticas de los jugadores del equipo elegido | Devuelve un string con las estadísticas de los jugadores del equipo elegido | public String selectEstadisticas(String equipoElegido) throws SQLException {
//Nos conectamos a nuestra BBDD
Connection connect = conexion();
//Creamos un resultSet a partir de la query del statement
Statement st = connect.createStatement();
String query = "SELECT round(AVG(rebotes_por_partido), 2), round (AVG(tapones_por_partido),2), jugadores.nombre FROM estadisticas "
+ "INNER JOIN jugadores ON jugadores.codigo = estadisticas.jugador "
+ "INNER JOIN equipos ON jugadores.nombre_equipo = equipos.nombre "
+ "WHERE equipos.nombre = '" + equipoElegido
+ "' GROUP BY jugadores.nombre ";
ResultSet rs = st.executeQuery(query);
ArrayList<String> listaSelect = new ArrayList<String>();
while (rs.next()) {
String nombre = rs.getString(3);
Double rebotes = rs.getDouble(1);
Double tapones = rs.getDouble(2);
String fila = String.format("%-22s %10.2f %10.2f\n", nombre, rebotes, tapones); //formateamos los datos obtenidos del resultSet en filas
listaSelect.add(fila);
}
connect.close();
String resultado = String.format("%-22s %10s %10s\n", "NOMBRE", "REBOTES", "TAPONES");
// Iterando, añadimos al string resultado, cada una de las líneas de nuestro arrayList
Iterator<String> iterator = listaSelect.iterator();
while (iterator.hasNext()) {
resultado += iterator.next();
}
return resultado;
} | [
"public",
"String",
"selectEstadisticas",
"(",
"String",
"equipoElegido",
")",
"throws",
"SQLException",
"{",
"//Nos conectamos a nuestra BBDD\r",
"Connection",
"connect",
"=",
"conexion",
"(",
")",
";",
"//Creamos un resultSet a partir de la query del statement\r",
"Statement",
"st",
"=",
"connect",
".",
"createStatement",
"(",
")",
";",
"String",
"query",
"=",
"\"SELECT round(AVG(rebotes_por_partido), 2), round (AVG(tapones_por_partido),2), jugadores.nombre FROM estadisticas \"",
"+",
"\"INNER JOIN jugadores ON jugadores.codigo = estadisticas.jugador \"",
"+",
"\"INNER JOIN equipos ON jugadores.nombre_equipo = equipos.nombre \"",
"+",
"\"WHERE equipos.nombre = '\"",
"+",
"equipoElegido",
"+",
"\"' GROUP BY jugadores.nombre \"",
";",
"ResultSet",
"rs",
"=",
"st",
".",
"executeQuery",
"(",
"query",
")",
";",
"ArrayList",
"<",
"String",
">",
"listaSelect",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"while",
"(",
"rs",
".",
"next",
"(",
")",
")",
"{",
"String",
"nombre",
"=",
"rs",
".",
"getString",
"(",
"3",
")",
";",
"Double",
"rebotes",
"=",
"rs",
".",
"getDouble",
"(",
"1",
")",
";",
"Double",
"tapones",
"=",
"rs",
".",
"getDouble",
"(",
"2",
")",
";",
"String",
"fila",
"=",
"String",
".",
"format",
"(",
"\"%-22s %10.2f %10.2f\\n\"",
",",
"nombre",
",",
"rebotes",
",",
"tapones",
")",
";",
"//formateamos los datos obtenidos del resultSet en filas\r",
"listaSelect",
".",
"add",
"(",
"fila",
")",
";",
"}",
"connect",
".",
"close",
"(",
")",
";",
"String",
"resultado",
"=",
"String",
".",
"format",
"(",
"\"%-22s %10s %10s\\n\"",
",",
"\"NOMBRE\"",
",",
"\"REBOTES\"",
",",
"\"TAPONES\"",
")",
";",
"// Iterando, añadimos al string resultado, cada una de las líneas de nuestro arrayList\r",
"Iterator",
"<",
"String",
">",
"iterator",
"=",
"listaSelect",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"resultado",
"+=",
"iterator",
".",
"next",
"(",
")",
";",
"}",
"return",
"resultado",
";",
"}"
] | [
185,
3
] | [
219,
4
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
SubProgramas. | null | Calcula el factorial de cualquier numero | Calcula el factorial de cualquier numero | public int factorial(int numero) {
int factorialResult=1;
if(numero>1){
for (int i = 2; i <= numero; i++) {
factorialResult*=i;
}
}
return factorialResult;
} | [
"public",
"int",
"factorial",
"(",
"int",
"numero",
")",
"{",
"int",
"factorialResult",
"=",
"1",
";",
"if",
"(",
"numero",
">",
"1",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"2",
";",
"i",
"<=",
"numero",
";",
"i",
"++",
")",
"{",
"factorialResult",
"*=",
"i",
";",
"}",
"}",
"return",
"factorialResult",
";",
"}"
] | [
12,
4
] | [
20,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
TransaccionesService. | null | Transacciones Lineas Creditos | Transacciones Lineas Creditos | private List<Transacciones> generarTransaccionesLineaCredito(){
List<Lcmlc> listaLineasCredito = lcmlcRepository.findByGbagendid(listaDocumentos);
List<Transacciones> listaTransacciones = new ArrayList<>();
for(Lcmlc lcmlc: listaLineasCredito){
List<Lctrn> lctrnList = lctrnRepository.findByLctrnnrlc(lcmlc.getLcmlcnrlc());
Optional<Gbage> gbage = gbageRepository.findByGbagecage(lcmlc.getLcmlccage());
for(Lctrn lctrn:lctrnList){
Transacciones transacciones = new Transacciones();
transacciones.setDocumentoPersonaSolicitud(gbage.get().getGbagendid());
transacciones.setNumeroOperacion(lctrn.getLctrnoper().toString());
transacciones.setTipoOperacion("LDC");
transacciones.setNumeroTransaccion(null);
transacciones.setFechaTransaccion(lctrn.getLctrnftra());
transacciones.setTipoTransaccion(null);
transacciones.setTipoFormaPagoTransaccion(null);
transacciones.setMontoTransaccion(null);
transacciones.setSaldo(lcmlc.getLcmlcmapr());
transacciones.setGlosaEntidad(null);
transacciones.setAgencia(null);
transacciones.setNombrePersonaTransaccion(null);
transacciones.setNumeroCuentaTransferencia(null);
transacciones.setNombreTitularCuentaTransferencia(null);
transacciones.setBancoTransferencia(null);
transacciones.setPaisTransferencia(null);
transacciones.setCiudadTransferencia(null);
transacciones.setNumeroCheque(null);
transacciones.setFechaProgramada(null);
transacciones.setImporteProgramado(null);
transacciones.setImporteProgramado(null);
transacciones.setNombreGiroCheque(null);
transacciones.setNombreCobradorCheque(null);
transacciones.setNumeroDpfRenovacion(null);
listaTransacciones.add(transacciones);
}
}
return listaTransacciones;
} | [
"private",
"List",
"<",
"Transacciones",
">",
"generarTransaccionesLineaCredito",
"(",
")",
"{",
"List",
"<",
"Lcmlc",
">",
"listaLineasCredito",
"=",
"lcmlcRepository",
".",
"findByGbagendid",
"(",
"listaDocumentos",
")",
";",
"List",
"<",
"Transacciones",
">",
"listaTransacciones",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"Lcmlc",
"lcmlc",
":",
"listaLineasCredito",
")",
"{",
"List",
"<",
"Lctrn",
">",
"lctrnList",
"=",
"lctrnRepository",
".",
"findByLctrnnrlc",
"(",
"lcmlc",
".",
"getLcmlcnrlc",
"(",
")",
")",
";",
"Optional",
"<",
"Gbage",
">",
"gbage",
"=",
"gbageRepository",
".",
"findByGbagecage",
"(",
"lcmlc",
".",
"getLcmlccage",
"(",
")",
")",
";",
"for",
"(",
"Lctrn",
"lctrn",
":",
"lctrnList",
")",
"{",
"Transacciones",
"transacciones",
"=",
"new",
"Transacciones",
"(",
")",
";",
"transacciones",
".",
"setDocumentoPersonaSolicitud",
"(",
"gbage",
".",
"get",
"(",
")",
".",
"getGbagendid",
"(",
")",
")",
";",
"transacciones",
".",
"setNumeroOperacion",
"(",
"lctrn",
".",
"getLctrnoper",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"transacciones",
".",
"setTipoOperacion",
"(",
"\"LDC\"",
")",
";",
"transacciones",
".",
"setNumeroTransaccion",
"(",
"null",
")",
";",
"transacciones",
".",
"setFechaTransaccion",
"(",
"lctrn",
".",
"getLctrnftra",
"(",
")",
")",
";",
"transacciones",
".",
"setTipoTransaccion",
"(",
"null",
")",
";",
"transacciones",
".",
"setTipoFormaPagoTransaccion",
"(",
"null",
")",
";",
"transacciones",
".",
"setMontoTransaccion",
"(",
"null",
")",
";",
"transacciones",
".",
"setSaldo",
"(",
"lcmlc",
".",
"getLcmlcmapr",
"(",
")",
")",
";",
"transacciones",
".",
"setGlosaEntidad",
"(",
"null",
")",
";",
"transacciones",
".",
"setAgencia",
"(",
"null",
")",
";",
"transacciones",
".",
"setNombrePersonaTransaccion",
"(",
"null",
")",
";",
"transacciones",
".",
"setNumeroCuentaTransferencia",
"(",
"null",
")",
";",
"transacciones",
".",
"setNombreTitularCuentaTransferencia",
"(",
"null",
")",
";",
"transacciones",
".",
"setBancoTransferencia",
"(",
"null",
")",
";",
"transacciones",
".",
"setPaisTransferencia",
"(",
"null",
")",
";",
"transacciones",
".",
"setCiudadTransferencia",
"(",
"null",
")",
";",
"transacciones",
".",
"setNumeroCheque",
"(",
"null",
")",
";",
"transacciones",
".",
"setFechaProgramada",
"(",
"null",
")",
";",
"transacciones",
".",
"setImporteProgramado",
"(",
"null",
")",
";",
"transacciones",
".",
"setImporteProgramado",
"(",
"null",
")",
";",
"transacciones",
".",
"setNombreGiroCheque",
"(",
"null",
")",
";",
"transacciones",
".",
"setNombreCobradorCheque",
"(",
"null",
")",
";",
"transacciones",
".",
"setNumeroDpfRenovacion",
"(",
"null",
")",
";",
"listaTransacciones",
".",
"add",
"(",
"transacciones",
")",
";",
"}",
"}",
"return",
"listaTransacciones",
";",
"}"
] | [
265,
4
] | [
311,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
HttpContext. | null | Este writeValue tiene en consideracion los espacios consecutivos,
los enter y los tabs
| Este writeValue tiene en consideracion los espacios consecutivos,
los enter y los tabs
| public void writeValueComplete(String text, boolean cvtTabs, boolean cvtEnters, boolean cvtSpaces)
{
StringBuilder sb = new StringBuilder();
boolean lastCharIsSpace = true; // Asumo que al comienzo el lastChar era space
for (int i = 0; i < text.length(); i++)
{
char currentChar = text.charAt(i);
switch (currentChar)
{
case (char) 34:
sb.append(""");
break;
case (char) 38:
sb.append("&");
break;
case (char) 60:
sb.append("<");
break;
case (char) 62:
sb.append(">");
break;
case '\t':
sb.append(cvtTabs ? " " : ("" + currentChar));
break;
case '\r':
if (cvtEnters && text.length() > i + 1 && text.charAt(i+1) == '\n'){
sb.append(cvtEnters ? "<br>" : ("" + currentChar));
i++;
}
break;
case '\n':
sb.append(cvtEnters ? "<br>" : ("" + currentChar));
break;
case ' ':
sb.append((lastCharIsSpace && cvtSpaces) ? " " : " ");
break;
default:
sb.append("" + currentChar);
}
lastCharIsSpace = currentChar == ' ';
}
writeText(sb.toString());
} | [
"public",
"void",
"writeValueComplete",
"(",
"String",
"text",
",",
"boolean",
"cvtTabs",
",",
"boolean",
"cvtEnters",
",",
"boolean",
"cvtSpaces",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"boolean",
"lastCharIsSpace",
"=",
"true",
";",
"// Asumo que al comienzo el lastChar era space",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"text",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"char",
"currentChar",
"=",
"text",
".",
"charAt",
"(",
"i",
")",
";",
"switch",
"(",
"currentChar",
")",
"{",
"case",
"(",
"char",
")",
"34",
":",
"sb",
".",
"append",
"(",
"\""\"",
")",
";",
"break",
";",
"case",
"(",
"char",
")",
"38",
":",
"sb",
".",
"append",
"(",
"\"&\"",
")",
";",
"break",
";",
"case",
"(",
"char",
")",
"60",
":",
"sb",
".",
"append",
"(",
"\"<\"",
")",
";",
"break",
";",
"case",
"(",
"char",
")",
"62",
":",
"sb",
".",
"append",
"(",
"\">\"",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"sb",
".",
"append",
"(",
"cvtTabs",
"?",
"\" \"",
":",
"(",
"\"\"",
"+",
"currentChar",
")",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"if",
"(",
"cvtEnters",
"&&",
"text",
".",
"length",
"(",
")",
">",
"i",
"+",
"1",
"&&",
"text",
".",
"charAt",
"(",
"i",
"+",
"1",
")",
"==",
"'",
"'",
")",
"{",
"sb",
".",
"append",
"(",
"cvtEnters",
"?",
"\"<br>\"",
":",
"(",
"\"\"",
"+",
"currentChar",
")",
")",
";",
"i",
"++",
";",
"}",
"break",
";",
"case",
"'",
"'",
":",
"sb",
".",
"append",
"(",
"cvtEnters",
"?",
"\"<br>\"",
":",
"(",
"\"\"",
"+",
"currentChar",
")",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"sb",
".",
"append",
"(",
"(",
"lastCharIsSpace",
"&&",
"cvtSpaces",
")",
"?",
"\" \"",
":",
"\" \"",
")",
";",
"break",
";",
"default",
":",
"sb",
".",
"append",
"(",
"\"\"",
"+",
"currentChar",
")",
";",
"}",
"lastCharIsSpace",
"=",
"currentChar",
"==",
"'",
"'",
";",
"}",
"writeText",
"(",
"sb",
".",
"toString",
"(",
")",
")",
";",
"}"
] | [
1230,
1
] | [
1272,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
GXCallableStatement. | null | -- Funciones que NO deberian ser llamadas desde los programas generados | -- Funciones que NO deberian ser llamadas desde los programas generados | public String getString(int columnIndex) throws SQLException
{
if (DEBUG) log(GXDBDebug.LOG_MAX, "Warning: getString");
return stmt.getString(columnIndex);
} | [
"public",
"String",
"getString",
"(",
"int",
"columnIndex",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"DEBUG",
")",
"log",
"(",
"GXDBDebug",
".",
"LOG_MAX",
",",
"\"Warning: getString\"",
")",
";",
"return",
"stmt",
".",
"getString",
"(",
"columnIndex",
")",
";",
"}"
] | [
685,
1
] | [
690,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Registro. | null | Método getTamanoReservaciones | Método getTamanoReservaciones | public int getTamanoReservaciones()
{
return RegistroReservaciones.size();
} | [
"public",
"int",
"getTamanoReservaciones",
"(",
")",
"{",
"return",
"RegistroReservaciones",
".",
"size",
"(",
")",
";",
"}"
] | [
233,
4
] | [
236,
5
] | null | java | es | ['es', 'es', 'es'] | False | true | method_declaration |
|
Registro. | null | Método VacioHabitaciones | Método VacioHabitaciones | public boolean VacioHabitaciones()
{
if(RegistroHabitaciones.size() <= 0)
{
return true;
}
return false;
} | [
"public",
"boolean",
"VacioHabitaciones",
"(",
")",
"{",
"if",
"(",
"RegistroHabitaciones",
".",
"size",
"(",
")",
"<=",
"0",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | [
188,
4
] | [
195,
5
] | null | java | es | ['es', 'es', 'es'] | False | true | method_declaration |
|
CrudProducto. | null | /*Busca un producto completo y devuelve el índice donde se encuentra
Utiliza compareTo para ver si dos productos son iguales, se estudiará más adelante | /*Busca un producto completo y devuelve el índice donde se encuentra
Utiliza compareTo para ver si dos productos son iguales, se estudiará más adelante | public int findProduct(Producto p) {
int i = 0;
boolean encontrado = false;
while (i < lista.length && !encontrado) {
Producto deLista = lista[i];
if (p.compareTo(deLista) == 0)
encontrado = true;
else
i++;
}
if (encontrado)
return i;
else
return -1;
} | [
"public",
"int",
"findProduct",
"(",
"Producto",
"p",
")",
"{",
"int",
"i",
"=",
"0",
";",
"boolean",
"encontrado",
"=",
"false",
";",
"while",
"(",
"i",
"<",
"lista",
".",
"length",
"&&",
"!",
"encontrado",
")",
"{",
"Producto",
"deLista",
"=",
"lista",
"[",
"i",
"]",
";",
"if",
"(",
"p",
".",
"compareTo",
"(",
"deLista",
")",
"==",
"0",
")",
"encontrado",
"=",
"true",
";",
"else",
"i",
"++",
";",
"}",
"if",
"(",
"encontrado",
")",
"return",
"i",
";",
"else",
"return",
"-",
"1",
";",
"}"
] | [
116,
1
] | [
132,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
NGSIToCarto. | null | Dentro de la configuracion se debera poder decir si quieres activar estas tres posibilidades de succes, etc | Dentro de la configuracion se debera poder decir si quieres activar estas tres posibilidades de succes, etc | @Override
public Set<Relationship> getRelationships() {
final Set<Relationship> rels = new HashSet<>();
rels.add(REL_SUCCESS);
rels.add(REL_RETRY);
rels.add(REL_FAILURE);
return rels;
} | [
"@",
"Override",
"public",
"Set",
"<",
"Relationship",
">",
"getRelationships",
"(",
")",
"{",
"final",
"Set",
"<",
"Relationship",
">",
"rels",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"rels",
".",
"add",
"(",
"REL_SUCCESS",
")",
";",
"rels",
".",
"add",
"(",
"REL_RETRY",
")",
";",
"rels",
".",
"add",
"(",
"REL_FAILURE",
")",
";",
"return",
"rels",
";",
"}"
] | [
205,
4
] | [
212,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Password. | null | Metodo para verificar si la contraseña es Fuerte | Metodo para verificar si la contraseña es Fuerte | public boolean esFuerte() {
int numeros = 0;
int mayusculas = 0;
int minusculas = 0;
for (int i = 0; i < this.contrasegna.length(); i++) {
if (contrasegna.charAt(i) >= 97 && this.contrasegna.charAt(i) <= 122) { //Metodo para las minusculas
minusculas++;
} else if (contrasegna.charAt(i) >= 48 && this.contrasegna.charAt(i) <= 57) { //Condicion para verificar si existe dentro de la cadena Numeros
numeros++;
} else if (contrasegna.charAt(i) >= 65 && this.contrasegna.charAt(i) <= 90) { //Condicion para verificar si existen Letras mayuculas
mayusculas++;
}
}
return (mayusculas >= 2 && minusculas >= 1 && numeros >= 5);
} | [
"public",
"boolean",
"esFuerte",
"(",
")",
"{",
"int",
"numeros",
"=",
"0",
";",
"int",
"mayusculas",
"=",
"0",
";",
"int",
"minusculas",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"this",
".",
"contrasegna",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"contrasegna",
".",
"charAt",
"(",
"i",
")",
">=",
"97",
"&&",
"this",
".",
"contrasegna",
".",
"charAt",
"(",
"i",
")",
"<=",
"122",
")",
"{",
"//Metodo para las minusculas",
"minusculas",
"++",
";",
"}",
"else",
"if",
"(",
"contrasegna",
".",
"charAt",
"(",
"i",
")",
">=",
"48",
"&&",
"this",
".",
"contrasegna",
".",
"charAt",
"(",
"i",
")",
"<=",
"57",
")",
"{",
"//Condicion para verificar si existe dentro de la cadena Numeros",
"numeros",
"++",
";",
"}",
"else",
"if",
"(",
"contrasegna",
".",
"charAt",
"(",
"i",
")",
">=",
"65",
"&&",
"this",
".",
"contrasegna",
".",
"charAt",
"(",
"i",
")",
"<=",
"90",
")",
"{",
"//Condicion para verificar si existen Letras mayuculas",
"mayusculas",
"++",
";",
"}",
"}",
"return",
"(",
"mayusculas",
">=",
"2",
"&&",
"minusculas",
">=",
"1",
"&&",
"numeros",
">=",
"5",
")",
";",
"}"
] | [
47,
4
] | [
61,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
DeviceTest. | null | CP3: Cuando creamos un dispositivo con determinado consumo, el consumo debe ser establecido en forma correcta. | CP3: Cuando creamos un dispositivo con determinado consumo, el consumo debe ser establecido en forma correcta. | @Test
public void Given_A_Device_Created_With_A_Consumption_When_GetConsumption_Method_Is_Called_Then_Return_Consumption() {
//Given
Integer expectedConsumption = this.consumption;
//When
Integer result =device.getConsumption();
//Then
assertEquals(expectedConsumption,result);
} | [
"@",
"Test",
"public",
"void",
"Given_A_Device_Created_With_A_Consumption_When_GetConsumption_Method_Is_Called_Then_Return_Consumption",
"(",
")",
"{",
"//Given",
"Integer",
"expectedConsumption",
"=",
"this",
".",
"consumption",
";",
"//When",
"Integer",
"result",
"=",
"device",
".",
"getConsumption",
"(",
")",
";",
"//Then",
"assertEquals",
"(",
"expectedConsumption",
",",
"result",
")",
";",
"}"
] | [
40,
4
] | [
50,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
EmpresaTest. | null | Probando el máximo computable de antigüedad... | Probando el máximo computable de antigüedad... | @Test
public void laEmpresaDebePoderObtenerElSueldoDeUnPlantaPermanenteTiempoCompletoConParejaSinHijesConAntiguedad37() {
Empresa miEmpresa1 = new Empresa();
EmpleadeAbstracte miEmpleadePlantaTemporariaJornadaCompletaConParejaSinHijesConAntiguedad20 = new EmpleadePorMes(
"Juan De Los Palotes", Planta.PERMANENTE, CON_PAREJA, SIN_HIJES, ANTIGUEDAD_20);
miEmpresa1.contratar(miEmpleadePlantaTemporariaJornadaCompletaConParejaSinHijesConAntiguedad20);
Empresa miEmpresa2 = new Empresa();
EmpleadeAbstracte miEmpleadePlantaTemporariaJornadaCompletaConParejaSinHijesConAntiguedad37 = new EmpleadePorMes(
"Juan De Los Palotes", Planta.PERMANENTE, CON_PAREJA, SIN_HIJES, ANTIGUEDAD_37);
miEmpresa2.contratar(miEmpleadePlantaTemporariaJornadaCompletaConParejaSinHijesConAntiguedad37);
// El Cálculo para Empleade Planta Permanente Jornada Completa:
// Sueldo Básico + Salario Familiar + Antigüedad
// Sueldo Básico = 1000.0
// Salario Familar = 200.0 * hije + 100.0 si tiene pareja registrada
// Antigüedad: 100 * Año, max: 2000.
// Si A > 20, el resultado debería ser igual a si A == 20.
assertEquals(miEmpresa1.obtTotalDeSueldos(), miEmpresa2.obtTotalDeSueldos());
} | [
"@",
"Test",
"public",
"void",
"laEmpresaDebePoderObtenerElSueldoDeUnPlantaPermanenteTiempoCompletoConParejaSinHijesConAntiguedad37",
"(",
")",
"{",
"Empresa",
"miEmpresa1",
"=",
"new",
"Empresa",
"(",
")",
";",
"EmpleadeAbstracte",
"miEmpleadePlantaTemporariaJornadaCompletaConParejaSinHijesConAntiguedad20",
"=",
"new",
"EmpleadePorMes",
"(",
"\"Juan De Los Palotes\"",
",",
"Planta",
".",
"PERMANENTE",
",",
"CON_PAREJA",
",",
"SIN_HIJES",
",",
"ANTIGUEDAD_20",
")",
";",
"miEmpresa1",
".",
"contratar",
"(",
"miEmpleadePlantaTemporariaJornadaCompletaConParejaSinHijesConAntiguedad20",
")",
";",
"Empresa",
"miEmpresa2",
"=",
"new",
"Empresa",
"(",
")",
";",
"EmpleadeAbstracte",
"miEmpleadePlantaTemporariaJornadaCompletaConParejaSinHijesConAntiguedad37",
"=",
"new",
"EmpleadePorMes",
"(",
"\"Juan De Los Palotes\"",
",",
"Planta",
".",
"PERMANENTE",
",",
"CON_PAREJA",
",",
"SIN_HIJES",
",",
"ANTIGUEDAD_37",
")",
";",
"miEmpresa2",
".",
"contratar",
"(",
"miEmpleadePlantaTemporariaJornadaCompletaConParejaSinHijesConAntiguedad37",
")",
";",
"// El Cálculo para Empleade Planta Permanente Jornada Completa:",
"// Sueldo Básico + Salario Familiar + Antigüedad",
"// Sueldo Básico = 1000.0",
"// Salario Familar = 200.0 * hije + 100.0 si tiene pareja registrada",
"// Antigüedad: 100 * Año, max: 2000.",
"// Si A > 20, el resultado debería ser igual a si A == 20.",
"assertEquals",
"(",
"miEmpresa1",
".",
"obtTotalDeSueldos",
"(",
")",
",",
"miEmpresa2",
".",
"obtTotalDeSueldos",
"(",
")",
")",
";",
"}"
] | [
401,
1
] | [
423,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
EmpresaTest. | null | Comenzamos con la validación de datos... | Comenzamos con la validación de datos... | @Test
public void categoriaDeEmpleadeSoloPuedeSerSinCantegoria() {
EmpleadeAbstracte empleadeValideSinCategoria = new EmpleadePorMes("Juan De Los Palotes", Planta.PERMANENTE,
SIN_PAREJA, DOS_HIJES, SIN_ANTIGUEDAD);
assertEquals(Categoria.SIN_CATEGORIA, empleadeValideSinCategoria.obtCategoria());
} | [
"@",
"Test",
"public",
"void",
"categoriaDeEmpleadeSoloPuedeSerSinCantegoria",
"(",
")",
"{",
"EmpleadeAbstracte",
"empleadeValideSinCategoria",
"=",
"new",
"EmpleadePorMes",
"(",
"\"Juan De Los Palotes\"",
",",
"Planta",
".",
"PERMANENTE",
",",
"SIN_PAREJA",
",",
"DOS_HIJES",
",",
"SIN_ANTIGUEDAD",
")",
";",
"assertEquals",
"(",
"Categoria",
".",
"SIN_CATEGORIA",
",",
"empleadeValideSinCategoria",
".",
"obtCategoria",
"(",
")",
")",
";",
"}"
] | [
146,
1
] | [
153,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
GXJarClassLoader. | null | Indica si este classLoader tiene clases 'viejas'
@return true si el classLoader tiene clases viejas
| Indica si este classLoader tiene clases 'viejas'
@return true si el classLoader tiene clases viejas | public boolean wasModified()
{
if (sourceIsJAR)
{
return (new File(source).lastModified()) != jarTimeStamp;
}
else
{
// Si el source es un directorio, tengo que chequear todos las clases cargadas
for(Enumeration enum1 = classTimeStamps.keys(); enum1.hasMoreElements();)
{
String className = (String) enum1.nextElement();
if (new File(source + File.separator + className).lastModified() != classTimeStamps.get(className).longValue())
return true;
}
return false;
}
} | [
"public",
"boolean",
"wasModified",
"(",
")",
"{",
"if",
"(",
"sourceIsJAR",
")",
"{",
"return",
"(",
"new",
"File",
"(",
"source",
")",
".",
"lastModified",
"(",
")",
")",
"!=",
"jarTimeStamp",
";",
"}",
"else",
"{",
"// Si el source es un directorio, tengo que chequear todos las clases cargadas\r",
"for",
"(",
"Enumeration",
"enum1",
"=",
"classTimeStamps",
".",
"keys",
"(",
")",
";",
"enum1",
".",
"hasMoreElements",
"(",
")",
";",
")",
"{",
"String",
"className",
"=",
"(",
"String",
")",
"enum1",
".",
"nextElement",
"(",
")",
";",
"if",
"(",
"new",
"File",
"(",
"source",
"+",
"File",
".",
"separator",
"+",
"className",
")",
".",
"lastModified",
"(",
")",
"!=",
"classTimeStamps",
".",
"get",
"(",
"className",
")",
".",
"longValue",
"(",
")",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}",
"}"
] | [
206,
4
] | [
223,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
TemporaryFiles. | null | Obtiene la instancia de TemporaryFiles
| Obtiene la instancia de TemporaryFiles
| public static TemporaryFiles getInstance()
{
return temporaryFiles;
} | [
"public",
"static",
"TemporaryFiles",
"getInstance",
"(",
")",
"{",
"return",
"temporaryFiles",
";",
"}"
] | [
17,
4
] | [
20,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CropImageView. | null | Asignacion de un CropListener para escuchar la actividad de la pantalla | Asignacion de un CropListener para escuchar la actividad de la pantalla | public void crop(CropListener listener, boolean needStretch) {
if (listener == null)
return;
mCropOverlayView.crop(listener, needStretch);
} | [
"public",
"void",
"crop",
"(",
"CropListener",
"listener",
",",
"boolean",
"needStretch",
")",
"{",
"if",
"(",
"listener",
"==",
"null",
")",
"return",
";",
"mCropOverlayView",
".",
"crop",
"(",
"listener",
",",
"needStretch",
")",
";",
"}"
] | [
51,
4
] | [
55,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
AmigosUsuController. | null | Peticiones de amistad recibidas por el usuario | Peticiones de amistad recibidas por el usuario | @CrossOrigin(origins = "http://localhost:4200")
@GetMapping("/getPeticionesRecibidasUsuario/{idUsu}")
public ResponseEntity<List<AmigosUsu>> getPeticionesRecibidasUsuario(@PathVariable int idUsu){
ArrayList<AmigosUsu> listaAmigosUsu = new ArrayList<AmigosUsu>();
listaAmigosUsu = (ArrayList<AmigosUsu>) service.findPeticionesRecibidasUsuario(idUsu);
listaAmigosUsu = quitarListasUsu(listaAmigosUsu);
return new ResponseEntity<List<AmigosUsu>>(listaAmigosUsu, HttpStatus.OK);
} | [
"@",
"CrossOrigin",
"(",
"origins",
"=",
"\"http://localhost:4200\"",
")",
"@",
"GetMapping",
"(",
"\"/getPeticionesRecibidasUsuario/{idUsu}\"",
")",
"public",
"ResponseEntity",
"<",
"List",
"<",
"AmigosUsu",
">",
">",
"getPeticionesRecibidasUsuario",
"(",
"@",
"PathVariable",
"int",
"idUsu",
")",
"{",
"ArrayList",
"<",
"AmigosUsu",
">",
"listaAmigosUsu",
"=",
"new",
"ArrayList",
"<",
"AmigosUsu",
">",
"(",
")",
";",
"listaAmigosUsu",
"=",
"(",
"ArrayList",
"<",
"AmigosUsu",
">",
")",
"service",
".",
"findPeticionesRecibidasUsuario",
"(",
"idUsu",
")",
";",
"listaAmigosUsu",
"=",
"quitarListasUsu",
"(",
"listaAmigosUsu",
")",
";",
"return",
"new",
"ResponseEntity",
"<",
"List",
"<",
"AmigosUsu",
">",
">",
"(",
"listaAmigosUsu",
",",
"HttpStatus",
".",
"OK",
")",
";",
"}"
] | [
166,
1
] | [
176,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
LLFunciones. | null | Creamos el siguiente metodo | Creamos el siguiente metodo | private void Lavado(){
//Observemos que primero encesitamos saber si la lavadora se lleno para poder seguir este paso , ya que si se lleno comenzara a lavar en otro caso no
if(llenadoCompleto == 1){
//Agreamos otro condicional para saber de que color es la ropa
if(TipoDeRopa == 1){
System.out.println("Ropa blanca / Lavado Suave");
System.out.println("Lavando...");
LavadoCompleto = 1;
}
}else if(TipoDeRopa == 2){
System.out.println("Ropa de color / lavado intensto");
System.out.println("Lavando...");
LavadoCompleto = 1;
}else{
System.out.println("El tipo de ropa no esta disponible.");
System.out.println("Se lavara como ropa de color.");
LavadoCompleto = 1;
}
} | [
"private",
"void",
"Lavado",
"(",
")",
"{",
"//Observemos que primero encesitamos saber si la lavadora se lleno para poder seguir este paso , ya que si se lleno comenzara a lavar en otro caso no\r",
"if",
"(",
"llenadoCompleto",
"==",
"1",
")",
"{",
"//Agreamos otro condicional para saber de que color es la ropa\r",
"if",
"(",
"TipoDeRopa",
"==",
"1",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Ropa blanca / Lavado Suave\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Lavando...\"",
")",
";",
"LavadoCompleto",
"=",
"1",
";",
"}",
"}",
"else",
"if",
"(",
"TipoDeRopa",
"==",
"2",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Ropa de color / lavado intensto\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Lavando...\"",
")",
";",
"LavadoCompleto",
"=",
"1",
";",
"}",
"else",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"El tipo de ropa no esta disponible.\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Se lavara como ropa de color.\"",
")",
";",
"LavadoCompleto",
"=",
"1",
";",
"}",
"}"
] | [
31,
4
] | [
49,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Pantalla. | null | lo extiende. Pero si no quiere usarlo, no tiene que extenderlo. | lo extiende. Pero si no quiere usarlo, no tiene que extenderlo. | @Override
public void render(float delta) {
// TODO Auto-generated method stub
} | [
"@",
"Override",
"public",
"void",
"render",
"(",
"float",
"delta",
")",
"{",
"// TODO Auto-generated method stub",
"}"
] | [
61,
1
] | [
65,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CrudLimpieza. | null | Modificar todos los productos con el mismo nombre de forma clásica | Modificar todos los productos con el mismo nombre de forma clásica | public void modificarTodosLosProductos (String nombre,String nuevoNombre) {
List <ProductosLimpieza> temp = buscarProductos(nombre);
for (int i = 0; i < temp.size(); i++) {
temp.get(i).setNombre(nuevoNombre);
}
} | [
"public",
"void",
"modificarTodosLosProductos",
"(",
"String",
"nombre",
",",
"String",
"nuevoNombre",
")",
"{",
"List",
"<",
"ProductosLimpieza",
">",
"temp",
"=",
"buscarProductos",
"(",
"nombre",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"temp",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"temp",
".",
"get",
"(",
"i",
")",
".",
"setNombre",
"(",
"nuevoNombre",
")",
";",
"}",
"}"
] | [
129,
1
] | [
135,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Estudiante. | null | Métodos -> No hemos colocado lógica, pero está posibilidad | Métodos -> No hemos colocado lógica, pero está posibilidad | public void mostrarInfoEstudiante(){
System.out.println("&&&&&& Info Estudiante &&&");
System.out.println("Código -> "+this.codigo);
System.out.println("Nombres -> "+this.nombres);
System.out.println("Apellidos -> "+this.apellidos);
} | [
"public",
"void",
"mostrarInfoEstudiante",
"(",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"&&&&&& Info Estudiante &&&\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Código -> \"+",
"t",
"his.",
"c",
"odigo)",
";",
"",
"System",
".",
"out",
".",
"println",
"(",
"\"Nombres -> \"",
"+",
"this",
".",
"nombres",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Apellidos -> \"",
"+",
"this",
".",
"apellidos",
")",
";",
"}"
] | [
23,
4
] | [
28,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
JsonReader. | null | Extrae los autores en una lista de String | Extrae los autores en una lista de String | public List<String> extraeAutores(JSONArray listaAutores){
List<String> autores = new ArrayList<String>();
Iterator<JSONObject> iterator = listaAutores.iterator();
while (iterator.hasNext()) {
String nombre = new String();
JSONObject it = iterator.next();
String primero = (String) it.get("first");
String medio = new String();
String ultimo = (String) it.get("last");
JSONArray mid = (JSONArray) it.get("middle");
Iterator<JSONObject> it_mid = mid.iterator();
while(it_mid.hasNext())
medio += it_mid.next();
if(!primero.equals("")){
if(!medio.equals("") || !ultimo.equals(""))
nombre += primero + " ";
else
nombre += primero;
}
if(!medio.equals("")){
if(!ultimo.equals(""))
nombre += medio + " ";
else
nombre += medio;
}
if(!ultimo.equals(""))
nombre += ultimo;
autores.add(nombre);
}
return autores;
} | [
"public",
"List",
"<",
"String",
">",
"extraeAutores",
"(",
"JSONArray",
"listaAutores",
")",
"{",
"List",
"<",
"String",
">",
"autores",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"Iterator",
"<",
"JSONObject",
">",
"iterator",
"=",
"listaAutores",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"String",
"nombre",
"=",
"new",
"String",
"(",
")",
";",
"JSONObject",
"it",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"String",
"primero",
"=",
"(",
"String",
")",
"it",
".",
"get",
"(",
"\"first\"",
")",
";",
"String",
"medio",
"=",
"new",
"String",
"(",
")",
";",
"String",
"ultimo",
"=",
"(",
"String",
")",
"it",
".",
"get",
"(",
"\"last\"",
")",
";",
"JSONArray",
"mid",
"=",
"(",
"JSONArray",
")",
"it",
".",
"get",
"(",
"\"middle\"",
")",
";",
"Iterator",
"<",
"JSONObject",
">",
"it_mid",
"=",
"mid",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it_mid",
".",
"hasNext",
"(",
")",
")",
"medio",
"+=",
"it_mid",
".",
"next",
"(",
")",
";",
"if",
"(",
"!",
"primero",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"if",
"(",
"!",
"medio",
".",
"equals",
"(",
"\"\"",
")",
"||",
"!",
"ultimo",
".",
"equals",
"(",
"\"\"",
")",
")",
"nombre",
"+=",
"primero",
"+",
"\" \"",
";",
"else",
"nombre",
"+=",
"primero",
";",
"}",
"if",
"(",
"!",
"medio",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"if",
"(",
"!",
"ultimo",
".",
"equals",
"(",
"\"\"",
")",
")",
"nombre",
"+=",
"medio",
"+",
"\" \"",
";",
"else",
"nombre",
"+=",
"medio",
";",
"}",
"if",
"(",
"!",
"ultimo",
".",
"equals",
"(",
"\"\"",
")",
")",
"nombre",
"+=",
"ultimo",
";",
"autores",
".",
"add",
"(",
"nombre",
")",
";",
"}",
"return",
"autores",
";",
"}"
] | [
124,
2
] | [
154,
3
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
UsuarioService. | null | Vacia los otros objetos del usuario para enviarlo por json | Vacia los otros objetos del usuario para enviarlo por json | private Usuario vaciarObjetosUsu(Usuario usu) {
Set<Comentario> setComment = new HashSet<Comentario>();
usu.setComentarios(setComment);
Set<Publicacion> setPubl = new HashSet<Publicacion>();
usu.setPublicaciones(setPubl);
Set<Fotos> setFotos = new HashSet<Fotos>();
usu.setFotos(setFotos);
Set<Videos> setVideos = new HashSet<Videos>();
usu.setVideos(setVideos);
Set<Entradas> setEntradas = new HashSet<Entradas>();
usu.setEntradas(setEntradas);
Set<AmigosUsu> setAmUsu = new HashSet<AmigosUsu>();
usu.setAmigosUsuRecibidos(setAmUsu);
usu.setAmigosUsuSolicitudes(setAmUsu);
return usu;
} | [
"private",
"Usuario",
"vaciarObjetosUsu",
"(",
"Usuario",
"usu",
")",
"{",
"Set",
"<",
"Comentario",
">",
"setComment",
"=",
"new",
"HashSet",
"<",
"Comentario",
">",
"(",
")",
";",
"usu",
".",
"setComentarios",
"(",
"setComment",
")",
";",
"Set",
"<",
"Publicacion",
">",
"setPubl",
"=",
"new",
"HashSet",
"<",
"Publicacion",
">",
"(",
")",
";",
"usu",
".",
"setPublicaciones",
"(",
"setPubl",
")",
";",
"Set",
"<",
"Fotos",
">",
"setFotos",
"=",
"new",
"HashSet",
"<",
"Fotos",
">",
"(",
")",
";",
"usu",
".",
"setFotos",
"(",
"setFotos",
")",
";",
"Set",
"<",
"Videos",
">",
"setVideos",
"=",
"new",
"HashSet",
"<",
"Videos",
">",
"(",
")",
";",
"usu",
".",
"setVideos",
"(",
"setVideos",
")",
";",
"Set",
"<",
"Entradas",
">",
"setEntradas",
"=",
"new",
"HashSet",
"<",
"Entradas",
">",
"(",
")",
";",
"usu",
".",
"setEntradas",
"(",
"setEntradas",
")",
";",
"Set",
"<",
"AmigosUsu",
">",
"setAmUsu",
"=",
"new",
"HashSet",
"<",
"AmigosUsu",
">",
"(",
")",
";",
"usu",
".",
"setAmigosUsuRecibidos",
"(",
"setAmUsu",
")",
";",
"usu",
".",
"setAmigosUsuSolicitudes",
"(",
"setAmUsu",
")",
";",
"return",
"usu",
";",
"}"
] | [
186,
2
] | [
209,
3
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ControladoraInformacion. | null | METODO PARA CALULCAR VELOCIDAD FINAL DE AMBOS CUERPOS | METODO PARA CALULCAR VELOCIDAD FINAL DE AMBOS CUERPOS | @FXML
public void calcularvf(ActionEvent event) {
try {
double vf1 = Double.parseDouble(vfvfca.getText());
double vf2 = Double.parseDouble(vfvfcb.getText());
double m1 = Double.parseDouble(vfmca.getText());
double m2 = Double.parseDouble(vfmcb.getText());
// *********************************************
double resultado1 = persona.vic1(m1, m2, vf1, vf2);
double resultado2 = persona.vic2(m1, m2, vf1, vf2, resultado1);
// *********************************************
String resultado1Real = String.valueOf(resultado1);
String resultado2Real = String.valueOf(resultado2);
// *********************************************
vfvica.setText(resultado1Real);
vfvicb.setText(resultado2Real);
// *********************************************
persona.agregarCalculo(resultado1, vf1, m1, resultado2, vf2, m2);
} catch(NumberFormatException e1) {
Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle("Informacion importante");
alert.setHeaderText(null);
alert.setContentText("Datos invalidos, por favor revise las siguientes opciones: \n" +
"\n 1. La informacion no debe de tener ninguna letra." +
"\n 2. Si utiliza decimales, por favor separelos con un punto." +
"\n 3. Ningun campo puede estar vacio");
alert.showAndWait();
} catch(NullPointerException e2) {
Alert alert = new Alert(AlertType.INFORMATION);
alert.setTitle("Informacion importante");
alert.setHeaderText(null);
alert.setContentText("Por favor llene todos los datos requeridos");
alert.showAndWait();
}
} | [
"@",
"FXML",
"public",
"void",
"calcularvf",
"(",
"ActionEvent",
"event",
")",
"{",
"try",
"{",
"double",
"vf1",
"=",
"Double",
".",
"parseDouble",
"(",
"vfvfca",
".",
"getText",
"(",
")",
")",
";",
"double",
"vf2",
"=",
"Double",
".",
"parseDouble",
"(",
"vfvfcb",
".",
"getText",
"(",
")",
")",
";",
"double",
"m1",
"=",
"Double",
".",
"parseDouble",
"(",
"vfmca",
".",
"getText",
"(",
")",
")",
";",
"double",
"m2",
"=",
"Double",
".",
"parseDouble",
"(",
"vfmcb",
".",
"getText",
"(",
")",
")",
";",
"// *********************************************",
"double",
"resultado1",
"=",
"persona",
".",
"vic1",
"(",
"m1",
",",
"m2",
",",
"vf1",
",",
"vf2",
")",
";",
"double",
"resultado2",
"=",
"persona",
".",
"vic2",
"(",
"m1",
",",
"m2",
",",
"vf1",
",",
"vf2",
",",
"resultado1",
")",
";",
"// *********************************************",
"String",
"resultado1Real",
"=",
"String",
".",
"valueOf",
"(",
"resultado1",
")",
";",
"String",
"resultado2Real",
"=",
"String",
".",
"valueOf",
"(",
"resultado2",
")",
";",
"// *********************************************",
"vfvica",
".",
"setText",
"(",
"resultado1Real",
")",
";",
"vfvicb",
".",
"setText",
"(",
"resultado2Real",
")",
";",
"// *********************************************",
"persona",
".",
"agregarCalculo",
"(",
"resultado1",
",",
"vf1",
",",
"m1",
",",
"resultado2",
",",
"vf2",
",",
"m2",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e1",
")",
"{",
"Alert",
"alert",
"=",
"new",
"Alert",
"(",
"AlertType",
".",
"INFORMATION",
")",
";",
"alert",
".",
"setTitle",
"(",
"\"Informacion importante\"",
")",
";",
"alert",
".",
"setHeaderText",
"(",
"null",
")",
";",
"alert",
".",
"setContentText",
"(",
"\"Datos invalidos, por favor revise las siguientes opciones: \\n\"",
"+",
"\"\\n 1. La informacion no debe de tener ninguna letra.\"",
"+",
"\"\\n 2. Si utiliza decimales, por favor separelos con un punto.\"",
"+",
"\"\\n 3. Ningun campo puede estar vacio\"",
")",
";",
"alert",
".",
"showAndWait",
"(",
")",
";",
"}",
"catch",
"(",
"NullPointerException",
"e2",
")",
"{",
"Alert",
"alert",
"=",
"new",
"Alert",
"(",
"AlertType",
".",
"INFORMATION",
")",
";",
"alert",
".",
"setTitle",
"(",
"\"Informacion importante\"",
")",
";",
"alert",
".",
"setHeaderText",
"(",
"null",
")",
";",
"alert",
".",
"setContentText",
"(",
"\"Por favor llene todos los datos requeridos\"",
")",
";",
"alert",
".",
"showAndWait",
"(",
")",
";",
"}",
"}"
] | [
116,
1
] | [
175,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
GXSimpleCollection. | null | agregado para tener visibilidad del constructor usado por el generador | agregado para tener visibilidad del constructor usado por el generador | public String getelementsName( )
{
return elementsName ;
} | [
"public",
"String",
"getelementsName",
"(",
")",
"{",
"return",
"elementsName",
";",
"}"
] | [
733,
1
] | [
736,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
EntradaCocheTeclado. | null | keyDown = al empezar a pulsar una tecla | keyDown = al empezar a pulsar una tecla | @Override
public boolean keyDown(int keycode) {
switch (keycode) {
case Input.Keys.LEFT:
case Input.Keys.A:
if (!controlador.moverDerecha)
controlador.moverIzquierda = true;
return true;
case Input.Keys.RIGHT:
case Input.Keys.D:
if (!controlador.moverIzquierda)
controlador.moverDerecha = true;
return true;
default:
return false;
}
} | [
"@",
"Override",
"public",
"boolean",
"keyDown",
"(",
"int",
"keycode",
")",
"{",
"switch",
"(",
"keycode",
")",
"{",
"case",
"Input",
".",
"Keys",
".",
"LEFT",
":",
"case",
"Input",
".",
"Keys",
".",
"A",
":",
"if",
"(",
"!",
"controlador",
".",
"moverDerecha",
")",
"controlador",
".",
"moverIzquierda",
"=",
"true",
";",
"return",
"true",
";",
"case",
"Input",
".",
"Keys",
".",
"RIGHT",
":",
"case",
"Input",
".",
"Keys",
".",
"D",
":",
"if",
"(",
"!",
"controlador",
".",
"moverIzquierda",
")",
"controlador",
".",
"moverDerecha",
"=",
"true",
";",
"return",
"true",
";",
"default",
":",
"return",
"false",
";",
"}",
"}"
] | [
20,
1
] | [
36,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
AmigosUsuService. | null | /*buscar peticiones de amistad del usuario en general (sin identificar enviadas recibidas) | /*buscar peticiones de amistad del usuario en general (sin identificar enviadas recibidas) | public List<AmigosUsu> findPeticionesEnGeneralUsuario(Integer idUsuSolicitud, Integer idUsuRecep) {
ArrayList<AmigosUsu> listaPeticionesGen = new ArrayList<AmigosUsu>();
listaPeticionesGen = (ArrayList<AmigosUsu>) repository.findPeticionesEnGeneralUsuario(idUsuSolicitud, idUsuRecep);
return listaPeticionesGen;
} | [
"public",
"List",
"<",
"AmigosUsu",
">",
"findPeticionesEnGeneralUsuario",
"(",
"Integer",
"idUsuSolicitud",
",",
"Integer",
"idUsuRecep",
")",
"{",
"ArrayList",
"<",
"AmigosUsu",
">",
"listaPeticionesGen",
"=",
"new",
"ArrayList",
"<",
"AmigosUsu",
">",
"(",
")",
";",
"listaPeticionesGen",
"=",
"(",
"ArrayList",
"<",
"AmigosUsu",
">",
")",
"repository",
".",
"findPeticionesEnGeneralUsuario",
"(",
"idUsuSolicitud",
",",
"idUsuRecep",
")",
";",
"return",
"listaPeticionesGen",
";",
"}"
] | [
80,
1
] | [
85,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
JsonReader. | null | Extrae el texto como un único String | Extrae el texto como un único String | public String extraeText(JSONArray txt){
String listaTexto = new String();
Iterator<JSONObject> iterator = txt.iterator();
while (iterator.hasNext()) {
JSONObject it = iterator.next();
String texto = (String) it.get("text");
listaTexto += texto + " ";
}
return listaTexto;
} | [
"public",
"String",
"extraeText",
"(",
"JSONArray",
"txt",
")",
"{",
"String",
"listaTexto",
"=",
"new",
"String",
"(",
")",
";",
"Iterator",
"<",
"JSONObject",
">",
"iterator",
"=",
"txt",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"JSONObject",
"it",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"String",
"texto",
"=",
"(",
"String",
")",
"it",
".",
"get",
"(",
"\"text\"",
")",
";",
"listaTexto",
"+=",
"texto",
"+",
"\" \"",
";",
"}",
"return",
"listaTexto",
";",
"}"
] | [
210,
2
] | [
219,
3
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CropOverlayView. | null | Metodo para resetear los puntos de referencia para realizar el recorte de la
imagen
| Metodo para resetear los puntos de referencia para realizar el recorte de la
imagen
| private void resetPoints() {
// 1. calcular el tamaño del mapa de bits (la fotografia) en un nuevo canva
float scaleX = bitmap.getWidth() * 1.0f / getWidth();
float scaleY = bitmap.getHeight() * 1.0f / getHeight();
float maxScale = Math.max(scaleX, scaleY);
// 2. determinar si la fotografia es muy larga o ancha
int minX = 0;
int maxX = getWidth();
int minY = 0;
int maxY = getHeight();
if (maxScale == scaleY) { // fotografia muy alta
int bitmapInCanvasWidth = (int) (bitmap.getWidth() / maxScale);
minX = (getWidth() - bitmapInCanvasWidth) / 2;
maxX = getWidth() - minX;
} else { // fotografia muy ancha
int bitmapInCanvasHeight = (int) (bitmap.getHeight() / maxScale);
minY = (getHeight() - bitmapInCanvasHeight)/2;
maxY = getHeight() - minY;
}
this.minX = minX;
this.minY = minY;
this.maxX = maxX;
this.maxY = maxY;
if (maxX - minX < defaultMargin || maxY - minY < defaultMargin)
defaultMargin = 0; // remover el minimo
else
defaultMargin = 30;
/**Dibujar los 4 nuevos puntos segun el calculo
* agregandole un margen de 100
* */
topLeft = new Point(minX + defaultMargin, minY + defaultMargin);
topRight = new Point(maxX - defaultMargin, minY + defaultMargin);
bottomLeft = new Point(minX + defaultMargin, maxY - defaultMargin);
bottomRight = new Point(maxX - defaultMargin, maxY - defaultMargin);
} | [
"private",
"void",
"resetPoints",
"(",
")",
"{",
"// 1. calcular el tamaño del mapa de bits (la fotografia) en un nuevo canva",
"float",
"scaleX",
"=",
"bitmap",
".",
"getWidth",
"(",
")",
"*",
"1.0f",
"/",
"getWidth",
"(",
")",
";",
"float",
"scaleY",
"=",
"bitmap",
".",
"getHeight",
"(",
")",
"*",
"1.0f",
"/",
"getHeight",
"(",
")",
";",
"float",
"maxScale",
"=",
"Math",
".",
"max",
"(",
"scaleX",
",",
"scaleY",
")",
";",
"// 2. determinar si la fotografia es muy larga o ancha",
"int",
"minX",
"=",
"0",
";",
"int",
"maxX",
"=",
"getWidth",
"(",
")",
";",
"int",
"minY",
"=",
"0",
";",
"int",
"maxY",
"=",
"getHeight",
"(",
")",
";",
"if",
"(",
"maxScale",
"==",
"scaleY",
")",
"{",
"// fotografia muy alta",
"int",
"bitmapInCanvasWidth",
"=",
"(",
"int",
")",
"(",
"bitmap",
".",
"getWidth",
"(",
")",
"/",
"maxScale",
")",
";",
"minX",
"=",
"(",
"getWidth",
"(",
")",
"-",
"bitmapInCanvasWidth",
")",
"/",
"2",
";",
"maxX",
"=",
"getWidth",
"(",
")",
"-",
"minX",
";",
"}",
"else",
"{",
"// fotografia muy ancha",
"int",
"bitmapInCanvasHeight",
"=",
"(",
"int",
")",
"(",
"bitmap",
".",
"getHeight",
"(",
")",
"/",
"maxScale",
")",
";",
"minY",
"=",
"(",
"getHeight",
"(",
")",
"-",
"bitmapInCanvasHeight",
")",
"/",
"2",
";",
"maxY",
"=",
"getHeight",
"(",
")",
"-",
"minY",
";",
"}",
"this",
".",
"minX",
"=",
"minX",
";",
"this",
".",
"minY",
"=",
"minY",
";",
"this",
".",
"maxX",
"=",
"maxX",
";",
"this",
".",
"maxY",
"=",
"maxY",
";",
"if",
"(",
"maxX",
"-",
"minX",
"<",
"defaultMargin",
"||",
"maxY",
"-",
"minY",
"<",
"defaultMargin",
")",
"defaultMargin",
"=",
"0",
";",
"// remover el minimo",
"else",
"defaultMargin",
"=",
"30",
";",
"/**Dibujar los 4 nuevos puntos segun el calculo\n * agregandole un margen de 100\n * */",
"topLeft",
"=",
"new",
"Point",
"(",
"minX",
"+",
"defaultMargin",
",",
"minY",
"+",
"defaultMargin",
")",
";",
"topRight",
"=",
"new",
"Point",
"(",
"maxX",
"-",
"defaultMargin",
",",
"minY",
"+",
"defaultMargin",
")",
";",
"bottomLeft",
"=",
"new",
"Point",
"(",
"minX",
"+",
"defaultMargin",
",",
"maxY",
"-",
"defaultMargin",
")",
";",
"bottomRight",
"=",
"new",
"Point",
"(",
"maxX",
"-",
"defaultMargin",
",",
"maxY",
"-",
"defaultMargin",
")",
";",
"}"
] | [
85,
4
] | [
125,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
GXSmartCacheProvider. | null | Rollback. Elimina todas las tablas pendientes sin registrarlas. | Rollback. Elimina todas las tablas pendientes sin registrarlas. | public void discardUpdates()
{
provider.discardUpdates(handle);
} | [
"public",
"void",
"discardUpdates",
"(",
")",
"{",
"provider",
".",
"discardUpdates",
"(",
"handle",
")",
";",
"}"
] | [
55,
1
] | [
58,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Ejercicio2. | null | Este metodo primero split() la linea por " " para encontrar el nombre y luego vuelve a dividir la linea por el nombre.
@param line The line read by Scanner
@return cleaned line.
| Este metodo primero split() la linea por " " para encontrar el nombre y luego vuelve a dividir la linea por el nombre. | public static String cleanLine(String line) {
String name = line.split(" ")[0];
return name + line.split(name)[1];
} | [
"public",
"static",
"String",
"cleanLine",
"(",
"String",
"line",
")",
"{",
"String",
"name",
"=",
"line",
".",
"split",
"(",
"\" \"",
")",
"[",
"0",
"]",
";",
"return",
"name",
"+",
"line",
".",
"split",
"(",
"name",
")",
"[",
"1",
"]",
";",
"}"
] | [
29,
1
] | [
32,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Rectangulo. | null | Creamos el emtodo que imprimira el resultado | Creamos el emtodo que imprimira el resultado | public void Imprimir(){
Formula();
System.out.print("El resultado es : " + r);
} | [
"public",
"void",
"Imprimir",
"(",
")",
"{",
"Formula",
"(",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"\"El resultado es : \"",
"+",
"r",
")",
";",
"}"
] | [
18,
4
] | [
21,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Asteroide. | null | get ue recibe un entero el cual nos va a retornar los lados del asteroide mediante un if | get ue recibe un entero el cual nos va a retornar los lados del asteroide mediante un if | public float Getlado(int lado)
{
if(lado == 1)
{
return this.lado1;
}
if(lado == 2)
{
return this.lado2;
}
if(lado != 1 && lado !=2)
{
return 0;
}
return 0;
} | [
"public",
"float",
"Getlado",
"(",
"int",
"lado",
")",
"{",
"if",
"(",
"lado",
"==",
"1",
")",
"{",
"return",
"this",
".",
"lado1",
";",
"}",
"if",
"(",
"lado",
"==",
"2",
")",
"{",
"return",
"this",
".",
"lado2",
";",
"}",
"if",
"(",
"lado",
"!=",
"1",
"&&",
"lado",
"!=",
"2",
")",
"{",
"return",
"0",
";",
"}",
"return",
"0",
";",
"}"
] | [
43,
1
] | [
59,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
DatabaseRecordTest. | null | /* Comprobamos los metodos de tipo Long | /* Comprobamos los metodos de tipo Long | @Test
public void Long_AreEquals(){
record1.setLongValue("Long_Column_1", 1234567890);
record2.setLongValue("Long_Column_1", 1234567890);
assertThat(record1.getLongValue("Long_Column_1")).isEqualTo(record2.getLongValue("Long_Column_1"));
} | [
"@",
"Test",
"public",
"void",
"Long_AreEquals",
"(",
")",
"{",
"record1",
".",
"setLongValue",
"(",
"\"Long_Column_1\"",
",",
"1234567890",
")",
";",
"record2",
".",
"setLongValue",
"(",
"\"Long_Column_1\"",
",",
"1234567890",
")",
";",
"assertThat",
"(",
"record1",
".",
"getLongValue",
"(",
"\"Long_Column_1\"",
")",
")",
".",
"isEqualTo",
"(",
"record2",
".",
"getLongValue",
"(",
"\"Long_Column_1\"",
")",
")",
";",
"}"
] | [
85,
2
] | [
91,
3
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Cooldown. | null | Devuelve el cooldown con un intervalo de tipo float | Devuelve el cooldown con un intervalo de tipo float | public static Cooldown withInterval(float interval) {
return new Cooldown(interval);
} | [
"public",
"static",
"Cooldown",
"withInterval",
"(",
"float",
"interval",
")",
"{",
"return",
"new",
"Cooldown",
"(",
"interval",
")",
";",
"}"
] | [
38,
1
] | [
40,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ControladorVistaCuidador_Familiar. | null | Sale el nombre y los apellidos de la persona seleccionada en la tabla | Sale el nombre y los apellidos de la persona seleccionada en la tabla | @FXML
void actualizar(ActionEvent event) {
Paciente paciente = tablaPacienteDoc.getSelectionModel().getSelectedItem();
if (paciente !=null) {
lblNombrePaciente.setText(paciente.getNombre());
lblApellidosPaciente.setText(paciente.getApellidos());
} else {
FuncionesAuxiliares.getAlertaError("Error", "No hay ning�n paciente seleccionado");
}
} | [
"@",
"FXML",
"void",
"actualizar",
"(",
"ActionEvent",
"event",
")",
"{",
"Paciente",
"paciente",
"=",
"tablaPacienteDoc",
".",
"getSelectionModel",
"(",
")",
".",
"getSelectedItem",
"(",
")",
";",
"if",
"(",
"paciente",
"!=",
"null",
")",
"{",
"lblNombrePaciente",
".",
"setText",
"(",
"paciente",
".",
"getNombre",
"(",
")",
")",
";",
"lblApellidosPaciente",
".",
"setText",
"(",
"paciente",
".",
"getApellidos",
"(",
")",
")",
";",
"}",
"else",
"{",
"FuncionesAuxiliares",
".",
"getAlertaError",
"(",
"\"Error\"",
",",
"\"No hay ning�n paciente seleccionado\");",
"",
"",
"}",
"}"
] | [
321,
1
] | [
330,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Registro. | null | Método EliminarReservaciones por objeto | Método EliminarReservaciones por objeto | public boolean EliminarReservaciones(Reservacion ReservacionAEliminar)
{
return RegistroReservaciones.remove(ReservacionAEliminar);
} | [
"public",
"boolean",
"EliminarReservaciones",
"(",
"Reservacion",
"ReservacionAEliminar",
")",
"{",
"return",
"RegistroReservaciones",
".",
"remove",
"(",
"ReservacionAEliminar",
")",
";",
"}"
] | [
165,
4
] | [
168,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CrudLimpieza. | null | Modificar todos los productos con el mismo nombre con Stream | Modificar todos los productos con el mismo nombre con Stream | public void modificarTodosLosProductosStream (String nombre,String nuevoNombre ) {
buscarProductosStream(nombre)
.forEach(x->x.setNombre(nuevoNombre));
} | [
"public",
"void",
"modificarTodosLosProductosStream",
"(",
"String",
"nombre",
",",
"String",
"nuevoNombre",
")",
"{",
"buscarProductosStream",
"(",
"nombre",
")",
".",
"forEach",
"(",
"x",
"->",
"x",
".",
"setNombre",
"(",
"nuevoNombre",
")",
")",
";",
"}"
] | [
138,
1
] | [
142,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
MenuLider. | null | Listar todos los líderes | Listar todos los líderes | public static void mostrarRequerimiento3(){
//Encabezado
System.out.println("Banco_Vinculado Area_Promedio");
System.out.println("--------------- --------------");
try{
ArrayList<BancoRankeadoAreaPromedio> bancos = controlador.requerimiento3();
for (BancoRankeadoAreaPromedio banco : bancos) {
System.out.printf("%s\t%f %n",
banco.getBancoVinculado(),
banco.getAreaPromedio()
);
}
}catch(SQLException e){
System.err.println( "Error recibido al rankear los bancos: " + e.getMessage() );
}
} | [
"public",
"static",
"void",
"mostrarRequerimiento3",
"(",
")",
"{",
"//Encabezado",
"System",
".",
"out",
".",
"println",
"(",
"\"Banco_Vinculado Area_Promedio\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"--------------- --------------\"",
")",
";",
"try",
"{",
"ArrayList",
"<",
"BancoRankeadoAreaPromedio",
">",
"bancos",
"=",
"controlador",
".",
"requerimiento3",
"(",
")",
";",
"for",
"(",
"BancoRankeadoAreaPromedio",
"banco",
":",
"bancos",
")",
"{",
"System",
".",
"out",
".",
"printf",
"(",
"\"%s\\t%f %n\"",
",",
"banco",
".",
"getBancoVinculado",
"(",
")",
",",
"banco",
".",
"getAreaPromedio",
"(",
")",
")",
";",
"}",
"}",
"catch",
"(",
"SQLException",
"e",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"Error recibido al rankear los bancos: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
] | [
15,
4
] | [
37,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Mesa. | null | Comprueba si hay movimientos disponibles por dentro del tablero | Comprueba si hay movimientos disponibles por dentro del tablero | private boolean movimientoPosibleDentro(int x, int y){
boolean disponible = false;
int i= 1;
int j = 0;
while(i < numFilas && disponible != true){
while(j < numColumnas && disponible != true){
if(!montonInterior[i][j].isEmpty() && ! montonInterior[x][y].isEmpty()){
if(montonInterior[x][y].peek().getNum() == 1){
disponible = true;
}else{
if(montonInterior[i][j].peek().getNum() == montonInterior[x][y]
.peek().getNum() + 1 && montonInterior[i][j].peek()
.getPalo() == montonInterior[x][y].peek().getPalo()){
disponible = true;
}
}
}
j++;
}
i++;
}
return disponible;
} | [
"private",
"boolean",
"movimientoPosibleDentro",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"boolean",
"disponible",
"=",
"false",
";",
"int",
"i",
"=",
"1",
";",
"int",
"j",
"=",
"0",
";",
"while",
"(",
"i",
"<",
"numFilas",
"&&",
"disponible",
"!=",
"true",
")",
"{",
"while",
"(",
"j",
"<",
"numColumnas",
"&&",
"disponible",
"!=",
"true",
")",
"{",
"if",
"(",
"!",
"montonInterior",
"[",
"i",
"]",
"[",
"j",
"]",
".",
"isEmpty",
"(",
")",
"&&",
"!",
"montonInterior",
"[",
"x",
"]",
"[",
"y",
"]",
".",
"isEmpty",
"(",
")",
")",
"{",
"if",
"(",
"montonInterior",
"[",
"x",
"]",
"[",
"y",
"]",
".",
"peek",
"(",
")",
".",
"getNum",
"(",
")",
"==",
"1",
")",
"{",
"disponible",
"=",
"true",
";",
"}",
"else",
"{",
"if",
"(",
"montonInterior",
"[",
"i",
"]",
"[",
"j",
"]",
".",
"peek",
"(",
")",
".",
"getNum",
"(",
")",
"==",
"montonInterior",
"[",
"x",
"]",
"[",
"y",
"]",
".",
"peek",
"(",
")",
".",
"getNum",
"(",
")",
"+",
"1",
"&&",
"montonInterior",
"[",
"i",
"]",
"[",
"j",
"]",
".",
"peek",
"(",
")",
".",
"getPalo",
"(",
")",
"==",
"montonInterior",
"[",
"x",
"]",
"[",
"y",
"]",
".",
"peek",
"(",
")",
".",
"getPalo",
"(",
")",
")",
"{",
"disponible",
"=",
"true",
";",
"}",
"}",
"}",
"j",
"++",
";",
"}",
"i",
"++",
";",
"}",
"return",
"disponible",
";",
"}"
] | [
182,
4
] | [
207,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
TroopsWindow. | null | Animaciones | Animaciones | private void btnPlayMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnPlayMouseEntered
setLabelImage(btnPlay, "res/play_focus_button.png");
} | [
"private",
"void",
"btnPlayMouseEntered",
"(",
"java",
".",
"awt",
".",
"event",
".",
"MouseEvent",
"evt",
")",
"{",
"//GEN-FIRST:event_btnPlayMouseEntered",
"setLabelImage",
"(",
"btnPlay",
",",
"\"res/play_focus_button.png\"",
")",
";",
"}"
] | [
285,
4
] | [
287,
5
] | null | java | es | ['es', 'es', 'es'] | False | true | method_declaration |
|
Mesa. | null | la coloca y si no la devuelve a la posición de origen | la coloca y si no la devuelve a la posición de origen | public void jugada(Carta c, int x, int y) throws Exception{
if(y < 4){
if(c.getNum() == 1 && montonExterior[y].isEmpty()){
montonExterior[y].push(c);
}else{
if(!montonExterior[y].isEmpty() && c.getNum() == montonExterior[y].peek().getNum() + 1 &&
c.getPalo() == montonExterior[y].peek().getPalo()){
montonExterior[y].push(c);
}
else{
montonInterior[(x-5)/4][(x-5)%4].push(c);
}
}
}else{
if(montonInterior[(y-5)/4][(y-5)%4].isEmpty()){
montonInterior[(x-5)/4][(x-5)%4].push(c);
throw new Exception("No se puede mover una carta a un monton vacio");
}else{
if (c.getNum() == montonInterior[(y - 5) / 4][(y - 5) % 4].peek().getNum() - 1
&& c.getPalo() == montonInterior[(y - 5) / 4][(y - 5) % 4].peek().getPalo()) {
montonInterior[(y - 5) / 4][(y - 5) % 4].push(c);
} else {
montonInterior[(x - 5) / 4][(x - 5) % 4].push(c);
}
}
}
} | [
"public",
"void",
"jugada",
"(",
"Carta",
"c",
",",
"int",
"x",
",",
"int",
"y",
")",
"throws",
"Exception",
"{",
"if",
"(",
"y",
"<",
"4",
")",
"{",
"if",
"(",
"c",
".",
"getNum",
"(",
")",
"==",
"1",
"&&",
"montonExterior",
"[",
"y",
"]",
".",
"isEmpty",
"(",
")",
")",
"{",
"montonExterior",
"[",
"y",
"]",
".",
"push",
"(",
"c",
")",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"montonExterior",
"[",
"y",
"]",
".",
"isEmpty",
"(",
")",
"&&",
"c",
".",
"getNum",
"(",
")",
"==",
"montonExterior",
"[",
"y",
"]",
".",
"peek",
"(",
")",
".",
"getNum",
"(",
")",
"+",
"1",
"&&",
"c",
".",
"getPalo",
"(",
")",
"==",
"montonExterior",
"[",
"y",
"]",
".",
"peek",
"(",
")",
".",
"getPalo",
"(",
")",
")",
"{",
"montonExterior",
"[",
"y",
"]",
".",
"push",
"(",
"c",
")",
";",
"}",
"else",
"{",
"montonInterior",
"[",
"(",
"x",
"-",
"5",
")",
"/",
"4",
"]",
"[",
"(",
"x",
"-",
"5",
")",
"%",
"4",
"]",
".",
"push",
"(",
"c",
")",
";",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"montonInterior",
"[",
"(",
"y",
"-",
"5",
")",
"/",
"4",
"]",
"[",
"(",
"y",
"-",
"5",
")",
"%",
"4",
"]",
".",
"isEmpty",
"(",
")",
")",
"{",
"montonInterior",
"[",
"(",
"x",
"-",
"5",
")",
"/",
"4",
"]",
"[",
"(",
"x",
"-",
"5",
")",
"%",
"4",
"]",
".",
"push",
"(",
"c",
")",
";",
"throw",
"new",
"Exception",
"(",
"\"No se puede mover una carta a un monton vacio\"",
")",
";",
"}",
"else",
"{",
"if",
"(",
"c",
".",
"getNum",
"(",
")",
"==",
"montonInterior",
"[",
"(",
"y",
"-",
"5",
")",
"/",
"4",
"]",
"[",
"(",
"y",
"-",
"5",
")",
"%",
"4",
"]",
".",
"peek",
"(",
")",
".",
"getNum",
"(",
")",
"-",
"1",
"&&",
"c",
".",
"getPalo",
"(",
")",
"==",
"montonInterior",
"[",
"(",
"y",
"-",
"5",
")",
"/",
"4",
"]",
"[",
"(",
"y",
"-",
"5",
")",
"%",
"4",
"]",
".",
"peek",
"(",
")",
".",
"getPalo",
"(",
")",
")",
"{",
"montonInterior",
"[",
"(",
"y",
"-",
"5",
")",
"/",
"4",
"]",
"[",
"(",
"y",
"-",
"5",
")",
"%",
"4",
"]",
".",
"push",
"(",
"c",
")",
";",
"}",
"else",
"{",
"montonInterior",
"[",
"(",
"x",
"-",
"5",
")",
"/",
"4",
"]",
"[",
"(",
"x",
"-",
"5",
")",
"%",
"4",
"]",
".",
"push",
"(",
"c",
")",
";",
"}",
"}",
"}",
"}"
] | [
223,
4
] | [
250,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
GXResultSet. | null | Metodos Agregados en el jdk1.4 | Metodos Agregados en el jdk1.4 | public java.net.URL getURL(int c) throws SQLException
{
return result.getURL(c);
} | [
"public",
"java",
".",
"net",
".",
"URL",
"getURL",
"(",
"int",
"c",
")",
"throws",
"SQLException",
"{",
"return",
"result",
".",
"getURL",
"(",
"c",
")",
";",
"}"
] | [
1715,
1
] | [
1718,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ProyectoRankeadoComprasDao. | null | Obtener los 10 proyectos rankeados según las compras | Obtener los 10 proyectos rankeados según las compras | public ArrayList<ProyectoRankeadoCompras> rankingProyectosComprasDescendente10() throws SQLException {
ArrayList<ProyectoRankeadoCompras> respuesta = new ArrayList<ProyectoRankeadoCompras>();
Connection conexion = null;
try {
conexion = JDBCUtilities.getConnection();
String consulta = "SELECT p.ID_Proyecto, " + "p.Clasificacion, "
+ "sum( c.Cantidad * m.Precio_Unidad ) as Gasto_Compras, " + "p.Serial " + "FROM Proyecto p "
+ "JOIN Compra c ON " + "p.ID_Proyecto = c.ID_Proyecto " + "JOIN MaterialConstruccion m ON "
+ "c.ID_MaterialConstruccion = m.ID_MaterialConstruccion " + "GROUP BY p.ID_Proyecto "
+ "ORDER BY Gasto_Compras DESC " + "LIMIT 10";
PreparedStatement statement = conexion.prepareStatement(consulta);
ResultSet resultSet = statement.executeQuery();
while (resultSet.next()) {
ProyectoRankeadoCompras proyecto = new ProyectoRankeadoCompras();
// proyecto.setIdProyecto(resultSet.getInt("ID_Proyecto"));
proyecto.setIdProyecto(resultSet.getInt(1));
proyecto.setClasificacion(resultSet.getString("Clasificacion"));
proyecto.setGastoCompras(resultSet.getInt("Gasto_Compras"));
proyecto.setSerial(resultSet.getString("Serial"));
respuesta.add(proyecto);
}
// Abiertas esas interacciones con BD
resultSet.close();
statement.close();
} catch (SQLException e) {
System.err.println("Error consultando los proyectos rankeados por compras! " + e);
} finally {
// Cierre del controlador
if (conexion != null) {
conexion.close();
}
}
// Retornar colección de vo's que satisfacen el requerimiento
return respuesta;
} | [
"public",
"ArrayList",
"<",
"ProyectoRankeadoCompras",
">",
"rankingProyectosComprasDescendente10",
"(",
")",
"throws",
"SQLException",
"{",
"ArrayList",
"<",
"ProyectoRankeadoCompras",
">",
"respuesta",
"=",
"new",
"ArrayList",
"<",
"ProyectoRankeadoCompras",
">",
"(",
")",
";",
"Connection",
"conexion",
"=",
"null",
";",
"try",
"{",
"conexion",
"=",
"JDBCUtilities",
".",
"getConnection",
"(",
")",
";",
"String",
"consulta",
"=",
"\"SELECT p.ID_Proyecto, \"",
"+",
"\"p.Clasificacion, \"",
"+",
"\"sum( c.Cantidad * m.Precio_Unidad ) as Gasto_Compras, \"",
"+",
"\"p.Serial \"",
"+",
"\"FROM Proyecto p \"",
"+",
"\"JOIN Compra c ON \"",
"+",
"\"p.ID_Proyecto = c.ID_Proyecto \"",
"+",
"\"JOIN MaterialConstruccion m ON \"",
"+",
"\"c.ID_MaterialConstruccion = m.ID_MaterialConstruccion \"",
"+",
"\"GROUP BY p.ID_Proyecto \"",
"+",
"\"ORDER BY Gasto_Compras DESC \"",
"+",
"\"LIMIT 10\"",
";",
"PreparedStatement",
"statement",
"=",
"conexion",
".",
"prepareStatement",
"(",
"consulta",
")",
";",
"ResultSet",
"resultSet",
"=",
"statement",
".",
"executeQuery",
"(",
")",
";",
"while",
"(",
"resultSet",
".",
"next",
"(",
")",
")",
"{",
"ProyectoRankeadoCompras",
"proyecto",
"=",
"new",
"ProyectoRankeadoCompras",
"(",
")",
";",
"// proyecto.setIdProyecto(resultSet.getInt(\"ID_Proyecto\"));\r",
"proyecto",
".",
"setIdProyecto",
"(",
"resultSet",
".",
"getInt",
"(",
"1",
")",
")",
";",
"proyecto",
".",
"setClasificacion",
"(",
"resultSet",
".",
"getString",
"(",
"\"Clasificacion\"",
")",
")",
";",
"proyecto",
".",
"setGastoCompras",
"(",
"resultSet",
".",
"getInt",
"(",
"\"Gasto_Compras\"",
")",
")",
";",
"proyecto",
".",
"setSerial",
"(",
"resultSet",
".",
"getString",
"(",
"\"Serial\"",
")",
")",
";",
"respuesta",
".",
"add",
"(",
"proyecto",
")",
";",
"}",
"// Abiertas esas interacciones con BD\r",
"resultSet",
".",
"close",
"(",
")",
";",
"statement",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"SQLException",
"e",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"Error consultando los proyectos rankeados por compras! \"",
"+",
"e",
")",
";",
"}",
"finally",
"{",
"// Cierre del controlador\r",
"if",
"(",
"conexion",
"!=",
"null",
")",
"{",
"conexion",
".",
"close",
"(",
")",
";",
"}",
"}",
"// Retornar colección de vo's que satisfacen el requerimiento\r",
"return",
"respuesta",
";",
"}"
] | [
192,
4
] | [
235,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ImageUtils. | null | Clase de ayuda para el manejo de las imagenes
guardarlas
| Clase de ayuda para el manejo de las imagenes
guardarlas
| public static boolean save(Bitmap src, String filePath, CompressFormat format) {
return save(src, FileUtils.getFileByPath(filePath), format, false);
} | [
"public",
"static",
"boolean",
"save",
"(",
"Bitmap",
"src",
",",
"String",
"filePath",
",",
"CompressFormat",
"format",
")",
"{",
"return",
"save",
"(",
"src",
",",
"FileUtils",
".",
"getFileByPath",
"(",
"filePath",
")",
",",
"format",
",",
"false",
")",
";",
"}"
] | [
23,
4
] | [
25,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Estudiante. | null | Registro Estudiantes (usando el main) : | Registro Estudiantes (usando el main) : | public static void main(String[] args) {
final String[] IDS = {"001", "002", "003"};
final String[] NOMBRES = {"Maria", "Gabriel", "Miguel"};
final boolean[] SUB_INCLUSION = {false, true, false};
ArrayList<Estudiante> estudiantes = new ArrayList<>();
ArrayList<Double> promsCredito;
promsCredito = Estudiante.calcPromsCredito(estudiantes);
if (promsCredito == null)
System.out.println("\t*** No se han ingresado estudiantes a la lista ***");
// Crea la ArrayList estudiantes
for (int i = 0; i < IDS.length; i++) {
Estudiante unEstudiante = new Estudiante(IDS[i], NOMBRES[i], SUB_INCLUSION[i]);
estudiantes.add(unEstudiante);
}
promsCredito = Estudiante.calcPromsCredito(estudiantes);
int i = 0;
double unPromCred;
System.out.println("\tId Nombre\tSub. Incl.\tProm-Cred");
for (Estudiante unEstudiante : estudiantes) {
unPromCred = promsCredito.get(i);
System.out.format("\t%s\t\t%.2f%n", unEstudiante.toString(), unPromCred);
i++;
}
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"final",
"String",
"[",
"]",
"IDS",
"=",
"{",
"\"001\"",
",",
"\"002\"",
",",
"\"003\"",
"}",
";",
"final",
"String",
"[",
"]",
"NOMBRES",
"=",
"{",
"\"Maria\"",
",",
"\"Gabriel\"",
",",
"\"Miguel\"",
"}",
";",
"final",
"boolean",
"[",
"]",
"SUB_INCLUSION",
"=",
"{",
"false",
",",
"true",
",",
"false",
"}",
";",
"ArrayList",
"<",
"Estudiante",
">",
"estudiantes",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"ArrayList",
"<",
"Double",
">",
"promsCredito",
";",
"promsCredito",
"=",
"Estudiante",
".",
"calcPromsCredito",
"(",
"estudiantes",
")",
";",
"if",
"(",
"promsCredito",
"==",
"null",
")",
"System",
".",
"out",
".",
"println",
"(",
"\"\\t*** No se han ingresado estudiantes a la lista ***\"",
")",
";",
"// Crea la ArrayList estudiantes\r",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"IDS",
".",
"length",
";",
"i",
"++",
")",
"{",
"Estudiante",
"unEstudiante",
"=",
"new",
"Estudiante",
"(",
"IDS",
"[",
"i",
"]",
",",
"NOMBRES",
"[",
"i",
"]",
",",
"SUB_INCLUSION",
"[",
"i",
"]",
")",
";",
"estudiantes",
".",
"add",
"(",
"unEstudiante",
")",
";",
"}",
"promsCredito",
"=",
"Estudiante",
".",
"calcPromsCredito",
"(",
"estudiantes",
")",
";",
"int",
"i",
"=",
"0",
";",
"double",
"unPromCred",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"\\tId Nombre\\tSub. Incl.\\tProm-Cred\"",
")",
";",
"for",
"(",
"Estudiante",
"unEstudiante",
":",
"estudiantes",
")",
"{",
"unPromCred",
"=",
"promsCredito",
".",
"get",
"(",
"i",
")",
";",
"System",
".",
"out",
".",
"format",
"(",
"\"\\t%s\\t\\t%.2f%n\"",
",",
"unEstudiante",
".",
"toString",
"(",
")",
",",
"unPromCred",
")",
";",
"i",
"++",
";",
"}",
"}"
] | [
59,
4
] | [
84,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CrearCuenta. | null | Método para cuando se desenfoca de CampoNombreUsuario | Método para cuando se desenfoca de CampoNombreUsuario | private void CampoNombreUsuarioFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_CampoNombreUsuarioFocusLost
// Obtiene contenido de campo
String Contenido = this.CampoNombreUsuario.getText();
// Obtiene color de campo
Color ColorActual = this.CampoNombreUsuario.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.CampoNombreUsuario.setText("Nombre de Usuario");
if(ColorActual != ColorNoEscrito)
{
this.CampoNombreUsuario.setForeground(ColorNoEscrito);
}
}
}
} | [
"private",
"void",
"CampoNombreUsuarioFocusLost",
"(",
"java",
".",
"awt",
".",
"event",
".",
"FocusEvent",
"evt",
")",
"{",
"//GEN-FIRST:event_CampoNombreUsuarioFocusLost",
"// Obtiene contenido de campo",
"String",
"Contenido",
"=",
"this",
".",
"CampoNombreUsuario",
".",
"getText",
"(",
")",
";",
"// Obtiene color de campo",
"Color",
"ColorActual",
"=",
"this",
".",
"CampoNombreUsuario",
".",
"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",
".",
"CampoNombreUsuario",
".",
"setText",
"(",
"\"Nombre de Usuario\"",
")",
";",
"if",
"(",
"ColorActual",
"!=",
"ColorNoEscrito",
")",
"{",
"this",
".",
"CampoNombreUsuario",
".",
"setForeground",
"(",
"ColorNoEscrito",
")",
";",
"}",
"}",
"}",
"}"
] | [
870,
4
] | [
891,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Ejercicio3. | null | Función o método que calcula el triple | Función o método que calcula el triple | public static int triple(int numero){
int triple = 0;
triple = numero * 3;
return triple;
} | [
"public",
"static",
"int",
"triple",
"(",
"int",
"numero",
")",
"{",
"int",
"triple",
"=",
"0",
";",
"triple",
"=",
"numero",
"*",
"3",
";",
"return",
"triple",
";",
"}"
] | [
14,
4
] | [
18,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
DeviceTest. | null | CP6: Cuando enviamos una petición de apagado, el dispositivo debe apagarse. | CP6: Cuando enviamos una petición de apagado, el dispositivo debe apagarse. | @Test
public void Given_A_TurnedOn_Device_When_TurnOffRequest_Method_Is_Called_Then_The_Device_Is_TurnOff(){
//Given
device.turnOn();
//When
device.turnOffRequest();
//Then
assertFalse(device.getTurnedOn());
} | [
"@",
"Test",
"public",
"void",
"Given_A_TurnedOn_Device_When_TurnOffRequest_Method_Is_Called_Then_The_Device_Is_TurnOff",
"(",
")",
"{",
"//Given",
"device",
".",
"turnOn",
"(",
")",
";",
"//When",
"device",
".",
"turnOffRequest",
"(",
")",
";",
"//Then",
"assertFalse",
"(",
"device",
".",
"getTurnedOn",
"(",
")",
")",
";",
"}"
] | [
82,
4
] | [
92,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Main. | null | /*1) Crear una clase Persona donde haya un método LeerDatosPersonales.
Como caso muy puntual académicamente, se leerán dentro del método
el nombre, apellidos, edad y DNI. En el mismo, se debe añadir el código
necesario para que se muestren los nombres de los métodos llamados hasta
el método que ha producido la excepción. Hacer la llamada en el main.
| /*1) Crear una clase Persona donde haya un método LeerDatosPersonales.
Como caso muy puntual académicamente, se leerán dentro del método
el nombre, apellidos, edad y DNI. En el mismo, se debe añadir el código
necesario para que se muestren los nombres de los métodos llamados hasta
el método que ha producido la excepción. Hacer la llamada en el main.
| public static void main(String[] args) {
// TODO Auto-generated method stub
Persona pg=new Persona();
pg.LeerDatosPersonales();
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"// TODO Auto-generated method stub",
"Persona",
"pg",
"=",
"new",
"Persona",
"(",
")",
";",
"pg",
".",
"LeerDatosPersonales",
"(",
")",
";",
"}"
] | [
10,
1
] | [
15,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Login. | null | Método cuando se presiona con el mouse CampoContrasena | Método cuando se presiona con el mouse CampoContrasena | private void CampoContrasenaMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_CampoContrasenaMousePressed
// Obtener contenido
String Contenido = this.CampoContrasena.getText();
Color ColorActual = this.CampoContrasena.getForeground();
Color ColorEscrito = new Color(51, 51, 51);
// Verifica si no tiene nada seteado aún
if(Contenido.equals("Contraseña"))
{
// Elimina contenido
this.CampoContrasena.setText("");
}
if(ColorActual != ColorEscrito)
{
this.CampoContrasena.setForeground(ColorEscrito);
}
} | [
"private",
"void",
"CampoContrasenaMousePressed",
"(",
"java",
".",
"awt",
".",
"event",
".",
"MouseEvent",
"evt",
")",
"{",
"//GEN-FIRST:event_CampoContrasenaMousePressed",
"// Obtener contenido",
"String",
"Contenido",
"=",
"this",
".",
"CampoContrasena",
".",
"getText",
"(",
")",
";",
"Color",
"ColorActual",
"=",
"this",
".",
"CampoContrasena",
".",
"getForeground",
"(",
")",
";",
"Color",
"ColorEscrito",
"=",
"new",
"Color",
"(",
"51",
",",
"51",
",",
"51",
")",
";",
"// Verifica si no tiene nada seteado aún",
"if",
"(",
"Contenido",
".",
"equals",
"(",
"\"Contraseña\")",
")",
"",
"{",
"// Elimina contenido",
"this",
".",
"CampoContrasena",
".",
"setText",
"(",
"\"\"",
")",
";",
"}",
"if",
"(",
"ColorActual",
"!=",
"ColorEscrito",
")",
"{",
"this",
".",
"CampoContrasena",
".",
"setForeground",
"(",
"ColorEscrito",
")",
";",
"}",
"}"
] | [
637,
4
] | [
652,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Cita. | null | Método que muestra la lista de citas. | Método que muestra la lista de citas. | public void mostrarCitas() {
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 * FROM Citas");
resultado = query.executeQuery();
while(resultado.next()) {
System.out.print("ID: ");
System.out.println(resultado.getInt("id"));
System.out.print("Fecha: ");
System.out.println(resultado.getString("fecha"));
System.out.print("Hora: ");
System.out.println(resultado.getString("hora"));
System.out.print("Motivo de la cita: ");
System.out.println(resultado.getString("motivo_cita"));
System.out.println("==========");
}
conexion.close();
query.close();
} catch (Exception e) {
System.err.println(e.getMessage());
}
} | [
"public",
"void",
"mostrarCitas",
"(",
")",
"{",
"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 * FROM Citas\"",
")",
";",
"resultado",
"=",
"query",
".",
"executeQuery",
"(",
")",
";",
"while",
"(",
"resultado",
".",
"next",
"(",
")",
")",
"{",
"System",
".",
"out",
".",
"print",
"(",
"\"ID: \"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"resultado",
".",
"getInt",
"(",
"\"id\"",
")",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"\"Fecha: \"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"resultado",
".",
"getString",
"(",
"\"fecha\"",
")",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"\"Hora: \"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"resultado",
".",
"getString",
"(",
"\"hora\"",
")",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"\"Motivo de la cita: \"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"resultado",
".",
"getString",
"(",
"\"motivo_cita\"",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"==========\"",
")",
";",
"}",
"conexion",
".",
"close",
"(",
")",
";",
"query",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
] | [
60,
4
] | [
98,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
WalletResourcesNetworkServicePluginRoot. | null | el xml de las skin debe estar pegado a una estructura de navegacion | el xml de las skin debe estar pegado a una estructura de navegacion | @Override
public void installCompleteWallet(String walletCategory, String walletType, String developer, String screenSize, String skinName, String languageName, String navigationStructureVersion,String walletPublicKey) throws WalletResourcesInstalationException {
// this will be use when the repository be open source
//String linkToRepo = REPOSITORY_LINK + walletCategory + "/" + walletType + "/" + developer + "/";
String linkToRepo = "seed-resources/wallet_resources/"+developer+"/"+walletCategory+"/"+walletType+"/";
String linkToResources = linkToRepo + "skins/" + skinName + "/";
String localStoragePath=this.LOCAL_STORAGE_PATH + developer +"/" +walletCategory + "/" + walletType + "/"+ "skins/" + skinName + "/" + screenSize + "/";
Skin skin;
/**
* add progress
*/
addProgress(InstalationProgress.INSTALATION_START);
try {
String linkToSkinFile= linkToResources + screenSize +"/";
skin = checkAndInstallSkinResources(linkToSkinFile, localStoragePath,walletPublicKey);
Repository repository = new Repository(skinName, navigationStructureVersion, localStoragePath);
/**
* Save skin on Database
*/
networkServicesWalletResourcesDAO.createRepository(repository, skin.getId());
/**
* download navigation structure
*/
String linkToNavigationStructure = linkToRepo + "navigation_structure/" + skin.getNavigationStructureCompatibility() + "/";
downloadNavigationStructure(linkToNavigationStructure, skin.getId(), localStoragePath, walletPublicKey);
/**
* download resources
*/
downloadResourcesFromRepo(linkToResources, skin, localStoragePath, screenSize, walletPublicKey);
/**
* download language
*/
String linkToLanguage = linkToRepo + "languages/";
downloadLanguageFromRepo(linkToLanguage, skin.getId(), languageName, localStoragePath + "languages/", screenSize, walletPublicKey);
} catch (CantDonwloadNavigationStructure e) {
throw new WalletResourcesInstalationException("CAN'T INSTALL WALLET RESOURCES",e,"Error download navigation structure","");
} catch (CantDownloadResourceFromRepo e) {
throw new WalletResourcesInstalationException("CAN'T INSTALL WALLET RESOURCES",e,"Error download Resource fro repo","");
} catch (CantDownloadLanguageFromRepo e) {
throw new WalletResourcesInstalationException("CAN'T INSTALL WALLET RESOURCES",e,"Error download language from repo","");
}
catch (CantCreateRepositoryException e) {
throw new WalletResourcesInstalationException("CAN'T INSTALL WALLET RESOURCES",e,"Error created repository on database","");
} catch (CantCheckResourcesException cantCheckResourcesException) {
throw new WalletResourcesInstalationException("CAN'T INSTALL WALLET RESOURCES",cantCheckResourcesException,"Error in skin.mxl file","");
} catch (Exception e) {
throw new WalletResourcesInstalationException("CAN'T INSTALL WALLET RESOURCES",e,"unknown error","");
}
//installSkinResource("null");
} | [
"@",
"Override",
"public",
"void",
"installCompleteWallet",
"(",
"String",
"walletCategory",
",",
"String",
"walletType",
",",
"String",
"developer",
",",
"String",
"screenSize",
",",
"String",
"skinName",
",",
"String",
"languageName",
",",
"String",
"navigationStructureVersion",
",",
"String",
"walletPublicKey",
")",
"throws",
"WalletResourcesInstalationException",
"{",
"// this will be use when the repository be open source",
"//String linkToRepo = REPOSITORY_LINK + walletCategory + \"/\" + walletType + \"/\" + developer + \"/\";",
"String",
"linkToRepo",
"=",
"\"seed-resources/wallet_resources/\"",
"+",
"developer",
"+",
"\"/\"",
"+",
"walletCategory",
"+",
"\"/\"",
"+",
"walletType",
"+",
"\"/\"",
";",
"String",
"linkToResources",
"=",
"linkToRepo",
"+",
"\"skins/\"",
"+",
"skinName",
"+",
"\"/\"",
";",
"String",
"localStoragePath",
"=",
"this",
".",
"LOCAL_STORAGE_PATH",
"+",
"developer",
"+",
"\"/\"",
"+",
"walletCategory",
"+",
"\"/\"",
"+",
"walletType",
"+",
"\"/\"",
"+",
"\"skins/\"",
"+",
"skinName",
"+",
"\"/\"",
"+",
"screenSize",
"+",
"\"/\"",
";",
"Skin",
"skin",
";",
"/**\n * add progress\n */",
"addProgress",
"(",
"InstalationProgress",
".",
"INSTALATION_START",
")",
";",
"try",
"{",
"String",
"linkToSkinFile",
"=",
"linkToResources",
"+",
"screenSize",
"+",
"\"/\"",
";",
"skin",
"=",
"checkAndInstallSkinResources",
"(",
"linkToSkinFile",
",",
"localStoragePath",
",",
"walletPublicKey",
")",
";",
"Repository",
"repository",
"=",
"new",
"Repository",
"(",
"skinName",
",",
"navigationStructureVersion",
",",
"localStoragePath",
")",
";",
"/**\n * Save skin on Database\n */",
"networkServicesWalletResourcesDAO",
".",
"createRepository",
"(",
"repository",
",",
"skin",
".",
"getId",
"(",
")",
")",
";",
"/**\n * download navigation structure\n */",
"String",
"linkToNavigationStructure",
"=",
"linkToRepo",
"+",
"\"navigation_structure/\"",
"+",
"skin",
".",
"getNavigationStructureCompatibility",
"(",
")",
"+",
"\"/\"",
";",
"downloadNavigationStructure",
"(",
"linkToNavigationStructure",
",",
"skin",
".",
"getId",
"(",
")",
",",
"localStoragePath",
",",
"walletPublicKey",
")",
";",
"/**\n * download resources\n */",
"downloadResourcesFromRepo",
"(",
"linkToResources",
",",
"skin",
",",
"localStoragePath",
",",
"screenSize",
",",
"walletPublicKey",
")",
";",
"/**\n * download language\n */",
"String",
"linkToLanguage",
"=",
"linkToRepo",
"+",
"\"languages/\"",
";",
"downloadLanguageFromRepo",
"(",
"linkToLanguage",
",",
"skin",
".",
"getId",
"(",
")",
",",
"languageName",
",",
"localStoragePath",
"+",
"\"languages/\"",
",",
"screenSize",
",",
"walletPublicKey",
")",
";",
"}",
"catch",
"(",
"CantDonwloadNavigationStructure",
"e",
")",
"{",
"throw",
"new",
"WalletResourcesInstalationException",
"(",
"\"CAN'T INSTALL WALLET RESOURCES\"",
",",
"e",
",",
"\"Error download navigation structure\"",
",",
"\"\"",
")",
";",
"}",
"catch",
"(",
"CantDownloadResourceFromRepo",
"e",
")",
"{",
"throw",
"new",
"WalletResourcesInstalationException",
"(",
"\"CAN'T INSTALL WALLET RESOURCES\"",
",",
"e",
",",
"\"Error download Resource fro repo\"",
",",
"\"\"",
")",
";",
"}",
"catch",
"(",
"CantDownloadLanguageFromRepo",
"e",
")",
"{",
"throw",
"new",
"WalletResourcesInstalationException",
"(",
"\"CAN'T INSTALL WALLET RESOURCES\"",
",",
"e",
",",
"\"Error download language from repo\"",
",",
"\"\"",
")",
";",
"}",
"catch",
"(",
"CantCreateRepositoryException",
"e",
")",
"{",
"throw",
"new",
"WalletResourcesInstalationException",
"(",
"\"CAN'T INSTALL WALLET RESOURCES\"",
",",
"e",
",",
"\"Error created repository on database\"",
",",
"\"\"",
")",
";",
"}",
"catch",
"(",
"CantCheckResourcesException",
"cantCheckResourcesException",
")",
"{",
"throw",
"new",
"WalletResourcesInstalationException",
"(",
"\"CAN'T INSTALL WALLET RESOURCES\"",
",",
"cantCheckResourcesException",
",",
"\"Error in skin.mxl file\"",
",",
"\"\"",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"WalletResourcesInstalationException",
"(",
"\"CAN'T INSTALL WALLET RESOURCES\"",
",",
"e",
",",
"\"unknown error\"",
",",
"\"\"",
")",
";",
"}",
"//installSkinResource(\"null\");",
"}"
] | [
322,
4
] | [
394,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ControladorDeAudio. | null | /* Vuelve para atras una cancion de la play list si llega al principio va al final | /* Vuelve para atras una cancion de la play list si llega al principio va al final | public void back() {
if(reproduciendo) repActual.stop();
int pos = (reproductores.indexOf(repActual)-1);
if(pos < 0) pos = reproductores.size() - 1;
repActual = reproductores.get(pos);
repActual.play();
reproduciendo = true;
} | [
"public",
"void",
"back",
"(",
")",
"{",
"if",
"(",
"reproduciendo",
")",
"repActual",
".",
"stop",
"(",
")",
";",
"int",
"pos",
"=",
"(",
"reproductores",
".",
"indexOf",
"(",
"repActual",
")",
"-",
"1",
")",
";",
"if",
"(",
"pos",
"<",
"0",
")",
"pos",
"=",
"reproductores",
".",
"size",
"(",
")",
"-",
"1",
";",
"repActual",
"=",
"reproductores",
".",
"get",
"(",
"pos",
")",
";",
"repActual",
".",
"play",
"(",
")",
";",
"reproduciendo",
"=",
"true",
";",
"}"
] | [
97,
4
] | [
107,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Login. | null | Método para cuando se quiere iniciar sesión | Método para cuando se quiere iniciar sesión | private void BotonIniciarSesionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonIniciarSesionActionPerformed
// Verifica si los campos no están vacíos
String Username, Password, HashContrasena;
Usuario SesionActiva;
int x, Posicion;
Boolean Sesion;
Posicion = -1;
Sesion = false;
Username = this.CampoUsuario.getText();
Password = this.CampoContrasena.getText();
HashContrasena = Hashing.Hash(ContrasenaTemp);
if(Username.equals("Nombre de Usuario") || Username.equals(""))
{
JOptionPane.showMessageDialog(null, "Faltan campos por llenar");
}
else
{
if(Password.equals("Contraseña") || Password.equals(""))
{
JOptionPane.showMessageDialog(null, "Faltan campos por llenar");
}
else
{
for(x = 0; x < RegistrosVentana.getTamanoUsuarios(); x++)
{
if(Username.equals(RegistrosVentana.getUsuario(x).getUsername()))
{
if(HashContrasena.equals(RegistrosVentana.getUsuario(x).getContrasena()))
{
Sesion = true;
Posicion = x;
}
}
}
if(Sesion)
{
System.out.println("Iniciando Sesión como " + Username);
SesionActiva = RegistrosVentana.getUsuario(Posicion);
Cargando CargandoVentana = new Cargando(this, true,
TamanoVentana, RegistrosVentana, SesionActiva);
CargandoVentana.pack();
CargandoVentana.setLocationRelativeTo(null);
CargandoVentana.setVisible(true);
Menu MenuVentana = new Menu(TamanoVentana, RegistrosVentana, SesionActiva);
MenuVentana.setVisible(true);
dispose();
}
else
{
JOptionPane.showMessageDialog(null, "Nombre de Usuario y/o contraseña erróneos");
}
}
}
} | [
"private",
"void",
"BotonIniciarSesionActionPerformed",
"(",
"java",
".",
"awt",
".",
"event",
".",
"ActionEvent",
"evt",
")",
"{",
"//GEN-FIRST:event_BotonIniciarSesionActionPerformed",
"// Verifica si los campos no están vacíos",
"String",
"Username",
",",
"Password",
",",
"HashContrasena",
";",
"Usuario",
"SesionActiva",
";",
"int",
"x",
",",
"Posicion",
";",
"Boolean",
"Sesion",
";",
"Posicion",
"=",
"-",
"1",
";",
"Sesion",
"=",
"false",
";",
"Username",
"=",
"this",
".",
"CampoUsuario",
".",
"getText",
"(",
")",
";",
"Password",
"=",
"this",
".",
"CampoContrasena",
".",
"getText",
"(",
")",
";",
"HashContrasena",
"=",
"Hashing",
".",
"Hash",
"(",
"ContrasenaTemp",
")",
";",
"if",
"(",
"Username",
".",
"equals",
"(",
"\"Nombre de Usuario\"",
")",
"||",
"Username",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"JOptionPane",
".",
"showMessageDialog",
"(",
"null",
",",
"\"Faltan campos por llenar\"",
")",
";",
"}",
"else",
"{",
"if",
"(",
"Password",
".",
"equals",
"(",
"\"Contraseña\")",
" ",
"| ",
"assword.",
"e",
"quals(",
"\"",
"\")",
")",
"",
"{",
"JOptionPane",
".",
"showMessageDialog",
"(",
"null",
",",
"\"Faltan campos por llenar\"",
")",
";",
"}",
"else",
"{",
"for",
"(",
"x",
"=",
"0",
";",
"x",
"<",
"RegistrosVentana",
".",
"getTamanoUsuarios",
"(",
")",
";",
"x",
"++",
")",
"{",
"if",
"(",
"Username",
".",
"equals",
"(",
"RegistrosVentana",
".",
"getUsuario",
"(",
"x",
")",
".",
"getUsername",
"(",
")",
")",
")",
"{",
"if",
"(",
"HashContrasena",
".",
"equals",
"(",
"RegistrosVentana",
".",
"getUsuario",
"(",
"x",
")",
".",
"getContrasena",
"(",
")",
")",
")",
"{",
"Sesion",
"=",
"true",
";",
"Posicion",
"=",
"x",
";",
"}",
"}",
"}",
"if",
"(",
"Sesion",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Iniciando Sesión como \" ",
" ",
"sername)",
";",
"",
"SesionActiva",
"=",
"RegistrosVentana",
".",
"getUsuario",
"(",
"Posicion",
")",
";",
"Cargando",
"CargandoVentana",
"=",
"new",
"Cargando",
"(",
"this",
",",
"true",
",",
"TamanoVentana",
",",
"RegistrosVentana",
",",
"SesionActiva",
")",
";",
"CargandoVentana",
".",
"pack",
"(",
")",
";",
"CargandoVentana",
".",
"setLocationRelativeTo",
"(",
"null",
")",
";",
"CargandoVentana",
".",
"setVisible",
"(",
"true",
")",
";",
"Menu",
"MenuVentana",
"=",
"new",
"Menu",
"(",
"TamanoVentana",
",",
"RegistrosVentana",
",",
"SesionActiva",
")",
";",
"MenuVentana",
".",
"setVisible",
"(",
"true",
")",
";",
"dispose",
"(",
")",
";",
"}",
"else",
"{",
"JOptionPane",
".",
"showMessageDialog",
"(",
"null",
",",
"\"Nombre de Usuario y/o contraseña erróneos\");",
"",
"",
"}",
"}",
"}",
"}"
] | [
758,
4
] | [
811,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Registro. | null | Método AnulaRegistroHabitaciones | Método AnulaRegistroHabitaciones | public void AnulaRegistroHabitaciones()
{
RegistroHabitaciones.clear();
} | [
"public",
"void",
"AnulaRegistroHabitaciones",
"(",
")",
"{",
"RegistroHabitaciones",
".",
"clear",
"(",
")",
";",
"}"
] | [
70,
4
] | [
73,
5
] | null | java | es | ['es', 'es', 'es'] | False | true | method_declaration |
|
CrearCuenta. | null | Método para cuando se presiona en CampoApellidoMaterno con el mouse | Método para cuando se presiona en CampoApellidoMaterno con el mouse | private void CampoApellidoMaternoMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_CampoApellidoMaternoMousePressed
// Obtener contenido
String Contenido = this.CampoApellidoMaterno.getText();
Color ColorActual = this.CampoApellidoMaterno.getForeground();
Color ColorEscrito = new Color(51, 51, 51);
// Verifica si no tiene nada seteado aún
if(Contenido.equals("Apellido Materno"))
{
// Elimina contenido
this.CampoApellidoMaterno.setText("");
}
if(ColorActual != ColorEscrito)
{
this.CampoApellidoMaterno.setForeground(ColorEscrito);
}
} | [
"private",
"void",
"CampoApellidoMaternoMousePressed",
"(",
"java",
".",
"awt",
".",
"event",
".",
"MouseEvent",
"evt",
")",
"{",
"//GEN-FIRST:event_CampoApellidoMaternoMousePressed",
"// Obtener contenido",
"String",
"Contenido",
"=",
"this",
".",
"CampoApellidoMaterno",
".",
"getText",
"(",
")",
";",
"Color",
"ColorActual",
"=",
"this",
".",
"CampoApellidoMaterno",
".",
"getForeground",
"(",
")",
";",
"Color",
"ColorEscrito",
"=",
"new",
"Color",
"(",
"51",
",",
"51",
",",
"51",
")",
";",
"// Verifica si no tiene nada seteado aún",
"if",
"(",
"Contenido",
".",
"equals",
"(",
"\"Apellido Materno\"",
")",
")",
"{",
"// Elimina contenido",
"this",
".",
"CampoApellidoMaterno",
".",
"setText",
"(",
"\"\"",
")",
";",
"}",
"if",
"(",
"ColorActual",
"!=",
"ColorEscrito",
")",
"{",
"this",
".",
"CampoApellidoMaterno",
".",
"setForeground",
"(",
"ColorEscrito",
")",
";",
"}",
"}"
] | [
1026,
4
] | [
1041,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Paciente. | null | Método para pedir los datos. | Método para pedir los datos. | public void pedirDatos() {
System.out.println("Ingresa el nombre del paciente: ");
this.nombre = scanner.nextLine();
} | [
"public",
"void",
"pedirDatos",
"(",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Ingresa el nombre del paciente: \"",
")",
";",
"this",
".",
"nombre",
"=",
"scanner",
".",
"nextLine",
"(",
")",
";",
"}"
] | [
18,
4
] | [
21,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
AnswerTests. | null | No debe validar si la fecha está en futuro | No debe validar si la fecha está en futuro | @Test
void shouldNotValidateWhendateIsInTheFuture() {
LocaleContextHolder.setLocale(Locale.ENGLISH);
Answer answer = this.generateAnswer();
answer.setDate(LocalDate.of(2021, 3, 17));
Validator validator = this.createValidator();
Set<ConstraintViolation<Answer>> constraintViolations = validator.validate(answer);
Assertions.assertThat(constraintViolations.size()).isEqualTo(1);
ConstraintViolation<Answer> violation = constraintViolations.iterator().next();
Assertions.assertThat(violation.getPropertyPath().toString()).isEqualTo("date");
Assertions.assertThat(violation.getMessage()).isEqualTo("must be a past date");
} | [
"@",
"Test",
"void",
"shouldNotValidateWhendateIsInTheFuture",
"(",
")",
"{",
"LocaleContextHolder",
".",
"setLocale",
"(",
"Locale",
".",
"ENGLISH",
")",
";",
"Answer",
"answer",
"=",
"this",
".",
"generateAnswer",
"(",
")",
";",
"answer",
".",
"setDate",
"(",
"LocalDate",
".",
"of",
"(",
"2021",
",",
"3",
",",
"17",
")",
")",
";",
"Validator",
"validator",
"=",
"this",
".",
"createValidator",
"(",
")",
";",
"Set",
"<",
"ConstraintViolation",
"<",
"Answer",
">",
">",
"constraintViolations",
"=",
"validator",
".",
"validate",
"(",
"answer",
")",
";",
"Assertions",
".",
"assertThat",
"(",
"constraintViolations",
".",
"size",
"(",
")",
")",
".",
"isEqualTo",
"(",
"1",
")",
";",
"ConstraintViolation",
"<",
"Answer",
">",
"violation",
"=",
"constraintViolations",
".",
"iterator",
"(",
")",
".",
"next",
"(",
")",
";",
"Assertions",
".",
"assertThat",
"(",
"violation",
".",
"getPropertyPath",
"(",
")",
".",
"toString",
"(",
")",
")",
".",
"isEqualTo",
"(",
"\"date\"",
")",
";",
"Assertions",
".",
"assertThat",
"(",
"violation",
".",
"getMessage",
"(",
")",
")",
".",
"isEqualTo",
"(",
"\"must be a past date\"",
")",
";",
"}"
] | [
42,
1
] | [
56,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ControladoraHotel. | null | Sirve para traer TODAS las reservas del dia de HOY | Sirve para traer TODAS las reservas del dia de HOY | public List<Reserva> traerReservaDeHoy() {
//traigo toda la lista
List<Reserva> lista = traerReserva();
String dia = getFechaActual();
//hago una lista copia, que sirve para guardar las coincidencias con la fecha que me envio de parametro
List< Reserva> lista_filtrada = new ArrayList();
//si la lista no esta vacia la recorro
if (lista != null) {
//busca
for (int i = 0; i < lista.size(); i++) {
Reserva r = lista.get(i);
if (DateAString(r.getFecha_alta_reserva()).equals(dia)) {
lista_filtrada.add(r);
}
}
}
return lista_filtrada;
} | [
"public",
"List",
"<",
"Reserva",
">",
"traerReservaDeHoy",
"(",
")",
"{",
"//traigo toda la lista ",
"List",
"<",
"Reserva",
">",
"lista",
"=",
"traerReserva",
"(",
")",
";",
"String",
"dia",
"=",
"getFechaActual",
"(",
")",
";",
"//hago una lista copia, que sirve para guardar las coincidencias con la fecha que me envio de parametro",
"List",
"<",
"Reserva",
">",
"lista_filtrada",
"=",
"new",
"ArrayList",
"(",
")",
";",
"//si la lista no esta vacia la recorro",
"if",
"(",
"lista",
"!=",
"null",
")",
"{",
"//busca ",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"lista",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"Reserva",
"r",
"=",
"lista",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"DateAString",
"(",
"r",
".",
"getFecha_alta_reserva",
"(",
")",
")",
".",
"equals",
"(",
"dia",
")",
")",
"{",
"lista_filtrada",
".",
"add",
"(",
"r",
")",
";",
"}",
"}",
"}",
"return",
"lista_filtrada",
";",
"}"
] | [
263,
4
] | [
283,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ControladorDeAudio. | null | /* Reproduce o para la cancion de reproductor actual | /* Reproduce o para la cancion de reproductor actual | public void play(){
if(reproduciendo){
repActual.stop();
reproduciendo = false;
}else{
repActual.play();
reproduciendo = true;
}
} | [
"public",
"void",
"play",
"(",
")",
"{",
"if",
"(",
"reproduciendo",
")",
"{",
"repActual",
".",
"stop",
"(",
")",
";",
"reproduciendo",
"=",
"false",
";",
"}",
"else",
"{",
"repActual",
".",
"play",
"(",
")",
";",
"reproduciendo",
"=",
"true",
";",
"}",
"}"
] | [
77,
4
] | [
85,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
MaterialController. | null | LISTANDO TODOS LOS MATERIALEs | LISTANDO TODOS LOS MATERIALEs | @GetMapping
public List<Material> listarMateriales(){
return mService.listarTodosAutores();
} | [
"@",
"GetMapping",
"public",
"List",
"<",
"Material",
">",
"listarMateriales",
"(",
")",
"{",
"return",
"mService",
".",
"listarTodosAutores",
"(",
")",
";",
"}"
] | [
112,
1
] | [
115,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
DatabaseRecordTest. | null | /* Comprobamos los metodos de tipo String | /* Comprobamos los metodos de tipo String | @Test
public void String_AreEquals(){
record1.setStringValue("String_Column_1", "Valor_1");
record2.setStringValue("String_Column_1", "Valor_1");
assertThat(record1.getStringValue("String_Column_1")).isEqualTo(record2.getStringValue("String_Column_1"));
assertThat(record1.toString()).isEqualTo(record2.toString());
} | [
"@",
"Test",
"public",
"void",
"String_AreEquals",
"(",
")",
"{",
"record1",
".",
"setStringValue",
"(",
"\"String_Column_1\"",
",",
"\"Valor_1\"",
")",
";",
"record2",
".",
"setStringValue",
"(",
"\"String_Column_1\"",
",",
"\"Valor_1\"",
")",
";",
"assertThat",
"(",
"record1",
".",
"getStringValue",
"(",
"\"String_Column_1\"",
")",
")",
".",
"isEqualTo",
"(",
"record2",
".",
"getStringValue",
"(",
"\"String_Column_1\"",
")",
")",
";",
"assertThat",
"(",
"record1",
".",
"toString",
"(",
")",
")",
".",
"isEqualTo",
"(",
"record2",
".",
"toString",
"(",
")",
")",
";",
"}"
] | [
47,
2
] | [
54,
3
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
AmigosUsuController. | null | private UsuarioController usuController; //Para buscar datos de los usuarios | private UsuarioController usuController; //Para buscar datos de los usuarios | @CrossOrigin(origins = "http://localhost:4200")
@PostMapping("/addAmigosUsus")
public ResponseEntity<List<AmigosUsu>> addAmigosUsus(@RequestBody List<AmigosUsu> amigosUsus){
return new ResponseEntity<List<AmigosUsu>>(service.saveAmigosUsu(amigosUsus), HttpStatus.OK);
} | [
"@",
"CrossOrigin",
"(",
"origins",
"=",
"\"http://localhost:4200\"",
")",
"@",
"PostMapping",
"(",
"\"/addAmigosUsus\"",
")",
"public",
"ResponseEntity",
"<",
"List",
"<",
"AmigosUsu",
">",
">",
"addAmigosUsus",
"(",
"@",
"RequestBody",
"List",
"<",
"AmigosUsu",
">",
"amigosUsus",
")",
"{",
"return",
"new",
"ResponseEntity",
"<",
"List",
"<",
"AmigosUsu",
">",
">",
"(",
"service",
".",
"saveAmigosUsu",
"(",
"amigosUsus",
")",
",",
"HttpStatus",
".",
"OK",
")",
";",
"}"
] | [
33,
1
] | [
37,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Imprimir. | null | sentido, pero para algo como una busqueda mejor pasamos el stream. | sentido, pero para algo como una busqueda mejor pasamos el stream. | public void imprimirProductosStream (Stream<ProductosLimpieza> lp) {
lp.forEach(x -> System.out.println(x));
} | [
"public",
"void",
"imprimirProductosStream",
"(",
"Stream",
"<",
"ProductosLimpieza",
">",
"lp",
")",
"{",
"lp",
".",
"forEach",
"(",
"x",
"->",
"System",
".",
"out",
".",
"println",
"(",
"x",
")",
")",
";",
"}"
] | [
45,
1
] | [
48,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ServletEventListener. | null | Se llama al iniciar la aplicacion
| Se llama al iniciar la aplicacion
| public void contextInitializedWrapper(String basePath, String gxcfg)
{
LogManager.initialize(basePath);
if (gxcfg != null)
{
try
{
Class gxcfgClass = Class.forName(gxcfg);
ApplicationContext appContext = ApplicationContext.getInstance();
appContext.setServletEngine(true);
appContext.setServletEngineDefaultPath(basePath);
Application.init(gxcfgClass);
}
catch (Exception e) {
}
}
} | [
"public",
"void",
"contextInitializedWrapper",
"(",
"String",
"basePath",
",",
"String",
"gxcfg",
")",
"{",
"LogManager",
".",
"initialize",
"(",
"basePath",
")",
";",
"if",
"(",
"gxcfg",
"!=",
"null",
")",
"{",
"try",
"{",
"Class",
"gxcfgClass",
"=",
"Class",
".",
"forName",
"(",
"gxcfg",
")",
";",
"ApplicationContext",
"appContext",
"=",
"ApplicationContext",
".",
"getInstance",
"(",
")",
";",
"appContext",
".",
"setServletEngine",
"(",
"true",
")",
";",
"appContext",
".",
"setServletEngineDefaultPath",
"(",
"basePath",
")",
";",
"Application",
".",
"init",
"(",
"gxcfgClass",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"}",
"}",
"}"
] | [
76,
1
] | [
92,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
FotosService. | null | /* buscar fotos de un usuario para la seccion de fotos | /* buscar fotos de un usuario para la seccion de fotos | public List<Fotos> findFotosUsuario(Integer idUsu) {
return repository.findFotosUsuario(idUsu);
} | [
"public",
"List",
"<",
"Fotos",
">",
"findFotosUsuario",
"(",
"Integer",
"idUsu",
")",
"{",
"return",
"repository",
".",
"findFotosUsuario",
"(",
"idUsu",
")",
";",
"}"
] | [
66,
1
] | [
68,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ControladoraHotel. | null | si le paso una reserva me devuelve el huesped que la reservó | si le paso una reserva me devuelve el huesped que la reservó | public Huesped dameHuepedReserva(Reserva reserva) {
//buscamos entre los huespedes el que tiene la reserva elegida
//1-traemos todos los huespedes y lo guardamos en una lista
//2-se crea una instancia nueva de huesped antes de empezar el for
//3-recorremos tda la lista de huespedes y luego recorremos
//4-la lista de reservas que tiene cada instancia de ese huesped
//5 se le asigna al objeto creado del tipo huesped, el huesped que tiene el numero de reserva buscado
List<Huesped> lista_huesped = traerHuesped();
Huesped huesped = new Huesped();
for (Huesped hues : lista_huesped) {
for (Reserva res : hues.getLista_reservas()) {
if (res.getNro_reserva() == reserva.getNro_reserva()) {
huesped = hues;
}
}
}
return huesped;
} | [
"public",
"Huesped",
"dameHuepedReserva",
"(",
"Reserva",
"reserva",
")",
"{",
"//buscamos entre los huespedes el que tiene la reserva elegida",
"//1-traemos todos los huespedes y lo guardamos en una lista",
"//2-se crea una instancia nueva de huesped antes de empezar el for",
"//3-recorremos tda la lista de huespedes y luego recorremos",
"//4-la lista de reservas que tiene cada instancia de ese huesped",
"//5 se le asigna al objeto creado del tipo huesped, el huesped que tiene el numero de reserva buscado",
"List",
"<",
"Huesped",
">",
"lista_huesped",
"=",
"traerHuesped",
"(",
")",
";",
"Huesped",
"huesped",
"=",
"new",
"Huesped",
"(",
")",
";",
"for",
"(",
"Huesped",
"hues",
":",
"lista_huesped",
")",
"{",
"for",
"(",
"Reserva",
"res",
":",
"hues",
".",
"getLista_reservas",
"(",
")",
")",
"{",
"if",
"(",
"res",
".",
"getNro_reserva",
"(",
")",
"==",
"reserva",
".",
"getNro_reserva",
"(",
")",
")",
"{",
"huesped",
"=",
"hues",
";",
"}",
"}",
"}",
"return",
"huesped",
";",
"}"
] | [
494,
4
] | [
511,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Imprimir. | null | Método para la impresión de la lista | Método para la impresión de la lista | public void imprimirListaLimpieza() {
crud.getStockLimpieza()
.stream()
.forEach(System.out::println);
} | [
"public",
"void",
"imprimirListaLimpieza",
"(",
")",
"{",
"crud",
".",
"getStockLimpieza",
"(",
")",
".",
"stream",
"(",
")",
".",
"forEach",
"(",
"System",
".",
"out",
"::",
"println",
")",
";",
"}"
] | [
20,
1
] | [
24,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ServletEventListener. | null | Se llama cuando se tira abajo la aplicacion (o se actualiza)
| Se llama cuando se tira abajo la aplicacion (o se actualiza)
| public void contextDestroyedWrapper()
{
BlobsCleaner.getInstance().contextDestroyed();
if (Application.isJMXEnabled())
{
com.genexus.management.MBeanUtils.unregisterObjects();
com.genexus.performance.MBeanUtils.unregisterObjects();
}
//Singletons
Application.gxCfg = null;
ModelContext.endModelContext();
LocalUtil.endLocalUtil();
Messages.endMessages();
ApplicationContext.endApplicationContext();
GXServices.endGXServices();
ClientPreferences.endClientPreferences();
PropertiesManager.endPropertiesManager();
Namespace.endNamespace();
DBConnectionManager.endDBConnectionManager();
BlobsCleaner.endBlobCleaner();
NativeFunctions.endNativeFunctions();
com.genexus.reports.fonts.TrueTypeFontCache.cleanup();
CommonUtil.threadCalendar = null;
GXutil.threadTimeZone = null;
ClientContext.setLocalUtil(null);
ClientContext.setModelContext(null);
SubmitThreadPool.waitForEnd();
//Desregistro los JDBC drivers para que no tire Tomcat el mensaje que los va a desregistrar para evitar un memory leak
ClassLoader cl = Thread.currentThread().getContextClassLoader();
Enumeration<Driver> drivers = DriverManager.getDrivers();
while (drivers.hasMoreElements())
{
Driver driver = drivers.nextElement();
if (driver.getClass().getClassLoader() == cl)
{
try
{
DriverManager.deregisterDriver(driver);
}
catch (SQLException e)
{
System.out.println(String.format("Error deregistering driver %s", driver));
}
}
}
//Para que libere la memoria de las clases cargadas en el classloader y no se sature el PermGen.
System.gc();
} | [
"public",
"void",
"contextDestroyedWrapper",
"(",
")",
"{",
"BlobsCleaner",
".",
"getInstance",
"(",
")",
".",
"contextDestroyed",
"(",
")",
";",
"if",
"(",
"Application",
".",
"isJMXEnabled",
"(",
")",
")",
"{",
"com",
".",
"genexus",
".",
"management",
".",
"MBeanUtils",
".",
"unregisterObjects",
"(",
")",
";",
"com",
".",
"genexus",
".",
"performance",
".",
"MBeanUtils",
".",
"unregisterObjects",
"(",
")",
";",
"}",
"//Singletons",
"Application",
".",
"gxCfg",
"=",
"null",
";",
"ModelContext",
".",
"endModelContext",
"(",
")",
";",
"LocalUtil",
".",
"endLocalUtil",
"(",
")",
";",
"Messages",
".",
"endMessages",
"(",
")",
";",
"ApplicationContext",
".",
"endApplicationContext",
"(",
")",
";",
"GXServices",
".",
"endGXServices",
"(",
")",
";",
"ClientPreferences",
".",
"endClientPreferences",
"(",
")",
";",
"PropertiesManager",
".",
"endPropertiesManager",
"(",
")",
";",
"Namespace",
".",
"endNamespace",
"(",
")",
";",
"DBConnectionManager",
".",
"endDBConnectionManager",
"(",
")",
";",
"BlobsCleaner",
".",
"endBlobCleaner",
"(",
")",
";",
"NativeFunctions",
".",
"endNativeFunctions",
"(",
")",
";",
"com",
".",
"genexus",
".",
"reports",
".",
"fonts",
".",
"TrueTypeFontCache",
".",
"cleanup",
"(",
")",
";",
"CommonUtil",
".",
"threadCalendar",
"=",
"null",
";",
"GXutil",
".",
"threadTimeZone",
"=",
"null",
";",
"ClientContext",
".",
"setLocalUtil",
"(",
"null",
")",
";",
"ClientContext",
".",
"setModelContext",
"(",
"null",
")",
";",
"SubmitThreadPool",
".",
"waitForEnd",
"(",
")",
";",
"//Desregistro los JDBC drivers para que no tire Tomcat el mensaje que los va a desregistrar para evitar un memory leak",
"ClassLoader",
"cl",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
";",
"Enumeration",
"<",
"Driver",
">",
"drivers",
"=",
"DriverManager",
".",
"getDrivers",
"(",
")",
";",
"while",
"(",
"drivers",
".",
"hasMoreElements",
"(",
")",
")",
"{",
"Driver",
"driver",
"=",
"drivers",
".",
"nextElement",
"(",
")",
";",
"if",
"(",
"driver",
".",
"getClass",
"(",
")",
".",
"getClassLoader",
"(",
")",
"==",
"cl",
")",
"{",
"try",
"{",
"DriverManager",
".",
"deregisterDriver",
"(",
"driver",
")",
";",
"}",
"catch",
"(",
"SQLException",
"e",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"String",
".",
"format",
"(",
"\"Error deregistering driver %s\"",
",",
"driver",
")",
")",
";",
"}",
"}",
"}",
"//Para que libere la memoria de las clases cargadas en el classloader y no se sature el PermGen.",
"System",
".",
"gc",
"(",
")",
";",
"}"
] | [
21,
1
] | [
72,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
BaseDeDatos. | null | actualizar llamado de un registro. | actualizar llamado de un registro. | public void actualizarRegistro(boolean llamado, int codRegistro, int cod_lugar) {
try {
//Variable para el codigo sql
String codSql;
//Crea un objeto SQLServerStatement que genera objetos.
Statement consulta = conexion.createStatement();
//Guardamos la consulta a realizar en una variable.
codSql = "update REGISTRO set llamado = '" + llamado + "', COD_LUGAR = " + cod_lugar + " where cod_registro = " + codRegistro;
//La mostramos en consola y la ejecutamos.
System.out.println(codSql);
consulta.executeUpdate(codSql);
} catch (Exception ex) {
//DO SOMETHING.
}
} | [
"public",
"void",
"actualizarRegistro",
"(",
"boolean",
"llamado",
",",
"int",
"codRegistro",
",",
"int",
"cod_lugar",
")",
"{",
"try",
"{",
"//Variable para el codigo sql",
"String",
"codSql",
";",
"//Crea un objeto SQLServerStatement que genera objetos.",
"Statement",
"consulta",
"=",
"conexion",
".",
"createStatement",
"(",
")",
";",
"//Guardamos la consulta a realizar en una variable.",
"codSql",
"=",
"\"update REGISTRO set llamado = '\"",
"+",
"llamado",
"+",
"\"', COD_LUGAR = \"",
"+",
"cod_lugar",
"+",
"\" where cod_registro = \"",
"+",
"codRegistro",
";",
"//La mostramos en consola y la ejecutamos.",
"System",
".",
"out",
".",
"println",
"(",
"codSql",
")",
";",
"consulta",
".",
"executeUpdate",
"(",
"codSql",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"//DO SOMETHING.",
"}",
"}"
] | [
100,
4
] | [
117,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Clasico. | null | Acá se le asigna a la ruedita para que abra la Actividad "Configuración" | Acá se le asigna a la ruedita para que abra la Actividad "Configuración" | private void openNewActivity() {
//Hago true la variable clasicoACtiva para saber que entré a configuración desde clásico y no desde continuo
actividad = this;
clasicoActiva = true;
Intent intent = new Intent(Clasico.this, Configuracion.class);
startActivity(intent);
} | [
"private",
"void",
"openNewActivity",
"(",
")",
"{",
"//Hago true la variable clasicoACtiva para saber que entré a configuración desde clásico y no desde continuo",
"actividad",
"=",
"this",
";",
"clasicoActiva",
"=",
"true",
";",
"Intent",
"intent",
"=",
"new",
"Intent",
"(",
"Clasico",
".",
"this",
",",
"Configuracion",
".",
"class",
")",
";",
"startActivity",
"(",
"intent",
")",
";",
"}"
] | [
75,
4
] | [
81,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ControladoraHotel. | null | si hay una interseccion entre las fechas ( segmento en comun) devuleve true | si hay una interseccion entre las fechas ( segmento en comun) devuleve true | private boolean hayInterseccionFechas(Date fecha_averiguar_inicio, Date fecha_averiguar_fin, Date fecha_ocupado_inicio, Date 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))) {
return false;
} else {
return true;
}
} | [
"private",
"boolean",
"hayInterseccionFechas",
"(",
"Date",
"fecha_averiguar_inicio",
",",
"Date",
"fecha_averiguar_fin",
",",
"Date",
"fecha_ocupado_inicio",
",",
"Date",
"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",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"return",
"true",
";",
"}",
"}"
] | [
561,
4
] | [
575,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
AnimesApiResource. | null | Método que actualiza una noticia de un anime | Método que actualiza una noticia de un anime | @PUT
@Path("/noticia/{idAnime}")
@Consumes("application/json")
public Response updateNoticiaAnime(@PathParam("idAnime") String idAnime, Noticia noticia) {
Noticia oldNoticia = repository.getNoticiaById(noticia.getId());
if (oldNoticia == null) {
throw new NotFoundException("La noticia no fue encontrada");
}
else {
repository.updateNoticiaAnime(idAnime, noticia);
}
return Response.noContent().build();
} | [
"@",
"PUT",
"@",
"Path",
"(",
"\"/noticia/{idAnime}\"",
")",
"@",
"Consumes",
"(",
"\"application/json\"",
")",
"public",
"Response",
"updateNoticiaAnime",
"(",
"@",
"PathParam",
"(",
"\"idAnime\"",
")",
"String",
"idAnime",
",",
"Noticia",
"noticia",
")",
"{",
"Noticia",
"oldNoticia",
"=",
"repository",
".",
"getNoticiaById",
"(",
"noticia",
".",
"getId",
"(",
")",
")",
";",
"if",
"(",
"oldNoticia",
"==",
"null",
")",
"{",
"throw",
"new",
"NotFoundException",
"(",
"\"La noticia no fue encontrada\"",
")",
";",
"}",
"else",
"{",
"repository",
".",
"updateNoticiaAnime",
"(",
"idAnime",
",",
"noticia",
")",
";",
"}",
"return",
"Response",
".",
"noContent",
"(",
")",
".",
"build",
"(",
")",
";",
"}"
] | [
141,
1
] | [
153,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
MainActivity. | null | Necesario para el menu pop-up. | Necesario para el menu pop-up. | @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_menu_principal);
} | [
"@",
"Override",
"protected",
"void",
"onCreate",
"(",
"Bundle",
"savedInstanceState",
")",
"{",
"super",
".",
"onCreate",
"(",
"savedInstanceState",
")",
";",
"setContentView",
"(",
"R",
".",
"layout",
".",
"layout_menu_principal",
")",
";",
"}"
] | [
37,
4
] | [
41,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
PDFReportItext. | null | Carga la tabla de substitutos
| Carga la tabla de substitutos
| private void loadSubstituteTable()
{
// Primero leemos la tabla de substitutos del Registry
Hashtable<String, Vector<String>> tempInverseMappings = new Hashtable<>();
// Seteo algunos Mappings que Acrobat toma como Type1
for(int i = 0; i < Const.FONT_SUBSTITUTES_TTF_TYPE1.length; i++)
fontSubstitutes.put(Const.FONT_SUBSTITUTES_TTF_TYPE1[i][0], Const.FONT_SUBSTITUTES_TTF_TYPE1[i][1]);
// Ahora inserto los mappings extra del PDFReport.INI (si es que hay)
// Los font substitutes del PDFReport.INI se encuentran bajo la seccion
// indicada por Const.FONT_SUBSTITUTES_SECTION y son pares oldFont -> newFont
Hashtable otherMappings = props.getSection(Const.FONT_SUBSTITUTES_SECTION);
if(otherMappings != null)
for(Enumeration enumera = otherMappings.keys(); enumera.hasMoreElements();)
{
String fontName = (String)enumera.nextElement();
fontSubstitutes.put(fontName, (String)otherMappings.get(fontName));
if(tempInverseMappings.containsKey(fontName)) // Con esto solucionamos el tema de la recursión de Fonts -> Fonts
{ // x ej: Si tenú} Font1-> Font2, y ahora tengo Font2->Font3, pongo cambio el 1º por Font1->Font3
String fontSubstitute = (String)otherMappings.get(fontName);
for(Enumeration<String> enum2 = tempInverseMappings.get(fontName).elements(); enum2.hasMoreElements();)
fontSubstitutes.put(enum2.nextElement(), fontSubstitute);
}
}
} | [
"private",
"void",
"loadSubstituteTable",
"(",
")",
"{",
"// Primero leemos la tabla de substitutos del Registry",
"Hashtable",
"<",
"String",
",",
"Vector",
"<",
"String",
">",
">",
"tempInverseMappings",
"=",
"new",
"Hashtable",
"<>",
"(",
")",
";",
"// Seteo algunos Mappings que Acrobat toma como Type1",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"Const",
".",
"FONT_SUBSTITUTES_TTF_TYPE1",
".",
"length",
";",
"i",
"++",
")",
"fontSubstitutes",
".",
"put",
"(",
"Const",
".",
"FONT_SUBSTITUTES_TTF_TYPE1",
"[",
"i",
"]",
"[",
"0",
"]",
"",
",",
"Const",
".",
"FONT_SUBSTITUTES_TTF_TYPE1",
"[",
"i",
"]",
"[",
"1",
"]",
")",
";",
"// Ahora inserto los mappings extra del PDFReport.INI (si es que hay)",
"// Los font substitutes del PDFReport.INI se encuentran bajo la seccion",
"// indicada por Const.FONT_SUBSTITUTES_SECTION y son pares oldFont -> newFont",
"Hashtable",
"otherMappings",
"=",
"props",
".",
"getSection",
"(",
"Const",
".",
"FONT_SUBSTITUTES_SECTION",
")",
";",
"if",
"(",
"otherMappings",
"!=",
"null",
")",
"for",
"(",
"Enumeration",
"enumera",
"=",
"otherMappings",
".",
"keys",
"(",
")",
";",
"enumera",
".",
"hasMoreElements",
"(",
")",
";",
")",
"{",
"String",
"fontName",
"=",
"(",
"String",
")",
"enumera",
".",
"nextElement",
"(",
")",
";",
"fontSubstitutes",
".",
"put",
"(",
"fontName",
",",
"(",
"String",
")",
"otherMappings",
".",
"get",
"(",
"fontName",
")",
")",
";",
"if",
"(",
"tempInverseMappings",
".",
"containsKey",
"(",
"fontName",
")",
")",
"// Con esto solucionamos el tema de la recursión de Fonts -> Fonts",
"{",
"// x ej: Si tenú} Font1-> Font2, y ahora tengo Font2->Font3, pongo cambio el 1º por Font1->Font3",
"String",
"fontSubstitute",
"=",
"(",
"String",
")",
"otherMappings",
".",
"get",
"(",
"fontName",
")",
";",
"for",
"(",
"Enumeration",
"<",
"String",
">",
"enum2",
"=",
"tempInverseMappings",
".",
"get",
"(",
"fontName",
")",
".",
"elements",
"(",
")",
";",
"enum2",
".",
"hasMoreElements",
"(",
")",
";",
")",
"fontSubstitutes",
".",
"put",
"(",
"enum2",
".",
"nextElement",
"(",
")",
"",
",",
"fontSubstitute",
")",
";",
"}",
"}",
"}"
] | [
2054,
4
] | [
2079,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Warrior. | null | cuando vamos a jugar un nivel los personajes tienen stacks predeterminados | cuando vamos a jugar un nivel los personajes tienen stacks predeterminados | @Override
public void upgrade(int level){
System.out.println("Level adfasdfasdf: " + level);
System.out.println(getLevel());
if(level > 5) level = 5;
if(level > 1){
for (int i = 1; i < level; i++) levelUp();
}
/*
//System.out.println("\n-------");
//System.out.println("Se va a aumentar: " + getName() + "Stacks actuales: Health" + getHealth() + " range: " + range + " stroke" + strokePerTime+ " speed: " + getSeep());
double percentage = growth(level);
setHealth((int) (getHealth() + getHealth() * percentage));
strokePerTime = (int) (strokePerTime + strokePerTime * percentage);
// Aumenta el rango si el nivel es 3 o 5
// Luego quedan muy rotos xD
if (level % 2 != 0) range++;
//System.out.println("resultado: " + getName() + "Stacks actuales: Health" + getHealth() + " range: " + range + " stroke" + strokePerTime+ " speed: " + getSeep());
//System.out.println("-------\n");*/
} | [
"@",
"Override",
"public",
"void",
"upgrade",
"(",
"int",
"level",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Level adfasdfasdf: \"",
"+",
"level",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"getLevel",
"(",
")",
")",
";",
"if",
"(",
"level",
">",
"5",
")",
"level",
"=",
"5",
";",
"if",
"(",
"level",
">",
"1",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"level",
";",
"i",
"++",
")",
"levelUp",
"(",
")",
";",
"}",
"/*\n //System.out.println(\"\\n-------\");\n //System.out.println(\"Se va a aumentar: \" + getName() + \"Stacks actuales: Health\" + getHealth() + \" range: \" + range + \" stroke\" + strokePerTime+ \" speed: \" + getSeep());\n\n double percentage = growth(level);\n\n setHealth((int) (getHealth() + getHealth() * percentage));\n strokePerTime = (int) (strokePerTime + strokePerTime * percentage);\n\n // Aumenta el rango si el nivel es 3 o 5\n // Luego quedan muy rotos xD\n if (level % 2 != 0) range++;\n\n //System.out.println(\"resultado: \" + getName() + \"Stacks actuales: Health\" + getHealth() + \" range: \" + range + \" stroke\" + strokePerTime+ \" speed: \" + getSeep());\n //System.out.println(\"-------\\n\");*/",
"}"
] | [
123,
4
] | [
149,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Registro. | null | Getter para RegistroReservaciones por posición | Getter para RegistroReservaciones por posición | public Reservacion getReservacion(int Posicion)
{
return RegistroReservaciones.get(Posicion);
} | [
"public",
"Reservacion",
"getReservacion",
"(",
"int",
"Posicion",
")",
"{",
"return",
"RegistroReservaciones",
".",
"get",
"(",
"Posicion",
")",
";",
"}"
] | [
272,
4
] | [
275,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CrudProducto. | null | /*Pasamos un producto y una posición y se añade dicho producto en dicha posición.
Ojo, porque no se comprueba nada, se pierde lo que había | /*Pasamos un producto y una posición y se añade dicho producto en dicha posición.
Ojo, porque no se comprueba nada, se pierde lo que había | public void add(Producto p, int posicion) {
lista[posicion]=p;
} | [
"public",
"void",
"add",
"(",
"Producto",
"p",
",",
"int",
"posicion",
")",
"{",
"lista",
"[",
"posicion",
"]",
"=",
"p",
";",
"}"
] | [
28,
1
] | [
30,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Table. | null | Solo filas de datos, no incluye la cabecera | Solo filas de datos, no incluye la cabecera | public int getRowCount() {
return (table.size());
} | [
"public",
"int",
"getRowCount",
"(",
")",
"{",
"return",
"(",
"table",
".",
"size",
"(",
")",
")",
";",
"}"
] | [
285,
1
] | [
287,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
GXSmartCacheProvider. | null | Carga el mapping de query -> tablas que utiliza | Carga el mapping de query -> tablas que utiliza | public static ConcurrentHashMap<String, Vector<String>> queryTables()
{
return provider.queryTables();
} | [
"public",
"static",
"ConcurrentHashMap",
"<",
"String",
",",
"Vector",
"<",
"String",
">",
">",
"queryTables",
"(",
")",
"{",
"return",
"provider",
".",
"queryTables",
"(",
")",
";",
"}"
] | [
72,
1
] | [
76,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
SubProgramas. | null | Calcula la potencia de cualquier numero | Calcula la potencia de cualquier numero | public double potencia(int x, int i) {
return Math.pow(x, i);
} | [
"public",
"double",
"potencia",
"(",
"int",
"x",
",",
"int",
"i",
")",
"{",
"return",
"Math",
".",
"pow",
"(",
"x",
",",
"i",
")",
";",
"}"
] | [
31,
4
] | [
33,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Clasico. | null | Adentró de este método, "onCreate" se pone todo lo que se produce durante la creación de la actividad. Es decir cuando se crea la pantalla. | Adentró de este método, "onCreate" se pone todo lo que se produce durante la creación de la actividad. Es decir cuando se crea la pantalla. | @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Elegir tema (Colores)
//En SharedPReference se guardan las cosas que el usuario elije en la pestaña configuración. Las tomo y defino si el tema
//es modo claro o moso oscuro
SharedPreferences sharedPreferences =
PreferenceManager.getDefaultSharedPreferences(this /* Activity context */);
boolean modoOscuro = sharedPreferences.getBoolean("ModoOscuro", false);
if (modoOscuro){
this.setTheme(R.style.TemaOscuro);}
else{
this.setTheme(R.style.TemaClaro);
}
//Acá se toma como pantalla lo que está configurado en el archivo clasico.xml
setContentView(R.layout.clasico);
//En el caso de que el modo sea oscuro, le pongo fondo negro al texto.
if (modoOscuro) {
findViewById(R.id.marco_texto_secuencial).setBackgroundColor(getResources().getColor(R.color.negro));
}
//Configuración del texto de abajo de la barra. En caso de que sea modo claro, le pongo color blanco
textoBarra= findViewById(R.id.texto_barra2);
textoBarra.setText("Deslice la barra para cambiar el tamaño de la letra");
if (!modoOscuro) {
textoBarra.setTextColor(getResources().getColor(R.color.blanco));
;
}
// Cargo texto principal
resultView = findViewById(R.id.result_text2);
resultView.setText(R.string.ready);
// Le asigno a la barra desplegable que modifique el tamaño del texto
sB = findViewById(R.id.seekBar2);
sB.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
@Override
public void onProgressChanged(SeekBar seekBar, int i, boolean b) {
seekValue = 3*i+30; //Calibración a ojo del tamaño de letra para que vaya de 20 a 60
resultView.setTextSize(seekValue);
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
resultView.setTextSize(seekValue);
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
resultView.setTextSize(seekValue);
}
});
// Le asigno al botón de la izqueirda que cierre tescucho secuencial y que abra tescucuho continuo
FloatingActionButton fab = findViewById(R.id.ir_a_continuo);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent2 = new Intent(v.getContext(), KaldiActivity.class);
finish();
startActivityForResult(intent2, 0);
}
});
//Le asigno a los botones de las orejas un nombre.
botonEscuchar = findViewById(R.id.recognize_mic);
botoRojo = findViewById(R.id.recognize_mic_rojo);
/* Configuración del reconocimiento de voz de google - Todo copiado de youtube */
speechRecognizer = SpeechRecognizer.createSpeechRecognizer(Clasico.this);
speechRecognizerIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
speechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
speechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_PARTIAL_RESULTS, true);
speechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS, 3000);
//speechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS, 5000);
//speechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_PREFER_OFFLINE, true);
speechRecognizer.setRecognitionListener(new RecognitionListener() {
@Override
public void onReadyForSpeech(Bundle bundle) {
}
@Override
//Al principio del reconocimiento borro el texto principal
public void onBeginningOfSpeech() {
resultView.setText("");
}
@Override
public void onRmsChanged(float v) {
Log.d("ACA", "onRmsChanged: ");
}
@Override
public void onBufferReceived(byte[] bytes) {
}
@Override
public void onEndOfSpeech() {
Log.d("ACA", "onEndOfSpeech: ACA");
}
@Override
public void onError(int i) {
resultView.setText("No se ha escuchado ningún mensaje");
Vibrator vibrator3 = (Vibrator) getSystemService(VIBRATOR_SERVICE);
botoRojo.setVisibility(View.INVISIBLE);
botonEscuchar.setVisibility(View.VISIBLE);
vibrator3.vibrate(150);
}
@Override
//Método ejecutado cuando se termina de escuchar. Se hace vibrar al teléfono y se cambian los íconos
public void onResults(Bundle bundle) {
Vibrator vibrator3 = (Vibrator) getSystemService(VIBRATOR_SERVICE);
botoRojo.setVisibility(View.INVISIBLE);
botonEscuchar.setVisibility(View.VISIBLE);
vibrator3.vibrate(150);
}
@Override
// Método ejecutado cuando hay resultados parciales. Tomo los resultados y los pongo en la pantalla principal
public void onPartialResults(Bundle bundle) {
ArrayList<String> texto = bundle.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
if(texto != null){
resultView.setText(texto.get(0).toUpperCase());
}
}
@Override
public void onEvent(int i, Bundle bundle) {
}
});
} | [
"@",
"Override",
"protected",
"void",
"onCreate",
"(",
"Bundle",
"savedInstanceState",
")",
"{",
"super",
".",
"onCreate",
"(",
"savedInstanceState",
")",
";",
"//Elegir tema (Colores)",
"//En SharedPReference se guardan las cosas que el usuario elije en la pestaña configuración. Las tomo y defino si el tema",
"//es modo claro o moso oscuro",
"SharedPreferences",
"sharedPreferences",
"=",
"PreferenceManager",
".",
"getDefaultSharedPreferences",
"(",
"this",
"/* Activity context */",
")",
";",
"boolean",
"modoOscuro",
"=",
"sharedPreferences",
".",
"getBoolean",
"(",
"\"ModoOscuro\"",
",",
"false",
")",
";",
"if",
"(",
"modoOscuro",
")",
"{",
"this",
".",
"setTheme",
"(",
"R",
".",
"style",
".",
"TemaOscuro",
")",
";",
"}",
"else",
"{",
"this",
".",
"setTheme",
"(",
"R",
".",
"style",
".",
"TemaClaro",
")",
";",
"}",
"//Acá se toma como pantalla lo que está configurado en el archivo clasico.xml",
"setContentView",
"(",
"R",
".",
"layout",
".",
"clasico",
")",
";",
"//En el caso de que el modo sea oscuro, le pongo fondo negro al texto.",
"if",
"(",
"modoOscuro",
")",
"{",
"findViewById",
"(",
"R",
".",
"id",
".",
"marco_texto_secuencial",
")",
".",
"setBackgroundColor",
"(",
"getResources",
"(",
")",
".",
"getColor",
"(",
"R",
".",
"color",
".",
"negro",
")",
")",
";",
"}",
"//Configuración del texto de abajo de la barra. En caso de que sea modo claro, le pongo color blanco",
"textoBarra",
"=",
"findViewById",
"(",
"R",
".",
"id",
".",
"texto_barra2",
")",
";",
"textoBarra",
".",
"setText",
"(",
"\"Deslice la barra para cambiar el tamaño de la letra\")",
";",
"",
"if",
"(",
"!",
"modoOscuro",
")",
"{",
"textoBarra",
".",
"setTextColor",
"(",
"getResources",
"(",
")",
".",
"getColor",
"(",
"R",
".",
"color",
".",
"blanco",
")",
")",
";",
";",
"}",
"// Cargo texto principal",
"resultView",
"=",
"findViewById",
"(",
"R",
".",
"id",
".",
"result_text2",
")",
";",
"resultView",
".",
"setText",
"(",
"R",
".",
"string",
".",
"ready",
")",
";",
"// Le asigno a la barra desplegable que modifique el tamaño del texto",
"sB",
"=",
"findViewById",
"(",
"R",
".",
"id",
".",
"seekBar2",
")",
";",
"sB",
".",
"setOnSeekBarChangeListener",
"(",
"new",
"SeekBar",
".",
"OnSeekBarChangeListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onProgressChanged",
"(",
"SeekBar",
"seekBar",
",",
"int",
"i",
",",
"boolean",
"b",
")",
"{",
"seekValue",
"=",
"3",
"*",
"i",
"+",
"30",
";",
"//Calibración a ojo del tamaño de letra para que vaya de 20 a 60",
"resultView",
".",
"setTextSize",
"(",
"seekValue",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"onStartTrackingTouch",
"(",
"SeekBar",
"seekBar",
")",
"{",
"resultView",
".",
"setTextSize",
"(",
"seekValue",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"onStopTrackingTouch",
"(",
"SeekBar",
"seekBar",
")",
"{",
"resultView",
".",
"setTextSize",
"(",
"seekValue",
")",
";",
"}",
"}",
")",
";",
"// Le asigno al botón de la izqueirda que cierre tescucho secuencial y que abra tescucuho continuo",
"FloatingActionButton",
"fab",
"=",
"findViewById",
"(",
"R",
".",
"id",
".",
"ir_a_continuo",
")",
";",
"fab",
".",
"setOnClickListener",
"(",
"new",
"View",
".",
"OnClickListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onClick",
"(",
"View",
"v",
")",
"{",
"Intent",
"intent2",
"=",
"new",
"Intent",
"(",
"v",
".",
"getContext",
"(",
")",
",",
"KaldiActivity",
".",
"class",
")",
";",
"finish",
"(",
")",
";",
"startActivityForResult",
"(",
"intent2",
",",
"0",
")",
";",
"}",
"}",
")",
";",
"//Le asigno a los botones de las orejas un nombre.",
"botonEscuchar",
"=",
"findViewById",
"(",
"R",
".",
"id",
".",
"recognize_mic",
")",
";",
"botoRojo",
"=",
"findViewById",
"(",
"R",
".",
"id",
".",
"recognize_mic_rojo",
")",
";",
"/* Configuración del reconocimiento de voz de google - Todo copiado de youtube */",
"speechRecognizer",
"=",
"SpeechRecognizer",
".",
"createSpeechRecognizer",
"(",
"Clasico",
".",
"this",
")",
";",
"speechRecognizerIntent",
"=",
"new",
"Intent",
"(",
"RecognizerIntent",
".",
"ACTION_RECOGNIZE_SPEECH",
")",
";",
"speechRecognizerIntent",
".",
"putExtra",
"(",
"RecognizerIntent",
".",
"EXTRA_LANGUAGE_MODEL",
",",
"RecognizerIntent",
".",
"LANGUAGE_MODEL_FREE_FORM",
")",
";",
"speechRecognizerIntent",
".",
"putExtra",
"(",
"RecognizerIntent",
".",
"EXTRA_PARTIAL_RESULTS",
",",
"true",
")",
";",
"speechRecognizerIntent",
".",
"putExtra",
"(",
"RecognizerIntent",
".",
"EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS",
",",
"3000",
")",
";",
"//speechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS, 5000);",
"//speechRecognizerIntent.putExtra(RecognizerIntent.EXTRA_PREFER_OFFLINE, true);",
"speechRecognizer",
".",
"setRecognitionListener",
"(",
"new",
"RecognitionListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onReadyForSpeech",
"(",
"Bundle",
"bundle",
")",
"{",
"}",
"@",
"Override",
"//Al principio del reconocimiento borro el texto principal",
"public",
"void",
"onBeginningOfSpeech",
"(",
")",
"{",
"resultView",
".",
"setText",
"(",
"\"\"",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"onRmsChanged",
"(",
"float",
"v",
")",
"{",
"Log",
".",
"d",
"(",
"\"ACA\"",
",",
"\"onRmsChanged: \"",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"onBufferReceived",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"}",
"@",
"Override",
"public",
"void",
"onEndOfSpeech",
"(",
")",
"{",
"Log",
".",
"d",
"(",
"\"ACA\"",
",",
"\"onEndOfSpeech: ACA\"",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"onError",
"(",
"int",
"i",
")",
"{",
"resultView",
".",
"setText",
"(",
"\"No se ha escuchado ningún mensaje\")",
";",
"",
"Vibrator",
"vibrator3",
"=",
"(",
"Vibrator",
")",
"getSystemService",
"(",
"VIBRATOR_SERVICE",
")",
";",
"botoRojo",
".",
"setVisibility",
"(",
"View",
".",
"INVISIBLE",
")",
";",
"botonEscuchar",
".",
"setVisibility",
"(",
"View",
".",
"VISIBLE",
")",
";",
"vibrator3",
".",
"vibrate",
"(",
"150",
")",
";",
"}",
"@",
"Override",
"//Método ejecutado cuando se termina de escuchar. Se hace vibrar al teléfono y se cambian los íconos",
"public",
"void",
"onResults",
"(",
"Bundle",
"bundle",
")",
"{",
"Vibrator",
"vibrator3",
"=",
"(",
"Vibrator",
")",
"getSystemService",
"(",
"VIBRATOR_SERVICE",
")",
";",
"botoRojo",
".",
"setVisibility",
"(",
"View",
".",
"INVISIBLE",
")",
";",
"botonEscuchar",
".",
"setVisibility",
"(",
"View",
".",
"VISIBLE",
")",
";",
"vibrator3",
".",
"vibrate",
"(",
"150",
")",
";",
"}",
"@",
"Override",
"// Método ejecutado cuando hay resultados parciales. Tomo los resultados y los pongo en la pantalla principal",
"public",
"void",
"onPartialResults",
"(",
"Bundle",
"bundle",
")",
"{",
"ArrayList",
"<",
"String",
">",
"texto",
"=",
"bundle",
".",
"getStringArrayList",
"(",
"SpeechRecognizer",
".",
"RESULTS_RECOGNITION",
")",
";",
"if",
"(",
"texto",
"!=",
"null",
")",
"{",
"resultView",
".",
"setText",
"(",
"texto",
".",
"get",
"(",
"0",
")",
".",
"toUpperCase",
"(",
")",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"void",
"onEvent",
"(",
"int",
"i",
",",
"Bundle",
"bundle",
")",
"{",
"}",
"}",
")",
";",
"}"
] | [
85,
4
] | [
242,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Alarma. | null | Porque id es el unico parametro que no esta en el constructor | Porque id es el unico parametro que no esta en el constructor | public void setId(int id) {
this.id = id;
} | [
"public",
"void",
"setId",
"(",
"int",
"id",
")",
"{",
"this",
".",
"id",
"=",
"id",
";",
"}"
] | [
42,
4
] | [
44,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.