Skip to content

Commit

Permalink
Make minor change in default renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
julianmendez committed Feb 3, 2019
1 parent dadbf1e commit 0ff8ad3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ new :

```

The unit tests include an example like [this one](https://github.com/julianmendez/tabulas/blob/master/tabulas-ext/src/test/resources/miniexample.properties).
The unit tests include an example like [this one](https://github.com/julianmendez/tabulas/blob/master/tabulas-ext/src/test/resources/ext/miniexample.properties).

For example, the [MainTest](https://github.com/julianmendez/tabulas/blob/master/tabulas-core/src/test/scala/de/tudresden/inf/lat/tabulas/main/MainTest.scala) class does the following steps:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class SimpleFormatRecordRenderer(output: Writer, prefixMap: PrefixMap) extends R
output.write(ParserConstant.NewLine)
output.write(ParserConstant.Space)
output.write(field)
output.write(ParserConstant.Space + ParserConstant.FieldSign)
output.write(ParserConstant.Space + SimpleFormatRecordRenderer.FieldSign)
if (value.getType.isList) {
val hasUris: Boolean = value match {
case list: ParameterizedListValue =>
Expand Down Expand Up @@ -58,7 +58,7 @@ class SimpleFormatRecordRenderer(output: Writer, prefixMap: PrefixMap) extends R
def renderNew(output: UncheckedWriter): Unit = {
output.write(ParserConstant.NewLine)
output.write(ParserConstant.NewRecordToken + ParserConstant.Space)
output.write(ParserConstant.FieldSign + ParserConstant.Space)
output.write(SimpleFormatRecordRenderer.FieldSign + ParserConstant.Space)
}

def render(output: UncheckedWriter, record: Record, fields: Seq[String]): Unit = {
Expand All @@ -81,6 +81,8 @@ class SimpleFormatRecordRenderer(output: Writer, prefixMap: PrefixMap) extends R

object SimpleFormatRecordRenderer {

final val FieldSign = ParserConstant.FieldSign

def apply(output: Writer, prefixMap: PrefixMap): SimpleFormatRecordRenderer = new SimpleFormatRecordRenderer(output, prefixMap)

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class SimpleFormatRenderer(output: Writer) extends Renderer {
tableMap.getTableIds.foreach(tableName => {
output.write(ParserConstant.NewLine)
output.write(ParserConstant.NewLine)
output.write(ParserConstant.TypeSelectionToken + ParserConstant.Space + ParserConstant.FieldSign + ParserConstant.Space)
output.write(ParserConstant.TypeSelectionToken + ParserConstant.Space + SimpleFormatRecordRenderer.FieldSign + ParserConstant.Space)
val table: Table = tableMap.getTable(tableName).get
val record = MetadataHelper().getMetadataAsRecord(tableName, table)
val recordRenderer = new SimpleFormatRecordRenderer(output.asWriter(), table.getPrefixMap)
Expand Down

0 comments on commit 0ff8ad3

Please sign in to comment.