Return the total number of atoms over all the rings in the colllection.

@param set The collection of rings
@return  The total number of atoms
424627
public static int getAtomCount(IRingSet set) {
        int count = 0;
        for (IAtomContainer atomContainer : set.atomContainers()) {
            count += atomContainer.getAtomCount();
        }
        return count;
    }
747121
private static IRingSet toRingSet(IAtomContainer container, int[][] cycles, EdgeToBondMap bondMap) {

        // note currently no way to say the size of the RingSet
        // even through we know it
        IChemObjectBuilder builder = container.getBuilder();
        IRingSet rings = builder.newInstance(IRingSet.class);

        for (int[] cycle : cycles) {
            rings.addAtomContainer(toRing(container, cycle, bondMap));
        }

        return rings;
    }
501174
public static <T> Set<T> copy(final Set<T> set) {
		if (set == null) {
			return null;
		}

		TypeEnum elementType = null;
		Set<T> copy = new HashSet<T>();
		for (T element : set) {
			T elementCopy = null;
			if (element != null) {
				if (elementType == null) {
					elementType = TypeEnum.dataTypeOf(element.getClass());
				}
				elementCopy = copy(element, elementType);
			}

			copy.add(elementCopy);
		}

		return copy;
	}
783840
public void addAll(Set<? extends E> set) {
		if(set.size()<=MAXIMUM_COMBINE_SIZE) {
			if(combined==null) combined = new HashSet<>(set);
			else combined.addAll(set);
		} else {
			added.add(set);
		}
	}
1008568
public static final Atom getCentroid(Atom[] atomSet){

		// if we don't catch this case, the centroid returned is (NaN,NaN,NaN), which can cause lots of problems down the line
		if (atomSet.length==0)
			throw new IllegalArgumentException("Atom array has length 0, can't calculate centroid!");


		double[] coords = new double[3];

		coords[0] = 0;
		coords[1] = 0;
		coords[2] = 0 ;

		for (Atom a : atomSet) {
			coords[0] += a.getX();
			coords[1] += a.getY();
			coords[2] += a.getZ();
		}

		int n = atomSet.length;
		coords[0] = coords[0] / n;
		coords[1] = coords[1] / n;
		coords[2] = coords[2] / n;

		Atom vec = new AtomImpl();
		vec.setCoords(coords);
		return vec;

	}
624800
public static final <T> boolean intersect(Collection<Set<T>> sets)
    {
        Set<T> set = intersection(sets);
        return !set.isEmpty();
    }
1027826
public int numberOfElements() {
        int n = 0;
        for (SortedSet<Integer> cell : cells) {
            n += cell.size();
        }
        return n;
    }
440585
@SuppressWarnings("unchecked")
    private static <T> Set<T> cast(Set<?> set) {
        return (Set<T>)set;
    }
1082205
void collectObjectNames(Set set) {

        for (int i = 0; i < nodes.length; i++) {
            if (nodes[i] != null) {
                nodes[i].collectObjectNames(set);
            }
        }

        if (subQuery != null) {
            if (subQuery.queryExpression != null) {
                subQuery.queryExpression.collectObjectNames(set);
            }
        }
    }
948631
public static Set<String> tupleToString(Set<Tuple> set) {
		Set<String> result = new LinkedHashSet<String>();
		for (Tuple tuple : set) {
			String element = tuple.getElement();
			result.add(element);
		}
		return result;
	}
909233
public static IAtomContainer convertToAtomContainer(IRingSet ringSet) {
        IRing ring = (IRing) ringSet.getAtomContainer(0);
        if (ring == null) return null;
        IAtomContainer ac = ring.getBuilder().newInstance(IAtomContainer.class);
        for (int i = 0; i < ringSet.getAtomContainerCount(); i++) {
            ring = (IRing) ringSet.getAtomContainer(i);
            for (int r = 0; r < ring.getBondCount(); r++) {
                IBond bond = ring.getBond(r);
                if (!ac.contains(bond)) {
                    for (int j = 0; j < bond.getAtomCount(); j++) {
                        ac.addAtom(bond.getAtom(j));
                    }
                    ac.addBond(bond);
                }
            }
        }
        return ac;
    }
164313
void addAll(Hashset set) {
    for (Enumeration e = set.table.keys(); e.hasMoreElements();)
      add(e.nextElement());
  }

  /**
   * Removes all the objects from this set.
   */
  void clear() {
    table.clear();
  }

  /**
   * Get an enumeration will all the objects from this set.
   * @return an enumeration with all the objects from this set.
   */
  Enumeration members() {
    return table.keys();
  }
}
248372
public int getSupport(int[] itemset) {
        if (root.children != null) {
            return getSupport(itemset, itemset.length - 1, root);
        } else {
            return 0;
        }
    }
105320
public static <E extends Enum<E> & ByteEnum> int setToInt (Set<E> set)
    {
        int flags = 0;
        for (E value : set) {
            flags |= toIntFlag(value);
        }
        return flags;
    }
1083798
public static <T> boolean isSubset(Set<T> setA, Set<T> setB) {
        return setB.containsAll(setA);
    }
859645
@Override
    public IRingSet getRings(IAtom atom) {
        IRingSet rings = new RingSet();
        IRing ring;
        for (int i = 0; i < getAtomContainerCount(); i++) {
            ring = (Ring) getAtomContainer(i);
            if (ring.contains(atom)) {
                rings.addAtomContainer(ring);
            }
        }
        return rings;
    }
110827
public int sum() {
        int total = 0;
        int N = getNumElements();
        for (int i = 0; i < N; i++) {
            if( data[i] )
                total += 1;
        }
        return total;
    }