PageRenderTime 17ms CodeModel.GetById 13ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/edu/uncc/parsets/data/old/CSVParserListener.java

https://code.google.com/p/parsets/
Java | 83 lines | 9 code | 10 blank | 64 comment | 0 complexity | b5a515700906635c754924949577305b MD5 | raw file
 1package edu.uncc.parsets.data.old;
 2
 3/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
 4 * Copyright (c) 2009, Robert Kosara, Caroline Ziemkiewicz,
 5 *                     and others (see Authors.txt for full list)
 6 * All rights reserved.
 7 * 
 8 * Redistribution and use in source and binary forms, with or without
 9 * modification, are permitted provided that the following conditions are met:
10 * 
11 *    * Redistributions of source code must retain the above copyright
12 *      notice, this list of conditions and the following disclaimer.
13 *    * Redistributions in binary form must reproduce the above copyright
14 *      notice, this list of conditions and the following disclaimer in the
15 *      documentation and/or other materials provided with the distribution.
16 *    * Neither the name of UNC Charlotte nor the names of its contributors
17 *      may be used to endorse or promote products derived from this software
18 *      without specific prior written permission.
19 *      
20 * THIS SOFTWARE IS PROVIDED BY ITS AUTHORS ''AS IS'' AND ANY
21 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 * DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
24 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
31
32public interface CSVParserListener {
33
34	/**
35	 * Called at the end of {@link CSVParser#analyzeCSVFile()}.
36	 * 
37	 * @param data The dataset, containing dimensions with metadata (if any)
38	 * and category definitions and stats.
39	 */
40	public void setDataSet(CSVDataSet data);
41	
42	/**
43	 * Will be called with values from 0 to 100 during parsing. If length of
44	 * file is unknown, will be called with value of -1.
45	 * 
46	 * @param progress Parsing progress from 0 to 100 or -1
47	 */
48	public void setProgress(int progress);
49	
50	/**
51	 * Called when the complete import is done.
52	 */
53	public void importDone();
54	
55	/**
56	 * Called when the parser can't open the file.
57	 * 
58	 * @param filename
59	 */
60	public void errorFileNotFound(String filename);
61	
62	/**
63	 * Called when the parser encounters an IOError or other problem while
64	 * reading the file.
65	 * 
66	 * @param filename The name of the file being read.
67	 */
68	public void errorReadingFile(String filename);
69	
70	/**
71	 * Called when the parser encounters a line with the wrong number of
72	 * columns while analyzing the CSV file. At that point, the parser
73	 * aborts the analysis and goes into an undefined state. Trying
74	 * to continue the import will lead to a program crash.
75	 * 
76	 * @param expected The number of columns the parser expected
77	 * @param found The number of columns found
78	 * @param line The line the error happened
79	 */
80	public void errorWrongNumberOfColumns(int expected, int found, int line);
81
82	
83}