Search Results for

    Show / Hide Table of Contents

    Class ParticleAttributeFactory

    Factory class for creating and initializing ParticleAttribute<T> subclass instances.

    Inheritance
    object
    ParticleAttributeFactory
    Namespace: AS2.Sim
    Assembly: .dll
    Syntax
    public static class ParticleAttributeFactory

    Methods

    | Edit this page View Source

    CheckAttributeName(string)

    Checks whether the given attribute name is valid and throws an exception if it is not.

    Invalid attribute names are "Chirality" and "Compass Dir" because these names are used by the particle panel to represent a particle's chirality and compass direction, which are not actually attributes.

    Declaration
    private static void CheckAttributeName(string name)
    Parameters
    Type Name Description
    string name

    The attribute names to check.

    | Edit this page View Source

    CheckParticleInConstruction(Particle)

    Checks whether the given particle is currently in construction or null and throws an exception otherwise. This is done to prevent attributes from being created outside of the constructor.

    Declaration
    private static void CheckParticleInConstruction(Particle p)
    Parameters
    Type Name Description
    Particle p

    The particle to check.

    | Edit this page View Source

    CreateParticleAttribute(Particle, Type, string, object)

    Creates a particle attribute matching the desired type if a corresponding attribute type exists. The attribute is not added to the given particle's list of attributes.

    Declaration
    public static IParticleAttribute CreateParticleAttribute(Particle p, Type type, string name, object initialValue)
    Parameters
    Type Name Description
    Particle p

    The particle holding the attribute.

    Type type

    The data type stored by the attribute.

    string name

    The name of the attribute.

    object initialValue

    The initial value of the attribute. If null, an appropriate default value is selected.

    Returns
    Type Description
    IParticleAttribute

    A new attribute instance if the type could be matched, otherwise null.

    | Edit this page View Source

    CreateParticleAttributeBool(Particle, string, bool)

    Creates a new ParticleAttribute_Bool and adds it to the given Particle's list of attributes.

    Declaration
    public static ParticleAttribute_Bool CreateParticleAttributeBool(Particle p, string name, bool initialValue)
    Parameters
    Type Name Description
    Particle p

    The Particle to which the attribute should belong.

    string name

    The display name of the attribute.

    bool initialValue

    The initial attribute value.

    Returns
    Type Description
    ParticleAttribute_Bool

    A newly initialized ParticleAttribute_Bool.

    | Edit this page View Source

    CreateParticleAttributeDirection(Particle, string, Direction)

    Creates a new ParticleAttribute_Direction and adds it to the given Particle's list of attributes.

    Declaration
    public static ParticleAttribute_Direction CreateParticleAttributeDirection(Particle p, string name, Direction initialValue)
    Parameters
    Type Name Description
    Particle p

    The Particle to which the attribute should belong.

    string name

    The display name of the attribute.

    Direction initialValue

    The initial attribute value.

    Returns
    Type Description
    ParticleAttribute_Direction

    A newly initialized ParticleAttribute_Direction.

    | Edit this page View Source

    CreateParticleAttributeEnum<EnumT>(Particle, string, EnumT)

    Creates a new ParticleAttribute_Enum<T> and adds it to the given Particle's list of attributes.

    Declaration
    public static ParticleAttribute_Enum<EnumT> CreateParticleAttributeEnum<EnumT>(Particle p, string name, EnumT initialValue) where EnumT : Enum
    Parameters
    Type Name Description
    Particle p

    The Particle to which the attribute should belong.

    string name

    The display name of the attribute.

    EnumT initialValue

    The initial attribute value.

    Returns
    Type Description
    ParticleAttribute_Enum<EnumT>

    A newly initialized ParticleAttribute_Enum<T>.

    Type Parameters
    Name Description
    EnumT

    The enum type represented by the attribute.

    | Edit this page View Source

    CreateParticleAttributeFloat(Particle, string, float)

    Creates a new ParticleAttribute_Float and adds it to the given Particle's list of attributes.

    Declaration
    public static ParticleAttribute_Float CreateParticleAttributeFloat(Particle p, string name, float initialValue)
    Parameters
    Type Name Description
    Particle p

    The Particle to which the attribute should belong.

    string name

    The display name of the attribute.

    float initialValue

    The initial attribute value.

    Returns
    Type Description
    ParticleAttribute_Float

    A newly initialized ParticleAttribute_Float.

    | Edit this page View Source

    CreateParticleAttributeInt(Particle, string, int)

    Creates a new ParticleAttribute_Int and adds it to the given Particle's list of attributes.

    Declaration
    public static ParticleAttribute_Int CreateParticleAttributeInt(Particle p, string name, int initialValue)
    Parameters
    Type Name Description
    Particle p

    The Particle to which the attribute should belong.

    string name

    The display name of the attribute.

    int initialValue

    The initial attribute value.

    Returns
    Type Description
    ParticleAttribute_Int

    A newly initialized ParticleAttribute_Int.

    | Edit this page View Source

    CreateParticleAttributePinConfiguration(Particle, string, PinConfiguration)

    Creates a new ParticleAttribute_PinConfiguration and adds it to the given Particle's list of attributes.

    Note the usage remarks of the ParticleAttribute_PinConfiguration class.

    Declaration
    public static ParticleAttribute_PinConfiguration CreateParticleAttributePinConfiguration(Particle p, string name, PinConfiguration initialValue)
    Parameters
    Type Name Description
    Particle p

    The Particle to which the attribute should belong.

    string name

    The display name of the attribute.

    PinConfiguration initialValue

    The initial attribute value.

    Returns
    Type Description
    ParticleAttribute_PinConfiguration

    A newly initialized ParticleAttribute_PinConfiguration.

    | Edit this page View Source

    CreateParticleAttributeString(Particle, string, string)

    Creates a new ParticleAttribute_String and adds it to the given Particle's list of attributes.

    Declaration
    public static ParticleAttribute_String CreateParticleAttributeString(Particle p, string name, string initialValue)
    Parameters
    Type Name Description
    Particle p

    The Particle to which the attribute should belong.

    string name

    The display name of the attribute.

    string initialValue

    The initial attribute value.

    Returns
    Type Description
    ParticleAttribute_String

    A newly initialized ParticleAttribute_String.

    • 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