plugin/src/java/org/pm4knime/node/logmanipulation/filter/XLogFilterUtil.java
public static XLog filterByWholeLogFreq(XLog log, boolean isKeep, int iThreshold, ExecutionContext exec) throws CanceledExecutionException {
		// TODO Auto-generated method stub
		XLog nlog = XLogUtil.clonePureLog(log, "event log filtered by trace frequency");
		
		ImmutableListMultimap<TraceVariantByClassifier, XTrace> variantsMap = 
				ClassifyUtil.getTraceVariant(log);
		// sort the trace variant  by frequency
		exec.checkCanceled();
		Map<TraceVariantByClassifier, Collection<XTrace>> sortedMap = variantsMap.asMap().entrySet().stream()
				.sorted((e1, e2) -> e2.getValue().size() - e1.getValue().size())
				 .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, LinkedHashMap::new));
    	int sum = 0;
    	if(isKeep) {
    		for(TraceVariantByClassifier variant : sortedMap.keySet()) {
    			exec.checkCanceled();
        		List<XTrace> traceList = variantsMap.get(variant);
        		if(sum <= iThreshold) {
        			nlog.addAll(traceList);
        		}else
        			break;
        		sum += traceList.size();
    		}
    		
    	}else {
    		for(TraceVariantByClassifier variant : sortedMap.keySet()) {
    			exec.checkCanceled();
        		List<XTrace> traceList = variantsMap.get(variant);
        		if(sum <= iThreshold) {
        			sum += traceList.size();
        			continue ;
        		}else
        			nlog.addAll(traceList);
    		}
    	}
    	
		return nlog;
	}
/**
	 * we guarantee that to give the filtered event log at least the threshold required trace number. 
	 * For example, whole event log 100 trace, threshold 20, but top trace variant has size 25. 
	 * But we will give out the top trace variant with 25 out. 
	 * 
	 * If we need to remove the trace variant. We give the order like that, so If we want to remove the 20 trace variant
	 * we will 
	 * @param log
	 * @param isKeep
	 * @param iThreshold
	 * @param exec 
	 * @return
	 * @throws CanceledExecutionException 
	 */
we guarantee that to give the filtered event log at least the threshold required trace number.
For example, whole event log 100 trace, threshold 20, but top trace variant has size 25.
But we will give out the top trace variant with 25 out.

If we need to remove the trace variant.
we guarantee that to give the filtered event log at least the threshold required trace number . For example whole event log 100 trace threshold 20 but top trace variant has size 25 . But we will give out the top trace variant with 25 out . If we need to remove the trace variant .
public static XLog filterByWholeLogFreq(XLog log, boolean isKeep, int iThreshold, ExecutionContext exec) throws CanceledExecutionException {
		XLog nlog = XLogUtil.clonePureLog(log, "event log filtered by trace frequency");
		ImmutableListMultimap<TraceVariantByClassifier, XTrace> variantsMap = 
				ClassifyUtil.getTraceVariant(log);
		exec.checkCanceled();
		Map<TraceVariantByClassifier, Collection<XTrace>> sortedMap = variantsMap.asMap().entrySet().stream()
				.sorted((e1, e2) -> e2.getValue().size() - e1.getValue().size())
				 .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, LinkedHashMap::new));
    	int sum = 0;
    	if(isKeep) {
    		for(TraceVariantByClassifier variant : sortedMap.keySet()) {
    			exec.checkCanceled();
        		List<XTrace> traceList = variantsMap.get(variant);
        		if(sum <= iThreshold) {
        			nlog.addAll(traceList);
        		}else
        			break;
        		sum += traceList.size();
    		}
    	}else {
    		for(TraceVariantByClassifier variant : sortedMap.keySet()) {
    			exec.checkCanceled();
        		List<XTrace> traceList = variantsMap.get(variant);
        		if(sum <= iThreshold) {
        			sum += traceList.size();
        			continue ;
        		}else
        			nlog.addAll(traceList);
    		}
    	}
		return nlog;
	}
public static XLog filterByWholeLogFreq ( XLog log , boolean isKeep , int iThreshold , ExecutionContext exec ) throws CanceledExecutionException { XLog nlog = XLogUtil . clonePureLog ( log , "event log filtered by trace frequency" ) ; ImmutableListMultimap < TraceVariantByClassifier , XTrace > variantsMap = ClassifyUtil . getTraceVariant ( log ) ; exec . checkCanceled ( ) ; Map < TraceVariantByClassifier , Collection < XTrace > > sortedMap = variantsMap . asMap ( ) . entrySet ( ) . stream ( ) . sorted ( ( e1 , e2 ) -> e2 . getValue ( ) . size ( ) - e1 . getValue ( ) . size ( ) ) . collect ( Collectors . toMap ( Map . Entry :: getKey , Map . Entry :: getValue , ( oldValue , newValue ) -> oldValue , LinkedHashMap :: new ) ) ; int sum = 0 ; if ( isKeep ) { for ( TraceVariantByClassifier variant : sortedMap . keySet ( ) ) { exec . checkCanceled ( ) ; List < XTrace > traceList = variantsMap . get ( variant ) ; if ( sum <= iThreshold ) { nlog . addAll ( traceList ) ; } else break ; sum += traceList . size ( ) ; } } else { for ( TraceVariantByClassifier variant : sortedMap . keySet ( ) ) { exec . checkCanceled ( ) ; List < XTrace > traceList = variantsMap . get ( variant ) ; if ( sum <= iThreshold ) { sum += traceList . size ( ) ; continue ; } else nlog . addAll ( traceList ) ; } } return nlog ; }
we guarantee that to give the filtered event log at least the threshold required trace number.
we guarantee that to give the filtered event log at least the threshold required trace number .
// TODO Auto-generated method stub // sort the trace variant  by frequency