|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.talvi.puffinplot.data.file.FileFormat
public final class FileFormat
This class represents an ASCII-based file format with one row per measurement. It defines the mapping from column numbers to data fields, and the number of header lines to be skipped. Columns are zero-indexed.
Constructor Summary | |
---|---|
FileFormat(java.util.Map<java.lang.Integer,DatumField> columnMap,
int headerLines,
MeasType measurementType,
TreatType treatmentType,
java.lang.String separator,
boolean useFixedWidthColumns,
java.util.List<java.lang.Integer> columnWidths)
Creates a new file format with the specified parameters. |
Method Summary | |
---|---|
static java.util.List<java.lang.Integer> |
convertStringToColumnWidths(java.lang.String widthString)
Turns a string containing comma-separated decimal integers into a List of {@link Integer. |
java.util.Map<java.lang.Integer,DatumField> |
getColumnMap()
|
java.lang.String |
getColumnWidthsAsString()
|
int |
getHeaderLines()
|
MeasType |
getMeasurementType()
|
java.lang.String |
getSeparator()
|
TreatType |
getTreatmentType()
|
static FileFormat |
readFromPrefs(java.util.prefs.Preferences prefs)
Creates a format from a preferences object. |
Datum |
readLine(java.lang.String line)
Creates a Datum from a line formatted according to this format. |
java.util.List<Datum> |
readLines(java.util.List<java.lang.String> lines)
Reds a list of lines in this format and produces the corresponding Datum s. |
boolean |
useFixedWidthColumns()
|
void |
writeToPrefs(java.util.prefs.Preferences prefs)
Saves this format to a preferences object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileFormat(java.util.Map<java.lang.Integer,DatumField> columnMap, int headerLines, MeasType measurementType, TreatType treatmentType, java.lang.String separator, boolean useFixedWidthColumns, java.util.List<java.lang.Integer> columnWidths)
columnMap
- a mapping from column numbers (0-indexed) to data fieldsheaderLines
- number of header lines to skipmeasurementType
- type of all measurements in filetreatmentType
- type of all treatments in fileseparator
- column separator for non-fixed-width-column formatsuseFixedWidthColumns
- whether this format uses fixed-width columnscolumnWidths
- the widths of columns for fixed-width-column formatsMethod Detail |
---|
public Datum readLine(java.lang.String line)
Datum
from a line formatted according to this format.
line
- a line formatted according this this format
public java.util.List<Datum> readLines(java.util.List<java.lang.String> lines)
Datum
s.
lines
- a list of lines in this format
public static java.util.List<java.lang.Integer> convertStringToColumnWidths(java.lang.String widthString)
List
of {@link Integer.
widthString
- a string of comma-separated decimal integers
public java.lang.String getColumnWidthsAsString()
public void writeToPrefs(java.util.prefs.Preferences prefs)
prefs
- the preferences to which to save this formatpublic static FileFormat readFromPrefs(java.util.prefs.Preferences prefs)
prefs
- a preferences object containing the data for a format
public MeasType getMeasurementType()
public TreatType getTreatmentType()
public java.util.Map<java.lang.Integer,DatumField> getColumnMap()
public int getHeaderLines()
public java.lang.String getSeparator()
public boolean useFixedWidthColumns()
true
if the format uses fixed-width columns
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |