/** * @param additionalProperties the additionalProperties to set */ public void setAdditionalProperty(String key, Object value) { if (additionalProperties == null) { additionalProperties = new LightHashMap(1); } additionalProperties.put(key, value); }
public void setAdditionalProperties(Map mapToCopy) { if (additionalProperties == null) { additionalProperties = new LightHashMap(1); } additionalProperties.putAll(mapToCopy); }
@Override public void setUserData(String key, Object value) { if(userData == null) userData = new LightHashMap(2); userData.put(key, value); }
public void clearUsedMessagesMap(int initialCapacity) { used_messages = new LightHashMap(initialCapacity); if (null_values != null) { null_values = new ArrayList(0); } } }
protected void setAdditionalProperty( String name, Object value ) { if ( additional_properties_maybe_null == null ){ additional_properties_maybe_null = new LightHashMap(); } additional_properties_maybe_null.put( name, value ); }
@Override public Object setUserData( Object key, Object value ) { synchronized( this ){ if ( user_data == null ){ user_data = new LightHashMap<>(); } return( user_data.put( key, value )); } }
@Override public void setEntryAutoOpen(String id, Object datasource) { Map<String, Object> map = (Map<String, Object>) mapAutoOpen.get(id); if (map == null) { map = new LightHashMap<>(1); } map.put("datasource", datasource); mapAutoOpen.put(id, map); }
@Override public void setUserData(Object key, Object data) { synchronized (this) { if (user_data == null) { user_data = new LightHashMap<>(); } if (data == null) { user_data.remove(key); if (user_data.isEmpty()) { user_data = null; } } else { user_data.put(key, data); } } }
protected Iterator getKeysLight() { Map m = new LightHashMap(loadMessages()); return( m.keySet().iterator()); }
Map<String,Object> exportToMap() throws IOException { Map<String,Object> map = new LightHashMap<>(); map.put( "u", uid ); map.put( "h", hash ); map.put( "n", name.getBytes( "UTF-8" )); map.put( "z", size ); map.put( "s", save_location.getBytes( "UTF-8" )); map.put( "a", add_time ); map.put( "c", complete_time ); map.put( "r", remove_time ); return( map ); }
@Override public void setUserData( Object key, Object data ) { synchronized( this ){ if ( user_data == null ){ user_data = new LightHashMap<>(); } user_data.put( key, data ); } }
@Override public void setUserData( Object key, Object data ) { synchronized( this ){ if ( user_data == null ){ user_data = new LightHashMap<>(); } user_data.put( key, data ); } }
public void setColumnData(String columnID, String key, Object value) { synchronized (tablesConfig) { Map mapTablesConfig = getTablesConfigMap(); Map mapColumns = MapUtils.getMapMap(mapTablesConfig, "Columns", null); if (mapColumns == null) { mapColumns = new LightHashMap(2); mapTablesConfig.put("Columns", mapColumns); } Map mapConfig = MapUtils.getMapMap(mapColumns, columnID, null); if (mapConfig == null) { mapConfig = new LightHashMap(2); mapColumns.put(columnID, mapConfig); } mapConfig.put(key, value); } }
@Override public void addCellOtherListener(String listenerID, Object listener) { try { this_mon.enter(); if (mapOtherCellListeners == null) { mapOtherCellListeners = new LightHashMap<>(1); } List<Object> list = mapOtherCellListeners.get(listenerID); if (list == null) { list = new ArrayList<>(1); mapOtherCellListeners.put(listenerID, list); list.add(listener); } else if (!list.contains(listener)) { list.add(listener); } } finally { this_mon.exit(); } }
/** To store arbitrary objects against a peer. */ @Override public void setUserData (Object key, Object value) { try{ general_mon.enter(); if (data == null) { data = new LightHashMap(); } if (value == null) { if (data.containsKey(key)){ data.remove(key); if ( data.size()==0 ){ data = null; } } } else { data.put(key, value); } }finally{ general_mon.exit(); } }
/** To store arbitrary objects against a peer. */ @Override public void setUserData (Object key, Object value) { try{ this_mon.enter(); if (data == null) { data = new LightHashMap(); } if (value == null) { if (data.containsKey(key)){ data.remove(key); if ( data.size() == 0 ){ data = null; } } } else { data.put(key, value); } }finally{ this_mon.exit(); } }
@Override public void setParameterDefault( String name ) { try{ this_mon.enter(); Object value = parameters.get( name ); if ( value == null ){ return; } // gotta clone here otherwise we update the underlying map and the setMapAttribute code // doesn't think it has changed parameters = new LightHashMap(parameters); parameters.remove( name ); }finally{ this_mon.exit(); } setMapAttribute( AT_PARAMETERS, parameters ); }
protected byte[] getSecret2( TOTorrent torrent ) throws TOTorrentException { Map secrets_map = download_manager.getDownloadState().getMapAttribute( DownloadManagerState.AT_SECRETS ); if ( secrets_map == null ){ secrets_map = new HashMap(); }else{ // clone as we can't just update the returned values secrets_map = new LightHashMap(secrets_map); } if ( secrets_map.size() == 0 ){ secrets_map.put( "p1", torrent.getPieces()[0] ); download_manager.getDownloadState().setMapAttribute( DownloadManagerState.AT_SECRETS, secrets_map ); } return((byte[])secrets_map.get( "p1" )); }
@Override public void setLongParameter( String name, long value ) { Object default_value = default_parameters.get( name ); if ( default_value == null ){ Debug.out( "Unknown parameter '" + name + "' - must be defined in DownloadManagerState" ); } try{ this_mon.enter(); // gotta clone here otherwise we update the underlying map and the setMapAttribute code // doesn't think it has changed parameters = new LightHashMap(parameters); parameters.put( name, new Long(value)); setMapAttribute( AT_PARAMETERS, parameters ); }finally{ this_mon.exit(); } }
@Override public void setTaggableTransientProperty(String key, Object value) { synchronized( TTP_KEY ){ LightHashMap<String,Object> map = (LightHashMap<String,Object>)getUserData( TTP_KEY ); if ( map == null ){ if ( value == null ){ return; } map = new LightHashMap<>(); map.put( key, value ); setUserData( TTP_KEY, map ); }else{ if ( value == null ){ map.remove( key ); if ( map.size() == 0 ){ setUserData( TTP_KEY, null ); } }else{ map.put( key, value ); } } } }