Package adams.data.io.input
Class PascalVOCObjectLocationsReader
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.io.input.AbstractReportReader<Report>
-
- adams.data.io.input.PascalVOCObjectLocationsReader
-
- All Implemented Interfaces:
CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,FileFormatHandler
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,ShallowCopySupporter<AbstractReportReader>
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,ReportReader<Report>
,ObjectPrefixHandler
,Serializable
,Comparable
public class PascalVOCObjectLocationsReader extends AbstractReportReader<Report> implements ObjectPrefixHandler
Reads object locations in Pascal VOC format.
See more:
https://github.com/WaikatoLink2020/objdet-predictions-exchange-format
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-input <adams.core.io.PlaceholderFile> (property: input) The file to read and turn into a report. default: ${CWD}
-id <adams.data.report.Field> (property: ID) The field to use for storing the ID. default: ID[S]
-timestamp <adams.data.report.Field> (property: timestamp) The field to use for storing the timestamp. default: Timestamp[S]
-prefix <java.lang.String> (property: prefix) The report field prefix used in the report for the objects. default: Object.
-label-suffix <java.lang.String> (property: labelSuffix) The suffix to use in the report for labels. default: type
-meta-prefix <java.lang.String> (property: metaPrefix) The report field prefix used in the report for the meta-data. default: Meta.
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Field
m_ID
the field to use for the ID.protected String
m_LabelSuffix
the label suffix to use.protected String
m_MetaPrefix
the prefix for the meta-data.protected String
m_Prefix
the prefix to use for objects.protected Field
m_Timestamp
the field to use for the timestamp.-
Fields inherited from class adams.data.io.input.AbstractReportReader
m_Input, m_Stopped
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description PascalVOCObjectLocationsReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
addBoolean(Report report, String name, Boolean value)
Adds the boolean value to the report.protected boolean
addNumeric(Report report, String name, String value)
Adds the numeric value to the report.protected boolean
addString(Report report, String name, String value)
Adds the string value to the report.void
defineOptions()
Adds options to the internal list of options.protected int
determineParentID(Report report)
Tries to determine the parent ID for the current report.String
getFormatDescription()
Returns a string describing the format (used in the file chooser).String[]
getFormatExtensions()
Returns the extension(s) of the format.Field
getID()
Returns the field to use for the ID.String
getLabelSuffix()
Returns the field suffix used in the report for labels.String
getMetaPrefix()
Returns the field prefix used in the report for the meta-data.protected Element
getNode(Document dom, String tag)
Returns the (first) node.protected String
getNodeText(Document dom, String tag)
Returns the node's text.String
getPrefix()
Returns the field prefix used in the report for the objects.protected Element
getSubNode(Element parent, String tag)
Returns the node from the specified sub-node.protected String
getSubNodeText(Element parent, String tag)
Returns the node text from the specified sub-node.Field
getTimestamp()
Returns the field to use for the timestamp.String
globalInfo()
Returns a string describing the object.String
IDTipText()
Returns the tip text for this property.String
labelSuffixTipText()
Returns the tip text for this property.String
metaPrefixTipText()
Returns the tip text for this property.Report
newInstance()
Returns a new instance of the report class in use.String
prefixTipText()
Returns the tip text for this property.protected List<Report>
readData()
Performs the actual reading.void
setID(Field value)
Sets the field to use for the ID.void
setLabelSuffix(String value)
Sets the field suffix used in the report for labels.void
setMetaPrefix(String value)
Sets the field prefix used in the report for the meta-data.void
setPrefix(String value)
Sets the field prefix used in the report for the objects.void
setTimestamp(Field value)
Sets the field to use for the timestamp.String
timestampTipText()
Returns the tip text for this property.-
Methods inherited from class adams.data.io.input.AbstractReportReader
checkData, cleanUp, compareTo, destroy, equals, forCommandLine, forName, getDefaultFormatExtension, getInput, getReaders, inputTipText, isStopped, postRead, read, reset, setInput, shallowCopy, shallowCopy, stopExecution
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_ID
protected Field m_ID
the field to use for the ID.
-
m_Timestamp
protected Field m_Timestamp
the field to use for the timestamp.
-
m_Prefix
protected String m_Prefix
the prefix to use for objects.
-
m_LabelSuffix
protected String m_LabelSuffix
the label suffix to use.
-
m_MetaPrefix
protected String m_MetaPrefix
the prefix for the meta-data.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractReportReader<Report>
-
setID
public void setID(Field value)
Sets the field to use for the ID.- Parameters:
value
- the field
-
getID
public Field getID()
Returns the field to use for the ID.- Returns:
- the field
-
IDTipText
public String IDTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setTimestamp
public void setTimestamp(Field value)
Sets the field to use for the timestamp.- Parameters:
value
- the field
-
getTimestamp
public Field getTimestamp()
Returns the field to use for the timestamp.- Returns:
- the field
-
timestampTipText
public String timestampTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setPrefix
public void setPrefix(String value)
Sets the field prefix used in the report for the objects.- Specified by:
setPrefix
in interfaceObjectPrefixHandler
- Parameters:
value
- the field prefix
-
getPrefix
public String getPrefix()
Returns the field prefix used in the report for the objects.- Specified by:
getPrefix
in interfaceObjectPrefixHandler
- Returns:
- the field prefix
-
prefixTipText
public String prefixTipText()
Returns the tip text for this property.- Specified by:
prefixTipText
in interfaceObjectPrefixHandler
- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLabelSuffix
public void setLabelSuffix(String value)
Sets the field suffix used in the report for labels.- Parameters:
value
- the field suffix
-
getLabelSuffix
public String getLabelSuffix()
Returns the field suffix used in the report for labels.- Returns:
- the field suffix
-
labelSuffixTipText
public String labelSuffixTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setMetaPrefix
public void setMetaPrefix(String value)
Sets the field prefix used in the report for the meta-data.- Parameters:
value
- the field prefix
-
getMetaPrefix
public String getMetaPrefix()
Returns the field prefix used in the report for the meta-data.- Returns:
- the field prefix
-
metaPrefixTipText
public String metaPrefixTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getFormatDescription
public String getFormatDescription()
Returns a string describing the format (used in the file chooser).- Specified by:
getFormatDescription
in interfaceFileFormatHandler
- Specified by:
getFormatDescription
in classAbstractReportReader<Report>
- Returns:
- a description suitable for displaying in the file chooser
-
getFormatExtensions
public String[] getFormatExtensions()
Returns the extension(s) of the format.- Specified by:
getFormatExtensions
in interfaceFileFormatHandler
- Specified by:
getFormatExtensions
in classAbstractReportReader<Report>
- Returns:
- the extension(s) (without the dot!)
-
determineParentID
protected int determineParentID(Report report)
Tries to determine the parent ID for the current report.- Specified by:
determineParentID
in classAbstractReportReader<Report>
- Parameters:
report
- the report to determine the ID for- Returns:
- the parent database ID, -1 if it cannot be determined
-
newInstance
public Report newInstance()
Returns a new instance of the report class in use.- Specified by:
newInstance
in classAbstractReportReader<Report>
- Returns:
- the new (empty) report
-
getNode
protected Element getNode(Document dom, String tag)
Returns the (first) node.- Parameters:
dom
- the document to look for tag (picks first)tag
- the tag name- Returns:
- the node, null if not found
-
getNodeText
protected String getNodeText(Document dom, String tag)
Returns the node's text.- Parameters:
dom
- the document to look for tag (picks first)tag
- the tag name- Returns:
- the text, null if not found
-
getSubNode
protected Element getSubNode(Element parent, String tag)
Returns the node from the specified sub-node.- Parameters:
parent
- the node to start fromtag
- the sub-node tag to look for- Returns:
- the sub-node, null if not found
-
getSubNodeText
protected String getSubNodeText(Element parent, String tag)
Returns the node text from the specified sub-node.- Parameters:
parent
- the node to start fromtag
- the sub-node tag to look for- Returns:
- the text, null if not found
-
addString
protected boolean addString(Report report, String name, String value)
Adds the string value to the report.- Parameters:
report
- the report to updatename
- the name of the fieldvalue
- the string value- Returns:
- whether successfully added
-
addNumeric
protected boolean addNumeric(Report report, String name, String value)
Adds the numeric value to the report.- Parameters:
report
- the report to updatename
- the name of the fieldvalue
- the numeric value- Returns:
- whether successfully added
-
addBoolean
protected boolean addBoolean(Report report, String name, Boolean value)
Adds the boolean value to the report.- Parameters:
report
- the report to updatename
- the name of the fieldvalue
- the numeric value- Returns:
- whether successfully added
-
readData
protected List<Report> readData()
Performs the actual reading.- Specified by:
readData
in classAbstractReportReader<Report>
- Returns:
- the reports that were read
-
-