Package cz.vutbr.fit.layout.io
Class JSONOutputOperator
- java.lang.Object
-
- cz.vutbr.fit.layout.impl.BaseService
-
- cz.vutbr.fit.layout.impl.BaseParametrizedOperation
-
- cz.vutbr.fit.layout.impl.BaseOperator
-
- cz.vutbr.fit.layout.io.JSONOutputOperator
-
- All Implemented Interfaces:
AreaTreeOperator,ParametrizedOperation,Service
public class JSONOutputOperator extends BaseOperator
This operator serializes the area tree to a JSON file.- Author:
- Josef Katrnak, burgetr
-
-
Constructor Summary
Constructors Constructor Description JSONOutputOperator()JSONOutputOperator(String filename)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapply(AreaTree atree)voidapply(AreaTree atree, Area root)List<Parameter>defineParams()voiddumpTo(AreaTree atree, PrintWriter writer)Dumps input AreTree to JSON.voiddumpTo(Page page, PrintWriter writer)Dumps a Page to JSON.StringgetCategory()StringgetDescription()StringgetFilename()StringgetId()intgetLabelCount()StringgetName()doublegetSuccessRate()Calculates successfully pages (pages with name and price).voidsetFilename(String filename)-
Methods inherited from class cz.vutbr.fit.layout.impl.BaseOperator
toString
-
Methods inherited from class cz.vutbr.fit.layout.impl.BaseParametrizedOperation
getParam, getParams, getParamString, setParam
-
Methods inherited from class cz.vutbr.fit.layout.impl.BaseService
getServiceManager, setServiceManager
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface cz.vutbr.fit.layout.api.ParametrizedOperation
getParam, getParams, getParamString, setParam
-
Methods inherited from interface cz.vutbr.fit.layout.api.Service
setServiceManager
-
-
-
-
Field Detail
-
filename
protected String filename
Path to the output file/
-
-
Constructor Detail
-
JSONOutputOperator
public JSONOutputOperator()
-
JSONOutputOperator
public JSONOutputOperator(String filename)
-
-
Method Detail
-
getId
public String getId()
-
getName
public String getName()
-
getDescription
public String getDescription()
-
getCategory
public String getCategory()
-
defineParams
public List<Parameter> defineParams()
- Overrides:
defineParamsin classBaseParametrizedOperation
-
getFilename
public String getFilename()
-
setFilename
public void setFilename(String filename)
-
apply
public void apply(AreaTree atree)
-
dumpTo
public void dumpTo(AreaTree atree, PrintWriter writer)
Dumps input AreTree to JSON.- Parameters:
atree- input area treewriter- output writer
-
dumpTo
public void dumpTo(Page page, PrintWriter writer)
Dumps a Page to JSON.- Parameters:
atree- input area treewriter- output writer
-
getSuccessRate
public double getSuccessRate()
Calculates successfully pages (pages with name and price).- Returns:
- Percentage of success
-
getLabelCount
public int getLabelCount()
-
-