samer@0: // samer@0: // VecWriter.java samer@0: // samer@0: // samer@0: // Created by Samer Abdallah on Mon Jun 10 2002. samer@0: // Copyright (c) 2002 __MyCompanyName__. All rights reserved. samer@0: // samer@0: samer@0: package samer.units; samer@0: samer@0: import samer.core.*; samer@0: import samer.tools.*; samer@0: import samer.maths.*; samer@0: import java.io.*; samer@0: samer@0: public class VecWriter extends AnonymousTask { samer@0: Vec x; // the vector itself samer@0: PrintWriter prn; samer@0: samer@0: public VecWriter(Vec x, Writer out) throws Exception { samer@0: this.x=x; prn = new PrintWriter(out); samer@0: } samer@0: samer@0: public void dispose() { samer@0: try { prn.flush(); } catch (Exception ex) {} samer@0: // prn.close(); samer@0: } samer@0: samer@0: public void run() throws Exception { samer@0: Vec.Iterator i=x.iterator(); samer@0: prn.print(i.next()); samer@0: while (i.more()) { samer@0: prn.print(' '); samer@0: prn.print(i.next()); samer@0: } samer@0: prn.println(); samer@0: } samer@0: samer@0: public void stopping() { samer@0: try { prn.flush(); } catch (Exception ex) {} samer@0: } samer@0: }