|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.activemath.presentation.preproc.PreProcessor
public class PreProcessor
This class is responsible to pre-process an OMDoc by walking through all elements
and performing Tasks on each of them.
An instance of a PreProcessor is a multi-threaded and re-usable object which runs through
its run(org.jdom.Element, java.util.Map) method.
At this point, the TaskFactory(ies) that are registred to this pre-processr are invoked
to provide Task objects that can perform the given task for one tree-traversal.
TaskFactory(ies) provided there should keep as low as possible the number of new instances
and possibly use a pool of tasks if these are expensive to build.
In general, there should be two kind of tasks: the stateless, i.e.. pure functional tasks: there should
be only one instance of these for everyone (a static member) and the task-factory should
provide always the same. The second category are stateful tasks that need to keep
data during their processing; for these tasks, the factory should either create a new one eveyr time
of, ideally, use a pool.
The tree-traversal is performed using simple JDOM calls unless OJElement are around
in which case, the method OJElement.getRealContent() exists. In this case only (currently),
the modifications of the tasks to replace an item by another will remain.
| Field Summary | |
|---|---|
static String |
CVS_ID
|
static boolean |
DEBUG
|
List |
taskList
The taskList that will be enumerated when running. |
protected static Logger |
thisLogCat
|
| Constructor Summary | |
|---|---|
PreProcessor()
builds a blank pre-processor. |
|
PreProcessor(List taskList)
builds a pre-processor with the given task list, which is a list of TaskFactory. |
|
| Method Summary | |
|---|---|
void |
addTask(TaskFactory taskFactory)
Adds the given task to the list. |
static void |
main(String[] args)
Simple test: processes the file given as arguments using makePagePreProc()
the and prints it to screen |
static PreProcessor |
makeLatexPreProc()
|
static PreProcessor |
makeNewPagePreProc(MBaseRef mbaseRef)
Makes a new page pre-processor every time. |
static PreProcessor |
makePagePreProc()
Returns a possibly cached pre-processor |
void |
run(org.jdom.Element elt,
Map properties)
Walks this element and all the kids for each task. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String CVS_ID
protected static Logger thisLogCat
public static final boolean DEBUG
public final List taskList
| Constructor Detail |
|---|
public PreProcessor()
public PreProcessor(List taskList)
TaskFactory.
| Method Detail |
|---|
public static PreProcessor makePagePreProc()
public static PreProcessor makeNewPagePreProc(MBaseRef mbaseRef)
public static PreProcessor makeLatexPreProc()
public void addTask(TaskFactory taskFactory)
public void run(org.jdom.Element elt,
Map properties)
TODO: find an optimization to make only one walk.
public static void main(String[] args)
throws Exception
makePagePreProc()
the and prints it to screen
Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||