List of usage examples for java.util List containsAll
boolean containsAll(Collection<?> c);
From source file:org.apache.hyracks.algebricks.rewriter.rules.PushMapOperatorDownThroughProductRule.java
@Override public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException { AbstractLogicalOperator op1 = (AbstractLogicalOperator) opRef.getValue(); // Even the LIMIT operator is a map operator, we don't push LIMIT operator into a join // since a new LIMIT under a join can't generate the original result. if (!op1.isMap() || op1.getOperatorTag() == LogicalOperatorTag.LIMIT) { return false; }//from ww w .j av a 2 s .c o m Mutable<ILogicalOperator> op2Ref = op1.getInputs().get(0); AbstractLogicalOperator op2 = (AbstractLogicalOperator) op2Ref.getValue(); if (op2.getOperatorTag() != LogicalOperatorTag.INNERJOIN) { return false; } AbstractBinaryJoinOperator join = (AbstractBinaryJoinOperator) op2; if (!OperatorPropertiesUtil.isAlwaysTrueCond(join.getCondition().getValue())) { return false; } List<LogicalVariable> used = new ArrayList<LogicalVariable>(); VariableUtilities.getUsedVariables(op1, used); Mutable<ILogicalOperator> b0Ref = op2.getInputs().get(0); ILogicalOperator b0 = b0Ref.getValue(); List<LogicalVariable> b0Scm = new ArrayList<LogicalVariable>(); VariableUtilities.getLiveVariables(b0, b0Scm); if (b0Scm.containsAll(used)) { // push operator on left branch op2Ref.setValue(b0); b0Ref.setValue(op1); opRef.setValue(op2); return true; } else { Mutable<ILogicalOperator> b1Ref = op2.getInputs().get(1); ILogicalOperator b1 = b1Ref.getValue(); List<LogicalVariable> b1Scm = new ArrayList<LogicalVariable>(); VariableUtilities.getLiveVariables(b1, b1Scm); if (b1Scm.containsAll(used)) { // push operator on right branch op2Ref.setValue(b1); b1Ref.setValue(op1); opRef.setValue(op2); return true; } else { return false; } } }
From source file:org.glite.slcs.policy.impl.MandatoryCertificateExtensionsPolicy.java
public boolean isCertificateRequestValid(CertificateRequest request, List attributes) throws SLCSException { // check validity of extensions List requiredCertificateExtensions = getRequiredCertificateExtensions(attributes); List certificateRequestExtensions = request.getCertificateExtensions(); if (!certificateRequestExtensions.containsAll(requiredCertificateExtensions)) { LOG.error("CertificateSigningRequest does not contain all required CertificateExtensions"); return false; } else if (!requiredCertificateExtensions.containsAll(certificateRequestExtensions)) { LOG.error("CertificateSigningRequest contains more CertificateExtensions than required"); return false; }/* ww w . ja va2 s . c o m*/ return true; }
From source file:org.pivotal.customer.versonix.SpringGemFireOqlQueryTest.java
protected void assertSelectResults(final SelectResults<PaxReserveType> actualResults, final PaxReserveType... expectedResults) { assertNotNull(actualResults);//w ww .j a v a 2 s.co m assertFalse(actualResults.isEmpty()); assertEquals(expectedResults.length, actualResults.size()); List<PaxReserveType> resultList = actualResults.asList(); assertNotNull(resultList); assertTrue(resultList.containsAll(Arrays.asList(expectedResults))); }
From source file:us.mn.state.health.lims.workplan.action.BaseWorkplanAction.java
protected boolean allNFSTestsRequested(List<String> testIdList) { return (testIdList.containsAll(nfsTestIdList)); }
From source file:com.netflix.spinnaker.fiat.providers.DefaultServiceAccountProvider.java
@Override public Set<ServiceAccount> getAllRestricted(@NonNull Set<Role> roles) throws ProviderException { List<String> roleNames = roles.stream().map(Role::getName).collect(Collectors.toList()); return getAll().stream().filter(svcAcct -> !svcAcct.getMemberOf().isEmpty()) .filter(svcAcct -> roleNames.containsAll(svcAcct.getMemberOf())).collect(Collectors.toSet()); }
From source file:com.migo.service.impl.SysUserServiceImpl.java
/** * ??//from w w w . j a v a2s. c om */ private void checkRole(SysUserEntity user) { //???? if (user.getCreateUserId() == Constant.SUPER_ADMIN) { return; } // List<Long> roleIdList = sysRoleService.queryRoleIdList(user.getCreateUserId()); //?? if (!roleIdList.containsAll(user.getRoleIdList())) { throw new RRException("?"); } }
From source file:com.ciphertool.sentencebuilder.dao.UniqueWordListDaoTest.java
@Test @SuppressWarnings("unchecked") public void testConstructor() { WordDao wordDaoMock = mock(WordDao.class); when(wordDaoMock.findAllUniqueWords()).thenReturn(wordsToReturn); UniqueWordListDao uniqueWordListDao = new UniqueWordListDao(wordDaoMock); Field wordListField = ReflectionUtils.findField(UniqueWordListDao.class, "wordList"); ReflectionUtils.makeAccessible(wordListField); List<Word> wordListFromObject = (List<Word>) ReflectionUtils.getField(wordListField, uniqueWordListDao); assertEquals(3, wordListFromObject.size()); assertTrue(wordListFromObject.containsAll(wordsToReturn)); assertTrue(wordsToReturn.containsAll(wordListFromObject)); verify(wordDaoMock, times(1)).findAllUniqueWords(); }
From source file:eu.trentorise.smartcampus.ac.provider.repository.memory.AcDaoMemoryImpl.java
@Override public List<User> readUsers(List<Attribute> attributes) { List<User> list = new ArrayList<User>(); Map<Long, User> map = (Map<Long, User>) cache.get(User.class); if (map != null) { for (User user : map.values()) { List<Attribute> userAttrs = user.getAttributes(); if (userAttrs.containsAll(attributes)) { list.add(user);// ww w . ja v a2s .c o m } } } return list; }
From source file:edu.uci.ics.hyracks.algebricks.rewriter.rules.PushSubplanWithAggregateDownThroughProductRule.java
@Override public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException { AbstractLogicalOperator op1 = (AbstractLogicalOperator) opRef.getValue(); if (op1.getOperatorTag() != LogicalOperatorTag.SUBPLAN) { return false; }//w ww. java2 s . co m SubplanOperator subplan = (SubplanOperator) op1; if (subplan.getNestedPlans().size() != 1) { return false; } ILogicalPlan p = subplan.getNestedPlans().get(0); if (p.getRoots().size() != 1) { return false; } Mutable<ILogicalOperator> r = p.getRoots().get(0); if (((AbstractLogicalOperator) r.getValue()).getOperatorTag() != LogicalOperatorTag.AGGREGATE) { return false; } Set<LogicalVariable> free = new HashSet<LogicalVariable>(); OperatorPropertiesUtil.getFreeVariablesInSubplans(subplan, free); Mutable<ILogicalOperator> op2Ref = op1.getInputs().get(0); AbstractLogicalOperator op2 = (AbstractLogicalOperator) op2Ref.getValue(); if (op2.getOperatorTag() != LogicalOperatorTag.INNERJOIN) { return false; } AbstractBinaryJoinOperator join = (AbstractBinaryJoinOperator) op2; if (!OperatorPropertiesUtil.isAlwaysTrueCond(join.getCondition().getValue())) { return false; } Mutable<ILogicalOperator> b0Ref = op2.getInputs().get(0); ILogicalOperator b0 = b0Ref.getValue(); List<LogicalVariable> b0Scm = new ArrayList<LogicalVariable>(); VariableUtilities.getLiveVariables(b0, b0Scm); if (b0Scm.containsAll(free)) { // push subplan on left branch op2Ref.setValue(b0); b0Ref.setValue(op1); opRef.setValue(op2); return true; } else { Mutable<ILogicalOperator> b1Ref = op2.getInputs().get(1); ILogicalOperator b1 = b1Ref.getValue(); List<LogicalVariable> b1Scm = new ArrayList<LogicalVariable>(); VariableUtilities.getLiveVariables(b1, b1Scm); if (b1Scm.containsAll(free)) { // push subplan on right branch op2Ref.setValue(b1); b1Ref.setValue(op1); opRef.setValue(op2); return true; } else { return false; } } }
From source file:com.ciphertool.sentencebuilder.dao.FrequencyWordListDaoTest.java
@Test @SuppressWarnings("unchecked") public void testConstructor() { WordDao wordDaoMock = mock(WordDao.class); when(wordDaoMock.findAllUniqueWords()).thenReturn(wordsToReturn); FrequencyWordListDao frequencyWordListDao = new FrequencyWordListDao(wordDaoMock); Field wordListField = ReflectionUtils.findField(FrequencyWordListDao.class, "wordList"); ReflectionUtils.makeAccessible(wordListField); List<Word> wordListFromObject = (List<Word>) ReflectionUtils.getField(wordListField, frequencyWordListDao); assertEquals(7, wordListFromObject.size()); assertTrue(wordListFromObject.containsAll(wordsToReturn)); assertTrue(wordsToReturn.containsAll(wordListFromObject)); assertEquals(5, countOccurrences(word1, wordListFromObject)); assertEquals(1, countOccurrences(word2, wordListFromObject)); assertEquals(1, countOccurrences(word3, wordListFromObject)); verify(wordDaoMock, times(1)).findAllUniqueWords(); }