public long put( int key, long value ) { synchronized( mutex ) { return m.put( key, value ); } } public long remove( int key ) {
public void registerClientNetworkEntity(int netId, long entityId) { long oldId = netIdToEntityId.put(netId, entityId); if (oldId != NULL_NET_ID && oldId != entityId) { logger.error("Registered duplicate network id: {}", netId); } else { logger.debug("Registered Network Entity: {}", netId); } }
public void markTasksDelivered(List<AnalystClusterRequest> tasks) { long deliveryTime = System.currentTimeMillis(); long visibleAt = deliveryTime + INVISIBLE_DURATION_SEC * 1000; for (AnalystClusterRequest task : tasks) { invisibleUntil.put(task.taskId, visibleAt); } }
/** * Inserts a key/value pair into the map. * * @param key an <code>Object</code> value * @param value an <code>Object</code> value * @return the previous value associated with <tt>key</tt>, * or Long(0) if none was found. */ public Long put( Integer key, Long value ) { int k; long v; if ( key == null ) { k = _map.getNoEntryKey(); } else { k = unwrapKey( key ); } if ( value == null ) { v = _map.getNoEntryValue(); } else { v = unwrapValue( value ); } long retval = _map.put( k, v ); if ( retval == _map.getNoEntryValue() ) { return null; } return wrapValue( retval ); }
public void registerNetworkEntity(EntityRef entity) { if (mode == NetworkMode.NONE) { return; } if (mode.isServer()) { NetworkComponent netComponent = entity.getComponent(NetworkComponent.class); netComponent.setNetworkId(nextNetId++); entity.saveComponent(netComponent); netIdToEntityId.put(netComponent.getNetworkId(), entity.getId()); switch (netComponent.replicateMode) { case OWNER: NetClient clientPlayer = getNetOwner(entity); if (clientPlayer != null) { clientPlayer.setNetInitial(netComponent.getNetworkId()); } break; default: for (NetClient client : netClientList) { // TODO: Relevance Check client.setNetInitial(netComponent.getNetworkId()); } break; } EntityRef owner = entity.getOwner(); if (owner.exists()) { ownerLookup.put(entity, owner); ownedLookup.put(owner, entity); } } }
protected void updateUserSSRC(int ssrc, long userId) { if (ssrcMap.containsKey(ssrc)) { long previousId = ssrcMap.get(ssrc); if (previousId != userId) { //Different User already existed with this ssrc. What should we do? Just replace? Probably should nuke the old opusDecoder. //Log for now and see if any user report the error. LOG.error("Yeah.. So.. JDA received a UserSSRC update for an ssrc that already had a User set. Inform DV8FromTheWorld.\nChannelId: {} SSRC: {} oldId: {} newId: {}", channel.get().getId(), ssrc, previousId, userId); } } else { ssrcMap.put(ssrc, userId); //Only create a decoder if we are actively handling received audio. if (receiveThread != null && AudioNatives.ensureOpus()) opusDecoders.put(ssrc, new Decoder(ssrc)); } }
public long put( int key, long value ) { synchronized( mutex ) { return m.put( key, value ); } } public long remove( int key ) {
@Override public long put( int key, long value ) { synchronized( mutex ) { return m.put( key, value ); } } @Override
public long put( int key, long value ) { synchronized( mutex ) { return m.put( key, value ); } } public long remove( int key ) {
@Override public final void read(ObjectInputStream is, int count) throws IOException { for (int i=0; i<count; ++i) { final long value = is.readLong(); this.codes.put(i, value); } }
@Override public Array<Long> fill(Long value, int start, int end) { final long fillValue = value == null ? defaultValue : value; if (fillValue == defaultValue) { this.values.clear(); } else { for (int i=start; i<end; ++i) { this.values.put(i, fillValue); } } return this; }
@Override public final void read(ObjectInputStream is, int count) throws IOException { for (int i=0; i<count; ++i) { final long value = is.readLong(); this.values.put(i, value); if (value != defaultValueAsLong) { final short zoneId = is.readShort(); this.zoneIds.put(i, zoneId); } } }
@Override() public final Array<T> copy(int start, int end) { final int length = end - start; final SparseArrayWithLongCoding<T> clone = new SparseArrayWithLongCoding<>(length, defaultValue, coding); for (int i=0; i<length; ++i) { final long code = getLong(start+i); if (code != defaultCode) { clone.codes.put(i, code); } } return clone; }
@Override public Array<T> fill(T value, int start, int end) { final long fillCode = coding.getCode(value); if (fillCode == defaultCode) { this.codes.clear(); } else { for (int i=start; i<end; ++i) { this.codes.put(i, fillCode); } } return this; }
@Override() public final Array<T> copy(int[] indexes) { final SparseArrayWithLongCoding<T> clone = new SparseArrayWithLongCoding<>(indexes.length, defaultValue, coding); for (int i = 0; i < indexes.length; ++i) { final long code = getLong(indexes[i]); clone.codes.put(i, code); } return clone; }
@Override public final Long setValue(int index, Long value) { this.checkBounds(index, length); final Long oldValue = getValue(index); if (value == null) { this.values.remove(index); return oldValue; } else { this.values.put(index,value); return oldValue; } }
/** * Stores only osmWayIds which are required for relations */ protected void storeOsmWayID( int edgeId, long osmWayId ) { if (getOsmWayIdSet().contains(osmWayId)) { getEdgeIdToOsmWayIdMap().put(edgeId, osmWayId); } }
@Override public final long setLong(int index, long value) { this.checkBounds(index, length); final long oldValue = getLong(index); if (value == defaultValue) { this.values.remove(index); return oldValue; } else { this.values.put(index, value); return oldValue; } }
@Override() public final Array<ZonedDateTime> copy(int[] indexes) { final SparseArrayOfZonedDateTimes clone = new SparseArrayOfZonedDateTimes(indexes.length, defaultValue); for (int i = 0; i < indexes.length; ++i) { final long value = getLong(indexes[i]); if (value != defaultValueAsLong) { clone.values.put(i, value); clone.zoneIds.put(i, this.zoneIds.get(i)); } } return clone; }