List of usage examples for java.util SortedSet containsAll
boolean containsAll(Collection<?> c);
From source file:com.vrem.wifianalyzer.wifi.band.WiFiChannelCountryGHZ2Test.java
private void validateChannels(SortedSet<Integer> expected, SortedSet<Integer> actual) { assertEquals(expected.size(), actual.size()); assertTrue(actual.containsAll(expected)); }
From source file:net.ripe.rpki.commons.crypto.crl.X509CrlBuilder.java
public boolean isSatisfiedByEntries(X509Crl crl) { SortedSet<Entry> crlEntries = crl.getRevokedCertificates(); return crlEntries.containsAll(entries.values()); }
From source file:net.pms.dlna.protocolinfo.DeviceProtocolInfo.java
/** * Returns {@code true} if the {@link Set} for the given * {@link DeviceProtocolInfoSource} contains all of the elements in the * specified collection.//from w w w . jav a2 s . c om * * @param type the {@link DeviceProtocolInfoSource} type to check. * @param collection a {@link Collection} to be checked for containment. * @return {@code true} if {@link Set} for {@code type} contains all of the * elements in {@code collection}. * * @see #contains(DeviceProtocolInfoSource, ProtocolInfo) * @see #contains(ProtocolInfo) * @see #containsAll(Collection) */ public boolean containsAll(DeviceProtocolInfoSource<?> type, Collection<ProtocolInfo> collection) { setsLock.readLock().lock(); try { SortedSet<ProtocolInfo> set = protocolInfoSets.get(type); return set == null ? false : set.containsAll(collection); } finally { setsLock.readLock().unlock(); } }
From source file:au.org.ala.delta.editor.slotfile.model.VOCharacterAdaptor.java
protected ControllingInfo checkApplicability(VOItemDesc item, VOCharBaseDesc charBase, int recurseLevel, List<Integer> testedControlledChars) { int controllingId = 0; if (item == null || charBase == null || charBase.getNControlling() == 0) { return new ControllingInfo(); }//from w w w. j a va2s. c o m boolean unknownOk = false; List<Integer> controlling = charBase.readControllingInfo(); if (controlling != null && controlling.size() > 1) { Collections.sort(controlling, new CompareCharNos(false)); } List<Integer> controllingChars = new ArrayList<Integer>(); SortedSet<Integer> controllingStates = new TreeSet<Integer>(); List<Integer> newContStates = new ArrayList<Integer>(); int testCharId = VOUID_NULL; controlling.add(VOUID_NULL); // Append dummy value, to ease handling of // the last element // Loop through all controlling attributes which directly control this // character... for (Integer i : controlling) { int newContCharId = 0; if (i == VOUID_NULL) { newContCharId = VOUID_NULL; } else { VOControllingDesc contAttrDesc = (VOControllingDesc) ((DeltaVOP) charBase.getVOP()) .getDescFromId(i); newContStates = contAttrDesc.readStateIds(); Collections.sort(newContStates); newContCharId = contAttrDesc.getCharId(); } if (newContCharId == testCharId) { // / Build up all relevant controlling attributes under the // control of a // / single controlling character, merging the state lists as we // go.... controllingStates.addAll(newContStates); } else { // Do checks when changing controlling state if (testCharId != VOUID_NULL) { VOCharBaseDesc testCharBase = getDescFromId(testCharId); if (!CharType.isMultistate(testCharBase.getCharType())) { throw new RuntimeException("Controlling characters must be multistate!"); } controllingId = testCharId; // If the controlling character is coded, see whether it // makes us inapplicable if (item.hasAttribute(controllingId)) { Attribute attrib = item.readAttribute(controllingId); List<Integer> codedStates = new ArrayList<Integer>(); short[] pseudoValues = new short[] { 0 }; attrib.getEncodedStates(testCharBase, codedStates, pseudoValues); // If controlling character is "variable", we are NOT // controlled if ((pseudoValues[0] & VOItemDesc.PSEUDO_VARIABLE) == 0) { if (codedStates.isEmpty()) { // If there are no states for the controlling // character, // but it is explicitly coded with the "unknown" // pseudo-value, // allow the controlled character to also be // unknown. if ((pseudoValues[0] & VOItemDesc.PSEUDO_UNKNOWN) != 0) { unknownOk = true; } else { return new ControllingInfo(ControlledStateType.Inapplicable, controllingId); } } else if (controllingStates.containsAll(codedStates)) { return new ControllingInfo(ControlledStateType.Inapplicable, controllingId); } } } else if (testCharBase.getUncodedImplicit() != VOCharBaseDesc.STATEID_NULL) { // if the controlling character is not encoded, see if // there is an implicit value for it if (controllingStates.contains(testCharBase.getUncodedImplicit())) { return new ControllingInfo(ControlledStateType.Inapplicable, controllingId); } } else { return new ControllingInfo(ControlledStateType.Inapplicable, controllingId); // /// This should probably be handled as a somewhat // special case, // /// so the user can be pointed in the right direction } } controllingId = VOUID_NULL; testCharId = newContCharId; if (testCharId != VOUID_NULL) { controllingChars.add(testCharId); } controllingStates.clear(); controllingStates.addAll(newContStates); } } // Up to this point, nothing has made this character inapplicable. // But it is possible that one of the controlling characters has itself // been made inapplicable. // Is this check really necessary? I suppose it is, but it slows things // down... for (int j : controllingChars) { if (++recurseLevel >= getDeltaMaster().getNContAttrs()) { try { List<Integer> contChars = new ArrayList<Integer>(); getControlledChars(testedControlledChars, _charDesc, contChars, true); } catch (CircularDependencyException ex) { return new ControllingInfo(ControlledStateType.Inapplicable, controllingId); } } VOCharBaseDesc testCharBase = getDescFromId(j); ControllingInfo info = checkApplicability(item, testCharBase, recurseLevel, testedControlledChars); if (info.isInapplicable()) { return info; } } return unknownOk ? new ControllingInfo(ControlledStateType.InapplicableOrUnknown, controllingId) : new ControllingInfo(); }