Top Description Fields Constructors Methods
uk.ac.ed.ph.snuggletex

public final Class SnuggleEngine

extends Object
Class Inheritance
Imports
uk.ac.ed.ph.snuggletex.definitions.BuiltinCommand, .BuiltinEnvironment, .CorePackageDefinitions, uk.ac.ed.ph.snuggletex.internal.util.ConstraintUtilities, uk.ac.ed.ph.snuggletex.utilities.DefaultTransformerFactoryChooser, .SimpleStylesheetCache, .StylesheetCache, .StylesheetManager, .TransformerFactoryChooser, java.util.ArrayList, .Collections, .List

This is the main entry point into SnuggleTeX.

Usage

Author
David McKain
Version
$Revision$

Field Summary

Modifier and TypeField and Description
private DOMOutputOptions
private SessionConfiguration
private XMLStringOutputOptions
private final List<SnugglePackage>
packages

List of all currently registered SnugglePackages used by this Engine.

private final StylesheetManager
stylesheetManager

Helper class to manage XSLT Stylesheets

Constructor Summary

AccessConstructor and Description
public
SnuggleEngine()

Creates a new SnuggleEngine using a very simple internal cache for any XSLT stylesheets required that simply stores them internally for the lifetime of the engine.

public
SnuggleEngine(StylesheetCache stylesheetCache)

Creates a new SnuggleEngine using the given StylesheetCache for managing stylesheets.

public
SnuggleEngine(TransformerFactoryChooser transformerFactoryChooser, StylesheetCache stylesheetCache)

Creates a new SnuggleEngine using the given StylesheetCache for managing stylesheets and given TransformerFactoryChooser for choosing which XSLT implementation to use.

public
SnuggleEngine(StylesheetManager stylesheetManager)

Creates a new SnuggleEngine using the given StylesheetManager for managing stylesheets.

Method Summary

Modifier and TypeMethod and Description
public void
addPackage(SnugglePackage snugglePackage)

Registers the given SnugglePackage with this SnuggleEngine.

public SnuggleSession
createSession()

Creates a new SnuggleSession using the default SessionConfiguration or a fresh SessionConfiguration if no default has been set.

public SnuggleSession
createSession(SessionConfiguration
SessionConfiguration to use, which must not be null.
sessionConfiguration
)

Creates a new SnuggleSession using the given SessionConfiguration

public SnuggleSimpleMathRunner
public SnuggleSimpleMathRunner
public BuiltinCommand
getBuiltinCommandByTeXName(String texName)

Returns the BuiltinCommand corresponding to LaTeX command called \texName, or null if this command is not defined.

public BuiltinEnvironment
getBuiltinEnvironmentByTeXName(String texName)

Returns the BuiltinEnvironment corresponding to LaTeX environment called texName, or null if this environment is not defined.

public DOMOutputOptions
public DOMOutputOptions
getDefaultDOMOutputOptions()

Gets the default DOMOutputOptions for this SnuggleEngine, which will not be null.

public SessionConfiguration
getDefaultSessionConfiguration()

Gets the selected default SessionConfiguration for this SnuggleEngine, which will not be null.

public XMLStringOutputOptions
getDefaultXMLStringOutputOptions()

Gets the default XMLStringOutputOptions for this SnuggleEngine, which will not be null.

public List<SnugglePackage>
getPackages()

Returns a synchronized List of all SnugglePackages registered with this engine.

public StylesheetManager
getStylesheetManager()

Convenience method to extract the underlying StylesheetManager used by this engine.

public void
public void
setDefaultDOMOutputOptions(DOMOutputOptions
new DOMOutputOptions, which must not be null.
defaultDOMOutputOptions
)

Sets the default DOMOutputOptions for this SnuggleEngine.

public void
setDefaultSessionConfiguration(SessionConfiguration
new default SessionConfiguration, which must not be null.
defaultSessionConfiguration
)

Sets the default SessionConfiguration for this SnuggleEngine.

public void
setDefaultXMLStringOutputOptions(XMLStringOutputOptions
new XMLStringOutputOptions, which must not be null.
defaultXMLOutputOptions
)

Sets the default XMLStringOutputOptions for this SnuggleEngine.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

defaultDOMOutputOptionsback to summary
private DOMOutputOptions defaultDOMOutputOptions

Default DOMOutputOptions

defaultSessionConfigurationback to summary
private SessionConfiguration defaultSessionConfiguration

Default SessionConfiguration

defaultXMLStringOutputOptionsback to summary
private XMLStringOutputOptions defaultXMLStringOutputOptions

Default XMLStringOutputOptions

packagesback to summary
private final List<SnugglePackage> packages

List of all currently registered SnugglePackages used by this Engine.

stylesheetManagerback to summary
private final StylesheetManager stylesheetManager

Helper class to manage XSLT Stylesheets

Constructor Detail

SnuggleEngineback to summary
public SnuggleEngine()

Creates a new SnuggleEngine using a very simple internal cache for any XSLT stylesheets required that simply stores them internally for the lifetime of the engine. The DefaultTransformerFactoryChooser is used to choose XSLT implementations.

This will be fine in most cases. If you want more control over this, consider the alternative constructor.

SnuggleEngineback to summary
public SnuggleEngine(StylesheetCache stylesheetCache)

Creates a new SnuggleEngine using the given StylesheetCache for managing stylesheets. Use this if you want to integrate XSLT caching with your own code or want more control over how things get cached. The DefaultTransformerFactoryChooser is used to choose XSLT implementations.

SnuggleEngineback to summary
public SnuggleEngine(TransformerFactoryChooser transformerFactoryChooser, StylesheetCache stylesheetCache)

Creates a new SnuggleEngine using the given StylesheetCache for managing stylesheets and given TransformerFactoryChooser for choosing which XSLT implementation to use. Use this if you want to integrate XSLT caching with your own code, want more control over how things get cached or want to control the selection of XSLT implementations.

SnuggleEngineback to summary
public SnuggleEngine(StylesheetManager stylesheetManager)

Creates a new SnuggleEngine using the given StylesheetManager for managing stylesheets. Use this if you want to integrate XSLT caching with your own code, want more control over how things get cached or want to control the selection of XSLT implementations.

Method Detail

addPackageback to summary
public void addPackage(SnugglePackage snugglePackage)

Registers the given SnugglePackage with this SnuggleEngine. All commands, environments and error codes defined by the SnugglePackage will then become available for use.

createSessionback to summary
public SnuggleSession createSession()

Creates a new SnuggleSession using the default SessionConfiguration or a fresh SessionConfiguration if no default has been set.

createSessionback to summary
public SnuggleSession createSession(SessionConfiguration sessionConfiguration)

Creates a new SnuggleSession using the given SessionConfiguration

Parameters
sessionConfiguration:SessionConfiguration

SessionConfiguration to use, which must not be null.

createSimpleMathRunnerback to summary
public SnuggleSimpleMathRunner createSimpleMathRunner()
createSimpleMathRunnerback to summary
public SnuggleSimpleMathRunner createSimpleMathRunner(SessionConfiguration sessionConfiguration)
getBuiltinCommandByTeXNameback to summary
public BuiltinCommand getBuiltinCommandByTeXName(String texName)

Returns the BuiltinCommand corresponding to LaTeX command called \texName, or null if this command is not defined.

getBuiltinEnvironmentByTeXNameback to summary
public BuiltinEnvironment getBuiltinEnvironmentByTeXName(String texName)

Returns the BuiltinEnvironment corresponding to LaTeX environment called texName, or null if this environment is not defined.

getDefaultDOMOptionsback to summary
public DOMOutputOptions getDefaultDOMOptions()
Annotations
@Deprecated
getDefaultDOMOutputOptionsback to summary
public DOMOutputOptions getDefaultDOMOutputOptions()

Gets the default DOMOutputOptions for this SnuggleEngine, which will not be null.

getDefaultSessionConfigurationback to summary
public SessionConfiguration getDefaultSessionConfiguration()

Gets the selected default SessionConfiguration for this SnuggleEngine, which will not be null.

getDefaultXMLStringOutputOptionsback to summary
public XMLStringOutputOptions getDefaultXMLStringOutputOptions()

Gets the default XMLStringOutputOptions for this SnuggleEngine, which will not be null.

getPackagesback to summary
public List<SnugglePackage> getPackages()

Returns a synchronized List of all SnugglePackages registered with this engine.

Since
1.3.0
getStylesheetManagerback to summary
public StylesheetManager getStylesheetManager()

Convenience method to extract the underlying StylesheetManager used by this engine. Most people won't care about this, but it might be useful if you're trying to integrate stylesheet caching.

setDefaultDOMOptionsback to summary
public void setDefaultDOMOptions(DOMOutputOptions defaultDOMOptions)
Annotations
@Deprecated
setDefaultDOMOutputOptionsback to summary
public void setDefaultDOMOutputOptions(DOMOutputOptions defaultDOMOutputOptions)

Sets the default DOMOutputOptions for this SnuggleEngine. These will be used when calling SnuggleSession#buildDOMSubtree().

Parameters
defaultDOMOutputOptions:DOMOutputOptions

new DOMOutputOptions, which must not be null.

setDefaultSessionConfigurationback to summary
public void setDefaultSessionConfiguration(SessionConfiguration defaultSessionConfiguration)

Sets the default SessionConfiguration for this SnuggleEngine. This will be used when creating a new SnuggleSession via createSession().

Parameters
defaultSessionConfiguration:SessionConfiguration

new default SessionConfiguration, which must not be null.

setDefaultXMLStringOutputOptionsback to summary
public void setDefaultXMLStringOutputOptions(XMLStringOutputOptions defaultXMLOutputOptions)

Sets the default XMLStringOutputOptions for this SnuggleEngine. These will be used when calling SnuggleSession#buildXMLString().

Parameters
defaultXMLOutputOptions:XMLStringOutputOptions

new XMLStringOutputOptions, which must not be null.