Projects a CDKRGraph bitset on the source graph G2.
@param  set  CDKRGraph BitSet to project
@return      The associate BitSet in G2
196896
public BitSet projectG2(BitSet set) {
        BitSet projection = new BitSet(getSecondGraphSize());
        CDKRNode xNode = null;

        for (int x = set.nextSetBit(0); x >= 0; x = set.nextSetBit(x + 1)) {
            xNode = getGraph().get(x);
            projection.set(xNode.getRMap().getId2());
        }
        return projection;
    }
1121500
public static int getBondCount(IRingSet set) {
        int count = 0;
        for (IAtomContainer atomContainer : set.atomContainers()) {
            count += atomContainer.getBondCount();
        }
        return count;
    }
700175
public final Set<K> keySet() {
	return new AbstractSet<K>() {
	    public Iterator<K> iterator() {
		final Iterator<Map.Entry<K,V>> ite = entryIterator();
		return new Iterator<K>() {
		    public boolean hasNext() { return ite.hasNext(); }
		    public void    remove()  { ite.remove(); }
		    public K       next()    { return ite.next().getKey(); }
		};
	    }
	    public int size() {
		return size;
	    }
	};
    }
1262915
public static BitSet and(BitSet left, BitSet right) {
        BitSet result = (BitSet) left.clone();
        result.and(right);
        return result;
    }
270212
public static final Atom getCenterVector(Atom[] atomSet){
		Atom centroid = getCentroid(atomSet);

		return getCenterVector(atomSet,centroid);

	}
73215
public static Set<Node> prepareSingleNodeSetFromSets(Set<Set<BioPAXElement>> sets, Graph graph)
	{
		Set<BioPAXElement> elements = new HashSet<BioPAXElement>();
		for (Set<BioPAXElement> set : sets)
		{
			elements.addAll(set);
		}
		return prepareSingleNodeSet(elements, graph);
	}
1232500
public ViewFSet<K> keySet() {
		if(keyView == null) {
			keyView = new LinkedHashViewFSet<>(inner.keySet());
		}
		return keyView;
	}
378650
@Override
    public boolean isSubgraph(boolean shouldMatchBonds) {

        CDKRMapHandler rmap = new CDKRMapHandler();

        try {

            if ((source.getAtomCount() == target.getAtomCount()) && source.getBondCount() == target.getBondCount()) {
                rOnPFlag = true;
                rmap.calculateIsomorphs(source, target, shouldMatchBonds);

            } else if (source.getAtomCount() > target.getAtomCount() && source.getBondCount() != target.getBondCount()) {
                rOnPFlag = true;
                rmap.calculateSubGraphs(source, target, shouldMatchBonds);

            } else {
                rOnPFlag = false;
                rmap.calculateSubGraphs(target, source, shouldMatchBonds);
            }

            setAllMapping();
            setAllAtomMapping();
            setFirstMapping();
            setFirstAtomMapping();

        } catch (CDKException e) {
            rmap = null;
            //            System.err.println("WARNING: graphContainer: most probably time out error ");
        }

        return !getFirstMapping().isEmpty();
    }
383430
public void addLibset(final LibrarySet libset) {
    if (isReference()) {
      throw super.noChildrenAllowed();
    }
    if (libset == null) {
      throw new NullPointerException("libset");
    }
    this.librarySets.addElement(libset);
  }
152516
public Set<E> getSubSet(int k) {
        int from = -1;
        //TODO: very bad. Bounds should be memorized
        for (int x = 0; x < values.size(); x++) {
            int cIdx = index.get(values.get(x).id());
            if (cIdx == k && from == -1) {
                from = x;
            }
            if (from >= 0 && cIdx > k) {
                return new ElementSubSet<>(this, k, from, x);
            }
        }
        if (from >= 0) {
            return new ElementSubSet<>(this, k, from, values.size());
        }
        return Collections.emptySet();
    }
852099
public synchronized Set<String> keySet() {
		if(size == 0) {
			return new HashSet<String>(0);
		} else {
			try {
				XAttributeMap map = deserialize();
				return map.keySet();
			} catch (IOException e) {
				e.printStackTrace();
				return null;
			}
		}
	}
452244
@Override
	protected <T extends NodeInterface> Set<T> getRelatedNodesReverse(final SecurityContext securityContext, final NodeInterface obj, final Class destinationType, final Predicate<GraphObject> predicate) {

		Set<T> relatedNodes = new LinkedHashSet<>();

		try {

			final Object source = relation.getSource().get(securityContext, obj, predicate);
			if (source != null) {

				if (source instanceof Iterable) {

					Iterable<T> nodes = (Iterable<T>)source;
					for (final T n : nodes) {

						relatedNodes.add(n);
					}

				} else {

					relatedNodes.add((T)source);
				}
			}

		} catch (Throwable t) {

			logger.warn("Unable to fetch related node: {}", t.getMessage());
		}

		return relatedNodes;
	}
62406
public final Set<K> keySet() {
		try {
			Set<K> set = new HashSet<K>();
			listFilesToSet(getPath(), set);
			return set;
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
701820
public BitSet projectG1(BitSet set) {
        BitSet projection = new BitSet(firstGraphSize);
        RNode xNode = null;

        for (int x = set.nextSetBit(0); x >= 0; x = set.nextSetBit(x + 1)) {
            xNode = (RNode) graph.get(x);
            projection.set(xNode.rMap.id1);
        }
        return projection;
    }
763133
public static <E,F> Set<Pair<E,F>> cross(Set<E> s1, Set<F> s2) {
    Set<Pair<E,F>> s = new HashSet<Pair<E,F>>();
    for (E o1 : s1) {
      for (F o2 : s2) {
        s.add(new Pair<E,F>(o1, o2));
      }
    }
    return s;
  }
622647
public Set<OGraphEdge> getInEdges(final String iEdgeLabel) {
		Set<OGraphEdge> temp = in != null ? in.get() : null;

		if (temp == null) {
			if (iEdgeLabel == null)
				temp = new HashSet<OGraphEdge>();
			in = new SoftReference<Set<OGraphEdge>>(temp);

			final Set<Object> docs = document.field(OGraphDatabase.VERTEX_FIELD_IN);

			if (docs != null) {
				// TRANSFORM ALL THE ARCS
				for (Object o : docs) {
					final ODocument doc = (ODocument) ((OIdentifiable) o).getRecord();
					if (iEdgeLabel != null && !iEdgeLabel.equals(doc.field(OGraphDatabase.LABEL)))
						continue;

					temp.add((OGraphEdge) database.getUserObjectByRecord(doc, null));
				}
			}
		} else if (iEdgeLabel != null) {
			// FILTER THE EXISTENT COLLECTION
			HashSet<OGraphEdge> filtered = new HashSet<OGraphEdge>();
			for (OGraphEdge e : temp) {
				if (iEdgeLabel.equals(e.getLabel()))
					filtered.add(e);
			}
			temp = filtered;
		}

		return temp;
	}
691954
public static final <S, E> Functional<S> functionalSet(Set<E> set) {
		return new FunctionalSet<S, E>(set);
	}