java/LangTable/src/cz/frantovo/langtable/LangTable.java
author František Kučera <franta-hg@frantovo.cz>
Fri, 08 May 2020 00:02:05 +0200
changeset 57 1b21c78d8706
parent 20 63b496ae04f9
permissions -rw-r--r--
SQLite: demo modul – rozšíření přidávající pár funkcí do SQL
Vzniklo v rámci práce na článku: https://blog.frantovo.cz/c/383/Komplexita%3A%20%C5%99e%C5%A1en%C3%AD%20a%C2%A0prevence
     1 package cz.frantovo.langtable;
     2 
     3 import cz.frantovo.langtable.Keyboards.*;
     4 import java.io.File;
     5 import javax.xml.bind.JAXBContext;
     6 import javax.xml.bind.JAXBException;
     7 import javax.xml.bind.Unmarshaller;
     8 
     9 /**
    10  *
    11  * @author Ing. František Kučera (frantovo.cz)
    12  */
    13 public class LangTable {
    14 
    15 	/**
    16 	 * @param args the command line arguments
    17 	 */
    18 	public static void main(String[] args) throws JAXBException {
    19 
    20 
    21 		JAXBContext c = JAXBContext.newInstance(Keyboards.class);
    22 		Unmarshaller u = c.createUnmarshaller();
    23 		
    24 		long start = System.currentTimeMillis();
    25 		Object o = u.unmarshal(new File("data/keyboards.xml"));
    26 		System.out.println("Time: " + (System.currentTimeMillis() - start) + " ms");
    27 		
    28 		Keyboards keyboards = (Keyboards) o;
    29 
    30 		for (Keyboard k : keyboards.getKeyboards()) {
    31 			System.out.println(k.getId());
    32 			System.out.println("  " + k.getDescription());
    33 			System.out.println("  " + k.getComment());
    34 			System.out.println("  " + k.isAscii());
    35 
    36 			System.out.println("  languages: " + k.getLanguages().size());
    37 			for (Language l : k.getLanguages()) {
    38 				System.out.println("    " + l);
    39 			}
    40 
    41 			System.out.println("  territories: " + k.getTerritories().size());
    42 			for (Territory t : k.getTerritories()) {
    43 				System.out.println("    " + t);
    44 			}
    45 		}
    46 
    47 
    48 
    49 
    50 	}
    51 }