public class SDRFLayout extends Object implements Layout<SDRF>
SDRF
datamodel
object and the serialized version of it.
The SDRF datamodel is considerably more complex than IDF, as the parsed version of the SDRF is a graph. This graph
has a mapping to the spreadsheet view where each node can occupy several locations in the spreadsheet. Furthermore,
the set of attributes attached to the node in each of these locations need not actually be identical (although they
should be, and usually are, the same). To this end, each node in the SDRF graph must be assigned one or more
locations, and each attribute for each node must also be assigned one or more locations.
Tracking this location information on parsing ensures that SDRF objects can be roundtripped from spreadsheet to graph
view and back whilst preserving row and column order, so that a 'diff' of the two files should be identical.Constructor and Description |
---|
SDRFLayout() |
Modifier and Type | Method and Description |
---|---|
void |
addAttributeLocation(SDRFAttribute attribute,
Location location) |
void |
addNodeLocation(SDRFNode node,
Location location) |
void |
addPrimitiveLocation(String primitiveValue,
String columnName,
Location location) |
void |
calculateLocations(SDRF sdrf)
A factory method for fully calculates the layout of the given datamodel object, using Limpopo's own MAGE-TAB
printing algorithms.
|
void |
calculateUnassignedLocations(SDRF sdrf)
A factory method for calculating the locations of any data items not already assigned.
|
boolean |
containsUnassignedElements(SDRF sdrf)
Returns true if the supplied datamodel has elements with no assigned location in this layout.
|
SDRFAttribute |
getAttribute(Location location) |
String[] |
getHeaders() |
int |
getLineCount() |
Collection<Location> |
getLocationsForAttribute(SDRFAttribute attribute) |
Collection<Location> |
getLocationsForNode(SDRFNode node) |
Collection<Location> |
getLocationsForPrimitive(String primitive) |
protected org.slf4j.Logger |
getLog() |
SDRFNode |
getNode(Location location) |
String |
getPrimitive(Location location) |
boolean |
isCompletelyUnassigned()
Returns true if there is no layout information contained within this layout
|
void |
storeHeaders(String[] originalHeaders) |
protected org.slf4j.Logger getLog()
public void storeHeaders(String[] originalHeaders)
public void addAttributeLocation(SDRFAttribute attribute, Location location)
public void addPrimitiveLocation(String primitiveValue, String columnName, Location location)
public String[] getHeaders()
public SDRFAttribute getAttribute(Location location)
public Collection<Location> getLocationsForNode(SDRFNode node)
public Collection<Location> getLocationsForAttribute(SDRFAttribute attribute)
public Collection<Location> getLocationsForPrimitive(String primitive)
public int getLineCount()
public boolean containsUnassignedElements(SDRF sdrf)
Layout
containsUnassignedElements
in interface Layout<SDRF>
public boolean isCompletelyUnassigned()
Layout
isCompletelyUnassigned
in interface Layout<SDRF>
public void calculateUnassignedLocations(SDRF sdrf)
Layout
calculateUnassignedLocations
in interface Layout<SDRF>
sdrf
- the datamodel for which to assign layout data for anything that hasn't been laid out previouslypublic void calculateLocations(SDRF sdrf)
Layout
calculateLocations
in interface Layout<SDRF>
sdrf
- the datamodel to layoutCopyright © 2014. All rights reserved.