<commit_before>package io.github.deltajulio.pantrybank.data;

/**
 * TODO: add a class header comment
 */

public class FoodItem
{
    private final String TAG = "FoodItem";

    public enum QuantityType
    {
        NULL, NUMERICAL, APPROXIMATE
    }
    public enum QuantityApprox
    {
        NULL, NONE_REMAINING, RUNNING_LOW, NORMAL, PLENTY
    }

    private String name;
    private boolean isPinned;
    private String quantityType;
    private String quantity;
    private String categoryId;
    private String foodId;

    @SuppressWarnings("unused")
    public FoodItem() { /*Needed for Firebase ui*/ }

    private FoodItem(String name, boolean isPinned, QuantityType quantityType, String quantity,
                     String categoryId)
    {
        setName(name);
        setIsPinned(isPinned);
        setQuantityType(quantityType);
        setQuantity(quantity);
        setCategoryId(categoryId);
    }

    public FoodItem(String name, boolean isPinned, long quantityNum, String categoryId)
    {
        this(name, isPinned, QuantityType.NUMERICAL, String.valueOf(quantityNum), categoryId);
    }

    public FoodItem(String name, boolean isPinned, QuantityApprox quantityApprox, String categoryId)
    {
        this(name, isPinned, QuantityType.APPROXIMATE, quantityApprox.toString(), categoryId);
    }

    public FoodItem(String name, boolean isPinned, QuantityType quantityType, String categoryId)
    {
        this(name, isPinned, quantityType,
                (quantityType == QuantityType.NUMERICAL ?
                String.valueOf(1): QuantityApprox.NORMAL.toString()),
                categoryId);
    }

    public final String getName() { return name; }
    public void setName(String name) { this.name = name; }

    public final boolean getIsPinned() { return isPinned; }
    public void setIsPinned(boolean isPinned) { this.isPinned = isPinned; }

    public final QuantityType getQuantityType() { return QuantityType.valueOf(quantityType); }
    public void setQuantityType(QuantityType quantityType) { this.quantityType = quantityType.toString(); }

    /**
     * For retrieving database value ONLY. Use long or enum return value instead.
     */
    public final String getQuantity() { return quantity; }

    /**
     * For setting database value ONLY. Use long or enum param version instead.
     */
    public void setQuantity(String quantity) { this.quantity = quantity; }

    public final long GetQuantityLong() { return Long.parseLong(quantity);}
    public void SetQuantityLong(long quantity) { this.quantity = String.valueOf(quantity); }

    public final QuantityApprox GetQuantityEnum() { return QuantityApprox.valueOf(quantity); }
    public void SetQuantityEnum(QuantityApprox quantity) { this.quantity = quantity.toString(); }

    public String getCategoryId() { return categoryId; }
    public void setCategoryId(String categoryId) { this.categoryId = categoryId; }

    public String getFoodId() { return foodId; }
    public void setFoodId(String foodId) { this.foodId = foodId; }
}
<commit_msg>add Next() and Previous() functions to QuantityApprox enum<commit_after>package io.github.deltajulio.pantrybank.data;

/**
 * TODO: add a class header comment
 */

public class FoodItem
{
    private final String TAG = "FoodItem";

    public enum QuantityType
    {
        NULL, NUMERICAL, APPROXIMATE
    }
    public enum QuantityApprox
    {
        NULL,
        NONE_REMAINING
                {
                    @Override
                    public QuantityApprox Previous()
                    {
                        return this;
                    }
                },
        RUNNING_LOW, NORMAL,
        PLENTY
                {
                    @Override
                    public QuantityApprox Next()
                    {
                        return this;
                    }
                };

        public QuantityApprox Next()
        {
            return values()[ordinal() + 1];
        }

        public QuantityApprox Previous()
        {
            return values()[ordinal() - 1];
        }
    }

    private String name;
    private boolean isPinned;
    private String quantityType;
    private String quantity;
    private String categoryId;
    private String foodId;

    @SuppressWarnings("unused")
    public FoodItem() { /*Needed for Firebase ui*/ }

    private FoodItem(String name, boolean isPinned, QuantityType quantityType, String quantity,
                     String categoryId)
    {
        setName(name);
        setIsPinned(isPinned);
        setQuantityType(quantityType);
        setQuantity(quantity);
        setCategoryId(categoryId);
    }

    public FoodItem(String name, boolean isPinned, long quantityNum, String categoryId)
    {
        this(name, isPinned, QuantityType.NUMERICAL, String.valueOf(quantityNum), categoryId);
    }

    public FoodItem(String name, boolean isPinned, QuantityApprox quantityApprox, String categoryId)
    {
        this(name, isPinned, QuantityType.APPROXIMATE, quantityApprox.toString(), categoryId);
    }

    public FoodItem(String name, boolean isPinned, QuantityType quantityType, String categoryId)
    {
        this(name, isPinned, quantityType,
                (quantityType == QuantityType.NUMERICAL ?
                String.valueOf(1): QuantityApprox.NORMAL.toString()),
                categoryId);
    }

    public final String getName() { return name; }
    public void setName(String name) { this.name = name; }

    public final boolean getIsPinned() { return isPinned; }
    public void setIsPinned(boolean isPinned) { this.isPinned = isPinned; }

    public final QuantityType getQuantityType() { return QuantityType.valueOf(quantityType); }
    public void setQuantityType(QuantityType quantityType) { this.quantityType = quantityType.toString(); }

    /**
     * For retrieving database value ONLY. Use long or enum return value instead.
     */
    public final String getQuantity() { return quantity; }

    /**
     * For setting database value ONLY. Use long or enum param version instead.
     */
    public void setQuantity(String quantity) { this.quantity = quantity; }

    public final long GetQuantityLong() { return Long.parseLong(quantity);}
    public void SetQuantityLong(long quantity) { this.quantity = String.valueOf(quantity); }

    public final QuantityApprox GetQuantityEnum() { return QuantityApprox.valueOf(quantity); }
    public void SetQuantityEnum(QuantityApprox quantity) { this.quantity = quantity.toString(); }

    public String getCategoryId() { return categoryId; }
    public void setCategoryId(String categoryId) { this.categoryId = categoryId; }

    public String getFoodId() { return foodId; }
    public void setFoodId(String foodId) { this.foodId = foodId; }
}

{'fraction_non_alphanumeric': 0.08529758397171479, 'fraction_numerical': 0.0005892751915144372, 'mean_word_length': 2.7037643207855973, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6961529', 'n_tokens_mistral': 1899, 'n_tokens_neox': 1782, 'n_words': 499}