public class TextWriter extends Object
Modifier and Type | Field and Description |
---|---|
static String |
FILE_EXTENSION
Extension for txt-files.
|
protected Map<String,Object> |
filenames
For producing unique filenames.
|
static HandlerList<TextWriterWriterInterface<?>> |
writers
Hash map for supported classes in writer.
|
Constructor and Description |
---|
TextWriter() |
Modifier and Type | Method and Description |
---|---|
private String |
filenameFromLabel(String label)
Derive a file name from the cluster label.
|
protected String |
getFilename(Object result,
String filenamepre)
Try to find a unique file name.
|
void |
output(Database db,
Result r,
StreamFactory streamOpener,
Pattern filter)
Stream output.
|
private void |
printObject(TextWriterStream out,
Database db,
DBIDRef objID,
List<Relation<?>> ra) |
private void |
writeClusterResult(Database db,
StreamFactory streamOpener,
Clustering<Model> clustering,
Cluster<Model> clus,
List<Relation<?>> ra,
NamingScheme naming) |
private void |
writeIterableResult(StreamFactory streamOpener,
IterableResult<?> ri) |
private void |
writeOrderingResult(Database db,
StreamFactory streamOpener,
OrderingResult or,
List<Relation<?>> ra) |
private void |
writeOtherResult(StreamFactory streamOpener,
Result r) |
private void |
writeSettingsResult(StreamFactory streamOpener,
List<SettingsResult> rs) |
public static final String FILE_EXTENSION
public static final HandlerList<TextWriterWriterInterface<?>> writers
protected String getFilename(Object result, String filenamepre)
result
- Result we printfilenamepre
- File name prefix to usepublic void output(Database db, Result r, StreamFactory streamOpener, Pattern filter) throws UnableToComplyException, IOException
db
- Database objectr
- Result classstreamOpener
- output stream managerfilter
- Filter patternUnableToComplyException
- when no usable results were foundIOException
- on IO errorprivate void printObject(TextWriterStream out, Database db, DBIDRef objID, List<Relation<?>> ra) throws UnableToComplyException, IOException
UnableToComplyException
IOException
private void writeClusterResult(Database db, StreamFactory streamOpener, Clustering<Model> clustering, Cluster<Model> clus, List<Relation<?>> ra, NamingScheme naming) throws FileNotFoundException, UnableToComplyException, IOException
private void writeIterableResult(StreamFactory streamOpener, IterableResult<?> ri) throws UnableToComplyException, IOException
UnableToComplyException
IOException
private void writeOrderingResult(Database db, StreamFactory streamOpener, OrderingResult or, List<Relation<?>> ra) throws IOException, UnableToComplyException
IOException
UnableToComplyException
private void writeSettingsResult(StreamFactory streamOpener, List<SettingsResult> rs) throws UnableToComplyException, IOException
UnableToComplyException
IOException
private void writeOtherResult(StreamFactory streamOpener, Result r) throws UnableToComplyException, IOException
UnableToComplyException
IOException