org.cpsolver.ifs.util

## Class CSVFile

- java.lang.Object
- - org.cpsolver.ifs.util.CSVFile

- All Implemented Interfaces:
    Serializable

      public class CSVFile
      extends Object
      implements Serializable

  Support for CSV (comma separated) text files.
  Version:
    IFS 1.3 (Iterative Forward Search)
    Copyright (C) 2006 - 2014 Tomáš Müller
    muller@unitime.org
    http://muller.unitime.org
    This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
    This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
    You should have received a copy of the GNU Lesser General Public License along with this library; if not see http://www.gnu.org/licenses/.
  Author:
    Tomáš Müller
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `CSVFile.CSVField` Representation of a field of a CSV file
    `static interface` | `CSVFile.CSVFilter` An interface for filtering lines of a CSV file
    `class` | `CSVFile.CSVLine` Representation of a line of a CSV file

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CSVFile()`
    `CSVFile(File file)`
    `CSVFile(File file, String separator)`
    `CSVFile(File file, String separator, String quotationMark)`
    `CSVFile(Reader file)`
    `CSVFile(Reader file, String separator)`
    `CSVFile(Reader file, String separator, String quotationMark)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `CSVFile.CSVLine` | `addLine()`
    `CSVFile.CSVLine` | `addLine(Collection<CSVFile.CSVField> fields)`
    `CSVFile.CSVLine` | `addLine(CSVFile.CSVField[] fields)`
    `void` | `addLine(CSVFile.CSVLine line)`
    `void` | `addLine(String line)`
    `static CSVFile.CSVFilter` | `and(CSVFile.CSVFilter first, CSVFile.CSVFilter second)`
    `static CSVFile.CSVFilter` | `eq(String name, String value)`
    `List<CSVFile.CSVLine>` | `filter(CSVFile.CSVFilter filter)`
    `CSVFile.CSVLine` | `getHeader()`
    `CSVFile.CSVLine` | `getLine(int idx)`
    `List<CSVFile.CSVLine>` | `getLines()`
    `String` | `getQuotationMark()`
    `String` | `getSeparator()`
    `boolean` | `isEmpty()`
    `Iterator<CSVFile.CSVLine>` | `lines()`
    `void` | `load(File file)`
    `void` | `load(Reader file)`
    `static CSVFile.CSVFilter` | `not(CSVFile.CSVFilter filter)`
    `static CSVFile.CSVFilter` | `or(CSVFile.CSVFilter first, CSVFile.CSVFilter second)`
    `void` | `save(File file)`
    `void` | `save(Writer file)`
    `CSVFile.CSVLine` | `setHeader(Collection<CSVFile.CSVField> fields)`
    `CSVFile.CSVLine` | `setHeader(CSVFile.CSVField[] fields)`
    `void` | `setHeader(CSVFile.CSVLine header)`
    `void` | `setQuotationMark(String quotationMark)`
    `void` | `setSeparator(String separator)`
    `int` | `size()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CSVFile

          public CSVFile()

    - #### CSVFile

          public CSVFile(File file)
                  throws IOException

      Throws:
        `IOException`

    - #### CSVFile

          public CSVFile(File file,
                         String separator)
                  throws IOException

      Throws:
        `IOException`

    - #### CSVFile

          public CSVFile(File file,
                         String separator,
                         String quotationMark)
                  throws IOException

      Throws:
        `IOException`

    - #### CSVFile

          public CSVFile(Reader file)
                  throws IOException

      Throws:
        `IOException`

    - #### CSVFile

          public CSVFile(Reader file,
                         String separator)
                  throws IOException

      Throws:
        `IOException`

    - #### CSVFile

          public CSVFile(Reader file,
                         String separator,
                         String quotationMark)
                  throws IOException

      Throws:
        `IOException`

  - ### Method Detail

    - #### setSeparator

          public void setSeparator(String separator)

    - #### getSeparator

          public String getSeparator()

    - #### setQuotationMark

          public void setQuotationMark(String quotationMark)

    - #### getQuotationMark

          public String getQuotationMark()

    - #### load

          public void load(File file)
                    throws IOException

      Throws:
        `IOException`

    - #### load

          public void load(Reader file)
                    throws IOException

      Throws:
        `IOException`

    - #### save

          public void save(File file)
                    throws IOException

      Throws:
        `IOException`

    - #### save

          public void save(Writer file)
                    throws IOException

      Throws:
        `IOException`

    - #### getHeader

          public CSVFile.CSVLine getHeader()

    - #### setHeader

          public void setHeader(CSVFile.CSVLine header)

    - #### getLines

          public List<CSVFile.CSVLine> getLines()

    - #### size

          public int size()

    - #### isEmpty

          public boolean isEmpty()

    - #### getLine

          public CSVFile.CSVLine getLine(int idx)

    - #### lines

          public Iterator<CSVFile.CSVLine> lines()

    - #### addLine

          public void addLine(CSVFile.CSVLine line)

    - #### addLine

          public void addLine(String line)

    - #### filter

          public List<CSVFile.CSVLine> filter(CSVFile.CSVFilter filter)

    - #### addLine

          public CSVFile.CSVLine addLine()

    - #### addLine

          public CSVFile.CSVLine addLine(CSVFile.CSVField[] fields)

    - #### addLine

          public CSVFile.CSVLine addLine(Collection<CSVFile.CSVField> fields)

    - #### setHeader

          public CSVFile.CSVLine setHeader(CSVFile.CSVField[] fields)

    - #### setHeader

          public CSVFile.CSVLine setHeader(Collection<CSVFile.CSVField> fields)

    - #### eq

          public static CSVFile.CSVFilter eq(String name,
                                             String value)

    - #### and

          public static CSVFile.CSVFilter and(CSVFile.CSVFilter first,
                                              CSVFile.CSVFilter second)

    - #### or

          public static CSVFile.CSVFilter or(CSVFile.CSVFilter first,
                                             CSVFile.CSVFilter second)

    - #### not

          public static CSVFile.CSVFilter not(CSVFile.CSVFilter filter)