// 
// Decompiled by Procyon v0.6.0
// 

package com.hypixel.hytale.server.worldgen.loader.util;

import java.util.function.Function;
import java.util.HashMap;
import com.google.gson.JsonElement;
import javax.annotation.Nonnull;
import java.util.Map;

public class FileMaskCache<T>
{
    @Nonnull
    private final Map<String, T> fileCache;
    @Nonnull
    private final Map<String, JsonElement> fileElements;
    
    public FileMaskCache() {
        this.fileCache = new HashMap<String, T>();
        this.fileElements = new HashMap<String, JsonElement>();
    }
    
    public T getIfPresentFileMask(final String filename) {
        return this.fileCache.get(filename);
    }
    
    public void putFileMask(final String filename, final T value) {
        this.fileCache.put(filename, value);
    }
    
    public JsonElement cachedFile(final String filename, @Nonnull final Function<String, JsonElement> function) {
        return this.fileElements.computeIfAbsent(filename, function);
    }
}
