
/**
 * Class containing method to save the history of a set of frequency filters
 *
 * @author Bob Fisher
 */
public class MaskHistoryItem {
        int type;
        int arg1,arg2,arg3,arg4;

        public MaskHistoryItem() { }
        
        public MaskHistoryItem(int t, int a1, int a2, int a3, int a4) {
                type=t; arg1 = a1; arg2 = a2; arg3 = a3; arg4 = a4; }
        
        public String saveMaskHistoryItem() {
                String saveData = new String();
                savedata = " "+type+" "+" "+arg1+" "+arg2+" "+arg3+" "+arg4+" ";
        }

        public void loadMaskHistoryItem() {
          //Grab the parameters
          int tokenType;
          tokenType = tokenizer.nextToken();
          int type = (int) tokenizer.nval;
          tokenType = tokenizer.nextToken();
          int arg1 = (int) tokenizer.nval;
          tokenType = tokenizer.nextToken();
          int arg2 = (int) tokenizer.nval;
          tokenType = tokenizer.nextToken();
          int arg3 = (int) tokenizer.nval;
          tokenType = tokenizer.nextToken();
          int arg4 = (int) tokenizer.nval;
        }
}        


public class MaskHistory {

  // number of mask components added
  int historylength;
  MaskHistoryItem [] history;
  
  public MaskHistory() { historylength = 0; }
  public void clearHistory() { historylength = 0; }
  public String saveHistory() {
        String saveData = new String();
        for (int i=0; i<historylength; i++) {
            saveData = saveData + history[i].saveMaskHistoryItem();
        }
  }
  public void loadHistory() {
        int tokenType;
        tokenType = tokenizer.nextToken();
        int historylength= (int) tokenizer.nval;
        for (int i=0; i<historylength; i++) {
                history[i] = new MaskHistoryItem();
                history[i].loadMaskHistoryItem();
        }
  }
}
