All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.daisy.dotify.cli.pefinfo.PEFBookInfo Maven / Gradle / Ivy

There is a newer version: 3.2.5
Show newest version
package org.daisy.dotify.cli.pefinfo;

import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;

import org.daisy.braille.utils.pef.PEFBook;

public class PEFBookInfo {	

	private final List infos;
	
	public PEFBookInfo() {
		this(DetailSet.DEFAULT);
	}
	
	public PEFBookInfo(DetailSet set) {
		this(set.newDetailSet());
	}
	
	public PEFBookInfo(Detail ... data) {
		this(Arrays.asList(data));
	}
	
	public PEFBookInfo(Collection data) {
		infos = new ArrayList<>(data);
	}

	public void print(PEFBook book, PrintStream ps) {
		for (Detail i : infos) {
			printIterable(ps, i.getTitle(), i.getDetails(book));
		}
	}
	
	private void printIterable(PrintStream ps, String title, Iterable items) {
		if (items==null) {
			return;
		} else {
			ps.println(title);
			for (String s : items) {
				ps.println("\t" +s);
			}
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy