X4O: Removed iterator for tree walker and bettered tag folding code
This commit is contained in:
parent
045f6d07f6
commit
9638d876b5
6 changed files with 27 additions and 16 deletions
|
|
@ -73,6 +73,13 @@ public abstract class AbstractX4OPhase implements X4OPhase {
|
|||
public void runPhase(X4OLanguageSession languageSession) throws X4OPhaseException {
|
||||
}
|
||||
|
||||
/**
|
||||
* If the session has an debug writer than ouput an phase message for debugging to the writer.
|
||||
*
|
||||
* @param languageSession The language session to run phase for.
|
||||
* @param message The message to write the the debug output.
|
||||
* @throws X4OPhaseException when debug writer has error.
|
||||
*/
|
||||
public void debugPhaseMessage(X4OLanguageSession languageSession, String message) throws X4OPhaseException {
|
||||
if (!languageSession.hasX4ODebugWriter()) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ import org.x4o.xml.lang.X4OLanguageSession;
|
|||
import org.x4o.xml.lang.X4OLanguageSessionLocal;
|
||||
|
||||
/**
|
||||
* X4OPhaseManager stores the X4OPhaseHandler and puts them in the right order. And will execute the phases when runPhases is called.
|
||||
* DefaultX4OPhaseManager stores the X4O phases and runs them in the right order.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Jan 6, 2008
|
||||
|
|
@ -263,14 +263,11 @@ PHASE_ORDER = { *startupX4OPhase,
|
|||
}
|
||||
|
||||
class X4OPhaseComparator implements Comparator<X4OPhase> {
|
||||
/**
|
||||
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
public int compare(X4OPhase e1, X4OPhase e2) {
|
||||
|
||||
@Override
|
||||
public int compare(X4OPhase e1, X4OPhase e2) {
|
||||
String pid = e1.getId();
|
||||
String[] dpids = e2.getPhaseDependencies();
|
||||
|
||||
for (int i = 0; i < dpids.length; i++) {
|
||||
String dpid = dpids[i];
|
||||
if (pid.equals(dpid)) {
|
||||
|
|
@ -305,7 +302,10 @@ PHASE_ORDER = { *startupX4OPhase,
|
|||
if (element.getElementClass() != null && element.getElementClass().getSkipPhases().contains(phase.getId()) == false) {
|
||||
phase.runElementPhase(element);
|
||||
}
|
||||
for (Element e : element.getChilderen()) {
|
||||
List<Element> elementChilderen = element.getChilderen();
|
||||
int elementChilderenSize = elementChilderen.size();
|
||||
for (int i = 0; i < elementChilderenSize; i++) {
|
||||
Element e = elementChilderen.get(i);
|
||||
executePhaseTree(e, phase);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ package org.x4o.xml.lang.phase;
|
|||
import org.x4o.xml.lang.X4OLanguageSession;
|
||||
|
||||
/**
|
||||
* An X4OPhaseListener can be placed on an X4OPhaseHandler and is called before and after the phase has runned.
|
||||
* An X4OPhaseListener is fired before and after the phase has been executed.
|
||||
*
|
||||
* @author Willem Cazander
|
||||
* @version 1.0 Dec 31, 2008
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue