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

com.neko233.skilltree.game.attributeTree.impl.GameGameAttributeTree Maven / Gradle / Ivy

There is a newer version: 0.3.6
Show newest version
package com.neko233.skilltree.game.attributeTree.impl;

import com.neko233.skilltree.game.attributeTree.GameAttributeNode;
import com.neko233.skilltree.game.attributeTree.GameAttributeTreeApi;

import java.util.HashMap;
import java.util.Map;

public class GameGameAttributeTree implements GameAttributeTreeApi {
    private final Map pathToNodeMap = new HashMap<>();

    public GameGameAttributeTree() {
    }

    @Override
    public void addAttribute(GameAttributeNode node) {
        String path = node.getPath();
        pathToNodeMap.put(path, node);

        updateParentNodeRecursive(node, true);


    }


    @Override
    public void removeAttribute(String path) {
        GameAttributeNode removeNode = pathToNodeMap.remove(path);

        updateParentNodeRecursive(removeNode, false);
    }

    @Override
    public GameAttributeNode getAttributeNode(String path) {
        return pathToNodeMap.get(path);
    }


    @Override
    public Map getPathToNodeMap() {
        return pathToNodeMap;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy