Skip to content

Interrupter.constructor

BelicusBr edited this page Feb 5, 2024 · 1 revision

Interrupter Constructor

Definition

Namespace: Cobilas

Only one switch specifying the index will be used, the others will remain at false value.

Overloads

Interrupter(int, bool) Only one switch specifying the index will be used, the others will remain at false value.
Interrupter(int) Only one switch specifying the index will be used, the others will remain at false value.

Interrupter(int, bool)

Only one switch specifying the index will be used, the others will remain at false value.

Parameters

int Capacity
How many switches.

bool UseASwitch
Allows you to use one switch at a time.

Example

using Cobilas;

static void example() {
    Interrupter interrupter = new Interrupter(5, false);
    interrupter[0] = true;
    interrupter[3] = true;
    Console.WriteLine($"interrupter1\r\n{interrupter}");

    interrupter = new Interrupter(5, true);
    interrupter[0] = true;
    interrupter[3] = true;
    Console.WriteLine($"interrupter2\r\n{interrupter}");
}
/*
interrupter1
Switches {
    switch(0)[status:true]
    switch(1)[status:false]
    switch(2)[status:false]
    switch(3)[status:true]
    switch(4)[status:false]
}

interrupter2
Switches {
    switch(0)[status:false]
    switch(1)[status:false]
    switch(2)[status:false]
    switch(3)[status:true]
    switch(4)[status:false]
}
*/

Interrupter(int)

Only one switch specifying the index will be used, the others will remain at false value.
By default the UseASwitch property is true.

Parameters

int Capacity
How many switches.

Example

using Cobilas;

static void example() {
    Interrupter interrupter = new Interrupter(5);
    interrupter[0] = true;
    interrupter[3] = true;
    Console.WriteLine($"interrupter1\r\n{interrupter}");
}
/*
interrupter1
Switches {
    switch(0)[status:false]
    switch(1)[status:false]
    switch(2)[status:false]
    switch(3)[status:true]
    switch(4)[status:false]
}
*/
Clone this wiki locally