Line | Hits | Source |
---|---|---|
1 | package net.sf.tourviewer; | |
2 | ||
3 | import java.io.BufferedInputStream; | |
4 | import java.io.FileInputStream; | |
5 | import java.io.IOException; | |
6 | import java.io.InputStream; | |
7 | import java.util.Arrays; | |
8 | import net.sf.tourviewer.ciclo.CicloReader; | |
9 | ||
10 | 0 | public class JTourViewer |
11 | { | |
12 | ||
13 | private static final int HAC4_SIGNATURE = 0xB735; | |
14 | private static final int CM414M_SIGNATURE = 0xB723; | |
15 | ||
16 | public TourSet read(String filename) throws IOException { | |
17 | 0 | InputStream in = new BufferedInputStream(new FileInputStream(filename)); |
18 | try { | |
19 | 0 | CicloReader reader = new CicloReader(); |
20 | 0 | if (reader.accept(in)) { |
21 | 0 | TourSet tourSet = reader.read(in); |
22 | //reader.print(System.out); | |
23 | 0 | print(tourSet); |
24 | 0 | return tourSet; |
25 | } | |
26 | else { | |
27 | 0 | throw new IOException("No handler for input file"); |
28 | } | |
29 | } | |
30 | 0 | finally { |
31 | try { | |
32 | 0 | in.close(); |
33 | 0 | } catch (Exception e) {} |
34 | 0 | } |
35 | } | |
36 | ||
37 | private void print(TourSet tourSet) | |
38 | { | |
39 | 0 | System.out.println(tourSet); |
40 | 0 | Tour[] tours = tourSet.getTours(); |
41 | 0 | Arrays.sort(tours); |
42 | 0 | for (Tour tour : tours) { |
43 | 0 | System.out.println(tour); |
44 | } | |
45 | 0 | System.out.println(); |
46 | ||
47 | 0 | for (Tour tour : tours) { |
48 | 0 | System.out.println(tour); |
49 | 0 | for (TourRecord record : tour.getRecords()) { |
50 | 0 | System.out.println(record); |
51 | } | |
52 | 0 | System.out.println(); |
53 | } | |
54 | ||
55 | 0 | } |
56 | ||
57 | public static void main( String[] args ) | |
58 | { | |
59 | 0 | if (args.length != 1) { |
60 | 0 | System.err.println("usage: java JTourViewer [filename]"); |
61 | 0 | System.exit(1); |
62 | } | |
63 | ||
64 | 0 | JTourViewer app = new JTourViewer(); |
65 | try { | |
66 | 0 | app.read(args[0]); |
67 | } | |
68 | 0 | catch (Exception e) { |
69 | 0 | e.printStackTrace(); |
70 | } | |
71 | 0 | } |
72 | ||
73 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |