/** * Used internally to mark a cell as just-now being expanded from. * @param pt the position of the cell to reset */ protected void setFresh(final Coord pt) { if(!initialized) return; fresh.add(pt); }
/** * Creates a new hash set using elements provided by a type-specific * iterator. * * @param i a type-specific iterator whose elements will fill the set. * @param f the load factor. */ public OrderedSet(final Iterator<? extends K> i, final float f) { this(DEFAULT_INITIAL_SIZE, f); while (i.hasNext()) add(i.next()); }
/** * Used internally to mark a cell as just-now being expanded from. * @param x the x position of the cell to reset * @param y the y position of the cell to reset */ protected void setFresh(int x, int y) { if(!initialized) return; fresh.add(Coord.get(x, y)); }
public static OrderedSet<GreasedRegion> whichContain(int x, int y, Collection<GreasedRegion> packed) { OrderedSet<GreasedRegion> found = new OrderedSet<>(packed.size()); for (GreasedRegion tmp : packed) { if(tmp != null && tmp.contains(x, y)) found.add(tmp); } return found; }
protected void setFresh(int idx, final Coord pt) { if(!initialized) return; if(anyFreshMap.contains(pt.x, pt.y)) return; fresh.get(idx).add(pt); anyFreshMap.insert(pt); }
protected void setFresh(int idx, int x, int y) { if(!initialized) return; fresh.get(idx).add(Coord.get(x, y)); anyFreshMap.insert(x, y); }
public OrderedSet<K> keysAsOrderedSet() { OrderedSet<K> os = new OrderedSet<K>(size, f, hasher); for (int i = 0; i < size; i++) { os.add(keyAt(i)); } return os; }
public OrderedSet<Integer> keysAsOrderedSet() { OrderedSet<Integer> os = new OrderedSet<>(size, f); for (int i = 0; i < size; i++) { os.add(keyAt(i)); } return os; } public int[] keysAsArray() {
public static OrderedSet<GreasedRegion> whichContain(int x, int y, GreasedRegion ... packed) { OrderedSet<GreasedRegion> found = new OrderedSet<>(packed.length); GreasedRegion tmp; for (int i = 0; i < packed.length; i++) { if((tmp = packed[i]) != null && tmp.contains(x, y)) found.add(tmp); } return found; }
public OrderedSet<K> keysAsOrderedSet() { OrderedSet<K> os = new OrderedSet<>(size, f, hasher); for (int i = 0; i < size; i++) { os.add(keyAt(i)); } return os; }
public boolean addAll(Collection<? extends K> c) { int n = c.size(); // The resulting collection will be at least c.size() big if (f <= .5) ensureCapacity(n); // The resulting collection will be sized // for c.size() elements else tryCapacity(size() + n); // The resulting collection will be // tentatively sized for size() + c.size() elements boolean retVal = false; final Iterator<? extends K> i = c.iterator(); while (n-- != 0) if (add(i.next())) retVal = true; return retVal; }
public OrderedSet<K> keysAt(int... positions) { if(keys == null || positions == null || positions.length <= 0) return new OrderedSet<K>(); OrderedSet<K> ks = new OrderedSet<>(positions.length); for(int i = 0; i < positions.length; i++) { ks.add(keyAt(positions[i])); } return ks; } public OrderedSet<K> keysAt(IntVLA positions)
public OrderedSet<K> keysAt(int... positions) { if(keys == null || positions == null || positions.length <= 0) return new OrderedSet<K>(); OrderedSet<K> ks = new OrderedSet<>(positions.length); for(int i = 0; i < positions.length; i++) { ks.add(keyAt(positions[i])); } return ks; } public OrderedSet<K> keysAt(IntVLA positions)
protected /* @Nullable */ TextCellFactory.Glyph createActor(int x, int y, char name, float encodedColor, boolean doubleWidth) { //final Actor a = textFactory.makeActor(name, encodedColor); final TextCellFactory.Glyph a = textFactory.glyph(name, encodedColor, worldX(x, doubleWidth), worldY(y)); //a.setName(String.valueOf(name)); //a.setPosition(adjustX(x, doubleWidth), adjustY(y)); autoActors.add(a); return a; }
/** * Gets all unique Strings from the top level of this ObText, not including any associated values, and puts them in * an {@link OrderedSet} of String. The returned set will retain the same order the Strings were entered in, and you * can use OrderedSet methods like {@link OrderedSet#getAt(int)} to look up keys by index. Changes to the returned * Set won't be reflected in this ObText. * @return all unique top-level Strings (without associated values) as an OrderedSet of String keys */ public OrderedSet<String> keyOrderedSet() { final int sz = size(); OrderedSet<String> keys = new OrderedSet<>(sz, CrossHash.stringHasher); for (int i = 0; i < sz; i++) { keys.add(get(i).primary); } return keys; }
public OrderedSet<K> keysAt(IntVLA positions) { if(keys == null || positions == null || positions.size <= 0) return new OrderedSet<K>(); OrderedSet<K> ks = new OrderedSet<>(positions.size); for(int i = 0; i < positions.size; i++) { ks.add(keyAt(positions.get(i))); } return ks; }
public OrderedSet<K> keysAt(IntVLA positions) { if(keys == null || positions == null || positions.size <= 0) return new OrderedSet<K>(); OrderedSet<K> ks = new OrderedSet<>(positions.size); for(int i = 0; i < positions.size; i++) { ks.add(keyAt(positions.get(i))); } return ks; }
protected /* @Nullable */ TextCellFactory.Glyph createActor(int x, int y, char name, Color color, boolean doubleWidth) { //final Actor a = textFactory.makeActor(name, scc.filter(color)); final TextCellFactory.Glyph a = textFactory.glyph(name, scc.filter(color), worldX(x, doubleWidth), worldY(y)); //a.setName(String.valueOf(name)); //a.setPosition(adjustX(x, doubleWidth), adjustY(y)); autoActors.add(a); return a; }
public AnimatedEntity directionMarker(int x, int y, boolean doubleWidth, Color color) { Actor a = textFactory.makeDirectionMarker(color); a.setName("^"); a.setPosition(adjustX(x, doubleWidth), adjustY(y)); AnimatedEntity ae = new AnimatedEntity(a, x, y, doubleWidth); animatedEntities.add(ae); return ae; } /**
public AnimatedEntity directionMarker(int x, int y, boolean doubleWidth, Color color) { Actor a = textFactory.makeDirectionMarker(color); a.setName("^"); a.setPosition(adjustX(x, doubleWidth), adjustY(y)); AnimatedEntity ae = new AnimatedEntity(a, x, y, doubleWidth); animatedEntities.add(ae); return ae; }