private ID AssignID(T holder) { Log.Verbose($"Next {typeofT} Loaded List available ID requested"); ID newid; if (FreeIDs.Count > 0) { newid = FreeIDs.Dequeue(); newid.Activate(holder, this); holder.ID = newid; Log.Verbose($"Granted the ID: \"{newid}\" to holder of Type: \"{typeofT}\""); return(newid); } Log.Verbose($"No free IDs available in {typeofT} Loaded List, creating a new one."); newid = new ID(Items.Count); newid.Activate(holder, this); holder.ID = newid; Log.Verbose($"Granted the ID: \"{newid}\" to holder of Type: \"{typeofT}\""); return(newid); }
private void RevokeID(ID id) { id.Deactivate(); FreeIDs.Enqueue(id); }