List of usage examples for com.google.common.collect Sets newIdentityHashSet
public static <E> Set<E> newIdentityHashSet()
From source file:com.facebook.presto.util.MoreSets.java
public static <T> Set<T> newIdentityHashSet() { return Sets.newIdentityHashSet(); }
From source file:com.yahoo.yqlplus.engine.internal.tasks.ForkTask.java
@Override public Set<Value> getInputs() { Set<Value> values = Sets.newIdentityHashSet(); for (Task next : getNext()) { values.addAll(next.getInputs()); }/*from w w w.j a v a2 s . c o m*/ return values; }
From source file:com.google.gapid.util.Tables.java
/** * @return the {@link TableItem TableItems} that are currently visible in the table. *//*from w w w . j a v a2s . co m*/ public static Set<TableItem> getVisibleItems(Table table) { int items = table.getItemCount(); if (items == 0) { return emptySet(); } int tableBottom = bottom(table.getClientArea()); Set<TableItem> visible = Sets.newIdentityHashSet(); for (int index = table.getTopIndex(); index < items; index++) { TableItem item = table.getItem(index); visible.add(table.getItem(index)); if (bottom(item.getBounds()) > tableBottom) { break; } } return visible; }
From source file:org.apache.drill.exec.planner.physical.visitor.RelUniqifier.java
public static Prel uniqifyGraph(Prel p) { Set<Prel> data = Sets.newIdentityHashSet(); return p.accept(INSTANCE, data); }
From source file:org.caleydo.view.bicluster.physics.MyDijkstra.java
/** * compute the min distance between the clusters * * @param source//from w w w . ja va 2 s . c o m * @param target * @param maxDistance * @param recBands * @param dimBands * @return the distance or maxDistance +1 for invalid or not existing */ public static int minDistance(final ClusterElement source, final ClusterElement target, int maxDistance, boolean recBands, boolean dimBands) { if (source == target) return 0; final int invalid = Math.min(maxDistance + 1, Integer.MAX_VALUE); if (maxDistance <= 0) return invalid; if (hasNeighbor(source, target, recBands, dimBands)) return 1; if (maxDistance < 2) return invalid; Set<ClusterElement> done = Sets.newIdentityHashSet(); Deque<Distanced> queue = new ArrayDeque<>(10); queue.add(new Distanced(0, source)); done.add(source); Distanced act; while ((act = queue.pollFirst()) != null) { if (hasNeighbor(act.elem, target, recBands, dimBands)) return act.distance + 1; if (act.distance >= maxDistance) // stop here to add its neighors continue; if (dimBands) addAll(done, queue, act.distance, act.elem.getOverlappingNeighbors(EDimension.DIMENSION)); if (recBands) addAll(done, queue, act.distance, act.elem.getOverlappingNeighbors(EDimension.RECORD)); } return invalid; }
From source file:com.google.gapid.util.Trees.java
/** * @return the {@link TreeItem TreeItems} that are currently visible in the tree. *///from w ww . ja v a 2 s . c o m public static Set<TreeItem> getVisibleItems(Tree tree) { TreeItem top = tree.getTopItem(); if (top == null) { // Work around bug where getTopItem() returns null when scrolling // up past the top item (elastic scroll). return (tree.getItemCount() != 0) ? null : emptySet(); } int treeBottom = bottom(tree.getClientArea()); Set<TreeItem> visible = Sets.newIdentityHashSet(); if (!getVisibleItems(top, treeBottom, visible)) { do { top = getVisibleSiblings(top, treeBottom, visible); } while (top != null); } return visible; }
From source file:com.yahoo.yqlplus.engine.internal.tasks.JoinTask.java
@Override public Set<Value> getInputs() { Set<Value> values = Sets.newIdentityHashSet(); for (Task next : getNext()) { values.addAll(next.getInputs()); }//from w w w . j a v a 2 s . c o m return Sets.intersection(values, getAvailable()); }
From source file:com.yahoo.yqlplus.engine.internal.tasks.RunTask.java
@Override public Set<Value> getInputs() { // we need a list of the values that we need, but do not compute ourselves Set<Value> values = Sets.newIdentityHashSet(); for (Task next : getNext()) { values.addAll(next.getInputs()); }//w w w . j av a 2 s.c om for (Step step : steps) { values.addAll(step.getInputs()); } for (Step step : steps) { values.remove(step.getOutput()); } return Sets.intersection(values, getAvailable()); }
From source file:org.vader.apm.dao.util.DaoUtils.java
/** * Filter all objects by type./*from w w w. ja va 2 s. com*/ * * @param dbObjects objects to filter * @param state DB object state * @param <T> DB object type * @return filtered objects */ public static <T extends ApmDbObject> Collection<T> getDbObjectsByState(Collection<T> dbObjects, DbObjectState state) { final Collection<T> result = Sets.newIdentityHashSet(); result.addAll(Collections2.filter(dbObjects, state)); return result; }
From source file:compile.analyze.LastReached.java
public LastReached(final Module module) { super(module); visitedRefs = Sets.newIdentityHashSet(); }