1 18 package org.apache.batik.ext.awt.image.rendered; 19 20 import java.awt.image.Raster ; 21 import java.lang.ref.Reference ; 22 import java.lang.ref.SoftReference ; 23 24 31 public class TileLRUMember implements LRUCache.LRUObj { 32 private static final boolean DEBUG = false; 33 34 protected LRUCache.LRUNode myNode = null; 35 protected Reference wRaster = null; 36 protected Raster hRaster = null; 37 38 public TileLRUMember() { } 39 40 public TileLRUMember(Raster ras) { 41 setRaster(ras); 42 } 43 44 public void setRaster(Raster ras) { 45 hRaster = ras; 46 wRaster = new SoftReference (ras); 47 } 48 49 public boolean checkRaster() { 50 if (hRaster != null) return true; 51 52 if ((wRaster != null) && 53 (wRaster.get() != null)) return true; 54 55 return false; 56 } 57 58 public Raster retrieveRaster() { 59 if (hRaster != null) return hRaster; 60 if (wRaster == null) return null; 61 62 hRaster = (Raster )wRaster.get(); 63 64 if (hRaster == null) wRaster = null; 66 67 return hRaster; 68 } 69 70 public LRUCache.LRUNode lruGet() { return myNode; } 71 public void lruSet(LRUCache.LRUNode nde) { myNode = nde; } 72 public void lruRemove() { 73 myNode = null; 74 hRaster = null; 75 if (DEBUG) System.out.println("Removing"); 76 } 77 } 78 79 | Popular Tags |