Class MultipleUnorderedOptionsPredicate
- java.lang.Object
-
- org.sonar.iac.docker.checks.utils.command.MultipleUnorderedOptionsPredicate
-
- All Implemented Interfaces:
CommandPredicate
public class MultipleUnorderedOptionsPredicate extends Object implements CommandPredicate
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.sonar.iac.docker.checks.utils.command.CommandPredicate
CommandPredicate.Type
-
-
Constructor Summary
Constructors Constructor Description MultipleUnorderedOptionsPredicate(List<OptionPredicate> options)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OptionPredicatecalculateAnyOptionMatchingExceptExpected()booleanhasType(CommandPredicate.Type... types)true if any of the option predicates matchbooleanisShouldSupportAnyMatch()voidmatch(PredicateContext context)Used to match this predicate, by trying to match the contained list ofoptions.booleanmatchExpectedOrAnyOption(PredicateContext context, Set<OptionPredicate> fulfilledOptions, List<OptionPredicate> workingSet, OptionPredicate anyOptionExceptExpectedPredicate)Tries to match anOptionPredicateof theworkingSetor possibly any other option except those from the workingSet if none of those matches.
-
-
-
Constructor Detail
-
MultipleUnorderedOptionsPredicate
public MultipleUnorderedOptionsPredicate(List<OptionPredicate> options)
-
-
Method Detail
-
isShouldSupportAnyMatch
public boolean isShouldSupportAnyMatch()
-
calculateAnyOptionMatchingExceptExpected
public OptionPredicate calculateAnyOptionMatchingExceptExpected()
-
hasType
public boolean hasType(CommandPredicate.Type... types)
true if any of the option predicates match- Specified by:
hasTypein interfaceCommandPredicate
-
match
public void match(PredicateContext context)
Used to match this predicate, by trying to match the contained list ofoptions. The listoptionscan be matched in any order, and depending onshouldSupportAnyMatchwith additional flags / options that aren't provided as sensitive options.- Specified by:
matchin interfaceCommandPredicate
-
matchExpectedOrAnyOption
public boolean matchExpectedOrAnyOption(PredicateContext context, Set<OptionPredicate> fulfilledOptions, List<OptionPredicate> workingSet, OptionPredicate anyOptionExceptExpectedPredicate)
Tries to match anOptionPredicateof theworkingSetor possibly any other option except those from the workingSet if none of those matches. One call of this method leads to a maximum of anOptionPredicatematched.
-
-