All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aol.cyclops.matcher.builders.InCaseOfManyStep2 Maven / Gradle / Ivy

There is a newer version: 7.2.4
Show newest version
package com.aol.cyclops.matcher.builders;

import java.util.List;
import java.util.function.Predicate;

import lombok.AllArgsConstructor;

import com.aol.cyclops.matcher.Action;
import com.aol.cyclops.matcher.TypedFunction;

@AllArgsConstructor
public class InCaseOfManyStep2{
	private final Predicate[] predicates;
	private final PatternMatcher patternMatcher;
	private final CaseBeingBuilt cse;
	
	/**
	 * Create a new Case with the supplied ActionWithReturn as the action
	 * 
	 * @param a Action to be executed when the new Case is triggered
	 * @return Pattern Matcher Builder
	 */
	public  CollectionMatchingInstance thenApply(TypedFunction, X> a){
		return addCase(patternMatcher.inCaseOfMany( a,predicates));
	}
	
	/**
	 * Create a new Case with the supplied ActionWithReturn as the action
	 * 
	 * @param a Action to be executed when the new Case is triggered
	 * @return Pattern Matcher Builder
	 */
	public   CollectionMatchingInstance thenConsume(Action> a){
		return addCase(patternMatcher.caseOfMany( a,predicates));
	}
	private  CollectionMatchingInstance addCase(PatternMatcher o){
		return new CollectionMatchingInstance<>(cse.withPatternMatcher(o));
	}
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy