baseQuery.setNode( EnumQuery.AND );
baseQuery.setNode( EnumQuery.OR );
	public void send() {				Query searchQuery = new Query();		/* if we have only one SearchQuery or SearchOptions,		 * we don't need to build the whole tree-structure		 * and we can directly set the searchQuery /searchOptions		 */		 Query baseQuery = new Query();		 baseQuery.setNode( EnumQuery.AND );		 		 /*process OR-Entrys*/		 if ( orQuerys.size() > 0 ) {		 	// if only one or-Query: add this directly to the basequery		 	if ( orQuerys.size() == 1 ) {		 		baseQuery.addQuery( ( Query ) orQuerys.get( 0 ) );		 	}		 	else {		 		//create OR-Query, put all those stuff in, and add to baseQuery		 		Query orQuery = new Query();		 		orQuery.setNode( EnumQuery.OR );				Iterator it = orQuerys.iterator();				while ( it.hasNext() ) {					Query temp = ( Query ) it.next();					orQuery.addQuery( temp );				}				baseQuery.addQuery( orQuery );		 				 	}		 }		 		/*process AND-Entrys*/		if ( andQuerys.size() > 0 ) {		   // if only one AND-Query: add this directly to the basequery		   if ( andQuerys.size() == 1 ) {			   baseQuery.addQuery( ( Query ) andQuerys.get( 0 ) );		   }		   else {			   //create AND-Query, put all those stuff in, and add to baseQuery			   Query andQuery = new Query();			   andQuery.setNode( EnumQuery.AND );			   Iterator it = andQuerys.iterator();			   while ( it.hasNext() ) {				   Query temp = ( Query ) it.next();				   andQuery.addQuery( temp );			   }			   baseQuery.addQuery( andQuery );		 				   }		}				/*if basequery as only one entry, than this entry is basequery.*/		if ( baseQuery.getQueries().length == 1 )			baseQuery = baseQuery.getQueries()[ 0 ];		 		 		 if ( andNotQuerys.size() > 0 ) {		 	/*we hav at least one AND_NOT entry, so we have to create		 	 * a and_not-node and fill it		 	 */		 		 		 	searchQuery.setNode( EnumQuery.AND_NOT );		 	if ( andNotQuerys.size() == 1 ) {		 		/*only one entry, no need for tree*/		 		searchQuery.setSAndNot( ( Query ) andNotQuerys.get( 0 ) );		 	}		 	else {		 		/*multiple entrys, we need a tree*/		 		Query andNotQuery = new Query();		 		andNotQuery.setNode( EnumQuery.OR );		 		Iterator it = andNotQuerys.iterator();		 		while ( it.hasNext() ) {		 			 Query temp = ( Query ) it.next();		 			 andNotQuery.addQuery( temp );		 		}		 		searchQuery.setSAndNot( andNotQuery ); 				 	}		 	searchQuery.setFAndNot( baseQuery );		 }		 /*No AND_NOT search, so we only search baseQuery*/		 else searchQuery = baseQuery;		 		 				if ( searchOptions.getQueries().length == 1 )			searchOptions = searchOptions.getQueries()[ 0 ];							/* now we do know, what our search exactly looks like, 		 * we can build the whole thing correct		 *		 * This is the wrapper for options & search-query		 */		mainQuery = new Query();		mainQuery.setNode( EnumQuery.AND );			mainQuery.addQuery( searchOptions );					mainQuery.addQuery( searchQuery );					List content = new ArrayList();		content.add( new Integer( searchIdentifier ) );				/* now we need to get the Query sorted out in kind of Objects[] */		Object[] tempArray = this.mainQuery.toObjectArray();		for ( int i = 0; i < tempArray.length; i++ ) {							content.add( tempArray [ i ] );		}				content.add( new Integer( maxSearchResults ) );		content.add( new Byte( searchType ) );		content.add( new Integer( network ) );				/* create the message content */		Message consoleMessage =			new EncodeMessage( Message.S_SEARCH_QUERY, content.toArray() );		consoleMessage.sendMessage( this.getParent() );	}