Search Results for

    Show / Hide Table of Contents

    Class SysPartitionSet

    System-side implementation of the abstract base class PartitionSet, which declares the API for the developer.

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

    Constructors

    | Edit this page View Source

    SysPartitionSet(SysPinConfiguration, int, int)

    Declaration
    public SysPartitionSet(SysPinConfiguration pinConfig, int id, int size)
    Parameters
    Type Name Description
    SysPinConfiguration pinConfig
    int id
    int size

    Fields

    | Edit this page View Source

    circuit

    The ID of the circuit this partition set currently belongs to.

    Declaration
    public int circuit
    Field Value
    Type Description
    int
    | Edit this page View Source

    color

    The color override of this partition set.

    Declaration
    public Color color
    Field Value
    Type Description
    Color
    | Edit this page View Source

    colorOverride

    Indicates whether the partition set has a color override.

    Declaration
    public bool colorOverride
    Field Value
    Type Description
    bool
    | Edit this page View Source

    drawSingletonHandle

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

    Declaration
    public bool drawSingletonHandle
    Field Value
    Type Description
    bool
    | Edit this page View Source

    id

    The unique ID of this partition set within the pin configuration.

    Declaration
    public int id
    Field Value
    Type Description
    int
    | Edit this page View Source

    numStoredPins

    The number of pins contained in this partition set.

    Declaration
    private int numStoredPins
    Field Value
    Type Description
    int
    | Edit this page View Source

    pinConfig

    The pin configuration to which this partition set belongs.

    Declaration
    public SysPinConfiguration pinConfig
    Field Value
    Type Description
    SysPinConfiguration
    | Edit this page View Source

    pins

    A bit array indicating which pins are contained in this partition set. Indices are pin IDs.

    Declaration
    public BitArray pins
    Field Value
    Type Description
    BitArray
    | Edit this page View Source

    positionHead

    Global polar coordinates of this partition set in the particle's head.

    Declaration
    public Vector2 positionHead
    Field Value
    Type Description
    Vector2
    | Edit this page View Source

    positionTail

    Global polar coordinates of this partition set in the particle's tail.

    Declaration
    public Vector2 positionTail
    Field Value
    Type Description
    Vector2

    Properties

    | Edit this page View Source

    Id

    The ID of this partition set.

    Partition set IDs range from 0 to NumPins - 1.

    Declaration
    public override int Id { get; }
    Property Value
    Type Description
    int
    Overrides
    PartitionSet.Id
    | Edit this page View Source

    NumStoredPins

    The number of pins contained in this partition set.

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

    PinConfiguration

    The PinConfiguration to which this partition set belongs.

    Declaration
    public override PinConfiguration PinConfiguration { get; }
    Property Value
    Type Description
    PinConfiguration
    Overrides
    PartitionSet.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 override void AddPin(Pin pin)
    Parameters
    Type Name Description
    Pin pin

    The pin to be added.

    Overrides
    PartitionSet.AddPin(Pin)
    | 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 override void AddPin(int idx)
    Parameters
    Type Name Description
    int idx
    Overrides
    PartitionSet.AddPin(int)
    | Edit this page View Source

    AddPinBasic(int)

    Adds the pin with the given ID to this partition set without causing any further actions.

    Used by PinConfiguration to handle pin movements.

    Declaration
    public void AddPinBasic(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 override void AddPins(Pin[] pins)
    Parameters
    Type Name Description
    Pin[] pins

    An array containing the pins to be added.

    Overrides
    PartitionSet.AddPins(Pin[])
    | 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 override void AddPins(int[] pinIds)
    Parameters
    Type Name Description
    int[] pinIds

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

    Overrides
    PartitionSet.AddPins(int[])
    | Edit this page View Source

    ClearInternal()

    Clears the local data of this partition set.

    Note that if this partition set contains any pins, these pins will keep their references to this partition set.

    Declaration
    public void ClearInternal()
    | Edit this page View Source

    ContainsPin(Pin)

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

    See also ContainsPin(int).

    Declaration
    public override 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.

    Overrides
    PartitionSet.ContainsPin(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 override 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.

    Overrides
    PartitionSet.ContainsPin(int)
    | Edit this page View Source

    Equals(object)

    Determines whether the specified object is equal to the current object.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj

    The object to compare with the current object.

    Returns
    Type Description
    bool

    true if the specified object is equal to the current object; otherwise, false.

    Overrides
    object.Equals(object)
    | Edit this page View Source

    GetHashCode()

    Serves as the default hash function.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int

    A hash code for the current object.

    Overrides
    object.GetHashCode()
    | Edit this page View Source

    GetPinIds()

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

    See also GetPins().

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

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

    Overrides
    PartitionSet.GetPinIds()
    | Edit this page View Source

    GetPins()

    Returns all pins contained in this partition set.

    See also GetPinIds().

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

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

    Overrides
    PartitionSet.GetPins()
    | 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 override Message GetReceivedMessage()
    Returns
    Type Description
    Message

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

    Overrides
    PartitionSet.GetReceivedMessage()
    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 override bool HasReceivedMessage()
    Returns
    Type Description
    bool

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

    Overrides
    PartitionSet.HasReceivedMessage()
    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 override bool IsEmpty()
    Returns
    Type Description
    bool

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

    Overrides
    PartitionSet.IsEmpty()
    | Edit this page View Source

    Merge(PartitionSet)

    Merges the given partition set into this one.

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

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

    Overrides
    PartitionSet.Merge(PartitionSet)
    | Edit this page View Source

    Merge(int)

    Merges the specified partition set into this one.

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

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

    Overrides
    PartitionSet.Merge(int)
    | Edit this page View Source

    Print()

    Declaration
    public string Print()
    Returns
    Type Description
    string
    | 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 override bool ReceivedBeep()
    Returns
    Type Description
    bool

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

    Overrides
    PartitionSet.ReceivedBeep()
    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 override void RemovePin(Pin pin)
    Parameters
    Type Name Description
    Pin pin

    The pin to be removed.

    Overrides
    PartitionSet.RemovePin(Pin)
    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 override void RemovePin(int idx)
    Parameters
    Type Name Description
    int idx
    Overrides
    PartitionSet.RemovePin(int)
    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

    RemovePinBasic(int)

    Removes the pin with the given ID from this partition set without causing any further actions.

    Used by PinConfiguration to handle pin movements.

    Declaration
    public void RemovePinBasic(int pinId)
    Parameters
    Type Name Description
    int pinId

    The ID of the pin to be removed.

    | 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 override void RemovePins(Pin[] pins)
    Parameters
    Type Name Description
    Pin[] pins

    An array containing the pins to be removed.

    Overrides
    PartitionSet.RemovePins(Pin[])
    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 override void RemovePins(int[] pinIds)
    Parameters
    Type Name Description
    int[] pinIds

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

    Overrides
    PartitionSet.RemovePins(int[])
    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 override void ResetColor()
    Overrides
    PartitionSet.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 override void SendBeep()
    Overrides
    PartitionSet.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 override void SendMessage(Message msg)
    Parameters
    Type Name Description
    Message msg

    The message to be sent.

    Overrides
    PartitionSet.SendMessage(Message)
    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 override void SetColor(Color color)
    Parameters
    Type Name Description
    Color color

    The color in which to display this partition set.

    Overrides
    PartitionSet.SetColor(Color)
    | 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 override void SetDrawHandle(bool drawHandle)
    Parameters
    Type Name Description
    bool drawHandle

    Whether the handle should always be drawn.

    Overrides
    PartitionSet.SetDrawHandle(bool)
    | 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 override 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.

    Overrides
    PartitionSet.SetPosition(Vector2, bool)

    Operators

    | Edit this page View Source

    operator ==(SysPartitionSet, SysPartitionSet)

    Declaration
    public static bool operator ==(SysPartitionSet p1, SysPartitionSet p2)
    Parameters
    Type Name Description
    SysPartitionSet p1
    SysPartitionSet p2
    Returns
    Type Description
    bool
    | Edit this page View Source

    operator !=(SysPartitionSet, SysPartitionSet)

    Declaration
    public static bool operator !=(SysPartitionSet p1, SysPartitionSet p2)
    Parameters
    Type Name Description
    SysPartitionSet p1
    SysPartitionSet p2
    Returns
    Type Description
    bool
    • 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