org.jetbrains.jet.storage
Interface StorageManager

All Known Subinterfaces:
LazyResolveStorageManager
All Known Implementing Classes:
LockBasedLazyResolveStorageManager, LockBasedStorageManager

public interface StorageManager


Method Summary
<T> T
compute(jet.Function0<T> computable)
           
<T> NotNullLazyValue<T>
createLazyValue(jet.Function0<T> computable)
           
<T> NotNullLazyValue<T>
createLazyValueWithPostCompute(jet.Function0<T> computable, jet.Function1<java.lang.Boolean,T> onRecursiveCall, jet.Function1<T,jet.Unit> postCompute)
           
<K,V> MemoizedFunctionToNotNull<K,V>
createMemoizedFunction(jet.Function1<K,V> compute)
          Given a function compute: K -> V create a memoized version of it that computes a value only once for each key
<K,V> MemoizedFunctionToNullable<K,V>
createMemoizedFunctionWithNullableValues(jet.Function1<K,V> compute)
           
<T> NullableLazyValue<T>
createNullableLazyValue(jet.Function0<T> computable)
           
<T> NullableLazyValue<T>
createNullableLazyValueWithPostCompute(jet.Function0<T> computable, jet.Function1<T,jet.Unit> postCompute)
          postCompute is called after the value is computed, but before any other thread sees it (the current thread may see it in between)
<T> NotNullLazyValue<T>
createRecursionTolerantLazyValue(jet.Function0<T> computable, T onRecursiveCall)
           
<T> NullableLazyValue<T>
createRecursionTolerantNullableLazyValue(jet.Function0<T> computable, T onRecursiveCall)
           
 

Method Detail

createMemoizedFunction

@NotNull
<K,V> MemoizedFunctionToNotNull<K,V> createMemoizedFunction(@NotNull
                                                                    jet.Function1<K,V> compute)
Given a function compute: K -> V create a memoized version of it that computes a value only once for each key

Parameters:
compute - the function to be memoized
valuesReferenceKind - how to store the memoized values NOTE: if compute() has side-effects the WEAK reference kind is dangerous: the side-effects will be repeated if the value gets collected and then re-computed

createMemoizedFunctionWithNullableValues

@NotNull
<K,V> MemoizedFunctionToNullable<K,V> createMemoizedFunctionWithNullableValues(@NotNull
                                                                                       jet.Function1<K,V> compute)

createLazyValue

@NotNull
<T> NotNullLazyValue<T> createLazyValue(@NotNull
                                                jet.Function0<T> computable)

createRecursionTolerantLazyValue

@NotNull
<T> NotNullLazyValue<T> createRecursionTolerantLazyValue(@NotNull
                                                                 jet.Function0<T> computable,
                                                                 @NotNull
                                                                 T onRecursiveCall)

createLazyValueWithPostCompute

@NotNull
<T> NotNullLazyValue<T> createLazyValueWithPostCompute(@NotNull
                                                               jet.Function0<T> computable,
                                                               @Nullable
                                                               jet.Function1<java.lang.Boolean,T> onRecursiveCall,
                                                               @NotNull
                                                               jet.Function1<T,jet.Unit> postCompute)
Parameters:
onRecursiveCall - is called if the computation calls itself recursively. The parameter to it is true for the first call, false otherwise. If onRecursiveCall is null, an exception will be thrown on a recursive call, otherwise it's executed and its result is returned
postCompute - is called after the value is computed, but before any other thread sees it

createNullableLazyValue

@NotNull
<T> NullableLazyValue<T> createNullableLazyValue(@NotNull
                                                         jet.Function0<T> computable)

createRecursionTolerantNullableLazyValue

@NotNull
<T> NullableLazyValue<T> createRecursionTolerantNullableLazyValue(@NotNull
                                                                          jet.Function0<T> computable,
                                                                          @Nullable
                                                                          T onRecursiveCall)

createNullableLazyValueWithPostCompute

@NotNull
<T> NullableLazyValue<T> createNullableLazyValueWithPostCompute(@NotNull
                                                                        jet.Function0<T> computable,
                                                                        @NotNull
                                                                        jet.Function1<T,jet.Unit> postCompute)
postCompute is called after the value is computed, but before any other thread sees it (the current thread may see it in between)


compute

<T> T compute(@NotNull
              jet.Function0<T> computable)