Skip to main content

SegmentDisplay

SegmentDisplay

Here we have the code that applies to the different segment displays. There is the initial state within the constructor and other functions that allow you to modify said segment display.


Constructor

public SegmentDisplay

new SegmentDisplay(numInputs, positioner)

Initializes a 7-segment display with input ports on the left side.

Parameters

  •  numInputs: any – The number of inputs this display is allowed to have.

  •  positioner: Positioner<InputPort> – The positioner used to position the ports.


Properties

No publicly accessible properties on SegmentDisplay


Methods

public setProp

setProp(key, val) => void

Description needed

Parameters

  •  key: stringDescription needed

  •  val: anyDescription needed

public isSegmentOn

isSegmentOn(segment) => false | true

Checks if each input port is connected to a power source that is on.

Parameters

  •  segment: number – The number of input ports.

Returns

  •   false | true – If the ports are on as a boolean.

public getSegments

getSegments() => SegmentType<Vector, "vertical" | "horizontal" | "diagonaltr" | "diagonaltl" | "diagonalbr" | "diagonalbl" | "horizontal0.5">[]

Gets the positions of the segemnts from the json file depending on how many segments there are.

Returns

public getSegmentCount

getSegmentCount() => number

Gets the number of segements in a segment display.

Returns

  •   number – The number of segements.

public getPropInfo

getPropInfo(key) => BasePropInfo & { type: "boolean"; } | BasePropInfo & { type: "button"; getText: (states: any[]) => string; getNewState: (states: any[]) => any; } | BasePropInfo & UnitInfo | BasePropInfo & { type: "string"; constraint?: RegExp; } | BasePropInfo & { type: "color"; } | BasePropInfo & { type: "string[]"; options: [string, string][]; } | BasePropInfo & { type: "number[]"; options: [string, number][]; } | BasePropInfo & { type: "veci" | "vecf"; min?: Vector; max?: Vector; step?: Vector; }

Description needed

Parameters

  •  key: stringDescription needed

Returns

public getDisplayName

getDisplayName() => string

Gets the name to display for the history.

Returns

  •   string – A string of the name to display in the history.

Static Methods

No static methods for SegmentDisplay