public synchronized void putFontMetrics( final FontKey key, final FontMetrics metrics ) { map.put( key, metrics ); }
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 ) ); }
public short getNearestColor( final Color awtColor ) { Short value = colorCache.get( awtColor.getRGB() ); if ( value != null ) { return value; } short nearestColor = base.getNearestColor( awtColor ); colorCache.put( awtColor.getRGB(), nearestColor ); return nearestColor; } }
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 Object clone() throws CloneNotSupportedException { final LFUMap<K, V> map = (LFUMap<K, V>) super.clone(); map.map = (HashMap<K, MapEntry<K, V>>) this.map.clone(); map.map.clear(); MapEntry<K, V> entry = first; while ( entry != null ) { final K key = entry.getKey(); final V value = entry.getValue(); map.put( key, value ); entry = entry.getNext(); } return map; } }
public Object clone() throws CloneNotSupportedException { final LFUMap<K,V> map = (LFUMap<K,V>) super.clone(); map.map = (HashMap<K,MapEntry<K,V>>) this.map.clone(); map.map.clear(); MapEntry<K,V> entry = first; while (entry != null) { final K key = entry.getKey(); final V value = entry.getValue(); map.put(key, value); entry = entry.getNext(); } return map; } }
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; }
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 String printCornerAsCSS( final BorderCorner edge ) { final String cached = cachedCornerStyle.get( edge ); if ( cached != null ) { return cached; } final String value = ( pointConverter.format( factory.fixLengthForSafari( StrictGeomUtility.toExternalValue( edge.getWidth() ) ) ) + "pt " + pointConverter .format( factory.fixLengthForSafari( StrictGeomUtility.toExternalValue( edge.getHeight() ) ) ) + "pt " ); cachedCornerStyle.put( edge, value ); return value; }
try { final LibLoaderResourceBundle resourceBundle = new LibLoaderResourceBundle( instream ); successfulLoads.put( propsName, resourceBundle ); return resourceBundle; } finally { try { final LibLoaderResourceBundle resourceBundle = new LibLoaderResourceBundle( instream ); successfulLoads.put( propsName, resourceBundle ); return resourceBundle; } finally {
public BoxDefinition getBoxDefinition( final StyleSheet es ) { final InstanceID id = es.getId(); cacheKey.reuse( id, es.getClass().getName() ); final CacheCarrier cc = cache.get( cacheKey ); if ( cc == null ) { final BoxDefinition boxDefinition = createBoxDefinition( es ); cache.put( new CacheKey( id, es.getClass().getName() ), new CacheCarrier( es.getChangeTracker(), boxDefinition ) ); return boxDefinition; } if ( cc.getChangeTracker() != es.getChangeTracker() ) { final BoxDefinition boxDefinition = createBoxDefinition( es ); cc.update( es.getChangeTracker(), boxDefinition ); return boxDefinition; } return cc.getBoxDefinition(); }
public String printEdgeAsCSS( final BorderEdge edge ) { final BorderStyle borderStyle = edge.getBorderStyle(); final long width = edge.getWidth(); if ( BorderStyle.NONE.equals( borderStyle ) || width <= 0 ) { return "none"; } final String cached = cachedBorderStyle.get( edge ); if ( cached != null ) { return cached; } final String value = pointConverter.format( StrictGeomUtility.toExternalValue( width ) ) + "pt " + borderStyle.toString() + ' ' + HtmlColors.getColorString( edge.getColor() ); cachedBorderStyle.put( edge, value ); return value; }
final ResourceData data = resourceManager.load( resource ); instance = com.lowagie.text.Image.getInstance( data.getResource( resourceManager ) ); imageCache.put( resource, instance );
public CellStyle createCellStyle( final InstanceID id, final StyleSheet element, final CellBackground bg ) { if ( id == null ) { CellStyle cellStyle = backgroundCache.get( bg ); if ( cellStyle != null ) { return cellStyle; } } else { CellStyle cellStyle = contentCache.get( new CacheKey( id, bg, element.getId(), (TextRotation) element.getStyleProperty( TextStyleKeys.TEXT_ROTATION, null ) ) ); if ( cellStyle != null ) { return cellStyle; } } CellStyle cellStyle = backend.createCellStyle( id, element, bg ); if ( cellStyle == null ) { return null; } if ( id == null ) { backgroundCache.put( bg, cellStyle ); } else { contentCache.put( new CacheKey( id, bg, element.getId(), (TextRotation) element.getStyleProperty( TextStyleKeys.TEXT_ROTATION, null ) ), cellStyle ); } return cellStyle; }
public String printEdgeAsCSS( final BorderEdge edge ) { final BorderStyle borderStyle = edge.getBorderStyle(); final long width = edge.getWidth(); if ( BorderStyle.NONE.equals( borderStyle ) || width <= 0 ) { return "none"; } final String cached = cachedBorderStyle.get( edge ); if ( cached != null ) { return cached; } final String value = pointConverter.format( factory.fixLengthForSafari( StrictGeomUtility.toExternalValue( width ) ) ) + "pt " + mapStyleToHtmlAllowed( borderStyle.toString() ) + ' ' + HtmlColors.getColorString( edge.getColor() ); cachedBorderStyle.put( edge, value ); return value; }
public SimpleStyleSheet getStyleSheet( final StyleSheet parent ) { final InstanceID id = parent.getId(); final String styleClass = parent.getClass().getName(); lookupKey.setStyleClass( styleClass ); lookupKey.setInstanceId( id ); final CacheCarrier cc = cache.get( lookupKey ); if ( cc == null ) { final CacheKey key = new CacheKey( id, styleClass ); final SimpleStyleSheet styleSheet = new SimpleStyleSheet( parent ); cache.put( key, new CacheCarrier( parent.getChangeTracker(), styleSheet ) ); cacheMiss += 1; return styleSheet; } if ( cc.getChangeTracker() != parent.getChangeTracker() ) { final CacheKey key = new CacheKey( id, styleClass ); final SimpleStyleSheet styleSheet = new SimpleStyleSheet( parent ); cache.put( key, new CacheCarrier( parent.getChangeTracker(), styleSheet ) ); cacheMiss += 1; return styleSheet; } validateCacheResult( parent, cc.getStyleSheet() ); cacheHits += 1; return cc.getStyleSheet(); }
public String getNormalizedFontFamilyName( final String name ) { if ( name != null ) { final Object fromCache = normalizedFontNameCache.get( name ); if ( fromCache != null ) { return (String) fromCache; } } String mappedName = super.getNormalizedFontFamilyName( name ); if ( FontMappingUtility.isSerif( mappedName ) ) { mappedName = "Times"; } else if ( FontMappingUtility.isSansSerif( mappedName ) ) { mappedName = "Helvetica"; } else if ( FontMappingUtility.isCourier( mappedName ) ) { mappedName = "Courier"; } else if ( FontMappingUtility.isSymbol( mappedName ) ) { mappedName = "Symbol"; } if ( name != null ) { normalizedFontNameCache.put( name, mappedName ); } return mappedName; }
fontMetricsByStyleCache.put( key, new StyleCacheEntry( styleSheet.getChangeTracker(), metrics ) ); return metrics;
context.failureCache = new LFUMap<Object, Boolean>( 5 ); context.failureCache.put( value, Boolean.TRUE ); ContentType.logger.warn( "Failed to load content using value " + value, e );
baselinesCache.put( new FontMetricsKey( lookupKey ), baselineInfo );