public final class FileFormat
extends java.lang.Object
Constructor and Description |
---|
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,
MomentUnit momentUnit,
FieldUnit fieldUnit)
Creates a new file format with the specified parameters.
|
Modifier and Type | Method and Description |
---|---|
static java.util.List<java.lang.Integer> |
convertStringToColumnWidths(java.lang.String widthString)
Turns a string containing comma-separated decimal integers into a
List of Integer . |
java.util.Map<java.lang.Integer,DatumField> |
getColumnMap() |
java.lang.String |
getColumnWidthsAsString() |
FieldUnit |
getFieldUnit() |
int |
getHeaderLines() |
MeasType |
getMeasurementType() |
MomentUnit |
getMomentUnit() |
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 |
specifiesDirection()
Determines whether this format specifies a three-dimensional direction.
|
boolean |
specifiesFullVector()
Determines whether this format specifies a full magnetization vector.
|
boolean |
useFixedWidthColumns() |
void |
writeToPrefs(java.util.prefs.Preferences prefs)
Saves this format to a preferences object.
|
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, MomentUnit momentUnit, FieldUnit fieldUnit)
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 formatsmomentUnit
- units in which magnetic moment per unit volume is expressedfieldUnit
- units in which magnetic field strength is expressedpublic Datum readLine(java.lang.String line)
Datum
from a line formatted according to this format.line
- a line formatted according this this formatpublic java.util.List<Datum> readLines(java.util.List<java.lang.String> lines)
Datum
s.lines
- a list of lines in this formatpublic static java.util.List<java.lang.Integer> convertStringToColumnWidths(java.lang.String widthString)
List
of Integer
.widthString
- a string of comma-separated decimal integerspublic 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 formatpublic 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 columnspublic boolean specifiesFullVector()
true
iff this format specifies a full magnetization vectorpublic boolean specifiesDirection()
true
iff this format specifies a three-dimensional directionpublic MomentUnit getMomentUnit()
public FieldUnit getFieldUnit()