Developing class for verification of Tavshil on Kirah

We are studying Mishnah Shabat 3.
so, I decided to make the way easier for me – to program it.
Here is a draft code for this Mishnah:

First, we create a class for Tavshil

public class Tavshil {
    public int levelOfCook = 0;
}

then we define class for Kirah.

public class Kirah {
    public Boolean isKosher = false;
    public Boolean isPotOnTop = false;

}

I would like to set classes, so that in future I will be able to add more options to them.

also we create Enum for Options (possible explanations)

public enum Options {
    OPTION_ONE,
    OPTION_TWO;
}

and here is our class for verification of various activities with Tavshil on Kirah.

public class TavshilOnKirah {
    private Boolean Rav = false;
    private Options option;
    private Kirah kirah;
    private Tavshil tavshil;
    public static final int LEVEL_BEN_DORSAY = 33; // in %. Some consider 50%

    public TavshilOnKirah(Kirah kirah, Tavshil tavshil, Boolean Rav, Options option)
    {
        this.kirah = kirah;
        this.tavshil = tavshil;
        this.Rav = Rav;
        this.option = option;
    }

    public Boolean verifyPut()
    {
        if (!Rav)
        {
            if (option == Options.OPTION_ONE)
            {
                if (!kirah.isKosher)
                {
                    if (tavshil.levelOfCook == 0 || tavshil.levelOfCook > 100)
                        return true;
                    else
                        return false;
                }else{
                    if (tavshil.levelOfCook > LEVEL_BEN_DORSAY)
                        return true;
                    else
                        return false;
                }
            }
            else if (option == Options.OPTION_TWO)
            {
                return true;
            }
        }else{

            if (option == Options.OPTION_TWO)
            {
                if (kirah.isKosher && kirah.isPotOnTop)
                {
                    return true;
                }else{
                    return false;
                }
            }
        }

        return false;
    }

    public Boolean verifyReturn()
    {
        if (!Rav)
        {
            if (option == Options.OPTION_ONE)
            {
                return false;

            }
            else if (option == Options.OPTION_TWO)
            {
                if (kirah.isKosher)
                    return true;
                else
                    return false;
            }
        }else{

            if (option == Options.OPTION_TWO)
            {
                if (kirah.isKosher && kirah.isPotOnTop)
                {
                    return true;
                }else{
                    return false;
                }
            }
        }

        return false;
    }


}

If you have anything to add, feel free to write a comment.

Leave a Reply

%d bloggers like this: