Minor. Add isComputing to DeferredType

This commit is contained in:
Stanislav Erokhin
2015-12-08 15:00:31 +03:00
parent 11410000b4
commit 10a13e737e
3 changed files with 11 additions and 0 deletions
@@ -77,6 +77,10 @@ public class DeferredType extends DelegatingType implements LazyType {
this.lazyValue = lazyValue;
}
public boolean isComputing() {
return lazyValue.isComputing();
}
public boolean isComputed() {
return lazyValue.isComputed();
}
@@ -286,6 +286,11 @@ public class LockBasedStorageManager implements StorageManager {
return value != NotValue.NOT_COMPUTED && value != NotValue.COMPUTING;
}
@Override
public boolean isComputing() {
return value == NotValue.COMPUTING;
}
@Override
public T invoke() {
Object _value = value;
@@ -28,10 +28,12 @@ public interface MemoizedFunctionToNullable<P, R : Any> : Function1<P, R?> {
public interface NotNullLazyValue<T : Any> : Function0<T> {
public fun isComputed(): Boolean
public fun isComputing(): Boolean
}
public interface NullableLazyValue<T : Any> : Function0<T?> {
public fun isComputed(): Boolean
public fun isComputing(): Boolean
}
public operator fun <T : Any> NotNullLazyValue<T>.getValue(_this: Any?, p: KProperty<*>): T = invoke()