Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  CellHeightCache.swift   Sprache: JAVA

 

import Foundation

/// Cache the cell hight and  estimated cell hight
final class CellHeightCache {
    
    //  MARK: - Properties

    private var cellHeightCache = [NSManagedObjectID: CGFloat]()
    private var estimatedCellHeightCache = [NSManagedObjectID: CGFloat]()
    
    // MARK: - Height
    
    /// Adds the height of a cell to the cache
    /// - Parameters:
    ///   - height: Height of cell
    ///   - objectID: NSManagedObjectID of cell
    func storeCellHeight(_ height: CGFloat, for objectID: NSManagedObjectID) {
        cellHeightCache[objectID] = height
    }
    
    /// Retrieves the cell height from cache
    /// - Parameter objectID: NSManagedObjectID of cell
    /// - Returns: Height of cell if one can be found, else nil
    func cellHeight(for objectID: NSManagedObjectID) -> CGFloat? {
        cellHeightCache[objectID]
    }
    
    // MARK: - Estimated height
    
    /// Adds the estimated height of a cell to the cache
    /// - Parameters:
    ///   - estimatedHeight: Estimated height of cell
    ///   - objectID: NSManagedObjectID of cell
    func storeEstimatedCellHeight(_ estimatedHeight: CGFloat, for objectID: NSManagedObjectID) {
        estimatedCellHeightCache[objectID] = estimatedHeight
    }
    
    /// Retrieves the estimated cell height from cache
    /// - Parameter objectID: NSManagedObjectID of cell
    /// - Returns: Estimated height of cell if one can be found, else nil
    func estimatedCellHeight(for objectID: NSManagedObjectID) -> CGFloat? {
        estimatedCellHeightCache[objectID]
    }
    
    // MARK: - Clear
    
    /// Clears all caches
    func clear() {
        cellHeightCache.removeAll()
        estimatedCellHeightCache.removeAll()
    }
    
    /// Clears all caches for a given object ID
    /// - Parameter objectID: NSManagedObjectID of cell
    func clearCellHeightCache(for objectID: NSManagedObjectID) {
        cellHeightCache.removeValue(forKey: objectID)
        estimatedCellHeightCache.removeValue(forKey: objectID)
    }
}

Messung
CHZG
859710094

¤ Dauer der Verarbeitung: 0.1 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover


Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1104857
#Domains=439316