public final class FileFormat
extends java.lang.Object
Constructor and Description |
---|
FileFormat(java.util.Map<java.lang.Integer,TreatmentParameter> columnMap,
int headerLines,
MeasurementType measurementType,
TreatmentType 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 widthsString)
Turns a string containing comma-separated decimal integers into a
List of Integer s. |
java.util.Map<java.lang.Integer,TreatmentParameter> |
getColumnMap() |
java.lang.String |
getColumnWidthsAsString() |
FieldUnit |
getFieldUnit() |
int |
getHeaderLines() |
MeasurementType |
getMeasurementType() |
MomentUnit |
getMomentUnit() |
java.lang.String |
getSeparator() |
TreatmentType |
getTreatmentType() |
static FileFormat |
readFromPrefs(java.util.prefs.Preferences prefs)
Creates a format from a preferences object.
|
TreatmentStep |
readLine(java.lang.String line)
Creates a
TreatmentStep from a line formatted according to this
format. |
java.util.List<TreatmentStep> |
readLines(java.util.List<java.lang.String> lines)
Reds a list of lines in this format and produces the corresponding
TreatmentStep 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,TreatmentParameter> columnMap, int headerLines, MeasurementType measurementType, TreatmentType 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 TreatmentStep readLine(java.lang.String line)
TreatmentStep
from a line formatted according to this
format.line
- a line formatted according this this formatpublic java.util.List<TreatmentStep> readLines(java.util.List<java.lang.String> lines)
TreatmentStep
s.lines
- a list of lines in this formatpublic static java.util.List<java.lang.Integer> convertStringToColumnWidths(java.lang.String widthsString)
List
of Integer
s.widthsString
- 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 MeasurementType getMeasurementType()
public TreatmentType getTreatmentType()
public java.util.Map<java.lang.Integer,TreatmentParameter> 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()