package edu.claflin.finder.algo.clustering.struct.infomap_struct;

import edu.claflin.finder.logic.Node;

import java.util.HashSet;
import java.util.Set;

public class ModuleNode extends Node {

    private final Set<Node> members;

    /**
     * Initializes the Node object.
     *
     * @param identifier the String representing the Node's identifier.
     */
    public ModuleNode(String identifier) {
        super(identifier);
        this.members = new HashSet<>();
    }

    public ModuleNode(Node node) {
        super(node.getIdentifier());
        this.setIntegerIdentifier(node.getIntegerIdentifier());
        this.members = null;
    }

    public Set<Node> getMembers() {
        return members;
    }

    public void addMember(Node node) {
        this.members.add(node);
    }

    public void removeMember(Node node) {
        this.members.remove(node);
    }

    public boolean isModule() {
        return this.members != null;
    }
}
