Calculate the antichain lattice.
@param <G> element type
@param set of partially-ordered elements
@return the antichain lattice
421059
public static <G extends PartiallyOrdered<?>> Context antichain(final List<G> set) {
        return new Context(set, set, new Equal());
    }
763650
private static <E extends Element> Set<E> setFilter(Set<? extends Element> elements,
                                                        Set<ElementKind> targetKinds,
                                                        Class<E> clazz) {
        // Return set preserving iteration order of input set.
        Set<E> set = new LinkedHashSet<E>();
        for (Element e : elements) {
            if (targetKinds.contains(e.getKind()))
                set.add(clazz.cast(e));
        }
        return set;
    }
243707
public Set<? extends Element> getSpecifiedElements() {
        if (specifiedElements == null) {
            Set<Element> result = new LinkedHashSet<>();
            result.addAll(specifiedModuleElements);
            result.addAll(specifiedPackageElements);
            result.addAll(specifiedTypeElements);
            specifiedElements = Collections.unmodifiableSet(result);
        }
        return specifiedElements;
    }
68146
private List<Set<Integer>> createInitialAggregates(
                List<Set<Integer>> N, boolean[] R) {
            C = new ArrayList<Set<Integer>>();

            for (int i = 0; i < R.length; ++i) {

                // Skip non-free nodes
                if (!R[i])
                    continue;

                // See if all nodes in the current N-set are free
                boolean free = true;
                for (int j : N.get(i))
                    free &= R[j];

                // Create an aggregate out of N[i]
                if (free) {
                    C.add(new HashSet<Integer>(N.get(i)));
                    for (int j : N.get(i))
                        R[j] = false;
                }

            }

            return C;
        }
403106
protected boolean isEquivalentInTheSet(Node node, Set<Node> set)
	{
		return set.contains(node) ||
			isEquivalentInTheSet(node, UPWARD, set) || isEquivalentInTheSet(node, DOWNWARD, set); 
	}
573051
public static final <T> Set<T> symmetricDifference(Set<T>... sets)
    {
        return symmetricDifference(CollectionHelp.create(sets));
    }
1119397
public List<SecStrucState> calculate(Structure s, boolean assign)
			throws StructureException {

		List<SecStrucState> secstruc = new ArrayList<SecStrucState>();
		for(int i=0; i<s.nrModels(); i++) {
			// Reinitialise the global vars
			ladders = new ArrayList<Ladder>();
			bridges = new ArrayList<BetaBridge>();
			groups = initGroupArray(s, i);
			// Initialise the contact set for this structure
			initContactSet();
			if (groups.length < 5) {
				// not enough groups to do anything
				throw new StructureException("Not enough backbone groups in the"
						+ " Structure to calculate the secondary structure ("
						+ groups.length+" given, minimum 5)" );
			}

			calculateHAtoms();
			calculateHBonds();
			calculateDihedralAngles();
			calculateTurns();
			buildHelices();
			detectBends();
			detectStrands();

			for (SecStrucGroup sg : groups){
				SecStrucState ss = (SecStrucState)
						sg.getProperty(Group.SEC_STRUC);
				// Add to return list and assign to original if flag is true
				secstruc.add(ss);
				if (assign) sg.getOriginal().setProperty(Group.SEC_STRUC, ss);
			}
		}
		return secstruc;
	}
845481
def element(self, inp=None):
        
        for set in self.sets:
            try:
                return set.element(inp)
            except NotImplementedError:
                pass
        raise NotImplementedError('`element` not implemented for any of the '
                                  'subsets')
337564
public static final <A,B> Set<OrderedPair<A,B>> cartesianProduct(Set<A> a, Set<B> b)
    {
        Set<OrderedPair<A,B>> set = new HashSet<>();
        for (A t : a)
        {
            for (B v : b)
            {
                set.add(new OrderedPair(t, v));
            }
        }
        return set;
    }
200261
public static <E> SortedSet<E> newSortedSet(E... elements) {
        SortedSet<E> set = new TreeSet<E>();
        Collections.addAll(set, elements);
        return set;
    }
309734
public static <E> Set<E> union(final Set<? extends E> set1, final Set<? extends E> set2) {
        checkArgumentNotNull(set1, "set1");
        checkArgumentNotNull(set2, "set2");

        // Set 2 minus set 1
        final Set<E> difference = new HashSet<>(set2);
        difference.removeAll(set1);
        // Following stream does not compile on some JDKs
        // See also https://bugs.openjdk.java.net/browse/JDK-8051443
        // set2.stream().filter((e) -> !set1.contains(e)).collect(Collectors.toSet());

        return new AbstractSet<E>() {

            @Override
            public Iterator<E> iterator() {
                final Iterator<E> iterator = Iterators.concat(ImmutableList.of(set1.iterator(), difference.iterator()).iterator());
                // Remove operation is not supported by default
                return new Iterator<E>() {
                    @Override
                    public boolean hasNext() {
                        return iterator.hasNext();
                    }

                    @Override
                    public E next() {
                        return iterator.next();
                    }
                };
            }

            @Override
            public int size() {
                return set1.size() + difference.size();
            }

            @Override
            public boolean isEmpty() {
                return set1.isEmpty() && difference.isEmpty();
            }

            @Override
            public boolean contains(Object o) {
                return set1.contains(o) || difference.contains(o);
            }
        };
    }
685700
public int getCount(G g) {
        Pair<Integer> orderAndSize = new Pair<Integer>(g.order(), g.size());
        Map<G,Integer> graphs = orderAndSizeToGraphs.get(orderAndSize);
        if (graphs == null) 
            return 0;
        for (Map.Entry<G,Integer> e : graphs.entrySet()) {
            if (isoTest.areIsomorphic(g, e.getKey())) 
                return e.getValue();
        }
        return 0;
    }
1304839
public static <T> Set<T> minus(Set<T> self, Object removeMe) {
        Comparator comparator = (self instanceof SortedSet) ? ((SortedSet) self).comparator() : null;
        final Set<T> ansSet = createSimilarSet(self);
        for (T t : self) {
            boolean areEqual = (comparator != null)? (comparator.compare(t, removeMe) == 0) : coercedEquals(t, removeMe);
            if (!areEqual) ansSet.add(t);
        }
        return ansSet;
    }
1152916
public AsciiSet diff(AsciiSet set) {
    final boolean[] diffMembers = new boolean[128];
    for (int i = 0; i < diffMembers.length; ++i) {
      diffMembers[i] = members[i] && !set.members[i];
    }
    return new AsciiSet(diffMembers);
  }
372310
public static final <T> Set<Set<T>> powerSet(Set<T> set)
    {
        Set<Set<T>> powerSet = new HashSet<>();
        powerSet.add(Collections.EMPTY_SET);
        powerSet(powerSet, set);
        return powerSet;
    }
1315106
private static Set<JsArray<String>> assoc() {
    return new TreeSet<>(Ordering.<String>natural().lexicographical().onResultOf(JsArray::asList));
  }
367392
@SafeVarargs
  /* #end */
  public static <KType> KTypeScatterSet<KType> from(KType... elements) {
    final KTypeScatterSet<KType> set = new KTypeScatterSet<KType>(elements.length);
    set.addAll(elements);
    return set;
  }