package edu.nyu.cs9053.concurrency.livelock;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;

/**
 * User: blangel
 * Date: 11/9/14
 * Time: 12:04 PM
 */
abstract class AbstractDirection implements Lock {

    private final Lock delegate;

    AbstractDirection(Lock delegate) {
        this.delegate = delegate;
    }

    @Override public void lock() {
        delegate.lock();
    }

    @Override public void lockInterruptibly() throws InterruptedException {
        delegate.lockInterruptibly();
    }

    @Override public boolean tryLock() {
        return delegate.tryLock();
    }

    @Override public boolean tryLock(long time, TimeUnit unit) throws InterruptedException {
        return delegate.tryLock(time, unit);
    }

    @Override public void unlock() {
        delegate.unlock();
    }

    @Override public Condition newCondition() {
        return delegate.newCondition();
    }
}
