public GTreeNode filter(GTreeFilter filter, TaskMonitor monitor)
			throws CancelledException, CloneNotSupportedException {
		List<GTreeNode> list = new ArrayList<>();
		if (isLoaded()) {
			for (GTreeNode child : children()) {
				monitor.checkCancelled();
				GTreeNode filtered = child.filter(filter, monitor);
				if (filtered != null) {
					list.add(filtered);
				}
				monitor.incrementProgress(1);
			}
		}

		if (isRoot() || !list.isEmpty() || filter.acceptsNode(this)) {
			GTreeNode clone = clone();
			clone.doSetChildren(list);
			return clone;
		}
		return null;
	}
Generates a filtered copy of this node and its children.
<P>
A node will be included if it or any of its descendants are accepted by the filter. NOTE: the
filter will only be applied to a nodes children if they are loaded. So to perform a filter on
all the nodes in the tree, the {@link #loadAll(TaskMonitor)} should be called before the
filter call.

@param filter the filter being applied
@param monitor a TaskMonitor for tracking the progress and cancelling
@return A copy of this node and its children that matches the filter or null if this node and
        none of its children match the filter.
@throws CancelledException if the operation is cancelled via the TaskMonitor
@throws CloneNotSupportedException if any nodes in the tree explicitly prevents cloning
Ghidra/Framework/Docking/src/main/java/docking/widgets/tree/GTreeNode.java