/*
 * Decompiled with CFR 0_132.
 */
package signals;

import signals.Signals;

public class Clock
extends Signals {
    private static final long serialVersionUID = 1L;

    public Clock(String name) {
        this.name = name;
        this.clock = true;
        this.widthUnit = 20;
    }

    public Clock(String name, int period) {
        this.init(name, period);
    }

    public Clock(String name, int period, int clockDomain, float ratio) {
        this.clockDomainId = clockDomain;
        this.ratio = ratio;
        this.init(name, period);
    }

    public void init(String name, int period) {
        this.setId();
        this.clockDomainId = this.id;
        this.name = name;
        this.clock = true;
        this.widthUnit = period;
        boolean level = false;
        int i = 0;
        while (i < 200) {
            if (level) {
                this.wave[i] = 1;
            }
            if (!level) {
                this.wave[i] = 0;
            }
            level = !level;
            ++i;
        }
    }

    @Override
    public void generate(boolean beginOnRisingEdge) {
        boolean level = false;
        if (beginOnRisingEdge) {
            int i = 0;
            while (i < 500) {
                if (level) {
                    this.wave[i] = 0;
                }
                if (!level) {
                    this.wave[i] = 1;
                }
                level = !level;
                ++i;
            }
        } else {
            int i = 0;
            while (i < 500) {
                if (level) {
                    this.wave[i] = 1;
                }
                if (!level) {
                    this.wave[i] = 0;
                }
                level = !level;
                ++i;
            }
        }
    }
}

