List of usage examples for java.util HashSet containsAll
boolean containsAll(Collection<?> c);
From source file:Main.java
public static void main(String[] a) { String elements[] = { "A", "B", "C", "D", "E" }; HashSet<String> set = new HashSet<String>(Arrays.asList(elements)); elements = new String[] { "A", "B", "C" }; HashSet<String> set2 = new HashSet<String>(Arrays.asList(elements)); System.out.println(set.containsAll(set2)); }
From source file:amie.keys.CombinationsExplorationNew.java
public static HashSet<HashSet<Integer>> simplifyHashNonKeySet(HashSet<HashSet<Integer>> nonKeySet) { HashSet<HashSet<Integer>> newnonKeySet = new HashSet<HashSet<Integer>>(); newnonKeySet.addAll(nonKeySet);//w w w .j av a2s .c o m for (HashSet set : nonKeySet) { for (HashSet set2 : nonKeySet) { if (set2 != set && set2.containsAll(set)) { newnonKeySet.remove(set); break; } } } return newnonKeySet; }
From source file:amie.keys.CombinationsExplorationNew.java
public static boolean containsSubSet(HashSet<Integer> allPropertiesSet) { boolean contains = false; if (nonKeysInt.contains(allPropertiesSet)) { return true; }//from ww w . j a v a 2 s. c o m for (HashSet<Integer> nonKeyInt : nonKeysInt) { // System.out.println("nonKeyInt:"+nonKeyInt); if (nonKeyInt.containsAll(allPropertiesSet)) { //|| nonKeyInt.equals(allPropertiesSet)) { return true; } } return contains; }
From source file:amie.keys.CombinationsExplorationNew.java
private static boolean hasFalseParent(HashSet<Integer> newSet2, HashSet<Node> newCandidateKeys) { for (Node parent : newCandidateKeys) { // System.out.println("parent:" + parent); // System.out.println("parent.toExplore:" + parent.toExplore); // System.out.println("=>"+newSet2.containsAll(parent.set)); if (newSet2.containsAll(parent.set) && parent.toExplore == false) { // System.out.println("doesnt enter"); return true; }//from w ww . j a v a 2 s . c o m } return false; }
From source file:org.geoserver.importer.ImporterTest.java
public void testCreateContextDirectoryHetero() throws Exception { File dir = unpack("shape/archsites_epsg_prj.zip"); unpack("geotiff/EmissiveCampania.tif.bz2", dir); Directory d = new Directory(dir); ImportContext context = importer.createContext(d); assertEquals(2, context.getTasks().size()); // cannot ensure order of tasks due to hashing HashSet files = new HashSet(); files.add(context.getTasks().get(0).getData()); files.add(context.getTasks().get(1).getData()); assertTrue(files.containsAll(d.getFiles())); }
From source file:edu.uci.ics.hyracks.algebricks.rewriter.rules.ComplexJoinInferenceRule.java
@Override public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext context) throws AlgebricksException { ILogicalOperator op = opRef.getValue(); if (!(op instanceof AbstractScanOperator)) { return false; }/*from w w w . j ava 2 s . co m*/ Mutable<ILogicalOperator> opRef2 = op.getInputs().get(0); AbstractLogicalOperator op2 = (AbstractLogicalOperator) opRef2.getValue(); if (op2.getOperatorTag() != LogicalOperatorTag.SUBPLAN) { return false; } SubplanOperator subplan = (SubplanOperator) op2; Mutable<ILogicalOperator> opRef3 = subplan.getInputs().get(0); AbstractLogicalOperator op3 = (AbstractLogicalOperator) opRef3.getValue(); if (op3.getOperatorTag() == LogicalOperatorTag.EMPTYTUPLESOURCE || op3.getOperatorTag() == LogicalOperatorTag.NESTEDTUPLESOURCE) { return false; } if (subplanHasFreeVariables(subplan)) { return false; } HashSet<LogicalVariable> varsUsedInUnnest = new HashSet<LogicalVariable>(); VariableUtilities.getUsedVariables(op, varsUsedInUnnest); HashSet<LogicalVariable> producedInSubplan = new HashSet<LogicalVariable>(); VariableUtilities.getProducedVariables(subplan, producedInSubplan); if (!producedInSubplan.containsAll(varsUsedInUnnest)) { return false; } ntsToEtsInSubplan(subplan, context); cleanupJoins(subplan); InnerJoinOperator join = new InnerJoinOperator( new MutableObject<ILogicalExpression>(ConstantExpression.TRUE)); join.getInputs().add(opRef3); opRef2.setValue(OperatorManipulationUtil.eliminateSingleSubplanOverEts(subplan)); join.getInputs().add(new MutableObject<ILogicalOperator>(op)); opRef.setValue(join); context.computeAndSetTypeEnvironmentForOperator(join); return true; }
From source file:com.vmware.bdd.service.resmgmt.sync.filter.HostFilterByNetwork.java
@Override public boolean isFiltered(VcHost vcHost) { boolean networkAccessible = false; HashSet<String> hostNetworkNameSet = new HashSet<>(); if (CollectionUtils.isNotEmpty(vcHost.getNetworks())) { for (VcNetwork vcNetwork : vcHost.getNetworks()) { hostNetworkNameSet.add(vcNetwork.getName()); }//from w w w . j a v a 2 s. c o m networkAccessible = hostNetworkNameSet.containsAll(requiredNetworkNameSet); } return !networkAccessible; }
From source file:net.digitalfeed.pdroidalternative.intenthandler.PackageChangeHandler.java
private boolean havePermissionsChanged(Context context, Application oldApp, Application newApp) { //TODO: Add detection of permissions change //Maybe add a table which stores 'changed since last' info, so new permissions can be highlighted? if (oldApp == null) { //this is an error situtation Log.d("PDroidAlternative", "oldApp == null; thus permissions have changed"); return true; } else {//w ww .j a va 2 s . c om /* * Now to find if there are any non-matches between the two lists: have the permissions * changed? */ //If only one array is null, then permissions have changed. If both are, then they haven't. if (oldApp.getPermissions() == null) { if (newApp.getPermissions() == null) { Log.d("PDroidAlternative", "oldApp and newApp permissions are both null; permissions have not changed"); return false; } else { Log.d("PDroidAlternative", "oldApp permissions == null; newApp not; thus permissions have changed"); return true; } } else if (newApp.getPermissions() == null) { Log.d("PDroidAlternative", "oldApp permissions != null; newApp are; thus permissions have changed"); return true; } //if the number of permissions is different, then permissions have changed if (oldApp.getPermissions().length != newApp.getPermissions().length) { Log.d("PDroidAlternative", "permissions lengths differ: oldapp: " + Integer.toString(oldApp.getPermissions().length) + " newapp: " + Integer.toString(newApp.getPermissions().length)); return true; } HashSet<String> currPermissions = new HashSet<String>(); currPermissions.addAll(Arrays.asList(oldApp.getPermissions())); if (!currPermissions.containsAll(Arrays.asList(newApp.getPermissions()))) { Log.d("PDroidAlternative", "containsAll returned false: thus permissions have changed"); return true; } } Log.d("PDroidAlternative", "Got to the end; permissions have stayed the same, it seems"); return false; }
From source file:org.jaqpot.core.service.validator.ParameterValidator.java
public void validateDataset(Dataset dataset, List<String> requiredFeatures) { if (dataset.getFeatures() == null) { throw new IllegalArgumentException("Input dataset does not have features"); }/*from www.j av a 2 s .co m*/ HashSet<String> features = dataset.getFeatures().stream().map(FeatureInfo::getURI) .collect(Collectors.toCollection(HashSet::new)); if (!features.containsAll(requiredFeatures)) { throw new IllegalArgumentException("Dataset is not compatible with model"); } }
From source file:com.gmail.emerssso.srbase.database.SRContentProvider.java
private void checkColumns(String[] projection, String[] available) { if (projection != null) { HashSet<String> requestedColumns = new HashSet<String>(Arrays.asList(projection)); HashSet<String> availableColumns = new HashSet<String>(Arrays.asList(available)); // check if all columns which are requested are available if (!availableColumns.containsAll(requestedColumns)) { String except = ""; for (String aProjection : projection) except = except + aProjection + ", "; throw new IllegalArgumentException("Unknown columns in projection: " + except); }//from www . j a va 2s . c o m } }