package aspectEditor.aspectEditorUtils;
import java.util.jar.JarFile;
import java.util.*;
import java.io.*;
import edu.neu.ccs.demeter.aplib.*;
import edu.neu.ccs.demeter.*;
class Glob_Commalist implements java.util.Enumeration {
  protected Nonempty_Glob_Commalist first;
  public Nonempty_Glob_Commalist get_first() { return first; }
  public void set_first(Nonempty_Glob_Commalist new_first) { first = new_first; }
  public Glob_Commalist() { super(); }
  public Glob_Commalist(Nonempty_Glob_Commalist first) {
    super();
    set_first(first);
  }
  public static Glob_Commalist parse(java.io.Reader in) throws ParseException { return new Parser(in)._Glob_Commalist(); }
  public static Glob_Commalist parse(java.io.InputStream in) throws ParseException { return new Parser(in)._Glob_Commalist(); }
  public static Glob_Commalist parse(String s) {
    try { return parse(new java.io.StringReader(s)); }
    catch (ParseException e) {
      throw new RuntimeException(e.toString());
    }
  }
  public String toString() {
    return (first == null ? "" : first.toString());
  }
  void universal_trv0_bef(UniversalVisitor _v_) {
    ((UniversalVisitor) _v_).before(this);
  }

  void universal_trv0_aft(UniversalVisitor _v_) {
    ((UniversalVisitor) _v_).after(this);
  }

  void universal_trv0(UniversalVisitor _v_) {
    universal_trv0_bef(_v_);
    ((UniversalVisitor) _v_).before_first(this, first);
    first.universal_trv0(_v_);
    ((UniversalVisitor) _v_).after_first(this, first);
    universal_trv0_aft(_v_);
  }

  void allGlobs_GlobSpec_trv_bef(GlobVisitor v) {
    ((UniversalVisitor) v).before(this);
  }

  void allGlobs_GlobSpec_trv_aft(GlobVisitor v) {
    ((UniversalVisitor) v).after(this);
  }

  void allGlobs_GlobSpec_trv(GlobVisitor v) {
    allGlobs_GlobSpec_trv_bef(v);
    ((UniversalVisitor) v).before_first(this, first);
    first.allGlobs_GlobSpec_trv(v);
    ((UniversalVisitor) v).after_first(this, first);
    allGlobs_GlobSpec_trv_aft(v);
  }

  void __trav_matchEdge_GlobSpec_trv_bef(__V_GlobSpec_matchEdge __v0) {  }

  void __trav_matchEdge_GlobSpec_trv_aft(__V_GlobSpec_matchEdge __v0) {  }

  void __trav_matchEdge_GlobSpec_trv(__V_GlobSpec_matchEdge __v0) {
    __trav_matchEdge_GlobSpec_trv_bef(__v0);
    first.__trav_matchEdge_GlobSpec_trv(__v0);
    __trav_matchEdge_GlobSpec_trv_aft(__v0);
  }

  void __trav_match_GlobSpec_trv_bef(__V_GlobSpec_match __v0) {  }

  void __trav_match_GlobSpec_trv_aft(__V_GlobSpec_match __v0) {  }

  void __trav_match_GlobSpec_trv(java.util.BitSet nodes, __V_GlobSpec_match __v0) {
    __trav_match_GlobSpec_trv_bef(__v0);
    { java.util.BitSet newnodes = new java.util.BitSet();
      newnodes.set(0);
      newnodes.and(nodes);
      if (!newnodes.equals(new java.util.BitSet())) {
        first.__trav_match_GlobSpec_trv(newnodes, __v0);
      }
    }
    __trav_match_GlobSpec_trv_aft(__v0);
  }

  void __trav_collectClassGlobs_GlobSpec_trv_bef(__V_GlobSpec_collectClassGlobs __v0) {  }

  void __trav_collectClassGlobs_GlobSpec_trv_aft(__V_GlobSpec_collectClassGlobs __v0) {  }

  void __trav_collectClassGlobs_GlobSpec_trv(__V_GlobSpec_collectClassGlobs __v0) {
    __trav_collectClassGlobs_GlobSpec_trv_bef(__v0);
    first.__trav_collectClassGlobs_GlobSpec_trv(__v0);
    __trav_collectClassGlobs_GlobSpec_trv_aft(__v0);
  }

  void __trav_collectEdgeGlobs_GlobSpec_trv_bef(__V_GlobSpec_collectEdgeGlobs __v0) {  }

  void __trav_collectEdgeGlobs_GlobSpec_trv_aft(__V_GlobSpec_collectEdgeGlobs __v0) {  }

  void __trav_collectEdgeGlobs_GlobSpec_trv(__V_GlobSpec_collectEdgeGlobs __v0) {
    __trav_collectEdgeGlobs_GlobSpec_trv_bef(__v0);
    first.__trav_collectEdgeGlobs_GlobSpec_trv(__v0);
    __trav_collectEdgeGlobs_GlobSpec_trv_aft(__v0);
  }


  private Nonempty_Glob_Commalist tail;
  public void addElement(Glob e) { 
    checktail(); 
    if (tail == null) {
      first = new Nonempty_Glob_Commalist(e,null); tail = first;
    } else {
	tail.set_next(new Nonempty_Glob_Commalist(e,null)); tail = tail.get_next();
    }
  }

  public void push(Glob e) { first = new Nonempty_Glob_Commalist(e,first); }

  public java.util.Enumeration elements() { return new Glob_Commalist(first); } 

  public int size() {
    int i= 0;
    for (java.util.Enumeration e=elements(); e.hasMoreElements(); i++)
	e.nextElement();
    return i;
  }
  public boolean isEmpty() { return (first == null); }

  public boolean hasMoreElements() { return (first != null); }

  public Object nextElement() {
    Glob car = first.get_it();
    first = first.get_next();
    return (Object) car;
  }

  private void checktail() {
    if (tail == null && first != null) {
	tail = first;
	while (tail.get_next() != null) tail = tail.get_next();
    }
  }
  public boolean contains(Glob e) {
    java.util.Enumeration en = this.elements();
    while (en.hasMoreElements())
	if (e.equals((Glob) en.nextElement())) return true;
    return false;
  }

}
