Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved formating state to the base class #474

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Stateless/Graph/GraphStyleBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ public abstract class GraphStyleBase
/// <returns></returns>
public abstract string FormatOneDecisionNode(string nodeName, string label);

/// <summary>
/// Returns the formatted text for a initial state.
/// </summary>
/// <param name="initialStateName"></param>
/// <returns></returns>
public abstract string FormatInitialState(string initialStateName);

/// <summary>
/// Returns the formatted text for all the transitions found in the state graph.
/// This form, which can be overridden, determines the type of each transition and passes the appropriate
Expand Down
15 changes: 15 additions & 0 deletions src/Stateless/Graph/UmlDotGraphStyle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,20 @@ internal string FormatOneLine(string fromNodeName, string toNodeName, string lab
{
return $"\"{fromNodeName}\" -> \"{toNodeName}\" [style=\"solid\", label=\"{label}\"];";
}

/// <summary>
/// Generate the text for a initial state
/// </summary>
/// <param name="initialStateName">Name of state</param>
/// <returns></returns>
public override string FormatInitialState(string initialStateName)
{
string f = System.Environment.NewLine + $" init [label=\"\", shape=point];";
f += System.Environment.NewLine + $" init -> \"{initialStateName}\"[style = \"solid\"]";

f += System.Environment.NewLine + "}";

return f;
}
}
}