com.spun.util.markdown.table.MarkdownTable Maven / Gradle / Ivy
package com.spun.util.markdown.table;
import com.spun.util.markdown.MarkdownCompatible;
import org.lambda.functions.Function1;
import org.lambda.query.Queryable;
public class MarkdownTable implements MarkdownCompatible
{
public Queryable markdown = new Queryable(
MarkdownTableElement.class);
private boolean fixedWidth = true;
private MarkdownColumn columnProperties = MarkdownColumn.DEFAULT;
public void setColumnsConsistentWidth(boolean setting)
{
fixedWidth = setting;
}
public static MarkdownTable create(I[] inputs, Function1 o, String column1, String column2)
{
MarkdownTable table = new MarkdownTable().withColumnHeaders(column1, column2);
for (I input : inputs)
{
table.addRow(input, o.call(input));
}
return table;
}
public static MarkdownTable withHeaders(String... columnNames)
{
MarkdownTable table = new MarkdownTable();
return table.withColumnHeaders(columnNames);
}
public MarkdownTable addRowsForInputs(I[] inputs, Function1... transfers)
{
for (I input : inputs)
{
Queryable