List of usage examples for org.apache.commons.collections15 CollectionUtils exists
public static <E> boolean exists(Iterable<E> iterable, Predicate<? super E> predicate)
From source file:com.javaid.bolaky.domain.pools.entity.Pool.java
public void completed() { if (this.poolStatus.equals(PoolStatus.DRAFT) || this.poolStatus.equals(PoolStatus.ACTIVE)) { final Set<PoolsError> poolsErrors = this.validate(); final String startingDateFutureErrorCode = "P120"; final String endDateFutureErrorCode = "P171"; Predicate<PoolsError> startingDateErrorCodePredicate = new Predicate<PoolsError>() { public boolean evaluate(PoolsError poolsError) { return poolsError.getErrorCode().equalsIgnoreCase(startingDateFutureErrorCode); }/*from w ww. j a v a 2 s . c o m*/ }; Predicate<PoolsError> endDateErrorCodePredicate = new Predicate<PoolsError>() { public boolean evaluate(PoolsError poolsError) { return poolsError.getErrorCode().equalsIgnoreCase(endDateFutureErrorCode); } }; if (CollectionUtils.exists(poolsErrors, startingDateErrorCodePredicate) && CollectionUtils.exists(poolsErrors, endDateErrorCodePredicate)) { this.poolStatus = PoolStatus.COMPLETED; } } }
From source file:org.drugis.mtc.model.Study.java
public boolean containsTreatment(final Treatment t) { return CollectionUtils.exists(getMeasurements(), new Predicate<Measurement>() { public boolean evaluate(Measurement m) { return m.getTreatment().equals(t); }// ww w. j a v a 2s .c o m }); }
From source file:org.drugis.mtc.parameterization.InconsistencyBaselineSearchProblem.java
private boolean existsNoneMissing(Set<List<Treatment>> cycles, final Set<FoldedEdge<Treatment, Study>> covered) { return CollectionUtils.exists(cycles, new Predicate<List<Treatment>>() { public boolean evaluate(List<Treatment> cycle) { return countMissingEdges(cycle, covered) == 0; }//from w w w . j av a 2 s .c om }); }
From source file:org.drugis.mtc.parameterization.InconsistencyBaselineSearchProblem.java
private boolean existsTooManyMissing(Set<List<Treatment>> cycles, final Set<FoldedEdge<Treatment, Study>> covered) { return CollectionUtils.exists(cycles, new Predicate<List<Treatment>>() { public boolean evaluate(List<Treatment> cycle) { return countMissingEdges(cycle, covered) < -1; }/*ww w .j ava 2s. c o m*/ }); }
From source file:org.drugis.mtc.parameterization.Part.java
/** * A part represents an undirected comparison measured by a set of studies. * Hence, (new Part(ta, tb, s)).equals(new Part(tb, ta, s)). *//*from www. j a v a 2 s .c o m*/ public Part(final Treatment t1, final Treatment t2, final Set<Study> studies) { if (studies.isEmpty()) { throw new IllegalArgumentException("The given list of studies may not be empty."); } if (CollectionUtils.exists(studies, new Predicate<Study>() { public boolean evaluate(Study s) { return !s.containsTreatment(t1) || !s.containsTreatment(t2); } })) { throw new IllegalArgumentException("All studies must contain both treatments"); } d_treatments.add(t1); d_treatments.add(t2); d_studies = studies; }