001package jmri.jmrit.logixng.implementation; 002 003import javax.annotation.CheckForNull; 004import javax.annotation.Nonnull; 005 006/** 007 * The default implementation of a NamedTable 008 * 009 * @author Daniel Bergqvist 2018 010 */ 011public class DefaultCsvNamedTable extends AbstractNamedTable { 012 013 private String _fileName; 014 015 private CsvType _csvType; 016 017 /** 018 * Create a new named table. 019 * @param sys the system name 020 * @param user the user name or null if no user name 021 * @param fileName the file name of the CSV table 022 * @param data the data in the table. Note that this data is not copied to 023 * a new array but used by the table as is. 024 * @param csvType the type of delimiter used for the file (comma or tab) 025 * @throws BadUserNameException when needed 026 * @throws BadSystemNameException when needed 027 */ 028 public DefaultCsvNamedTable( 029 @Nonnull String sys, @CheckForNull String user, 030 @CheckForNull String fileName, 031 @Nonnull Object[][] data, 032 CsvType csvType) 033 throws BadUserNameException, BadSystemNameException { 034 super(sys,user,data); 035 036 _fileName = fileName; 037 _csvType = csvType; 038 } 039 @Override 040 public boolean isCsvTypeSupported() { 041 return true; 042 } 043 044 public String getFileName() { 045 return _fileName; 046 } 047 048 public void setFileName(String fileName) { 049 this._fileName = fileName; 050 } 051 052 @Override 053 public void setCsvType(CsvType csvType) { 054 _csvType = csvType; 055 } 056 057 @Override 058 public CsvType getCsvType() { 059 return _csvType; 060 } 061 062}