solución definitiva del gitignore
This commit is contained in:
-10
@@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-25">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@@ -1 +0,0 @@
|
||||
/bin/
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>Ficheros_02</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
||||
@@ -1,11 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=25
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=25
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.release=enabled
|
||||
org.eclipse.jdt.core.compiler.source=25
|
||||
Binary file not shown.
@@ -1,68 +0,0 @@
|
||||
package org.palomafp.aadd.rmr;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.palomafp.aadd.rmr.vo.Continente;
|
||||
import org.palomafp.aadd.rmr.vo.Pais;
|
||||
|
||||
import java.io.FileReader;
|
||||
import java.io.BufferedReader;
|
||||
|
||||
public class Main {
|
||||
|
||||
// este método se ejecuta al arrancar el programa
|
||||
public static void main (String[] args) {
|
||||
|
||||
// llamo al método que va a procesar mi fichero
|
||||
imprimirInformacionPaises();
|
||||
}
|
||||
|
||||
|
||||
public static void imprimirInformacionPaises() {
|
||||
// el codiguito va aquí
|
||||
try {
|
||||
|
||||
// preparo para leer el archivo de la ruta
|
||||
BufferedReader br = new BufferedReader (new FileReader("C:/Users/Rocío/aadd/fic02/informacion_paises.txt"));
|
||||
String linea = ""; // guardo cada línea aquí
|
||||
|
||||
// bucle donde leo línea a línea hasta que no haya más
|
||||
while ((linea = br.readLine()) != null) {
|
||||
|
||||
// si la lóinea mepieza por # o - la ignoro y no hace nada
|
||||
if (linea.startsWith("#") || linea.startsWith("-")) {
|
||||
|
||||
} else {
|
||||
// paso 1. limpio los datos
|
||||
linea = linea.replace("\"", ""); // quito todas las comillas dobles
|
||||
String[] trozos = linea.split(","); // parto la línea por las comas para tener lso 4 datos
|
||||
|
||||
// paso 2. meto los datos en objetos
|
||||
Continente c = new Continente(); // creo el continente
|
||||
c.setCodigo(trozos[0].trim()); // guardo el code quitándole los espacios
|
||||
|
||||
Pais p = new Pais();
|
||||
p.setIdentificador(Integer.parseInt(trozos[1].trim())); // convierto a num el identificador
|
||||
p.setNombre(trozos[2].trim()); // meto el nombre
|
||||
p.setCapital(trozos[3].trim()); // meto la capital
|
||||
p.setContinente(c); // mteo el objeto continente dentro de país
|
||||
|
||||
// paso 3. imprimo l oque se ipde
|
||||
System.out.println(p.toString());
|
||||
|
||||
// paso 4. monto la frase sql sacando los datos de los objetos que he creado arriba
|
||||
System.out.println("INSERT INTO T_PAIS (cod_continente, identificador, capital, nombre_pais) VALUES (" + p.getIdentificador() + ", '" + c.getCodigo() + "', '" + p.getCapital() + "', '" + p.getNombre() + "');");
|
||||
}
|
||||
}
|
||||
|
||||
br.close();
|
||||
|
||||
} catch (FileNotFoundException e) {
|
||||
System.out.println("El archivo no se encuentra.");
|
||||
} catch (IOException e) {
|
||||
System.out.println("Ha ocurrido un error.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package org.palomafp.aadd.rmr.vo;
|
||||
|
||||
public class Continente {
|
||||
|
||||
private String codigo;
|
||||
private String nombre;
|
||||
|
||||
|
||||
public String getCodigo() {
|
||||
return codigo;
|
||||
}
|
||||
public void setCodigo(String codigo) {
|
||||
this.codigo = codigo;
|
||||
}
|
||||
|
||||
|
||||
public String getNombre() {
|
||||
return nombre;
|
||||
}
|
||||
public void setNombre(String nombre) {
|
||||
this.nombre = nombre;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Continente [codigo=" + codigo + ", nombre=" + nombre + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package org.palomafp.aadd.rmr.vo;
|
||||
|
||||
public class Pais {
|
||||
|
||||
private int identificador;
|
||||
private String nombre;
|
||||
private String capital;
|
||||
private Continente continente;
|
||||
|
||||
|
||||
public int getIdentificador() {
|
||||
return identificador;
|
||||
}
|
||||
public void setIdentificador(int identificador) {
|
||||
this.identificador = identificador;
|
||||
}
|
||||
|
||||
|
||||
public String getNombre() {
|
||||
return nombre;
|
||||
}
|
||||
public void setNombre(String nombre) {
|
||||
this.nombre = nombre;
|
||||
}
|
||||
|
||||
|
||||
public String getCapital() {
|
||||
return capital;
|
||||
}
|
||||
public void setCapital(String capital) {
|
||||
this.capital = capital;
|
||||
}
|
||||
|
||||
|
||||
public Continente getContinente() {
|
||||
return continente;
|
||||
}
|
||||
public void setContinente(Continente continente) {
|
||||
this.continente = continente;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Pais [identificador=" + identificador + ", nombre=" + nombre + ", capital=" + capital + ", continente="
|
||||
+ continente + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user