Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AlloySignature

In Alloy, a signature introduces a set of atoms.

Hierarchy

Index

Constructors

constructor

Methods

atom

  • Get an atom by ID

    Parameters

    • id: string

      The atom ID

    Returns null | AlloyAtom

    An atom or null if there is no atom with the specified ID

atoms

  • Get an array of all atoms in this signature.

    Parameters

    • recursive: boolean = false

      If false, return only atoms defined by this signature, if true, include atoms defined by all subsignatures as well.

    Returns AlloyAtom[]

clone

empty

  • empty(): boolean

equals

  • Returns true if this set is equivalent to the provided set, false otherwise.

    Parameters

    Returns boolean

id

  • id(): string

in

  • Returns true if this set is a subset of the provided set, false otherwise.

    Parameters

    Returns boolean

join

  • Perform a join operation with another set. This operation is equivalent to the dot join operator in Alloy, in which this set is on the left side of the dot and that set is on the right side.

    Parameters

    Returns AlloySet

subSignatures

  • Get an array of all signatures that extend this signature.

    Parameters

    • recursive: boolean = false

      If false, return only signatures that are immediate children of this signature. If true, return all signatures that are descendants of this signature.

    Returns AlloySignature[]

toString

  • toString(): string

tuples

Static fromElement

  • Create a signature from an XML element and populate the signature with atoms. Any signatures that extend the one defined in the element are not created.

    Parameters

    • element: Element

      The XML <sig> element

    • Optional proxy: AlloyProxy

      If provided, a proxied signature with proxied atoms will be returned.

    Returns AlloySignature

Static intSignature

  • Create the Int signature.

    Parameters

    • bitwidth: number

      The integer bitwidth, which must be greater than or equal to zero.

    • Optional proxy: AlloyProxy

      If provided, a proxied Int signature with proxied atoms will be returned.

    Returns AlloySignature

Static seqIntSignature

Static signaturesFromXML

  • Build all signatures from an XML <instance> element. All signatures are populated with atoms.

    Parameters

    • instance: Element

      The XML <instance> element

    • Optional proxy: AlloyProxy

      If provided, all signatures and atoms will be proxied.

    Returns Map<string, AlloySignature>

    A map of string IDs, as defined by the "ID" attribute for each signature, to AlloySignature objects.

Static typesFromXML

  • Get an array of signature types associated with an XML element. Typically this is used when parsing a field or skolem, as each <field> and <skolem> element will have a <types> child. This method parses the types defined in this element and returns the corresponding signatures.

    Parameters

    • element: Element

      The XML element that has a child

    • sigIDs: Map<string, AlloySignature>

      A map of signature IDs to signatures

    Returns AlloySignature[]