Search Results for

    Show / Hide Table of Contents

    Class Pin

    Developer API for pins.

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

    A pin represents a connection point on the edge of a particle through which it can communicate with neighboring particles using beeps or entire messages. Each edge incident to a particle has the same number of pins and the pins are ordered according to each particle's chirality. This means that the same pin may have different IDs for the two particles. Pins are locally identified by IDs computed from the label of the edge to which they belong and their offset on that edge.

    Every pin is part of a pin configuration and as such, it belongs to a partition set at all times. Pins cannot be created or destroyed, they can only be moved from one partition set to another.

    Inheritance
    object
    Pin
    SysPin
    Namespace: AS2.Sim
    Assembly: .dll
    Syntax
    public abstract class Pin

    Properties

    | Edit this page View Source

    Direction

    The local direction of the edge on which this pin is located.

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

    Id

    The ID of this pin.

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

    IsOnHead

    Whether the edge this pin belongs to is on the particle's head.

    See also IsOnTail.

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

    IsOnTail

    Whether the edge this pin belongs to is on the particle's tail.

    See also IsOnHead.

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

    Offset

    The offset of this pin on its edge.

    The pins on an edge are ordered according to the chirality of the particle. Their offsets range from 0 to PinsPerEdge - 1.

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

    PartitionSet

    The partition set to which this pin currently belongs.

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

    Methods

    | Edit this page View Source

    GetReceivedMessage()

    Returns the message this pin 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 pin in the last round, if it exists, otherwise null.

    Exceptions
    Type Condition
    InvalidOperationException

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

    | Edit this page View Source

    HasReceivedMessage()

    Checks whether this pin 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 pin has received a message in the last round.

    Exceptions
    Type Condition
    InvalidOperationException

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

    | Edit this page View Source

    ReceivedBeep()

    Checks whether this pin 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 pin has received a beep in the last round.

    Exceptions
    Type Condition
    InvalidOperationException

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

    | Edit this page View Source

    SendBeep()

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

    Declaration
    public abstract void SendBeep()
    Exceptions
    Type Condition
    InvalidOperationException

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

    | Edit this page View Source

    SendMessage(Message)

    Sends a message on this pin 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 pin does not belong to the next pin configuration.

    • 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