Class AlgorithmExtensions
Extension methods to the IAlgorithm interface
public static class AlgorithmExtensions
- Inheritance
-
AlgorithmExtensions
- Inherited Members
Methods
Clear(IAlgorithm)
Clear the algorithm
public static void Clear(this IAlgorithm algorithm)
Parameters
algorithm
IAlgorithmThe algorithm
GetDefaultName(IAlgorithm)
Returns the algorithm string identifier. This string is used as top level xml/yml node tag when the object is saved to a file or string.
public static string GetDefaultName(this IAlgorithm algorithm)
Parameters
algorithm
IAlgorithmThe algorithm
Returns
- string
Returns the algorithm string identifier. This string is used as top level xml/yml node tag when the object is saved to a file or string.
IsEmpty(IAlgorithm)
Returns true if the Algorithm is empty. e.g. in the very beginning or after unsuccessful read.
public static bool IsEmpty(this IAlgorithm algorithm)
Parameters
algorithm
IAlgorithmThe algorithm
Returns
- bool
Returns true if the Algorithm is empty. e.g. in the very beginning or after unsuccessful read.
Load(IAlgorithm, string, string, string)
Loads algorithm from the file
public static void Load(this IAlgorithm algorithm, string fileName, string objName = null, string encoding = null)
Parameters
algorithm
IAlgorithmThe algorithm
fileName
stringName of the file to read.
objName
stringThe optional name of the node to read (if empty, the first top-level node will be used)
encoding
stringEncoding of the file. Note that UTF-16 XML encoding is not supported currently and you should use 8-bit encoding instead of it.
LoadFromString(IAlgorithm, string, string, string)
Loads algorithm from a String
public static void LoadFromString(this IAlgorithm algorithm, string strModel, string objName = null, string encoding = null)
Parameters
algorithm
IAlgorithmThe algorithm
strModel
stringThe string variable containing the model you want to load.
objName
stringThe optional name of the node to read (if empty, the first top-level node will be used)
encoding
stringEncoding of the file. Note that UTF-16 XML encoding is not supported currently and you should use 8-bit encoding instead of it.
Read(IAlgorithm, FileNode)
Reads algorithm parameters from a file storage.
public static void Read(this IAlgorithm algorithm, FileNode node)
Parameters
algorithm
IAlgorithmThe algorithm.
node
FileNodeThe node from file storage.
Save(IAlgorithm, string)
Save the algorithm to file
public static void Save(this IAlgorithm algorithm, string fileName)
Parameters
algorithm
IAlgorithmThe algorithm
fileName
stringThe file name where this algorithm will be saved to
SaveToString(IAlgorithm, string)
Save the algorithm to a string
public static string SaveToString(this IAlgorithm algorithm, string format = ".xml")
Parameters
algorithm
IAlgorithmThe algorithm
format
stringfile format, can be .xml or .yml
Returns
- string
The algorithm as an yml string
Write(IAlgorithm, FileStorage)
Stores algorithm parameters in a file storage
public static void Write(this IAlgorithm algorithm, FileStorage storage)
Parameters
algorithm
IAlgorithmThe algorithm.
storage
FileStorageThe storage.
Write(IAlgorithm, FileStorage, string)
Stores algorithm parameters in a file storage
public static void Write(this IAlgorithm algorithm, FileStorage storage, string name)
Parameters
algorithm
IAlgorithmThe algorithm.
storage
FileStorageThe storage.
name
stringThe name of the node