org.scilab.forge.jlatexmath.cache
Class JLaTeXMathCache

java.lang.Object
  extended by org.scilab.forge.jlatexmath.cache.JLaTeXMathCache

public final class JLaTeXMathCache
extends java.lang.Object

Class to cache generated image from formulas

Author:
Calixte DENIZET

Method Summary
static void clearCache()
          Clear the cache
static java.lang.Object getCachedTeXFormula(java.lang.String f, int style, int size, int inset)
           
static java.lang.Object getCachedTeXFormula(java.lang.String f, int style, int type, int size, int inset, java.awt.Color fgcolor)
          Get a cached formula
static int[] getCachedTeXFormulaDimensions(java.lang.Object o)
           
static int[] getCachedTeXFormulaDimensions(java.lang.String f, int style, int size, int inset)
           
static int[] getCachedTeXFormulaDimensions(java.lang.String f, int style, int type, int size, int inset, java.awt.Color fgcolor)
           
static java.awt.Image getCachedTeXFormulaImage(java.lang.Object o)
          Get a cached formula
static java.awt.Image getCachedTeXFormulaImage(java.lang.String f, int style, int size, int inset)
           
static java.awt.Image getCachedTeXFormulaImage(java.lang.String f, int style, int type, int size, int inset, java.awt.Color fgcolor)
          Get a cached formula
static java.lang.Object paintCachedTeXFormula(java.lang.Object o, java.awt.Graphics2D g)
          Paint a cached formula
static java.lang.Object paintCachedTeXFormula(java.lang.String f, int style, int size, int inset, java.awt.Graphics2D g)
           
static java.lang.Object paintCachedTeXFormula(java.lang.String f, int style, int type, int size, int inset, java.awt.Color fgcolor, java.awt.Graphics2D g)
          Paint a cached formula
static void removeCachedTeXFormula(java.lang.Object o)
          Remove a formula from the cache.
static void removeCachedTeXFormula(java.lang.String f, int style, int size, int inset)
           
static void removeCachedTeXFormula(java.lang.String f, int style, int type, int size, int inset, java.awt.Color fgcolor)
          Remove a formula from the cache
static void setMaxCachedObjects(int max)
          Set max size.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setMaxCachedObjects

public static void setMaxCachedObjects(int max)
Set max size. Take care the cache will be reinitialized

Parameters:
max - the max size

getCachedTeXFormulaDimensions

public static int[] getCachedTeXFormulaDimensions(java.lang.String f,
                                                  int style,
                                                  int type,
                                                  int size,
                                                  int inset,
                                                  java.awt.Color fgcolor)
                                           throws ParseException
Parameters:
f - a formula
style - a style like TeXConstants.STYLE_DISPLAY
size - the size of font
inset - the inset to add on the top, bottom, left and right
Returns:
an array of length 3 containing width, height and depth
Throws:
ParseException

getCachedTeXFormulaDimensions

public static int[] getCachedTeXFormulaDimensions(java.lang.String f,
                                                  int style,
                                                  int size,
                                                  int inset)
                                           throws ParseException
Throws:
ParseException

getCachedTeXFormulaDimensions

public static int[] getCachedTeXFormulaDimensions(java.lang.Object o)
                                           throws ParseException
Parameters:
o - an Object to identify the image in the cache
Returns:
an array of length 3 containing width, height and depth
Throws:
ParseException

getCachedTeXFormula

public static java.lang.Object getCachedTeXFormula(java.lang.String f,
                                                   int style,
                                                   int type,
                                                   int size,
                                                   int inset,
                                                   java.awt.Color fgcolor)
                                            throws ParseException
Get a cached formula

Parameters:
f - a formula
style - a style like TeXConstants.STYLE_DISPLAY
size - the size of font
inset - the inset to add on the top, bottom, left and right
Returns:
the key in the map
Throws:
ParseException

getCachedTeXFormula

public static java.lang.Object getCachedTeXFormula(java.lang.String f,
                                                   int style,
                                                   int size,
                                                   int inset)
                                            throws ParseException
Throws:
ParseException

clearCache

public static void clearCache()
Clear the cache


removeCachedTeXFormula

public static void removeCachedTeXFormula(java.lang.String f,
                                          int style,
                                          int type,
                                          int size,
                                          int inset,
                                          java.awt.Color fgcolor)
                                   throws ParseException
Remove a formula from the cache

Parameters:
f - a formula
style - a style like TeXConstants.STYLE_DISPLAY
size - the size of font
inset - the inset to add on the top, bottom, left and right
Throws:
ParseException

removeCachedTeXFormula

public static void removeCachedTeXFormula(java.lang.String f,
                                          int style,
                                          int size,
                                          int inset)
                                   throws ParseException
Throws:
ParseException

removeCachedTeXFormula

public static void removeCachedTeXFormula(java.lang.Object o)
                                   throws ParseException
Remove a formula from the cache. Take care, remove the Object o, invalidate it !

Parameters:
o - an Object to identify the image in the cache
Throws:
ParseException

paintCachedTeXFormula

public static java.lang.Object paintCachedTeXFormula(java.lang.String f,
                                                     int style,
                                                     int type,
                                                     int size,
                                                     int inset,
                                                     java.awt.Color fgcolor,
                                                     java.awt.Graphics2D g)
                                              throws ParseException
Paint a cached formula

Parameters:
f - a formula
style - a style like TeXConstants.STYLE_DISPLAY
size - the size of font
inset - the inset to add on the top, bottom, left and right
Returns:
the key in the map
Throws:
ParseException

paintCachedTeXFormula

public static java.lang.Object paintCachedTeXFormula(java.lang.String f,
                                                     int style,
                                                     int size,
                                                     int inset,
                                                     java.awt.Graphics2D g)
                                              throws ParseException
Throws:
ParseException

paintCachedTeXFormula

public static java.lang.Object paintCachedTeXFormula(java.lang.Object o,
                                                     java.awt.Graphics2D g)
                                              throws ParseException
Paint a cached formula

Parameters:
o - an Object to identify the image in the cache
g - the graphics where to paint the image
Returns:
the key in the map
Throws:
ParseException

getCachedTeXFormulaImage

public static java.awt.Image getCachedTeXFormulaImage(java.lang.String f,
                                                      int style,
                                                      int type,
                                                      int size,
                                                      int inset,
                                                      java.awt.Color fgcolor)
                                               throws ParseException
Get a cached formula

Parameters:
f - a formula
style - a style like TeXConstants.STYLE_DISPLAY
size - the size of font
inset - the inset to add on the top, bottom, left and right
Returns:
the cached image
Throws:
ParseException

getCachedTeXFormulaImage

public static java.awt.Image getCachedTeXFormulaImage(java.lang.String f,
                                                      int style,
                                                      int size,
                                                      int inset)
                                               throws ParseException
Throws:
ParseException

getCachedTeXFormulaImage

public static java.awt.Image getCachedTeXFormulaImage(java.lang.Object o)
                                               throws ParseException
Get a cached formula

Parameters:
o - an Object to identify the image in the cache
Returns:
the cached image
Throws:
ParseException