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
Coordenada.
null
set que cambia losa tributos de la coordenada a modificar
set que cambia losa tributos de la coordenada a modificar
public void setX(float x) { this.x = x; }
[ "public", "void", "setX", "(", "float", "x", ")", "{", "this", ".", "x", "=", "x", ";", "}" ]
[ 57, 1 ]
[ 60, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
CrudLimpieza.
null
Método para ordenar la lista por orden alfabético
Método para ordenar la lista por orden alfabético
public void ordenarAlf () { Collections.sort(stockLimpieza, new OrdenarPorNombre ()); }
[ "public", "void", "ordenarAlf", "(", ")", "{", "Collections", ".", "sort", "(", "stockLimpieza", ",", "new", "OrdenarPorNombre", "(", ")", ")", ";", "}" ]
[ 159, 1 ]
[ 161, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Casilla.
null
Métodos -> comportamiento
Métodos -> comportamiento
public void aplicarJugada(int pValorLogico, String pValorConsola){ this.valorLogico = pValorLogico; this.valorConsola = pValorConsola; this.libre = false; }
[ "public", "void", "aplicarJugada", "(", "int", "pValorLogico", ",", "String", "pValorConsola", ")", "{", "this", ".", "valorLogico", "=", "pValorLogico", ";", "this", ".", "valorConsola", "=", "pValorConsola", ";", "this", ".", "libre", "=", "false", ";", "}" ]
[ 29, 4 ]
[ 33, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
EJ3Lucene.
null
Sobrecargamos el comportamiento del analizador para obtener un constructor del Analyzer personalizado
Sobrecargamos el comportamiento del analizador para obtener un constructor del Analyzer personalizado
public static Analyzer buildAnalyzer(final String language, final CharArraySet stopwords, final int min){ return new Analyzer(){ @Override protected TokenStreamComponents createComponents(String fieldname){ final Tokenizer source = new UAX29URLEmailTokenizer(); TokenStream result = new LowerCaseFilter(source); result = new StopFilter(result, stopwords); result = new NumerosFilter(result); result = new SnowballFilter(result, language); result = new LengthFilter(result, min, 1000); return new TokenStreamComponents(source, result); } }; }
[ "public", "static", "Analyzer", "buildAnalyzer", "(", "final", "String", "language", ",", "final", "CharArraySet", "stopwords", ",", "final", "int", "min", ")", "{", "return", "new", "Analyzer", "(", ")", "{", "@", "Override", "protected", "TokenStreamComponents", "createComponents", "(", "String", "fieldname", ")", "{", "final", "Tokenizer", "source", "=", "new", "UAX29URLEmailTokenizer", "(", ")", ";", "TokenStream", "result", "=", "new", "LowerCaseFilter", "(", "source", ")", ";", "result", "=", "new", "StopFilter", "(", "result", ",", "stopwords", ")", ";", "result", "=", "new", "NumerosFilter", "(", "result", ")", ";", "result", "=", "new", "SnowballFilter", "(", "result", ",", "language", ")", ";", "result", "=", "new", "LengthFilter", "(", "result", ",", "min", ",", "1000", ")", ";", "return", "new", "TokenStreamComponents", "(", "source", ",", "result", ")", ";", "}", "}", ";", "}" ]
[ 39, 1 ]
[ 52, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
BancoRankeadoAreaPromedioDao.
null
Consultar todos los líderes (READ)
Consultar todos los líderes (READ)
public ArrayList<BancoRankeadoAreaPromedio> consultarBancosAreaPromedioDesc() throws SQLException { //Contenedor de la respuesta -> Colección de líderes ArrayList<BancoRankeadoAreaPromedio> respuesta = new ArrayList<BancoRankeadoAreaPromedio>(); Connection conexion = null; try{ conexion = JDBCUtilities.getConnection(); //SELECT * FROM Lider; String consulta = "SELECT p.Banco_Vinculado,"+ "AVG(t.Area_Max) as Area_Promedio "+ "FROM Proyecto p "+ "JOIN Tipo t ON "+ "p.ID_Tipo = t.ID_Tipo "+ "GROUP BY p.Banco_Vinculado "+ "ORDER BY Area_Promedio DESC"; PreparedStatement statement = conexion.prepareStatement(consulta); ResultSet resultSet = statement.executeQuery(); //Moviendo apuntador por cada registro, cuando no hay más, retorna falso y se sale while(resultSet.next()){ //Cargar el registro actual en un Value Object BancoRankeadoAreaPromedio banco = new BancoRankeadoAreaPromedio(); banco.setAreaPromedio(resultSet.getDouble("Area_Promedio")); banco.setBancoVinculado(resultSet.getString("Banco_Vinculado")); respuesta.add(banco); } resultSet.close(); statement.close(); }catch(SQLException e){ System.err.println("Error consultando bancos rankeados areaMax promedio: "+e); }finally{ if(conexion != null){ conexion.close(); } } //Retornamos la colección de VO's obtenida de la BD (Vacía, con un VO o muchos) return respuesta; }
[ "public", "ArrayList", "<", "BancoRankeadoAreaPromedio", ">", "consultarBancosAreaPromedioDesc", "(", ")", "throws", "SQLException", "{", "//Contenedor de la respuesta -> Colección de líderes", "ArrayList", "<", "BancoRankeadoAreaPromedio", ">", "respuesta", "=", "new", "ArrayList", "<", "BancoRankeadoAreaPromedio", ">", "(", ")", ";", "Connection", "conexion", "=", "null", ";", "try", "{", "conexion", "=", "JDBCUtilities", ".", "getConnection", "(", ")", ";", "//SELECT * FROM Lider;", "String", "consulta", "=", "\"SELECT p.Banco_Vinculado,\"", "+", "\"AVG(t.Area_Max) as Area_Promedio \"", "+", "\"FROM Proyecto p \"", "+", "\"JOIN Tipo t ON \"", "+", "\"p.ID_Tipo = t.ID_Tipo \"", "+", "\"GROUP BY p.Banco_Vinculado \"", "+", "\"ORDER BY Area_Promedio DESC\"", ";", "PreparedStatement", "statement", "=", "conexion", ".", "prepareStatement", "(", "consulta", ")", ";", "ResultSet", "resultSet", "=", "statement", ".", "executeQuery", "(", ")", ";", "//Moviendo apuntador por cada registro, cuando no hay más, retorna falso y se sale", "while", "(", "resultSet", ".", "next", "(", ")", ")", "{", "//Cargar el registro actual en un Value Object", "BancoRankeadoAreaPromedio", "banco", "=", "new", "BancoRankeadoAreaPromedio", "(", ")", ";", "banco", ".", "setAreaPromedio", "(", "resultSet", ".", "getDouble", "(", "\"Area_Promedio\"", ")", ")", ";", "banco", ".", "setBancoVinculado", "(", "resultSet", ".", "getString", "(", "\"Banco_Vinculado\"", ")", ")", ";", "respuesta", ".", "add", "(", "banco", ")", ";", "}", "resultSet", ".", "close", "(", ")", ";", "statement", ".", "close", "(", ")", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"Error consultando bancos rankeados areaMax promedio: \"", "+", "e", ")", ";", "}", "finally", "{", "if", "(", "conexion", "!=", "null", ")", "{", "conexion", ".", "close", "(", ")", ";", "}", "}", "//Retornamos la colección de VO's obtenida de la BD (Vacía, con un VO o muchos)", "return", "respuesta", ";", "}" ]
[ 19, 4 ]
[ 63, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
JuegoPanel.
null
nuevo metodo con el cual creamos nuestra nave y sus atributos
nuevo metodo con el cual creamos nuestra nave y sus atributos
@Override public void paintComponent(Graphics g){ // llamaremoas al padre de la clase paint y le pasamos rl parmetro g super.paintComponent(g); // creaoms un objeto en 2D casteando graphics g2 = (Graphics2D)g; // cambiamos el color de lo que esta pintando g2.setColor(Color.BLACK); // le damos el tamaño a nuestra nave nave = new Rectangle2D.Double(xNave,410,60,90); // procedemos a dibujarlo g2.fill(nave); // for para dibujar las naves que aun estan for(int i =0;i<disparadas;i++){ disparos[i]= new Ellipse2D.Double(xDisp[i],yDisp[i],10,20); g2.fill(disparos[i]); } // si nuestras vidas son igual a 0 entonces paramos el timer if(lives ==0){ fin=true; t.stop(); enemi.stop(); } // LLAMADO DE FUNCIONES wwrite(); iniEnemigas(); reviewVivas(); intersectBala(); restLives(); }
[ "@", "Override", "public", "void", "paintComponent", "(", "Graphics", "g", ")", "{", "// llamaremoas al padre de la clase paint y le pasamos rl parmetro g", "super", ".", "paintComponent", "(", "g", ")", ";", "// creaoms un objeto en 2D casteando graphics", "g2", "=", "(", "Graphics2D", ")", "g", ";", "// cambiamos el color de lo que esta pintando", "g2", ".", "setColor", "(", "Color", ".", "BLACK", ")", ";", "// le damos el tamaño a nuestra nave", "nave", "=", "new", "Rectangle2D", ".", "Double", "(", "xNave", ",", "410", ",", "60", ",", "90", ")", ";", "// procedemos a dibujarlo", "g2", ".", "fill", "(", "nave", ")", ";", "// for para dibujar las naves que aun estan", "for", "(", "int", "i", "=", "0", ";", "i", "<", "disparadas", ";", "i", "++", ")", "{", "disparos", "[", "i", "]", "=", "new", "Ellipse2D", ".", "Double", "(", "xDisp", "[", "i", "]", ",", "yDisp", "[", "i", "]", ",", "10", ",", "20", ")", ";", "g2", ".", "fill", "(", "disparos", "[", "i", "]", ")", ";", "}", "// si nuestras vidas son igual a 0 entonces paramos el timer ", "if", "(", "lives", "==", "0", ")", "{", "fin", "=", "true", ";", "t", ".", "stop", "(", ")", ";", "enemi", ".", "stop", "(", ")", ";", "}", "// LLAMADO DE FUNCIONES", "wwrite", "(", ")", ";", "iniEnemigas", "(", ")", ";", "reviewVivas", "(", ")", ";", "intersectBala", "(", ")", ";", "restLives", "(", ")", ";", "}" ]
[ 335, 4 ]
[ 368, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
GXXMLSerializable.
null
/*Recorre el iterador y pone los _N del campo al final asi no se pierden los valores null cuando se asigna el valor al campo
/*Recorre el iterador y pone los _N del campo al final asi no se pierden los valores null cuando se asigna el valor al campo
private Iterator getFromJSONObjectOrderIterator(Iterator it) { java.util.Vector<String> v = new java.util.Vector<String>(); java.util.Vector<String> vAtEnd = new java.util.Vector<String>(); String name; while(it.hasNext()) { name = (String)it.next(); String map = getJsonMap(name); String className = CommonUtil.classNameNoPackage(this.getClass()); Method getMethod = getMethod(GET_METHOD_NAME + className + "_" + (map != null? map : name)); if (name.endsWith("_N") || getMethod != null && getMethod.getName().startsWith("getgxTv_") && getMethod.isAnnotationPresent(GxUpload.class)) { vAtEnd.add(name); } else { v.add(name);//Debe conservar el orden de los atributos que no terminan con _N. } } if (vAtEnd.size()>0) v.addAll(vAtEnd); return v.iterator(); }
[ "private", "Iterator", "getFromJSONObjectOrderIterator", "(", "Iterator", "it", ")", "{", "java", ".", "util", ".", "Vector", "<", "String", ">", "v", "=", "new", "java", ".", "util", ".", "Vector", "<", "String", ">", "(", ")", ";", "java", ".", "util", ".", "Vector", "<", "String", ">", "vAtEnd", "=", "new", "java", ".", "util", ".", "Vector", "<", "String", ">", "(", ")", ";", "String", "name", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", "{", "name", "=", "(", "String", ")", "it", ".", "next", "(", ")", ";", "String", "map", "=", "getJsonMap", "(", "name", ")", ";", "String", "className", "=", "CommonUtil", ".", "classNameNoPackage", "(", "this", ".", "getClass", "(", ")", ")", ";", "Method", "getMethod", "=", "getMethod", "(", "GET_METHOD_NAME", "+", "className", "+", "\"_\"", "+", "(", "map", "!=", "null", "?", "map", ":", "name", ")", ")", ";", "if", "(", "name", ".", "endsWith", "(", "\"_N\"", ")", "||", "getMethod", "!=", "null", "&&", "getMethod", ".", "getName", "(", ")", ".", "startsWith", "(", "\"getgxTv_\"", ")", "&&", "getMethod", ".", "isAnnotationPresent", "(", "GxUpload", ".", "class", ")", ")", "{", "vAtEnd", ".", "add", "(", "name", ")", ";", "}", "else", "{", "v", ".", "add", "(", "name", ")", ";", "//Debe conservar el orden de los atributos que no terminan con _N.", "}", "}", "if", "(", "vAtEnd", ".", "size", "(", ")", ">", "0", ")", "v", ".", "addAll", "(", "vAtEnd", ")", ";", "return", "v", ".", "iterator", "(", ")", ";", "}" ]
[ 319, 1 ]
[ 343, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Password.
null
Metodo para generar una Contraseña Aleatoria
Metodo para generar una Contraseña Aleatoria
private String generarPassword() { int valor = 0; String cadena = ""; for (int i = 0; i < this.longitud; i++) { valor = ((int) Math.floor(Math.random() * 3 + 1)); if (valor == 1) { //Mayusculas char may = (char) ((int) Math.floor(Math.random() * (91 - 65) + 65)); cadena += may; } else if (valor == 2) { //Minusculas char minusculas = (char) ((int) Math.floor(Math.random() * (123 - 97) + 97)); cadena += minusculas; } else { //Numeros char numeros = (char) ((int) Math.floor(Math.random() * (58 - 48) + 48)); cadena += numeros; } } return cadena; }
[ "private", "String", "generarPassword", "(", ")", "{", "int", "valor", "=", "0", ";", "String", "cadena", "=", "\"\"", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "longitud", ";", "i", "++", ")", "{", "valor", "=", "(", "(", "int", ")", "Math", ".", "floor", "(", "Math", ".", "random", "(", ")", "*", "3", "+", "1", ")", ")", ";", "if", "(", "valor", "==", "1", ")", "{", "//Mayusculas", "char", "may", "=", "(", "char", ")", "(", "(", "int", ")", "Math", ".", "floor", "(", "Math", ".", "random", "(", ")", "*", "(", "91", "-", "65", ")", "+", "65", ")", ")", ";", "cadena", "+=", "may", ";", "}", "else", "if", "(", "valor", "==", "2", ")", "{", "//Minusculas", "char", "minusculas", "=", "(", "char", ")", "(", "(", "int", ")", "Math", ".", "floor", "(", "Math", ".", "random", "(", ")", "*", "(", "123", "-", "97", ")", "+", "97", ")", ")", ";", "cadena", "+=", "minusculas", ";", "}", "else", "{", "//Numeros", "char", "numeros", "=", "(", "char", ")", "(", "(", "int", ")", "Math", ".", "floor", "(", "Math", ".", "random", "(", ")", "*", "(", "58", "-", "48", ")", "+", "48", ")", ")", ";", "cadena", "+=", "numeros", ";", "}", "}", "return", "cadena", ";", "}" ]
[ 64, 4 ]
[ 82, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Registro.
null
Método InsertarHabitaciones con posición
Método InsertarHabitaciones con posición
public void InsertarHabitaciones(int Posicion, Habitacion HabitacionAAsignar) { RegistroHabitaciones.add(Posicion, HabitacionAAsignar); }
[ "public", "void", "InsertarHabitaciones", "(", "int", "Posicion", ",", "Habitacion", "HabitacionAAsignar", ")", "{", "RegistroHabitaciones", ".", "add", "(", "Posicion", ",", "HabitacionAAsignar", ")", ";", "}" ]
[ 114, 4 ]
[ 117, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
DatabaseRecordTest.
null
/* Comprobamos los metodos de tipo Integer
/* Comprobamos los metodos de tipo Integer
@Test public void Integer_AreEquals(){ record1.setIntegerValue("Integer_Column_1", 1); record2.setIntegerValue("Integer_Column_1", 1); assertThat(record1.getIntegerValue("Integer_Column_1")).isEqualTo(record2.getIntegerValue("Integer_Column_1")); }
[ "@", "Test", "public", "void", "Integer_AreEquals", "(", ")", "{", "record1", ".", "setIntegerValue", "(", "\"Integer_Column_1\"", ",", "1", ")", ";", "record2", ".", "setIntegerValue", "(", "\"Integer_Column_1\"", ",", "1", ")", ";", "assertThat", "(", "record1", ".", "getIntegerValue", "(", "\"Integer_Column_1\"", ")", ")", ".", "isEqualTo", "(", "record2", ".", "getIntegerValue", "(", "\"Integer_Column_1\"", ")", ")", ";", "}" ]
[ 67, 2 ]
[ 73, 3 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
LocalUtil.
null
El resultado se normaliza para que el punto decimal siempre sea '.'
El resultado se normaliza para que el punto decimal siempre sea '.'
private static String normalize(String value, char decSepChar, char thousandsSepChar) { StringBuffer buffer = new StringBuffer(); boolean first = true; //Si el numero tiene mas de un . entonces no es separador decimal (es parte de la picture, p.ej. C.I.) se remueven todos. boolean dotAsLiteral = (decSepChar=='.') && (value.lastIndexOf('.') != value.indexOf('.')); for (int i = 0; i < value.length(); i++) { if (value.charAt(i) == decSepChar) { if (!dotAsLiteral) { buffer.append('.'); first=false; } } else if (value.charAt(i) == '-' && first) { buffer.append(value.charAt(i)); first=false; } else if (value.charAt(i) >= '0' && value.charAt(i) <= '9') { buffer.append(value.charAt(i)); first=false; } } return buffer.toString(); }
[ "private", "static", "String", "normalize", "(", "String", "value", ",", "char", "decSepChar", ",", "char", "thousandsSepChar", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "boolean", "first", "=", "true", ";", "//Si el numero tiene mas de un . entonces no es separador decimal (es parte de la picture, p.ej. C.I.) se remueven todos.", "boolean", "dotAsLiteral", "=", "(", "decSepChar", "==", "'", "'", ")", "&&", "(", "value", ".", "lastIndexOf", "(", "'", "'", ")", "!=", "value", ".", "indexOf", "(", "'", "'", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "value", ".", "length", "(", ")", ";", "i", "++", ")", "{", "if", "(", "value", ".", "charAt", "(", "i", ")", "==", "decSepChar", ")", "{", "if", "(", "!", "dotAsLiteral", ")", "{", "buffer", ".", "append", "(", "'", "'", ")", ";", "first", "=", "false", ";", "}", "}", "else", "if", "(", "value", ".", "charAt", "(", "i", ")", "==", "'", "'", "&&", "first", ")", "{", "buffer", ".", "append", "(", "value", ".", "charAt", "(", "i", ")", ")", ";", "first", "=", "false", ";", "}", "else", "if", "(", "value", ".", "charAt", "(", "i", ")", ">=", "'", "'", "&&", "value", ".", "charAt", "(", "i", ")", "<=", "'", "'", ")", "{", "buffer", ".", "append", "(", "value", ".", "charAt", "(", "i", ")", ")", ";", "first", "=", "false", ";", "}", "}", "return", "buffer", ".", "toString", "(", ")", ";", "}" ]
[ 1840, 1 ]
[ 1870, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
CryptoTransmissionAgent.
null
Este agente se usa por las dudas que no se haya escuchado el evento del receive que guarda las cosas en la db de la metadata recibida
Este agente se usa por las dudas que no se haya escuchado el evento del receive que guarda las cosas en la db de la metadata recibida
private void receiveCycle(){ try { // function to process metadata received processReceive(); //Sleep for a time toSend.sleep(CryptoTransmissionAgent.RECEIVE_SLEEP_TIME); } catch (InterruptedException e) { errorManager.reportUnexpectedPluginException(Plugins.BITDUBAI_TEMPLATE_NETWORK_SERVICE, UnexpectedPluginExceptionSeverity.DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN, new Exception("Can not sleep")); } }
[ "private", "void", "receiveCycle", "(", ")", "{", "try", "{", "// function to process metadata received", "processReceive", "(", ")", ";", "//Sleep for a time", "toSend", ".", "sleep", "(", "CryptoTransmissionAgent", ".", "RECEIVE_SLEEP_TIME", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "errorManager", ".", "reportUnexpectedPluginException", "(", "Plugins", ".", "BITDUBAI_TEMPLATE_NETWORK_SERVICE", ",", "UnexpectedPluginExceptionSeverity", ".", "DISABLES_SOME_FUNCTIONALITY_WITHIN_THIS_PLUGIN", ",", "new", "Exception", "(", "\"Can not sleep\"", ")", ")", ";", "}", "}" ]
[ 503, 4 ]
[ 514, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
ImagenesApiResource.
null
Método que devuelve una imagen con una determinada id
Método que devuelve una imagen con una determinada id
@GET @Path("/{id}") @Produces("application/json") public Imagen getImagenById(@PathParam("id") String id) { Imagen imagen = repository.getImagenById(id); if (imagen == null) { throw new BadRequestException("La imagen solicitada no existe."); } return imagen; }
[ "@", "GET", "@", "Path", "(", "\"/{id}\"", ")", "@", "Produces", "(", "\"application/json\"", ")", "public", "Imagen", "getImagenById", "(", "@", "PathParam", "(", "\"id\"", ")", "String", "id", ")", "{", "Imagen", "imagen", "=", "repository", ".", "getImagenById", "(", "id", ")", ";", "if", "(", "imagen", "==", "null", ")", "{", "throw", "new", "BadRequestException", "(", "\"La imagen solicitada no existe.\"", ")", ";", "}", "return", "imagen", ";", "}" ]
[ 67, 1 ]
[ 76, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Baraja.
null
Comprueba si la baraj está vacia
Comprueba si la baraj está vacia
public boolean esVacio(){ return baraja.isEmpty(); }
[ "public", "boolean", "esVacio", "(", ")", "{", "return", "baraja", ".", "isEmpty", "(", ")", ";", "}" ]
[ 39, 4 ]
[ 41, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
GXSimpleCollection.
null
Ordena la Collection de acuerdo a un proc pasado por parametro El proc tiene que recibir como parms parm(IN: &SDT1, IN: &SDT2, OUT: INT) O sea, los 2 primero parametros son los SDTs a comparar y el tercero es el resultado
Ordena la Collection de acuerdo a un proc pasado por parametro El proc tiene que recibir como parms parm(IN: &SDT1, IN: &SDT2, OUT: INT) O sea, los 2 primero parametros son los SDTs a comparar y el tercero es el resultado
public void sortproc(String procName, ModelContext modelContext, int handle) { //Quicksort.sort(vector, new ProcComparer(procName, modelContext, handle)); }
[ "public", "void", "sortproc", "(", "String", "procName", ",", "ModelContext", "modelContext", ",", "int", "handle", ")", "{", "//Quicksort.sort(vector, new ProcComparer(procName, modelContext, handle));", "}" ]
[ 725, 1 ]
[ 728, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
ClaseBBDD.
null
Devolverá true si la operación se realiza y false en caso contrario
Devolverá true si la operación se realiza y false en caso contrario
public boolean insertarPartido(String local, String visitante, int ptosLocal, int ptosVisitante, String temporada) throws SQLException { Connection connect = conexion(); // query 1 para obtener el código del partido Statement st = connect.createStatement(); ResultSet rs = st.executeQuery("SELECT MAX(codigo) FROM partidos"); int codigo = 0; while(rs.next()) { codigo = rs.getInt(1); } //query 2 para hacer INSERT PreparedStatement pst = connect.prepareStatement("INSERT INTO partidos (codigo, equipo_local, equipo_visitante, puntos_local, puntos_visitante, temporada)" + "VALUES (?, ?, ?, ?, ?, ?)"); pst.setInt(1, (codigo +1)); pst.setString(2, local); pst.setString(3, visitante); pst.setInt(4, ptosLocal); pst.setInt(5, ptosVisitante); pst.setString(6, temporada); int resultado = pst.executeUpdate(); //Devuelve la cantidad de filas insertadas o modificadas //(deberá ser 1 en este caso) connect.close(); return resultado == 1; //Si hemos insertado una fila, devolverá TRUE }
[ "public", "boolean", "insertarPartido", "(", "String", "local", ",", "String", "visitante", ",", "int", "ptosLocal", ",", "int", "ptosVisitante", ",", "String", "temporada", ")", "throws", "SQLException", "{", "Connection", "connect", "=", "conexion", "(", ")", ";", "// query 1 para obtener el código del partido\r", "Statement", "st", "=", "connect", ".", "createStatement", "(", ")", ";", "ResultSet", "rs", "=", "st", ".", "executeQuery", "(", "\"SELECT MAX(codigo) FROM partidos\"", ")", ";", "int", "codigo", "=", "0", ";", "while", "(", "rs", ".", "next", "(", ")", ")", "{", "codigo", "=", "rs", ".", "getInt", "(", "1", ")", ";", "}", "//query 2 para hacer INSERT\r", "PreparedStatement", "pst", "=", "connect", ".", "prepareStatement", "(", "\"INSERT INTO partidos (codigo, equipo_local, equipo_visitante, puntos_local, puntos_visitante, temporada)\"", "+", "\"VALUES (?, ?, ?, ?, ?, ?)\"", ")", ";", "pst", ".", "setInt", "(", "1", ",", "(", "codigo", "+", "1", ")", ")", ";", "pst", ".", "setString", "(", "2", ",", "local", ")", ";", "pst", ".", "setString", "(", "3", ",", "visitante", ")", ";", "pst", ".", "setInt", "(", "4", ",", "ptosLocal", ")", ";", "pst", ".", "setInt", "(", "5", ",", "ptosVisitante", ")", ";", "pst", ".", "setString", "(", "6", ",", "temporada", ")", ";", "int", "resultado", "=", "pst", ".", "executeUpdate", "(", ")", ";", "//Devuelve la cantidad de filas insertadas o modificadas\r", "//(deberá ser 1 en este caso)\r", "connect", ".", "close", "(", ")", ";", "return", "resultado", "==", "1", ";", "//Si hemos insertado una fila, devolverá TRUE\r", "}" ]
[ 226, 3 ]
[ 254, 4 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
RelacionInformacion.
null
Método que muestra la información relacionada (doctor, paciente, cita).
Método que muestra la información relacionada (doctor, paciente, cita).
public void mostrarRelacionesInformacion() { ResultSet resultado = null; try { // Establecer conexión. Class.forName("org.sqlite.JDBC"); conexion = DriverManager.getConnection("jdbc:sqlite:db/administracion_citas.db"); if(conexion != null) { System.out.println("Conectado."); } PreparedStatement query = conexion.prepareStatement("SELECT Doctores.*, Pacientes.*, Citas.* FROM RelacionInformacion INNER JOIN Doctores " + "ON RelacionInformacion.idDoctor = Doctores.id " + "INNER JOIN Pacientes ON RelacionInformacion.idPaciente = Pacientes.id " + "INNER JOIN Citas ON RelacionInformacion.idCita = Citas.id"); resultado = query.executeQuery(); while(resultado.next()) { // Datos del doctor. System.out.println("***** DATOS DEL DOCTOR *****"); System.out.print("ID del doctor: "); System.out.println(resultado.getString(1)); System.out.print("Nombre del doctor: "); System.out.println(resultado.getString(2)); System.out.print("Especialidad del doctor: "); System.out.println(resultado.getString(3)); System.out.println(); // Datos del paciente. System.out.println("***** DATOS DEL PACIENTE *****"); System.out.print("ID del paciente: "); System.out.println(resultado.getString(4)); System.out.print("Nombre del paciente: "); System.out.println(resultado.getString(5)); System.out.println(); // Datos de la cita. System.out.println("***** DATOS DE LA CITA *****"); System.out.print("ID de la cita: "); System.out.println(resultado.getString(6)); System.out.print("Fecha de la cita: "); System.out.println(resultado.getString(7)); System.out.print("Hora de la cita: "); System.out.println(resultado.getString(8)); System.out.print("Motivo de la cita: "); System.out.println(resultado.getString(9)); System.out.println("=========="); System.out.println(); } query.close(); conexion.close(); } catch (Exception e) { System.err.println(e.getMessage()); } }
[ "public", "void", "mostrarRelacionesInformacion", "(", ")", "{", "ResultSet", "resultado", "=", "null", ";", "try", "{", "// Establecer conexión.", "Class", ".", "forName", "(", "\"org.sqlite.JDBC\"", ")", ";", "conexion", "=", "DriverManager", ".", "getConnection", "(", "\"jdbc:sqlite:db/administracion_citas.db\"", ")", ";", "if", "(", "conexion", "!=", "null", ")", "{", "System", ".", "out", ".", "println", "(", "\"Conectado.\"", ")", ";", "}", "PreparedStatement", "query", "=", "conexion", ".", "prepareStatement", "(", "\"SELECT Doctores.*, Pacientes.*, Citas.* FROM RelacionInformacion INNER JOIN Doctores \"", "+", "\"ON RelacionInformacion.idDoctor = Doctores.id \"", "+", "\"INNER JOIN Pacientes ON RelacionInformacion.idPaciente = Pacientes.id \"", "+", "\"INNER JOIN Citas ON RelacionInformacion.idCita = Citas.id\"", ")", ";", "resultado", "=", "query", ".", "executeQuery", "(", ")", ";", "while", "(", "resultado", ".", "next", "(", ")", ")", "{", "// Datos del doctor.", "System", ".", "out", ".", "println", "(", "\"***** DATOS DEL DOCTOR *****\"", ")", ";", "System", ".", "out", ".", "print", "(", "\"ID del doctor: \"", ")", ";", "System", ".", "out", ".", "println", "(", "resultado", ".", "getString", "(", "1", ")", ")", ";", "System", ".", "out", ".", "print", "(", "\"Nombre del doctor: \"", ")", ";", "System", ".", "out", ".", "println", "(", "resultado", ".", "getString", "(", "2", ")", ")", ";", "System", ".", "out", ".", "print", "(", "\"Especialidad del doctor: \"", ")", ";", "System", ".", "out", ".", "println", "(", "resultado", ".", "getString", "(", "3", ")", ")", ";", "System", ".", "out", ".", "println", "(", ")", ";", "// Datos del paciente.", "System", ".", "out", ".", "println", "(", "\"***** DATOS DEL PACIENTE *****\"", ")", ";", "System", ".", "out", ".", "print", "(", "\"ID del paciente: \"", ")", ";", "System", ".", "out", ".", "println", "(", "resultado", ".", "getString", "(", "4", ")", ")", ";", "System", ".", "out", ".", "print", "(", "\"Nombre del paciente: \"", ")", ";", "System", ".", "out", ".", "println", "(", "resultado", ".", "getString", "(", "5", ")", ")", ";", "System", ".", "out", ".", "println", "(", ")", ";", "// Datos de la cita.", "System", ".", "out", ".", "println", "(", "\"***** DATOS DE LA CITA *****\"", ")", ";", "System", ".", "out", ".", "print", "(", "\"ID de la cita: \"", ")", ";", "System", ".", "out", ".", "println", "(", "resultado", ".", "getString", "(", "6", ")", ")", ";", "System", ".", "out", ".", "print", "(", "\"Fecha de la cita: \"", ")", ";", "System", ".", "out", ".", "println", "(", "resultado", ".", "getString", "(", "7", ")", ")", ";", "System", ".", "out", ".", "print", "(", "\"Hora de la cita: \"", ")", ";", "System", ".", "out", ".", "println", "(", "resultado", ".", "getString", "(", "8", ")", ")", ";", "System", ".", "out", ".", "print", "(", "\"Motivo de la cita: \"", ")", ";", "System", ".", "out", ".", "println", "(", "resultado", ".", "getString", "(", "9", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"==========\"", ")", ";", "System", ".", "out", ".", "println", "(", ")", ";", "}", "query", ".", "close", "(", ")", ";", "conexion", ".", "close", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "err", ".", "println", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}" ]
[ 59, 4 ]
[ 118, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
ControladorVistaAdministrador.
null
------------------ Funciones auxiliares ------------------
------------------ Funciones auxiliares ------------------
private void buscarAdministradorLogueado() { // Se busca el administrador en funcion del usuario logueado; Vector<Administrador> administradores = Sistema.getUnico().getfListaAdministradores(); for(Administrador a: administradores) { if (Sistema.getUnico().getUsuarioLogueado().getUsuario().equals(a.getDni())) { adminLogueado = a; break; } } }
[ "private", "void", "buscarAdministradorLogueado", "(", ")", "{", "// Se busca el administrador en funcion del usuario logueado;", "Vector", "<", "Administrador", ">", "administradores", "=", "Sistema", ".", "getUnico", "(", ")", ".", "getfListaAdministradores", "(", ")", ";", "for", "(", "Administrador", "a", ":", "administradores", ")", "{", "if", "(", "Sistema", ".", "getUnico", "(", ")", ".", "getUsuarioLogueado", "(", ")", ".", "getUsuario", "(", ")", ".", "equals", "(", "a", ".", "getDni", "(", ")", ")", ")", "{", "adminLogueado", "=", "a", ";", "break", ";", "}", "}", "}" ]
[ 275, 1 ]
[ 284, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Juego.
null
Capacidad al juego para revisar el tablero y determinar en qué estado se encuentra
Capacidad al juego para revisar el tablero y determinar en qué estado se encuentra
public ValoresLogicos revisarTablero(){ //Obtener las sumatorias de las filas ArrayList<Integer> sumatoriaFilas = new ArrayList<Integer>(); for (int i = 0; i < Tablero.NUM_FILAS; i++) { sumatoriaFilas.add(this.sumatoriaCasillas(this.obtenerFila(i))); } //Obtener las sumatorias de las columnas ArrayList<Integer> sumatoriaColumnas = new ArrayList<Integer>(); for (int j = 0; j < Tablero.NUM_COLUMNAS; j++) { sumatoriaColumnas.add(this.sumatoriaCasillas(this.obtenerColumna(j))); } //Obtener sumatoria de la diagonal int sumatoriaDiagonal = this.sumatoriaCasillas(this.obtenerDiagonal()); //Obtener sumatoria de la diagonal inversa int sumatoriaDiagonalInversa = this.sumatoriaCasillas(this.obtenerDiagonalInversa()); //Obtener sumatoria total del tablero int sumatoriaTotal = this.sumatoriaTablero(); //Ganador //Si ganó el jugadorO if( sumatoriaFilas.contains(ValoresLogicos.LINEA_JUGADOR_O.getValorLogico()) || sumatoriaColumnas.contains(ValoresLogicos.LINEA_JUGADOR_O.getValorLogico()) || sumatoriaDiagonal == ValoresLogicos.LINEA_JUGADOR_O.getValorLogico() || sumatoriaDiagonalInversa == ValoresLogicos.LINEA_JUGADOR_O.getValorLogico() ){ return ValoresLogicos.JUGADOR_O; } //Si ganó el jugadorX if( sumatoriaFilas.contains(ValoresLogicos.LINEA_JUGADOR_X.getValorLogico()) || sumatoriaColumnas.contains(ValoresLogicos.LINEA_JUGADOR_X.getValorLogico()) || sumatoriaDiagonal == ValoresLogicos.LINEA_JUGADOR_X.getValorLogico() || sumatoriaDiagonalInversa == ValoresLogicos.LINEA_JUGADOR_X.getValorLogico() ){ return ValoresLogicos.JUGADOR_X; } //Hay empate if( sumatoriaTotal == ValoresLogicos.EMPATE_INICIANDO_O.getValorLogico() || sumatoriaTotal == ValoresLogicos.EMPATE_INICIANDO_X.getValorLogico() ){ return ValoresLogicos.PARTIDA_EMPATADA; } //No hay ganador no hay empate return ValoresLogicos.SIN_GANADOR; }
[ "public", "ValoresLogicos", "revisarTablero", "(", ")", "{", "//Obtener las sumatorias de las filas", "ArrayList", "<", "Integer", ">", "sumatoriaFilas", "=", "new", "ArrayList", "<", "Integer", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "Tablero", ".", "NUM_FILAS", ";", "i", "++", ")", "{", "sumatoriaFilas", ".", "add", "(", "this", ".", "sumatoriaCasillas", "(", "this", ".", "obtenerFila", "(", "i", ")", ")", ")", ";", "}", "//Obtener las sumatorias de las columnas", "ArrayList", "<", "Integer", ">", "sumatoriaColumnas", "=", "new", "ArrayList", "<", "Integer", ">", "(", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "Tablero", ".", "NUM_COLUMNAS", ";", "j", "++", ")", "{", "sumatoriaColumnas", ".", "add", "(", "this", ".", "sumatoriaCasillas", "(", "this", ".", "obtenerColumna", "(", "j", ")", ")", ")", ";", "}", "//Obtener sumatoria de la diagonal", "int", "sumatoriaDiagonal", "=", "this", ".", "sumatoriaCasillas", "(", "this", ".", "obtenerDiagonal", "(", ")", ")", ";", "//Obtener sumatoria de la diagonal inversa", "int", "sumatoriaDiagonalInversa", "=", "this", ".", "sumatoriaCasillas", "(", "this", ".", "obtenerDiagonalInversa", "(", ")", ")", ";", "//Obtener sumatoria total del tablero", "int", "sumatoriaTotal", "=", "this", ".", "sumatoriaTablero", "(", ")", ";", "//Ganador", "//Si ganó el jugadorO ", "if", "(", "sumatoriaFilas", ".", "contains", "(", "ValoresLogicos", ".", "LINEA_JUGADOR_O", ".", "getValorLogico", "(", ")", ")", "||", "sumatoriaColumnas", ".", "contains", "(", "ValoresLogicos", ".", "LINEA_JUGADOR_O", ".", "getValorLogico", "(", ")", ")", "||", "sumatoriaDiagonal", "==", "ValoresLogicos", ".", "LINEA_JUGADOR_O", ".", "getValorLogico", "(", ")", "||", "sumatoriaDiagonalInversa", "==", "ValoresLogicos", ".", "LINEA_JUGADOR_O", ".", "getValorLogico", "(", ")", ")", "{", "return", "ValoresLogicos", ".", "JUGADOR_O", ";", "}", "//Si ganó el jugadorX ", "if", "(", "sumatoriaFilas", ".", "contains", "(", "ValoresLogicos", ".", "LINEA_JUGADOR_X", ".", "getValorLogico", "(", ")", ")", "||", "sumatoriaColumnas", ".", "contains", "(", "ValoresLogicos", ".", "LINEA_JUGADOR_X", ".", "getValorLogico", "(", ")", ")", "||", "sumatoriaDiagonal", "==", "ValoresLogicos", ".", "LINEA_JUGADOR_X", ".", "getValorLogico", "(", ")", "||", "sumatoriaDiagonalInversa", "==", "ValoresLogicos", ".", "LINEA_JUGADOR_X", ".", "getValorLogico", "(", ")", ")", "{", "return", "ValoresLogicos", ".", "JUGADOR_X", ";", "}", "//Hay empate", "if", "(", "sumatoriaTotal", "==", "ValoresLogicos", ".", "EMPATE_INICIANDO_O", ".", "getValorLogico", "(", ")", "||", "sumatoriaTotal", "==", "ValoresLogicos", ".", "EMPATE_INICIANDO_X", ".", "getValorLogico", "(", ")", ")", "{", "return", "ValoresLogicos", ".", "PARTIDA_EMPATADA", ";", "}", "//No hay ganador no hay empate", "return", "ValoresLogicos", ".", "SIN_GANADOR", ";", "}" ]
[ 103, 4 ]
[ 156, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Coche.
null
Actualiza la posición y la velocidad del coche.
Actualiza la posición y la velocidad del coche.
public void update() { float posicion = getX(); float tiempo = Gdx.graphics.getDeltaTime(); velocidad += aceleracion * tiempo; posicion += velocidad * tiempo + 0.5 * aceleracion * (tiempo * tiempo); setX(posicion); }
[ "public", "void", "update", "(", ")", "{", "float", "posicion", "=", "getX", "(", ")", ";", "float", "tiempo", "=", "Gdx", ".", "graphics", ".", "getDeltaTime", "(", ")", ";", "velocidad", "+=", "aceleracion", "*", "tiempo", ";", "posicion", "+=", "velocidad", "*", "tiempo", "+", "0.5", "*", "aceleracion", "*", "(", "tiempo", "*", "tiempo", ")", ";", "setX", "(", "posicion", ")", ";", "}" ]
[ 24, 1 ]
[ 30, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
BaseMockControllerTest.
null
Metodos EstadisticaPersonalEntrenamientoService por defecto
Metodos EstadisticaPersonalEntrenamientoService por defecto
protected void givenEstadisticaPersonalEntrenamientoService(EstadisticaPersonalEntrenamiento estadisticaPersonalEntrenamiento) { given(this.estadisticaPersonalEntrenamientoService.findById(any(Integer.class))) .willReturn(Optional.of(estadisticaPersonalEntrenamiento)); given(this.estadisticaPersonalEntrenamientoService.findByJugador(any(Integer.class))) .willReturn(Lists.newArrayList(estadisticaPersonalEntrenamiento)); given(this.estadisticaPersonalEntrenamientoService.findByEntrenamiento(any(Integer.class))) .willReturn(Lists.newArrayList(estadisticaPersonalEntrenamiento)); given(this.estadisticaPersonalEntrenamientoService.findByJugadorAndEntrenamiento(any(Integer.class),any(Integer.class))) .willReturn(estadisticaPersonalEntrenamiento); }
[ "protected", "void", "givenEstadisticaPersonalEntrenamientoService", "(", "EstadisticaPersonalEntrenamiento", "estadisticaPersonalEntrenamiento", ")", "{", "given", "(", "this", ".", "estadisticaPersonalEntrenamientoService", ".", "findById", "(", "any", "(", "Integer", ".", "class", ")", ")", ")", ".", "willReturn", "(", "Optional", ".", "of", "(", "estadisticaPersonalEntrenamiento", ")", ")", ";", "given", "(", "this", ".", "estadisticaPersonalEntrenamientoService", ".", "findByJugador", "(", "any", "(", "Integer", ".", "class", ")", ")", ")", ".", "willReturn", "(", "Lists", ".", "newArrayList", "(", "estadisticaPersonalEntrenamiento", ")", ")", ";", "given", "(", "this", ".", "estadisticaPersonalEntrenamientoService", ".", "findByEntrenamiento", "(", "any", "(", "Integer", ".", "class", ")", ")", ")", ".", "willReturn", "(", "Lists", ".", "newArrayList", "(", "estadisticaPersonalEntrenamiento", ")", ")", ";", "given", "(", "this", ".", "estadisticaPersonalEntrenamientoService", ".", "findByJugadorAndEntrenamiento", "(", "any", "(", "Integer", ".", "class", ")", ",", "any", "(", "Integer", ".", "class", ")", ")", ")", ".", "willReturn", "(", "estadisticaPersonalEntrenamiento", ")", ";", "}" ]
[ 359, 1 ]
[ 369, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Warrior.
null
Asuma que se lo pasamos en porcentajes (0% - 100%)
Asuma que se lo pasamos en porcentajes (0% - 100%)
public void setGrowthRate(int growthRate) { growthRate /= 100; this.growthRate = growthRate; }
[ "public", "void", "setGrowthRate", "(", "int", "growthRate", ")", "{", "growthRate", "/=", "100", ";", "this", ".", "growthRate", "=", "growthRate", ";", "}" ]
[ 222, 4 ]
[ 225, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
AnswerTests.
null
Debe validar si la fecha está en pasado
Debe validar si la fecha está en pasado
@Test void shouldValidateWhendateIsInThePast() { LocaleContextHolder.setLocale(Locale.ENGLISH); Answer answer = this.generateAnswer(); answer.setDate(LocalDate.of(2018, 3, 17)); Validator validator = this.createValidator(); Set<ConstraintViolation<Answer>> constraintViolations = validator.validate(answer); Assertions.assertThat(constraintViolations.size()).isEqualTo(0); }
[ "@", "Test", "void", "shouldValidateWhendateIsInThePast", "(", ")", "{", "LocaleContextHolder", ".", "setLocale", "(", "Locale", ".", "ENGLISH", ")", ";", "Answer", "answer", "=", "this", ".", "generateAnswer", "(", ")", ";", "answer", ".", "setDate", "(", "LocalDate", ".", "of", "(", "2018", ",", "3", ",", "17", ")", ")", ";", "Validator", "validator", "=", "this", ".", "createValidator", "(", ")", ";", "Set", "<", "ConstraintViolation", "<", "Answer", ">", ">", "constraintViolations", "=", "validator", ".", "validate", "(", "answer", ")", ";", "Assertions", ".", "assertThat", "(", "constraintViolations", ".", "size", "(", ")", ")", ".", "isEqualTo", "(", "0", ")", ";", "}" ]
[ 59, 1 ]
[ 69, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
UsuarioService.
null
/* Select para buscar nuevos amigos en la seccion buscar amigos
/* Select para buscar nuevos amigos en la seccion buscar amigos
public List<Usuario> findNuevosAmigos(Integer idUsu) { ArrayList<Usuario> listaNuevosAm = new ArrayList<Usuario>(); listaNuevosAm = (ArrayList<Usuario>) repository.findNuevosAmigos(idUsu); return listaNuevosAm; }
[ "public", "List", "<", "Usuario", ">", "findNuevosAmigos", "(", "Integer", "idUsu", ")", "{", "ArrayList", "<", "Usuario", ">", "listaNuevosAm", "=", "new", "ArrayList", "<", "Usuario", ">", "(", ")", ";", "listaNuevosAm", "=", "(", "ArrayList", "<", "Usuario", ">", ")", "repository", ".", "findNuevosAmigos", "(", "idUsu", ")", ";", "return", "listaNuevosAm", ";", "}" ]
[ 148, 2 ]
[ 152, 3 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
DatabaseRecordTest.
null
/* Comprobamos el get y set general
/* Comprobamos el get y set general
@Test public void Get_Set_AreEquals_and_NotEquals(){ record3.setValues(record1.getValues()); record2.setUUIDValue("UUID_Column_2", uuid2); assertThat(record1.getValues()).isEqualTo(record3.getValues()); assertThat(record1.getValues()).isNotEqualTo(record2.getValues()); }
[ "@", "Test", "public", "void", "Get_Set_AreEquals_and_NotEquals", "(", ")", "{", "record3", ".", "setValues", "(", "record1", ".", "getValues", "(", ")", ")", ";", "record2", ".", "setUUIDValue", "(", "\"UUID_Column_2\"", ",", "uuid2", ")", ";", "assertThat", "(", "record1", ".", "getValues", "(", ")", ")", ".", "isEqualTo", "(", "record3", ".", "getValues", "(", ")", ")", ";", "assertThat", "(", "record1", ".", "getValues", "(", ")", ")", ".", "isNotEqualTo", "(", "record2", ".", "getValues", "(", ")", ")", ";", "}" ]
[ 157, 2 ]
[ 165, 3 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Application.
null
Rollback de todos los datastores usando la error_handler del datastore pasado por parametro.
Rollback de todos los datastores usando la error_handler del datastore pasado por parametro.
public static void rollbackDataStores(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(); rollback(context, remoteHandle, dataSourceName, dataStore, objName); } }
[ "public", "static", "void", "rollbackDataStores", "(", "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", "(", ")", ";", "rollback", "(", "context", ",", "remoteHandle", ",", "dataSourceName", ",", "dataStore", ",", "objName", ")", ";", "}", "}" ]
[ 616, 1 ]
[ 625, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
BoxPhysicsSystem.
null
Agrega el oyente de destruccion a la lista de oyentes
Agrega el oyente de destruccion a la lista de oyentes
public void register(BoxDestructionListener destructionListener) { destructionListeners.add(destructionListener); }
[ "public", "void", "register", "(", "BoxDestructionListener", "destructionListener", ")", "{", "destructionListeners", ".", "add", "(", "destructionListener", ")", ";", "}" ]
[ 35, 1 ]
[ 37, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Pregunta.
null
Este metodo es solo para los Tests
Este metodo es solo para los Tests
public ArrayList<Opcion> getOpcionesCorrectas(){ return this.listaOpcionesParaPregunta.getOpcionesCorrectas(); }
[ "public", "ArrayList", "<", "Opcion", ">", "getOpcionesCorrectas", "(", ")", "{", "return", "this", ".", "listaOpcionesParaPregunta", ".", "getOpcionesCorrectas", "(", ")", ";", "}" ]
[ 29, 4 ]
[ 31, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
ElectricSystemTest.
null
CP1: Si tenemos una red con un dispositivo, la cantidad de dispositivos de esa red es 1.
CP1: Si tenemos una red con un dispositivo, la cantidad de dispositivos de esa red es 1.
@Test public void Given_A_ElectricSystem_With_One_Device_When_NumberOfDevices_Method_Is_Called_Then_Return_One() { //Given ElectricSystem electricSystem = new ElectricSystem(maximumPowerAllowedStable); electricSystem.addDevice(turnedOffDevice); //Then assertEquals(1, electricSystem.numberOfDevices()); }
[ "@", "Test", "public", "void", "Given_A_ElectricSystem_With_One_Device_When_NumberOfDevices_Method_Is_Called_Then_Return_One", "(", ")", "{", "//Given", "ElectricSystem", "electricSystem", "=", "new", "ElectricSystem", "(", "maximumPowerAllowedStable", ")", ";", "electricSystem", ".", "addDevice", "(", "turnedOffDevice", ")", ";", "//Then", "assertEquals", "(", "1", ",", "electricSystem", ".", "numberOfDevices", "(", ")", ")", ";", "}" ]
[ 46, 4 ]
[ 54, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
AnswerTests.
null
No debe validar si la fecha es null
No debe validar si la fecha es null
@Test void shouldNotValidateWhendateIsNull() { LocaleContextHolder.setLocale(Locale.ENGLISH); Answer answer = this.generateAnswer(); answer.setDate(null); Validator validator = this.createValidator(); Set<ConstraintViolation<Answer>> constraintViolations = validator.validate(answer); Assertions.assertThat(constraintViolations.size()).isEqualTo(1); ConstraintViolation<Answer> violation = constraintViolations.iterator().next(); Assertions.assertThat(violation.getPropertyPath().toString()).isEqualTo("date"); Assertions.assertThat(violation.getMessage()).isEqualTo("must not be null"); }
[ "@", "Test", "void", "shouldNotValidateWhendateIsNull", "(", ")", "{", "LocaleContextHolder", ".", "setLocale", "(", "Locale", ".", "ENGLISH", ")", ";", "Answer", "answer", "=", "this", ".", "generateAnswer", "(", ")", ";", "answer", ".", "setDate", "(", "null", ")", ";", "Validator", "validator", "=", "this", ".", "createValidator", "(", ")", ";", "Set", "<", "ConstraintViolation", "<", "Answer", ">", ">", "constraintViolations", "=", "validator", ".", "validate", "(", "answer", ")", ";", "Assertions", ".", "assertThat", "(", "constraintViolations", ".", "size", "(", ")", ")", ".", "isEqualTo", "(", "1", ")", ";", "ConstraintViolation", "<", "Answer", ">", "violation", "=", "constraintViolations", ".", "iterator", "(", ")", ".", "next", "(", ")", ";", "Assertions", ".", "assertThat", "(", "violation", ".", "getPropertyPath", "(", ")", ".", "toString", "(", ")", ")", ".", "isEqualTo", "(", "\"date\"", ")", ";", "Assertions", ".", "assertThat", "(", "violation", ".", "getMessage", "(", ")", ")", ".", "isEqualTo", "(", "\"must not be null\"", ")", ";", "}" ]
[ 72, 1 ]
[ 86, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
ExpressionEvaluator.
null
Setea las variables y sus valores. El formato es el siguiente: VarName1=Valor1;VarName2=Valor2;....;VarNameN=ValorN
Setea las variables y sus valores. El formato es el siguiente: VarName1=Valor1;VarName2=Valor2;....;VarNameN=ValorN
public void setParms(String varParms) { parms.clear(); Tokenizer tokenizer = new Tokenizer(varParms, ";", false); while(tokenizer.hasMoreTokens()) { String parm = tokenizer.nextToken().trim(); if(parm.equals(""))continue; int index = parm.indexOf('='); if(index == -1 || Character.isDigit(parm.charAt(0))) { throwException(PARAMETER_ERROR, "Parm " + parm + " does not comply with format: 'ParmName=ParmValue'"); }else { try { String parmName = parm.substring(0, index).trim().toLowerCase(); String parmValue = parm.substring(index+1).trim(); if(parmValue.length() > 0 && !Character.isDigit(parmValue.charAt(0))) { if (parms.containsKey( parmValue) ) { parms.put(parmName, parms.get(parmValue)); }else { throwException(PARAMETER_ERROR, "Unknown parameter '" + parmValue + "'"); } continue; } parms.put(parmName, parmValue); }catch(Throwable e) { throwException(PARAMETER_ERROR, "Parm " + parm + " cannot be evaluated: " + e.getMessage()); } } } }
[ "public", "void", "setParms", "(", "String", "varParms", ")", "{", "parms", ".", "clear", "(", ")", ";", "Tokenizer", "tokenizer", "=", "new", "Tokenizer", "(", "varParms", ",", "\";\"", ",", "false", ")", ";", "while", "(", "tokenizer", ".", "hasMoreTokens", "(", ")", ")", "{", "String", "parm", "=", "tokenizer", ".", "nextToken", "(", ")", ".", "trim", "(", ")", ";", "if", "(", "parm", ".", "equals", "(", "\"\"", ")", ")", "continue", ";", "int", "index", "=", "parm", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "index", "==", "-", "1", "||", "Character", ".", "isDigit", "(", "parm", ".", "charAt", "(", "0", ")", ")", ")", "{", "throwException", "(", "PARAMETER_ERROR", ",", "\"Parm \"", "+", "parm", "+", "\" does not comply with format: 'ParmName=ParmValue'\"", ")", ";", "}", "else", "{", "try", "{", "String", "parmName", "=", "parm", ".", "substring", "(", "0", ",", "index", ")", ".", "trim", "(", ")", ".", "toLowerCase", "(", ")", ";", "String", "parmValue", "=", "parm", ".", "substring", "(", "index", "+", "1", ")", ".", "trim", "(", ")", ";", "if", "(", "parmValue", ".", "length", "(", ")", ">", "0", "&&", "!", "Character", ".", "isDigit", "(", "parmValue", ".", "charAt", "(", "0", ")", ")", ")", "{", "if", "(", "parms", ".", "containsKey", "(", "parmValue", ")", ")", "{", "parms", ".", "put", "(", "parmName", ",", "parms", ".", "get", "(", "parmValue", ")", ")", ";", "}", "else", "{", "throwException", "(", "PARAMETER_ERROR", ",", "\"Unknown parameter '\"", "+", "parmValue", "+", "\"'\"", ")", ";", "}", "continue", ";", "}", "parms", ".", "put", "(", "parmName", ",", "parmValue", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "throwException", "(", "PARAMETER_ERROR", ",", "\"Parm \"", "+", "parm", "+", "\" cannot be evaluated: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}", "}", "}" ]
[ 108, 1 ]
[ 144, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
PublicacionService.
null
/*Publicaciones de un usuario
/*Publicaciones de un usuario
public List<Publicacion> findPublicacionesUsuario(Integer idUsu) { ArrayList<Publicacion> publUsuario = new ArrayList<>(); publUsuario = (ArrayList<Publicacion>) repository.findPublicacionesUsuario(idUsu); return publUsuario; }
[ "public", "List", "<", "Publicacion", ">", "findPublicacionesUsuario", "(", "Integer", "idUsu", ")", "{", "ArrayList", "<", "Publicacion", ">", "publUsuario", "=", "new", "ArrayList", "<>", "(", ")", ";", "publUsuario", "=", "(", "ArrayList", "<", "Publicacion", ">", ")", "repository", ".", "findPublicacionesUsuario", "(", "idUsu", ")", ";", "return", "publUsuario", ";", "}" ]
[ 82, 1 ]
[ 87, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
AnimesApiResource.
null
Método que añade una noticia a un anime
Método que añade una noticia a un anime
@POST @Path("/noticia/{idAnime}") @Consumes("application/json") @Produces("application/json") public Response addNoticiaAnime(@Context UriInfo uriInfo, @PathParam("idAnime") String idAnime, Noticia noticia) { if (idAnime == null || idAnime == "") { throw new BadRequestException("La noticia no es válida"); } repository.addNoticiaAnime(idAnime, noticia); ResponseBuilder resp = Response.created(uriInfo.getAbsolutePath()); resp.entity(noticia); return resp.build(); }
[ "@", "POST", "@", "Path", "(", "\"/noticia/{idAnime}\"", ")", "@", "Consumes", "(", "\"application/json\"", ")", "@", "Produces", "(", "\"application/json\"", ")", "public", "Response", "addNoticiaAnime", "(", "@", "Context", "UriInfo", "uriInfo", ",", "@", "PathParam", "(", "\"idAnime\"", ")", "String", "idAnime", ",", "Noticia", "noticia", ")", "{", "if", "(", "idAnime", "==", "null", "||", "idAnime", "==", "\"\"", ")", "{", "throw", "new", "BadRequestException", "(", "\"La noticia no es válida\")", ";", "", "}", "repository", ".", "addNoticiaAnime", "(", "idAnime", ",", "noticia", ")", ";", "ResponseBuilder", "resp", "=", "Response", ".", "created", "(", "uriInfo", ".", "getAbsolutePath", "(", ")", ")", ";", "resp", ".", "entity", "(", "noticia", ")", ";", "return", "resp", ".", "build", "(", ")", ";", "}" ]
[ 126, 1 ]
[ 138, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
AnimesApiResource.
null
Método que devuelve un anime con una determinada id
Método que devuelve un anime con una determinada id
@GET @Path("/{id}") @Produces("application/json") public Anime getAnimeById(@PathParam("id") String id) { Anime anime = repository.getAnimeById(id); if (anime == null) { throw new BadRequestException("El anime solicitado no existe."); } return anime; }
[ "@", "GET", "@", "Path", "(", "\"/{id}\"", ")", "@", "Produces", "(", "\"application/json\"", ")", "public", "Anime", "getAnimeById", "(", "@", "PathParam", "(", "\"id\"", ")", "String", "id", ")", "{", "Anime", "anime", "=", "repository", ".", "getAnimeById", "(", "id", ")", ";", "if", "(", "anime", "==", "null", ")", "{", "throw", "new", "BadRequestException", "(", "\"El anime solicitado no existe.\"", ")", ";", "}", "return", "anime", ";", "}" ]
[ 57, 1 ]
[ 66, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
ControladoraPersistencia.
null
este metodo devuelve una lista con todos los componentes de la tabla usuarios
este metodo devuelve una lista con todos los componentes de la tabla usuarios
public List<Usuario> traerUsuario() { return usuarioJPA.findUsuarioEntities(); }
[ "public", "List", "<", "Usuario", ">", "traerUsuario", "(", ")", "{", "return", "usuarioJPA", ".", "findUsuarioEntities", "(", ")", ";", "}" ]
[ 89, 4 ]
[ 91, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
implUsuario.
null
Este metodo lo utilizamos para sacar los demas datos del usuario
Este metodo lo utilizamos para sacar los demas datos del usuario
public int reporteUsuarioUnico(Usuario u){ int i=0; try { sql=" select * from usuario where usuario_id='"+u.getId()+"' "; stmt=cx.conectaMysql().createStatement(); rset=stmt.executeQuery(sql); if(rset.next()){ u.setNombre(rset.getString(2)); u.setApellido(rset.getString(3)); u.setSexo(rset.getString(4)); u.setEdad(rset.getString(5)); u.setCategoria(rset.getString(6)); u.setNombreUsuario(rset.getString(7)); u.setPasword(rset.getString(8)); u.setDni_ruc(rset.getString(9)); } } catch (SQLException ex) { ex.getMessage(); } return i; }
[ "public", "int", "reporteUsuarioUnico", "(", "Usuario", "u", ")", "{", "int", "i", "=", "0", ";", "try", "{", "sql", "=", "\" select * from usuario where usuario_id='\"", "+", "u", ".", "getId", "(", ")", "+", "\"' \"", ";", "stmt", "=", "cx", ".", "conectaMysql", "(", ")", ".", "createStatement", "(", ")", ";", "rset", "=", "stmt", ".", "executeQuery", "(", "sql", ")", ";", "if", "(", "rset", ".", "next", "(", ")", ")", "{", "u", ".", "setNombre", "(", "rset", ".", "getString", "(", "2", ")", ")", ";", "u", ".", "setApellido", "(", "rset", ".", "getString", "(", "3", ")", ")", ";", "u", ".", "setSexo", "(", "rset", ".", "getString", "(", "4", ")", ")", ";", "u", ".", "setEdad", "(", "rset", ".", "getString", "(", "5", ")", ")", ";", "u", ".", "setCategoria", "(", "rset", ".", "getString", "(", "6", ")", ")", ";", "u", ".", "setNombreUsuario", "(", "rset", ".", "getString", "(", "7", ")", ")", ";", "u", ".", "setPasword", "(", "rset", ".", "getString", "(", "8", ")", ")", ";", "u", ".", "setDni_ruc", "(", "rset", ".", "getString", "(", "9", ")", ")", ";", "}", "}", "catch", "(", "SQLException", "ex", ")", "{", "ex", ".", "getMessage", "(", ")", ";", "}", "return", "i", ";", "}" ]
[ 104, 4 ]
[ 127, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Materia.
null
Calcular el promedio sobre la colección (mutable) de notas
Calcular el promedio sobre la colección (mutable) de notas
public void calcularPromedio(int modo){//Cualquier valor entero indica promedio sobre colección double sumatoria = 0; for (Nota nota : notasColeccion) { sumatoria += nota.getEscala5(); } this.promedio = sumatoria/this.notasColeccion.size(); }
[ "public", "void", "calcularPromedio", "(", "int", "modo", ")", "{", "//Cualquier valor entero indica promedio sobre colección", "double", "sumatoria", "=", "0", ";", "for", "(", "Nota", "nota", ":", "notasColeccion", ")", "{", "sumatoria", "+=", "nota", ".", "getEscala5", "(", ")", ";", "}", "this", ".", "promedio", "=", "sumatoria", "/", "this", ".", "notasColeccion", ".", "size", "(", ")", ";", "}" ]
[ 190, 4 ]
[ 196, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Rectangulo.
null
Creamos el metodo que va a realizar la operacion
Creamos el metodo que va a realizar la operacion
public void Formula(){ r = b*a; }
[ "public", "void", "Formula", "(", ")", "{", "r", "=", "b", "*", "a", ";", "}" ]
[ 14, 4 ]
[ 16, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
VideosApiResource.
null
Método que devuelve todos los vídeos de la id de un determinado anime
Método que devuelve todos los vídeos de la id de un determinado anime
@GET @Path("/idAnime") @Produces("application/json") public Collection<Video> getAllVideosById(@QueryParam("id") String idAnime) { Collection<Video> res = repository.getAnimeVideosById(idAnime); if (res == null) { throw new NotFoundException("No se encuentra ningún vídeo."); } return res; }
[ "@", "GET", "@", "Path", "(", "\"/idAnime\"", ")", "@", "Produces", "(", "\"application/json\"", ")", "public", "Collection", "<", "Video", ">", "getAllVideosById", "(", "@", "QueryParam", "(", "\"id\"", ")", "String", "idAnime", ")", "{", "Collection", "<", "Video", ">", "res", "=", "repository", ".", "getAnimeVideosById", "(", "idAnime", ")", ";", "if", "(", "res", "==", "null", ")", "{", "throw", "new", "NotFoundException", "(", "\"No se encuentra ningún vídeo.\");", "", "", "}", "return", "res", ";", "}" ]
[ 42, 1 ]
[ 51, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
ControladoraPersistencia.
null
metodo para crear tipo de habitaciones
metodo para crear tipo de habitaciones
public void crearTipoHabitacion(TipoHabitacion tipoh) { try { tipoHabitacionJPA.create(tipoh); } catch (Exception ex) { Logger.getLogger(ControladoraPersistencia.class.getName()).log(Level.SEVERE, null, ex); } }
[ "public", "void", "crearTipoHabitacion", "(", "TipoHabitacion", "tipoh", ")", "{", "try", "{", "tipoHabitacionJPA", ".", "create", "(", "tipoh", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "Logger", ".", "getLogger", "(", "ControladoraPersistencia", ".", "class", ".", "getName", "(", ")", ")", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "ex", ")", ";", "}", "}" ]
[ 72, 4 ]
[ 78, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
ServModificarEmpleado.
null
recoge el id del empleado para enviarlo al jsp del formualario
recoge el id del empleado para enviarlo al jsp del formualario
@Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); ControladoraHotel control = new ControladoraHotel(); //trae parametros y la convierto al tipo correspondiente int id_empleado = Integer.parseInt(request.getParameter("id_empleado")); //traigo al huesped/objeto buscado Empleado empleado = control.traerEmpleadoPorID(id_empleado); //traemos la sesion con la que estamos trabajando HttpSession misesion = request.getSession(); //a la sesion le agregamos el atributo misesion.setAttribute("empleado", empleado); //luego redirije desde este servlet hacia el JSP que tiene el formulario para editar al empleado response.sendRedirect("form-modificar-empleado.jsp"); }
[ "@", "Override", "protected", "void", "doPost", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "ServletException", ",", "IOException", "{", "processRequest", "(", "request", ",", "response", ")", ";", "ControladoraHotel", "control", "=", "new", "ControladoraHotel", "(", ")", ";", "//trae parametros y la convierto al tipo correspondiente", "int", "id_empleado", "=", "Integer", ".", "parseInt", "(", "request", ".", "getParameter", "(", "\"id_empleado\"", ")", ")", ";", "//traigo al huesped/objeto buscado", "Empleado", "empleado", "=", "control", ".", "traerEmpleadoPorID", "(", "id_empleado", ")", ";", "//traemos la sesion con la que estamos trabajando", "HttpSession", "misesion", "=", "request", ".", "getSession", "(", ")", ";", "//a la sesion le agregamos el atributo", "misesion", ".", "setAttribute", "(", "\"empleado\"", ",", "empleado", ")", ";", "//luego redirije desde este servlet hacia el JSP que tiene el formulario para editar al empleado", "response", ".", "sendRedirect", "(", "\"form-modificar-empleado.jsp\"", ")", ";", "}" ]
[ 76, 4 ]
[ 98, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
CommentService.
null
Listar todos los comentarios del id de post
Listar todos los comentarios del id de post
public List<Comment> listComments(Long news_id) { return commentRepository.findByNewsId_id(news_id); }
[ "public", "List", "<", "Comment", ">", "listComments", "(", "Long", "news_id", ")", "{", "return", "commentRepository", ".", "findByNewsId_id", "(", "news_id", ")", ";", "}" ]
[ 23, 4 ]
[ 25, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Registro.
null
Método EliminarReservaciones por posición
Método EliminarReservaciones por posición
public Reservacion EliminarReservaciones(int Posicion) { return RegistroReservaciones.remove(Posicion); }
[ "public", "Reservacion", "EliminarReservaciones", "(", "int", "Posicion", ")", "{", "return", "RegistroReservaciones", ".", "remove", "(", "Posicion", ")", ";", "}" ]
[ 171, 4 ]
[ 174, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
GameWindow.
null
play al sonido del barbaro, no vamos a necesitar ningun otro
play al sonido del barbaro, no vamos a necesitar ningun otro
public static void playSound(){ if(sound)return; sound = true; new Timer().schedule(new TimerTask() { @Override public void run() { sound = false; } }, 3000); try (AudioInputStream inputStream = AudioSystem.getAudioInputStream( new File("src/main/java/com/game/audio/barbarian_hit_stuff.wav"))){ Clip clip = AudioSystem.getClip(); clip.open(inputStream); FloatControl gainControl = (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN); gainControl.setValue(-30.0f); clip.start(); } catch (Exception e) { System.err.println(e.getMessage()); } }
[ "public", "static", "void", "playSound", "(", ")", "{", "if", "(", "sound", ")", "return", ";", "sound", "=", "true", ";", "new", "Timer", "(", ")", ".", "schedule", "(", "new", "TimerTask", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "sound", "=", "false", ";", "}", "}", ",", "3000", ")", ";", "try", "(", "AudioInputStream", "inputStream", "=", "AudioSystem", ".", "getAudioInputStream", "(", "new", "File", "(", "\"src/main/java/com/game/audio/barbarian_hit_stuff.wav\"", ")", ")", ")", "{", "Clip", "clip", "=", "AudioSystem", ".", "getClip", "(", ")", ";", "clip", ".", "open", "(", "inputStream", ")", ";", "FloatControl", "gainControl", "=", "(", "FloatControl", ")", "clip", ".", "getControl", "(", "FloatControl", ".", "Type", ".", "MASTER_GAIN", ")", ";", "gainControl", ".", "setValue", "(", "-", "30.0f", ")", ";", "clip", ".", "start", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "err", ".", "println", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}" ]
[ 124, 4 ]
[ 145, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
AnswerTests.
null
Debe validar si la description está dentro del rango, es 3, es 200
Debe validar si la description está dentro del rango, es 3, es 200
@ParameterizedTest @NullSource @ValueSource(strings = { "Esto es un texto",// "Est",// "Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Es" }) void shouldValidateDescription(final String text) { LocaleContextHolder.setLocale(Locale.ENGLISH); Answer answer = this.generateAnswer(); answer.setDescription(text); Validator validator = this.createValidator(); Set<ConstraintViolation<Answer>> constraintViolations = validator.validate(answer); Assertions.assertThat(constraintViolations.size()).isEqualTo(0); }
[ "@", "ParameterizedTest", "@", "NullSource", "@", "ValueSource", "(", "strings", "=", "{", "\"Esto es un texto\"", ",", "//", "\"Est\"", ",", "//", "\"Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Esto es un texto, Es\"", "}", ")", "void", "shouldValidateDescription", "(", "final", "String", "text", ")", "{", "LocaleContextHolder", ".", "setLocale", "(", "Locale", ".", "ENGLISH", ")", ";", "Answer", "answer", "=", "this", ".", "generateAnswer", "(", ")", ";", "answer", ".", "setDescription", "(", "text", ")", ";", "Validator", "validator", "=", "this", ".", "createValidator", "(", ")", ";", "Set", "<", "ConstraintViolation", "<", "Answer", ">", ">", "constraintViolations", "=", "validator", ".", "validate", "(", "answer", ")", ";", "Assertions", ".", "assertThat", "(", "constraintViolations", ".", "size", "(", ")", ")", ".", "isEqualTo", "(", "0", ")", ";", "}" ]
[ 91, 1 ]
[ 107, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
CrudProducto.
null
Mostrar todos los productos de la lista
Mostrar todos los productos de la lista
public void imprimirTodosLosProductos () { for(int i=0; i<lista.length;i++) { System.out.println((i+1)+". "+lista[i]); } }
[ "public", "void", "imprimirTodosLosProductos", "(", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "lista", ".", "length", ";", "i", "++", ")", "{", "System", ".", "out", ".", "println", "(", "(", "i", "+", "1", ")", "+", "\". \"", "+", "lista", "[", "i", "]", ")", ";", "}", "}" ]
[ 137, 1 ]
[ 141, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
CropOverlayView.
null
Metodo de View para capturar los eventos en el touch
Metodo de View para capturar los eventos en el touch
@Override public boolean onTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_UP: getParent().requestDisallowInterceptTouchEvent(false); break; case MotionEvent.ACTION_DOWN: getParent().requestDisallowInterceptTouchEvent(false); onActionDown(event); return true; case MotionEvent.ACTION_MOVE: getParent().requestDisallowInterceptTouchEvent(true); onActionMove(event); return true; } return false; }
[ "@", "Override", "public", "boolean", "onTouchEvent", "(", "MotionEvent", "event", ")", "{", "switch", "(", "event", ".", "getAction", "(", ")", ")", "{", "case", "MotionEvent", ".", "ACTION_UP", ":", "getParent", "(", ")", ".", "requestDisallowInterceptTouchEvent", "(", "false", ")", ";", "break", ";", "case", "MotionEvent", ".", "ACTION_DOWN", ":", "getParent", "(", ")", ".", "requestDisallowInterceptTouchEvent", "(", "false", ")", ";", "onActionDown", "(", "event", ")", ";", "return", "true", ";", "case", "MotionEvent", ".", "ACTION_MOVE", ":", "getParent", "(", ")", ".", "requestDisallowInterceptTouchEvent", "(", "true", ")", ";", "onActionMove", "(", "event", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}" ]
[ 231, 4 ]
[ 247, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
PanelClientes.
null
Forma iterativa se puede mejorar generando un metodo en el DAO que te devuela la lista en cuestión.
Forma iterativa se puede mejorar generando un metodo en el DAO que te devuela la lista en cuestión.
public void setTablaVentas(ArrayList<Venta> misVentas, ArrayList<Usuario> misUsuarios, String dniClienteSeleccionado) { String[] columnas = {"ID Venta", "DNI Vendedor", "Nombre Vendedor", "Monto vendido"}; ArrayList<Venta> misVentasSeleccionadas = new ArrayList<>(); // Recorre todas las ventas y selecciona las que coinciden con dniClienteSeleccionado for (int i = 0; i < misVentas.size(); i++) { if (misVentas.get(i).getDniCliente().equals(dniClienteSeleccionado)) { misVentasSeleccionadas.add(misVentas.get(i)); } } // Setea la tabla con las ventas seleccionadas Object[][] miData = new Object[misVentasSeleccionadas.size()][4]; for (int i = 0; i < misVentasSeleccionadas.size(); i++) { miData[i][0] = misVentasSeleccionadas.get(i).getIdVenta(); miData[i][1] = misVentasSeleccionadas.get(i).getDniUsuario(); miData[i][3] = misVentasSeleccionadas.get(i).getMonto(); for (int j = 0; j < misUsuarios.size(); j++) { if (misUsuarios.get(j).getDniUsuario().equals(misVentasSeleccionadas.get(i).getDniUsuario())) { miData[i][2] = misUsuarios.get(j).getNombre(); } } } DefaultTableModel miDefaultTableModel = new DefaultTableModel(miData, columnas); tblVenta.setModel(miDefaultTableModel); }
[ "public", "void", "setTablaVentas", "(", "ArrayList", "<", "Venta", ">", "misVentas", ",", "ArrayList", "<", "Usuario", ">", "misUsuarios", ",", "String", "dniClienteSeleccionado", ")", "{", "String", "[", "]", "columnas", "=", "{", "\"ID Venta\"", ",", "\"DNI Vendedor\"", ",", "\"Nombre Vendedor\"", ",", "\"Monto vendido\"", "}", ";", "ArrayList", "<", "Venta", ">", "misVentasSeleccionadas", "=", "new", "ArrayList", "<>", "(", ")", ";", "// Recorre todas las ventas y selecciona las que coinciden con dniClienteSeleccionado", "for", "(", "int", "i", "=", "0", ";", "i", "<", "misVentas", ".", "size", "(", ")", ";", "i", "++", ")", "{", "if", "(", "misVentas", ".", "get", "(", "i", ")", ".", "getDniCliente", "(", ")", ".", "equals", "(", "dniClienteSeleccionado", ")", ")", "{", "misVentasSeleccionadas", ".", "add", "(", "misVentas", ".", "get", "(", "i", ")", ")", ";", "}", "}", "// Setea la tabla con las ventas seleccionadas", "Object", "[", "]", "[", "]", "miData", "=", "new", "Object", "[", "misVentasSeleccionadas", ".", "size", "(", ")", "]", "[", "4", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "misVentasSeleccionadas", ".", "size", "(", ")", ";", "i", "++", ")", "{", "miData", "[", "i", "]", "[", "0", "]", "=", "misVentasSeleccionadas", ".", "get", "(", "i", ")", ".", "getIdVenta", "(", ")", ";", "miData", "[", "i", "]", "[", "1", "]", "=", "misVentasSeleccionadas", ".", "get", "(", "i", ")", ".", "getDniUsuario", "(", ")", ";", "miData", "[", "i", "]", "[", "3", "]", "=", "misVentasSeleccionadas", ".", "get", "(", "i", ")", ".", "getMonto", "(", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "misUsuarios", ".", "size", "(", ")", ";", "j", "++", ")", "{", "if", "(", "misUsuarios", ".", "get", "(", "j", ")", ".", "getDniUsuario", "(", ")", ".", "equals", "(", "misVentasSeleccionadas", ".", "get", "(", "i", ")", ".", "getDniUsuario", "(", ")", ")", ")", "{", "miData", "[", "i", "]", "[", "2", "]", "=", "misUsuarios", ".", "get", "(", "j", ")", ".", "getNombre", "(", ")", ";", "}", "}", "}", "DefaultTableModel", "miDefaultTableModel", "=", "new", "DefaultTableModel", "(", "miData", ",", "columnas", ")", ";", "tblVenta", ".", "setModel", "(", "miDefaultTableModel", ")", ";", "}" ]
[ 220, 4 ]
[ 244, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
CriticalDeviceTest.
null
CP1: Cuando enviamos una petición de apagado, el dispositivo critico NO DEBE apagarse.
CP1: Cuando enviamos una petición de apagado, el dispositivo critico NO DEBE apagarse.
@Test public void Given_A_TurnedOn_Device_When_TurnOffRequest_Method_Is_Called_Then_The_Critical_Device_Isnt_TurnOff(){ //Given device.turnOn(); //When device.turnOffRequest(); //Then assertTrue(device.getTurnedOn()); }
[ "@", "Test", "public", "void", "Given_A_TurnedOn_Device_When_TurnOffRequest_Method_Is_Called_Then_The_Critical_Device_Isnt_TurnOff", "(", ")", "{", "//Given", "device", ".", "turnOn", "(", ")", ";", "//When", "device", ".", "turnOffRequest", "(", ")", ";", "//Then", "assertTrue", "(", "device", ".", "getTurnedOn", "(", ")", ")", ";", "}" ]
[ 20, 4 ]
[ 30, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
AnimesApiResource.
null
Método que elimina una imagen de un anime
Método que elimina una imagen de un anime
@DELETE @Path("/imagen/{idAnime}/{idImagen}") @Consumes("application/json") public Response deleteImagenAnime(@PathParam("idAnime") String idAnime, @PathParam("idImagen") String idImagen) { if (idImagen == null) { throw new NotFoundException("La imagen no fue encontrada"); } else { repository.deleteImagenAnime(idAnime, idImagen); } return Response.noContent().build(); }
[ "@", "DELETE", "@", "Path", "(", "\"/imagen/{idAnime}/{idImagen}\"", ")", "@", "Consumes", "(", "\"application/json\"", ")", "public", "Response", "deleteImagenAnime", "(", "@", "PathParam", "(", "\"idAnime\"", ")", "String", "idAnime", ",", "@", "PathParam", "(", "\"idImagen\"", ")", "String", "idImagen", ")", "{", "if", "(", "idImagen", "==", "null", ")", "{", "throw", "new", "NotFoundException", "(", "\"La imagen no fue encontrada\"", ")", ";", "}", "else", "{", "repository", ".", "deleteImagenAnime", "(", "idAnime", ",", "idImagen", ")", ";", "}", "return", "Response", ".", "noContent", "(", ")", ".", "build", "(", ")", ";", "}" ]
[ 200, 1 ]
[ 211, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Properties.
null
Devuelve el valor (que puede ser nulo) para la clave especificada, o nulo si la clave no esta en el mapa
Devuelve el valor (que puede ser nulo) para la clave especificada, o nulo si la clave no esta en el mapa
public int getInt(String key) { return (int) properties.get(key); }
[ "public", "int", "getInt", "(", "String", "key", ")", "{", "return", "(", "int", ")", "properties", ".", "get", "(", "key", ")", ";", "}" ]
[ 31, 1 ]
[ 33, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
GXWebObjectBase.
null
Este metodo es redefinido por la clase GX generada cuando hay submits
Este metodo es redefinido por la clase GX generada cuando hay submits
public void submit(int id, Object [] submitParms, ModelContext ctx){ }
[ "public", "void", "submit", "(", "int", "id", ",", "Object", "[", "]", "submitParms", ",", "ModelContext", "ctx", ")", "{", "}" ]
[ 351, 1 ]
[ 352, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Jugador.
null
Realizar la jugada con base en la casilla elegida
Realizar la jugada con base en la casilla elegida
public void realizarJugada(Casilla casillaElegida, Tablero tablero){ //Obtenemos la información de la casilla elegida int filaCasilla = casillaElegida.getFila(); int columnaCasilla = casillaElegida.getColumna(); //El jugador actualiza el tablero tablero.casillas[filaCasilla][columnaCasilla].aplicarJugada(this.movimientoLogico, this.movimientoConsola); }
[ "public", "void", "realizarJugada", "(", "Casilla", "casillaElegida", ",", "Tablero", "tablero", ")", "{", "//Obtenemos la información de la casilla elegida", "int", "filaCasilla", "=", "casillaElegida", ".", "getFila", "(", ")", ";", "int", "columnaCasilla", "=", "casillaElegida", ".", "getColumna", "(", ")", ";", "//El jugador actualiza el tablero", "tablero", ".", "casillas", "[", "filaCasilla", "]", "[", "columnaCasilla", "]", ".", "aplicarJugada", "(", "this", ".", "movimientoLogico", ",", "this", ".", "movimientoConsola", ")", ";", "}" ]
[ 41, 4 ]
[ 47, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
LibMatrixCuMatMult.
null
Usage: y = swap(x, x=y);
Usage: y = swap(x, x=y);
private static long swap(long x, long y) { return x; }
[ "private", "static", "long", "swap", "(", "long", "x", ",", "long", "y", ")", "{", "return", "x", ";", "}" ]
[ 384, 1 ]
[ 386, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
GamewebApplicationTests.
null
esto es un push de prueba
esto es un push de prueba
@Test void contextLoads() { }
[ "@", "Test", "void", "contextLoads", "(", ")", "{", "}" ]
[ 8, 1 ]
[ 10, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
LiderDao.
null
Consultar todos los líderes
Consultar todos los líderes
public ArrayList<Lider> consultarTodos() throws SQLException { //Preparo contenedor de la respuesta ArrayList<Lider> respuesta = new ArrayList<Lider>(); //Preparo contenero de la conexión Connection conexion = null; try{ //Crear la conexión conexion = JDBCUtilities.getConnection(); //Crear objeto a partir de la consulta SQL PreparedStatement statement = conexion.prepareStatement("SELECT * FROM Lider;"); //Ejecutar la consulta y almacenar la respuesta en estructura de datos //tipo ResultSet (iterador) ResultSet resultSet = statement.executeQuery(); //Recorrer estilo iterador la estructura de datos que aloja los registros //Se detiene cuando siguiente retorna falso! while(resultSet.next()){ Lider lider = new Lider(); lider.setIdLider(resultSet.getInt("ID_Lider")); lider.setNombre(resultSet.getString("Nombre")); lider.setPrimerApellido(resultSet.getString("Primer_Apellido")); lider.setSegundoApellido(resultSet.getString("Segundo_Apellido")); lider.setSalario(resultSet.getInt("Salario")); lider.setClasificacion(resultSet.getDouble("Clasificacion")); respuesta.add(lider); } resultSet.close(); statement.close(); }catch(SQLException e){ System.err.println("Error consultando todos los líderes: "+e); }finally{ //Siempre debo cerrar la conexión con la base de datos si se logró if(conexion != null){ conexion.close(); } } //Retornar respuesta obtenida tras interactuar con la base de datos return respuesta; }
[ "public", "ArrayList", "<", "Lider", ">", "consultarTodos", "(", ")", "throws", "SQLException", "{", "//Preparo contenedor de la respuesta", "ArrayList", "<", "Lider", ">", "respuesta", "=", "new", "ArrayList", "<", "Lider", ">", "(", ")", ";", "//Preparo contenero de la conexión", "Connection", "conexion", "=", "null", ";", "try", "{", "//Crear la conexión", "conexion", "=", "JDBCUtilities", ".", "getConnection", "(", ")", ";", "//Crear objeto a partir de la consulta SQL", "PreparedStatement", "statement", "=", "conexion", ".", "prepareStatement", "(", "\"SELECT * FROM Lider;\"", ")", ";", "//Ejecutar la consulta y almacenar la respuesta en estructura de datos", "//tipo ResultSet (iterador)", "ResultSet", "resultSet", "=", "statement", ".", "executeQuery", "(", ")", ";", "//Recorrer estilo iterador la estructura de datos que aloja los registros", "//Se detiene cuando siguiente retorna falso!", "while", "(", "resultSet", ".", "next", "(", ")", ")", "{", "Lider", "lider", "=", "new", "Lider", "(", ")", ";", "lider", ".", "setIdLider", "(", "resultSet", ".", "getInt", "(", "\"ID_Lider\"", ")", ")", ";", "lider", ".", "setNombre", "(", "resultSet", ".", "getString", "(", "\"Nombre\"", ")", ")", ";", "lider", ".", "setPrimerApellido", "(", "resultSet", ".", "getString", "(", "\"Primer_Apellido\"", ")", ")", ";", "lider", ".", "setSegundoApellido", "(", "resultSet", ".", "getString", "(", "\"Segundo_Apellido\"", ")", ")", ";", "lider", ".", "setSalario", "(", "resultSet", ".", "getInt", "(", "\"Salario\"", ")", ")", ";", "lider", ".", "setClasificacion", "(", "resultSet", ".", "getDouble", "(", "\"Clasificacion\"", ")", ")", ";", "respuesta", ".", "add", "(", "lider", ")", ";", "}", "resultSet", ".", "close", "(", ")", ";", "statement", ".", "close", "(", ")", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"Error consultando todos los líderes: \"+", "e", ")", ";", "", "}", "finally", "{", "//Siempre debo cerrar la conexión con la base de datos si se logró", "if", "(", "conexion", "!=", "null", ")", "{", "conexion", ".", "close", "(", ")", ";", "}", "}", "//Retornar respuesta obtenida tras interactuar con la base de datos", "return", "respuesta", ";", "}" ]
[ 15, 4 ]
[ 58, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
PeliculasDOM.
null
Leer la información del documento y mostrarla por pantalla
Leer la información del documento y mostrarla por pantalla
private void leerDocumento() { //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 el = (Element) nl.item(i); //obtenemos el objeto película Pelicula p = getPelicula(el); //añadimos la película a la lista misPeliculas.add(p); } } }
[ "private", "void", "leerDocumento", "(", ")", "{", "//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", "el", "=", "(", "Element", ")", "nl", ".", "item", "(", "i", ")", ";", "//obtenemos el objeto película", "Pelicula", "p", "=", "getPelicula", "(", "el", ")", ";", "//añadimos la película a la lista", "misPeliculas", ".", "add", "(", "p", ")", ";", "}", "}", "}" ]
[ 111, 4 ]
[ 130, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
BOWImgDescriptorExtractor.
null
javadoc: BOWImgDescriptorExtractor::compute(image, keypoints, imgDescriptor)
javadoc: BOWImgDescriptorExtractor::compute(image, keypoints, imgDescriptor)
public void compute(Mat image, MatOfKeyPoint keypoints, Mat imgDescriptor) { Mat keypoints_mat = keypoints; compute_0(nativeObj, image.nativeObj, keypoints_mat.nativeObj, imgDescriptor.nativeObj); return; }
[ "public", "void", "compute", "(", "Mat", "image", ",", "MatOfKeyPoint", "keypoints", ",", "Mat", "imgDescriptor", ")", "{", "Mat", "keypoints_mat", "=", "keypoints", ";", "compute_0", "(", "nativeObj", ",", "image", ".", "nativeObj", ",", "keypoints_mat", ".", "nativeObj", ",", "imgDescriptor", ".", "nativeObj", ")", ";", "return", ";", "}" ]
[ 78, 4 ]
[ 84, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
CrudLimpieza.
null
Método para ordenar la lista por orden alfabético con Stream
Método para ordenar la lista por orden alfabético con Stream
public void ordenarAlfStream () { stockLimpieza=stockLimpieza .stream() .parallel() .sorted( (n1, n2)-> n1.getNombre().compareToIgnoreCase(n2.getNombre())) .collect(Collectors.toList()); }
[ "public", "void", "ordenarAlfStream", "(", ")", "{", "stockLimpieza", "=", "stockLimpieza", ".", "stream", "(", ")", ".", "parallel", "(", ")", ".", "sorted", "(", "(", "n1", ",", "n2", ")", "->", "n1", ".", "getNombre", "(", ")", ".", "compareToIgnoreCase", "(", "n2", ".", "getNombre", "(", ")", ")", ")", ".", "collect", "(", "Collectors", ".", "toList", "(", ")", ")", ";", "}" ]
[ 164, 1 ]
[ 170, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
CrearCuenta.
null
Método para cuando se enfoca en CampoApellidoPaterno
Método para cuando se enfoca en CampoApellidoPaterno
private void CampoApellidoPaternoFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_CampoApellidoPaternoFocusGained // Obtiene contenido de campo String Contenido = this.CampoApellidoPaterno.getText(); // Obtiene color de campo Color ColorActual = this.CampoApellidoPaterno.getForeground(); // Color cuando no se ha escrito nada Color ColorNoEscrito = new Color(102, 102, 102); // Color cuando se va a escribir algo Color ColorEscribir = new Color(51, 51, 51); // Verifica contenido y color de campo son los predeterminados if(Contenido.equals("Apellido Paterno") && (ColorActual == ColorNoEscrito)) { // Limpiamos contenido this.CampoApellidoPaterno.setText(""); this.CampoApellidoPaterno.setForeground(ColorEscribir); } else { this.CampoApellidoPaterno.setForeground(ColorEscribir); } }
[ "private", "void", "CampoApellidoPaternoFocusGained", "(", "java", ".", "awt", ".", "event", ".", "FocusEvent", "evt", ")", "{", "//GEN-FIRST:event_CampoApellidoPaternoFocusGained", "// Obtiene contenido de campo", "String", "Contenido", "=", "this", ".", "CampoApellidoPaterno", ".", "getText", "(", ")", ";", "// Obtiene color de campo", "Color", "ColorActual", "=", "this", ".", "CampoApellidoPaterno", ".", "getForeground", "(", ")", ";", "// Color cuando no se ha escrito nada", "Color", "ColorNoEscrito", "=", "new", "Color", "(", "102", ",", "102", ",", "102", ")", ";", "// Color cuando se va a escribir algo", "Color", "ColorEscribir", "=", "new", "Color", "(", "51", ",", "51", ",", "51", ")", ";", "// Verifica contenido y color de campo son los predeterminados", "if", "(", "Contenido", ".", "equals", "(", "\"Apellido Paterno\"", ")", "&&", "(", "ColorActual", "==", "ColorNoEscrito", ")", ")", "{", "// Limpiamos contenido", "this", ".", "CampoApellidoPaterno", ".", "setText", "(", "\"\"", ")", ";", "this", ".", "CampoApellidoPaterno", ".", "setForeground", "(", "ColorEscribir", ")", ";", "}", "else", "{", "this", ".", "CampoApellidoPaterno", ".", "setForeground", "(", "ColorEscribir", ")", ";", "}", "}" ]
[ 978, 4 ]
[ 999, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
JwtUtil.
null
Método para crear el JWT y enviarlo al cliente en el header de la respuesta
Método para crear el JWT y enviarlo al cliente en el header de la respuesta
static void addAuthentication(HttpServletResponse res, String username) { String token = Jwts.builder() .setSubject(username) // Vamos a asignar un tiempo de expiracion de 1 minuto // solo con fines demostrativos en el video que hay al final .setExpiration(new Date(System.currentTimeMillis() + 6000000)) // Hash con el que firmaremos la clave .signWith(SignatureAlgorithm.HS512, "P@tit0") .compact(); //agregamos al encabezado el token res.addHeader("Authorization", "Bearer " + token); }
[ "static", "void", "addAuthentication", "(", "HttpServletResponse", "res", ",", "String", "username", ")", "{", "String", "token", "=", "Jwts", ".", "builder", "(", ")", ".", "setSubject", "(", "username", ")", "// Vamos a asignar un tiempo de expiracion de 1 minuto", "// solo con fines demostrativos en el video que hay al final", ".", "setExpiration", "(", "new", "Date", "(", "System", ".", "currentTimeMillis", "(", ")", "+", "6000000", ")", ")", "// Hash con el que firmaremos la clave", ".", "signWith", "(", "SignatureAlgorithm", ".", "HS512", ",", "\"P@tit0\"", ")", ".", "compact", "(", ")", ";", "//agregamos al encabezado el token", "res", ".", "addHeader", "(", "\"Authorization\"", ",", "\"Bearer \"", "+", "token", ")", ";", "}" ]
[ 27, 4 ]
[ 42, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
CriticalDeviceMinimumConsumptionTest.
null
CP7: Cuando hacemos una solicitud de apagado a un dispositivo encendido, el consumo actual debe ser el consumo minimo de dicho dispositivo.
CP7: Cuando hacemos una solicitud de apagado a un dispositivo encendido, el consumo actual debe ser el consumo minimo de dicho dispositivo.
@Test public void Given_A_TurnedOn_Device_When_TurnOffRequest_Method_Is_Called_Then_Current_Consumption_Is_Now_Minimun_Consumption(){ //Given Integer expectedCurrentConsumption = this.minimunConsumption; device.turnOn(); //When device.turnOffRequest(); Integer result = device.getCurrentConsumption(); //Then assertEquals(expectedCurrentConsumption,result); }
[ "@", "Test", "public", "void", "Given_A_TurnedOn_Device_When_TurnOffRequest_Method_Is_Called_Then_Current_Consumption_Is_Now_Minimun_Consumption", "(", ")", "{", "//Given", "Integer", "expectedCurrentConsumption", "=", "this", ".", "minimunConsumption", ";", "device", ".", "turnOn", "(", ")", ";", "//When", "device", ".", "turnOffRequest", "(", ")", ";", "Integer", "result", "=", "device", ".", "getCurrentConsumption", "(", ")", ";", "//Then", "assertEquals", "(", "expectedCurrentConsumption", ",", "result", ")", ";", "}" ]
[ 99, 4 ]
[ 111, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
RestClient.
null
Todo --> Hay que añadir otro este método
Todo --> Hay que añadir otro este método
public List<JsonNode> query(String ontology, String query, SSAPQueryType queryType) throws SSAPConnectionException { if (!isConnected()) throw new SSAPConnectionException(NULL_CLIENT); HttpUrl url = null; Request request = null; Response response = null; final TypeFactory typeFactory = mapper.getTypeFactory(); try { final String usedSessionKey = new String(sessionKey); final String processedQuery = URLEncoder.encode(query, UTF_8); if (processedQuery.length() < MAX_LENGTH_BYTES) { url = new HttpUrl.Builder().scheme(HttpUrl.parse(restServer).scheme()) .host(HttpUrl.parse(restServer).host()).port(HttpUrl.parse(restServer).port()) .addPathSegment(HttpUrl.parse(restServer).pathSegments().get(0)) .addEncodedPathSegments(LIST_GET).addPathSegment(ontology) .addEncodedQueryParameter(QUERY_STR, processedQuery) .addQueryParameter("queryType", SSAPQueryType.valueOf(queryType.name()).name()).build(); request = new Request.Builder().url(url).addHeader(CORRELATION_ID_HEADER_NAME, logId()) .addHeader(AUTHORIZATION_STR, usedSessionKey).get().build(); } else { url = new HttpUrl.Builder().scheme(HttpUrl.parse(restServer).scheme()) .host(HttpUrl.parse(restServer).host()).port(HttpUrl.parse(restServer).port()) .addPathSegment(HttpUrl.parse(restServer).pathSegments().get(0)) .addEncodedPathSegments(LIST_GET).addPathSegment(ontology).addEncodedPathSegments(QUERY_STR) .addQueryParameter("queryType", SSAPQueryType.valueOf(queryType.name()).name()).build(); final RequestBody formBody = new FormBody.Builder().add(QUERY_STR, query).build(); request = new Request.Builder().url(url).addHeader(CORRELATION_ID_HEADER_NAME, logId()) .addHeader(AUTHORIZATION_STR, usedSessionKey).post(formBody).build(); } response = client.newCall(request).execute(); if (!response.isSuccessful()) { if (response.code() == 401) {// Expired sessionkey log.info(SESSIONKEY_EXP); try { lockRenewSession.lock(); if (sessionKey.equals(usedSessionKey)) { createConnection(token, deviceTemplate, device); } } catch (final Exception e) { log.error(REGENERATING_ERROR, e); } finally { lockRenewSession.unlock(); } return query(ontology, query, queryType); } log.error(QUERY_ERROR + response.body().string()); throw new SSAPConnectionException(QUERY_ERROR + response.body().string()); } final String instancesAsText = response.body().string(); // instancesAsText = instancesAsText.replaceAll("\\\\\\\"", "\"").replace("\"{", // "{").replace("}\"", "}"); List<JsonNode> instances = new ArrayList<>(); instances = mapper.readValue(instancesAsText, typeFactory.constructCollectionType(List.class, JsonNode.class)); return instances; } catch (final SSAPConnectionException e) { throw e; } catch (final Exception e) { log.error("Error in get instances: {}", e); throw new SSAPConnectionException("query: Error in get instances: {}", e); } }
[ "public", "List", "<", "JsonNode", ">", "query", "(", "String", "ontology", ",", "String", "query", ",", "SSAPQueryType", "queryType", ")", "throws", "SSAPConnectionException", "{", "if", "(", "!", "isConnected", "(", ")", ")", "throw", "new", "SSAPConnectionException", "(", "NULL_CLIENT", ")", ";", "HttpUrl", "url", "=", "null", ";", "Request", "request", "=", "null", ";", "Response", "response", "=", "null", ";", "final", "TypeFactory", "typeFactory", "=", "mapper", ".", "getTypeFactory", "(", ")", ";", "try", "{", "final", "String", "usedSessionKey", "=", "new", "String", "(", "sessionKey", ")", ";", "final", "String", "processedQuery", "=", "URLEncoder", ".", "encode", "(", "query", ",", "UTF_8", ")", ";", "if", "(", "processedQuery", ".", "length", "(", ")", "<", "MAX_LENGTH_BYTES", ")", "{", "url", "=", "new", "HttpUrl", ".", "Builder", "(", ")", ".", "scheme", "(", "HttpUrl", ".", "parse", "(", "restServer", ")", ".", "scheme", "(", ")", ")", ".", "host", "(", "HttpUrl", ".", "parse", "(", "restServer", ")", ".", "host", "(", ")", ")", ".", "port", "(", "HttpUrl", ".", "parse", "(", "restServer", ")", ".", "port", "(", ")", ")", ".", "addPathSegment", "(", "HttpUrl", ".", "parse", "(", "restServer", ")", ".", "pathSegments", "(", ")", ".", "get", "(", "0", ")", ")", ".", "addEncodedPathSegments", "(", "LIST_GET", ")", ".", "addPathSegment", "(", "ontology", ")", ".", "addEncodedQueryParameter", "(", "QUERY_STR", ",", "processedQuery", ")", ".", "addQueryParameter", "(", "\"queryType\"", ",", "SSAPQueryType", ".", "valueOf", "(", "queryType", ".", "name", "(", ")", ")", ".", "name", "(", ")", ")", ".", "build", "(", ")", ";", "request", "=", "new", "Request", ".", "Builder", "(", ")", ".", "url", "(", "url", ")", ".", "addHeader", "(", "CORRELATION_ID_HEADER_NAME", ",", "logId", "(", ")", ")", ".", "addHeader", "(", "AUTHORIZATION_STR", ",", "usedSessionKey", ")", ".", "get", "(", ")", ".", "build", "(", ")", ";", "}", "else", "{", "url", "=", "new", "HttpUrl", ".", "Builder", "(", ")", ".", "scheme", "(", "HttpUrl", ".", "parse", "(", "restServer", ")", ".", "scheme", "(", ")", ")", ".", "host", "(", "HttpUrl", ".", "parse", "(", "restServer", ")", ".", "host", "(", ")", ")", ".", "port", "(", "HttpUrl", ".", "parse", "(", "restServer", ")", ".", "port", "(", ")", ")", ".", "addPathSegment", "(", "HttpUrl", ".", "parse", "(", "restServer", ")", ".", "pathSegments", "(", ")", ".", "get", "(", "0", ")", ")", ".", "addEncodedPathSegments", "(", "LIST_GET", ")", ".", "addPathSegment", "(", "ontology", ")", ".", "addEncodedPathSegments", "(", "QUERY_STR", ")", ".", "addQueryParameter", "(", "\"queryType\"", ",", "SSAPQueryType", ".", "valueOf", "(", "queryType", ".", "name", "(", ")", ")", ".", "name", "(", ")", ")", ".", "build", "(", ")", ";", "final", "RequestBody", "formBody", "=", "new", "FormBody", ".", "Builder", "(", ")", ".", "add", "(", "QUERY_STR", ",", "query", ")", ".", "build", "(", ")", ";", "request", "=", "new", "Request", ".", "Builder", "(", ")", ".", "url", "(", "url", ")", ".", "addHeader", "(", "CORRELATION_ID_HEADER_NAME", ",", "logId", "(", ")", ")", ".", "addHeader", "(", "AUTHORIZATION_STR", ",", "usedSessionKey", ")", ".", "post", "(", "formBody", ")", ".", "build", "(", ")", ";", "}", "response", "=", "client", ".", "newCall", "(", "request", ")", ".", "execute", "(", ")", ";", "if", "(", "!", "response", ".", "isSuccessful", "(", ")", ")", "{", "if", "(", "response", ".", "code", "(", ")", "==", "401", ")", "{", "// Expired sessionkey", "log", ".", "info", "(", "SESSIONKEY_EXP", ")", ";", "try", "{", "lockRenewSession", ".", "lock", "(", ")", ";", "if", "(", "sessionKey", ".", "equals", "(", "usedSessionKey", ")", ")", "{", "createConnection", "(", "token", ",", "deviceTemplate", ",", "device", ")", ";", "}", "}", "catch", "(", "final", "Exception", "e", ")", "{", "log", ".", "error", "(", "REGENERATING_ERROR", ",", "e", ")", ";", "}", "finally", "{", "lockRenewSession", ".", "unlock", "(", ")", ";", "}", "return", "query", "(", "ontology", ",", "query", ",", "queryType", ")", ";", "}", "log", ".", "error", "(", "QUERY_ERROR", "+", "response", ".", "body", "(", ")", ".", "string", "(", ")", ")", ";", "throw", "new", "SSAPConnectionException", "(", "QUERY_ERROR", "+", "response", ".", "body", "(", ")", ".", "string", "(", ")", ")", ";", "}", "final", "String", "instancesAsText", "=", "response", ".", "body", "(", ")", ".", "string", "(", ")", ";", "// instancesAsText = instancesAsText.replaceAll(\"\\\\\\\\\\\\\\\"\", \"\\\"\").replace(\"\\\"{\",", "// \"{\").replace(\"}\\\"\", \"}\");", "List", "<", "JsonNode", ">", "instances", "=", "new", "ArrayList", "<>", "(", ")", ";", "instances", "=", "mapper", ".", "readValue", "(", "instancesAsText", ",", "typeFactory", ".", "constructCollectionType", "(", "List", ".", "class", ",", "JsonNode", ".", "class", ")", ")", ";", "return", "instances", ";", "}", "catch", "(", "final", "SSAPConnectionException", "e", ")", "{", "throw", "e", ";", "}", "catch", "(", "final", "Exception", "e", ")", "{", "log", ".", "error", "(", "\"Error in get instances: {}\"", ",", "e", ")", ";", "throw", "new", "SSAPConnectionException", "(", "\"query: Error in get instances: {}\"", ",", "e", ")", ";", "}", "}" ]
[ 300, 1 ]
[ 366, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
ControladoraHotel.
null
devuelve una lista de reservas de un huesped desde su dia de ingreso dentro de un determinado rango de fechas desde-hasta
devuelve una lista de reservas de un huesped desde su dia de ingreso dentro de un determinado rango de fechas desde-hasta
public List<Reserva> traerReservaHuespedPorFecha(Date fecha_desde, Date fecha_hasta, List<Reserva> lista_reserva) { List<Reserva> lista_filtrada = new ArrayList<Reserva>(); for (Reserva res : lista_reserva) { if (res.getFecha_egreso().compareTo(fecha_desde) >= 0 && res.getFecha_ingreso().compareTo(fecha_hasta) <= 0) { lista_filtrada.add(res); } } return lista_filtrada; }
[ "public", "List", "<", "Reserva", ">", "traerReservaHuespedPorFecha", "(", "Date", "fecha_desde", ",", "Date", "fecha_hasta", ",", "List", "<", "Reserva", ">", "lista_reserva", ")", "{", "List", "<", "Reserva", ">", "lista_filtrada", "=", "new", "ArrayList", "<", "Reserva", ">", "(", ")", ";", "for", "(", "Reserva", "res", ":", "lista_reserva", ")", "{", "if", "(", "res", ".", "getFecha_egreso", "(", ")", ".", "compareTo", "(", "fecha_desde", ")", ">=", "0", "&&", "res", ".", "getFecha_ingreso", "(", ")", ".", "compareTo", "(", "fecha_hasta", ")", "<=", "0", ")", "{", "lista_filtrada", ".", "add", "(", "res", ")", ";", "}", "}", "return", "lista_filtrada", ";", "}" ]
[ 247, 4 ]
[ 259, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Secretaria.
null
aspecto que deberíamos hacer como buena práctica
aspecto que deberíamos hacer como buena práctica
public void agregarAlum(Alumno alum) { listAlumnos.add(alum); }
[ "public", "void", "agregarAlum", "(", "Alumno", "alum", ")", "{", "listAlumnos", ".", "add", "(", "alum", ")", ";", "}" ]
[ 38, 1 ]
[ 40, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Nota.
null
2b)Métodos que definen el comportamiento particular de la nota
2b)Métodos que definen el comportamiento particular de la nota
public void mostrarNota(){ System.out.println("---InfoNota----"); System.out.println("Nombre -> "+this.nombre); System.out.println("Escala100 -> "+this.escala100); System.out.println("Escala5 -> "+this.escala5); System.out.println("Cualitativo -> "+this.cualitativo); System.out.println("Codigo -> "+this.codigo); }
[ "public", "void", "mostrarNota", "(", ")", "{", "System", ".", "out", ".", "println", "(", "\"---InfoNota----\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"Nombre -> \"", "+", "this", ".", "nombre", ")", ";", "System", ".", "out", ".", "println", "(", "\"Escala100 -> \"", "+", "this", ".", "escala100", ")", ";", "System", ".", "out", ".", "println", "(", "\"Escala5 -> \"", "+", "this", ".", "escala5", ")", ";", "System", ".", "out", ".", "println", "(", "\"Cualitativo -> \"", "+", "this", ".", "cualitativo", ")", ";", "System", ".", "out", ".", "println", "(", "\"Codigo -> \"", "+", "this", ".", "codigo", ")", ";", "}" ]
[ 119, 4 ]
[ 126, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
GXutil.
null
hay que empezar a achicarlo si no entra en el espacio indicado.
hay que empezar a achicarlo si no entra en el espacio indicado.
public static String str(int[] value, int length, int decimals) { return str(value[0], length, decimals); }
[ "public", "static", "String", "str", "(", "int", "[", "]", "value", ",", "int", "length", ",", "int", "decimals", ")", "{", "return", "str", "(", "value", "[", "0", "]", ",", "length", ",", "decimals", ")", ";", "}" ]
[ 459, 1 ]
[ 462, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
SumaMain.
null
/* En esta seccion solamente vendra el codigo para pedirle los datos al usuario
/* En esta seccion solamente vendra el codigo para pedirle los datos al usuario
public static void main(String[] args) { // Creamos nuevo objeto Scanner entrada = new Scanner(System.in); System.out.println("Dame el primer valor: "); // declaramos el valor uno int valor1 = entrada.nextInt(); // declaramos el valor dos System.out.println("Dame el primer valor: "); int valor2 = entrada.nextInt(); // Creamos un objeto de tipo suma para poder comunicar nuestras variables con Suma Suma valores = new Suma(valor1,valor2); // mandamos a llamar al metodo imprimir valores.Imprimir(); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "// Creamos nuevo objeto", "Scanner", "entrada", "=", "new", "Scanner", "(", "System", ".", "in", ")", ";", "System", ".", "out", ".", "println", "(", "\"Dame el primer valor: \"", ")", ";", "// declaramos el valor uno", "int", "valor1", "=", "entrada", ".", "nextInt", "(", ")", ";", "// declaramos el valor dos", "System", ".", "out", ".", "println", "(", "\"Dame el primer valor: \"", ")", ";", "int", "valor2", "=", "entrada", ".", "nextInt", "(", ")", ";", "// Creamos un objeto de tipo suma para poder comunicar nuestras variables con Suma", "Suma", "valores", "=", "new", "Suma", "(", "valor1", ",", "valor2", ")", ";", "// mandamos a llamar al metodo imprimir", "valores", ".", "Imprimir", "(", ")", ";", "}" ]
[ 8, 3 ]
[ 31, 4 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
ImagenesApiResource.
null
Método que devuelve todas las imágenes del nombre de un determinado anime
Método que devuelve todas las imágenes del nombre de un determinado anime
@GET @Path("/titleAnime") @Produces("application/json") public Collection<Imagen> getAllImagenesByTitle(@QueryParam("title") String title) { Collection<Imagen> res = repository.getAnimeImagenesByName(title); if (res == null) { throw new NotFoundException("No se encuentra ninguna imagen."); } return res; }
[ "@", "GET", "@", "Path", "(", "\"/titleAnime\"", ")", "@", "Produces", "(", "\"application/json\"", ")", "public", "Collection", "<", "Imagen", ">", "getAllImagenesByTitle", "(", "@", "QueryParam", "(", "\"title\"", ")", "String", "title", ")", "{", "Collection", "<", "Imagen", ">", "res", "=", "repository", ".", "getAnimeImagenesByName", "(", "title", ")", ";", "if", "(", "res", "==", "null", ")", "{", "throw", "new", "NotFoundException", "(", "\"No se encuentra ninguna imagen.\"", ")", ";", "}", "return", "res", ";", "}" ]
[ 55, 1 ]
[ 64, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
VideosService.
null
/* buscar videos de un usuario
/* buscar videos de un usuario
public List<Videos> findVideosUsuario(Integer idUsu) { return repository.findVideosUsuario(idUsu); }
[ "public", "List", "<", "Videos", ">", "findVideosUsuario", "(", "Integer", "idUsu", ")", "{", "return", "repository", ".", "findVideosUsuario", "(", "idUsu", ")", ";", "}" ]
[ 65, 1 ]
[ 67, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
ControladoraHotel.
null
devuelve una lista de reservas filtrada por fechas. Se le debe indicar un rango de inicio a fin de la duracion de la reserva
devuelve una lista de reservas filtrada por fechas. Se le debe indicar un rango de inicio a fin de la duracion de la reserva
public List<Reserva> traerReservaPorFecha(Date fecha_ingreso, Date fecha_egreso) { List<Reserva> lista_reserva = traerReserva(); List<Reserva> lista_filtrada = new ArrayList<Reserva>(); int cont = 0; for (Reserva res : lista_reserva) { cont++; if (hayInterseccionFechas(fecha_ingreso, fecha_egreso, res.getFecha_ingreso(), res.getFecha_egreso())) { lista_filtrada.add(res); } } return lista_filtrada; }
[ "public", "List", "<", "Reserva", ">", "traerReservaPorFecha", "(", "Date", "fecha_ingreso", ",", "Date", "fecha_egreso", ")", "{", "List", "<", "Reserva", ">", "lista_reserva", "=", "traerReserva", "(", ")", ";", "List", "<", "Reserva", ">", "lista_filtrada", "=", "new", "ArrayList", "<", "Reserva", ">", "(", ")", ";", "int", "cont", "=", "0", ";", "for", "(", "Reserva", "res", ":", "lista_reserva", ")", "{", "cont", "++", ";", "if", "(", "hayInterseccionFechas", "(", "fecha_ingreso", ",", "fecha_egreso", ",", "res", ".", "getFecha_ingreso", "(", ")", ",", "res", ".", "getFecha_egreso", "(", ")", ")", ")", "{", "lista_filtrada", ".", "add", "(", "res", ")", ";", "}", "}", "return", "lista_filtrada", ";", "}" ]
[ 206, 4 ]
[ 223, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
CrearCuenta.
null
Método para cuando se presiona CampoNombre con el mouse
Método para cuando se presiona CampoNombre con el mouse
private void CampoNombreMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_CampoNombreMousePressed // Obtener contenido String Contenido = this.CampoNombre.getText(); Color ColorActual = this.CampoNombre.getForeground(); Color ColorEscrito = new Color(51, 51, 51); // Verifica si no tiene nada seteado aún if(Contenido.equals("Nombre(s)")) { // Elimina contenido this.CampoNombre.setText(""); } if(ColorActual != ColorEscrito) { this.CampoNombre.setForeground(ColorEscrito); } }
[ "private", "void", "CampoNombreMousePressed", "(", "java", ".", "awt", ".", "event", ".", "MouseEvent", "evt", ")", "{", "//GEN-FIRST:event_CampoNombreMousePressed", "// Obtener contenido", "String", "Contenido", "=", "this", ".", "CampoNombre", ".", "getText", "(", ")", ";", "Color", "ColorActual", "=", "this", ".", "CampoNombre", ".", "getForeground", "(", ")", ";", "Color", "ColorEscrito", "=", "new", "Color", "(", "51", ",", "51", ",", "51", ")", ";", "// Verifica si no tiene nada seteado aún", "if", "(", "Contenido", ".", "equals", "(", "\"Nombre(s)\"", ")", ")", "{", "// Elimina contenido", "this", ".", "CampoNombre", ".", "setText", "(", "\"\"", ")", ";", "}", "if", "(", "ColorActual", "!=", "ColorEscrito", ")", "{", "this", ".", "CampoNombre", ".", "setForeground", "(", "ColorEscrito", ")", ";", "}", "}" ]
[ 894, 4 ]
[ 909, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
KaldiActivity.
null
Si se presiona atrás de nuevo se cierra la app
Si se presiona atrás de nuevo se cierra la app
@Override public void onBackPressed() { if (this.lastBackPressTime < System.currentTimeMillis() - 8000) { toast = Toast.makeText(this, "Tescucho es una app desarrollada por ingenieros del CISTAS UNTREF. Universidad Nacional de Tres de Febrero. Presione nuevamente \" atrás \" para salir.", Toast.LENGTH_LONG); toast.show(); this.lastBackPressTime = System.currentTimeMillis(); } else { if (toast != null) { toast.cancel(); } super.onBackPressed(); } }
[ "@", "Override", "public", "void", "onBackPressed", "(", ")", "{", "if", "(", "this", ".", "lastBackPressTime", "<", "System", ".", "currentTimeMillis", "(", ")", "-", "8000", ")", "{", "toast", "=", "Toast", ".", "makeText", "(", "this", ",", "\"Tescucho es una app desarrollada por ingenieros del CISTAS UNTREF. Universidad Nacional de Tres de Febrero. Presione nuevamente \\\" atrás \\\" para salir.\",", " ", "oast.", "L", "ENGTH_LONG)", ";", "", "toast", ".", "show", "(", ")", ";", "this", ".", "lastBackPressTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "}", "else", "{", "if", "(", "toast", "!=", "null", ")", "{", "toast", ".", "cancel", "(", ")", ";", "}", "super", ".", "onBackPressed", "(", ")", ";", "}", "}" ]
[ 581, 4 ]
[ 593, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Bullet.
null
cuando el bullet impacta
cuando el bullet impacta
public void impact(){ if(impacting) return; // si ya esta impactando entonces no hacemos nada if(!alive) handlerGameObjects.removeObject(this); // nos eliminamos if(!impacting && !alive) return; target.hit(damage); // hacemos el dano damagePosition = new Rectangle2D.Double(getX(), getY(), 10, 10); // para que se dibuje el dano en la posicion que impactamo impacting = true; alive = false; new Timer().schedule(new TimerTask() { @Override public void run() { impacting = false; } }, 500); // programamos que muera en 3s }
[ "public", "void", "impact", "(", ")", "{", "if", "(", "impacting", ")", "return", ";", "// si ya esta impactando entonces no hacemos nada", "if", "(", "!", "alive", ")", "handlerGameObjects", ".", "removeObject", "(", "this", ")", ";", "// nos eliminamos", "if", "(", "!", "impacting", "&&", "!", "alive", ")", "return", ";", "target", ".", "hit", "(", "damage", ")", ";", "// hacemos el dano", "damagePosition", "=", "new", "Rectangle2D", ".", "Double", "(", "getX", "(", ")", ",", "getY", "(", ")", ",", "10", ",", "10", ")", ";", "// para que se dibuje el dano en la posicion que impactamo", "impacting", "=", "true", ";", "alive", "=", "false", ";", "new", "Timer", "(", ")", ".", "schedule", "(", "new", "TimerTask", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{", "impacting", "=", "false", ";", "}", "}", ",", "500", ")", ";", "// programamos que muera en 3s", "}" ]
[ 112, 4 ]
[ 129, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Agenda.
null
modifica el telefono propietario
modifica el telefono propietario
public void setTelefonoPropietario(String telefonoPropietario) { this.telefonoPropietario = telefonoPropietario; }
[ "public", "void", "setTelefonoPropietario", "(", "String", "telefonoPropietario", ")", "{", "this", ".", "telefonoPropietario", "=", "telefonoPropietario", ";", "}" ]
[ 105, 1 ]
[ 107, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
CrearCuenta.
null
Método para cuando se enfoca en CampoTelefono
Método para cuando se enfoca en CampoTelefono
private void CampoTelefonoFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_CampoTelefonoFocusGained // Obtiene contenido de campo String Contenido = this.CampoTelefono.getText(); // Obtiene color de campo Color ColorActual = this.CampoTelefono.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("Teléfono") && (ColorActual == ColorNoEscrito)) { // Limpiamos contenido this.CampoTelefono.setText(""); this.CampoTelefono.setForeground(ColorEscribir); } else { this.CampoTelefono.setForeground(ColorEscribir); } }
[ "private", "void", "CampoTelefonoFocusGained", "(", "java", ".", "awt", ".", "event", ".", "FocusEvent", "evt", ")", "{", "//GEN-FIRST:event_CampoTelefonoFocusGained", "// Obtiene contenido de campo", "String", "Contenido", "=", "this", ".", "CampoTelefono", ".", "getText", "(", ")", ";", "// Obtiene color de campo", "Color", "ColorActual", "=", "this", ".", "CampoTelefono", ".", "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", "(", "\"Teléfono\")", " ", "& ", "(", "ColorActual", "==", "ColorNoEscrito", ")", ")", "{", "// Limpiamos contenido", "this", ".", "CampoTelefono", ".", "setText", "(", "\"\"", ")", ";", "this", ".", "CampoTelefono", ".", "setForeground", "(", "ColorEscribir", ")", ";", "}", "else", "{", "this", ".", "CampoTelefono", ".", "setForeground", "(", "ColorEscribir", ")", ";", "}", "}" ]
[ 1176, 4 ]
[ 1197, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
CrudLimpieza.
null
Busca un producto por nombre de forma clásica (primera coincidencia)
Busca un producto por nombre de forma clásica (primera coincidencia)
public int buscarProducto(String nombre) { int temp = -1; boolean salir = false; for (int i = 0; i < stockLimpieza.size() && !salir; i++) { if (stockLimpieza.get(i).getNombre().equalsIgnoreCase(nombre)) { temp = i; salir = true; } } return temp; }
[ "public", "int", "buscarProducto", "(", "String", "nombre", ")", "{", "int", "temp", "=", "-", "1", ";", "boolean", "salir", "=", "false", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "stockLimpieza", ".", "size", "(", ")", "&&", "!", "salir", ";", "i", "++", ")", "{", "if", "(", "stockLimpieza", ".", "get", "(", "i", ")", ".", "getNombre", "(", ")", ".", "equalsIgnoreCase", "(", "nombre", ")", ")", "{", "temp", "=", "i", ";", "salir", "=", "true", ";", "}", "}", "return", "temp", ";", "}" ]
[ 48, 1 ]
[ 60, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
ClaseBBDD.
null
Obtenemos información sobre la BBDD con la que estamos trabajando
Obtenemos información sobre la BBDD con la que estamos trabajando
public String getBBDD() throws SQLException { Connection connect = conexion(); DatabaseMetaData meta = connect.getMetaData(); String dbInfo = "Versión del producto: " + meta.getDatabaseProductVersion() + "\n" + "Versión del driver: " + meta.getDriverVersion() + "\n" + "Nombre del producto: " + meta.getDatabaseProductName() + "\n"; connect.close(); return dbInfo; }
[ "public", "String", "getBBDD", "(", ")", "throws", "SQLException", "{", "Connection", "connect", "=", "conexion", "(", ")", ";", "DatabaseMetaData", "meta", "=", "connect", ".", "getMetaData", "(", ")", ";", "String", "dbInfo", "=", "\"Versión del producto: \" ", " ", "eta.", "g", "etDatabaseProductVersion(", ")", " ", " ", "\\n\"\r", "+", "\"Versión del driver: \" ", " ", "eta.", "g", "etDriverVersion(", ")", " ", " ", "\\n\"\r", "+", "\"Nombre del producto: \"", "+", "meta", ".", "getDatabaseProductName", "(", ")", "+", "\"\\n\"", ";", "connect", ".", "close", "(", ")", ";", "return", "dbInfo", ";", "}" ]
[ 34, 3 ]
[ 46, 4 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Registro.
null
Método EliminarHabitaciones por posición
Método EliminarHabitaciones por posición
public Habitacion EliminarHabitaciones(int Posicion) { return RegistroHabitaciones.remove(Posicion); }
[ "public", "Habitacion", "EliminarHabitaciones", "(", "int", "Posicion", ")", "{", "return", "RegistroHabitaciones", ".", "remove", "(", "Posicion", ")", ";", "}" ]
[ 159, 4 ]
[ 162, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
AnimesApiResource.
null
Método que actualiza una imagen de un anime
Método que actualiza una imagen de un anime
@PUT @Path("/imagen/{idAnime}") @Consumes("application/json") public Response updateImagenAnime(@PathParam("idAnime") String idAnime, Imagen imagen) { Imagen oldImagen = repository.getImagenById(imagen.getId()); if (oldImagen == null) { throw new NotFoundException("La imagen no fue encontrada"); } else { repository.updateImagenAnime(idAnime, imagen); } return Response.noContent().build(); }
[ "@", "PUT", "@", "Path", "(", "\"/imagen/{idAnime}\"", ")", "@", "Consumes", "(", "\"application/json\"", ")", "public", "Response", "updateImagenAnime", "(", "@", "PathParam", "(", "\"idAnime\"", ")", "String", "idAnime", ",", "Imagen", "imagen", ")", "{", "Imagen", "oldImagen", "=", "repository", ".", "getImagenById", "(", "imagen", ".", "getId", "(", ")", ")", ";", "if", "(", "oldImagen", "==", "null", ")", "{", "throw", "new", "NotFoundException", "(", "\"La imagen no fue encontrada\"", ")", ";", "}", "else", "{", "repository", ".", "updateImagenAnime", "(", "idAnime", ",", "imagen", ")", ";", "}", "return", "Response", ".", "noContent", "(", ")", ".", "build", "(", ")", ";", "}" ]
[ 185, 1 ]
[ 197, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Jndi.
null
Crear usuario con ./add-user.sh y dependencias
Crear usuario con ./add-user.sh y dependencias
public static void main(String[] args) throws Exception { // Usuario y password para conectarse al servidor JNDI String usuario = "guest"; String contrasena = "guest"; // Propiedades para crear el contexto: clase factoría, url del servidor JNDI y credenciales Properties env = new Properties(); env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"); env.put(Context.PROVIDER_URL, "http-remoting://localhost:8080"); env.put(Context.SECURITY_PRINCIPAL, usuario); env.put(Context.SECURITY_CREDENTIALS, contrasena); // El objeto InitialContext permite obtener la referencias de los objetos registrado en el // ábol JNDI InitialContext ic = new InitialContext(env); // Obtener un objeto del registro que previanmente el administrador JNDI ha registrado Object connectionFactory = ic.lookup("jms/RemoteConnectionFactory"); // Terminar liberando los recursos ic.close(); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "Exception", "{", "// Usuario y password para conectarse al servidor JNDI", "String", "usuario", "=", "\"guest\"", ";", "String", "contrasena", "=", "\"guest\"", ";", "// Propiedades para crear el contexto: clase factoría, url del servidor JNDI y credenciales", "Properties", "env", "=", "new", "Properties", "(", ")", ";", "env", ".", "put", "(", "Context", ".", "INITIAL_CONTEXT_FACTORY", ",", "\"org.jboss.naming.remote.client.InitialContextFactory\"", ")", ";", "env", ".", "put", "(", "Context", ".", "PROVIDER_URL", ",", "\"http-remoting://localhost:8080\"", ")", ";", "env", ".", "put", "(", "Context", ".", "SECURITY_PRINCIPAL", ",", "usuario", ")", ";", "env", ".", "put", "(", "Context", ".", "SECURITY_CREDENTIALS", ",", "contrasena", ")", ";", "// El objeto InitialContext permite obtener la referencias de los objetos registrado en el", "// ábol JNDI", "InitialContext", "ic", "=", "new", "InitialContext", "(", "env", ")", ";", "// Obtener un objeto del registro que previanmente el administrador JNDI ha registrado", "Object", "connectionFactory", "=", "ic", ".", "lookup", "(", "\"jms/RemoteConnectionFactory\"", ")", ";", "// Terminar liberando los recursos", "ic", ".", "close", "(", ")", ";", "}" ]
[ 13, 1 ]
[ 34, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Salario.
null
metodo calcula salario si trabaja <= 40 horas
metodo calcula salario si trabaja <= 40 horas
public double calcularSalario(double horas) { double precio = 16; double salario; salario = precio * horas; return salario; }
[ "public", "double", "calcularSalario", "(", "double", "horas", ")", "{", "double", "precio", "=", "16", ";", "double", "salario", ";", "salario", "=", "precio", "*", "horas", ";", "return", "salario", ";", "}" ]
[ 35, 1 ]
[ 45, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
CrearCuenta.
null
Método para cuando se presiona CampoContrasena con el mouse
Método para cuando se presiona CampoContrasena con el mouse
private void CampoContrasenaMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_CampoContrasenaMousePressed // Obtener contenido String Contenido = this.CampoContrasena.getText(); Color ColorActual = this.CampoContrasena.getForeground(); Color ColorEscrito = new Color(51, 51, 51); // Verifica si no tiene nada seteado aún if(Contenido.equals("Contraseña")) { // Elimina contenido this.CampoContrasena.setText(""); } if(ColorActual != ColorEscrito) { this.CampoContrasena.setForeground(ColorEscrito); } }
[ "private", "void", "CampoContrasenaMousePressed", "(", "java", ".", "awt", ".", "event", ".", "MouseEvent", "evt", ")", "{", "//GEN-FIRST:event_CampoContrasenaMousePressed", "// Obtener contenido", "String", "Contenido", "=", "this", ".", "CampoContrasena", ".", "getText", "(", ")", ";", "Color", "ColorActual", "=", "this", ".", "CampoContrasena", ".", "getForeground", "(", ")", ";", "Color", "ColorEscrito", "=", "new", "Color", "(", "51", ",", "51", ",", "51", ")", ";", "// Verifica si no tiene nada seteado aún", "if", "(", "Contenido", ".", "equals", "(", "\"Contraseña\")", ")", "", "{", "// Elimina contenido", "this", ".", "CampoContrasena", ".", "setText", "(", "\"\"", ")", ";", "}", "if", "(", "ColorActual", "!=", "ColorEscrito", ")", "{", "this", ".", "CampoContrasena", ".", "setForeground", "(", "ColorEscrito", ")", ";", "}", "}" ]
[ 810, 4 ]
[ 825, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
JDBCUtilities.
null
Construir conexión con la base de datos
Construir conexión con la base de datos
public static Connection getConnection() throws SQLException { String url = "jdbc:sqlite:" + JDBCUtilities.UBICACION_BD; return DriverManager.getConnection(url); }
[ "public", "static", "Connection", "getConnection", "(", ")", "throws", "SQLException", "{", "String", "url", "=", "\"jdbc:sqlite:\"", "+", "JDBCUtilities", ".", "UBICACION_BD", ";", "return", "DriverManager", ".", "getConnection", "(", "url", ")", ";", "}" ]
[ 17, 4 ]
[ 20, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
GXResultSet.
null
-- Funciones que deberian ser llamadas desde los programas generados
-- Funciones que deberian ser llamadas desde los programas generados
public boolean next() throws SQLException { resultRegBytes = 0; if (DEBUG) { log(GXDBDebug.LOG_MAX, "next"); try { return result.next(); } catch (SQLException sqlException) { if (con.isLogEnabled()) con.logSQLException(handle, sqlException); throw sqlException; } } else { return result.next(); } }
[ "public", "boolean", "next", "(", ")", "throws", "SQLException", "{", "resultRegBytes", "=", "0", ";", "if", "(", "DEBUG", ")", "{", "log", "(", "GXDBDebug", ".", "LOG_MAX", ",", "\"next\"", ")", ";", "try", "{", "return", "result", ".", "next", "(", ")", ";", "}", "catch", "(", "SQLException", "sqlException", ")", "{", "if", "(", "con", ".", "isLogEnabled", "(", ")", ")", "con", ".", "logSQLException", "(", "handle", ",", "sqlException", ")", ";", "throw", "sqlException", ";", "}", "}", "else", "{", "return", "result", ".", "next", "(", ")", ";", "}", "}" ]
[ 78, 1 ]
[ 99, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
JDBCUtilities.
null
Método para proveer conexión
Método para proveer conexión
public static Connection getConnection() throws SQLException { String url = "jdbc:sqlite:" + JDBCUtilities.UBICACION_BD; return DriverManager.getConnection(url); }
[ "public", "static", "Connection", "getConnection", "(", ")", "throws", "SQLException", "{", "String", "url", "=", "\"jdbc:sqlite:\"", "+", "JDBCUtilities", ".", "UBICACION_BD", ";", "return", "DriverManager", ".", "getConnection", "(", "url", ")", ";", "}" ]
[ 16, 4 ]
[ 19, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
GXSmartCacheProvider.
null
Marca una tabla como modificada. Se utiliza desde los pgms generados luego de una actulizacion sobre la tabla
Marca una tabla como modificada. Se utiliza desde los pgms generados luego de una actulizacion sobre la tabla
public void setUpdated(String table) { provider.setUpdated(table, handle); }
[ "public", "void", "setUpdated", "(", "String", "table", ")", "{", "provider", ".", "setUpdated", "(", "table", ",", "handle", ")", ";", "}" ]
[ 24, 1 ]
[ 27, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Ventana.
null
metodos para iniciar y detener el thread principal
metodos para iniciar y detener el thread principal
private void start() { // creamos un nuevo hilo para implemetnar la clase de la interfaz hilo = new Thread(this); hilo.start(); corriendo = true; }
[ "private", "void", "start", "(", ")", "{", "// creamos un nuevo hilo para implemetnar la clase de la interfaz", "hilo", "=", "new", "Thread", "(", "this", ")", ";", "hilo", ".", "start", "(", ")", ";", "corriendo", "=", "true", ";", "}" ]
[ 112, 4 ]
[ 121, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
WebServiceConfig.
null
Primero inicia con el XSD: Schema XML
Primero inicia con el XSD: Schema XML
@Bean public XsdSchema countriesSchema(){ return new SimpleXsdSchema( new ClassPathResource("META-INF/schemas/hr.xsd")); }
[ "@", "Bean", "public", "XsdSchema", "countriesSchema", "(", ")", "{", "return", "new", "SimpleXsdSchema", "(", "new", "ClassPathResource", "(", "\"META-INF/schemas/hr.xsd\"", ")", ")", ";", "}" ]
[ 56, 1 ]
[ 60, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Dados.
null
Devuelve la cantidad de dados que hay
Devuelve la cantidad de dados que hay
public int cantidadDados(){ return conjuntoDados.size(); }
[ "public", "int", "cantidadDados", "(", ")", "{", "return", "conjuntoDados", ".", "size", "(", ")", ";", "}" ]
[ 24, 4 ]
[ 26, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Gestor.
null
Metodo para rellenar los valores
Metodo para rellenar los valores
public Password rellenar(int i) { Password p = null; if (i == 1) { String c = JOptionPane.showInputDialog(null, "Introduce la contraseña", "Introduciendo contraseña", 1); p = new Password(c); if (p.esFuerte()) { JOptionPane.showMessageDialog(null, "La contraseña es Fuerte:\n " + p, "Contraseña Agregada Fuerte", 1); } else { JOptionPane.showMessageDialog(null, "Contraseña Debil: \n" + p, "Contraseña Introducida Debil", 2); } } else { boolean bandera = false; do { int n = Integer.parseInt(JOptionPane.showInputDialog(null, "Introduce la longitud de la contraseña a generar", "Introduciendo longitud", 1)); if (n > 0 && n != 0) { bandera=true; p = new Password(n); if (p.esFuerte()) { JOptionPane.showMessageDialog(null, "La contraseña es Fuerte:\n" + p, "Contraseña Agregada Fuerte", 1); } else { JOptionPane.showMessageDialog(null, "Contraseña Debil:\n " + p, "Contraseña Introducida Debil", 2); } } else { JOptionPane.showMessageDialog(null, "Introduce un valor valido", "Error de valor introducido", 2); } } while (!bandera); } return p; }
[ "public", "Password", "rellenar", "(", "int", "i", ")", "{", "Password", "p", "=", "null", ";", "if", "(", "i", "==", "1", ")", "{", "String", "c", "=", "JOptionPane", ".", "showInputDialog", "(", "null", ",", "\"Introduce la contraseña\",", " ", "Introduciendo contraseña\", ", "1", ";", "", "", "p", "=", "new", "Password", "(", "c", ")", ";", "if", "(", "p", ".", "esFuerte", "(", ")", ")", "{", "JOptionPane", ".", "showMessageDialog", "(", "null", ",", "\"La contraseña es Fuerte:\\n \" ", " ", ",", " ", "Contraseña Agregada Fuerte\", ", "1", ";", "", "", "}", "else", "{", "JOptionPane", ".", "showMessageDialog", "(", "null", ",", "\"Contraseña Debil: \\n\" ", " ", ",", " ", "Contraseña Introducida Debil\", ", "2", ";", "", "", "}", "}", "else", "{", "boolean", "bandera", "=", "false", ";", "do", "{", "int", "n", "=", "Integer", ".", "parseInt", "(", "JOptionPane", ".", "showInputDialog", "(", "null", ",", "\"Introduce la longitud de la contraseña a generar\",", " ", "Introduciendo longitud\",", " ", ")", ")", ";", "", "if", "(", "n", ">", "0", "&&", "n", "!=", "0", ")", "{", "bandera", "=", "true", ";", "p", "=", "new", "Password", "(", "n", ")", ";", "if", "(", "p", ".", "esFuerte", "(", ")", ")", "{", "JOptionPane", ".", "showMessageDialog", "(", "null", ",", "\"La contraseña es Fuerte:\\n\" ", " ", ",", " ", "Contraseña Agregada Fuerte\", ", "1", ";", "", "", "}", "else", "{", "JOptionPane", ".", "showMessageDialog", "(", "null", ",", "\"Contraseña Debil:\\n \" ", " ", ",", " ", "Contraseña Introducida Debil\", ", "2", ";", "", "", "}", "}", "else", "{", "JOptionPane", ".", "showMessageDialog", "(", "null", ",", "\"Introduce un valor valido\"", ",", "\"Error de valor introducido\"", ",", "2", ")", ";", "}", "}", "while", "(", "!", "bandera", ")", ";", "}", "return", "p", ";", "}" ]
[ 32, 4 ]
[ 60, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
CropOverlayView.
null
Obtener la distancia entre dos puntos
Obtener la distancia entre dos puntos
private int distance(Point src, Point dst) { return (int) Math.sqrt(Math.pow(src.x - dst.x, 2) + Math.pow(src.y - dst.y, 2)); }
[ "private", "int", "distance", "(", "Point", "src", ",", "Point", "dst", ")", "{", "return", "(", "int", ")", "Math", ".", "sqrt", "(", "Math", ".", "pow", "(", "src", ".", "x", "-", "dst", ".", "x", ",", "2", ")", "+", "Math", ".", "pow", "(", "src", ".", "y", "-", "dst", ".", "y", ",", "2", ")", ")", ";", "}" ]
[ 270, 4 ]
[ 272, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Notas.
null
Calcula y devuelve la nota inicial
Calcula y devuelve la nota inicial
public double CalcularNotaInicial(Paralelo p, Notas notas){ return CalcularNota(p, notas); }
[ "public", "double", "CalcularNotaInicial", "(", "Paralelo", "p", ",", "Notas", "notas", ")", "{", "return", "CalcularNota", "(", "p", ",", "notas", ")", ";", "}" ]
[ 47, 4 ]
[ 49, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Registro.
null
Método InsertarUsuarios con posición
Método InsertarUsuarios con posición
public void InsertarUsuarios(int Posicion, Usuario UsuarioAAsignar) { RegistroUsuarios.add(Posicion, UsuarioAAsignar); }
[ "public", "void", "InsertarUsuarios", "(", "int", "Posicion", ",", "Usuario", "UsuarioAAsignar", ")", "{", "RegistroUsuarios", ".", "add", "(", "Posicion", ",", "UsuarioAAsignar", ")", ";", "}" ]
[ 96, 4 ]
[ 99, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Tools.
null
obtiene imagenes pero listas para componentes de Swing
obtiene imagenes pero listas para componentes de Swing
public static ImageIcon getComponentIcon(String path, int width, int height) throws FileNotFoundException, IOException{ BufferedImage bg = ImageIO.read(new FileInputStream(path)); Image dimg = bg.getScaledInstance(width, height, Image.SCALE_SMOOTH); return new ImageIcon(dimg); }
[ "public", "static", "ImageIcon", "getComponentIcon", "(", "String", "path", ",", "int", "width", ",", "int", "height", ")", "throws", "FileNotFoundException", ",", "IOException", "{", "BufferedImage", "bg", "=", "ImageIO", ".", "read", "(", "new", "FileInputStream", "(", "path", ")", ")", ";", "Image", "dimg", "=", "bg", ".", "getScaledInstance", "(", "width", ",", "height", ",", "Image", ".", "SCALE_SMOOTH", ")", ";", "return", "new", "ImageIcon", "(", "dimg", ")", ";", "}" ]
[ 31, 4 ]
[ 36, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Juego.
null
Comportamiento del Juego
Comportamiento del Juego
public int sumatoriaTablero(){ int sumatoria = 0; for (int i = 0; i < Tablero.NUM_FILAS; i++) { for (int j = 0; j < Tablero.NUM_COLUMNAS; j++) { sumatoria += this.tablero.casillas[i][j].getValorLogico(); } } return sumatoria; }
[ "public", "int", "sumatoriaTablero", "(", ")", "{", "int", "sumatoria", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "Tablero", ".", "NUM_FILAS", ";", "i", "++", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "Tablero", ".", "NUM_COLUMNAS", ";", "j", "++", ")", "{", "sumatoria", "+=", "this", ".", "tablero", ".", "casillas", "[", "i", "]", "[", "j", "]", ".", "getValorLogico", "(", ")", ";", "}", "}", "return", "sumatoria", ";", "}" ]
[ 41, 4 ]
[ 49, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
WsGamesHandler.
null
Se ejecuta cuando un cliente se ha desconectado
Se ejecuta cuando un cliente se ha desconectado
@Override public void afterConnectionClosed(WebSocketSession session, CloseStatus status) throws Exception { // Elimina a los jugadores de su partida games.forEach((k, v)->{ List<WebSocketSession> aux = v; // Si es el lobby del jugador, desconecta al otro también y borra el lobby if(aux.contains(session)) { games.remove(k); for (int i=0; i < aux.size(); i++) { try { aux.get(i).close(); System.out.println("Un jugador se ha desconectado de la partida " + k); } catch (IOException e) { e.printStackTrace(); } } return; } }); }
[ "@", "Override", "public", "void", "afterConnectionClosed", "(", "WebSocketSession", "session", ",", "CloseStatus", "status", ")", "throws", "Exception", "{", "// Elimina a los jugadores de su partida", "games", ".", "forEach", "(", "(", "k", ",", "v", ")", "->", "{", "List", "<", "WebSocketSession", ">", "aux", "=", "v", ";", "// Si es el lobby del jugador, desconecta al otro también y borra el lobby", "if", "(", "aux", ".", "contains", "(", "session", ")", ")", "{", "games", ".", "remove", "(", "k", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "aux", ".", "size", "(", ")", ";", "i", "++", ")", "{", "try", "{", "aux", ".", "get", "(", "i", ")", ".", "close", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\"Un jugador se ha desconectado de la partida \"", "+", "k", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "return", ";", "}", "}", ")", ";", "}" ]
[ 36, 1 ]
[ 61, 2 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
PeliculasDOM.
null
Cargamos el documento en memoria en forma de arbol DOM
Cargamos el documento en memoria en forma de arbol DOM
private void parsearDocumentoXML() { //get an instance of factory DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); try { //get an instance of builder DocumentBuilder db = dbf.newDocumentBuilder(); //create an instance of DOM dom = db.parse("../peliculas.xml"); } catch (ParserConfigurationException pce) { //dump it System.out.println("Error while trying to instantiate DocumentBuilder " + pce); System.exit(1); } catch (SAXException se) { se.printStackTrace(); } catch (IOException ioe) { ioe.printStackTrace(); } }
[ "private", "void", "parsearDocumentoXML", "(", ")", "{", "//get an instance of factory", "DocumentBuilderFactory", "dbf", "=", "DocumentBuilderFactory", ".", "newInstance", "(", ")", ";", "try", "{", "//get an instance of builder", "DocumentBuilder", "db", "=", "dbf", ".", "newDocumentBuilder", "(", ")", ";", "//create an instance of DOM", "dom", "=", "db", ".", "parse", "(", "\"../peliculas.xml\"", ")", ";", "}", "catch", "(", "ParserConfigurationException", "pce", ")", "{", "//dump it", "System", ".", "out", ".", "println", "(", "\"Error while trying to instantiate DocumentBuilder \"", "+", "pce", ")", ";", "System", ".", "exit", "(", "1", ")", ";", "}", "catch", "(", "SAXException", "se", ")", "{", "se", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "IOException", "ioe", ")", "{", "ioe", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
[ 87, 4 ]
[ 108, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration
Registro.
null
Método InsertarHabitaciones
Método InsertarHabitaciones
public void InsertarHabitaciones(Habitacion HabitacionAAsignar) { RegistroHabitaciones.add(HabitacionAAsignar); }
[ "public", "void", "InsertarHabitaciones", "(", "Habitacion", "HabitacionAAsignar", ")", "{", "RegistroHabitaciones", ".", "add", "(", "HabitacionAAsignar", ")", ";", "}" ]
[ 108, 4 ]
[ 111, 5 ]
null
java
es
['es', 'es', 'es']
False
true
method_declaration
Lista.
null
Enlace cola de llenado
Enlace cola de llenado
public void setColaDeLlenado(ColaDeLlenado miColaDeLlenado) { this.miColaDeLlenado = miColaDeLlenado; }
[ "public", "void", "setColaDeLlenado", "(", "ColaDeLlenado", "miColaDeLlenado", ")", "{", "this", ".", "miColaDeLlenado", "=", "miColaDeLlenado", ";", "}" ]
[ 32, 4 ]
[ 34, 5 ]
null
java
es
['es', 'es', 'es']
True
true
method_declaration