Package adams.core.option
Class FlowStructureGraphMLProducer
- 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.FlowStructureGraphMLProducer
-
- All Implemented Interfaces:
CleanUpHandler,Destroyable,FileFormatHandler,LoggingSupporter,OptionHandler,OptionProducer<String,String>,OptionProducerWithOptionHandling<String,String>,RecursiveOptionProducer,SizeOfHandler,Serializable
public class FlowStructureGraphMLProducer extends AbstractRecursiveOptionProducerWithOptionHandling<String,String> implements FileFormatHandler
Outputs the flow structure in GraphML XML 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 intm_EdgeCounterthe counter for the edges.protected booleanm_LinkCallableActorswhether to link to callable actors.protected Hashtable<String,String>m_NameIDRelationthe actor name - ID relation.protected intm_NodeCounterthe counter for the nodes.protected StringBuilderm_OutputBufferfor storing the generating string.protected booleanm_OutputClassnamewhether to display the class name as well in the label.protected booleanm_OutputYEdGraphMLwhether to output yEd GraphML.-
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 FlowStructureGraphMLProducer()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddEdge(String from, String to)Adds an edge.protected StringaddNode(Actor actor)Adds the actor as node.protected voidaddNode(String id, String label)Adds a node.protected StringaddVariableNode(String variable)Adds the actor as node (actor is represented by the variable).protected OptionHandlercheckInput(OptionHandler object)Makes sure that the input is an Actor object.voiddefineOptions()Adds options to the internal list of options.StringgetDefaultFormatExtension()Returns the default file extension (without the dot).StringgetFormatDescription()Returns the description of the file format.String[]getFormatExtensions()Returns the file extensions (without the dot).booleangetLinkCallableActors()Returns whether to output the links to global actors as well.StringgetOutput()Returns the output generated from the visit.booleangetOutputClassname()Returns whether to add the classnames to the labels.booleangetOutputYEdGraphML()Returns whether to output yEd GraphML.StringglobalInfo()Returns a string describing the object.protected voidinitialize()Initializes the members.protected StringinitOutput()Initializes the output data structure.StringlinkCallableActorsTipText()Returns the tip text for this property.static voidmain(String[] args)Executes the producer from commandline.protected StringnextEdgeID()Returns the next edge ID.protected StringnextNodeID()Returns the next node ID.StringoutputClassnameTipText()Returns the tip text for this property.StringoutputVariableValuesTipText()Returns the tip text for this property.StringoutputYEdGraphMLTipText()Returns the tip text for this property.protected voidpostProduce()Hook-method after visiting options.protected voidpreProduce()Hook-method before starting visiting options.StringprocessOption(AbstractArgumentOption option)Visits an argument option.StringprocessOption(BooleanOption option)Visits a boolean option.StringprocessOption(ClassOption option)Visits a class option.protected Stringsanitize(String label)Sanitizes the label.voidsetLinkCallableActors(boolean value)Sets whether to output the links to callable actors as well.voidsetOutputClassname(boolean value)Sets whether to output the classnames in the labels.voidsetOutputYEdGraphML(boolean value)Sets whether to output yEd GraphML.StringtoString()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_OutputYEdGraphML
protected boolean m_OutputYEdGraphML
whether to output yEd GraphML.
-
m_OutputBuffer
protected StringBuilder m_OutputBuffer
for storing the generating string.
-
m_NodeCounter
protected int m_NodeCounter
the counter for the nodes.
-
m_EdgeCounter
protected int m_EdgeCounter
the counter for the edges.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceOptionProducer<String,String>- Specified by:
globalInfoin classAbstractOptionProducer<String,String>- Returns:
- a description suitable for displaying in the gui
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein 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:
defineOptionsin interfaceOptionHandler- Specified by:
defineOptionsin interfaceOptionProducerWithOptionHandling<String,String>- Overrides:
defineOptionsin classAbstractRecursiveOptionProducerWithOptionHandling<String,String>
-
initOutput
protected String initOutput()
Initializes the output data structure.- Specified by:
initOutputin classAbstractOptionProducer<String,String>- Returns:
- the created data structure
-
outputVariableValuesTipText
public String outputVariableValuesTipText()
Returns the tip text for this property.- Specified by:
outputVariableValuesTipTextin interfaceOptionProducer<String,String>- Overrides:
outputVariableValuesTipTextin 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 global actors as well.- Returns:
- true if the links to global 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.
-
setOutputYEdGraphML
public void setOutputYEdGraphML(boolean value)
Sets whether to output yEd GraphML.- Parameters:
value- if true then yEd Graphml is produced
-
getOutputYEdGraphML
public boolean getOutputYEdGraphML()
Returns whether to output yEd GraphML.- Returns:
- true if to output yEd GraphML
-
outputYEdGraphMLTipText
public String outputYEdGraphMLTipText()
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:
processOptionin interfaceOptionProducer<String,String>- Specified by:
processOptionin classAbstractOptionProducer<String,String>- Parameters:
option- the boolean option- Returns:
- always null
-
nextNodeID
protected String nextNodeID()
Returns the next node ID.- Returns:
- the node ID
-
nextEdgeID
protected String nextEdgeID()
Returns the next edge ID.- Returns:
- the edge 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 String addNode(Actor actor)
Adds the actor as node.- Parameters:
actor- the actor to add as node- 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:
variable- the variable representing the acto- Returns:
- the ID used for the node
-
processOption
public String processOption(ClassOption option)
Visits a class option.- Specified by:
processOptionin interfaceOptionProducer<String,String>- Specified by:
processOptionin 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:
processOptionin interfaceOptionProducer<String,String>- Specified by:
processOptionin 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:
checkInputin classAbstractOptionProducer<String,String>- Parameters:
object- the objec to check- Returns:
- the checked object
-
preProduce
protected void preProduce()
Hook-method before starting visiting options.- Overrides:
preProducein classAbstractOptionProducer<String,String>- See Also:
AbstractOptionProducer.initOutput()
-
postProduce
protected void postProduce()
Hook-method after visiting options.- Overrides:
postProducein classAbstractOptionProducer<String,String>
-
getOutput
public String getOutput()
Returns the output generated from the visit.- Specified by:
getOutputin interfaceOptionProducer<String,String>- Overrides:
getOutputin classAbstractOptionProducer<String,String>- Returns:
- the output
- See Also:
AbstractOptionProducer.initOutput()
-
toString
public String toString()
Returns the output generated from the visit.- Specified by:
toStringin interfaceOptionProducer<String,String>- Specified by:
toStringin 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:
getFormatDescriptionin interfaceFileFormatHandler- Returns:
- the description
-
getDefaultFormatExtension
public String getDefaultFormatExtension()
Returns the default file extension (without the dot).- Specified by:
getDefaultFormatExtensionin interfaceFileFormatHandler- Returns:
- the default extension
-
getFormatExtensions
public String[] getFormatExtensions()
Returns the file extensions (without the dot).- Specified by:
getFormatExtensionsin 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
-
-