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

com.vladsch.flexmark.ext.attributes.internal.NodeAttributeRepository Maven / Gradle / Ivy

package com.vladsch.flexmark.ext.attributes.internal;

import com.vladsch.flexmark.ext.attributes.AttributesExtension;
import com.vladsch.flexmark.ext.attributes.AttributesNode;
import com.vladsch.flexmark.util.ast.KeepType;
import com.vladsch.flexmark.util.ast.Node;
import com.vladsch.flexmark.util.data.DataHolder;
import com.vladsch.flexmark.util.data.DataKey;
import org.jetbrains.annotations.NotNull;

import java.util.*;

@SuppressWarnings("WeakerAccess")
public class NodeAttributeRepository implements Map> {
    protected final HashMap> nodeAttributesHashMap = new HashMap<>();

    public NodeAttributeRepository(DataHolder options) {
    }

    public DataKey getDataKey() {
        return AttributesExtension.NODE_ATTRIBUTES;
    }

    public DataKey getKeepDataKey() {
        return AttributesExtension.ATTRIBUTES_KEEP;
    }

    @Override
    public int size() {
        return nodeAttributesHashMap.size();
    }

    @Override
    public boolean isEmpty() {
        return nodeAttributesHashMap.isEmpty();
    }

    @Override
    public boolean containsKey(Object key) {
        return nodeAttributesHashMap.containsKey(key);
    }

    @Override
    public boolean containsValue(Object value) {
        return nodeAttributesHashMap.containsValue(value);
    }

    @Override
    public ArrayList get(Object key) {
        return nodeAttributesHashMap.get(key);
    }

    @Override
    public ArrayList put(Node key, ArrayList value) {
        return nodeAttributesHashMap.put(key, value);
    }

    public ArrayList put(Node key, AttributesNode value) {
        ArrayList another = nodeAttributesHashMap.get(key);
        if (another == null) {
            another = new ArrayList<>();
            nodeAttributesHashMap.put(key, another);
        }
        another.add(value);
        return another;
    }

    @Override
    public ArrayList remove(Object key) {
        return nodeAttributesHashMap.remove(key);
    }

    @Override
    public void putAll(@NotNull Map> m) {
        nodeAttributesHashMap.putAll(m);
    }

    @Override
    public void clear() {
        nodeAttributesHashMap.clear();
    }

    @NotNull
    @Override
    public Set keySet() {
        return nodeAttributesHashMap.keySet();
    }

    @NotNull
    @Override
    public Collection> values() {
        return nodeAttributesHashMap.values();
    }

    @NotNull
    @Override
    public Set>> entrySet() {
        return nodeAttributesHashMap.entrySet();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy