Commit dc5c648d authored by Fabien Triolet's avatar Fabien Triolet
Browse files

Changed Thread handling and corrected print of parameters in ruleset stylesheet

parent 3372c331
/** /**
* $Id: TMerger.java,v 1.1 2002-11-06 14:08:21 serge Exp $ * $Id: TMerger.java,v 1.2 2002-11-26 16:34:57 triolet Exp $
* *
* Transmorpher * Transmorpher
* *
...@@ -69,6 +69,7 @@ public abstract class TMerger extends TProcessBasic { ...@@ -69,6 +69,7 @@ public abstract class TMerger extends TProcessBasic {
} }
// The first current handler is the first one // The first current handler is the first one
handlerList[iCurrentHandler].setCurrent(true); handlerList[iCurrentHandler].setCurrent(true);
setFinished(false);
} }
/** /**
...@@ -127,7 +128,9 @@ public abstract class TMerger extends TProcessBasic { ...@@ -127,7 +128,9 @@ public abstract class TMerger extends TProcessBasic {
handlerList[iCurrentHandler++].setCurrent(false); handlerList[iCurrentHandler++].setCurrent(false);
handlerList[iCurrentHandler].flushBuffer(); handlerList[iCurrentHandler].flushBuffer();
handlerList[iCurrentHandler].setCurrent(true); handlerList[iCurrentHandler].setCurrent(true);
}//end while }
setFinished(true);
//end while
/* /*
*handlerList[iCurrentHandler++].setCurrent(false); *handlerList[iCurrentHandler++].setCurrent(false);
*if (iCurrentHandler < iNbIn) { *if (iCurrentHandler < iNbIn) {
......
/** /**
* $Id: TProcessBasic.java,v 1.2 2002-11-13 15:43:41 triolet Exp $ * $Id: TProcessBasic.java,v 1.3 2002-11-26 16:34:57 triolet Exp $
* *
* Transmorpher * Transmorpher
* *
...@@ -47,8 +47,11 @@ public abstract class TProcessBasic extends TProcess_Impl implements Runnable{ ...@@ -47,8 +47,11 @@ public abstract class TProcessBasic extends TProcess_Impl implements Runnable{
protected Thread procThread = null ; protected Thread procThread = null ;
protected boolean isThread = false ; protected boolean isThread = false ;
protected boolean finished = true ;
/** /**
* Description of the Field * Description of the Field
*/ */
...@@ -93,13 +96,28 @@ public abstract class TProcessBasic extends TProcess_Impl implements Runnable{ ...@@ -93,13 +96,28 @@ public abstract class TProcessBasic extends TProcess_Impl implements Runnable{
} }
} }
} }
public boolean getFinished(){
return finished;
}
public void run(){ public void run(){
try{
System.out.flush();
while(!(getFinished())){
Thread.sleep(10);
}
}
catch (Exception e){}
}
public void setFinished(boolean finished){
this.finished=finished;
} }
public void setThread(boolean useThread) { public void setThread(boolean useThread) {
isThread = useThread; isThread = useThread;
if (procThread == null) { if ((procThread == null)&&isThread) {
procThread = new Thread(this); procThread = new Thread(this);
} }
} }
......
/** /**
* $Id: Ruleset.java,v 1.2 2002-11-07 08:13:26 triolet Exp $ * $Id: Ruleset.java,v 1.3 2002-11-26 16:34:57 triolet Exp $
* *
* Transmorpher * Transmorpher
* *
...@@ -111,7 +111,7 @@ public class Ruleset extends TransformationImpl implements Namespaced { ...@@ -111,7 +111,7 @@ public class Ruleset extends TransformationImpl implements Namespaced {
file.writeln(" ************************************************************ -->"); file.writeln(" ************************************************************ -->");
for( Enumeration e = parameters.getNames() ; e.hasMoreElements(); ){ for( Enumeration e = parameters.getNames() ; e.hasMoreElements(); ){
String key = (String)e.nextElement(); String key = (String)e.nextElement();
file.writeln(2,"<xsl:param "+key+">"+parameters.getParameter(key)+"</xsl:param>"); file.writeln(2,"<xsl:param name=\""+key+"\">"+parameters.getParameter(key)+"</xsl:param>");
} }
file.writeln(""); file.writeln("");
file.writeln(" <!-- Copying the root and its attributes -->"); file.writeln(" <!-- Copying the root and its attributes -->");
......
/** /**
* $Id: Broadcast.java,v 1.2 2002-11-25 16:09:11 triolet Exp $ * $Id: Broadcast.java,v 1.3 2002-11-26 16:34:57 triolet Exp $
* *
* Transmorpher * Transmorpher
* *
...@@ -52,6 +52,7 @@ public final class Broadcast extends TDispatcher { ...@@ -52,6 +52,7 @@ public final class Broadcast extends TDispatcher {
/** the constructor */ /** the constructor */
public Broadcast(String[] pIn, String[] pOut,Parameters pParam){ public Broadcast(String[] pIn, String[] pOut,Parameters pParam){
super(pIn,pOut,pParam); super(pIn,pOut,pParam);
finished=false;
} }
/** the start element method of content handler interface */ /** the start element method of content handler interface */
...@@ -84,6 +85,8 @@ public final class Broadcast extends TDispatcher { ...@@ -84,6 +85,8 @@ public final class Broadcast extends TDispatcher {
/** the endDocument method of content handler interface */ /** the endDocument method of content handler interface */
public final void endDocument() throws SAXException { public final void endDocument() throws SAXException {
setFinished(true);
for (int i=0; i<iNbOut; i++) { for (int i=0; i<iNbOut; i++) {
contentHandlers[i].endDocument(); contentHandlers[i].endDocument();
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment