package logicrepository.plugins.srs;

import java.util.ArrayList;

public class Sequence extends ArrayList<Symbol> implements AbstractSequence {

  public Sequence(int size){
    super(size);
  }

  public Sequence(){
    super();
  }

  public Sequence(ArrayList<Symbol> symbols){
    for(Symbol s : symbols){
      if(s == null) continue;
      add(s);
    }
  }

  public String toString(){
    if(size() == 0) return "#epsilon";
    StringBuilder sb = new StringBuilder();
    for(Symbol s : this){
      sb.append(s.toString());
      sb.append(" ");
    }
    return sb.toString();
  }

  public String toDotString(){
    if(size() == 0) return "\\#epsilon";
    StringBuilder sb = new StringBuilder();
    for(Symbol s : this){
      sb.append(s.toDotString());
      sb.append("\\ ");
    }
    return sb.toString();
  }

  public Sequence copy(){
    Sequence ret = new Sequence(size());
    for(Symbol s : this){
      ret.add(s);
    }
    return ret;
  }

  public static void printSequenceArray(Sequence[] arr){
    for(Sequence s : arr){
      System.out.print(s);
      System.out.print("; ");
    }
    System.out.println();
  }

  @Override
  public int dotLength(){
    if(isEmpty()) return 8;
    int len = 0;
    for(Symbol s: this){
      len += s.length();
    }
    return len;
  }
}

@@ -788,38 +788,44 @@
 %5C %22);%0A    %7D%0A    
-return
+String ret =
  sb.toString();%0A
@@ -816,32 +816,78 @@
  sb.toString();%0A
+    return ret.substring(0,ret.length() - 2);%0A
   %7D%0A%0A  public Se

dot output