public class IDFLayout extends Object implements Layout<IDF>
IDF datamodel
 object and the serialized version of it.  This is useful for tracking the Location of data items from their
 "original" location in a parsed text file
 
 As the IDF datamodel object is more or less equivalent to the spreadsheet view, this layout object simply gives the
 line numbers of each field in the IDF.  For a given value, it's index in a list (if cardinality > 1) is the column
 number.  So, for example, if I have an IDF:
 
 Protocol Name    P-ABC-123   P-XYZ-456
 
 Then I can determine the location of the field named protocolName as '1' (line one, not zero indexed).
 idf.protocolName.indexOf("P-XYZ-456") will return 1 (because this list is zero indexed) - from this I
 can evaluate that the location of this field is line 1, column 3 (assuming one considers the header to be column
 "1").
 | Constructor and Description | 
|---|
IDFLayout()  | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
addCommentLocation(String commentType,
                  int lineNumber)
Add a location of an IDF comment type. 
 | 
void | 
addLocation(Field field,
           int lineNumber)
Add a location of a field from IDF. 
 | 
void | 
calculateLocations(IDF idf)
A factory method for fully calculates the layout of the given datamodel object, using Limpopo's own MAGE-TAB
 printing algorithms. 
 | 
void | 
calculateUnassignedLocations(IDF idf)
A factory method for calculating the locations of any data items not already assigned. 
 | 
boolean | 
containsUnassignedElements(IDF idf)
Returns true if the supplied datamodel has elements with no assigned location in this layout. 
 | 
String | 
getCommentType(int lineNumber)
Get the comment type on a given line, or null if none exists 
 | 
Field | 
getField(int lineNumber)
Get the field on the given line, or null if none exists. 
 | 
int | 
getLineCount()
Get the number of lines in the serialized IDF. 
 | 
int | 
getLineNumberForComment(String commentType)
Get the line number assigned to the supplied comment type. 
 | 
int | 
getLineNumberForField(Field field)
Get the line number assigned to the supplied field. 
 | 
int | 
getLineNumberForHeader(String header)  | 
protected org.slf4j.Logger | 
getLog()  | 
boolean | 
isCompletelyUnassigned()
Returns true if there is no layout information contained within this layout 
 | 
protected org.slf4j.Logger getLog()
public void addLocation(Field field, int lineNumber)
field - the field of the IDF to assign a location tolineNumber - the linenumber this field was read from or is being assigned topublic void addCommentLocation(String commentType, int lineNumber)
commentType - the type of comment in the IDF to assign a location tolineNumber - the linenumber this field was read from or is being assigned topublic Field getField(int lineNumber)
lineNumber - the line number a field should be found onpublic String getCommentType(int lineNumber)
lineNumber - the line number a field should be found onpublic int getLineNumberForField(Field field)
field - the field  to find the line number forpublic int getLineNumberForComment(String commentType)
commentType - the comment type to find the line number forpublic int getLineNumberForHeader(String header)
public int getLineCount()
public boolean containsUnassignedElements(IDF idf)
LayoutcontainsUnassignedElements in interface Layout<IDF>public boolean isCompletelyUnassigned()
LayoutisCompletelyUnassigned in interface Layout<IDF>public void calculateUnassignedLocations(IDF idf)
LayoutcalculateUnassignedLocations in interface Layout<IDF>idf - the datamodel for which to assign layout data for anything that hasn't been laid out previouslypublic void calculateLocations(IDF idf)
LayoutcalculateLocations in interface Layout<IDF>idf - the datamodel to layoutCopyright © 2014. All rights reserved.