Package adams.core.option
Class FlowStructureDotProducer
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.option.AbstractOptionProducer<O,I>
-
- adams.core.option.AbstractRecursiveOptionProducer<O,I>
-
- adams.core.option.AbstractRecursiveOptionProducerWithOptionHandling<String,String>
-
- adams.core.option.FlowStructureDotProducer
-
- All Implemented Interfaces:
CleanUpHandler
,Destroyable
,FileFormatHandler
,LoggingSupporter
,OptionHandler
,OptionProducer<String,String>
,OptionProducerWithOptionHandling<String,String>
,RecursiveOptionProducer
,SizeOfHandler
,Serializable
public class FlowStructureDotProducer extends AbstractRecursiveOptionProducerWithOptionHandling<String,String> implements FileFormatHandler
Outputs the flow structure in DOT (GraphViz) format.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
m_Counter
the counter for the nodes.protected boolean
m_LinkCallableActors
whether to link to callable actors.protected Hashtable<String,String>
m_NameIDRelation
the actor name - ID relation.protected StringBuilder
m_OutputBuffer
for storing the generating string.protected boolean
m_OutputClassname
whether to display the class name as well in the label.-
Fields inherited from class adams.core.option.AbstractRecursiveOptionProducerWithOptionHandling
m_OptionManager
-
Fields inherited from class adams.core.option.AbstractRecursiveOptionProducer
m_Nesting
-
Fields inherited from class adams.core.option.AbstractOptionProducer
m_Input, m_LastGenerated, m_Output, m_OutputVariableValues, m_SkippedProperties, m_UsePropertyNames
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description FlowStructureDotProducer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addEdge(String from, String to)
Adds an edge.protected String
addNode(Actor actor)
Adds the actor as node.protected String
addNode(Actor actor, String shape, String style)
Adds the actor as node.protected void
addNode(String id, String label)
Adds a node.protected void
addNode(String id, String label, String shape, String style)
Adds a node.protected String
addVariableNode(String variable)
Adds the actor as node (actor is represented by the variable).protected OptionHandler
checkInput(OptionHandler object)
Makes sure that the input is an Actor object.void
defineOptions()
Adds options to the internal list of options.String
getDefaultFormatExtension()
Returns the default file extension (without the dot).String
getFormatDescription()
Returns the description of the file format.String[]
getFormatExtensions()
Returns the file extensions (without the dot).boolean
getLinkCallableActors()
Returns whether to output the links to callable actors as well.String
getOutput()
Returns the output generated from the visit.boolean
getOutputClassname()
Returns whether to add the classnames to the labels.String
globalInfo()
Returns a string describing the object.protected void
initialize()
Initializes the members.protected String
initOutput()
Initializes the output data structure.String
linkCallableActorsTipText()
Returns the tip text for this property.static void
main(String[] args)
Executes the producer from commandline.protected String
nextNodeID()
Returns the next node ID.String
outputClassnameTipText()
Returns the tip text for this property.String
outputVariableValuesTipText()
Returns the tip text for this property.protected void
postProduce()
Hook-method after visiting options.protected void
preProduce()
Hook-method before starting visiting options.String
processOption(AbstractArgumentOption option)
Visits an argument option.String
processOption(BooleanOption option)
Visits a boolean option.String
processOption(ClassOption option)
Visits a class option.protected String
sanitize(String label)
Sanitizes the label.void
setLinkCallableActors(boolean value)
Sets whether to output the links to callable actors as well.void
setOutputClassname(boolean value)
Sets whether to output the classnames in the labels.String
toString()
Returns the output generated from the visit.-
Methods inherited from class adams.core.option.AbstractRecursiveOptionProducerWithOptionHandling
cleanUpOptions, destroy, finishInit, getOptionManager, newOptionManager, toCommandLine
-
Methods inherited from class adams.core.option.AbstractRecursiveOptionProducer
cleanUp, generateLoggingString, getDebugIndentation, getDebugIndentation, getRecursionLevel, reset
-
Methods inherited from class adams.core.option.AbstractOptionProducer
doProduce, doProduce, getCurrentValue, getInput, getOptionIdentifier, getOutputVariableValues, getSkippedProperties, getUsePropertyNames, isDefaultValue, loggingLevelTipText, postProduce, preProduce, produce, produce, runProducer, setLoggingLevel, setOutputVariableValues, setSkippedProperties, toString, write
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.option.OptionProducer
cleanUp, doProduce, getInput, getLoggingLevel, getOutputVariableValues, getSkippedProperties, getUsePropertyNames, loggingLevelTipText, produce, setLoggingLevel, setOutputVariableValues, setSkippedProperties, write
-
-
-
-
Field Detail
-
m_OutputClassname
protected boolean m_OutputClassname
whether to display the class name as well in the label.
-
m_LinkCallableActors
protected boolean m_LinkCallableActors
whether to link to callable actors.
-
m_OutputBuffer
protected StringBuilder m_OutputBuffer
for storing the generating string.
-
m_Counter
protected int m_Counter
the counter for the nodes.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceOptionProducer<String,String>
- Specified by:
globalInfo
in classAbstractOptionProducer<String,String>
- Returns:
- a description suitable for displaying in the gui
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractOptionProducer<String,String>
-
defineOptions
public void defineOptions()
Adds options to the internal list of options. Derived classes must override this method to add additional options.- Specified by:
defineOptions
in interfaceOptionHandler
- Specified by:
defineOptions
in interfaceOptionProducerWithOptionHandling<String,String>
- Overrides:
defineOptions
in classAbstractRecursiveOptionProducerWithOptionHandling<String,String>
-
initOutput
protected String initOutput()
Initializes the output data structure.- Specified by:
initOutput
in classAbstractOptionProducer<String,String>
- Returns:
- the created data structure
-
outputVariableValuesTipText
public String outputVariableValuesTipText()
Returns the tip text for this property.- Specified by:
outputVariableValuesTipText
in interfaceOptionProducer<String,String>
- Overrides:
outputVariableValuesTipText
in classAbstractOptionProducer<String,String>
- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setOutputClassname
public void setOutputClassname(boolean value)
Sets whether to output the classnames in the labels.- Parameters:
value
- if true then the classnames are added to the labels
-
getOutputClassname
public boolean getOutputClassname()
Returns whether to add the classnames to the labels.- Returns:
- true if the classnames are added
-
outputClassnameTipText
public String outputClassnameTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLinkCallableActors
public void setLinkCallableActors(boolean value)
Sets whether to output the links to callable actors as well.- Parameters:
value
- if true then the links to callable actors are output as well
-
getLinkCallableActors
public boolean getLinkCallableActors()
Returns whether to output the links to callable actors as well.- Returns:
- true if the links to callable actors are output as well
-
linkCallableActorsTipText
public String linkCallableActorsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
processOption
public String processOption(BooleanOption option)
Visits a boolean option. Does nothing.- Specified by:
processOption
in interfaceOptionProducer<String,String>
- Specified by:
processOption
in classAbstractOptionProducer<String,String>
- Parameters:
option
- the boolean option- Returns:
- always null
-
nextNodeID
protected String nextNodeID()
Returns the next node ID.- Returns:
- the node ID
-
addEdge
protected void addEdge(String from, String to)
Adds an edge.- Parameters:
from
- the "from" IDto
- the "to" ID
-
sanitize
protected String sanitize(String label)
Sanitizes the label.- Parameters:
label
- the label to process- Returns:
- the processed label
-
addNode
protected void addNode(String id, String label)
Adds a node.- Parameters:
id
- the ID of the nodelabel
- the option label of the node, use null to omit
-
addNode
protected void addNode(String id, String label, String shape, String style)
Adds a node.- Parameters:
id
- the ID of the nodelabel
- the option label of the node, use null to omitshape
- the shape of the nodestyle
- the style of the shape, null to omit
-
addNode
protected String addNode(Actor actor)
Adds the actor as node.- Parameters:
actor
- the actor to add as node- Returns:
- the ID used for the node
-
addNode
protected String addNode(Actor actor, String shape, String style)
Adds the actor as node.- Parameters:
actor
- the actor to add as nodeshape
- the shape of the node, null to ignorestyle
- the style of the node, null to ignore- Returns:
- the ID used for the node
-
addVariableNode
protected String addVariableNode(String variable)
Adds the actor as node (actor is represented by the variable).- Parameters:
actor
- the actor to add as nodevariable
- the variable representing the acto- Returns:
- the ID used for the node
-
processOption
public String processOption(ClassOption option)
Visits a class option.- Specified by:
processOption
in interfaceOptionProducer<String,String>
- Specified by:
processOption
in classAbstractOptionProducer<String,String>
- Parameters:
option
- the class option- Returns:
- always null
-
processOption
public String processOption(AbstractArgumentOption option)
Visits an argument option. Does nothing.- Specified by:
processOption
in interfaceOptionProducer<String,String>
- Specified by:
processOption
in classAbstractOptionProducer<String,String>
- Parameters:
option
- the argument option- Returns:
- always null
-
checkInput
protected OptionHandler checkInput(OptionHandler object)
Makes sure that the input is an Actor object.- Overrides:
checkInput
in classAbstractOptionProducer<String,String>
- Parameters:
object
- the objec to check- Returns:
- the checked object
-
preProduce
protected void preProduce()
Hook-method before starting visiting options.- Overrides:
preProduce
in classAbstractOptionProducer<String,String>
- See Also:
AbstractOptionProducer.initOutput()
-
postProduce
protected void postProduce()
Hook-method after visiting options.- Overrides:
postProduce
in classAbstractOptionProducer<String,String>
-
getOutput
public String getOutput()
Returns the output generated from the visit.- Specified by:
getOutput
in interfaceOptionProducer<String,String>
- Overrides:
getOutput
in classAbstractOptionProducer<String,String>
- Returns:
- the output
- See Also:
AbstractOptionProducer.initOutput()
-
toString
public String toString()
Returns the output generated from the visit.- Specified by:
toString
in interfaceOptionProducer<String,String>
- Specified by:
toString
in classAbstractOptionProducer<String,String>
- Returns:
- the output, null in case of an error
-
getFormatDescription
public String getFormatDescription()
Returns the description of the file format.- Specified by:
getFormatDescription
in interfaceFileFormatHandler
- Returns:
- the description
-
getDefaultFormatExtension
public String getDefaultFormatExtension()
Returns the default file extension (without the dot).- Specified by:
getDefaultFormatExtension
in interfaceFileFormatHandler
- Returns:
- the default extension
-
getFormatExtensions
public String[] getFormatExtensions()
Returns the file extensions (without the dot).- Specified by:
getFormatExtensions
in interfaceFileFormatHandler
- Returns:
- the extensions
-
main
public static void main(String[] args)
Executes the producer from commandline.- Parameters:
args
- the commandline arguments, use -help for help
-
-