private HashMap<Integer, List<Tree>> getPrefixesAndSuffixes() {
		HashMap<Integer, List<Tree>> res = new HashMap<Integer, List<Tree>>();
		if (prefix != null || suffix != null) {
			// If the prefix is defined then map 'begin' to this node.
			// Prefixes are visualized before the current node, i.e. at 'begin' position.
			if (prefix != null) {
				List<Tree> l = new LinkedList<Tree>();
				l.add(this);
				res.put(begin, l);
			}
			
			// If suffix is defined then map 'end' to this node.
			// Suffixes are visualized after the current node, i.e. at 'end' position.
			// Because 'end' is exclusive then the suffix will be displayed just after
			// the current node.
			if (suffix != null) {
				List<Tree> l = new LinkedList<Tree>();
				l.add(this);
				res.put(end, l);
			}
		}
		
		// Do this recursively for all subtrees.
		for (Tree b: branches) {
			// If there is a missing subtree or a subtree that doesn't
			// contain anything then skip it.
			if (b == null || b.node.length() == 0) {
				continue;
			}
			
			// Get current subtree's prefixes and suffixes and
			// merge them to all prefixes and suffixes defined
			// on this position (if any).
			HashMap<Integer, List<Tree>> map = b.getPrefixesAndSuffixes();
			for (Integer n: map.keySet()) {
				List<Tree> l1 = res.get(n);
				List<Tree> l2 = map.get(n);
				if (l1 != null) {
					l1.addAll(l2);
				} else {
					res.put(n, l2);
				}
			}
		}
		
		return res;
	}