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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CastManager. | null | Control de reproducción del video en la pantalla remota | Control de reproducción del video en la pantalla remota | @Override
public void onSuccess(MediaControl.PlayStateStatus playState) {
switch (playState) {
case Playing:
log("PlayStateStatus: playing");
break;
case Finished:
log("PlayStateStatus: finished");
NotificationsHelper.cancelNotification(context);
for (Map.Entry<String, PlayStatusListener> playStatusListener : playStatusListeners.entrySet()) {
playStatusListener.getValue()
.onPlayStatusChanged(PlayStatusListener.STATUS_FINISHED);
}
mediaObject = null;
break;
case Buffering:
log("PlayStateStatus: buffering");
break;
case Idle:
log("PlayStateStatus: idle");
break;
case Paused:
log("PlayStateStatus: paused");
for (Map.Entry<String, PlayStatusListener> playStatusListener : playStatusListeners.entrySet()) {
playStatusListener.getValue()
.onPlayStatusChanged(PlayStatusListener.STATUS_PAUSED);
}
statusStartPlayingFired = true;
break;
case Unknown:
log("PlayStateStatus: unknown");
break;
}
} | [
"@",
"Override",
"public",
"void",
"onSuccess",
"(",
"MediaControl",
".",
"PlayStateStatus",
"playState",
")",
"{",
"switch",
"(",
"playState",
")",
"{",
"case",
"Playing",
":",
"log",
"(",
"\"PlayStateStatus: playing\"",
")",
";",
"break",
";",
"case",
"Finished",
":",
"log",
"(",
"\"PlayStateStatus: finished\"",
")",
";",
"NotificationsHelper",
".",
"cancelNotification",
"(",
"context",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"PlayStatusListener",
">",
"playStatusListener",
":",
"playStatusListeners",
".",
"entrySet",
"(",
")",
")",
"{",
"playStatusListener",
".",
"getValue",
"(",
")",
".",
"onPlayStatusChanged",
"(",
"PlayStatusListener",
".",
"STATUS_FINISHED",
")",
";",
"}",
"mediaObject",
"=",
"null",
";",
"break",
";",
"case",
"Buffering",
":",
"log",
"(",
"\"PlayStateStatus: buffering\"",
")",
";",
"break",
";",
"case",
"Idle",
":",
"log",
"(",
"\"PlayStateStatus: idle\"",
")",
";",
"break",
";",
"case",
"Paused",
":",
"log",
"(",
"\"PlayStateStatus: paused\"",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"PlayStatusListener",
">",
"playStatusListener",
":",
"playStatusListeners",
".",
"entrySet",
"(",
")",
")",
"{",
"playStatusListener",
".",
"getValue",
"(",
")",
".",
"onPlayStatusChanged",
"(",
"PlayStatusListener",
".",
"STATUS_PAUSED",
")",
";",
"}",
"statusStartPlayingFired",
"=",
"true",
";",
"break",
";",
"case",
"Unknown",
":",
"log",
"(",
"\"PlayStateStatus: unknown\"",
")",
";",
"break",
";",
"}",
"}"
] | [
650,
4
] | [
688,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CropOverlayView. | null | Se llama para determinar los requisitos de tamaño para esta vista
| Se llama para determinar los requisitos de tamaño para esta vista
| @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
} | [
"@",
"Override",
"protected",
"void",
"onMeasure",
"(",
"int",
"widthMeasureSpec",
",",
"int",
"heightMeasureSpec",
")",
"{",
"super",
".",
"onMeasure",
"(",
"widthMeasureSpec",
",",
"heightMeasureSpec",
")",
";",
"}"
] | [
129,
4
] | [
132,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
DialogoEstadisticas. | null | Detecta la opción que se ha pulsado y ejecuta la acción correspondiente | Detecta la opción que se ha pulsado y ejecuta la acción correspondiente | @Override
public void actionPerformed(ActionEvent evento) {
// TAREA 2: identifica el equipo que se ha seleccionado, obtiene las estadísticas de sus jugadores y
// las muestra en la area de texto
String equipoSeleccionado = equipos.getSelectedItem().toString();
try {
areaTexto.setText(estaBBDD.selectEstadisticas(equipoSeleccionado));
} catch (SQLException e) {
JDialog error = new JDialog(dialogo, "Ha ocurrido un error SQL: " + e.getMessage());
} catch (Exception e) {
JDialog error = new JDialog(dialogo, "Ha ocurrido un error: " + e.getMessage());
}
} | [
"@",
"Override",
"public",
"void",
"actionPerformed",
"(",
"ActionEvent",
"evento",
")",
"{",
"// TAREA 2: identifica el equipo que se ha seleccionado, obtiene las estadísticas de sus jugadores y\r",
"// las muestra en la area de texto\r",
"String",
"equipoSeleccionado",
"=",
"equipos",
".",
"getSelectedItem",
"(",
")",
".",
"toString",
"(",
")",
";",
"try",
"{",
"areaTexto",
".",
"setText",
"(",
"estaBBDD",
".",
"selectEstadisticas",
"(",
"equipoSeleccionado",
")",
")",
";",
"}",
"catch",
"(",
"SQLException",
"e",
")",
"{",
"JDialog",
"error",
"=",
"new",
"JDialog",
"(",
"dialogo",
",",
"\"Ha ocurrido un error SQL: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"JDialog",
"error",
"=",
"new",
"JDialog",
"(",
"dialogo",
",",
"\"Ha ocurrido un error: \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}"
] | [
58,
3
] | [
73,
4
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
PanelF. | null | Metodo que deibuja un obejto a medida que recorre el array | Metodo que deibuja un obejto a medida que recorre el array | public void paint(Graphics g)
{
Dibujable dib;
// mientras que estemos recoriendoel array de objetos , lo dibujaremos
for(int j = 0;j<v.size();j++) {
// casteamos el objeto dibujable para que sea dibujado
dib = (Dibujable)v.get(j);
}
} | [
"public",
"void",
"paint",
"(",
"Graphics",
"g",
")",
"{",
"Dibujable",
"dib",
";",
"// mientras que estemos recoriendoel array de objetos , lo dibujaremos",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"v",
".",
"size",
"(",
")",
";",
"j",
"++",
")",
"{",
"// casteamos el objeto dibujable para que sea dibujado",
"dib",
"=",
"(",
"Dibujable",
")",
"v",
".",
"get",
"(",
"j",
")",
";",
"}",
"}"
] | [
34,
1
] | [
45,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
AAD4_E1_Jeremy. | null | Contar la cantidad total de dígitos | Contar la cantidad total de dígitos | public static int ContarDigitos (long numero)
{
// Variable Contador = 0
int contador = 0;
// Variable NúmeroTemp = Número ingresado
long numerotemp = numero;
// Mientras que haya el NúmeroTemp >0
while (numerotemp >0)
{
System.out.println("Se ha entrado al while");
// NúmeroTemp = NúmeroTemp / 10
numerotemp = numerotemp /10;
// Contador = Contador + 1
contador = contador +1;
}
// Devolver Contador
return contador;
} | [
"public",
"static",
"int",
"ContarDigitos",
"(",
"long",
"numero",
")",
"{",
"// Variable Contador = 0",
"int",
"contador",
"=",
"0",
";",
"// Variable NúmeroTemp = Número ingresado",
"long",
"numerotemp",
"=",
"numero",
";",
"// Mientras que haya el NúmeroTemp >0 ",
"while",
"(",
"numerotemp",
">",
"0",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Se ha entrado al while\"",
")",
";",
"// NúmeroTemp = NúmeroTemp / 10",
"numerotemp",
"=",
"numerotemp",
"/",
"10",
";",
"// Contador = Contador + 1",
"contador",
"=",
"contador",
"+",
"1",
";",
"}",
"// Devolver Contador ",
"return",
"contador",
";",
"}"
] | [
41,
1
] | [
58,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ProyectoMiyamotoRepositoryImplement. | null | Métodos de productos | Métodos de productos | public Collection<Producto> getAllAnimeProductos() {
Collection<Producto> productos = new HashSet<>();
for (Anime a : getAllAnimes()) {
productos.addAll(a.getProductos());
}
return productos;
} | [
"public",
"Collection",
"<",
"Producto",
">",
"getAllAnimeProductos",
"(",
")",
"{",
"Collection",
"<",
"Producto",
">",
"productos",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"for",
"(",
"Anime",
"a",
":",
"getAllAnimes",
"(",
")",
")",
"{",
"productos",
".",
"addAll",
"(",
"a",
".",
"getProductos",
"(",
")",
")",
";",
"}",
"return",
"productos",
";",
"}"
] | [
219,
1
] | [
225,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CrudLimpieza. | null | Buscar todos los productos por nombre con stream | Buscar todos los productos por nombre con stream | public Stream<ProductosLimpieza> buscarProductosStream(String nombre) {
return stockLimpieza
.stream()
.parallel()
.filter(x -> x.getNombre().equalsIgnoreCase(nombre));
} | [
"public",
"Stream",
"<",
"ProductosLimpieza",
">",
"buscarProductosStream",
"(",
"String",
"nombre",
")",
"{",
"return",
"stockLimpieza",
".",
"stream",
"(",
")",
".",
"parallel",
"(",
")",
".",
"filter",
"(",
"x",
"->",
"x",
".",
"getNombre",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"nombre",
")",
")",
";",
"}"
] | [
86,
1
] | [
91,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CursorFactory. | null | Elimina un cursor (lo cierra y lo saca de la lista de prepared statements)
| Elimina un cursor (lo cierra y lo saca de la lista de prepared statements)
| public synchronized void dropCursor(GXPreparedStatement stmt)
{
if(stmt == null)return;
setNotInUse(stmt);
try
{
stmt.close();
}
catch (SQLException e){ ; }
preparedStatements.remove(stmt);
return;
} | [
"public",
"synchronized",
"void",
"dropCursor",
"(",
"GXPreparedStatement",
"stmt",
")",
"{",
"if",
"(",
"stmt",
"==",
"null",
")",
"return",
";",
"setNotInUse",
"(",
"stmt",
")",
";",
"try",
"{",
"stmt",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"SQLException",
"e",
")",
"{",
";",
"}",
"preparedStatements",
".",
"remove",
"(",
"stmt",
")",
";",
"return",
";",
"}"
] | [
352,
1
] | [
363,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
MyViewModel. | null | La Activity solo tiene acceso al ViewModel y no al repositorio. Por eso se añaden los metodos de acceso al mismo. | La Activity solo tiene acceso al ViewModel y no al repositorio. Por eso se añaden los metodos de acceso al mismo. | public void insert(Alarma alarma){
repositorio.insert(alarma);
} | [
"public",
"void",
"insert",
"(",
"Alarma",
"alarma",
")",
"{",
"repositorio",
".",
"insert",
"(",
"alarma",
")",
";",
"}"
] | [
32,
4
] | [
34,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
TgTimb. | null | fecha de inicio de vigencia del timbrado | fecha de inicio de vigencia del timbrado | public void setupSOAPElements(SOAPElement DE) throws SOAPException {
SOAPElement gTimb = DE.addChildElement("gTimb");
gTimb.addChildElement("iTiDE").setTextContent(String.valueOf(this.iTiDE.getVal()));
gTimb.addChildElement("dDesTiDE").setTextContent(this.iTiDE.getDescripcion());
gTimb.addChildElement("dNumTim").setTextContent(String.valueOf(this.dNumTim));
gTimb.addChildElement("dEst").setTextContent(this.dEst);
gTimb.addChildElement("dPunExp").setTextContent(this.dPunExp);
gTimb.addChildElement("dNumDoc").setTextContent(this.dNumDoc);
if (this.dSerieNum != null)
gTimb.addChildElement("dSerieNum").setTextContent(this.dSerieNum);
gTimb.addChildElement("dFeIniT").setTextContent(this.dFeIniT.toString());
} | [
"public",
"void",
"setupSOAPElements",
"(",
"SOAPElement",
"DE",
")",
"throws",
"SOAPException",
"{",
"SOAPElement",
"gTimb",
"=",
"DE",
".",
"addChildElement",
"(",
"\"gTimb\"",
")",
";",
"gTimb",
".",
"addChildElement",
"(",
"\"iTiDE\"",
")",
".",
"setTextContent",
"(",
"String",
".",
"valueOf",
"(",
"this",
".",
"iTiDE",
".",
"getVal",
"(",
")",
")",
")",
";",
"gTimb",
".",
"addChildElement",
"(",
"\"dDesTiDE\"",
")",
".",
"setTextContent",
"(",
"this",
".",
"iTiDE",
".",
"getDescripcion",
"(",
")",
")",
";",
"gTimb",
".",
"addChildElement",
"(",
"\"dNumTim\"",
")",
".",
"setTextContent",
"(",
"String",
".",
"valueOf",
"(",
"this",
".",
"dNumTim",
")",
")",
";",
"gTimb",
".",
"addChildElement",
"(",
"\"dEst\"",
")",
".",
"setTextContent",
"(",
"this",
".",
"dEst",
")",
";",
"gTimb",
".",
"addChildElement",
"(",
"\"dPunExp\"",
")",
".",
"setTextContent",
"(",
"this",
".",
"dPunExp",
")",
";",
"gTimb",
".",
"addChildElement",
"(",
"\"dNumDoc\"",
")",
".",
"setTextContent",
"(",
"this",
".",
"dNumDoc",
")",
";",
"if",
"(",
"this",
".",
"dSerieNum",
"!=",
"null",
")",
"gTimb",
".",
"addChildElement",
"(",
"\"dSerieNum\"",
")",
".",
"setTextContent",
"(",
"this",
".",
"dSerieNum",
")",
";",
"gTimb",
".",
"addChildElement",
"(",
"\"dFeIniT\"",
")",
".",
"setTextContent",
"(",
"this",
".",
"dFeIniT",
".",
"toString",
"(",
")",
")",
";",
"}"
] | [
22,
4
] | [
33,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
DeviceTest. | null | CP4: Cuando tenemos un dispositivo encendido, el consumo actual debe ser el consumo con el cual fue creado dicho dispositivo. | CP4: Cuando tenemos un dispositivo encendido, el consumo actual debe ser el consumo con el cual fue creado dicho dispositivo. | @Test
public void Given_A_TurnedOn_Device_When_GetCurrentConsumption_Method_Is_Called_Then_Return_Consumption(){
//Given
Integer expectedCurrentConsumption = this.consumption;
device.turnOn();
//When
Integer result = device.getCurrentConsumption();
//Then
assertEquals(expectedCurrentConsumption,result);
} | [
"@",
"Test",
"public",
"void",
"Given_A_TurnedOn_Device_When_GetCurrentConsumption_Method_Is_Called_Then_Return_Consumption",
"(",
")",
"{",
"//Given",
"Integer",
"expectedCurrentConsumption",
"=",
"this",
".",
"consumption",
";",
"device",
".",
"turnOn",
"(",
")",
";",
"//When",
"Integer",
"result",
"=",
"device",
".",
"getCurrentConsumption",
"(",
")",
";",
"//Then",
"assertEquals",
"(",
"expectedCurrentConsumption",
",",
"result",
")",
";",
"}"
] | [
53,
4
] | [
64,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
PantallaCoche. | null | El coche avanza hacia atrás. | El coche avanza hacia atrás. | private void marchaAtras() {
if (aceleracion >= -240f) aceleracion -= 40f;
} | [
"private",
"void",
"marchaAtras",
"(",
")",
"{",
"if",
"(",
"aceleracion",
">=",
"-",
"240f",
")",
"aceleracion",
"-=",
"40f",
";",
"}"
] | [
185,
1
] | [
187,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
SingleObject. | null | 3.-se declara un getter estatico para instanciar o obtener la instancia si ya fue creada | 3.-se declara un getter estatico para instanciar o obtener la instancia si ya fue creada | public static SingleObject getInstance() {
if(instance == null)
instance= new SingleObject();
return instance;
} | [
"public",
"static",
"SingleObject",
"getInstance",
"(",
")",
"{",
"if",
"(",
"instance",
"==",
"null",
")",
"instance",
"=",
"new",
"SingleObject",
"(",
")",
";",
"return",
"instance",
";",
"}"
] | [
14,
1
] | [
18,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
NGSIToCarto. | null | On error - Especifica una funcion OnError predeterminada que se llamara si no se especifica explicitamente cuando se llama a execute(Object, Object Procedure) | On error - Especifica una funcion OnError predeterminada que se llamara si no se especifica explicitamente cuando se llama a execute(Object, Object Procedure) | private ExceptionHandler.OnError<FunctionContext, FlowFile> onFlowFileError(final ProcessContext context, final ProcessSession session, final RoutingResult result) {
ExceptionHandler.OnError<FunctionContext, FlowFile> onFlowFileError = createOnError(context, session, result, REL_FAILURE, REL_RETRY);
onFlowFileError = onFlowFileError.andThen((c, i, r, e) -> {
switch (r.destination()) {
case Failure:
getLogger().error("Failed to update database for {} due to {}; routing to failure", new Object[]{i, e}, e);
break;
case Retry:
getLogger().error("Failed to update database for {} due to {}; it is possible that retrying the operation will succeed, so routing to retry",
new Object[]{i, e}, e);
break;
}
});
return RollbackOnFailure.createOnError(onFlowFileError);
} | [
"private",
"ExceptionHandler",
".",
"OnError",
"<",
"FunctionContext",
",",
"FlowFile",
">",
"onFlowFileError",
"(",
"final",
"ProcessContext",
"context",
",",
"final",
"ProcessSession",
"session",
",",
"final",
"RoutingResult",
"result",
")",
"{",
"ExceptionHandler",
".",
"OnError",
"<",
"FunctionContext",
",",
"FlowFile",
">",
"onFlowFileError",
"=",
"createOnError",
"(",
"context",
",",
"session",
",",
"result",
",",
"REL_FAILURE",
",",
"REL_RETRY",
")",
";",
"onFlowFileError",
"=",
"onFlowFileError",
".",
"andThen",
"(",
"(",
"c",
",",
"i",
",",
"r",
",",
"e",
")",
"->",
"{",
"switch",
"(",
"r",
".",
"destination",
"(",
")",
")",
"{",
"case",
"Failure",
":",
"getLogger",
"(",
")",
".",
"error",
"(",
"\"Failed to update database for {} due to {}; routing to failure\"",
",",
"new",
"Object",
"[",
"]",
"{",
"i",
",",
"e",
"}",
",",
"e",
")",
";",
"break",
";",
"case",
"Retry",
":",
"getLogger",
"(",
")",
".",
"error",
"(",
"\"Failed to update database for {} due to {}; it is possible that retrying the operation will succeed, so routing to retry\"",
",",
"new",
"Object",
"[",
"]",
"{",
"i",
",",
"e",
"}",
",",
"e",
")",
";",
"break",
";",
"}",
"}",
")",
";",
"return",
"RollbackOnFailure",
".",
"createOnError",
"(",
"onFlowFileError",
")",
";",
"}"
] | [
648,
4
] | [
662,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
PromedioNotas. | null | Sección principal o punto de entrada para consumir estas funciones | Sección principal o punto de entrada para consumir estas funciones | public static void main(String[] args) {
// 1) Recoger la información: código del estudiante y las 5 notas
Scanner sc = new Scanner(System.in);
System.out.print("Ingrese el código del estudiante: ");
String codigoEstudiante = sc.nextLine();
System.out.print("Ingrese nota1: ");
int nota1 = sc.nextInt();
System.out.print("Ingrese nota2: ");
int nota2 = sc.nextInt();
System.out.print("Ingrese nota3: ");
int nota3 = sc.nextInt();
System.out.print("Ingrese nota4: ");
int nota4 = sc.nextInt();
System.out.print("Ingrese nota5: ");
int nota5 = sc.nextInt();
//Ejecutar las funciones -> al paso 3 (internamente realiza el paso 2)
//double promedioAjustado = convertirEscala5(calcularPromedioAjustado(nota1, nota2, nota3, nota4, nota5)) ;
double promedioAjustado = calcularPromedioAjustado(nota1, nota2, nota3, nota4, nota5);
promedioAjustado = convertirEscala5(promedioAjustado);
//Reportar el resultado
//reportarPromedioAjustado(codigoEstudiante, Math.round(promedioAjustado) );
reportarPromedioAjustado(codigoEstudiante, promedioAjustado );
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"// 1) Recoger la información: código del estudiante y las 5 notas",
"Scanner",
"sc",
"=",
"new",
"Scanner",
"(",
"System",
".",
"in",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"\"Ingrese el código del estudiante: \")",
";",
"",
"String",
"codigoEstudiante",
"=",
"sc",
".",
"nextLine",
"(",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"\"Ingrese nota1: \"",
")",
";",
"int",
"nota1",
"=",
"sc",
".",
"nextInt",
"(",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"\"Ingrese nota2: \"",
")",
";",
"int",
"nota2",
"=",
"sc",
".",
"nextInt",
"(",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"\"Ingrese nota3: \"",
")",
";",
"int",
"nota3",
"=",
"sc",
".",
"nextInt",
"(",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"\"Ingrese nota4: \"",
")",
";",
"int",
"nota4",
"=",
"sc",
".",
"nextInt",
"(",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"\"Ingrese nota5: \"",
")",
";",
"int",
"nota5",
"=",
"sc",
".",
"nextInt",
"(",
")",
";",
"//Ejecutar las funciones -> al paso 3 (internamente realiza el paso 2)",
"//double promedioAjustado = convertirEscala5(calcularPromedioAjustado(nota1, nota2, nota3, nota4, nota5)) ;",
"double",
"promedioAjustado",
"=",
"calcularPromedioAjustado",
"(",
"nota1",
",",
"nota2",
",",
"nota3",
",",
"nota4",
",",
"nota5",
")",
";",
"promedioAjustado",
"=",
"convertirEscala5",
"(",
"promedioAjustado",
")",
";",
"//Reportar el resultado",
"//reportarPromedioAjustado(codigoEstudiante, Math.round(promedioAjustado) );",
"reportarPromedioAjustado",
"(",
"codigoEstudiante",
",",
"promedioAjustado",
")",
";",
"}"
] | [
74,
4
] | [
100,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
SecurityConfigurations. | null | Recursos estaticos | Recursos estaticos | @Override
public void configure(WebSecurity web) throws Exception {
super.configure(web);
} | [
"@",
"Override",
"public",
"void",
"configure",
"(",
"WebSecurity",
"web",
")",
"throws",
"Exception",
"{",
"super",
".",
"configure",
"(",
"web",
")",
";",
"}"
] | [
60,
4
] | [
63,
5
] | null | java | es | ['es', 'es', 'es'] | False | true | method_declaration |
|
CrearCuenta. | null | Método para cuando se desenfoca de CampoDireccion | Método para cuando se desenfoca de CampoDireccion | private void CampoDireccionFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_CampoDireccionFocusLost
// Obtiene contenido de campo
String Contenido = this.CampoDireccion.getText();
// Obtiene color de campo
Color ColorActual = this.CampoDireccion.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("Dirección"))
{
if(Contenido.equals(""))
{
this.CampoDireccion.setText("Dirección");
if(ColorActual != ColorNoEscrito)
{
this.CampoDireccion.setForeground(ColorNoEscrito);
}
}
}
} | [
"private",
"void",
"CampoDireccionFocusLost",
"(",
"java",
".",
"awt",
".",
"event",
".",
"FocusEvent",
"evt",
")",
"{",
"//GEN-FIRST:event_CampoDireccionFocusLost",
"// Obtiene contenido de campo",
"String",
"Contenido",
"=",
"this",
".",
"CampoDireccion",
".",
"getText",
"(",
")",
";",
"// Obtiene color de campo",
"Color",
"ColorActual",
"=",
"this",
".",
"CampoDireccion",
".",
"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",
"(",
"\"Dirección\")",
")",
"",
"{",
"if",
"(",
"Contenido",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"this",
".",
"CampoDireccion",
".",
"setText",
"(",
"\"Dirección\")",
";",
"",
"if",
"(",
"ColorActual",
"!=",
"ColorNoEscrito",
")",
"{",
"this",
".",
"CampoDireccion",
".",
"setForeground",
"(",
"ColorNoEscrito",
")",
";",
"}",
"}",
"}",
"}"
] | [
1134,
4
] | [
1155,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
FotosController. | null | Crea el objeto foto en la base de datos | Crea el objeto foto en la base de datos | private Fotos crearObjetoFotoBD(MultipartFile file, Integer idUsu) {
String mensajeOperacion = ""; //Si esta vacio, problema con insertar la entrada
PonerFecha ponerFecha = new PonerFecha();
Fotos foto = new Fotos();
foto.setUsuarioFotos(usuServ.getUsuarioById(idUsu));
foto.setFechaSubidaFoto(ponerFecha.ponerFechaHoraActual());
foto.setFotoString(file.getOriginalFilename().toLowerCase());
System.out.println("Obj foto: " + foto.toString());
Fotos fotoDevuelta = new Fotos();
//subir foto a BD
try {
fotoDevuelta = service.saveFoto(foto);
if(fotoDevuelta != null) mensajeOperacion = "objeto foto insertado";
else mensajeOperacion = "Problemas, objeto foto no insertado";
}catch(Exception e) {
System.out.println("Problemas en la inserccion" + e.toString());
mensajeOperacion = "Problemas, foto no insertada";
}
return fotoDevuelta;
} | [
"private",
"Fotos",
"crearObjetoFotoBD",
"(",
"MultipartFile",
"file",
",",
"Integer",
"idUsu",
")",
"{",
"String",
"mensajeOperacion",
"=",
"\"\"",
";",
"//Si esta vacio, problema con insertar la entrada\r",
"PonerFecha",
"ponerFecha",
"=",
"new",
"PonerFecha",
"(",
")",
";",
"Fotos",
"foto",
"=",
"new",
"Fotos",
"(",
")",
";",
"foto",
".",
"setUsuarioFotos",
"(",
"usuServ",
".",
"getUsuarioById",
"(",
"idUsu",
")",
")",
";",
"foto",
".",
"setFechaSubidaFoto",
"(",
"ponerFecha",
".",
"ponerFechaHoraActual",
"(",
")",
")",
";",
"foto",
".",
"setFotoString",
"(",
"file",
".",
"getOriginalFilename",
"(",
")",
".",
"toLowerCase",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Obj foto: \"",
"+",
"foto",
".",
"toString",
"(",
")",
")",
";",
"Fotos",
"fotoDevuelta",
"=",
"new",
"Fotos",
"(",
")",
";",
"//subir foto a BD\r",
"try",
"{",
"fotoDevuelta",
"=",
"service",
".",
"saveFoto",
"(",
"foto",
")",
";",
"if",
"(",
"fotoDevuelta",
"!=",
"null",
")",
"mensajeOperacion",
"=",
"\"objeto foto insertado\"",
";",
"else",
"mensajeOperacion",
"=",
"\"Problemas, objeto foto no insertado\"",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Problemas en la inserccion\"",
"+",
"e",
".",
"toString",
"(",
")",
")",
";",
"mensajeOperacion",
"=",
"\"Problemas, foto no insertada\"",
";",
"}",
"return",
"fotoDevuelta",
";",
"}"
] | [
179,
1
] | [
211,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
BasicSecuritySystemTest. | null | CP2: Dado un Sistema de seguridad con una red en estado ESTABLE, NO SE APAGA ningún dispositivo de dicha red. | CP2: Dado un Sistema de seguridad con una red en estado ESTABLE, NO SE APAGA ningún dispositivo de dicha red. | @Test
public void Given_An_SecuritySystem_With_An_Stable_ElectricSystem_When_Perform_Method_Is_Called_Then_No_Device_Is_TurnedOff(){
//Given
when(electricSystem.isStable()).thenReturn(true);
//When
securitySystem.perform();
//Then
Mockito.verify(device1, never()).turnOff();
Mockito.verify(device2, never()).turnOff();
} | [
"@",
"Test",
"public",
"void",
"Given_An_SecuritySystem_With_An_Stable_ElectricSystem_When_Perform_Method_Is_Called_Then_No_Device_Is_TurnedOff",
"(",
")",
"{",
"//Given",
"when",
"(",
"electricSystem",
".",
"isStable",
"(",
")",
")",
".",
"thenReturn",
"(",
"true",
")",
";",
"//When",
"securitySystem",
".",
"perform",
"(",
")",
";",
"//Then",
"Mockito",
".",
"verify",
"(",
"device1",
",",
"never",
"(",
")",
")",
".",
"turnOff",
"(",
")",
";",
"Mockito",
".",
"verify",
"(",
"device2",
",",
"never",
"(",
")",
")",
".",
"turnOff",
"(",
")",
";",
"}"
] | [
52,
4
] | [
64,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
AmigosUsuService. | null | /* buscar peticiones recibidas por el usuario | /* buscar peticiones recibidas por el usuario | public List<AmigosUsu> findPeticionesRecibidasUsuario(Integer idUsuRecep) {
ArrayList<AmigosUsu> peticionesRecibidas = new ArrayList<AmigosUsu>();
peticionesRecibidas = (ArrayList<AmigosUsu>) repository.findPeticionesRecibidasUsuario(idUsuRecep);
return peticionesRecibidas;
} | [
"public",
"List",
"<",
"AmigosUsu",
">",
"findPeticionesRecibidasUsuario",
"(",
"Integer",
"idUsuRecep",
")",
"{",
"ArrayList",
"<",
"AmigosUsu",
">",
"peticionesRecibidas",
"=",
"new",
"ArrayList",
"<",
"AmigosUsu",
">",
"(",
")",
";",
"peticionesRecibidas",
"=",
"(",
"ArrayList",
"<",
"AmigosUsu",
">",
")",
"repository",
".",
"findPeticionesRecibidasUsuario",
"(",
"idUsuRecep",
")",
";",
"return",
"peticionesRecibidas",
";",
"}"
] | [
97,
1
] | [
102,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
AnimesApiResource. | null | Método que devuelve todos los animes de un determinado título | Método que devuelve todos los animes de un determinado título | @GET
@Path("/title}")
@Produces("application/json")
public Collection<Anime> geAllAnimesByTitle(@QueryParam("title") String title) {
Collection<Anime> res = repository.getAnimesByTitle(title);
if (res == null) {
throw new NotFoundException("No se encuentra ningún anime.");
}
return res;
} | [
"@",
"GET",
"@",
"Path",
"(",
"\"/title}\"",
")",
"@",
"Produces",
"(",
"\"application/json\"",
")",
"public",
"Collection",
"<",
"Anime",
">",
"geAllAnimesByTitle",
"(",
"@",
"QueryParam",
"(",
"\"title\"",
")",
"String",
"title",
")",
"{",
"Collection",
"<",
"Anime",
">",
"res",
"=",
"repository",
".",
"getAnimesByTitle",
"(",
"title",
")",
";",
"if",
"(",
"res",
"==",
"null",
")",
"{",
"throw",
"new",
"NotFoundException",
"(",
"\"No se encuentra ningún anime.\")",
";",
"",
"}",
"return",
"res",
";",
"}"
] | [
69,
1
] | [
78,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Application. | null | Commit de todos los datastores usando la error_handler del datastore pasado por parametro. | Commit de todos los datastores usando la error_handler del datastore pasado por parametro. | public static void commitDataStores(ModelContext context, int remoteHandle, com.genexus.db.IDataStoreProvider dataStore, String objName)
{
UserInformation info = getConnectionManager().getUserInformation(remoteHandle);
for (Enumeration<com.genexus.db.driver.DataSource> en = info.getNamespace().getDataSources(); en.hasMoreElements(); )
{
String dataSourceName = en.nextElement().getName();
commit(context, remoteHandle, dataSourceName, dataStore, objName);
}
} | [
"public",
"static",
"void",
"commitDataStores",
"(",
"ModelContext",
"context",
",",
"int",
"remoteHandle",
",",
"com",
".",
"genexus",
".",
"db",
".",
"IDataStoreProvider",
"dataStore",
",",
"String",
"objName",
")",
"{",
"UserInformation",
"info",
"=",
"getConnectionManager",
"(",
")",
".",
"getUserInformation",
"(",
"remoteHandle",
")",
";",
"for",
"(",
"Enumeration",
"<",
"com",
".",
"genexus",
".",
"db",
".",
"driver",
".",
"DataSource",
">",
"en",
"=",
"info",
".",
"getNamespace",
"(",
")",
".",
"getDataSources",
"(",
")",
";",
"en",
".",
"hasMoreElements",
"(",
")",
";",
")",
"{",
"String",
"dataSourceName",
"=",
"en",
".",
"nextElement",
"(",
")",
".",
"getName",
"(",
")",
";",
"commit",
"(",
"context",
",",
"remoteHandle",
",",
"dataSourceName",
",",
"dataStore",
",",
"objName",
")",
";",
"}",
"}"
] | [
544,
1
] | [
553,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CrudLimpieza. | null | Modificar producto buscando por nombre de forma clásica | Modificar producto buscando por nombre de forma clásica | public void modificarNombreProducto (String nombre, String nuevoNombre) {
int i;
i=buscarProducto(nombre);
stockLimpieza.get(i).setNombre(nuevoNombre);
} | [
"public",
"void",
"modificarNombreProducto",
"(",
"String",
"nombre",
",",
"String",
"nuevoNombre",
")",
"{",
"int",
"i",
";",
"i",
"=",
"buscarProducto",
"(",
"nombre",
")",
";",
"stockLimpieza",
".",
"get",
"(",
"i",
")",
".",
"setNombre",
"(",
"nuevoNombre",
")",
";",
"}"
] | [
117,
1
] | [
121,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Jugador. | null | Juego manual -> solicitar posiciones al usuario | Juego manual -> solicitar posiciones al usuario | public void realizarMovimientoManual(Tablero tablero){
//Interacción -> Sacarlo luego al paquete de interacción luego
Scanner sc = new Scanner(System.in);
System.out.println();
System.out.print("Ingresar fila: ");
int filaIngresada = sc.nextInt();
System.out.print("Ingresar columna: ");
int columnaIngresada = sc.nextInt();
//Modificar la casilla elegida manualmente
tablero.casillas[filaIngresada][columnaIngresada].aplicarJugada(this.movimientoLogico, this.movimientoConsola);
} | [
"public",
"void",
"realizarMovimientoManual",
"(",
"Tablero",
"tablero",
")",
"{",
"//Interacción -> Sacarlo luego al paquete de interacción luego",
"Scanner",
"sc",
"=",
"new",
"Scanner",
"(",
"System",
".",
"in",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"\"Ingresar fila: \"",
")",
";",
"int",
"filaIngresada",
"=",
"sc",
".",
"nextInt",
"(",
")",
";",
"System",
".",
"out",
".",
"print",
"(",
"\"Ingresar columna: \"",
")",
";",
"int",
"columnaIngresada",
"=",
"sc",
".",
"nextInt",
"(",
")",
";",
"//Modificar la casilla elegida manualmente",
"tablero",
".",
"casillas",
"[",
"filaIngresada",
"]",
"[",
"columnaIngresada",
"]",
".",
"aplicarJugada",
"(",
"this",
".",
"movimientoLogico",
",",
"this",
".",
"movimientoConsola",
")",
";",
"}"
] | [
54,
4
] | [
67,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
NewsController. | null | @PreAuthorize("hasRole(ROLE_ADMIN)") en un comienzo, esto lo filtro con los antMatcher | @GetMapping("/{id}")
public ResponseEntity<?> bringNews(@PathVariable long id) {
Optional<News> news = newsService.findById(id);
if (news.isEmpty()) return new ResponseEntity(new Message("no se ha encontrado una news con el id: "+id), HttpStatus.NOT_FOUND);
return ResponseEntity.ok(news.get());
} | [
"@",
"GetMapping",
"(",
"\"/{id}\"",
")",
"public",
"ResponseEntity",
"<",
"?",
">",
"bringNews",
"(",
"@",
"PathVariable",
"long",
"id",
")",
"{",
"Optional",
"<",
"News",
">",
"news",
"=",
"newsService",
".",
"findById",
"(",
"id",
")",
";",
"if",
"(",
"news",
".",
"isEmpty",
"(",
")",
")",
"return",
"new",
"ResponseEntity",
"(",
"new",
"Message",
"(",
"\"no se ha encontrado una news con el id: \"",
"+",
"id",
")",
",",
"HttpStatus",
".",
"NOT_FOUND",
")",
";",
"return",
"ResponseEntity",
".",
"ok",
"(",
"news",
".",
"get",
"(",
")",
")",
";",
"}"
] | [
36,
4
] | [
41,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
||
Mesa. | null | Comprueba si hay movimientos posible hacia fuera del monton | Comprueba si hay movimientos posible hacia fuera del monton | private boolean movimientoPosibleHaciaFuera(int x, int y){
boolean disponible = false;
int i = 0;
while(i < numColumnas && disponible != true){
if(!montonInterior[x][y].isEmpty()){
if(montonExterior[i].isEmpty()){
if(montonInterior[x][y].peek().getNum() == 1){
disponible = true;
}
}else{
if(montonExterior[i].peek().getNum() == montonInterior[x][y]
.peek().getNum() - 1 && montonExterior[i].peek()
.getPalo() == montonInterior[x][y].peek().getPalo()){
disponible = true;
}
}
}
i++;
}
return disponible;
} | [
"private",
"boolean",
"movimientoPosibleHaciaFuera",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"boolean",
"disponible",
"=",
"false",
";",
"int",
"i",
"=",
"0",
";",
"while",
"(",
"i",
"<",
"numColumnas",
"&&",
"disponible",
"!=",
"true",
")",
"{",
"if",
"(",
"!",
"montonInterior",
"[",
"x",
"]",
"[",
"y",
"]",
".",
"isEmpty",
"(",
")",
")",
"{",
"if",
"(",
"montonExterior",
"[",
"i",
"]",
".",
"isEmpty",
"(",
")",
")",
"{",
"if",
"(",
"montonInterior",
"[",
"x",
"]",
"[",
"y",
"]",
".",
"peek",
"(",
")",
".",
"getNum",
"(",
")",
"==",
"1",
")",
"{",
"disponible",
"=",
"true",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"montonExterior",
"[",
"i",
"]",
".",
"peek",
"(",
")",
".",
"getNum",
"(",
")",
"==",
"montonInterior",
"[",
"x",
"]",
"[",
"y",
"]",
".",
"peek",
"(",
")",
".",
"getNum",
"(",
")",
"-",
"1",
"&&",
"montonExterior",
"[",
"i",
"]",
".",
"peek",
"(",
")",
".",
"getPalo",
"(",
")",
"==",
"montonInterior",
"[",
"x",
"]",
"[",
"y",
"]",
".",
"peek",
"(",
")",
".",
"getPalo",
"(",
")",
")",
"{",
"disponible",
"=",
"true",
";",
"}",
"}",
"}",
"i",
"++",
";",
"}",
"return",
"disponible",
";",
"}"
] | [
157,
4
] | [
179,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CropOverlayView. | null | Metodo que ayuda a dibujar el fondo difuminado de color gris
ayuda a dar un mejor encuadre de la credencial y asi obtener
una mejor fotografia
| Metodo que ayuda a dibujar el fondo difuminado de color gris
ayuda a dar un mejor encuadre de la credencial y asi obtener
una mejor fotografia
| private void drawBackground(Canvas canvas) {
Paint paint = new Paint();
paint.setColor(Color.parseColor("#66000000"));
paint.setStyle(Paint.Style.FILL);
Path path = new Path();
path.moveTo(topLeft.x, topLeft.y);
path.lineTo(topRight.x, topRight.y);
path.lineTo(bottomRight.x, bottomRight.y);
path.lineTo(bottomLeft.x, bottomLeft.y);
path.close();
canvas.save();
canvas.clipPath(path, Region.Op.DIFFERENCE);
canvas.drawColor(Color.parseColor("#66000000"));
canvas.restore();
} | [
"private",
"void",
"drawBackground",
"(",
"Canvas",
"canvas",
")",
"{",
"Paint",
"paint",
"=",
"new",
"Paint",
"(",
")",
";",
"paint",
".",
"setColor",
"(",
"Color",
".",
"parseColor",
"(",
"\"#66000000\"",
")",
")",
";",
"paint",
".",
"setStyle",
"(",
"Paint",
".",
"Style",
".",
"FILL",
")",
";",
"Path",
"path",
"=",
"new",
"Path",
"(",
")",
";",
"path",
".",
"moveTo",
"(",
"topLeft",
".",
"x",
",",
"topLeft",
".",
"y",
")",
";",
"path",
".",
"lineTo",
"(",
"topRight",
".",
"x",
",",
"topRight",
".",
"y",
")",
";",
"path",
".",
"lineTo",
"(",
"bottomRight",
".",
"x",
",",
"bottomRight",
".",
"y",
")",
";",
"path",
".",
"lineTo",
"(",
"bottomLeft",
".",
"x",
",",
"bottomLeft",
".",
"y",
")",
";",
"path",
".",
"close",
"(",
")",
";",
"canvas",
".",
"save",
"(",
")",
";",
"canvas",
".",
"clipPath",
"(",
"path",
",",
"Region",
".",
"Op",
".",
"DIFFERENCE",
")",
";",
"canvas",
".",
"drawColor",
"(",
"Color",
".",
"parseColor",
"(",
"\"#66000000\"",
")",
")",
";",
"canvas",
".",
"restore",
"(",
")",
";",
"}"
] | [
137,
4
] | [
153,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
PinnedHeaderAdapter. | null | TODO: ver si lo que cambie aca del toString está bien, estoy casao | TODO: ver si lo que cambie aca del toString está bien, estoy casao | @Override
public void configurePinnedHeader(View v, int position) {
try
{
// set text in pinned header
LinearLayout linearLayout =(LinearLayout)v;
TextView header = (TextView) linearLayout.getChildAt(0);
mCurrentSectionPosition = getCurrentSectionPosition(position);
header.setText(mListItems.get(mCurrentSectionPosition).toString());
}
catch (Exception e) {
e.printStackTrace();
}
} | [
"@",
"Override",
"public",
"void",
"configurePinnedHeader",
"(",
"View",
"v",
",",
"int",
"position",
")",
"{",
"try",
"{",
"// set text in pinned header",
"LinearLayout",
"linearLayout",
"=",
"(",
"LinearLayout",
")",
"v",
";",
"TextView",
"header",
"=",
"(",
"TextView",
")",
"linearLayout",
".",
"getChildAt",
"(",
"0",
")",
";",
"mCurrentSectionPosition",
"=",
"getCurrentSectionPosition",
"(",
"position",
")",
";",
"header",
".",
"setText",
"(",
"mListItems",
".",
"get",
"(",
"mCurrentSectionPosition",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] | [
232,
4
] | [
247,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
PrincipalCalculadora. | null | Metodo para cargar los datos de las distintas comunidades entre vairiable comunidad de tipo Comunidad | Metodo para cargar los datos de las distintas comunidades entre vairiable comunidad de tipo Comunidad | public static void cargarDatos(int i) {
ArrayList<Integer> poblacion = new ArrayList<>();
poblacion.add(rangos[i][0]); // 50-59
poblacion.add(rangos[i][1]); // 25-49
poblacion.add(rangos[i][2]); // 18-24
poblacion.add(rangos[i][3]); // <18
comunidad = new Comunidad(CCAA[i], poblacion, ritmoDiario[i]);
} | [
"public",
"static",
"void",
"cargarDatos",
"(",
"int",
"i",
")",
"{",
"ArrayList",
"<",
"Integer",
">",
"poblacion",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"poblacion",
".",
"add",
"(",
"rangos",
"[",
"i",
"]",
"[",
"0",
"]",
")",
";",
"// 50-59",
"poblacion",
".",
"add",
"(",
"rangos",
"[",
"i",
"]",
"[",
"1",
"]",
")",
";",
"// 25-49",
"poblacion",
".",
"add",
"(",
"rangos",
"[",
"i",
"]",
"[",
"2",
"]",
")",
";",
"// 18-24",
"poblacion",
".",
"add",
"(",
"rangos",
"[",
"i",
"]",
"[",
"3",
"]",
")",
";",
"// <18",
"comunidad",
"=",
"new",
"Comunidad",
"(",
"CCAA",
"[",
"i",
"]",
",",
"poblacion",
",",
"ritmoDiario",
"[",
"i",
"]",
")",
";",
"}"
] | [
48,
4
] | [
55,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Materia. | null | Calcular el promedio sin ayudar al estudiante | Calcular el promedio sin ayudar al estudiante | public void calcularPromedio(){
//Calcular el promedio excluyendo la peor nota
this.promedio = (nota1.getEscala100() + nota2.getEscala100() + nota3.getEscala100() + nota4.getEscala100() + nota5.getEscala100())/5;
//Expresarlo en el atributo cualitativo
Nota notaPromedio = new Nota((int)this.promedio);
this.promedioCualitativo = notaPromedio.getCualitativa();
//Aprovechamos el comportamiento de la envoltura que hicimos al promedio
this.promedio = notaPromedio.getEscala5();
} | [
"public",
"void",
"calcularPromedio",
"(",
")",
"{",
"//Calcular el promedio excluyendo la peor nota ",
"this",
".",
"promedio",
"=",
"(",
"nota1",
".",
"getEscala100",
"(",
")",
"+",
"nota2",
".",
"getEscala100",
"(",
")",
"+",
"nota3",
".",
"getEscala100",
"(",
")",
"+",
"nota4",
".",
"getEscala100",
"(",
")",
"+",
"nota5",
".",
"getEscala100",
"(",
")",
")",
"/",
"5",
";",
"//Expresarlo en el atributo cualitativo",
"Nota",
"notaPromedio",
"=",
"new",
"Nota",
"(",
"(",
"int",
")",
"this",
".",
"promedio",
")",
";",
"this",
".",
"promedioCualitativo",
"=",
"notaPromedio",
".",
"getCualitativa",
"(",
")",
";",
"//Aprovechamos el comportamiento de la envoltura que hicimos al promedio",
"this",
".",
"promedio",
"=",
"notaPromedio",
".",
"getEscala5",
"(",
")",
";",
"}"
] | [
199,
4
] | [
211,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
InfluxDBStatusBarPanel. | null | El string que se le pasa aparece displayado en la etiqueta
donde se muestran los mensajes al usuario.
@param message l string que se le pasa aparece displayado en la etiqueta
donde se muestran los mensajes al usuario.
| El string que se le pasa aparece displayado en la etiqueta
donde se muestran los mensajes al usuario.
| public void setMesage(String message){
messageLabel.setText(message);
} | [
"public",
"void",
"setMesage",
"(",
"String",
"message",
")",
"{",
"messageLabel",
".",
"setText",
"(",
"message",
")",
";",
"}"
] | [
71,
4
] | [
73,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
PeliculasDOM. | null | Borramos la película del arbol DOM | Borramos la película del arbol DOM | private void borrarPelicula(){
String respuesta = "S";
do {
Scanner sc = new Scanner(System.in);
System.out.println("Introduce el título de la película que quieres eliminar:");
String titulo = sc.nextLine();
//Obtenemos la referencia al elemento raiz
Element docEle = dom.getDocumentElement();
//Obtenemos un NodeList con todos los elementos pelicula
NodeList nl = docEle.getElementsByTagName("pelicula");
if (nl != null && nl.getLength() > 0) {
for (int i = 0; i < nl.getLength(); i++) {
//obtenemos el elemento película
Element peli = (Element) nl.item(i);
//si coicide el título borramos el elemento del arbol DOM
if (titulo.equalsIgnoreCase(getTextValue(peli, "titulo")))
{
docEle.removeChild(peli);
}
}
}
System.out.println("Deseas seguir eliminando películas? (S/N)");
respuesta = sc.nextLine().toUpperCase();
}while(!respuesta.equals("N"));
} | [
"private",
"void",
"borrarPelicula",
"(",
")",
"{",
"String",
"respuesta",
"=",
"\"S\"",
";",
"do",
"{",
"Scanner",
"sc",
"=",
"new",
"Scanner",
"(",
"System",
".",
"in",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Introduce el título de la película que quieres eliminar:\");",
"",
"",
"String",
"titulo",
"=",
"sc",
".",
"nextLine",
"(",
")",
";",
"//Obtenemos la referencia al elemento raiz",
"Element",
"docEle",
"=",
"dom",
".",
"getDocumentElement",
"(",
")",
";",
"//Obtenemos un NodeList con todos los elementos pelicula",
"NodeList",
"nl",
"=",
"docEle",
".",
"getElementsByTagName",
"(",
"\"pelicula\"",
")",
";",
"if",
"(",
"nl",
"!=",
"null",
"&&",
"nl",
".",
"getLength",
"(",
")",
">",
"0",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nl",
".",
"getLength",
"(",
")",
";",
"i",
"++",
")",
"{",
"//obtenemos el elemento película",
"Element",
"peli",
"=",
"(",
"Element",
")",
"nl",
".",
"item",
"(",
"i",
")",
";",
"//si coicide el título borramos el elemento del arbol DOM",
"if",
"(",
"titulo",
".",
"equalsIgnoreCase",
"(",
"getTextValue",
"(",
"peli",
",",
"\"titulo\"",
")",
")",
")",
"{",
"docEle",
".",
"removeChild",
"(",
"peli",
")",
";",
"}",
"}",
"}",
"System",
".",
"out",
".",
"println",
"(",
"\"Deseas seguir eliminando películas? (S/N)\")",
";",
"",
"respuesta",
"=",
"sc",
".",
"nextLine",
"(",
")",
".",
"toUpperCase",
"(",
")",
";",
"}",
"while",
"(",
"!",
"respuesta",
".",
"equals",
"(",
"\"N\"",
")",
")",
";",
"}"
] | [
271,
4
] | [
301,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Lista. | null | Enlace cola de rechazados | Enlace cola de rechazados | public void setColaDeRechazados(ColaDeEspera miColaDeRechazados) {
this.miColaDeRechazados = miColaDeRechazados;
} | [
"public",
"void",
"setColaDeRechazados",
"(",
"ColaDeEspera",
"miColaDeRechazados",
")",
"{",
"this",
".",
"miColaDeRechazados",
"=",
"miColaDeRechazados",
";",
"}"
] | [
37,
4
] | [
39,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Secretaria. | null | Habría que tener el imprimir mensaje de error al agregar como hemos visto en clase | Habría que tener el imprimir mensaje de error al agregar como hemos visto en clase | public boolean agregar2 (Alumno al) {
return listAlumnos.add(al);
} | [
"public",
"boolean",
"agregar2",
"(",
"Alumno",
"al",
")",
"{",
"return",
"listAlumnos",
".",
"add",
"(",
"al",
")",
";",
"}"
] | [
45,
1
] | [
48,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
EmpresaTest. | null | Test de regresión: probamos con el máximo posible de antigüedad | Test de regresión: probamos con el máximo posible de antigüedad | @Test
public void laEmpresaDebePoderObtenerElSueldoDeUneGerenteConParejaSinHijesConAntiguedad20() {
Empresa miEmpresa = new Empresa();
EmpleadeAbstracte miGerenteConParejaSinHijesConAntiguedad20 = new Gerente("Ana De la Cumbre", CON_PAREJA,
SIN_HIJES, ANTIGUEDAD_20);
miEmpresa.contratar(miGerenteConParejaSinHijesConAntiguedad20);
// El Cálculo para Gerente:
// Sueldo Básico + Salario Familiar + Antigüedad + Asig. por Personal a Cargo
//
// Sueldo Básico = 1000.0
// Salario Familar = 200.0 * hije + 100.0 si tiene pareja registrada
// Antigüedad: 100 * Año, max: 2000.
// Asig. por Personal a Cargo: 2000 (fijo)
// En este caso, para A == 20,
// 5100 = 1000 + 100.0 + (20 * 100.0) + 2000.0
assertEquals(5100, miEmpresa.obtTotalDeSueldos());
} | [
"@",
"Test",
"public",
"void",
"laEmpresaDebePoderObtenerElSueldoDeUneGerenteConParejaSinHijesConAntiguedad20",
"(",
")",
"{",
"Empresa",
"miEmpresa",
"=",
"new",
"Empresa",
"(",
")",
";",
"EmpleadeAbstracte",
"miGerenteConParejaSinHijesConAntiguedad20",
"=",
"new",
"Gerente",
"(",
"\"Ana De la Cumbre\"",
",",
"CON_PAREJA",
",",
"SIN_HIJES",
",",
"ANTIGUEDAD_20",
")",
";",
"miEmpresa",
".",
"contratar",
"(",
"miGerenteConParejaSinHijesConAntiguedad20",
")",
";",
"// El Cálculo para Gerente:",
"// Sueldo Básico + Salario Familiar + Antigüedad + Asig. por Personal a Cargo",
"//",
"// Sueldo Básico = 1000.0",
"// Salario Familar = 200.0 * hije + 100.0 si tiene pareja registrada",
"// Antigüedad: 100 * Año, max: 2000.",
"// Asig. por Personal a Cargo: 2000 (fijo)",
"// En este caso, para A == 20,",
"// 5100 = 1000 + 100.0 + (20 * 100.0) + 2000.0",
"assertEquals",
"(",
"5100",
",",
"miEmpresa",
".",
"obtTotalDeSueldos",
"(",
")",
")",
";",
"}"
] | [
448,
1
] | [
467,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
PantallaCoche. | null | Se encarga de renderizar el juego como vimos en el episodio 3. | Se encarga de renderizar el juego como vimos en el episodio 3. | private void renderizarJuego() {
// Con glClearColor y glClear podemos limpiar la pantalla y cambiarla por
// un fondo del color que le digamos. El color se lo decimos con los tres
// primeros parámetros, que son valores flotantes de tipo RGB entre 0 y 1.
Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
// Empezamos a mostrar cosas usando nuestro batch.
game.batch.begin();
// Para mostrar un Sprite la cosa es muy sencilla :)
miCoche.draw(game.batch);
game.batch.end();
} | [
"private",
"void",
"renderizarJuego",
"(",
")",
"{",
"// Con glClearColor y glClear podemos limpiar la pantalla y cambiarla por",
"// un fondo del color que le digamos. El color se lo decimos con los tres",
"// primeros parámetros, que son valores flotantes de tipo RGB entre 0 y 1.",
"Gdx",
".",
"gl",
".",
"glClearColor",
"(",
"0.2f",
",",
"0.2f",
",",
"0.2f",
",",
"1",
")",
";",
"Gdx",
".",
"gl",
".",
"glClear",
"(",
"GL20",
".",
"GL_COLOR_BUFFER_BIT",
")",
";",
"// Empezamos a mostrar cosas usando nuestro batch.",
"game",
".",
"batch",
".",
"begin",
"(",
")",
";",
"// Para mostrar un Sprite la cosa es muy sencilla :)",
"miCoche",
".",
"draw",
"(",
"game",
".",
"batch",
")",
";",
"game",
".",
"batch",
".",
"end",
"(",
")",
";",
"}"
] | [
109,
1
] | [
122,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Secretaria. | null | Devuelve el alumno buscado si lo encuentra o null si no es así | Devuelve el alumno buscado si lo encuentra o null si no es así | public Alumno buscarAlum2(String dni) {
Alumno tem=null;
boolean salir = false;
for (int i = 0; i < listAlumnos.size() && !salir; i++) {
if (listAlumnos.get(i).getDni().equalsIgnoreCase(dni)) {
tem = listAlumnos.get(i);
salir = true;
}
}
return tem;
} | [
"public",
"Alumno",
"buscarAlum2",
"(",
"String",
"dni",
")",
"{",
"Alumno",
"tem",
"=",
"null",
";",
"boolean",
"salir",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"listAlumnos",
".",
"size",
"(",
")",
"&&",
"!",
"salir",
";",
"i",
"++",
")",
"{",
"if",
"(",
"listAlumnos",
".",
"get",
"(",
"i",
")",
".",
"getDni",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"dni",
")",
")",
"{",
"tem",
"=",
"listAlumnos",
".",
"get",
"(",
"i",
")",
";",
"salir",
"=",
"true",
";",
"}",
"}",
"return",
"tem",
";",
"}"
] | [
74,
1
] | [
85,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
AAD4_E1_Jeremy. | null | Contar la cantidad de números repetidos de acuerdo al dígito indicado. | Contar la cantidad de números repetidos de acuerdo al dígito indicado. | public static int ContarNumerosRepetidos (long numero, int numeroacontabilizar)
{
// Variable Contador = 0
int contador = 0;
// Variable Resto=0
int resto = 0;
// Variable Número a contabilizar
// Variable NúmeroTemp = Número ingresado
long numerotemp = numero;
// Mientras que el NúmeroTemp >0
while (numerotemp >0)
{
System.out.println("Se ha entrado al while");
// Resto = Obtener el Resto de la división NúmeroTemp / 10
resto = (int)(numerotemp % 10);
// Si el Resto = Número a contabilizar
if (resto == numeroacontabilizar)
{
// Contador = Contador + 1
contador = contador +1;
}
// NúmeroTemp = NúmeroTemp / 10
numerotemp = numerotemp /10;
}
// Devolver Contador
return contador;
} | [
"public",
"static",
"int",
"ContarNumerosRepetidos",
"(",
"long",
"numero",
",",
"int",
"numeroacontabilizar",
")",
"{",
"// Variable Contador = 0",
"int",
"contador",
"=",
"0",
";",
"// Variable Resto=0",
"int",
"resto",
"=",
"0",
";",
"// Variable Número a contabilizar\t\t",
"// Variable NúmeroTemp = Número ingresado",
"long",
"numerotemp",
"=",
"numero",
";",
"// Mientras que el NúmeroTemp >0",
"while",
"(",
"numerotemp",
">",
"0",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Se ha entrado al while\"",
")",
";",
"// Resto = Obtener el Resto de la división NúmeroTemp / 10",
"resto",
"=",
"(",
"int",
")",
"(",
"numerotemp",
"%",
"10",
")",
";",
"// Si el Resto = Número a contabilizar",
"if",
"(",
"resto",
"==",
"numeroacontabilizar",
")",
"{",
"// Contador = Contador + 1",
"contador",
"=",
"contador",
"+",
"1",
";",
"}",
"// NúmeroTemp = NúmeroTemp / 10",
"numerotemp",
"=",
"numerotemp",
"/",
"10",
";",
"}",
"// Devolver Contador ",
"return",
"contador",
";",
"}"
] | [
61,
1
] | [
88,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
GxUtilsLoader. | null | Obtiene los bytes de la clase desde el JAR o del directorio
| Obtiene los bytes de la clase desde el JAR o del directorio
| private byte[] loadBytes(String className)
{
if(zipFile == null)
{
throw new NoClassDefFoundError(className);
}
byte[] result = null;
className = className.replace('.', '/') + ".class";
try
{
ZipEntry theEntry;
if((theEntry = zipFile.getEntry(className)) != null)
{
result = new byte[(int)theEntry.getSize()];
InputStream theStream = zipFile.getInputStream(theEntry);
new DataInputStream(new BufferedInputStream(theStream)).readFully(result);
theStream.close();
}
}catch(IOException e) { ; }
return result;
} | [
"private",
"byte",
"[",
"]",
"loadBytes",
"(",
"String",
"className",
")",
"{",
"if",
"(",
"zipFile",
"==",
"null",
")",
"{",
"throw",
"new",
"NoClassDefFoundError",
"(",
"className",
")",
";",
"}",
"byte",
"[",
"]",
"result",
"=",
"null",
";",
"className",
"=",
"className",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
"+",
"\".class\"",
";",
"try",
"{",
"ZipEntry",
"theEntry",
";",
"if",
"(",
"(",
"theEntry",
"=",
"zipFile",
".",
"getEntry",
"(",
"className",
")",
")",
"!=",
"null",
")",
"{",
"result",
"=",
"new",
"byte",
"[",
"(",
"int",
")",
"theEntry",
".",
"getSize",
"(",
")",
"]",
";",
"InputStream",
"theStream",
"=",
"zipFile",
".",
"getInputStream",
"(",
"theEntry",
")",
";",
"new",
"DataInputStream",
"(",
"new",
"BufferedInputStream",
"(",
"theStream",
")",
")",
".",
"readFully",
"(",
"result",
")",
";",
"theStream",
".",
"close",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
";",
"}",
"return",
"result",
";",
"}"
] | [
189,
1
] | [
211,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
GXBCCollection. | null | -- Add de una collection de BC | -- Add de una collection de BC | @SuppressWarnings("unchecked")
public boolean addElementTrn(Object item)
{
try
{
elementsType.getMethod(getMethodName(false, "Mode"), new Class[]{String.class}).invoke(item, new Object[]{"INS"});
elementsType.getMethod(getMethodName(false, "Modified"), new Class[]{short.class}).invoke(item, new Object[]{new Short((short)1)});
}catch(Exception e)
{
System.err.println("[addElementTrn]:" + e.toString());
e.printStackTrace();
}
return super.add((T)item); //Vector add element
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"boolean",
"addElementTrn",
"(",
"Object",
"item",
")",
"{",
"try",
"{",
"elementsType",
".",
"getMethod",
"(",
"getMethodName",
"(",
"false",
",",
"\"Mode\"",
")",
",",
"new",
"Class",
"[",
"]",
"{",
"String",
".",
"class",
"}",
")",
".",
"invoke",
"(",
"item",
",",
"new",
"Object",
"[",
"]",
"{",
"\"INS\"",
"}",
")",
";",
"elementsType",
".",
"getMethod",
"(",
"getMethodName",
"(",
"false",
",",
"\"Modified\"",
")",
",",
"new",
"Class",
"[",
"]",
"{",
"short",
".",
"class",
"}",
")",
".",
"invoke",
"(",
"item",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Short",
"(",
"(",
"short",
")",
"1",
")",
"}",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"[addElementTrn]:\"",
"+",
"e",
".",
"toString",
"(",
")",
")",
";",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"super",
".",
"add",
"(",
"(",
"T",
")",
"item",
")",
";",
"//Vector add element",
"}"
] | [
60,
2
] | [
73,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Registro. | null | Método InsertarReservaciones con posición | Método InsertarReservaciones con posición | public void InsertarReservaciones(int Posicion, Reservacion ReservacionAAsignar)
{
RegistroReservaciones.add(Posicion, ReservacionAAsignar);
} | [
"public",
"void",
"InsertarReservaciones",
"(",
"int",
"Posicion",
",",
"Reservacion",
"ReservacionAAsignar",
")",
"{",
"RegistroReservaciones",
".",
"add",
"(",
"Posicion",
",",
"ReservacionAAsignar",
")",
";",
"}"
] | [
132,
4
] | [
135,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
BuscarDatosUsuario. | null | Metodo para poner los datos de lo usuarios de una lista (Usado en las listas de busqueda de usuarios) | Metodo para poner los datos de lo usuarios de una lista (Usado en las listas de busqueda de usuarios) | public ArrayList<Usuario> obtenerDatosUsu(ArrayList<Usuario> listaUsu) {
ArrayList<Usuario> listaUsuObt = new ArrayList<Usuario>();
for(int i = 0; listaUsu.size() > i ; i++){
Usuario usu = new Usuario();
usu = listaUsu.get(i);
//Poner datos al usuario
usu = service.getUsuarioById(usu.getIdUsu());
listaUsuObt.add(usu);
}
return listaUsuObt;
} | [
"public",
"ArrayList",
"<",
"Usuario",
">",
"obtenerDatosUsu",
"(",
"ArrayList",
"<",
"Usuario",
">",
"listaUsu",
")",
"{",
"ArrayList",
"<",
"Usuario",
">",
"listaUsuObt",
"=",
"new",
"ArrayList",
"<",
"Usuario",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"listaUsu",
".",
"size",
"(",
")",
">",
"i",
";",
"i",
"++",
")",
"{",
"Usuario",
"usu",
"=",
"new",
"Usuario",
"(",
")",
";",
"usu",
"=",
"listaUsu",
".",
"get",
"(",
"i",
")",
";",
"//Poner datos al usuario\r",
"usu",
"=",
"service",
".",
"getUsuarioById",
"(",
"usu",
".",
"getIdUsu",
"(",
")",
")",
";",
"listaUsuObt",
".",
"add",
"(",
"usu",
")",
";",
"}",
"return",
"listaUsuObt",
";",
"}"
] | [
22,
1
] | [
38,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
BaseDeDatos. | null | Mostrar los registros de un día especifico: | Mostrar los registros de un día especifico: | public ArrayList<Turno> consultarRegistrosPorDia(String fecha, ArrayList<Turno> array, String tipoUsu, boolean cja, boolean assor) {
try {
String[] lugar = new String[2];
//Crea un objeto SQLServerStatement que genera objetos.
Statement consulta = conexion.createStatement();
String SQL = "";
if (tipoUsu.equals("EA") || tipoUsu.equals("EP")) {
SQL = "SELECT tipo_usuario, turno, motivo_consulta, cod_lugar, to_char(fecha_registro, 'dd/mm/yy') \"Fecha\", to_char(hora_llegada, '99,99') \"hora\", TITULAR.* FROM REGISTRO, REGISTRO_TITULAR, TITULAR where registro.fecha_registro = '"
+ fecha + "' and registro.tipo_usuario = '" + tipoUsu + "' and registro.cod_registro = registro_titular.cod_registro and registro_titular.cod_titular = Titular.cod_titular";
} else {
SQL = "SELECT tipo_usuario, turno, motivo_consulta, cod_lugar, to_char(fecha_registro, 'dd/mm/yy') \"fecha\" , to_char(hora_llegada, '99,99') \"hora\" FROM REGISTRO where registro.fecha_registro = '"
+ fecha + "' and registro.tipo_usuario = '" + tipoUsu + "'";
}
System.out.println("SQL: " + SQL);
//Creamos un vector de dos dimensiones con la cantidad de filas y columnas ya establecidas
ArrayList<Turno> consultaArray = array;
//Obtiene el resultado de la busqueda de todos las filas de la base de datos.
ResultSet resultado = consulta.executeQuery(SQL);
//En cada registro seleccionado asignamos sus valores dentro del vector consultaArray-
while (resultado.next()) {
String turno, motivo, modulo, fechaTurno, hora, id, correo;
turno = resultado.getString("tipo_usuario") + "-" + resultado.getString("turno");
motivo = resultado.getString("motivo_consulta");
modulo = resultado.getString("cod_lugar");
lugar = consultarLugar(modulo);
if(!lugar[0].equals("WAITING")){
modulo = lugar[0] + " " + lugar[1];
}else{
modulo = "No asignado";
}
fechaTurno = resultado.getString("fecha");
hora = resultado.getString("hora");
if (tipoUsu.equals("EA") || tipoUsu.equals("EP")) {
id = resultado.getString("identificacion");
correo = resultado.getString("correo");
} else {
id = "";
correo = "";
}
hora = hora.replace(",", ":");
if (cja && assor) {
consultaArray.add(new Turno(turno, modulo, hora, fechaTurno, motivo, id, correo));
} else if (cja && !assor) {
if (lugar[0].equals("CAJA")) {
consultaArray.add(new Turno(turno, modulo, hora, fechaTurno, motivo, id, correo));
}
} else if (!cja && assor) {
if (lugar[0].equals("ASESOR")) {
consultaArray.add(new Turno(turno, modulo, hora, fechaTurno, motivo, id, correo));
}
}
else{
if (lugar[0].equals("WAITING")) {
consultaArray.add(new Turno(turno, modulo, hora, fechaTurno, motivo, id, correo));
}
}
}
return consultaArray;
} catch (Exception ex) {
//DO SOMETHING
System.out.println(ex.toString());
return null; //No retornamos ningun valor.
}
} | [
"public",
"ArrayList",
"<",
"Turno",
">",
"consultarRegistrosPorDia",
"(",
"String",
"fecha",
",",
"ArrayList",
"<",
"Turno",
">",
"array",
",",
"String",
"tipoUsu",
",",
"boolean",
"cja",
",",
"boolean",
"assor",
")",
"{",
"try",
"{",
"String",
"[",
"]",
"lugar",
"=",
"new",
"String",
"[",
"2",
"]",
";",
"//Crea un objeto SQLServerStatement que genera objetos.",
"Statement",
"consulta",
"=",
"conexion",
".",
"createStatement",
"(",
")",
";",
"String",
"SQL",
"=",
"\"\"",
";",
"if",
"(",
"tipoUsu",
".",
"equals",
"(",
"\"EA\"",
")",
"||",
"tipoUsu",
".",
"equals",
"(",
"\"EP\"",
")",
")",
"{",
"SQL",
"=",
"\"SELECT tipo_usuario, turno, motivo_consulta, cod_lugar, to_char(fecha_registro, 'dd/mm/yy') \\\"Fecha\\\", to_char(hora_llegada, '99,99') \\\"hora\\\", TITULAR.* FROM REGISTRO, REGISTRO_TITULAR, TITULAR where registro.fecha_registro = '\"",
"+",
"fecha",
"+",
"\"' and registro.tipo_usuario = '\"",
"+",
"tipoUsu",
"+",
"\"' and registro.cod_registro = registro_titular.cod_registro and registro_titular.cod_titular = Titular.cod_titular\"",
";",
"}",
"else",
"{",
"SQL",
"=",
"\"SELECT tipo_usuario, turno, motivo_consulta, cod_lugar, to_char(fecha_registro, 'dd/mm/yy') \\\"fecha\\\" , to_char(hora_llegada, '99,99') \\\"hora\\\" FROM REGISTRO where registro.fecha_registro = '\"",
"+",
"fecha",
"+",
"\"' and registro.tipo_usuario = '\"",
"+",
"tipoUsu",
"+",
"\"'\"",
";",
"}",
"System",
".",
"out",
".",
"println",
"(",
"\"SQL: \"",
"+",
"SQL",
")",
";",
"//Creamos un vector de dos dimensiones con la cantidad de filas y columnas ya establecidas",
"ArrayList",
"<",
"Turno",
">",
"consultaArray",
"=",
"array",
";",
"//Obtiene el resultado de la busqueda de todos las filas de la base de datos.",
"ResultSet",
"resultado",
"=",
"consulta",
".",
"executeQuery",
"(",
"SQL",
")",
";",
"//En cada registro seleccionado asignamos sus valores dentro del vector consultaArray-",
"while",
"(",
"resultado",
".",
"next",
"(",
")",
")",
"{",
"String",
"turno",
",",
"motivo",
",",
"modulo",
",",
"fechaTurno",
",",
"hora",
",",
"id",
",",
"correo",
";",
"turno",
"=",
"resultado",
".",
"getString",
"(",
"\"tipo_usuario\"",
")",
"+",
"\"-\"",
"+",
"resultado",
".",
"getString",
"(",
"\"turno\"",
")",
";",
"motivo",
"=",
"resultado",
".",
"getString",
"(",
"\"motivo_consulta\"",
")",
";",
"modulo",
"=",
"resultado",
".",
"getString",
"(",
"\"cod_lugar\"",
")",
";",
"lugar",
"=",
"consultarLugar",
"(",
"modulo",
")",
";",
"if",
"(",
"!",
"lugar",
"[",
"0",
"]",
".",
"equals",
"(",
"\"WAITING\"",
")",
")",
"{",
"modulo",
"=",
"lugar",
"[",
"0",
"]",
"+",
"\" \"",
"+",
"lugar",
"[",
"1",
"]",
";",
"}",
"else",
"{",
"modulo",
"=",
"\"No asignado\"",
";",
"}",
"fechaTurno",
"=",
"resultado",
".",
"getString",
"(",
"\"fecha\"",
")",
";",
"hora",
"=",
"resultado",
".",
"getString",
"(",
"\"hora\"",
")",
";",
"if",
"(",
"tipoUsu",
".",
"equals",
"(",
"\"EA\"",
")",
"||",
"tipoUsu",
".",
"equals",
"(",
"\"EP\"",
")",
")",
"{",
"id",
"=",
"resultado",
".",
"getString",
"(",
"\"identificacion\"",
")",
";",
"correo",
"=",
"resultado",
".",
"getString",
"(",
"\"correo\"",
")",
";",
"}",
"else",
"{",
"id",
"=",
"\"\"",
";",
"correo",
"=",
"\"\"",
";",
"}",
"hora",
"=",
"hora",
".",
"replace",
"(",
"\",\"",
",",
"\":\"",
")",
";",
"if",
"(",
"cja",
"&&",
"assor",
")",
"{",
"consultaArray",
".",
"add",
"(",
"new",
"Turno",
"(",
"turno",
",",
"modulo",
",",
"hora",
",",
"fechaTurno",
",",
"motivo",
",",
"id",
",",
"correo",
")",
")",
";",
"}",
"else",
"if",
"(",
"cja",
"&&",
"!",
"assor",
")",
"{",
"if",
"(",
"lugar",
"[",
"0",
"]",
".",
"equals",
"(",
"\"CAJA\"",
")",
")",
"{",
"consultaArray",
".",
"add",
"(",
"new",
"Turno",
"(",
"turno",
",",
"modulo",
",",
"hora",
",",
"fechaTurno",
",",
"motivo",
",",
"id",
",",
"correo",
")",
")",
";",
"}",
"}",
"else",
"if",
"(",
"!",
"cja",
"&&",
"assor",
")",
"{",
"if",
"(",
"lugar",
"[",
"0",
"]",
".",
"equals",
"(",
"\"ASESOR\"",
")",
")",
"{",
"consultaArray",
".",
"add",
"(",
"new",
"Turno",
"(",
"turno",
",",
"modulo",
",",
"hora",
",",
"fechaTurno",
",",
"motivo",
",",
"id",
",",
"correo",
")",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"lugar",
"[",
"0",
"]",
".",
"equals",
"(",
"\"WAITING\"",
")",
")",
"{",
"consultaArray",
".",
"add",
"(",
"new",
"Turno",
"(",
"turno",
",",
"modulo",
",",
"hora",
",",
"fechaTurno",
",",
"motivo",
",",
"id",
",",
"correo",
")",
")",
";",
"}",
"}",
"}",
"return",
"consultaArray",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"//DO SOMETHING",
"System",
".",
"out",
".",
"println",
"(",
"ex",
".",
"toString",
"(",
")",
")",
";",
"return",
"null",
";",
"//No retornamos ningun valor.",
"}",
"}"
] | [
276,
4
] | [
341,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Visualizacao. | null | metodo sobre cargar | metodo sobre cargar | public void avaliar(){
this.filme.setAvaliacao(5);
} | [
"public",
"void",
"avaliar",
"(",
")",
"{",
"this",
".",
"filme",
".",
"setAvaliacao",
"(",
"5",
")",
";",
"}"
] | [
47,
4
] | [
49,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Arreglo_Alumno. | null | Para obtener la lista | Para obtener la lista | public ArrayList<Alumno> listado() {
return lista;
} | [
"public",
"ArrayList",
"<",
"Alumno",
">",
"listado",
"(",
")",
"{",
"return",
"lista",
";",
"}"
] | [
25,
4
] | [
28,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ProductosApiResource. | null | Método que devuelve todos los productos | Método que devuelve todos los productos | @GET
@Produces("application/json")
public Collection<Producto> getAllProductos() {
return repository.getAllAnimeProductos();
} | [
"@",
"GET",
"@",
"Produces",
"(",
"\"application/json\"",
")",
"public",
"Collection",
"<",
"Producto",
">",
"getAllProductos",
"(",
")",
"{",
"return",
"repository",
".",
"getAllAnimeProductos",
"(",
")",
";",
"}"
] | [
36,
1
] | [
40,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CropOverlayView. | null | Metodo que ayuda a crear una cuadricula entre los vertices de ayuda
se crea una cuadricula de 4x4
| Metodo que ayuda a crear una cuadricula entre los vertices de ayuda
se crea una cuadricula de 4x4
| private void drawGrid(Canvas canvas) {
Paint paint = new Paint();
paint.setColor(Color.WHITE);
paint.setStrokeWidth(2);
paint.setAntiAlias(true);
for (int i = 1; i <= gridSize; i++) {
int topDistanceX = Math.abs(topLeft.x - topRight.x) / (gridSize + 1) * i;
int topDistanceY = Math.abs((topLeft.y - topRight.y) / (gridSize + 1) * i);
Point top = new Point(
topLeft.x < topRight.x ? topLeft.x + topDistanceX : topLeft.x - topDistanceX,
topLeft.y < topRight.y ? topLeft.y + topDistanceY : topLeft.y - topDistanceY);
int bottomDistanceX = Math.abs((bottomLeft.x - bottomRight.x) / (gridSize + 1) * i);
int bottomDistanceY = Math.abs((bottomLeft.y - bottomRight.y) / (gridSize + 1) * i);
Point bottom = new Point(
bottomLeft.x < bottomRight.x ? bottomLeft.x + bottomDistanceX : bottomLeft.x - bottomDistanceX,
bottomLeft.y < bottomRight.y ? bottomLeft.y + bottomDistanceY : bottomLeft.y - bottomDistanceY);
canvas.drawLine(top.x, top.y, bottom.x, bottom.y, paint);
int leftDistanceX = Math.abs((topLeft.x - bottomLeft.x) / (gridSize + 1) * i);
int leftDistanceY = Math.abs((topLeft.y - bottomLeft.y) / (gridSize + 1) * i);
Point left = new Point(
topLeft.x < bottomLeft.x ? topLeft.x + leftDistanceX : topLeft.x - leftDistanceX,
topLeft.y < bottomLeft.y ? topLeft.y + leftDistanceY : topLeft.y - leftDistanceY);
int rightDistanceX = Math.abs((topRight.x - bottomRight.x) / (gridSize + 1) * i);
int rightDistanceY = Math.abs((topRight.y - bottomRight.y) / (gridSize + 1) * i);
Point right = new Point(
topRight.x < bottomRight.x ? topRight.x + rightDistanceX : topRight.x - rightDistanceX,
topRight.y < bottomRight.y ? topRight.y + rightDistanceY : topRight.y - rightDistanceY);
canvas.drawLine(left.x, left.y, right.x, right.y, paint);
}
} | [
"private",
"void",
"drawGrid",
"(",
"Canvas",
"canvas",
")",
"{",
"Paint",
"paint",
"=",
"new",
"Paint",
"(",
")",
";",
"paint",
".",
"setColor",
"(",
"Color",
".",
"WHITE",
")",
";",
"paint",
".",
"setStrokeWidth",
"(",
"2",
")",
";",
"paint",
".",
"setAntiAlias",
"(",
"true",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<=",
"gridSize",
";",
"i",
"++",
")",
"{",
"int",
"topDistanceX",
"=",
"Math",
".",
"abs",
"(",
"topLeft",
".",
"x",
"-",
"topRight",
".",
"x",
")",
"/",
"(",
"gridSize",
"+",
"1",
")",
"*",
"i",
";",
"int",
"topDistanceY",
"=",
"Math",
".",
"abs",
"(",
"(",
"topLeft",
".",
"y",
"-",
"topRight",
".",
"y",
")",
"/",
"(",
"gridSize",
"+",
"1",
")",
"*",
"i",
")",
";",
"Point",
"top",
"=",
"new",
"Point",
"(",
"topLeft",
".",
"x",
"<",
"topRight",
".",
"x",
"?",
"topLeft",
".",
"x",
"+",
"topDistanceX",
":",
"topLeft",
".",
"x",
"-",
"topDistanceX",
",",
"topLeft",
".",
"y",
"<",
"topRight",
".",
"y",
"?",
"topLeft",
".",
"y",
"+",
"topDistanceY",
":",
"topLeft",
".",
"y",
"-",
"topDistanceY",
")",
";",
"int",
"bottomDistanceX",
"=",
"Math",
".",
"abs",
"(",
"(",
"bottomLeft",
".",
"x",
"-",
"bottomRight",
".",
"x",
")",
"/",
"(",
"gridSize",
"+",
"1",
")",
"*",
"i",
")",
";",
"int",
"bottomDistanceY",
"=",
"Math",
".",
"abs",
"(",
"(",
"bottomLeft",
".",
"y",
"-",
"bottomRight",
".",
"y",
")",
"/",
"(",
"gridSize",
"+",
"1",
")",
"*",
"i",
")",
";",
"Point",
"bottom",
"=",
"new",
"Point",
"(",
"bottomLeft",
".",
"x",
"<",
"bottomRight",
".",
"x",
"?",
"bottomLeft",
".",
"x",
"+",
"bottomDistanceX",
":",
"bottomLeft",
".",
"x",
"-",
"bottomDistanceX",
",",
"bottomLeft",
".",
"y",
"<",
"bottomRight",
".",
"y",
"?",
"bottomLeft",
".",
"y",
"+",
"bottomDistanceY",
":",
"bottomLeft",
".",
"y",
"-",
"bottomDistanceY",
")",
";",
"canvas",
".",
"drawLine",
"(",
"top",
".",
"x",
",",
"top",
".",
"y",
",",
"bottom",
".",
"x",
",",
"bottom",
".",
"y",
",",
"paint",
")",
";",
"int",
"leftDistanceX",
"=",
"Math",
".",
"abs",
"(",
"(",
"topLeft",
".",
"x",
"-",
"bottomLeft",
".",
"x",
")",
"/",
"(",
"gridSize",
"+",
"1",
")",
"*",
"i",
")",
";",
"int",
"leftDistanceY",
"=",
"Math",
".",
"abs",
"(",
"(",
"topLeft",
".",
"y",
"-",
"bottomLeft",
".",
"y",
")",
"/",
"(",
"gridSize",
"+",
"1",
")",
"*",
"i",
")",
";",
"Point",
"left",
"=",
"new",
"Point",
"(",
"topLeft",
".",
"x",
"<",
"bottomLeft",
".",
"x",
"?",
"topLeft",
".",
"x",
"+",
"leftDistanceX",
":",
"topLeft",
".",
"x",
"-",
"leftDistanceX",
",",
"topLeft",
".",
"y",
"<",
"bottomLeft",
".",
"y",
"?",
"topLeft",
".",
"y",
"+",
"leftDistanceY",
":",
"topLeft",
".",
"y",
"-",
"leftDistanceY",
")",
";",
"int",
"rightDistanceX",
"=",
"Math",
".",
"abs",
"(",
"(",
"topRight",
".",
"x",
"-",
"bottomRight",
".",
"x",
")",
"/",
"(",
"gridSize",
"+",
"1",
")",
"*",
"i",
")",
";",
"int",
"rightDistanceY",
"=",
"Math",
".",
"abs",
"(",
"(",
"topRight",
".",
"y",
"-",
"bottomRight",
".",
"y",
")",
"/",
"(",
"gridSize",
"+",
"1",
")",
"*",
"i",
")",
";",
"Point",
"right",
"=",
"new",
"Point",
"(",
"topRight",
".",
"x",
"<",
"bottomRight",
".",
"x",
"?",
"topRight",
".",
"x",
"+",
"rightDistanceX",
":",
"topRight",
".",
"x",
"-",
"rightDistanceX",
",",
"topRight",
".",
"y",
"<",
"bottomRight",
".",
"y",
"?",
"topRight",
".",
"y",
"+",
"rightDistanceY",
":",
"topRight",
".",
"y",
"-",
"rightDistanceY",
")",
";",
"canvas",
".",
"drawLine",
"(",
"left",
".",
"x",
",",
"left",
".",
"y",
",",
"right",
".",
"x",
",",
"right",
".",
"y",
",",
"paint",
")",
";",
"}",
"}"
] | [
189,
4
] | [
228,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CrearCuenta. | null | Método para cuando se desenfoca de CampoNombre | Método para cuando se desenfoca de CampoNombre | private void CampoNombreFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_CampoNombreFocusLost
// Obtiene contenido de campo
String Contenido = this.CampoNombre.getText();
// Obtiene color de campo
Color ColorActual = this.CampoNombre.getForeground();
// Color cuando no se ha escrito nada
Color ColorNoEscrito = new Color(102, 102, 102);
// Color cuando se va a escribir algo
Color ColorEscribir = new Color(51, 51, 51);
// Verifica contenido y color de campo son los predeterminados
if(!Contenido.equals("Nombre(s)"))
{
if(Contenido.equals(""))
{
this.CampoNombre.setText("Nombre(s)");
if(ColorActual != ColorNoEscrito)
{
this.CampoNombre.setForeground(ColorNoEscrito);
}
}
}
} | [
"private",
"void",
"CampoNombreFocusLost",
"(",
"java",
".",
"awt",
".",
"event",
".",
"FocusEvent",
"evt",
")",
"{",
"//GEN-FIRST:event_CampoNombreFocusLost",
"// Obtiene contenido de campo",
"String",
"Contenido",
"=",
"this",
".",
"CampoNombre",
".",
"getText",
"(",
")",
";",
"// Obtiene color de campo",
"Color",
"ColorActual",
"=",
"this",
".",
"CampoNombre",
".",
"getForeground",
"(",
")",
";",
"// Color cuando no se ha escrito nada",
"Color",
"ColorNoEscrito",
"=",
"new",
"Color",
"(",
"102",
",",
"102",
",",
"102",
")",
";",
"// Color cuando se va a escribir algo",
"Color",
"ColorEscribir",
"=",
"new",
"Color",
"(",
"51",
",",
"51",
",",
"51",
")",
";",
"// Verifica contenido y color de campo son los predeterminados",
"if",
"(",
"!",
"Contenido",
".",
"equals",
"(",
"\"Nombre(s)\"",
")",
")",
"{",
"if",
"(",
"Contenido",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"this",
".",
"CampoNombre",
".",
"setText",
"(",
"\"Nombre(s)\"",
")",
";",
"if",
"(",
"ColorActual",
"!=",
"ColorNoEscrito",
")",
"{",
"this",
".",
"CampoNombre",
".",
"setForeground",
"(",
"ColorNoEscrito",
")",
";",
"}",
"}",
"}",
"}"
] | [
936,
4
] | [
957,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
EmpresaTest. | null | Test de regresión: verificamos que todos los demás casos posibles lo sean | Test de regresión: verificamos que todos los demás casos posibles lo sean | @Test
public void deboPoderMostrarUnaEmpresaConUnGerenteDePlantaPermanente() {
Empresa miEmpresa = new Empresa();
EmpleadeAbstracte miEmpleade = new Gerente("Ana De la Cumbre", SIN_PAREJA, SIN_HIJES, SIN_ANTIGUEDAD);
miEmpresa.contratar(miEmpleade);
String mostrar = "Cantidad de Empleades: 1." + "\n" + "1. Ana De la Cumbre (Gerente, Planta Permanente)";
// System.out.println(miEmpresa.toString());
assertEquals(mostrar, miEmpresa.toString());
} | [
"@",
"Test",
"public",
"void",
"deboPoderMostrarUnaEmpresaConUnGerenteDePlantaPermanente",
"(",
")",
"{",
"Empresa",
"miEmpresa",
"=",
"new",
"Empresa",
"(",
")",
";",
"EmpleadeAbstracte",
"miEmpleade",
"=",
"new",
"Gerente",
"(",
"\"Ana De la Cumbre\"",
",",
"SIN_PAREJA",
",",
"SIN_HIJES",
",",
"SIN_ANTIGUEDAD",
")",
";",
"miEmpresa",
".",
"contratar",
"(",
"miEmpleade",
")",
";",
"String",
"mostrar",
"=",
"\"Cantidad de Empleades: 1.\"",
"+",
"\"\\n\"",
"+",
"\"1. Ana De la Cumbre (Gerente, Planta Permanente)\"",
";",
"// System.out.println(miEmpresa.toString());",
"assertEquals",
"(",
"mostrar",
",",
"miEmpresa",
".",
"toString",
"(",
")",
")",
";",
"}"
] | [
90,
1
] | [
99,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
GameScreen. | null | Crea el mundo del juego | Crea el mundo del juego | @Override protected World createWorld() {
RenderBatchingSystem renderBatchingSystem;
final SpriteBatch batch = new SpriteBatch(2000);
/**
* Constructor de mundos.
* Permite la adicion conveniente de var-arg de sistemas, administradores. Admite complementos.
* */
WorldConfigurationBuilder worldConfigurationBuilder = new WorldConfigurationBuilder()
// dependsOn() especifiqua la dependencia de los sistemas/complementos
.dependsOn(MyFluidEntityPlugin.class, EntityLinkManager.class, OperationsPlugin.class, SingletonPlugin.class).with(new EventSystem())
// with() agrega los sistemas activos, se conserva el orden. Solo se permite una instancia de cada clase.
.with(new FontManager(), new TagManager(), new TiledMapManager(GameRules.nextMap))
.with(new CameraSystem(2), new MyClearScreenSystem(Color.valueOf(BACKGROUND_COLOR_HEX)), // Probablemente bien
new GameScreenAssetSystem(), new MapEntitySpawnerSystem(), // Convierte mapas en mosaico en FutureEntities para que se generen
new FutureEntitySystem(new MyEntityAssemblyStrategy()), // Responsable de las entidades de desove
new ParticleEffectSystem(new MyParticleEffectStrategy()), new PlayerControlSystem(),
// @todo fase 2: movimiento separado del enlace de teclas al control
new PhysicsSystem(), // Para particulas
new BoxPhysicsSystem(), new BoxPhysicsMouseSystem(), new LatchingSystem(), new MouseCursorSystem(),
new PickupSystem(), new LeakSystem(), new BeamedSystem(),
new LevelTimerSystem(),
new CameraFollowSystem(), new PlayerAnimationSystem(),
new BreathingSfxSystem(), new LeakSfxSystem(),
new RenderBackgroundSystem(),
renderBatchingSystem = new RenderBatchingSystem(), new MyAnimRenderSystem(renderBatchingSystem),
new MyLabelRenderSystem(renderBatchingSystem), new MapLayerRenderSystem(renderBatchingSystem, batch), new UiSystem(),
new SoundPlaySystem("leak-loop.wav", "oxygen-recharge-1", "oxygen-recharge-2", "astronaut-pops", "breath-normal",
"breath-laboured", "breath-suffocating", "suit-puncture", "suit-almost-puncture", "suit-last-oxygen-escapes",
"ship-reached", "tractor-lock-1.wav", "tractor-lock-2.wav", "tractor-unlock.wav", "orb-on", "randomise"),
new BoxPhysicsDebugRenderSystem(), new TransitionSystem(GdxArtemisGame.getInstance(), this));
if (GameRules.DEBUG_ENABLED) {
// worldConfigurationBuilder.with(new DebugOptionControlSystem());
}
return new World(worldConfigurationBuilder.build());
} | [
"@",
"Override",
"protected",
"World",
"createWorld",
"(",
")",
"{",
"RenderBatchingSystem",
"renderBatchingSystem",
";",
"final",
"SpriteBatch",
"batch",
"=",
"new",
"SpriteBatch",
"(",
"2000",
")",
";",
"/**\n\t\t * Constructor de mundos.\n\t\t * Permite la adicion conveniente de var-arg de sistemas, administradores. Admite complementos.\n\t\t * */",
"WorldConfigurationBuilder",
"worldConfigurationBuilder",
"=",
"new",
"WorldConfigurationBuilder",
"(",
")",
"// dependsOn() especifiqua la dependencia de los sistemas/complementos",
".",
"dependsOn",
"(",
"MyFluidEntityPlugin",
".",
"class",
",",
"EntityLinkManager",
".",
"class",
",",
"OperationsPlugin",
".",
"class",
",",
"SingletonPlugin",
".",
"class",
")",
".",
"with",
"(",
"new",
"EventSystem",
"(",
")",
")",
"// with() agrega los sistemas activos, se conserva el orden. Solo se permite una instancia de cada clase.",
".",
"with",
"(",
"new",
"FontManager",
"(",
")",
",",
"new",
"TagManager",
"(",
")",
",",
"new",
"TiledMapManager",
"(",
"GameRules",
".",
"nextMap",
")",
")",
".",
"with",
"(",
"new",
"CameraSystem",
"(",
"2",
")",
",",
"new",
"MyClearScreenSystem",
"(",
"Color",
".",
"valueOf",
"(",
"BACKGROUND_COLOR_HEX",
")",
")",
",",
"// Probablemente bien",
"new",
"GameScreenAssetSystem",
"(",
")",
",",
"new",
"MapEntitySpawnerSystem",
"(",
")",
",",
"// Convierte mapas en mosaico en FutureEntities para que se generen",
"new",
"FutureEntitySystem",
"(",
"new",
"MyEntityAssemblyStrategy",
"(",
")",
")",
",",
"// Responsable de las entidades de desove",
"new",
"ParticleEffectSystem",
"(",
"new",
"MyParticleEffectStrategy",
"(",
")",
")",
",",
"new",
"PlayerControlSystem",
"(",
")",
",",
"// @todo fase 2: movimiento separado del enlace de teclas al control",
"new",
"PhysicsSystem",
"(",
")",
",",
"// Para particulas",
"new",
"BoxPhysicsSystem",
"(",
")",
",",
"new",
"BoxPhysicsMouseSystem",
"(",
")",
",",
"new",
"LatchingSystem",
"(",
")",
",",
"new",
"MouseCursorSystem",
"(",
")",
",",
"new",
"PickupSystem",
"(",
")",
",",
"new",
"LeakSystem",
"(",
")",
",",
"new",
"BeamedSystem",
"(",
")",
",",
"new",
"LevelTimerSystem",
"(",
")",
",",
"new",
"CameraFollowSystem",
"(",
")",
",",
"new",
"PlayerAnimationSystem",
"(",
")",
",",
"new",
"BreathingSfxSystem",
"(",
")",
",",
"new",
"LeakSfxSystem",
"(",
")",
",",
"new",
"RenderBackgroundSystem",
"(",
")",
",",
"renderBatchingSystem",
"=",
"new",
"RenderBatchingSystem",
"(",
")",
",",
"new",
"MyAnimRenderSystem",
"(",
"renderBatchingSystem",
")",
",",
"new",
"MyLabelRenderSystem",
"(",
"renderBatchingSystem",
")",
",",
"new",
"MapLayerRenderSystem",
"(",
"renderBatchingSystem",
",",
"batch",
")",
",",
"new",
"UiSystem",
"(",
")",
",",
"new",
"SoundPlaySystem",
"(",
"\"leak-loop.wav\"",
",",
"\"oxygen-recharge-1\"",
",",
"\"oxygen-recharge-2\"",
",",
"\"astronaut-pops\"",
",",
"\"breath-normal\"",
",",
"\"breath-laboured\"",
",",
"\"breath-suffocating\"",
",",
"\"suit-puncture\"",
",",
"\"suit-almost-puncture\"",
",",
"\"suit-last-oxygen-escapes\"",
",",
"\"ship-reached\"",
",",
"\"tractor-lock-1.wav\"",
",",
"\"tractor-lock-2.wav\"",
",",
"\"tractor-unlock.wav\"",
",",
"\"orb-on\"",
",",
"\"randomise\"",
")",
",",
"new",
"BoxPhysicsDebugRenderSystem",
"(",
")",
",",
"new",
"TransitionSystem",
"(",
"GdxArtemisGame",
".",
"getInstance",
"(",
")",
",",
"this",
")",
")",
";",
"if",
"(",
"GameRules",
".",
"DEBUG_ENABLED",
")",
"{",
"// worldConfigurationBuilder.with(new DebugOptionControlSystem());",
"}",
"return",
"new",
"World",
"(",
"worldConfigurationBuilder",
".",
"build",
"(",
")",
")",
";",
"}"
] | [
40,
1
] | [
86,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
AmigosUsuController. | null | Peticiones de amistad realizadas por el usuario | Peticiones de amistad realizadas por el usuario | @CrossOrigin(origins = "http://localhost:4200")
@GetMapping("/getPeticionesRealizadasUsuario/{idUsu}")
public ResponseEntity<List<AmigosUsu>> getPeticionesRealizadasUsuario(@PathVariable int idUsu){
ArrayList<AmigosUsu> listaAmigosUsu = new ArrayList<AmigosUsu>();
listaAmigosUsu = (ArrayList<AmigosUsu>) service.findPeticionesRealizadasUsuario(idUsu);
listaAmigosUsu = quitarListasUsu(listaAmigosUsu);
return new ResponseEntity<List<AmigosUsu>>(listaAmigosUsu, HttpStatus.OK);
} | [
"@",
"CrossOrigin",
"(",
"origins",
"=",
"\"http://localhost:4200\"",
")",
"@",
"GetMapping",
"(",
"\"/getPeticionesRealizadasUsuario/{idUsu}\"",
")",
"public",
"ResponseEntity",
"<",
"List",
"<",
"AmigosUsu",
">",
">",
"getPeticionesRealizadasUsuario",
"(",
"@",
"PathVariable",
"int",
"idUsu",
")",
"{",
"ArrayList",
"<",
"AmigosUsu",
">",
"listaAmigosUsu",
"=",
"new",
"ArrayList",
"<",
"AmigosUsu",
">",
"(",
")",
";",
"listaAmigosUsu",
"=",
"(",
"ArrayList",
"<",
"AmigosUsu",
">",
")",
"service",
".",
"findPeticionesRealizadasUsuario",
"(",
"idUsu",
")",
";",
"listaAmigosUsu",
"=",
"quitarListasUsu",
"(",
"listaAmigosUsu",
")",
";",
"return",
"new",
"ResponseEntity",
"<",
"List",
"<",
"AmigosUsu",
">",
">",
"(",
"listaAmigosUsu",
",",
"HttpStatus",
".",
"OK",
")",
";",
"}"
] | [
154,
1
] | [
163,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
AmigosUsuService. | null | buscarpor los ids de usuario | buscarpor los ids de usuario | public AmigosUsu findAmigoUsuIds(Integer idUsuSolicitud, Integer idUsuRecep) {
AmigosUsu amUsu = new AmigosUsu();
amUsu = repository.findAmigoUsuIds(idUsuSolicitud, idUsuRecep);
return amUsu;
} | [
"public",
"AmigosUsu",
"findAmigoUsuIds",
"(",
"Integer",
"idUsuSolicitud",
",",
"Integer",
"idUsuRecep",
")",
"{",
"AmigosUsu",
"amUsu",
"=",
"new",
"AmigosUsu",
"(",
")",
";",
"amUsu",
"=",
"repository",
".",
"findAmigoUsuIds",
"(",
"idUsuSolicitud",
",",
"idUsuRecep",
")",
";",
"return",
"amUsu",
";",
"}"
] | [
105,
1
] | [
111,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ControladoraHotel. | null | metodo que crea SOLO usuarios | metodo que crea SOLO usuarios | public void crearUsuario(String usuario, String contrasenia) {
Usuario user = new Usuario();
user.setNombre_usuario(usuario);
user.setContrasenia(contrasenia);
controlPersistencia.crearUsuario(user);
} | [
"public",
"void",
"crearUsuario",
"(",
"String",
"usuario",
",",
"String",
"contrasenia",
")",
"{",
"Usuario",
"user",
"=",
"new",
"Usuario",
"(",
")",
";",
"user",
".",
"setNombre_usuario",
"(",
"usuario",
")",
";",
"user",
".",
"setContrasenia",
"(",
"contrasenia",
")",
";",
"controlPersistencia",
".",
"crearUsuario",
"(",
"user",
")",
";",
"}"
] | [
142,
4
] | [
149,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
GXSmartCacheProvider. | null | Commit de datos actualizados. Las tablas modificadas hasta el momento se registran con el timestamp del commit. | Commit de datos actualizados. Las tablas modificadas hasta el momento se registran con el timestamp del commit. | public void recordUpdates()
{
provider.recordUpdates(handle);
} | [
"public",
"void",
"recordUpdates",
"(",
")",
"{",
"provider",
".",
"recordUpdates",
"(",
"handle",
")",
";",
"}"
] | [
49,
1
] | [
52,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CrudProducto. | null | /*Buscar producto por código id y devuelve el producto buscado completo | /*Buscar producto por código id y devuelve el producto buscado completo | public Producto findById(String codigo) {
int i = 0;
boolean encontrado = false;
//Mientras no hayamos llegado al final o encontrado lo que buscamos repetimos el bucle
//Al encotrarlo, el bucle para
while (i < lista.length && !encontrado) {
Producto deLista = lista[i];
if (deLista.getCodigo().equalsIgnoreCase(codigo))
encontrado = true;
else
i++;
}
if (encontrado)
return lista[i];//Devolvemos el producto buscado
else
return null;
} | [
"public",
"Producto",
"findById",
"(",
"String",
"codigo",
")",
"{",
"int",
"i",
"=",
"0",
";",
"boolean",
"encontrado",
"=",
"false",
";",
"//Mientras no hayamos llegado al final o encontrado lo que buscamos repetimos el bucle",
"//Al encotrarlo, el bucle para",
"while",
"(",
"i",
"<",
"lista",
".",
"length",
"&&",
"!",
"encontrado",
")",
"{",
"Producto",
"deLista",
"=",
"lista",
"[",
"i",
"]",
";",
"if",
"(",
"deLista",
".",
"getCodigo",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"codigo",
")",
")",
"encontrado",
"=",
"true",
";",
"else",
"i",
"++",
";",
"}",
"if",
"(",
"encontrado",
")",
"return",
"lista",
"[",
"i",
"]",
";",
"//Devolvemos el producto buscado",
"else",
"return",
"null",
";",
"}"
] | [
64,
1
] | [
82,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Trabajador. | null | metodo que calcula el sueldo de un trabajador | metodo que calcula el sueldo de un trabajador | public double calcularSueldo() {
double sumaHoras=0.0;
for(int i=0;i<horasTrabajadas.length;i++) {
sumaHoras=sumaHoras +horasTrabajadas[i];
}
return sumaHoras*precioHora;
} | [
"public",
"double",
"calcularSueldo",
"(",
")",
"{",
"double",
"sumaHoras",
"=",
"0.0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"horasTrabajadas",
".",
"length",
";",
"i",
"++",
")",
"{",
"sumaHoras",
"=",
"sumaHoras",
"+",
"horasTrabajadas",
"[",
"i",
"]",
";",
"}",
"return",
"sumaHoras",
"*",
"precioHora",
";",
"}"
] | [
57,
1
] | [
70,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ConnectionAdmin. | null | devuelve la coleccion de documentos de una Collection | devuelve la coleccion de documentos de una Collection | public MongoCollection<Document> connectCollection(String collectionName)
{
//access collection
MongoCollection<Document> collection = database.getCollection(collectionName);
return collection;
} | [
"public",
"MongoCollection",
"<",
"Document",
">",
"connectCollection",
"(",
"String",
"collectionName",
")",
"{",
"//access collection",
"MongoCollection",
"<",
"Document",
">",
"collection",
"=",
"database",
".",
"getCollection",
"(",
"collectionName",
")",
";",
"return",
"collection",
";",
"}"
] | [
92,
1
] | [
98,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
AnswerTests. | null | No debe validar si name está vacío, más de 50, menos de 3 | No debe validar si name está vacío, más de 50, menos de 3 | @ParameterizedTest
@ValueSource(strings = {
"",//
"Esto es un texto, Esto es un texto, Esto es un texto",//
"Es"
})
void shouldNotValidateName(final String name) {
LocaleContextHolder.setLocale(Locale.ENGLISH);
Answer answer = this.generateAnswer();
answer.setName(name);
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("name");
Assertions.assertThat(violation.getMessage()).isEqualTo("size must be between 3 and 50");
} | [
"@",
"ParameterizedTest",
"@",
"ValueSource",
"(",
"strings",
"=",
"{",
"\"\"",
",",
"//",
"\"Esto es un texto, Esto es un texto, Esto es un texto\"",
",",
"//",
"\"Es\"",
"}",
")",
"void",
"shouldNotValidateName",
"(",
"final",
"String",
"name",
")",
"{",
"LocaleContextHolder",
".",
"setLocale",
"(",
"Locale",
".",
"ENGLISH",
")",
";",
"Answer",
"answer",
"=",
"this",
".",
"generateAnswer",
"(",
")",
";",
"answer",
".",
"setName",
"(",
"name",
")",
";",
"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",
"(",
"\"name\"",
")",
";",
"Assertions",
".",
"assertThat",
"(",
"violation",
".",
"getMessage",
"(",
")",
")",
".",
"isEqualTo",
"(",
"\"size must be between 3 and 50\"",
")",
";",
"}"
] | [
133,
1
] | [
152,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Mesa. | null | Comprueba si hay movimientos posibles, hacia fuera o por dentro | Comprueba si hay movimientos posibles, hacia fuera o por dentro | public Estado movimientoPosible(){
boolean recorrida = false;
int i = 0;
while(recorrida != true && i != numFilas){
int j = 0;
while (recorrida != true && j != numColumnas){
if(movimientoPosibleHaciaFuera(i, j)){
recorrida = true;
}else{
if(movimientoPosibleDentro(i, j)){
recorrida = true;
}
}
j++;
}
i++;
}
if(recorrida == true){
estado = estado.CORRIENDO;
}else{
if(getNumCartasMontonExterior() == 40){
estado = estado.GANADO;
}else{
estado = estado.PERDIDO;
}
}
return estado;
} | [
"public",
"Estado",
"movimientoPosible",
"(",
")",
"{",
"boolean",
"recorrida",
"=",
"false",
";",
"int",
"i",
"=",
"0",
";",
"while",
"(",
"recorrida",
"!=",
"true",
"&&",
"i",
"!=",
"numFilas",
")",
"{",
"int",
"j",
"=",
"0",
";",
"while",
"(",
"recorrida",
"!=",
"true",
"&&",
"j",
"!=",
"numColumnas",
")",
"{",
"if",
"(",
"movimientoPosibleHaciaFuera",
"(",
"i",
",",
"j",
")",
")",
"{",
"recorrida",
"=",
"true",
";",
"}",
"else",
"{",
"if",
"(",
"movimientoPosibleDentro",
"(",
"i",
",",
"j",
")",
")",
"{",
"recorrida",
"=",
"true",
";",
"}",
"}",
"j",
"++",
";",
"}",
"i",
"++",
";",
"}",
"if",
"(",
"recorrida",
"==",
"true",
")",
"{",
"estado",
"=",
"estado",
".",
"CORRIENDO",
";",
"}",
"else",
"{",
"if",
"(",
"getNumCartasMontonExterior",
"(",
")",
"==",
"40",
")",
"{",
"estado",
"=",
"estado",
".",
"GANADO",
";",
"}",
"else",
"{",
"estado",
"=",
"estado",
".",
"PERDIDO",
";",
"}",
"}",
"return",
"estado",
";",
"}"
] | [
123,
4
] | [
154,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
MainActivity. | null | Gestionamos el menu | Gestionamos el menu | @Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater menuInflater = getMenuInflater();
menuInflater.inflate(R.menu.main_menu, menu);
return true;
} | [
"@",
"Override",
"public",
"boolean",
"onCreateOptionsMenu",
"(",
"Menu",
"menu",
")",
"{",
"MenuInflater",
"menuInflater",
"=",
"getMenuInflater",
"(",
")",
";",
"menuInflater",
".",
"inflate",
"(",
"R",
".",
"menu",
".",
"main_menu",
",",
"menu",
")",
";",
"return",
"true",
";",
"}"
] | [
93,
4
] | [
98,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Jugador. | null | Elegir casilla del tablero aleatoriamente para realizar la jugada | Elegir casilla del tablero aleatoriamente para realizar la jugada | public Casilla elegirCasillaAleatoria(Tablero tablero){
//Espacio donde estará el objeto tipo casilla (elegida)
Casilla casillaSeleccionada = new Casilla();
//Solicitarle al tablero las casillas que están
ArrayList<Casilla> casillasLibres = tablero.obtenerCasillasVacias();
//Seleccionar casilla aleatoria
int Min = 0;
int Max = casillasLibres.size();
int indiceSeleccion = Min + (int) (Math.random() * (Max-Min));
casillaSeleccionada = casillasLibres.get(indiceSeleccion);
//Retornar la casilla seleccionada
return casillaSeleccionada;
} | [
"public",
"Casilla",
"elegirCasillaAleatoria",
"(",
"Tablero",
"tablero",
")",
"{",
"//Espacio donde estará el objeto tipo casilla (elegida)",
"Casilla",
"casillaSeleccionada",
"=",
"new",
"Casilla",
"(",
")",
";",
"//Solicitarle al tablero las casillas que están",
"ArrayList",
"<",
"Casilla",
">",
"casillasLibres",
"=",
"tablero",
".",
"obtenerCasillasVacias",
"(",
")",
";",
"//Seleccionar casilla aleatoria",
"int",
"Min",
"=",
"0",
";",
"int",
"Max",
"=",
"casillasLibres",
".",
"size",
"(",
")",
";",
"int",
"indiceSeleccion",
"=",
"Min",
"+",
"(",
"int",
")",
"(",
"Math",
".",
"random",
"(",
")",
"*",
"(",
"Max",
"-",
"Min",
")",
")",
";",
"casillaSeleccionada",
"=",
"casillasLibres",
".",
"get",
"(",
"indiceSeleccion",
")",
";",
"//Retornar la casilla seleccionada",
"return",
"casillaSeleccionada",
";",
"}"
] | [
22,
4
] | [
38,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Mesa. | null | Evalua el estado de la partida | Evalua el estado de la partida | public Estado getEstado(){
return estado;
} | [
"public",
"Estado",
"getEstado",
"(",
")",
"{",
"return",
"estado",
";",
"}"
] | [
117,
4
] | [
120,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
MainActivity. | null | reiniciar la aplicacion para implementar el modo oscuro y guardar la preferencia | reiniciar la aplicacion para implementar el modo oscuro y guardar la preferencia | @Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
if(key.equals(Ajustes.KEY_DARK_MODE_SWITCH)){
recreate();
}
} | [
"@",
"Override",
"public",
"void",
"onSharedPreferenceChanged",
"(",
"SharedPreferences",
"sharedPreferences",
",",
"String",
"key",
")",
"{",
"if",
"(",
"key",
".",
"equals",
"(",
"Ajustes",
".",
"KEY_DARK_MODE_SWITCH",
")",
")",
"{",
"recreate",
"(",
")",
";",
"}",
"}"
] | [
176,
4
] | [
181,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ClaseBBDD. | null | El primer elemento de este array además se incluirá la palabra "Todas" que indicará cualquier procedencia | El primer elemento de este array además se incluirá la palabra "Todas" que indicará cualquier procedencia | public String[] arrayProcedencia() throws SQLException {
//Nos conectamos a nuestra BBDD
Connection connect = conexion();
//Creamos un resultSet a partir de la query del statement
Statement st = connect.createStatement();
ResultSet rs = st.executeQuery("SELECT DISTINCT procedencia FROM jugadores");
//Creamos un ArrayList, donde almacenaremos los results del resultSet
ArrayList<String> procedenciasList = new ArrayList<String>();
// Añadimos cada result a nuestra ArrrayList
while (rs.next()) {
procedenciasList.add(rs.getString(1));
}
connect.close();
//Añadimos "Todas" a la lista de procedencias en el primer index
procedenciasList.add(0,"Todas");
//Creamos un array del mismo tamaño que nuestra arrayList
String[] procedencias = new String[procedenciasList.size()];
//Volcamos nuestra arrayList al Array previamente creado
procedenciasList.toArray(procedencias);
return procedencias;
} | [
"public",
"String",
"[",
"]",
"arrayProcedencia",
"(",
")",
"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",
"(",
")",
";",
"ResultSet",
"rs",
"=",
"st",
".",
"executeQuery",
"(",
"\"SELECT DISTINCT procedencia FROM jugadores\"",
")",
";",
"//Creamos un ArrayList, donde almacenaremos los results del resultSet\r",
"ArrayList",
"<",
"String",
">",
"procedenciasList",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"// Añadimos cada result a nuestra ArrrayList\r",
"while",
"(",
"rs",
".",
"next",
"(",
")",
")",
"{",
"procedenciasList",
".",
"add",
"(",
"rs",
".",
"getString",
"(",
"1",
")",
")",
";",
"}",
"connect",
".",
"close",
"(",
")",
";",
"//Añadimos \"Todas\" a la lista de procedencias en el primer index\r",
"procedenciasList",
".",
"add",
"(",
"0",
",",
"\"Todas\"",
")",
";",
"//Creamos un array del mismo tamaño que nuestra arrayList\r",
"String",
"[",
"]",
"procedencias",
"=",
"new",
"String",
"[",
"procedenciasList",
".",
"size",
"(",
")",
"]",
";",
"//Volcamos nuestra arrayList al Array previamente creado\r",
"procedenciasList",
".",
"toArray",
"(",
"procedencias",
")",
";",
"return",
"procedencias",
";",
"}"
] | [
109,
3
] | [
137,
4
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
AnimesApiResource. | null | Método que añade una imagen a un anime | Método que añade una imagen a un anime | @POST
@Path("/imagen/{idAnime}")
@Consumes("application/json")
@Produces("application/json")
public Response addImagenAnime(@Context UriInfo uriInfo, @PathParam("idAnime") String idAnime, Imagen imagen) {
if (idAnime == null || idAnime == "") {
throw new BadRequestException("La imagen no es válida");
}
repository.addImagenAnime(idAnime, imagen);
ResponseBuilder resp = Response.created(uriInfo.getAbsolutePath());
resp.entity(imagen);
return resp.build();
} | [
"@",
"POST",
"@",
"Path",
"(",
"\"/imagen/{idAnime}\"",
")",
"@",
"Consumes",
"(",
"\"application/json\"",
")",
"@",
"Produces",
"(",
"\"application/json\"",
")",
"public",
"Response",
"addImagenAnime",
"(",
"@",
"Context",
"UriInfo",
"uriInfo",
",",
"@",
"PathParam",
"(",
"\"idAnime\"",
")",
"String",
"idAnime",
",",
"Imagen",
"imagen",
")",
"{",
"if",
"(",
"idAnime",
"==",
"null",
"||",
"idAnime",
"==",
"\"\"",
")",
"{",
"throw",
"new",
"BadRequestException",
"(",
"\"La imagen no es válida\")",
";",
"",
"}",
"repository",
".",
"addImagenAnime",
"(",
"idAnime",
",",
"imagen",
")",
";",
"ResponseBuilder",
"resp",
"=",
"Response",
".",
"created",
"(",
"uriInfo",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"resp",
".",
"entity",
"(",
"imagen",
")",
";",
"return",
"resp",
".",
"build",
"(",
")",
";",
"}"
] | [
170,
1
] | [
182,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Materia. | null | Calcular el promedio ayudando al estudiante (promedioAjustado) | Calcular el promedio ayudando al estudiante (promedioAjustado) | public void calcularPromedioAjustado(){
//Identificar la peor nota
this.calcularPeorNota();
// //Local al método (cuándo utilizar this)
// Nota nota1 = new Nota();
// nota1.setCualitativa("Aprobado");
// nota1.setEscala100(34);
// nota1.convertirNota100_5();
//Calcular el promedio excluyendo la peor nota
this.promedioAjustado = (nota1.getEscala100() + nota2.getEscala100() + nota3.getEscala100() + nota4.getEscala100() + nota5.getEscala100() - notaExcluida.getEscala100())/4;
//Expresarlo en el atributo cualitativo
Nota notaPromedioAjustado = new Nota((int)this.promedioAjustado);
this.promedioCualitativoAjustado = notaPromedioAjustado.getCualitativa();
//Aprovechamos el comportamiento de la envoltura que hicimos al promedio
this.promedioAjustado = notaPromedioAjustado.getEscala5();
} | [
"public",
"void",
"calcularPromedioAjustado",
"(",
")",
"{",
"//Identificar la peor nota",
"this",
".",
"calcularPeorNota",
"(",
")",
";",
"// //Local al método (cuándo utilizar this)",
"// Nota nota1 = new Nota();",
"// nota1.setCualitativa(\"Aprobado\");",
"// nota1.setEscala100(34);",
"// nota1.convertirNota100_5();",
"//Calcular el promedio excluyendo la peor nota ",
"this",
".",
"promedioAjustado",
"=",
"(",
"nota1",
".",
"getEscala100",
"(",
")",
"+",
"nota2",
".",
"getEscala100",
"(",
")",
"+",
"nota3",
".",
"getEscala100",
"(",
")",
"+",
"nota4",
".",
"getEscala100",
"(",
")",
"+",
"nota5",
".",
"getEscala100",
"(",
")",
"-",
"notaExcluida",
".",
"getEscala100",
"(",
")",
")",
"/",
"4",
";",
"//Expresarlo en el atributo cualitativo",
"Nota",
"notaPromedioAjustado",
"=",
"new",
"Nota",
"(",
"(",
"int",
")",
"this",
".",
"promedioAjustado",
")",
";",
"this",
".",
"promedioCualitativoAjustado",
"=",
"notaPromedioAjustado",
".",
"getCualitativa",
"(",
")",
";",
"//Aprovechamos el comportamiento de la envoltura que hicimos al promedio",
"this",
".",
"promedioAjustado",
"=",
"notaPromedioAjustado",
".",
"getEscala5",
"(",
")",
";",
"}"
] | [
167,
4
] | [
187,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CrudLimpieza. | null | Método para ordenar la lista por orden natural (precio) con stream | Método para ordenar la lista por orden natural (precio) con stream | public void ordenarListaStream () {
stockLimpieza=stockLimpieza
.stream()
.parallel()
.sorted()
.collect(Collectors.toList());
} | [
"public",
"void",
"ordenarListaStream",
"(",
")",
"{",
"stockLimpieza",
"=",
"stockLimpieza",
".",
"stream",
"(",
")",
".",
"parallel",
"(",
")",
".",
"sorted",
"(",
")",
".",
"collect",
"(",
"Collectors",
".",
"toList",
"(",
")",
")",
";",
"}"
] | [
150,
1
] | [
156,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ShapeFactory. | null | es importante que este metodo sea del tipo de la interface Shape | es importante que este metodo sea del tipo de la interface Shape | public Shape getShape(String shapeTipo) {
if (shapeTipo == null) {
return null;
}
if (shapeTipo.equalsIgnoreCase("CIRCLE")) {
return new Circle();
} else if (shapeTipo.equalsIgnoreCase("RECTANGLE")) {
return new Rectangle();
} else if (shapeTipo.equalsIgnoreCase("SQUARE")) {
return new Square();
}
return null;
} | [
"public",
"Shape",
"getShape",
"(",
"String",
"shapeTipo",
")",
"{",
"if",
"(",
"shapeTipo",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"shapeTipo",
".",
"equalsIgnoreCase",
"(",
"\"CIRCLE\"",
")",
")",
"{",
"return",
"new",
"Circle",
"(",
")",
";",
"}",
"else",
"if",
"(",
"shapeTipo",
".",
"equalsIgnoreCase",
"(",
"\"RECTANGLE\"",
")",
")",
"{",
"return",
"new",
"Rectangle",
"(",
")",
";",
"}",
"else",
"if",
"(",
"shapeTipo",
".",
"equalsIgnoreCase",
"(",
"\"SQUARE\"",
")",
")",
"{",
"return",
"new",
"Square",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] | [
10,
1
] | [
23,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Login. | null | Método para cuando se hace click en BotonMostrarContrasena | Método para cuando se hace click en BotonMostrarContrasena | private void BotonMostrarContrasenaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonMostrarContrasenaActionPerformed
if(MostrandoContrasena)
{
CampoContrasenaCubrirContrasena();
MostrandoContrasena = false;
}
else
{
this.CampoContrasena.setText(ContrasenaTemp);
MostrandoContrasena = true;
}
} | [
"private",
"void",
"BotonMostrarContrasenaActionPerformed",
"(",
"java",
".",
"awt",
".",
"event",
".",
"ActionEvent",
"evt",
")",
"{",
"//GEN-FIRST:event_BotonMostrarContrasenaActionPerformed",
"if",
"(",
"MostrandoContrasena",
")",
"{",
"CampoContrasenaCubrirContrasena",
"(",
")",
";",
"MostrandoContrasena",
"=",
"false",
";",
"}",
"else",
"{",
"this",
".",
"CampoContrasena",
".",
"setText",
"(",
"ContrasenaTemp",
")",
";",
"MostrandoContrasena",
"=",
"true",
";",
"}",
"}"
] | [
505,
4
] | [
516,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Fighter. | null | Funcion que retorna el porcentaje que debe crecer basado en un x | Funcion que retorna el porcentaje que debe crecer basado en un x | protected double growth(int x){
return Math.log(x) / 3;
} | [
"protected",
"double",
"growth",
"(",
"int",
"x",
")",
"{",
"return",
"Math",
".",
"log",
"(",
"x",
")",
"/",
"3",
";",
"}"
] | [
200,
4
] | [
202,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ScreenUtils. | null | Clase para obtener el alto y ancho de la pantalla en Pixeles | Clase para obtener el alto y ancho de la pantalla en Pixeles | public static int getScreenWidth(Context context) {
return context.getResources().getDisplayMetrics().widthPixels;
} | [
"public",
"static",
"int",
"getScreenWidth",
"(",
"Context",
"context",
")",
"{",
"return",
"context",
".",
"getResources",
"(",
")",
".",
"getDisplayMetrics",
"(",
")",
".",
"widthPixels",
";",
"}"
] | [
7,
4
] | [
9,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CrudProducto. | null | /*Buscar producto por código id y devuelve el índice del array donde se encuentra
el producto buscado | /*Buscar producto por código id y devuelve el índice del array donde se encuentra
el producto buscado | public int findByIdV2(String codigo) {
int i = 0;
boolean encontrado = false;
while (i < lista.length && !encontrado) {
Producto deLista = lista[i];
if (deLista.getCodigo().equalsIgnoreCase(codigo))
encontrado = true;
else
i++;
}
if (encontrado)
return i;
else
return -1;
} | [
"public",
"int",
"findByIdV2",
"(",
"String",
"codigo",
")",
"{",
"int",
"i",
"=",
"0",
";",
"boolean",
"encontrado",
"=",
"false",
";",
"while",
"(",
"i",
"<",
"lista",
".",
"length",
"&&",
"!",
"encontrado",
")",
"{",
"Producto",
"deLista",
"=",
"lista",
"[",
"i",
"]",
";",
"if",
"(",
"deLista",
".",
"getCodigo",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"codigo",
")",
")",
"encontrado",
"=",
"true",
";",
"else",
"i",
"++",
";",
"}",
"if",
"(",
"encontrado",
")",
"return",
"i",
";",
"else",
"return",
"-",
"1",
";",
"}"
] | [
88,
1
] | [
103,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Ordernar. | null | un metodo Perfomable que recibe que manda el parametro con el . | un metodo Perfomable que recibe que manda el parametro con el . | public static Performable ordenAlfabeticoDesdeA(){
return Instrumented.instanceOf(Ordernar.class).withProperties("Product Name: A to Z");
} | [
"public",
"static",
"Performable",
"ordenAlfabeticoDesdeA",
"(",
")",
"{",
"return",
"Instrumented",
".",
"instanceOf",
"(",
"Ordernar",
".",
"class",
")",
".",
"withProperties",
"(",
"\"Product Name: A to Z\"",
")",
";",
"}"
] | [
28,
4
] | [
30,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
BuscarDatosUsuario. | null | Metodo para vaciar los objetos de un usuario antes de enviarlo por json | Metodo para vaciar los objetos de un usuario antes de enviarlo por json | public 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;
} | [
"public",
"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",
";",
"}"
] | [
49,
1
] | [
72,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
JsonReader. | null | Extrae el texto como lista de String | Extrae el texto como lista de String | public List<String> extraeListText(JSONArray txt){
List<String> listaTexto = new ArrayList<String>();
Iterator<JSONObject> iterator = txt.iterator();
while (iterator.hasNext()) {
JSONObject it = iterator.next();
String texto = (String) it.get("text");
listaTexto.add(texto);
}
return listaTexto;
} | [
"public",
"List",
"<",
"String",
">",
"extraeListText",
"(",
"JSONArray",
"txt",
")",
"{",
"List",
"<",
"String",
">",
"listaTexto",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"Iterator",
"<",
"JSONObject",
">",
"iterator",
"=",
"txt",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"JSONObject",
"it",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"String",
"texto",
"=",
"(",
"String",
")",
"it",
".",
"get",
"(",
"\"text\"",
")",
";",
"listaTexto",
".",
"add",
"(",
"texto",
")",
";",
"}",
"return",
"listaTexto",
";",
"}"
] | [
198,
2
] | [
207,
3
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Mesa. | null | Comprueba que la carta se puede mover por dentro del tablero a la posicion indicada | Comprueba que la carta se puede mover por dentro del tablero a la posicion indicada | public boolean movimientoOportunoDentro(int x, int y){
boolean movimiento = false;
if((montonInterior[(y-5)/4][(y-5)%4].peek().getNum() == montonInterior[(x-5)/4][(x-5)%4]
.peek().getNum() + 1) && montonInterior[(y-5)/4][(y-5)%4].peek()
.getPalo() == montonInterior[(x-5)/4][(x-5)%4].peek().getPalo()){
movimiento = true;
}
return movimiento;
} | [
"public",
"boolean",
"movimientoOportunoDentro",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"boolean",
"movimiento",
"=",
"false",
";",
"if",
"(",
"(",
"montonInterior",
"[",
"(",
"y",
"-",
"5",
")",
"/",
"4",
"]",
"[",
"(",
"y",
"-",
"5",
")",
"%",
"4",
"]",
".",
"peek",
"(",
")",
".",
"getNum",
"(",
")",
"==",
"montonInterior",
"[",
"(",
"x",
"-",
"5",
")",
"/",
"4",
"]",
"[",
"(",
"x",
"-",
"5",
")",
"%",
"4",
"]",
".",
"peek",
"(",
")",
".",
"getNum",
"(",
")",
"+",
"1",
")",
"&&",
"montonInterior",
"[",
"(",
"y",
"-",
"5",
")",
"/",
"4",
"]",
"[",
"(",
"y",
"-",
"5",
")",
"%",
"4",
"]",
".",
"peek",
"(",
")",
".",
"getPalo",
"(",
")",
"==",
"montonInterior",
"[",
"(",
"x",
"-",
"5",
")",
"/",
"4",
"]",
"[",
"(",
"x",
"-",
"5",
")",
"%",
"4",
"]",
".",
"peek",
"(",
")",
".",
"getPalo",
"(",
")",
")",
"{",
"movimiento",
"=",
"true",
";",
"}",
"return",
"movimiento",
";",
"}"
] | [
84,
4
] | [
97,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
DatabaseRecordTest. | null | /* Comprobamos los metodos de tipo Double | /* Comprobamos los metodos de tipo Double | @Test
public void Double_AreEquals(){
record1.setDoubleValue("Double_Column_1", 123456789.123);
record2.setDoubleValue("Double_Column_1", 123456789.123);
assertThat(record1.getDoubleValue("Double_Column_1")).isEqualTo(record2.getDoubleValue("Double_Column_1"));
} | [
"@",
"Test",
"public",
"void",
"Double_AreEquals",
"(",
")",
"{",
"record1",
".",
"setDoubleValue",
"(",
"\"Double_Column_1\"",
",",
"123456789.123",
")",
";",
"record2",
".",
"setDoubleValue",
"(",
"\"Double_Column_1\"",
",",
"123456789.123",
")",
";",
"assertThat",
"(",
"record1",
".",
"getDoubleValue",
"(",
"\"Double_Column_1\"",
")",
")",
".",
"isEqualTo",
"(",
"record2",
".",
"getDoubleValue",
"(",
"\"Double_Column_1\"",
")",
")",
";",
"}"
] | [
121,
2
] | [
127,
3
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
EstadisticasController. | null | Gestionar los errores cometidos en la sintaxis de los comandos introducidos | Gestionar los errores cometidos en la sintaxis de los comandos introducidos | private String gestionErroresComandos(String error, String[] dataActions, int i, Set<Integer> dorsales, boolean correccion) {
String[] dataActionsParts = dataActions[i].split(",");
if(dataActionsParts.length < 3 || dataActionsParts.length > 3) {
error += "Comas(,) en posición " + (i+1);
error += "; ";
} else {
String dorsal = dataActionsParts[0].replace("%", "");
String accion = dataActionsParts[1];
String acierto = dataActionsParts[2];
//Elemento 1
if(!Pattern.matches("^[0-9]+", dorsal)) {
error += "Dorsal no números en posición " + (i+1);
error += "; ";
} else if(!dorsales.contains(Integer.valueOf(dorsal))) {
error += "Dorsal no en juego en posición " + (i+1);
error += "; ";
}
//Elemento 2
if(!correccion) {
if(!accion.equalsIgnoreCase("s") && !accion.equalsIgnoreCase("r") && !accion.equalsIgnoreCase("c") && !accion.equalsIgnoreCase("d") && !accion.equalsIgnoreCase("b") && !accion.equalsIgnoreCase("a") && !accion.equalsIgnoreCase("f") && !accion.equalsIgnoreCase("ar") && !accion.equalsIgnoreCase("ft") && !accion.equalsIgnoreCase("ta") && !accion.equalsIgnoreCase("tr")) {
error += "Acción incorrecta en posición " + (i+1);
error += "; ";
}
} else {
if(!accion.equalsIgnoreCase("s") && !accion.equalsIgnoreCase("r") && !accion.equalsIgnoreCase("c") && !accion.equalsIgnoreCase("d") && !accion.equalsIgnoreCase("b") && !accion.equalsIgnoreCase("a") && !accion.equalsIgnoreCase("f") && !accion.equalsIgnoreCase("ar")) {
error += "Acción incorrecta en posición " + (i+1);
error += "; ";
}
}
//Elemento 3
if(acierto.length() != 1 && (!acierto.equals("+") && !acierto.equals("-"))) {
error += "+/- incorrecto en posición " + (i+1);
error += "; ";
}
}
return error;
} | [
"private",
"String",
"gestionErroresComandos",
"(",
"String",
"error",
",",
"String",
"[",
"]",
"dataActions",
",",
"int",
"i",
",",
"Set",
"<",
"Integer",
">",
"dorsales",
",",
"boolean",
"correccion",
")",
"{",
"String",
"[",
"]",
"dataActionsParts",
"=",
"dataActions",
"[",
"i",
"]",
".",
"split",
"(",
"\",\"",
")",
";",
"if",
"(",
"dataActionsParts",
".",
"length",
"<",
"3",
"||",
"dataActionsParts",
".",
"length",
">",
"3",
")",
"{",
"error",
"+=",
"\"Comas(,) en posición \" ",
" ",
"i",
"+",
"1",
")",
";",
"",
"error",
"+=",
"\"; \"",
";",
"}",
"else",
"{",
"String",
"dorsal",
"=",
"dataActionsParts",
"[",
"0",
"]",
".",
"replace",
"(",
"\"%\"",
",",
"\"\"",
")",
";",
"String",
"accion",
"=",
"dataActionsParts",
"[",
"1",
"]",
";",
"String",
"acierto",
"=",
"dataActionsParts",
"[",
"2",
"]",
";",
"//Elemento 1",
"if",
"(",
"!",
"Pattern",
".",
"matches",
"(",
"\"^[0-9]+\"",
",",
"dorsal",
")",
")",
"{",
"error",
"+=",
"\"Dorsal no números en posición \" +",
"(",
"+",
"1",
")",
";",
"",
"",
"error",
"+=",
"\"; \"",
";",
"}",
"else",
"if",
"(",
"!",
"dorsales",
".",
"contains",
"(",
"Integer",
".",
"valueOf",
"(",
"dorsal",
")",
")",
")",
"{",
"error",
"+=",
"\"Dorsal no en juego en posición \" ",
" ",
"i",
"+",
"1",
")",
";",
"",
"error",
"+=",
"\"; \"",
";",
"}",
"//Elemento 2",
"if",
"(",
"!",
"correccion",
")",
"{",
"if",
"(",
"!",
"accion",
".",
"equalsIgnoreCase",
"(",
"\"s\"",
")",
"&&",
"!",
"accion",
".",
"equalsIgnoreCase",
"(",
"\"r\"",
")",
"&&",
"!",
"accion",
".",
"equalsIgnoreCase",
"(",
"\"c\"",
")",
"&&",
"!",
"accion",
".",
"equalsIgnoreCase",
"(",
"\"d\"",
")",
"&&",
"!",
"accion",
".",
"equalsIgnoreCase",
"(",
"\"b\"",
")",
"&&",
"!",
"accion",
".",
"equalsIgnoreCase",
"(",
"\"a\"",
")",
"&&",
"!",
"accion",
".",
"equalsIgnoreCase",
"(",
"\"f\"",
")",
"&&",
"!",
"accion",
".",
"equalsIgnoreCase",
"(",
"\"ar\"",
")",
"&&",
"!",
"accion",
".",
"equalsIgnoreCase",
"(",
"\"ft\"",
")",
"&&",
"!",
"accion",
".",
"equalsIgnoreCase",
"(",
"\"ta\"",
")",
"&&",
"!",
"accion",
".",
"equalsIgnoreCase",
"(",
"\"tr\"",
")",
")",
"{",
"error",
"+=",
"\"Acción incorrecta en posición \" +",
"(",
"+",
"1",
")",
";",
"",
"",
"error",
"+=",
"\"; \"",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"!",
"accion",
".",
"equalsIgnoreCase",
"(",
"\"s\"",
")",
"&&",
"!",
"accion",
".",
"equalsIgnoreCase",
"(",
"\"r\"",
")",
"&&",
"!",
"accion",
".",
"equalsIgnoreCase",
"(",
"\"c\"",
")",
"&&",
"!",
"accion",
".",
"equalsIgnoreCase",
"(",
"\"d\"",
")",
"&&",
"!",
"accion",
".",
"equalsIgnoreCase",
"(",
"\"b\"",
")",
"&&",
"!",
"accion",
".",
"equalsIgnoreCase",
"(",
"\"a\"",
")",
"&&",
"!",
"accion",
".",
"equalsIgnoreCase",
"(",
"\"f\"",
")",
"&&",
"!",
"accion",
".",
"equalsIgnoreCase",
"(",
"\"ar\"",
")",
")",
"{",
"error",
"+=",
"\"Acción incorrecta en posición \" +",
"(",
"+",
"1",
")",
";",
"",
"",
"error",
"+=",
"\"; \"",
";",
"}",
"}",
"//Elemento 3",
"if",
"(",
"acierto",
".",
"length",
"(",
")",
"!=",
"1",
"&&",
"(",
"!",
"acierto",
".",
"equals",
"(",
"\"+\"",
")",
"&&",
"!",
"acierto",
".",
"equals",
"(",
"\"-\"",
")",
")",
")",
"{",
"error",
"+=",
"\"+/- incorrecto en posición \" ",
" ",
"i",
"+",
"1",
")",
";",
"",
"error",
"+=",
"\"; \"",
";",
"}",
"}",
"return",
"error",
";",
"}"
] | [
1324,
1
] | [
1363,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
PublicacionController. | null | metodos propios ------------------------------------------------ | metodos propios ------------------------------------------------ | @CrossOrigin(origins = "http://localhost:4200")
@GetMapping("/getPubliInicioUsuario/{idUsu}")
public ResponseEntity<List<Publicacion>> getPubliInicioUsuario(@PathVariable Integer idUsu){
// buscar amigos del usuario
ArrayList<AmigosUsu> listaAmigosUsu = new ArrayList<AmigosUsu>();
listaAmigosUsu = (ArrayList<AmigosUsu>) amUsuServ.findAmigosUsuario(idUsu, idUsu);
// Recorrer para seleccionar
ArrayList<Usuario> soloAmigos = new ArrayList<Usuario>();
for (AmigosUsu amUsu: listaAmigosUsu) {
if(amUsu.getUsuAmIdReceptor().getIdUsu() != idUsu) {
soloAmigos.add(amUsu.getUsuAmIdReceptor());
}
if(amUsu.getUsuAmIdSolicitante().getIdUsu() != idUsu) {
soloAmigos.add(amUsu.getUsuAmIdSolicitante());
}
}
ArrayList<Publicacion> listaPubl = new ArrayList<Publicacion>();
// Buscar las publicaciones de los amigos del usuario
for (Usuario amigoUsuario: soloAmigos) {
System.out.println(amigoUsuario.getIdUsu());
listaPubl = (ArrayList<Publicacion>) service.findPublicacionesUsuario(amigoUsuario.getIdUsu());
// publUsu = service.getPublicacionById(amigoUsuario.getIdUsu());
}
listaPubl = quitarListas(listaPubl);
// Como estaba antes
/*
ArrayList<Publicacion> listaPubl = new ArrayList<Publicacion>();
listaPubl = (ArrayList<Publicacion>) service.findPubliInicioUsuario(idUsu);
listaPubl = quitarListas(listaPubl);
*/
return new ResponseEntity<List<Publicacion>>(listaPubl, HttpStatus.OK);
} | [
"@",
"CrossOrigin",
"(",
"origins",
"=",
"\"http://localhost:4200\"",
")",
"@",
"GetMapping",
"(",
"\"/getPubliInicioUsuario/{idUsu}\"",
")",
"public",
"ResponseEntity",
"<",
"List",
"<",
"Publicacion",
">",
">",
"getPubliInicioUsuario",
"(",
"@",
"PathVariable",
"Integer",
"idUsu",
")",
"{",
"// buscar amigos del usuario\r",
"ArrayList",
"<",
"AmigosUsu",
">",
"listaAmigosUsu",
"=",
"new",
"ArrayList",
"<",
"AmigosUsu",
">",
"(",
")",
";",
"listaAmigosUsu",
"=",
"(",
"ArrayList",
"<",
"AmigosUsu",
">",
")",
"amUsuServ",
".",
"findAmigosUsuario",
"(",
"idUsu",
",",
"idUsu",
")",
";",
"// Recorrer para seleccionar\r",
"ArrayList",
"<",
"Usuario",
">",
"soloAmigos",
"=",
"new",
"ArrayList",
"<",
"Usuario",
">",
"(",
")",
";",
"for",
"(",
"AmigosUsu",
"amUsu",
":",
"listaAmigosUsu",
")",
"{",
"if",
"(",
"amUsu",
".",
"getUsuAmIdReceptor",
"(",
")",
".",
"getIdUsu",
"(",
")",
"!=",
"idUsu",
")",
"{",
"soloAmigos",
".",
"add",
"(",
"amUsu",
".",
"getUsuAmIdReceptor",
"(",
")",
")",
";",
"}",
"if",
"(",
"amUsu",
".",
"getUsuAmIdSolicitante",
"(",
")",
".",
"getIdUsu",
"(",
")",
"!=",
"idUsu",
")",
"{",
"soloAmigos",
".",
"add",
"(",
"amUsu",
".",
"getUsuAmIdSolicitante",
"(",
")",
")",
";",
"}",
"}",
"ArrayList",
"<",
"Publicacion",
">",
"listaPubl",
"=",
"new",
"ArrayList",
"<",
"Publicacion",
">",
"(",
")",
";",
"// Buscar las publicaciones de los amigos del usuario\r",
"for",
"(",
"Usuario",
"amigoUsuario",
":",
"soloAmigos",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"amigoUsuario",
".",
"getIdUsu",
"(",
")",
")",
";",
"listaPubl",
"=",
"(",
"ArrayList",
"<",
"Publicacion",
">",
")",
"service",
".",
"findPublicacionesUsuario",
"(",
"amigoUsuario",
".",
"getIdUsu",
"(",
")",
")",
";",
"// publUsu = service.getPublicacionById(amigoUsuario.getIdUsu());\r",
"}",
"listaPubl",
"=",
"quitarListas",
"(",
"listaPubl",
")",
";",
"// Como estaba antes\r",
"/*\r\n\t\tArrayList<Publicacion> listaPubl = new ArrayList<Publicacion>();\r\n\t\tlistaPubl = (ArrayList<Publicacion>) service.findPubliInicioUsuario(idUsu);\r\n\t\tlistaPubl = quitarListas(listaPubl);\r\n\t\t*/",
"return",
"new",
"ResponseEntity",
"<",
"List",
"<",
"Publicacion",
">",
">",
"(",
"listaPubl",
",",
"HttpStatus",
".",
"OK",
")",
";",
"}"
] | [
116,
1
] | [
157,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ProductosApiResource. | null | Método que devuelve todos los productos de la id de un determinado anime | Método que devuelve todos los productos de la id de un determinado anime | @GET
@Path("/idAnime")
@Produces("application/json")
public Collection<Producto> getAllProductosById(@QueryParam("id") String idAnime) {
Collection<Producto> res = repository.getAnimeProductosById(idAnime);
if (res == null) {
throw new NotFoundException("No se encuentra ningún producto.");
}
return res;
} | [
"@",
"GET",
"@",
"Path",
"(",
"\"/idAnime\"",
")",
"@",
"Produces",
"(",
"\"application/json\"",
")",
"public",
"Collection",
"<",
"Producto",
">",
"getAllProductosById",
"(",
"@",
"QueryParam",
"(",
"\"id\"",
")",
"String",
"idAnime",
")",
"{",
"Collection",
"<",
"Producto",
">",
"res",
"=",
"repository",
".",
"getAnimeProductosById",
"(",
"idAnime",
")",
";",
"if",
"(",
"res",
"==",
"null",
")",
"{",
"throw",
"new",
"NotFoundException",
"(",
"\"No se encuentra ningún producto.\")",
";",
"",
"}",
"return",
"res",
";",
"}"
] | [
43,
1
] | [
52,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
JsonReader. | null | Extrae las instituciones en una lista de String | Extrae las instituciones en una lista de String | public List<String> extraeInstitucion(JSONArray listaAutores){
List<String> listaInsts = new ArrayList<String>();
Iterator<JSONObject> iterator = listaAutores.iterator();
while (iterator.hasNext()) {
JSONObject it = iterator.next();
JSONObject aff = (JSONObject) it.get("affiliation");
if(aff != null){
String ins = (String) aff.get("institution");
if(ins != null && !ins.equals(""))
listaInsts.add(ins);
}
}
//Elimina las instituciones repetidas (comentar si se quieren aumentar sus pesos)
//listaInsts = listaInsts.stream().distinct().collect(Collectors.toList());
return listaInsts;
} | [
"public",
"List",
"<",
"String",
">",
"extraeInstitucion",
"(",
"JSONArray",
"listaAutores",
")",
"{",
"List",
"<",
"String",
">",
"listaInsts",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"Iterator",
"<",
"JSONObject",
">",
"iterator",
"=",
"listaAutores",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"JSONObject",
"it",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"JSONObject",
"aff",
"=",
"(",
"JSONObject",
")",
"it",
".",
"get",
"(",
"\"affiliation\"",
")",
";",
"if",
"(",
"aff",
"!=",
"null",
")",
"{",
"String",
"ins",
"=",
"(",
"String",
")",
"aff",
".",
"get",
"(",
"\"institution\"",
")",
";",
"if",
"(",
"ins",
"!=",
"null",
"&&",
"!",
"ins",
".",
"equals",
"(",
"\"\"",
")",
")",
"listaInsts",
".",
"add",
"(",
"ins",
")",
";",
"}",
"}",
"//Elimina las instituciones repetidas (comentar si se quieren aumentar sus pesos)",
"//listaInsts = listaInsts.stream().distinct().collect(Collectors.toList());",
"return",
"listaInsts",
";",
"}"
] | [
180,
2
] | [
195,
3
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Application. | null | Commit de todos los datastores, no utiliza mencaismo de error_handler. Utilizado en OfflineEventReplicator | Commit de todos los datastores, no utiliza mencaismo de error_handler. Utilizado en OfflineEventReplicator | public static void commit(ModelContext context, int remoteHandle, String objName)
{
commitDataStores(context, remoteHandle, null, objName);
} | [
"public",
"static",
"void",
"commit",
"(",
"ModelContext",
"context",
",",
"int",
"remoteHandle",
",",
"String",
"objName",
")",
"{",
"commitDataStores",
"(",
"context",
",",
"remoteHandle",
",",
"null",
",",
"objName",
")",
";",
"}"
] | [
539,
1
] | [
542,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CrudLimpieza. | null | Buscar el primer producto por nombre (primera coincidencia) con stream | Buscar el primer producto por nombre (primera coincidencia) con stream | public ProductosLimpieza buscarProductoStream(String nombre) {
return stockLimpieza
.stream()
.parallel()
.filter(x -> x.getNombre().equalsIgnoreCase(nombre))
.findAny()
.orElse(null);
} | [
"public",
"ProductosLimpieza",
"buscarProductoStream",
"(",
"String",
"nombre",
")",
"{",
"return",
"stockLimpieza",
".",
"stream",
"(",
")",
".",
"parallel",
"(",
")",
".",
"filter",
"(",
"x",
"->",
"x",
".",
"getNombre",
"(",
")",
".",
"equalsIgnoreCase",
"(",
"nombre",
")",
")",
".",
"findAny",
"(",
")",
".",
"orElse",
"(",
"null",
")",
";",
"}"
] | [
63,
1
] | [
72,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
Carta. | null | Devuelve el palo de la carta | Devuelve el palo de la carta | public Palos getPalo() {
return palo;
} | [
"public",
"Palos",
"getPalo",
"(",
")",
"{",
"return",
"palo",
";",
"}"
] | [
28,
4
] | [
30,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ControladorRequerimientosReto4. | null | Controlador iniciando la aplicación | Controlador iniciando la aplicación | public void iniciarAplicacion(){
this.menuPrincipalGUI.iniciarGUI(this);
} | [
"public",
"void",
"iniciarAplicacion",
"(",
")",
"{",
"this",
".",
"menuPrincipalGUI",
".",
"iniciarGUI",
"(",
"this",
")",
";",
"}"
] | [
78,
4
] | [
80,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
DynamicExecute. | null | pues para el tambi�n realizamos casts | pues para el tambi�n realizamos casts | protected static int getPrimitiveType(Class<?> clase)
{
if(clase.isAssignableFrom(Byte.class) ||
clase.isAssignableFrom(byte.class))
{
return TYPE_BYTE;
}
else if(clase.isAssignableFrom(Character.class) ||
clase.isAssignableFrom(char.class))
{
return TYPE_CHARACTER;
}
else if(clase.isAssignableFrom(Short.class) ||
clase.isAssignableFrom(short.class))
{
return TYPE_SHORT;
}
else if(clase.isAssignableFrom(Integer.class) ||
clase.isAssignableFrom(int.class))
{
return TYPE_INTEGER;
}
else if(clase.isAssignableFrom(Long.class) ||
clase.isAssignableFrom(long.class))
{
return TYPE_LONG;
}
else if(clase.isAssignableFrom(Float.class) ||
clase.isAssignableFrom(float.class))
{
return TYPE_FLOAT;
}
else if(clase.isAssignableFrom(Double.class) ||
clase.isAssignableFrom(double.class))
{
return TYPE_DOUBLE;
}
else if(clase.isAssignableFrom(BigDecimal.class))
{
return TYPE_BIG_DECIMAL;
}
else if(clase.isAssignableFrom(Boolean.class) ||
clase.isAssignableFrom(boolean.class))
{
// El cache puede hacer uso de este... asi que no doy mas 'type not supported'
// System.err.println("Type not supported!");
return TYPE_BOOLEAN;
}
return TYPE_NOT_PRIMITIVE;
} | [
"protected",
"static",
"int",
"getPrimitiveType",
"(",
"Class",
"<",
"?",
">",
"clase",
")",
"{",
"if",
"(",
"clase",
".",
"isAssignableFrom",
"(",
"Byte",
".",
"class",
")",
"||",
"clase",
".",
"isAssignableFrom",
"(",
"byte",
".",
"class",
")",
")",
"{",
"return",
"TYPE_BYTE",
";",
"}",
"else",
"if",
"(",
"clase",
".",
"isAssignableFrom",
"(",
"Character",
".",
"class",
")",
"||",
"clase",
".",
"isAssignableFrom",
"(",
"char",
".",
"class",
")",
")",
"{",
"return",
"TYPE_CHARACTER",
";",
"}",
"else",
"if",
"(",
"clase",
".",
"isAssignableFrom",
"(",
"Short",
".",
"class",
")",
"||",
"clase",
".",
"isAssignableFrom",
"(",
"short",
".",
"class",
")",
")",
"{",
"return",
"TYPE_SHORT",
";",
"}",
"else",
"if",
"(",
"clase",
".",
"isAssignableFrom",
"(",
"Integer",
".",
"class",
")",
"||",
"clase",
".",
"isAssignableFrom",
"(",
"int",
".",
"class",
")",
")",
"{",
"return",
"TYPE_INTEGER",
";",
"}",
"else",
"if",
"(",
"clase",
".",
"isAssignableFrom",
"(",
"Long",
".",
"class",
")",
"||",
"clase",
".",
"isAssignableFrom",
"(",
"long",
".",
"class",
")",
")",
"{",
"return",
"TYPE_LONG",
";",
"}",
"else",
"if",
"(",
"clase",
".",
"isAssignableFrom",
"(",
"Float",
".",
"class",
")",
"||",
"clase",
".",
"isAssignableFrom",
"(",
"float",
".",
"class",
")",
")",
"{",
"return",
"TYPE_FLOAT",
";",
"}",
"else",
"if",
"(",
"clase",
".",
"isAssignableFrom",
"(",
"Double",
".",
"class",
")",
"||",
"clase",
".",
"isAssignableFrom",
"(",
"double",
".",
"class",
")",
")",
"{",
"return",
"TYPE_DOUBLE",
";",
"}",
"else",
"if",
"(",
"clase",
".",
"isAssignableFrom",
"(",
"BigDecimal",
".",
"class",
")",
")",
"{",
"return",
"TYPE_BIG_DECIMAL",
";",
"}",
"else",
"if",
"(",
"clase",
".",
"isAssignableFrom",
"(",
"Boolean",
".",
"class",
")",
"||",
"clase",
".",
"isAssignableFrom",
"(",
"boolean",
".",
"class",
")",
")",
"{",
"// El cache puede hacer uso de este... asi que no doy mas 'type not supported'",
"//\t\t\tSystem.err.println(\"Type not supported!\");",
"return",
"TYPE_BOOLEAN",
";",
"}",
"return",
"TYPE_NOT_PRIMITIVE",
";",
"}"
] | [
547,
1
] | [
596,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ElectricSystemTest. | null | actual de la red es el consumo de dicho dispositivo cuando se encuentra encendido. | actual de la red es el consumo de dicho dispositivo cuando se encuentra encendido. | @Test
public void Given_A_ElectricalSystem_With_One_Device_TurnedOn_When_GetCurrentConsumption_Method_Is_Called_Then_Return_30() {
//Given
ElectricSystem electricSystem = new ElectricSystem(maximumPowerAllowedStable);
electricSystem.addDevice(turnedOnDevice1);
Integer expectedConsumption = turnedOnDevice1Consumption;
//When
Integer result = electricSystem.getCurrentConsumption();
//Then
assertEquals(expectedConsumption, result);
} | [
"@",
"Test",
"public",
"void",
"Given_A_ElectricalSystem_With_One_Device_TurnedOn_When_GetCurrentConsumption_Method_Is_Called_Then_Return_30",
"(",
")",
"{",
"//Given",
"ElectricSystem",
"electricSystem",
"=",
"new",
"ElectricSystem",
"(",
"maximumPowerAllowedStable",
")",
";",
"electricSystem",
".",
"addDevice",
"(",
"turnedOnDevice1",
")",
";",
"Integer",
"expectedConsumption",
"=",
"turnedOnDevice1Consumption",
";",
"//When",
"Integer",
"result",
"=",
"electricSystem",
".",
"getCurrentConsumption",
"(",
")",
";",
"//Then",
"assertEquals",
"(",
"expectedConsumption",
",",
"result",
")",
";",
"}"
] | [
58,
4
] | [
70,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CropOverlayView. | null | Metodo para dibujar el fondo difuminado
los vertices, las lineas y la cuadricula de referencia para recortar la imagen
| Metodo para dibujar el fondo difuminado
los vertices, las lineas y la cuadricula de referencia para recortar la imagen
| @Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
//obtener las medidas actuales
if (getWidth() != currentWidth || getHeight() != currentHeight) {
currentWidth = getWidth();
currentHeight = getHeight();
resetPoints();
}
drawBackground(canvas); //Dibujar el fondo difuminado
drawVertex(canvas); //Dibujar los vertices en el canva
drawEdge(canvas); //Dibujar las lineas que unen los vertices
drawGrid(canvas); //Dibujar una cuadricula de referencia
} | [
"@",
"Override",
"protected",
"void",
"onDraw",
"(",
"Canvas",
"canvas",
")",
"{",
"super",
".",
"onDraw",
"(",
"canvas",
")",
";",
"//obtener las medidas actuales",
"if",
"(",
"getWidth",
"(",
")",
"!=",
"currentWidth",
"||",
"getHeight",
"(",
")",
"!=",
"currentHeight",
")",
"{",
"currentWidth",
"=",
"getWidth",
"(",
")",
";",
"currentHeight",
"=",
"getHeight",
"(",
")",
";",
"resetPoints",
"(",
")",
";",
"}",
"drawBackground",
"(",
"canvas",
")",
";",
"//Dibujar el fondo difuminado",
"drawVertex",
"(",
"canvas",
")",
";",
"//Dibujar los vertices en el canva",
"drawEdge",
"(",
"canvas",
")",
";",
"//Dibujar las lineas que unen los vertices",
"drawGrid",
"(",
"canvas",
")",
";",
"//Dibujar una cuadricula de referencia",
"}"
] | [
67,
4
] | [
80,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
IncomingCryptoRegistry. | null | Pasa la transacción a TBN y le agrega el Specialist. | Pasa la transacción a TBN y le agrega el Specialist. | public void setToNotify(UUID id, Specialist specialist) {
DatabaseTable registryTable = this.database.getTable(IncomingCryptoDataBaseConstants.INCOMING_CRYPTO_REGISTRY_TABLE_NAME);
try {
// We look for the record to update
registryTable.setUUIDFilter(IncomingCryptoDataBaseConstants.INCOMING_CRYPTO_REGISTRY_TABLE_ID_COLUMN.columnName, id, DatabaseFilterType.EQUAL);
registryTable.loadToMemory();
List<DatabaseTableRecord> records = registryTable.getRecords();
if (records.size() != 1) {
String message = "Unexpected number of transactions found";
String context = "The number of transactions found was: "+records.size()+ " and we expected 1";
FermatException e = new ExpectedTransactionNotFoundException(message,null,context,"");
errorManager.reportUnexpectedPluginException(Plugins.BITDUBAI_INCOMING_CRYPTO_TRANSACTION, UnexpectedPluginExceptionSeverity.DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN, e);
//TODO: MANAGE EXCEPTION
} else {
DatabaseTableRecord recordToUpdate = records.get(0);
recordToUpdate.setStringValue(
IncomingCryptoDataBaseConstants.INCOMING_CRYPTO_REGISTRY_TABLE_PROTOCOL_STATUS_COLUMN.columnName,
ProtocolStatus.TO_BE_NOTIFIED.getCode()
);
recordToUpdate.setStringValue(
IncomingCryptoDataBaseConstants.INCOMING_CRYPTO_REGISTRY_TABLE_SPECIALIST_COLUMN.columnName,
specialist.getCode()
);
registryTable.updateRecord(recordToUpdate);
}
} catch (CantLoadTableToMemoryException cantLoadTableToMemory) {
errorManager.reportUnexpectedPluginException(Plugins.BITDUBAI_INCOMING_CRYPTO_TRANSACTION, UnexpectedPluginExceptionSeverity.DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN, cantLoadTableToMemory);
//TODO: MANAGE EXCEPTION
} catch (CantUpdateRecordException cantUpdateRecord) {
errorManager.reportUnexpectedPluginException(Plugins.BITDUBAI_INCOMING_CRYPTO_TRANSACTION, UnexpectedPluginExceptionSeverity.DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN, cantUpdateRecord);
//TODO: MANAGE EXCEPTION
} catch (Exception exception) {
errorManager.reportUnexpectedPluginException(Plugins.BITDUBAI_INCOMING_CRYPTO_TRANSACTION, UnexpectedPluginExceptionSeverity.DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN, exception);
}
} | [
"public",
"void",
"setToNotify",
"(",
"UUID",
"id",
",",
"Specialist",
"specialist",
")",
"{",
"DatabaseTable",
"registryTable",
"=",
"this",
".",
"database",
".",
"getTable",
"(",
"IncomingCryptoDataBaseConstants",
".",
"INCOMING_CRYPTO_REGISTRY_TABLE_NAME",
")",
";",
"try",
"{",
"// We look for the record to update",
"registryTable",
".",
"setUUIDFilter",
"(",
"IncomingCryptoDataBaseConstants",
".",
"INCOMING_CRYPTO_REGISTRY_TABLE_ID_COLUMN",
".",
"columnName",
",",
"id",
",",
"DatabaseFilterType",
".",
"EQUAL",
")",
";",
"registryTable",
".",
"loadToMemory",
"(",
")",
";",
"List",
"<",
"DatabaseTableRecord",
">",
"records",
"=",
"registryTable",
".",
"getRecords",
"(",
")",
";",
"if",
"(",
"records",
".",
"size",
"(",
")",
"!=",
"1",
")",
"{",
"String",
"message",
"=",
"\"Unexpected number of transactions found\"",
";",
"String",
"context",
"=",
"\"The number of transactions found was: \"",
"+",
"records",
".",
"size",
"(",
")",
"+",
"\" and we expected 1\"",
";",
"FermatException",
"e",
"=",
"new",
"ExpectedTransactionNotFoundException",
"(",
"message",
",",
"null",
",",
"context",
",",
"\"\"",
")",
";",
"errorManager",
".",
"reportUnexpectedPluginException",
"(",
"Plugins",
".",
"BITDUBAI_INCOMING_CRYPTO_TRANSACTION",
",",
"UnexpectedPluginExceptionSeverity",
".",
"DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN",
",",
"e",
")",
";",
"//TODO: MANAGE EXCEPTION",
"}",
"else",
"{",
"DatabaseTableRecord",
"recordToUpdate",
"=",
"records",
".",
"get",
"(",
"0",
")",
";",
"recordToUpdate",
".",
"setStringValue",
"(",
"IncomingCryptoDataBaseConstants",
".",
"INCOMING_CRYPTO_REGISTRY_TABLE_PROTOCOL_STATUS_COLUMN",
".",
"columnName",
",",
"ProtocolStatus",
".",
"TO_BE_NOTIFIED",
".",
"getCode",
"(",
")",
")",
";",
"recordToUpdate",
".",
"setStringValue",
"(",
"IncomingCryptoDataBaseConstants",
".",
"INCOMING_CRYPTO_REGISTRY_TABLE_SPECIALIST_COLUMN",
".",
"columnName",
",",
"specialist",
".",
"getCode",
"(",
")",
")",
";",
"registryTable",
".",
"updateRecord",
"(",
"recordToUpdate",
")",
";",
"}",
"}",
"catch",
"(",
"CantLoadTableToMemoryException",
"cantLoadTableToMemory",
")",
"{",
"errorManager",
".",
"reportUnexpectedPluginException",
"(",
"Plugins",
".",
"BITDUBAI_INCOMING_CRYPTO_TRANSACTION",
",",
"UnexpectedPluginExceptionSeverity",
".",
"DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN",
",",
"cantLoadTableToMemory",
")",
";",
"//TODO: MANAGE EXCEPTION",
"}",
"catch",
"(",
"CantUpdateRecordException",
"cantUpdateRecord",
")",
"{",
"errorManager",
".",
"reportUnexpectedPluginException",
"(",
"Plugins",
".",
"BITDUBAI_INCOMING_CRYPTO_TRANSACTION",
",",
"UnexpectedPluginExceptionSeverity",
".",
"DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN",
",",
"cantUpdateRecord",
")",
";",
"//TODO: MANAGE EXCEPTION",
"}",
"catch",
"(",
"Exception",
"exception",
")",
"{",
"errorManager",
".",
"reportUnexpectedPluginException",
"(",
"Plugins",
".",
"BITDUBAI_INCOMING_CRYPTO_TRANSACTION",
",",
"UnexpectedPluginExceptionSeverity",
".",
"DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN",
",",
"exception",
")",
";",
"}",
"}"
] | [
413,
4
] | [
456,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ControladoraHotel. | null | si le paso una reserva me devuelve la habitacion que tiene esa reserva | si le paso una reserva me devuelve la habitacion que tiene esa reserva | public Habitacion dameHabitacionReserva(Reserva reserva) {
List<Habitacion> lista_habitacion = traerHabitacion();
Habitacion habitacion = new Habitacion();
for (Habitacion hab : lista_habitacion) {
for (Reserva res : hab.getLista_reservas()) {
if (res.getNro_reserva() == reserva.getNro_reserva()) {
habitacion = hab;
}
}
}
return habitacion;
} | [
"public",
"Habitacion",
"dameHabitacionReserva",
"(",
"Reserva",
"reserva",
")",
"{",
"List",
"<",
"Habitacion",
">",
"lista_habitacion",
"=",
"traerHabitacion",
"(",
")",
";",
"Habitacion",
"habitacion",
"=",
"new",
"Habitacion",
"(",
")",
";",
"for",
"(",
"Habitacion",
"hab",
":",
"lista_habitacion",
")",
"{",
"for",
"(",
"Reserva",
"res",
":",
"hab",
".",
"getLista_reservas",
"(",
")",
")",
"{",
"if",
"(",
"res",
".",
"getNro_reserva",
"(",
")",
"==",
"reserva",
".",
"getNro_reserva",
"(",
")",
")",
"{",
"habitacion",
"=",
"hab",
";",
"}",
"}",
"}",
"return",
"habitacion",
";",
"}"
] | [
514,
4
] | [
527,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
DatabaseRecordTest. | null | /* Comprobamos los return por default | /* Comprobamos los return por default | @Test
public void Default_AreEquals(){
record1.setStringValue("Columna_z", "z");
assertThat(record1.getStringValue("Column_x")).isEqualTo("");
assertThat(record1.getUUIDValue("Column_x")).isEqualTo(null);
assertThat(record1.getLongValue("Column_x")).isEqualTo(0);
assertThat(record1.getIntegerValue("Column_x")).isEqualTo(0);
assertThat(record1.getFloatValue("Column_x")).isEqualTo(0);
assertThat(record1.getDoubleValue("Column_x")).isEqualTo(0);
} | [
"@",
"Test",
"public",
"void",
"Default_AreEquals",
"(",
")",
"{",
"record1",
".",
"setStringValue",
"(",
"\"Columna_z\"",
",",
"\"z\"",
")",
";",
"assertThat",
"(",
"record1",
".",
"getStringValue",
"(",
"\"Column_x\"",
")",
")",
".",
"isEqualTo",
"(",
"\"\"",
")",
";",
"assertThat",
"(",
"record1",
".",
"getUUIDValue",
"(",
"\"Column_x\"",
")",
")",
".",
"isEqualTo",
"(",
"null",
")",
";",
"assertThat",
"(",
"record1",
".",
"getLongValue",
"(",
"\"Column_x\"",
")",
")",
".",
"isEqualTo",
"(",
"0",
")",
";",
"assertThat",
"(",
"record1",
".",
"getIntegerValue",
"(",
"\"Column_x\"",
")",
")",
".",
"isEqualTo",
"(",
"0",
")",
";",
"assertThat",
"(",
"record1",
".",
"getFloatValue",
"(",
"\"Column_x\"",
")",
")",
".",
"isEqualTo",
"(",
"0",
")",
";",
"assertThat",
"(",
"record1",
".",
"getDoubleValue",
"(",
"\"Column_x\"",
")",
")",
".",
"isEqualTo",
"(",
"0",
")",
";",
"}"
] | [
170,
1
] | [
182,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
MiCuenta. | null | Depende la seleccion de Camara/Galeria (Case) hace una cosa o otra para mostrar las imagenes | Depende la seleccion de Camara/Galeria (Case) hace una cosa o otra para mostrar las imagenes | @Override
public void onActivityResult(int requestCode, int resultCode, final Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
showProgressDialog();
switch (requestCode) {
case PHOTO_CODE:
MediaScannerConnection.scanFile(getContext(), new String[]{mPath}, null, new MediaScannerConnection.OnScanCompletedListener() {
@Override
public void onScanCompleted(String path, Uri uri) {
Toast.makeText(getContext(), "Scanned" + path + ":", Toast.LENGTH_SHORT).show();
Toast.makeText(getContext(), "-> Uri = " + uri, Toast.LENGTH_SHORT).show();
//Log.i("ExternalStorage", "Scanned" + path + ":");
//Log.i("ExternalStorage", "-> Uri = " + uri);
}
});
imageBitmap = BitmapFactory.decodeFile(mPath);
break;
case SELECT_PICTURE:
//FireBase Storage
final Uri path = data.getData();
final StorageReference filePath = mStorage.child("users").child(currentuser.getUid()).child("profile");
filePath.putFile(path).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
filePath.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
urlImagen = uri.toString();
String userId = currentuser.getUid();
mDatabase.child(userId).child("perfil").child("photoUser").setValue(urlImagen, new DatabaseReference.CompletionListener() {
public void onComplete(DatabaseError error, DatabaseReference ref) {
if (error != null) {
hideProgressDialog();
Toast.makeText(getContext(), "Error al Acttualizar: " + error.toString(), Toast.LENGTH_LONG).show();
} else {
hideProgressDialog();
Toast.makeText(getContext(), "Imagen Cambiada con Éxito!!", Toast.LENGTH_LONG).show();
}
}
});
}
});
}
});
break;
}
}
} | [
"@",
"Override",
"public",
"void",
"onActivityResult",
"(",
"int",
"requestCode",
",",
"int",
"resultCode",
",",
"final",
"Intent",
"data",
")",
"{",
"super",
".",
"onActivityResult",
"(",
"requestCode",
",",
"resultCode",
",",
"data",
")",
";",
"if",
"(",
"resultCode",
"==",
"RESULT_OK",
")",
"{",
"showProgressDialog",
"(",
")",
";",
"switch",
"(",
"requestCode",
")",
"{",
"case",
"PHOTO_CODE",
":",
"MediaScannerConnection",
".",
"scanFile",
"(",
"getContext",
"(",
")",
",",
"new",
"String",
"[",
"]",
"{",
"mPath",
"}",
",",
"null",
",",
"new",
"MediaScannerConnection",
".",
"OnScanCompletedListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onScanCompleted",
"(",
"String",
"path",
",",
"Uri",
"uri",
")",
"{",
"Toast",
".",
"makeText",
"(",
"getContext",
"(",
")",
",",
"\"Scanned\"",
"+",
"path",
"+",
"\":\"",
",",
"Toast",
".",
"LENGTH_SHORT",
")",
".",
"show",
"(",
")",
";",
"Toast",
".",
"makeText",
"(",
"getContext",
"(",
")",
",",
"\"-> Uri = \"",
"+",
"uri",
",",
"Toast",
".",
"LENGTH_SHORT",
")",
".",
"show",
"(",
")",
";",
"//Log.i(\"ExternalStorage\", \"Scanned\" + path + \":\");",
"//Log.i(\"ExternalStorage\", \"-> Uri = \" + uri);",
"}",
"}",
")",
";",
"imageBitmap",
"=",
"BitmapFactory",
".",
"decodeFile",
"(",
"mPath",
")",
";",
"break",
";",
"case",
"SELECT_PICTURE",
":",
"//FireBase Storage",
"final",
"Uri",
"path",
"=",
"data",
".",
"getData",
"(",
")",
";",
"final",
"StorageReference",
"filePath",
"=",
"mStorage",
".",
"child",
"(",
"\"users\"",
")",
".",
"child",
"(",
"currentuser",
".",
"getUid",
"(",
")",
")",
".",
"child",
"(",
"\"profile\"",
")",
";",
"filePath",
".",
"putFile",
"(",
"path",
")",
".",
"addOnSuccessListener",
"(",
"new",
"OnSuccessListener",
"<",
"UploadTask",
".",
"TaskSnapshot",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onSuccess",
"(",
"UploadTask",
".",
"TaskSnapshot",
"taskSnapshot",
")",
"{",
"filePath",
".",
"getDownloadUrl",
"(",
")",
".",
"addOnSuccessListener",
"(",
"new",
"OnSuccessListener",
"<",
"Uri",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onSuccess",
"(",
"Uri",
"uri",
")",
"{",
"urlImagen",
"=",
"uri",
".",
"toString",
"(",
")",
";",
"String",
"userId",
"=",
"currentuser",
".",
"getUid",
"(",
")",
";",
"mDatabase",
".",
"child",
"(",
"userId",
")",
".",
"child",
"(",
"\"perfil\"",
")",
".",
"child",
"(",
"\"photoUser\"",
")",
".",
"setValue",
"(",
"urlImagen",
",",
"new",
"DatabaseReference",
".",
"CompletionListener",
"(",
")",
"{",
"public",
"void",
"onComplete",
"(",
"DatabaseError",
"error",
",",
"DatabaseReference",
"ref",
")",
"{",
"if",
"(",
"error",
"!=",
"null",
")",
"{",
"hideProgressDialog",
"(",
")",
";",
"Toast",
".",
"makeText",
"(",
"getContext",
"(",
")",
",",
"\"Error al Acttualizar: \"",
"+",
"error",
".",
"toString",
"(",
")",
",",
"Toast",
".",
"LENGTH_LONG",
")",
".",
"show",
"(",
")",
";",
"}",
"else",
"{",
"hideProgressDialog",
"(",
")",
";",
"Toast",
".",
"makeText",
"(",
"getContext",
"(",
")",
",",
"\"Imagen Cambiada con Éxito!!\",",
" ",
"oast.",
"L",
"ENGTH_LONG)",
".",
"s",
"how(",
")",
";",
"",
"}",
"}",
"}",
")",
";",
"}",
"}",
")",
";",
"}",
"}",
")",
";",
"break",
";",
"}",
"}",
"}"
] | [
189,
4
] | [
239,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
JugadorX. | null | Implementar el método abstracto pendiente (requisito) | Implementar el método abstracto pendiente (requisito) | public void ejecutarEstrategiaEspecifica(Tablero tablero){
//JugadorX busca la esquina superior izquierda (SI) del tablero que esté vacía
super.realizarJugada(this.elegirCasillaSI(tablero), tablero);
} | [
"public",
"void",
"ejecutarEstrategiaEspecifica",
"(",
"Tablero",
"tablero",
")",
"{",
"//JugadorX busca la esquina superior izquierda (SI) del tablero que esté vacía",
"super",
".",
"realizarJugada",
"(",
"this",
".",
"elegirCasillaSI",
"(",
"tablero",
")",
",",
"tablero",
")",
";",
"}"
] | [
22,
4
] | [
25,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
UsuarioService. | null | /* select para buscar nuevos amigos por region | /* select para buscar nuevos amigos por region | public List<Usuario> findNuevosAmigosRegion(String region) {
ArrayList<Usuario> listaNuevosAmRegion = new ArrayList<Usuario>();
listaNuevosAmRegion = (ArrayList<Usuario>) repository.findNuevosAmigosRegion(region);
return listaNuevosAmRegion;
} | [
"public",
"List",
"<",
"Usuario",
">",
"findNuevosAmigosRegion",
"(",
"String",
"region",
")",
"{",
"ArrayList",
"<",
"Usuario",
">",
"listaNuevosAmRegion",
"=",
"new",
"ArrayList",
"<",
"Usuario",
">",
"(",
")",
";",
"listaNuevosAmRegion",
"=",
"(",
"ArrayList",
"<",
"Usuario",
">",
")",
"repository",
".",
"findNuevosAmigosRegion",
"(",
"region",
")",
";",
"return",
"listaNuevosAmRegion",
";",
"}"
] | [
163,
2
] | [
167,
3
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
FotosService. | null | /* buscar fotos del usuario limite de 9 ultimas para el perfil de usuario | /* buscar fotos del usuario limite de 9 ultimas para el perfil de usuario | public List<Fotos> findFotosPerfilUsuario(Integer idUsu) {
return repository.findFotosPerfilUsuario(idUsu);
} | [
"public",
"List",
"<",
"Fotos",
">",
"findFotosPerfilUsuario",
"(",
"Integer",
"idUsu",
")",
"{",
"return",
"repository",
".",
"findFotosPerfilUsuario",
"(",
"idUsu",
")",
";",
"}"
] | [
61,
1
] | [
63,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
CuentaBancoImplB. | null | /*esta clase es para fin demostrativo
similar a la clase CuentaBancoImpl pero agrega .20 a cada deposito | /*esta clase es para fin demostrativo
similar a la clase CuentaBancoImpl pero agrega .20 a cada deposito | @Override
public Cuenta retirarDinero(Cuenta cuenta, double monto) {
double saldoActual= cuenta.getSaldoinicial()-monto;
cuenta.setSaldoinicial(saldoActual);
System.out.println("Saldo actual: "+ cuenta.getSaldoinicial());
return cuenta;
} | [
"@",
"Override",
"public",
"Cuenta",
"retirarDinero",
"(",
"Cuenta",
"cuenta",
",",
"double",
"monto",
")",
"{",
"double",
"saldoActual",
"=",
"cuenta",
".",
"getSaldoinicial",
"(",
")",
"-",
"monto",
";",
"cuenta",
".",
"setSaldoinicial",
"(",
"saldoActual",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Saldo actual: \"",
"+",
"cuenta",
".",
"getSaldoinicial",
"(",
")",
")",
";",
"return",
"cuenta",
";",
"}"
] | [
8,
1
] | [
14,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ControladorVistas. | null | Enlace a panel cola de llenado | Enlace a panel cola de llenado | public void setPanelColaLlenado(PanelColaLlenado miPanelColaLlenado) {
this.miPanelColaLlenado = miPanelColaLlenado;
this.miPanelColaLlenado.setSize(800, 780);
this.miVentanaPrincipal.jPanel3.add(miPanelColaLlenado);
this.miPanelColaLlenado.setVisible(false);
} | [
"public",
"void",
"setPanelColaLlenado",
"(",
"PanelColaLlenado",
"miPanelColaLlenado",
")",
"{",
"this",
".",
"miPanelColaLlenado",
"=",
"miPanelColaLlenado",
";",
"this",
".",
"miPanelColaLlenado",
".",
"setSize",
"(",
"800",
",",
"780",
")",
";",
"this",
".",
"miVentanaPrincipal",
".",
"jPanel3",
".",
"add",
"(",
"miPanelColaLlenado",
")",
";",
"this",
".",
"miPanelColaLlenado",
".",
"setVisible",
"(",
"false",
")",
";",
"}"
] | [
63,
4
] | [
68,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
ClaseBBDD. | null | Devuelve un ArrayList de objetos Jugador con los datos de todos los jugadores de la BBDD | Devuelve un ArrayList de objetos Jugador con los datos de todos los jugadores de la BBDD | public ArrayList<Jugador> arrayListJugadores() throws SQLException {
//Nos conectamos a nuestra BBDD
Connection connect = conexion();
//Creamos un resultSet a partir de la query del statement
Statement st = connect.createStatement();
ResultSet rs = st.executeQuery("SELECT * FROM jugadores ORDER BY nombre");
//Creamos un ArrayList, donde almacenaremos los results del resultSet
ArrayList<Jugador> jugadores = new ArrayList<Jugador>();
// Añadimos cada result a nuestra ArrrayList:
// Primero decidiremos qué campo del resultSet corresponde a cada atributo del constructor Jugador
while (rs.next()) {
int codigo = rs.getInt(1);
String nombre = rs.getString(2);
String procedencia = rs.getString(3);
String altura = rs.getString(4);
int peso = rs.getInt(5);
String posicion = rs.getString(6);
String equipo = rs.getString(7);
Jugador player = new Jugador(codigo, nombre, procedencia, altura, peso, posicion, equipo);
jugadores.add(player); //añadimos cada jugador ya creado a nuestra ArrayList de jugadores
}
connect.close();
return jugadores;
} | [
"public",
"ArrayList",
"<",
"Jugador",
">",
"arrayListJugadores",
"(",
")",
"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",
"(",
")",
";",
"ResultSet",
"rs",
"=",
"st",
".",
"executeQuery",
"(",
"\"SELECT * FROM jugadores ORDER BY nombre\"",
")",
";",
"//Creamos un ArrayList, donde almacenaremos los results del resultSet\r",
"ArrayList",
"<",
"Jugador",
">",
"jugadores",
"=",
"new",
"ArrayList",
"<",
"Jugador",
">",
"(",
")",
";",
"// Añadimos cada result a nuestra ArrrayList:\r",
"// Primero decidiremos qué campo del resultSet corresponde a cada atributo del constructor Jugador\r",
"while",
"(",
"rs",
".",
"next",
"(",
")",
")",
"{",
"int",
"codigo",
"=",
"rs",
".",
"getInt",
"(",
"1",
")",
";",
"String",
"nombre",
"=",
"rs",
".",
"getString",
"(",
"2",
")",
";",
"String",
"procedencia",
"=",
"rs",
".",
"getString",
"(",
"3",
")",
";",
"String",
"altura",
"=",
"rs",
".",
"getString",
"(",
"4",
")",
";",
"int",
"peso",
"=",
"rs",
".",
"getInt",
"(",
"5",
")",
";",
"String",
"posicion",
"=",
"rs",
".",
"getString",
"(",
"6",
")",
";",
"String",
"equipo",
"=",
"rs",
".",
"getString",
"(",
"7",
")",
";",
"Jugador",
"player",
"=",
"new",
"Jugador",
"(",
"codigo",
",",
"nombre",
",",
"procedencia",
",",
"altura",
",",
"peso",
",",
"posicion",
",",
"equipo",
")",
";",
"jugadores",
".",
"add",
"(",
"player",
")",
";",
"//añadimos cada jugador ya creado a nuestra ArrayList de jugadores\r",
"}",
"connect",
".",
"close",
"(",
")",
";",
"return",
"jugadores",
";",
"}"
] | [
77,
3
] | [
105,
4
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
LLFunciones. | null | Declaramos el siguiente metodo | Declaramos el siguiente metodo | private void Secado(){
//Mnadmos a llamar al ultimo metodo para saber como se lavo y si se lavo la ropa
Lavado();
if(LavadoCompleto == 1 ){
System.out.println("Secando");
SecadoCompleto = 1;
}
} | [
"private",
"void",
"Secado",
"(",
")",
"{",
"//Mnadmos a llamar al ultimo metodo para saber como se lavo y si se lavo la ropa\r",
"Lavado",
"(",
")",
";",
"if",
"(",
"LavadoCompleto",
"==",
"1",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Secando\"",
")",
";",
"SecadoCompleto",
"=",
"1",
";",
"}",
"}"
] | [
51,
4
] | [
58,
5
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
|
GXDBMSoracle7. | null | Setea los datos de un blob
El parametro blob debe ser una instancia de java.sql.Blob o descendiente
Esta puesto como Object para que compile sin problemas en JSharp
| Setea los datos de un blob
El parametro blob debe ser una instancia de java.sql.Blob o descendiente
Esta puesto como Object para que compile sin problemas en JSharp
| public void setBlobData(Object blob, InputStream stream, int length)throws Exception
{
try
{
byte [] bytes = new byte[length];
com.genexus.PrivateUtilities.readFully(stream, bytes, 0, length);
if(PUTBYTES == null)
{
PUTBYTES = Class.forName("java.sql.Blob").getMethod("setBytes", new Class[]{long.class, byte[].class});
}
PUTBYTES.invoke(blob, new Object[]{new Long(1), bytes});
}catch(Exception e)
{
System.err.println(e.toString());
throw e;
}
} | [
"public",
"void",
"setBlobData",
"(",
"Object",
"blob",
",",
"InputStream",
"stream",
",",
"int",
"length",
")",
"throws",
"Exception",
"{",
"try",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"new",
"byte",
"[",
"length",
"]",
";",
"com",
".",
"genexus",
".",
"PrivateUtilities",
".",
"readFully",
"(",
"stream",
",",
"bytes",
",",
"0",
",",
"length",
")",
";",
"if",
"(",
"PUTBYTES",
"==",
"null",
")",
"{",
"PUTBYTES",
"=",
"Class",
".",
"forName",
"(",
"\"java.sql.Blob\"",
")",
".",
"getMethod",
"(",
"\"setBytes\"",
",",
"new",
"Class",
"[",
"]",
"{",
"long",
".",
"class",
",",
"byte",
"[",
"]",
".",
"class",
"}",
")",
";",
"}",
"PUTBYTES",
".",
"invoke",
"(",
"blob",
",",
"new",
"Object",
"[",
"]",
"{",
"new",
"Long",
"(",
"1",
")",
",",
"bytes",
"}",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"e",
".",
"toString",
"(",
")",
")",
";",
"throw",
"e",
";",
"}",
"}"
] | [
215,
1
] | [
231,
2
] | null | java | es | ['es', 'es', 'es'] | True | true | method_declaration |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.