<commit_before><commit_msg>This class is incomplete.  It also won't be the most efficient because it loads in all of the OTObjects.  But it has been sorely missing for quite a while now.<commit_after>package org.concord.otrunk;

import java.util.ArrayList;

import org.concord.framework.otrunk.OTCollection;
import org.concord.framework.otrunk.OTObject;
import org.concord.framework.otrunk.OTObjectList;
import org.concord.framework.otrunk.OTResourceCollection;
import org.concord.framework.otrunk.otcore.OTClass;
import org.concord.framework.otrunk.otcore.OTClassProperty;

/**
 * OTBreadthFirstSearch <br>
 * This is not functional yet.
 * <p>
 * Date created: Aug 5, 2008
 * 
 * @author scytacki<p>
 *
 */
public class OTBreadthFirstSearch
{
	OTObject root;
	
	public OTBreadthFirstSearch(OTObject root)
    {	
		this.root = root;
    }
	
	/**
	 * This will not be efficient, but it good at least for illustration purposes.
	 * It also might not handle the bodyText of compound documents correctly.
	 * 
	 * @param klass
	 * @param root
	 * @return
	 */
	public OTObject findFirstBreadthFirst()
	{
		/*
		String className = klass.getName();
        OTClass otClass = OTrunkImpl.getOTClass(className);
        
        if(otClass == null){
        	return null;
        }
        */
		OTClass otClass = root.otClass();
		ArrayList otClassProperties = otClass.getOTAllClassProperties();
		
		for(int i=0; i<otClassProperties.size(); i++){
			OTClassProperty prop = (OTClassProperty) otClassProperties.get(i);
			if(prop.isPrimitive()){
				continue;
			}
			
			if(prop.isList() || prop.isMap()){
				OTCollection collection = (OTCollection) root.otGet(prop);
				if(collection == null || 
						collection instanceof OTResourceCollection ||
						collection.size() == 0){
					continue;
				}
				
				if(collection instanceof OTObjectList){
					OTObjectList list = (OTObjectList) collection;
					for(int j=0; j<list.size(); j++){
						OTObject child = list.get(j);
						
					}
				}
			}
		}

		throw new UnsupportedOperationException("This method isn't finished yet");
	}

}
{'fraction_non_alphanumeric': 0.10897743638982237, 'fraction_numerical': 0.003840614498319731, 'mean_word_length': 3.3507306889352817, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 6, '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': '6715762', 'n_tokens_mistral': 752, 'n_tokens_neox': 639, 'n_words': 163}