iwf
    Preparing search index...

    Class QuantitySnak

    Class for the QuantitySnak.

    Most used property of this type is P1215 (apparent magnitude).

    Hierarchy (View Summary)

    Index

    Constructors

    • Parameters

      • snak: QuantitySnak

        The snak for this class in JSON format.

      Returns QuantitySnak

      If the upperBound is smaller than the amount or the lowerBound is bigger than the amount.

      const snak = new QuantitySnak(json);
      

    Properties

    datatype: string = dataType
    hash: undefined | string
    property: `P${number}`
    snaktype: SnakType
    unit: string

    Accessors

    • get amount(): undefined | number

      Returns undefined | number

      The amount of the quantity.

    • set amount(number: undefined | number): void

      Parameters

      • number: undefined | number

        The number that the amount will be set to.

      Returns void

    • get hasValue(): boolean

      Checks if the snak has a value.

      Returns boolean

      True if the snak has a value.

    • get internalID(): string

      Creates a unique ID for the Snak.

      Returns string

      The ID.

    • get lowerBound(): undefined | number

      Returns undefined | number

      The lowerBound of the quantity.

    • set lowerBound(number: undefined | number): void

      Parameters

      • number: undefined | number

        The number that the lowerBound will be set to.

      Returns void

    • get upperBound(): undefined | number

      Returns undefined | number

      The upperBound of the quantity.

    • set upperBound(number: undefined | number): void

      Parameters

      • number: undefined | number

        The number that the upperBound will be set to.

      Returns void

    Methods

    • Returns the snak as JSON.

      Returns QuantitySnak

      The snak as JSON.

      const json = quantitySnak.toJSON();
      
    • Create a snak from some basic data.

      Parameters

      • property: `P${number}`

        The property of the snak in 'P-form'.

      • quantity: number

        Amount of the quantity.

      • OptionallowerBound: null | number

        LowerBound of the quantity.

      • OptionalupperBound: null | number

        UpperBound of the quantity.

      • Optionalunit: `Q${number}`

        Unit of the quantity.

      Returns QuantitySnak

      A snak with the given properties.

      const snak = QuantitySnak.fromNumbers('P1215', 1);