/** * Removes a Radiance as a light source from the given position, if any is present. * @param position the position to remove the Radiance from * @return this for chaining */ public LightingHandler removeLight(Coord position) { lights.remove(position); return this; } /**
/** * Removes one object from the current group by the {@code innerName} it was prepared with using * {@link #put(String, Object, StringConvert)}. This does not affect already-stored objects unless * {@link #store(String)} is called after this, in which case the new version of the current group, without the * object this removed, is stored. * @param innerName the String key used to put an object in the current group with {@link #put(String, Object, StringConvert)} * @return this for chaining */ public TextStorage remove(String innerName) { contents.remove(innerName); return this; }
/** * Removes the element with the given identity from all storage in this data structure. * <br> * You should strongly avoid calling remove() and add() to change an element; prefer modify() and move(). * @param id the identity of the element to remove * @return the value of the element that was removed or null if nothing was present at the position */ public E remove(I id) { SpatialTriple<I, E> gotten = itemMapping.remove(id); if(gotten != null) { positionMapping.remove(gotten.position); return gotten.element; } return null; }
/** * Removes the element at the given position from all storage in this data structure. * <br> * You should strongly avoid calling remove() and add() to change an element; prefer modify() and move(). * @param coord the position of the element to remove * @return the value of the element that was removed or null if nothing was present at the position */ public E remove(Coord coord) { SpatialTriple<I, E> gotten = positionMapping.remove(coord); if(gotten != null) { itemMapping.remove(gotten.id); return gotten.element; } return null; } /**
/** * If a sound is being produced at a given location (a Coord), this removes it. * @param pt */ public void removeSound(Coord pt) { if(!initialized) return; if(sounds.containsKey(pt)) sounds.remove(pt); }
/** * Inserts a SpatialTriple into this SpatialMap without changing it, potentially overwriting an existing element. * SpatialTriple objects can be obtained by the triples() or tripleIterator() methods, and can also be constructed * on their own. * <br> * If you want to alter an existing element, use modify() or move(). * @param triple a SpatialTriple (an inner class of SpatialMap) with the same type parameters as this class */ public void put(SpatialTriple<I, E> triple) { itemMapping.remove(triple.id); positionMapping.remove(triple.position); itemMapping.put(triple.id, triple); positionMapping.put(triple.position, triple); }
/** * Inserts a new element with the given identity and Coord position, potentially overwriting an existing element. * <br> * If you want to alter an existing element, use modify() or move(). * @param coord the Coord position to place the element at; should be empty * @param id the identity to associate the element with; should be unused * @param element the element to add */ public void put(Coord coord, I id, E element) { SpatialTriple<I, E> triple = new SpatialTriple<>(coord, id, element); itemMapping.remove(id); positionMapping.remove(coord); itemMapping.put(id, triple); positionMapping.put(coord, triple); }
/** * Removes the entry for the specified key only if it is currently * mapped to the specified value. * * @param key key with which the specified value is associated * @param value value expected to be associated with the specified key * @return {@code true} if the value was removed */ public boolean remove(Object key, Object value) { if (containsKey(key) && Objects.equals(get(key), value)) { remove(key); return true; } else return false; }
@Override public OrderedMap<Coord, Double> findArea() { OrderedMap<Coord, Double> r = AreaUtils.arrayToHashMap(fov.calculateFOV(map, origin.x, origin.y, radius, radiusType, angle, span)); r.remove(origin); return r; }
/** * If a sound is being produced at a given (x, y) location, this removes it. * @param x * @param y */ public void removeSound(int x, int y) { if(!initialized) return; Coord pt = Coord.get(x, y); if(sounds.containsKey(pt)) sounds.remove(pt); }
/** * Move an element from one position to another; moves whatever is at the Coord position previous to the new Coord * position target. The element will not be present at its original position if target is unoccupied, but nothing * will change if target is occupied. * @param previous the starting Coord position of an element to move * @param target the Coord position to move the element to * @return the moved element if movement was successful or null otherwise */ public E move(Coord previous, Coord target) { if(positionMapping.containsKey(previous) && !positionMapping.containsKey(target)) { SpatialTriple<I, E> gotten = positionMapping.remove(previous); gotten.position = target; positionMapping.put(target, gotten); return gotten.element; } return null; }
/** * Move an element, picked by its identity, to a new Coord position. Finds the element using only the id, and does * not need the previous position. The target position must be empty for this to move successfully, and the id must * exist in this data structure for this to move anything. * @param id the identity of the element to move * @param target the Coord position to move the element to * @return the moved element if movement was successful or null otherwise */ public E move(I id, Coord target) { if(itemMapping.containsKey(id) && !positionMapping.containsKey(target)) { SpatialTriple<I, E> gotten = itemMapping.get(id); positionMapping.remove(gotten.position); gotten.position = target; positionMapping.put(target, gotten); return gotten.element; } return null; }
/** * Copies an existing Chimera other into a new Chimera with potentially a different name. * @param name the name to use for the Chimera this constructs * @param other the existing Chimera to copy all fields but name from. */ public Chimera(String name, Chimera other) { this.name = name; unknown = other.unknown; if(unknown != null) mainForm = unknown; else mainForm = other.name; parts = new OrderedMap<>(other.parts); List<String> oldParts = new ArrayList<>(parts.remove(mainForm)); parts.put(name, oldParts); unsaidAdjectives = new OrderedSet<>(other.unsaidAdjectives); wholeAdjectives = new OrderedSet<>(other.wholeAdjectives); powerAdjectives = new OrderedSet<>(other.powerAdjectives); powerPhrases = new OrderedSet<>(other.powerPhrases); }
finder.caves.put(region, finder.rooms.remove(region)); finder.allRooms.andNot(region); finder.allCaves.or(region);