public void add(RouteDataObject ro) { tileStatistics.addObject(ro); for (int i = 0; i < ro.pointsX.length; i++) { int x31 = ro.getPoint31XTile(i); int y31 = ro.getPoint31YTile(i); long l = (((long) x31) << 31) + (long) y31; RouteSegment segment = new RouteSegment(ro, i); if (!routes.containsKey(l)) { routes.put(l, segment); } else { RouteSegment orig = routes.get(l); while (orig.next != null) { orig = orig.next; } orig.next = segment; } } }
public V remove( long key ) { synchronized( mutex ) { return m.remove( key ); } } public void putAll( Map<? extends Long, ? extends V> map ) {
/** * Checks for the present of <tt>key</tt> in the keys of the map. * * @param key an <code>Object</code> value * @return a <code>boolean</code> value */ public boolean containsKey( Object key ) { if ( key == null ) return _map.containsKey( _map.getNoEntryKey() ); return key instanceof Long && _map.containsKey( ( ( Long ) key ).longValue() ); }
/** * Creates a new <code>TLongObjectHashMap</code> that contains the entries * in the map passed to it. * * @param map the <tt>TLongObjectMap</tt> to be copied. */ public TLongObjectHashMap( TLongObjectMap<? extends V> map ) { this( map.size(), 0.5f, map.getNoEntryKey() ); putAll( map ); }
/** * Inserts a key/value pair into the map. * * @param key an <code>Long</code> value * @param value an <code>Object</code> value * @return the previous value associated with <tt>key</tt>, * or <tt>null</tt> if none was found. */ public V put( Long key, V value ) { long k; if ( key == null ) { k = _map.getNoEntryKey(); } else { k = unwrapKey( key ); } return _map.put( k, value ); }
return null; GuildImpl guild = (GuildImpl) getJDA().getGuildMap().get(id); if (guild == null) MemberImpl member = (MemberImpl) guild.getMembersMap().remove(userId); ((VoiceChannelImpl) channel).getConnectedMembersMap().remove(member.getUser().getIdLong()); getJDA().getEventManager().handle( new GuildVoiceLeaveEvent( && getJDA().getGuildMap().valueCollection().stream().noneMatch(g -> ((GuildImpl) g).getMembersMap().containsKey(userId)) && !(getJDA().getAccountType() == AccountType.CLIENT && getJDA().asClient().getFriendById(userId) != null)) UserImpl user = (UserImpl) getJDA().getUserMap().remove(userId); if (user.hasPrivateChannel()) user.setFake(true); priv.setFake(true); getJDA().getFakeUserMap().put(user.getIdLong(), user); getJDA().getFakePrivateChannelMap().put(priv.getIdLong(), priv); getJDA().getFakeUserMap().put(user.getIdLong(), user); break; //Breaks from groups loop
public V get( long key ) { synchronized( mutex ) { return m.get( key ); } }
public V put( long key, V value ) { synchronized( mutex ) { return m.put( key, value ); } } public V remove( long key ) {
channel = getJDA().getPrivateChannelMap().get(channelId); if (channel == null) WebSocketClient.LOG.error("Received a CALL_CREATE for a Group that already has an active call cached! JSON: {}", content); group.setCurrentCall(call); group.getUserMap().forEachEntry((userId, user) -> callUsers.put(userId, callUser); WebSocketClient.LOG.error("Received a CALL_CREATE for a PrivateChannel that already has an active call cached! JSON: {}", content); priv.setCurrentCall(call); callUsers.put(priv.getUser().getIdLong(), new CallUserImpl(call, priv.getUser())); callUsers.put(getJDA().getSelfUser().getIdLong(), new CallUserImpl(call, getJDA().getSelfUser())); CallUser cUser = callUsers.get(userId); CallVoiceStateImpl vState = (CallVoiceStateImpl) cUser.getVoiceState(); vState.setSelfDeafened(voiceState.getBoolean("self_deaf")); getJDA().asClient().getCallUserMap().put(userId, cUser);
/** {@inheritDoc} */ public boolean equals( Object other ) { if ( ! ( other instanceof TLongObjectMap ) ) { return false; } TLongObjectMap that = ( TLongObjectMap ) other; if ( that.size() != this.size() ) { return false; } try { TLongObjectIterator iter = this.iterator(); while ( iter.hasNext() ) { iter.advance(); long key = iter.key(); Object value = iter.value(); if ( value == null ) { if ( !( that.get( key ) == null && that.containsKey( key ) ) ) { return false; } } else { if ( !value.equals( that.get( key ) ) ) { return false; } } } } catch ( ClassCastException ex ) { // unused. } return true; }
GuildImpl guild = (GuildImpl) getJDA().getGuildMap().get(guildId); TextChannel channel = getJDA().getTextChannelMap().remove(channelId); if (channel == null) guild.getTextChannelsMap().remove(channel.getIdLong()); getJDA().getEventManager().handle( new TextChannelDeleteEvent( GuildImpl guild = (GuildImpl) getJDA().getGuildMap().get(guildId); VoiceChannel channel = getJDA().getVoiceChannelMap().remove(channelId); if (channel == null) AudioManagerImpl manager = (AudioManagerImpl) getJDA().getAudioManagerMap().get(guild.getIdLong()); if (manager != null && manager.isConnected() && manager.getConnectedChannel().getIdLong() == channel.getIdLong()) guild.getVoiceChannelsMap().remove(channel.getIdLong()); getJDA().getEventManager().handle( new VoiceChannelDeleteEvent( GuildImpl guild = (GuildImpl) getJDA().getGuildMap().get(guildId); Category category = getJDA().getCategoryMap().remove(channelId); if (category == null) guild.getCategoriesMap().remove(channelId); getJDA().getEventManager().handle( new CategoryDeleteEvent( PrivateChannel channel = getJDA().getPrivateChannelMap().remove(channelId);
public Collection<V> valueCollection() { if ( values == null ) values = Collections.unmodifiableCollection( m.valueCollection() ); return values; } public Object[] values() { return m.values(); }
public SelfUser createSelfUser(JSONObject self) { SelfUserImpl selfUser = ((SelfUserImpl) getJDA().getSelfUser()); if (selfUser == null) { final long id = self.getLong("id"); selfUser = new SelfUserImpl(id, getJDA()); getJDA().setSelfUser(selfUser); } if (!getJDA().getUserMap().containsKey(selfUser.getIdLong())) getJDA().getUserMap().put(selfUser.getIdLong(), selfUser); selfUser.setVerified(self.getBoolean("verified")) .setMfaEnabled(self.getBoolean("mfa_enabled")) .setName(self.getString("username")) .setDiscriminator(self.getString("discriminator")) .setAvatarId(self.optString("avatar", null)) .setBot(Helpers.optBoolean(self, "bot")); if (this.getJDA().getAccountType() == AccountType.CLIENT) { selfUser .setEmail(self.optString("email", null)) .setMobile(Helpers.optBoolean(self, "mobile")) .setNitro(Helpers.optBoolean(self, "premium")) .setPhoneNumber(self.optString("phone", null)); } return selfUser; }
/** * Retrieves the value for <tt>key</tt> * * @param key an <code>Object</code> value * @return the value of <tt>key</tt> or null if no such mapping exists. */ public V get( Object key ) { long k; if ( key != null ) { if ( key instanceof Long ) { k = unwrapKey( ( Long ) key ); } else { return null; } } else { k = _map.getNoEntryKey(); } return _map.get( k ); }
public boolean containsKey( long key ) { synchronized( mutex ) { return m.containsKey( key ); } } public boolean containsValue( Object value ){
@Override public List<T> asList() { ArrayList<T> list = new ArrayList<>(elements.size()); elements.forEachValue(list::add); return Collections.unmodifiableList(list); }
/** * Empties the map. */ public void clear() { this._map.clear(); }
public boolean forEachEntry( TLongObjectProcedure<? super V> procedure ) { synchronized( mutex ) { return m.forEachEntry( procedure ); } } public void transformValues( TObjectFunction<V,V> function ) {
/** * Returns the number of entries in the map. * * @return the map's size. */ public int size() { return this._map.size(); }