Search Results for

    Show / Hide Table of Contents

    Class AlgorithmManager

    Singleton class that uses reflection to manage all particle algorithms, providing an interface to access their names, generation methods and parameters.

    Inheritance
    object
    AlgorithmManager
    Namespace: AS2
    Assembly: .dll
    Syntax
    public class AlgorithmManager

    Constructors

    | Edit this page View Source

    AlgorithmManager()

    Declaration
    private AlgorithmManager()

    Fields

    | Edit this page View Source

    Generator_Property

    Declaration
    private static readonly string Generator_Property
    Field Value
    Type Description
    string
    | Edit this page View Source

    Init_Method

    Declaration
    private static readonly string Init_Method
    Field Value
    Type Description
    string
    | Edit this page View Source

    Name_Property

    Declaration
    private static readonly string Name_Property
    Field Value
    Type Description
    string
    | Edit this page View Source

    algorithms

    Declaration
    private Dictionary<string, AlgorithmManager.AlgorithmInfo> algorithms
    Field Value
    Type Description
    Dictionary<string, AlgorithmManager.AlgorithmInfo>
    | Edit this page View Source

    excludedAlgorithms

    A list of algorithm names that should be excluded from the system. These algorithms will be skipped during algorithm discovery and will not appear in the algorithm selection dropdown menu.

    Declaration
    private readonly List<string> excludedAlgorithms
    Field Value
    Type Description
    List<string>
    | Edit this page View Source

    instance

    Declaration
    private static AlgorithmManager instance
    Field Value
    Type Description
    AlgorithmManager

    Properties

    | Edit this page View Source

    Instance

    The singleton instance of this class.

    Declaration
    public static AlgorithmManager Instance { get; }
    Property Value
    Type Description
    AlgorithmManager

    Methods

    | Edit this page View Source

    CallStatusInfoMethod(string, int, ParticleSystem, Particle)

    Call the status info method of the algorithm with the given name. The index idx must be the attribute's array index as returned by GetStatusInfoMethods(string).

    Declaration
    public void CallStatusInfoMethod(string name, int idx, ParticleSystem system, Particle selectedParticle)
    Parameters
    Type Name Description
    string name

    The string ID of the algorithm.

    int idx

    The array index of the status info method to call.

    ParticleSystem system

    The first parameter of the status info method.

    Particle selectedParticle

    The second parameter of the status info method.

    | Edit this page View Source

    FindAlgorithm(string)

    Tries to get the algorithm with the given name.

    Declaration
    private AlgorithmManager.AlgorithmInfo FindAlgorithm(string name)
    Parameters
    Type Name Description
    string name

    The string ID of the desired algorithm.

    Returns
    Type Description
    AlgorithmManager.AlgorithmInfo

    The record of the algorithm with name name if it exists, otherwise null.

    | Edit this page View Source

    GetAlgorithmGenerationMethod(string)

    Gets the name of the given algorithm's generation method.

    Declaration
    public string GetAlgorithmGenerationMethod(string name)
    Parameters
    Type Name Description
    string name

    The string ID of the algorithm.

    Returns
    Type Description
    string

    The name of the algorithm's generation method, if a record for this algorithm exists.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if the algorithm is not known.

    | Edit this page View Source

    GetAlgorithmNames()

    Gets a list of all known algorithm names.

    Declaration
    public List<string> GetAlgorithmNames()
    Returns
    Type Description
    List<string>

    A list containing the names of all algorithms.

    | Edit this page View Source

    GetInitParameters(string)

    Gets the parameters of the algorithm's Init method.

    Declaration
    public ParameterInfo[] GetInitParameters(string name)
    Parameters
    Type Name Description
    string name

    The string ID of the algorithm.

    Returns
    Type Description
    ParameterInfo[]

    An array containing the parameters of the algorithm's Init method, if the algorithm exists and it implements this method, otherwise null.

    | Edit this page View Source

    GetStatusInfoMethods(string)

    Gets the status info attributes defined for the given algorithm.

    Declaration
    public StatusInfoAttribute[] GetStatusInfoMethods(string name)
    Parameters
    Type Name Description
    string name

    The string ID of the algorithm.

    Returns
    Type Description
    StatusInfoAttribute[]

    An array of status info attribute instances defined for the given algorithm. The attributes contain a name, a tooltip and a default auto-call value. Call these info methods using CallStatusInfoMethod(string, int, ParticleSystem, Particle) with the index from this array.

    | Edit this page View Source

    Initialize(string, ParticleAlgorithm, object[])

    Initializes the given algorithm with the given parameters by calling its Init method.

    Declaration
    public void Initialize(string name, ParticleAlgorithm algo, object[] parameters)
    Parameters
    Type Name Description
    string name

    The string ID of the algorithm type.

    ParticleAlgorithm algo

    The algorithm instance to initialize.

    object[] parameters

    The parameters to be passed to the Init method.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if the algorithm is not known.

    | Edit this page View Source

    Instantiate(string, Particle)

    Creates a new instance of the given algorithm for the given particle.

    Declaration
    public ParticleAlgorithm Instantiate(string name, Particle particle)
    Parameters
    Type Name Description
    string name

    The string ID of the algorithm.

    Particle particle

    The particle that shall be controlled by the algorithm.

    Returns
    Type Description
    ParticleAlgorithm

    A new instance of the specified algorithm.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if the algorithm is not known.

    | Edit this page View Source

    IsAlgorithmKnown(string)

    Checks if the given algorithm name is known.

    Declaration
    public bool IsAlgorithmKnown(string name)
    Parameters
    Type Name Description
    string name

    The string ID to check.

    Returns
    Type Description
    bool

    true if and only if a particle algorithm with the given name is registered.

    • Edit this page
    • View Source
    In this article
    Back to top AmoebotSim 2.0 Documentation v1.11
    Copyright © 2025 AmoebotSim 2.0 Authors
    Generated by DocFX