UMD.HCIL.Piccolo.PNode.GetAllNodes C# (CSharp) Method

GetAllNodes() public method

Gets a list containing the subset of this node and all of its descendent nodes that are accepted by the given node filter.
If the filter is null then all nodes will be accepted. If the results parameter is not null then it will be used to store this subset instead of creating a new list.
public GetAllNodes ( PNodeFilter filter, UMD.HCIL.Piccolo.Util.PNodeList results ) : UMD.HCIL.Piccolo.Util.PNodeList
filter PNodeFilter The filter used to determine the subset.
results UMD.HCIL.Piccolo.Util.PNodeList The list used to collect the subset; can be null.
return UMD.HCIL.Piccolo.Util.PNodeList
		public virtual PNodeList GetAllNodes(PNodeFilter filter, PNodeList results) {
			if (results == null) {
				results = new PNodeList();
			}
			if (filter == null || filter.Accept(this)) {
				results.Add(this);
			}

			if (filter == null || filter.AcceptChildrenOf(this)) {
				int count = ChildrenCount;
				for (int i = 0; i < count; i++) {
					children[i].GetAllNodes(filter, results);
				}
			}

			return results;
		}
		#endregion