package edu.nyu.cs9053.concurrency.chapter14.atomicity;

/**
 * User: blangel
 * Date: 7/26/14
 * Time: 4:25 PM
 */
public class ThreadSafe {

    private final int bounded;

    public ThreadSafe(int value) {
        this.bounded = value;
    }

    public ThreadSafe addUpTo100(int delta) {
        if ((bounded + delta) < 100) {
            return new ThreadSafe(bounded + delta);
        }
        return this;
    }

}
