<commit_before>package com.bustiblelemons.cthulhator.model.dice;

import java.util.Observable;
import java.util.Random;

/**
 * Created by bhm on 09.09.14.
 */
public class PointPool extends Observable {
    private Random mRandom;
    private int        mMax         = Integer.MAX_VALUE;
    private int        points       = mMax;
    private int        mMin         = 0;
    private Observable mObservalble = new Observable();

    private PointPool(int max) {
        this(0, max);
    }

    private PointPool(int min, int max) {
        this(min, max, System.currentTimeMillis());
    }

    private PointPool(int min, int max, long mSeed) {
        this.mMin = min;
        this.mMax = max;
        this.points = max;
        mRandom = new Random(mSeed);
    }

    public static PointPool random(int max) {
        PointPool r = new PointPool(max);
        return r;
    }

    public int getMax() {
        return mMax;
    }

    public int getMin() {
        return mMin;
    }

    public void setMin(int mMin) {
        this.mMin = mMin;
    }

    public int getPoints() {
        return points;
    }

    public void setPoints(int points) {
        this.points = points;
    }

    public synchronized boolean increase() {
        if (points + 1 <= mMax) {
            points++;
            return true;
        }
        return false;
    }

    public synchronized boolean decrease() {
        if (points - 1 >= mMin) {
            points--;
            return false;
        }
        return false;
    }

    @Override
    public String toString() {
        return "PointPool{" +
                "mRandom=" + mRandom +
                ", mMax=" + mMax +
                ", points=" + points +
                ", mMin=" + mMin +
                ", mObservalble=" + mObservalble +
                '}';
    }

    public static class Builder {<commit_msg>pointpool dec rand<commit_after>package com.bustiblelemons.cthulhator.model.dice;

import java.util.Observable;
import java.util.Random;

/**
 * Created by bhm on 09.09.14.
 */
public class PointPool extends Observable {
    private Random mRandom;
    private int        mMax         = Integer.MAX_VALUE;
    private int        points       = mMax;
    private int        mMin         = 0;
    private Observable mObservalble = new Observable();

    private PointPool(int max) {
        this(0, max);
    }

    private PointPool(int min, int max) {
        this(min, max, System.currentTimeMillis());
    }

    private PointPool(int min, int max, long mSeed) {
        this.mMin = min;
        this.mMax = max;
        this.points = max;
        mRandom = new Random(mSeed);
    }

    public static PointPool random(int max) {
        PointPool r = new PointPool(max);
        return r;
    }

    public int getMax() {
        return mMax;
    }

    public int getMin() {
        return mMin;
    }

    public void setMin(int mMin) {
        this.mMin = mMin;
    }

    public int getPoints() {
        return points;
    }

    public void setPoints(int points) {
        this.points = points;
    }

    public synchronized boolean increase() {
        if (points + 1 <= mMax) {
            points++;
            return true;
        }
        return false;
    }

    public synchronized boolean decrease() {
        if (points - 1 >= mMin) {
            points--;
            return false;
        }
        return false;
    }

    public synchronized int decreaseByRandom() {
        return decreaseByRandom(getPoints());
    }

    public synchronized int decreaseByRandom(int byMax) {
        int mod = 0;
        if (points > 0) {
            mod = mRandom.nextInt(byMax) + 1;
            points -= mod;
        }
        return mod;
    }

    @Override
    public String toString() {
        return "PointPool{" +
                "mRandom=" + mRandom +
                ", mMax=" + mMax +
                ", points=" + points +
                ", mMin=" + mMin +
                ", mObservalble=" + mObservalble +
                '}';
    }

    public static class Builder {
{'fraction_non_alphanumeric': 0.10034431874077718, 'fraction_numerical': 0.005656665027053615, 'mean_word_length': 1.59375, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '7062706', 'n_tokens_mistral': 1219, 'n_tokens_neox': 1157, 'n_words': 324}