package com.siyeh.igtest.controlflow.switch_statement_density;

public class SwitchStatementDensity
{
    private int m_bar;

    public SwitchStatementDensity()
    {
        m_bar = 0;
    }

    public void fooBar()
    {
        final int bar = m_bar;
        <warning descr="'switch' branch density is too low (19%)">switch</warning>(bar)
        {
            case 3:
            case 4:
                System.out.println("3");
                System.out.println("3");
                System.out.println("3");
                System.out.println("3");
                System.out.println("3");
                System.out.println("3");
                System.out.println("3");
                System.out.println("3");
                System.out.println("3");
                System.out.println("3");
                System.out.println("3");
                System.out.println("3");
                System.out.println("3");
                System.out.println("3");
                System.out.println("3");
                System.out.println("3");
                System.out.println("3");
                System.out.println("3");
                System.out.println("3");
                System.out.println("3");
                break;
            case 6:
                System.out.println("4");
                break;
            default:
                break;
        }
        switch(bar) {}

    }

    public int switchExpression(int e) {
        return <warning descr="'switch' branch density is too low (11%)">switch</warning> (e) {
            case 1:
                System.out.println(e);
                System.out.println(e);
                System.out.println(e);
                System.out.println(e);
                System.out.println(e);
                System.out.println(e);
                System.out.println(e);
                System.out.println(e);
                System.out.println(e);
                System.out.println(e);
                System.out.println(e);
                System.out.println(e);
                System.out.println(e);
                System.out.println(e);
                System.out.println(e);
                System.out.println(e);
                System.out.println(e);
                System.out.println(e);
                yield 1;
            default:
                yield 0;

        };
    }

    public void ruleBaseSwitch(String s) {
        <warning descr="'switch' branch density is too low (9%)">switch</warning> (s) {
            case "one" -> {
                System.out.println(1);
                System.out.println(1);
                System.out.println(1);
                System.out.println(1);
                System.out.println(1);
                System.out.println(1);
                System.out.println(1);
                System.out.println(1);
                System.out.println(1);
                System.out.println(1);
                System.out.println(1);
                System.out.println(1);
                System.out.println(1);
                System.out.println(1);
                System.out.println(1);
                System.out.println(1);
                System.out.println(1);
                System.out.println(1);
                System.out.println(1);
            }
            case "two" -> {
                System.out.println(2);
            }
        }
    }
}
