20 package net.sf.gridarta.model.face;
22 import java.lang.ref.SoftReference;
23 import java.util.HashMap;
25 import javax.swing.ImageIcon;
26 import org.apache.log4j.Category;
27 import org.apache.log4j.Logger;
28 import org.jetbrains.annotations.NotNull;
29 import org.jetbrains.annotations.Nullable;
49 private final Map<String, SoftReference<ImageIcon>>
cache =
new HashMap<>();
54 ImageIcon icon =
null;
55 final String realFaceName = String.format(
"%s-%d", faceName, stretch);
56 final SoftReference<ImageIcon> ref =
cache.get(realFaceName);
63 cache.put(realFaceName,
new SoftReference<>(icon));
71 if (
LOG.isDebugEnabled()) {
72 LOG.debug(
"Clearing image cache.");
84 protected abstract ImageIcon
createImage(@NotNull String faceName,
long stretch);