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

com.jfreeman.attribute.SynthesizedAttribute Maven / Gradle / Ivy

package com.jfreeman.attribute;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import com.jfreeman.lazy.Lazy;

/**
 * @author jfreeman
 */
public class SynthesizedAttribute
    implements Attribute
{
    private final Map> _attrs = new ConcurrentHashMap<>();

    /**
     * {@inheritDoc}
     *
     * May not be called for a node until after its value has been
     * {@link #set(Object, Lazy)}.
     */
    @Override
    public Lazy get(N node) {
        return _attrs.get(node);
    }

    /**
     * {@inheritDoc}
     *
     * Must be called before {@link #get(Object)} for the same node.
     */
    @Override
    public void set(N node, Lazy value) {
        _attrs.put(node, value);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy