<commit_before>package server;

import java.util.ArrayList;
import java.util.HashMap;

public class TopicManager {

	private class Node {
		
		private String name;
		
		private ArrayList<String> subscribed;
		
		private HashMap<String, Node> children;
		
		public Node(String name){
			this.name = name;
			this.subscribed = new ArrayList<String>();
			this.children = new HashMap<String, Node>();
		}

		public ArrayList<String> getSubscribed() {
			return subscribed;
		}

		public void setSubscribed(ArrayList<String> subscribed) {
			this.subscribed = subscribed;
		}

		public HashMap<String, Node> getChildren() {
			return children;
		}

		public void setChildren(HashMap<String, Node> children) {
			this.children = children;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}
		
	}
	
	private Node root;
	
	public TopicManager(){
		this.root = new Node("/");
	}
	
	private String[] getComponents(String path){
		if(path.charAt(0) == '/') path = path.substring(1);
		return path.split("/");
	}
	
	private Node getNode(String path){
		String[] components = this.getComponents(path);
		
		Node curr = root;
		
		for(String component : components){
			if(!curr.getChildren().containsKey(component)) return null;
			curr = curr.getChildren().get(component);
		}	
		
		return curr;
	}
	
	public ArrayList<String> getSubscribed(String path){
		ArrayList<String> subscribed = new ArrayList<String>();
		
		String[] components = this.getComponents(path);
		
		Node curr = root;
		subscribed.addAll(curr.getSubscribed());
		
		for(String component : components){
			curr = curr.getChildren().get(component);
			subscribed.addAll(curr.getSubscribed());
		}
		
		return subscribed;
	}
	<commit_msg>Fixing topic manager<commit_after>package server;

import java.util.ArrayList;
import java.util.HashMap;

public class TopicManager {

	private class Node {
		
		private String name;
		
		private ArrayList<String> subscribed;
		
		private HashMap<String, Node> children;
		
		public Node(String name){
			this.name = name;
			this.subscribed = new ArrayList<String>();
			this.children = new HashMap<String, Node>();
		}

		public ArrayList<String> getSubscribed() {
			return subscribed;
		}

		public void setSubscribed(ArrayList<String> subscribed) {
			this.subscribed = subscribed;
		}

		public HashMap<String, Node> getChildren() {
			return children;
		}

		public void setChildren(HashMap<String, Node> children) {
			this.children = children;
		}

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}
		
	}
	
	private Node root;
	
	public TopicManager(){
		this.root = new Node("/");
	}
	
	private String[] getComponents(String path){
		if(path.charAt(0) == '/') path = path.substring(1);
		return path.split("/");
	}
	
	private Node getNode(String path){
		String[] components = this.getComponents(path);
		
		Node curr = root;
		
		for(String component : components){
			if(!curr.getChildren().containsKey(component)) return null;
			curr = curr.getChildren().get(component);
		}	
		
		return curr;
	}
	
	public ArrayList<String> getSubscribed(String path){
		ArrayList<String> subscribed = new ArrayList<String>();
		
		String[] components = this.getComponents(path);
		
		Node curr = root;
		subscribed.addAll(curr.getSubscribed());
		
		for(String component : components){
			curr = curr.getChildren().get(component);
			if(curr == null) break;
			subscribed.addAll(curr.getSubscribed());
		}
		
		return subscribed;
	}
	
{'fraction_non_alphanumeric': 0.12408553742262239, 'fraction_numerical': 0.0011254924029262803, 'mean_word_length': 3.74, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4660793', 'n_tokens_mistral': 1268, 'n_tokens_neox': 1058, 'n_words': 263}