All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.reactfx.value.SuspendableValWrapper Maven / Gradle / Ivy

There is a newer version: 1.11
Show newest version
package org.reactfx.value;

import java.util.function.Consumer;

import org.reactfx.SuspendableBase;
import org.reactfx.util.AccumulatorSize;
import org.reactfx.util.NotificationAccumulator;

class SuspendableValWrapper
extends SuspendableBase, T, T>
implements SuspendableVal, ProperVal {
    private final Val delegate;

    protected SuspendableValWrapper(Val obs) {
        super(
                obs.invalidations(),
                NotificationAccumulator.retainOldestValNotifications());
        this.delegate = obs;
    }

    @Override
    public T getValue() {
        return delegate.getValue();
    }

    @Override
    protected AccumulatorSize sizeOf(T accum) {
        return AccumulatorSize.ONE;
    }

    @Override
    protected T headOf(T accum) {
        return accum;
    }

    @Override
    protected T tailOf(T accum) {
        throw new UnsupportedOperationException("Cannot take a tail of a single value");
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy