public Result get( final InstanceID instanceID, final long styleChangeTracker, final long attributeChangeTracker, final String originalText ) { final InternalResult o = cache.get( instanceID ); if ( o == null ) { return null; } if ( o.isValid( styleChangeTracker, attributeChangeTracker, originalText ) == false ) { cache.remove( instanceID ); return null; } return o; }
public TextCache( final int maxEntries ) { cache = new LFUMap<InstanceID, InternalResult>( maxEntries ); }
public synchronized void putFontMetrics( final FontKey key, final FontMetrics metrics ) { map.put( key, metrics ); }
remove( key ); return;
public TableModel get( final DataCacheKey key ) { return dataCache.get( key ); }
public void clearAll() { dataCache.clear(); }
public Object clone() throws CloneNotSupportedException { final LibLoaderResourceBundleFactory o = (LibLoaderResourceBundleFactory) super.clone(); o.failedLoads = (HashSet<String>) failedLoads.clone(); o.successfulLoads = (LFUMap<String, LibLoaderResourceBundle>) successfulLoads.clone(); return o; }
public void store( final InstanceID instanceID, final long styleChangeTracker, final long attrChangeTracker, final String originalText, final StyleSheet styleSheet, final ReportAttributeMap attributeMap, final RenderNode[] text, final RenderNode[] finish ) { cache.put( instanceID, new InternalResult( text, finish, styleSheet, styleChangeTracker, attributeMap, attrChangeTracker, originalText ) ); }
remove(key); return;
public synchronized FontMetrics getFontMetrics( final FontKey fontKey ) { return map.get( fontKey ); }
public void shutdown() { dataCache.clear(); } }
public ImmutableDataAttributes normalize( final DataAttributes attrs, final DataAttributeContext context ) { ImmutableDataAttributes key = ImmutableDataAttributes.create( attrs, context ); CacheKey cacheKey = new CacheKey( context, key ); synchronized ( this ) { ImmutableDataAttributes fromCache = backend.get( cacheKey ); if ( fromCache == null ) { backend.put( cacheKey, key ); return key; } return fromCache; } } }
public TableModel put( final DataCacheKey key, final TableModel model ) { if ( model.getRowCount() > maximumRows ) { return model; } // Only copy if safe to do so. Check for whitelist of good column types .. if ( CachableTableModel.isSafeToCache( model ) == false ) { return model; } final TableModel cacheModel = new CachableTableModel( model ); dataCache.put( key, cacheModel ); return cacheModel; }
public LeastFrequentlyUsedCache( final int cacheSize ) { // having at least 3 entries saves me a lot of coding and thus gives more performance .. this.map = new LFUMap<FontKey, FontMetrics>( cacheSize ); }
public void setResourceLoader( final ResourceManager resourceManager, final ResourceKey contextKey ) { this.manager = resourceManager; this.baseKey = contextKey; this.failedLoads.clear(); this.successfulLoads.clear(); }
public String printCornerAsCSS( final BorderCorner edge ) { final String cached = cachedCornerStyle.get( edge ); if ( cached != null ) { return cached; } final String value = ( pointConverter.format( StrictGeomUtility.toExternalValue( edge.getWidth() ) ) + "pt " + pointConverter .format( StrictGeomUtility.toExternalValue( edge.getHeight() ) ) + "pt " ); cachedCornerStyle.put( edge, value ); return value; }