Search Results for

    Show / Hide Table of Contents

    Class PartitionSet

    Developer API for partition sets.

    This is part of the pin configuration API, see PinConfiguration.

    A partition set is a set of connected pins within a pin configuration. It belongs to an object implementing the PinConfiguration interface and may be changed through methods of this API or through the pin configuration itself.
    See also Pin.

    Inheritance
    object
    PartitionSet
    SysPartitionSet
    Namespace: AS2.Sim
    Assembly: .dll
    Syntax
    public abstract class PartitionSet

    Properties

    | Edit this page View Source

    Id

    The ID of this partition set.

    Partition set IDs range from 0 to NumPins - 1.

    Declaration
    public abstract int Id { get; }
    Property Value
    Type Description
    int
    | Edit this page View Source

    PinConfiguration

    The PinConfiguration to which this partition set belongs.

    Declaration
    public abstract PinConfiguration PinConfiguration { get; }
    Property Value
    Type Description
    PinConfiguration

    Methods

    | Edit this page View Source

    AddPin(Pin)

    Adds the given pin to this partition set.

    If the pin is not already contained in this set, it is removed from the set it is currently contained in.

    See also AddPin(int).

    Declaration
    public abstract void AddPin(Pin pin)
    Parameters
    Type Name Description
    Pin pin

    The pin to be added.

    | Edit this page View Source

    AddPin(int)

    Adds the specified pin to this partition set.

    If the pin is not already contained in this set, it is removed from the set it is currently contained in.

    See also AddPin(Pin).

    Declaration
    public abstract void AddPin(int pinId)
    Parameters
    Type Name Description
    int pinId

    The ID of the pin to be added.

    | Edit this page View Source

    AddPins(Pin[])

    Adds the given pins to this partition set.

    Has the same effect as calling AddPin(Pin) multiple times.

    See also AddPins(int[]).

    Declaration
    public abstract void AddPins(Pin[] pins)
    Parameters
    Type Name Description
    Pin[] pins

    An array containing the pins to be added.

    | Edit this page View Source

    AddPins(int[])

    Adds the specified pins to this partition set.

    Has the same effect as calling AddPin(int) multiple times.

    See also AddPins(Pin[]).

    Declaration
    public abstract void AddPins(int[] pinIds)
    Parameters
    Type Name Description
    int[] pinIds

    An array containing the IDs of the pins to be added.

    | Edit this page View Source

    ContainsPin(Pin)

    Checks if the given pin is contained in this partition set.

    See also ContainsPin(int).

    Declaration
    public abstract bool ContainsPin(Pin pin)
    Parameters
    Type Name Description
    Pin pin

    The pin to be checked.

    Returns
    Type Description
    bool

    true if and only if this partition set contains a pin with the same ID as the givne pin.

    | Edit this page View Source

    ContainsPin(int)

    Checks if the specified pin is contained in this partition set.

    See also ContainsPin(Pin).

    Declaration
    public abstract bool ContainsPin(int pinId)
    Parameters
    Type Name Description
    int pinId

    The ID of the pin to be checked.

    Returns
    Type Description
    bool

    true if and only if this partition set contains a pin with ID pinId.

    | Edit this page View Source

    GetPinIds()

    Returns the IDs of all pins contained in this partition set.

    See also GetPins().

    Declaration
    public abstract int[] GetPinIds()
    Returns
    Type Description
    int[]

    An array containing the IDs of all pins contained in this partition set, in ascending order.

    | Edit this page View Source

    GetPins()

    Returns all pins contained in this partition set.

    See also GetPinIds().

    Declaration
    public abstract Pin[] GetPins()
    Returns
    Type Description
    Pin[]

    An array containing all pins contained in this partition set, ordered by their IDs.

    | Edit this page View Source

    GetReceivedMessage()

    Returns the message this partition set has received in the last round, if it has received one and it belongs to the current pin configuration.

    Declaration
    public abstract Message GetReceivedMessage()
    Returns
    Type Description
    Message

    The message received by this partition set in the last round, if it exists, otherwise null.

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if this partition set does not belong to the current pin configuration.

    | Edit this page View Source

    HasReceivedMessage()

    Checks whether this partition set has received a message in the last round, if the pin configuration it belongs to is the current one.

    Declaration
    public abstract bool HasReceivedMessage()
    Returns
    Type Description
    bool

    true if and only if this partition set has received a message in the last round.

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if this partition set does not belong to the current pin configuration.

    | Edit this page View Source

    IsEmpty()

    Checks if this partition set is empty.

    Declaration
    public abstract bool IsEmpty()
    Returns
    Type Description
    bool

    true if and only if this partition set does not contain any pins.

    | Edit this page View Source

    Merge(PartitionSet)

    Merges the given partition set into this one.

    Declaration
    public abstract void Merge(PartitionSet other)
    Parameters
    Type Name Description
    PartitionSet other

    The partition set whose pins should be moved to this set.

    | Edit this page View Source

    Merge(int)

    Merges the specified partition set into this one.

    Declaration
    public abstract void Merge(int otherId)
    Parameters
    Type Name Description
    int otherId

    The ID of the partition set whose pins should be moved to this set.

    | Edit this page View Source

    ReceivedBeep()

    Checks whether this partition set has received a beep in the last round, if the pin configuration it belongs to is the current one.

    Declaration
    public abstract bool ReceivedBeep()
    Returns
    Type Description
    bool

    true if and only if this partition set has received a beep in the last round.

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if this partition set does not belong to the current pin configuration.

    | Edit this page View Source

    RemovePin(Pin)

    Tries to remove the specified pin from this partition set.

    If the pin is currently contained in this partition set and some other partition set is currently empty, the pin is moved to that empty partition set. If no empty partition set can be found, an exception will be thrown.

    See also RemovePin(int).

    Declaration
    public abstract void RemovePin(Pin pin)
    Parameters
    Type Name Description
    Pin pin

    The pin to be removed.

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if the pin is the only one in this partition set and no other partition set is empty.

    | Edit this page View Source

    RemovePin(int)

    Tries to remove the specified pin from this partition set.

    If the pin is currently contained in this partition set and some other partition set is currently empty, the pin is moved to that empty partition set. If no empty partition set can be found, an exception will be thrown.

    See also RemovePin(Pin).

    Declaration
    public abstract void RemovePin(int pinId)
    Parameters
    Type Name Description
    int pinId

    The ID of the pin to be removed.

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if the pin is the only one in this partition set and no other partition set is empty.

    | Edit this page View Source

    RemovePins(Pin[])

    Tries to remove the given pins from this partition set.

    Has the same effect as calling RemovePin(Pin) multiple times.

    See also RemovePins(int[]).

    Declaration
    public abstract void RemovePins(Pin[] pins)
    Parameters
    Type Name Description
    Pin[] pins

    An array containing the pins to be removed.

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if a pin is the last one in this partition set and no other partition set is empty.

    | Edit this page View Source

    RemovePins(int[])

    Tries to remove the specified pins from this partition set.

    Has the same effect as calling RemovePin(int) multiple times.

    See also RemovePins(Pin[]).

    Declaration
    public abstract void RemovePins(int[] pinIds)
    Parameters
    Type Name Description
    int[] pinIds

    An array containing the IDs of the pins to be removed.

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if a pin is the last one in this partition set and no other partition set is empty.

    | Edit this page View Source

    ResetColor()

    Resets the color override of this partition set.

    See ResetPartitionSetColor(int).

    Declaration
    public abstract void ResetColor()
    | Edit this page View Source

    SendBeep()

    Sends a beep on this partition set if the pin configuration it belongs to is the next one.

    Declaration
    public abstract void SendBeep()
    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if this partition set does not belong to the next pin configuration.

    | Edit this page View Source

    SendMessage(Message)

    Sends a message on this partition set if the pin configuration it belongs to is the next one.

    Declaration
    public abstract void SendMessage(Message msg)
    Parameters
    Type Name Description
    Message msg

    The message to be sent.

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown if this partition set does not belong to the next pin configuration.

    | Edit this page View Source

    SetColor(Color)

    Overrides the color of this partition set.

    See SetPartitionSetColor(int, Color).

    Declaration
    public abstract void SetColor(Color color)
    Parameters
    Type Name Description
    Color color

    The color in which to display this partition set.

    | Edit this page View Source

    SetDrawHandle(bool)

    Specifies whether this partition set should always be drawn with a handle, even if it is a singleton set (but not if it is empty).

    Declaration
    public abstract void SetDrawHandle(bool drawHandle)
    Parameters
    Type Name Description
    bool drawHandle

    Whether the handle should always be drawn.

    | Edit this page View Source

    SetPosition(Vector2, bool)

    Sets the position of this partition set to the given polar coordinates. Only affects the position if the partition set contains at least two pins. Also sets the pin configuration's placement mode to MANUAL.

    Declaration
    public abstract void SetPosition(Vector2 polarCoords, bool head = true)
    Parameters
    Type Name Description
    Vector2 polarCoords

    The polar coordinates (angleDeg, distance) of the partition set relative to the center of the particle. Angle 0 points in local E direction and angles increase in local counter-clockwise direction. Distance 1 places the partition set on the edge of the particle.

    bool head

    Determines whether the partition set in the particle's head or tail should be placed. For contracted particles, this should be true.

    • 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