home *** CD-ROM | disk | FTP | other *** search
/ Datatid 1999 #6 / Datatid_1999-06.iso / internet / Tango352Promo / Tango / data.z / Action.class (.txt) < prev    next >
Encoding:
Java Class File  |  1999-02-03  |  1.5 KB  |  69 lines

  1. package com.everyware.tango.jas;
  2.  
  3. import java.util.Vector;
  4.  
  5. public abstract class Action {
  6.    private static final int UNSET_VALUE = Integer.MIN_VALUE;
  7.    private Vector result = new Vector();
  8.    private String[] row;
  9.    private int numRows = Integer.MIN_VALUE;
  10.    private int numColumns = Integer.MIN_VALUE;
  11.    private int currentRow;
  12.    private int currentColumn;
  13.  
  14.    protected void setNumColumns(int var1) {
  15.       if (var1 > 0) {
  16.          this.numColumns = var1;
  17.       }
  18.  
  19.    }
  20.  
  21.    private void dumpRow() {
  22.       if (this.numColumns != Integer.MIN_VALUE) {
  23.          if (this.row == null) {
  24.             this.currentRow = 0;
  25.          } else {
  26.             while(this.currentColumn <= this.numColumns) {
  27.                this.newColumn("");
  28.             }
  29.  
  30.          }
  31.       }
  32.    }
  33.  
  34.    protected void newRow() {
  35.       this.dumpRow();
  36.       ++this.currentRow;
  37.       this.row = new String[this.numColumns];
  38.       this.result.addElement(this.row);
  39.       this.currentColumn = 1;
  40.    }
  41.  
  42.    protected void newColumn(String var1) {
  43.       if (this.currentColumn <= this.numColumns) {
  44.          this.row[this.currentColumn - 1] = new String(var1);
  45.          ++this.currentColumn;
  46.       }
  47.    }
  48.  
  49.    public final String[] process(String[] var1) {
  50.       this.customProcessing(var1);
  51.       this.dumpRow();
  52.       String[] var2 = new String[2 + this.result.size() * this.numColumns];
  53.       var2[0] = String.valueOf(this.result.size());
  54.       var2[1] = String.valueOf(this.numColumns);
  55.  
  56.       for(int var3 = 0; var3 < this.result.size(); ++var3) {
  57.          this.row = (String[])this.result.elementAt(var3);
  58.  
  59.          for(int var4 = 0; var4 < this.numColumns; ++var4) {
  60.             var2[2 + var3 * this.numColumns + var4] = this.row[var4];
  61.          }
  62.       }
  63.  
  64.       return var2;
  65.    }
  66.  
  67.    public abstract void customProcessing(String[] var1);
  68. }
  69.