本文整理汇总了Java中es.uniovi.asw.util.Console类的典型用法代码示例。如果您正苦于以下问题:Java Console类的具体用法?Java Console怎么用?Java Console使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Console类属于es.uniovi.asw.util包,在下文中一共展示了Console类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: insert
import es.uniovi.asw.util.Console; //导入依赖的package包/类
/**
* Recibe los ciudadanos leídos por el parser. Si hay alguno con dni repetido no se mete.
* Devuelve una lista con los ciudadanos se hayan podido meter en la base de datos.
*/
@Override
public List<Citizen> insert(List<Citizen> citizens) {
EntityManager mapper = Jpa.createEntityManager();
EntityTransaction trx = mapper.getTransaction();
trx.begin();
List<Citizen> ciud = new ArrayList<Citizen>();
for(Citizen c:citizens){
if(CitizenFinder.findByDNI(c.getDNI())==null){
Jpa.getManager().persist(c);
ciud.add(c);
Console.println("Se ha añadido a la base de datos a "+c.toString());
}else{
reporter.report("El usuario con DNI "+c.getDNI()+" ya se encontraba en la base de datos.");
}
}
trx.commit();
return ciud;
}
示例2: read
import es.uniovi.asw.util.Console; //导入依赖的package包/类
@Override
public List<Citizen> read(String path) {
String extension = path.split("\\.")[1];
List<Citizen> citizens;
if (extension.equals("xlsx"))
reader = new ParserExcel();
else if (extension.equals("txt"))
reader = new ParserTextPlain();
else
Console.print("El fichero no tiene un formato correcto");
citizens = reader.readFile(path);
List<Citizen> ciudadanosOk = SingletonInsert.getInsert().insert(citizens);
return ciudadanosOk;
}
示例3: println1
import es.uniovi.asw.util.Console; //导入依赖的package包/类
@Test
public void println1() throws Exception {
Citizen c = new Citizen("Pelayo","Garcia","[email protected]",
new Date(),"Gijon","Española","563587A");
Console.println(c);
assertEquals(c.toString()+newLine,outContent.toString());
}
示例4: readCommand
import es.uniovi.asw.util.Console; //导入依赖的package包/类
private static void readCommand() {
command = Console.readString(">");
if (!command.equals("quit")) {
if (command.equals("-h")) {
help(null);
readCommand();
}
else
parse(command.split(" "));
}
}
示例5: println
import es.uniovi.asw.util.Console; //导入依赖的package包/类
@Test
public void println() throws Exception {
Console.println("Test println");
assertEquals("Test println"+newLine,outContent.toString());
}
示例6: print
import es.uniovi.asw.util.Console; //导入依赖的package包/类
@Test
public void print() throws Exception {
Console.print("Test println");
assertEquals("Test println",outContent.toString());
}
示例7: printf
import es.uniovi.asw.util.Console; //导入依赖的package包/类
@Test
public void printf() throws Exception {
Console.printf("the %s jumped over the %s, %d times", "cow", "moon", 2);
assertEquals("the cow jumped over the moon, 2 times",outContent.toString());
}
示例8: readString1
import es.uniovi.asw.util.Console; //导入依赖的package包/类
@Test
public void readString1() throws Exception {
String s = Console.readString("Test readString");
assertEquals("test in",s);
assertEquals("Test readString: ",outContent.toString());
}