Package eu.simuline.m2latex.core
Enum LatexPreProcessor.SuffixHandler
- java.lang.Object
-
- java.lang.Enum<LatexPreProcessor.SuffixHandler>
-
- eu.simuline.m2latex.core.LatexPreProcessor.SuffixHandler
-
- All Implemented Interfaces:
Serializable,Comparable<LatexPreProcessor.SuffixHandler>,java.lang.constant.Constable
- Enclosing class:
- LatexPreProcessor
static enum LatexPreProcessor.SuffixHandler extends Enum<LatexPreProcessor.SuffixHandler>
Handler for each suffix of a source file. Mostly, these represent graphic formats but alsoLatexPreProcessor.SUFFIX_TEXis required to detect the latex main files andLatexPreProcessor.SUFFIX_TEXandLatexPreProcessor.SUFFIX_BIBare needed for proper cleaning of the tex souce directory.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
-
Enum Constant Summary
Enum Constants Enum Constant Description bibHandler for .bib-files representing the BibTeX format for bibliographies.figHandler for .fig-files representing the native xfig format.gpHandler for .gp-files representing the native gnuplot format.jpgHandler for .jpg-files representing a format definde by the Joint Photographic Experts Group (jp(e)g).mpHandler for .mp-files representing the metapost format.pngHandler for .png-files representing the Portable Network Graphics format.svgHandler for .svg-files representing scaleable vector graphics.texHandler for .tex-files representing the TeX format, to be more precise the LaTeX format.
-
Constructor Summary
Constructors Modifier Constructor Description privateSuffixHandler()
-
Method Summary
Modifier and Type Method Description (package private) abstract voidclearTarget(File file, LatexPreProcessor proc)Deletes the files potentially created from the source filefileusingproc.(package private) voidclearTarget(File file, LatexPreProcessor proc, Map<File,LatexPreProcessor.SuffixHandler> file2handler)Typically, .i.e. forfig-,gp-,mp- andsvg-files just associatesfilewith this handler infile2handlerto schedule according targets for deletion except fortex-files for which the target is cleared immediately if it is a latex main file, otherwise ignoring by invokingLatexPreProcessor.clearTargetTexIfLatexMain(File).(package private) abstract StringgetSuffix()Returns the suffix of the file type of the file type, this is the handler for.(package private) abstract voidprocSrc(File file, LatexPreProcessor proc)(package private) voidscheduleProcSrc(File file, Map<File,LatexPreProcessor.SuffixHandler> file2handler, LatexPreProcessor proc, Collection<File> latexMainFiles)static LatexPreProcessor.SuffixHandlervalueOf(String name)Returns the enum constant of this type with the specified name.static LatexPreProcessor.SuffixHandler[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
fig
public static final LatexPreProcessor.SuffixHandler fig
Handler for .fig-files representing the native xfig format.
-
gp
public static final LatexPreProcessor.SuffixHandler gp
Handler for .gp-files representing the native gnuplot format.
-
mp
public static final LatexPreProcessor.SuffixHandler mp
Handler for .mp-files representing the metapost format.
-
svg
public static final LatexPreProcessor.SuffixHandler svg
Handler for .svg-files representing scaleable vector graphics.
-
jpg
public static final LatexPreProcessor.SuffixHandler jpg
Handler for .jpg-files representing a format definde by the Joint Photographic Experts Group (jp(e)g).
-
png
public static final LatexPreProcessor.SuffixHandler png
Handler for .png-files representing the Portable Network Graphics format.
-
tex
public static final LatexPreProcessor.SuffixHandler tex
Handler for .tex-files representing the TeX format, to be more precise the LaTeX format.
-
bib
public static final LatexPreProcessor.SuffixHandler bib
Handler for .bib-files representing the BibTeX format for bibliographies.
-
-
Method Detail
-
values
public static LatexPreProcessor.SuffixHandler[] values()
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static LatexPreProcessor.SuffixHandler valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
scheduleProcSrc
void scheduleProcSrc(File file, Map<File,LatexPreProcessor.SuffixHandler> file2handler, LatexPreProcessor proc, Collection<File> latexMainFiles)
-
procSrc
abstract void procSrc(File file, LatexPreProcessor proc) throws BuildFailureException
Typically, .i.e. forfig-,gp-,mp- and associatesfileDoes the transformation of the filefileusingprocimmediately, except for-
svg-files for which an info message is logged, that transformation is done by need in the course of a LaTeX run. What occurs are files .pdf and .pdf_tex even ifSettings.pdfViaDviindicates creation of dvi files. -
tex-files which are only scheduled for later translation just by adding them tolatexMainFilesif they are latex main files, and ignored otherwise (seeLatexPreProcessor.addIfLatexMain(File, Collection)). -
bib-files for which just an info message that a bib file was found is logged.
Logging:
- WFU03: cannot close
- WPP02: tex file may be latex main file
- EEX01, EEX02, EEX03, WEX04, WEX05: if applications for preprocessing graphic files failed.
- EFU06: if moving a file fails.
- Parameters:
file- a file with ending given bygetSuffix().proc- a latex pre-processor.- Throws:
BuildFailureException- TEX01 only forfig,gpandmpbecause these invoke external programs.
-
-
clearTarget
void clearTarget(File file, LatexPreProcessor proc, Map<File,LatexPreProcessor.SuffixHandler> file2handler)
Typically, .i.e. forfig-,gp-,mp- andsvg-files just associatesfilewith this handler infile2handlerto schedule according targets for deletion except for-
tex-files for which the target is cleared immediately if it is a latex main file, otherwise ignoring by invokingLatexPreProcessor.clearTargetTexIfLatexMain(File). -
bib-files (maybe appropriate also for jpg-files and for png-files) for which there are no targets and so the association is not added tofile2handler.
Logging:
- WPP02: tex file may be latex main file
- WFU01: Cannot read directory...
- WFU03: cannot close tex file
- EFU05: Failed to delete file
- Parameters:
file- a file with ending given bygetSuffix(), i.e. a file which can be handled by this handler.proc- a latex pre-processor.file2handler- mapsfileto its handler. In general, this method addsfiletofile2handlertogether with its handler which is justthis.- See Also:
clearTarget(File, LatexPreProcessor)
-
-
clearTarget
abstract void clearTarget(File file, LatexPreProcessor proc)
Deletes the files potentially created from the source filefileusingproc.Logging:
- WFU01: Cannot read directory...
- EFU05: Failed to delete file
- Parameters:
file- a file with ending given bygetSuffix().proc- a latex pre-processor.- Throws:
IllegalStateException--
if
filehas no targets to be deleted as for jpg-files, png-files and bib-files. -
if targets of
fileshould have been cleared already byclearTarget(File, LatexPreProcessor, Map)as for tex-files.
-
if
- See Also:
clearTarget(File, LatexPreProcessor, Map)
-
getSuffix
abstract String getSuffix()
Returns the suffix of the file type of the file type, this is the handler for.
-
-