Package view.output
Class SimpleFileWriter
java.lang.Object
view.output.SimpleFileWriter
- All Implemented Interfaces:
IDescriptor
,IOutput
public class SimpleFileWriter extends java.lang.Object implements IOutput
SimpleFileWriter class implements
IOutput
. Output module to
print composite structure with visualized depth level of hierarchy to a file.-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
DESCRIPTION
private java.io.File
file
private FileWriterWrapper
fw
private static java.lang.String
NAME
-
Constructor Summary
Constructors Constructor Description SimpleFileWriter()
The default constructor is mentioned explicitly because a modified constructor is required for the tests.SimpleFileWriter(java.io.File f)
Modified constructor for testing which takes a file. -
Method Summary
Modifier and Type Method Description java.lang.String
getDescription()
Returns description of implemented module.java.lang.String
getName()
Returns decent name of class.void
output(CompositeContainer container)
Outputs the contents of the composite structureprivate void
printCompositum(CompositeContainer c, int level)
Forms the output and writes it to the text filevoid
reset()
Resets the Output module object to its initial state.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
NAME
private static final java.lang.String NAME- See Also:
- Constant Field Values
-
DESCRIPTION
private static final java.lang.String DESCRIPTION- See Also:
- Constant Field Values
-
file
private java.io.File file -
fw
-
-
Constructor Details
-
SimpleFileWriter
public SimpleFileWriter()The default constructor is mentioned explicitly because a modified constructor is required for the tests. -
SimpleFileWriter
public SimpleFileWriter(java.io.File f)Modified constructor for testing which takes a file.- Parameters:
f
-File
-
-
Method Details
-
output
Description copied from interface:IOutput
Outputs the contents of the composite structure -
printCompositum
Forms the output and writes it to the text file- Parameters:
c
- container Root container of the composite Structurelevel
- depth level of hierarchy
-
getName
public java.lang.String getName()Description copied from interface:IDescriptor
Returns decent name of class.- Specified by:
getName
in interfaceIDescriptor
- Returns:
- Decent name of class
-
getDescription
public java.lang.String getDescription()Description copied from interface:IDescriptor
Returns description of implemented module.- Specified by:
getDescription
in interfaceIDescriptor
- Returns:
- Description
-
reset
public void reset()Description copied from interface:IOutput
Resets the Output module object to its initial state.
-