/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

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