<commit_before>/*
 * Created on Nov 9, 2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package edu.wustl.catissuecore.query;

import java.util.HashMap;
import java.util.Map;
import java.util.Vector;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.swing.tree.DefaultMutableTreeNode;

import edu.wustl.catissuecore.bizlogic.BizLogicFactory;
import edu.wustl.catissuecore.bizlogic.QueryBizLogic;
import edu.wustl.catissuecore.util.global.Constants;
import edu.wustl.common.util.logger.Logger;

/**
 * @author poornima_govindrao
 *
 *This class is for diplaying the tree in query view of Advanced Search 
 * 
 */
public class TreeView {
	
	//Variable which holds node ID in the tree. 
	private int nodeId=0;
	private boolean andOrBool = false;
	
	//Recursive function to create the tree
	public void arrangeTree(DefaultMutableTreeNode node,int parentId,Vector tree,Map advancedConditionNodesMap,int checkedNode,String operation) throws Exception
	{
			nodeId++;
			
			//Loop for all the children for the current node.
			for(int i = 0; i < node.getChildCount();i++){
				//nodeCount++;
				DefaultMutableTreeNode child = (DefaultMutableTreeNode)node.getChildAt(i);
				DefaultMutableTreeNode parent = (DefaultMutableTreeNode)child.getParent();
				
				if(!parent.isRoot())
				{
					AdvancedConditionsNode parentAdvConditionNode = (AdvancedConditionsNode)parent.getUserObject();
					String temp = parentAdvConditionNode.getOperationWithChildCondition().getOperator();
					if(temp.equals(Operator.AND))
					{
						andOrBool = true;
					}
					else
					{
						andOrBool = false;
					}
					
				}
				AdvancedConditionsNode advConditionNode = (AdvancedConditionsNode)child.getUserObject();
				advancedConditionNodesMap.put(new Integer(nodeId),child);
								
				if(nodeId == checkedNode)
				{
//					if(operation !)
					if(operation.equals(Operator.AND))
					{
						advConditionNode.setOperationWithChildCondition(new Operator(Operator.AND));
					}
					else
					{
						advConditionNode.setOperationWithChildCondition(new Operator(Operator.OR));
					}
				}
				
				Vector vectorOfCondtions = advConditionNode.getObjectConditions();<commit_msg>change value of operator form AND to EXIST<commit_after>/*
 * Created on Nov 9, 2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package edu.wustl.catissuecore.query;

import java.util.HashMap;
import java.util.Map;
import java.util.Vector;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.swing.tree.DefaultMutableTreeNode;

import edu.wustl.catissuecore.bizlogic.BizLogicFactory;
import edu.wustl.catissuecore.bizlogic.QueryBizLogic;
import edu.wustl.catissuecore.util.global.Constants;
import edu.wustl.common.util.logger.Logger;

/**
 * @author poornima_govindrao
 *
 *This class is for diplaying the tree in query view of Advanced Search 
 * 
 */
public class TreeView {
	
	//Variable which holds node ID in the tree. 
	private int nodeId=0;
	private boolean andOrBool = false;
	
	//Recursive function to create the tree
	public void arrangeTree(DefaultMutableTreeNode node,int parentId,Vector tree,Map advancedConditionNodesMap,int checkedNode,String operation) throws Exception
	{
			nodeId++;
			
			//Loop for all the children for the current node.
			for(int i = 0; i < node.getChildCount();i++){
				//nodeCount++;
				DefaultMutableTreeNode child = (DefaultMutableTreeNode)node.getChildAt(i);
				DefaultMutableTreeNode parent = (DefaultMutableTreeNode)child.getParent();
				
				if(!parent.isRoot())
				{
					AdvancedConditionsNode parentAdvConditionNode = (AdvancedConditionsNode)parent.getUserObject();
					String temp = parentAdvConditionNode.getOperationWithChildCondition().getOperator();
					if(temp.equals(Operator.EXIST))
					{
						andOrBool = true;
					}
					else
					{
						andOrBool = false;
					}
					
				}
				AdvancedConditionsNode advConditionNode = (AdvancedConditionsNode)child.getUserObject();
				advancedConditionNodesMap.put(new Integer(nodeId),child);
								
				if(nodeId == checkedNode)
				{
//					if(operation !)
					if(operation.equals(Operator.EXIST))
					{
						advConditionNode.setOperationWithChildCondition(new Operator(Operator.EXIST));
					}
					else
					{
						advConditionNode.setOperationWithChildCondition(new Operator(Operator.OR));
					}
				}
				
				Vector vectorOfCondtions = advConditionNode.getObjectConditions();
{'fraction_non_alphanumeric': 0.09458000431872166, 'fraction_numerical': 0.0030231051608723817, 'mean_word_length': 3.8451882845188283, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '2009468', 'n_tokens_mistral': 1694, 'n_tokens_neox': 1345, 'n_words': 302}