Search Results for

    Show / Hide Table of Contents

    Class BinAttribute<T>

    Lightweight attribute wrapper representing a value that is stored in a single integer attribute, encoded in binary using a subset of bits. A standard int has 32 bits, which can be used to encode multiple different values, especially since amoebot memory is limited and will never use integer values this large.

    Inheritance
    object
    BinAttribute<T>
    BinAttributeBitField
    BinAttributeBool
    BinAttributeDirection
    BinAttributeEnum<T>
    BinAttributeInt
    Namespace: AS2.Subroutines.BinStateHelpers
    Assembly: .dll
    Syntax
    public abstract class BinAttribute<T>
    Type Parameters
    Name Description
    T

    The type of value represented by the attribute.

    Constructors

    | Edit this page View Source

    BinAttribute(ParticleAttribute<int>, int)

    Creates a new attribute wrapper referencing the given state attribute int.

    Declaration
    public BinAttribute(ParticleAttribute<int> attr, int idx)
    Parameters
    Type Name Description
    ParticleAttribute<int> attr

    The attribute storing the integer that contains this value as a subset of bits.

    int idx

    The bit index at which the encoding of this value starts.

    Fields

    | Edit this page View Source

    attr

    Declaration
    public readonly ParticleAttribute<int> attr
    Field Value
    Type Description
    ParticleAttribute<int>
    | Edit this page View Source

    idx

    Declaration
    public readonly int idx
    Field Value
    Type Description
    int

    Methods

    | Edit this page View Source

    GetCurrentValue()

    Returns the latest value.

    Declaration
    public abstract T GetCurrentValue()
    Returns
    Type Description
    T

    The value decoded from the int's latest value.

    | Edit this page View Source

    GetValue()

    Returns the value from the beginning of the current round.

    Declaration
    public abstract T GetValue()
    Returns
    Type Description
    T

    The value decoded from the int's snapshot value.

    | Edit this page View Source

    SetValue(T)

    Writes a new value to the state integer.

    Declaration
    public abstract void SetValue(T value)
    Parameters
    Type Name Description
    T value

    The new value to be written.

    • 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