Skip to content

Commit

Permalink
Added new python string builder class
Browse files Browse the repository at this point in the history
  • Loading branch information
ncguilbeault committed Jul 10, 2024
1 parent a3f54a1 commit 5ee0ec0
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/Bonsai.ML.HiddenMarkovModels/PythonStringBuilder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System;
using System.Text;

namespace Bonsai.ML.HiddenMarkovModels
{
public abstract class PythonStringBuilder
{

private string _cachedString;
private bool _updateString;
protected readonly StringBuilder StringBuilder = new StringBuilder();

protected void UpdateString()
{
_updateString = true;
}

protected virtual string BuildString()
{
return StringBuilder.ToString();
}

public override string ToString()
{
if (_updateString)
{
_cachedString = BuildString();
_updateString = false;
}
return _cachedString;
}
}
}


0 comments on commit 5ee0ec0

Please sign in to comment.