package EDU.neu.ccs.demeter.tools.apstudio.graphedit;
import java.awt.*;
import java.io.*;
import java.util.*;
import EDU.neu.ccs.demeter.*;
import EDU.neu.ccs.demeter.common.tg.*;


import EDU.neu.ccs.demeter.*;
class SGEdge {
  protected ClassGlobSpec source;
  public ClassGlobSpec get_source() { return source; }
  public void set_source(ClassGlobSpec new_source)
    { source = new_source; }
  protected ClassGlobSpec dest;
  public ClassGlobSpec get_dest() { return dest; }
  public void set_dest(ClassGlobSpec new_dest)
    { dest = new_dest; }
  protected NegativeConstraint constraint;
  public NegativeConstraint get_constraint() { return constraint; }
  public void set_constraint(NegativeConstraint new_constraint)
    { constraint = new_constraint; }
  SGEdge() { super(); }
  public SGEdge(ClassGlobSpec source, ClassGlobSpec dest, NegativeConstraint constraint) {
    super();
    set_source(source);
    set_dest(dest);
    set_constraint(constraint);
  }
  public static SGEdge parse(java.io.InputStream in) throws ParseException
    { return new Parser(in)._SGEdge(); }
  public static SGEdge parse(String s) {
    try { return parse(new java.io.ByteArrayInputStream(s.getBytes())); }
    catch (ParseException e) { throw new RuntimeException(e.toString()); }
  }

		public VecVisitor go_get_source()
		{
			VecVisitor vv = new VecVisitor(new Vector());
			collectSource(vv);
			return vv;
		}
	
		public VecVisitor go_get_destination()
		{
			VecVisitor vv = new VecVisitor(new Vector());
			collectDest(vv);
			return vv;
		}
	
		public VecVisitor go_get_bypassV()
		{
			VecVisitor vv = new VecVisitor(new Vector());
			collectBypassVs(vv);
			return vv;
		}
	
		public VecVisitor go_get_onlythruV()
		{
			VecVisitor vv = new VecVisitor(new Vector());
			collectOnlyThruVs(vv);
			return vv;
		}
	
		public VecVisitor go_get_part_globs()
		{
			VecVisitor vv = new VecVisitor(new Vector());
			collectPartGlob(vv);
			return vv;
		}
	
		public VecVisitor go_get_subclass_globs()
		{
			VecVisitor vv = new VecVisitor(new Vector());
			collectSubclassGlob(vv);
			return vv;
		}
	  boolean checkConstraint(TGEdge edge) {
    __V_SGEdge_checkConstraint v0 = new __V_SGEdge_checkConstraint();
    v0.set_edge(edge);
    v0.start();
    __trav_checkConstraint(v0);
    v0.finish();
    return v0.get_return_val();
  }
  void universal_trv0_bef(UniversalVisitor _v_) {
    _v_.before(this);
  }
  void universal_trv0_aft(UniversalVisitor _v_) {
    _v_.after(this);
  }
  void universal_trv0(UniversalVisitor _v_) {
    universal_trv0_bef(_v_);
    _v_.before_source(this, source);
    source.universal_trv0(_v_);
    _v_.after_source(this, source);
    _v_.before_dest(this, dest);
    dest.universal_trv0(_v_);
    _v_.after_dest(this, dest);
    if (constraint != null) {
      _v_.before_constraint(this, constraint);
    constraint.universal_trv0(_v_);
      _v_.after_constraint(this, constraint);
    }
    universal_trv0_aft(_v_);
  }
  void toAllSubclasses_Program_trv_bef(ClassNameTranspVisitor cntv, EdgeVisitor aev) {  }
  void toAllSubclasses_Program_trv_aft(ClassNameTranspVisitor cntv, EdgeVisitor aev) {  }
  void toAllSubclasses_Program_trv(ClassNameTranspVisitor cntv, EdgeVisitor aev) {
    toAllSubclasses_Program_trv_bef(cntv, aev);
    source.toAllSubclasses_Program_trv(cntv, aev);
    dest.toAllSubclasses_Program_trv(cntv, aev);
    if (constraint != null) {
    constraint.toAllSubclasses_Program_trv(cntv, aev);
    }
    toAllSubclasses_Program_trv_aft(cntv, aev);
  }
  void checkStars_ProgramBehavior_trv_bef(DummyVisitor dv) {  }
  void checkStars_ProgramBehavior_trv_aft(DummyVisitor dv) {  }
  void checkStars_ProgramBehavior_trv(DummyVisitor dv) {
    checkStars_ProgramBehavior_trv_bef(dv);
    source.checkStars_ProgramBehavior_trv(dv);
    dest.checkStars_ProgramBehavior_trv(dv);
    if (constraint != null) {
    constraint.checkStars_ProgramBehavior_trv(dv);
    }
    checkStars_ProgramBehavior_trv_aft(dv);
  }
  void allSources_StrategyGraph_trv_bef(GlobVisitor __v0) {  }
  void allSources_StrategyGraph_trv_aft(GlobVisitor __v0) {  }
  void allSources_StrategyGraph_trv(GlobVisitor __v0) {
    allSources_StrategyGraph_trv_bef(__v0);
    source.allSources_StrategyGraph_trv(__v0);
    allSources_StrategyGraph_trv_aft(__v0);
  }
  void allDests_StrategyGraph_trv_bef(GlobVisitor __v0) {  }
  void allDests_StrategyGraph_trv_aft(GlobVisitor __v0) {  }
  void allDests_StrategyGraph_trv(GlobVisitor __v0) {
    allDests_StrategyGraph_trv_bef(__v0);
    dest.allDests_StrategyGraph_trv(__v0);
    allDests_StrategyGraph_trv_aft(__v0);
  }
  void __trav_getFirst_StrategyGraph_trv_bef(__V_StrategyGraph_getFirst __v0) {  }
  void __trav_getFirst_StrategyGraph_trv_aft(__V_StrategyGraph_getFirst __v0) {  }
  void __trav_getFirst_StrategyGraph_trv(java.util.BitSet nodes, __V_StrategyGraph_getFirst __v0) {
    if (nodes.get(0)) nodes.set(1);
    __trav_getFirst_StrategyGraph_trv_bef(__v0);
    { java.util.BitSet newnodes = new java.util.BitSet();
      newnodes.set(1);
      newnodes.and(nodes);
      if (!newnodes.equals(new java.util.BitSet()))
        source.__trav_getFirst_StrategyGraph_trv(newnodes, __v0); }
    { java.util.BitSet newnodes = new java.util.BitSet();
      newnodes.set(1);
      newnodes.and(nodes);
      if (!newnodes.equals(new java.util.BitSet()))
        dest.__trav_getFirst_StrategyGraph_trv(newnodes, __v0); }
    if (constraint != null) {
    { java.util.BitSet newnodes = new java.util.BitSet();
      newnodes.set(1);
      newnodes.and(nodes);
      if (!newnodes.equals(new java.util.BitSet()))
        constraint.__trav_getFirst_StrategyGraph_trv(newnodes, __v0); }
    }
    __trav_getFirst_StrategyGraph_trv_aft(__v0);
  }
  public void collectSource(VecVisitor vv) {
    collectSource_SGEdge_trv(vv);
  }
  void collectSource_SGEdge_trv_bef(VecVisitor vv) {  }
  void collectSource_SGEdge_trv_aft(VecVisitor vv) {  }
  void collectSource_SGEdge_trv(VecVisitor vv) {
    collectSource_SGEdge_trv_bef(vv);
    source.collectSource_SGEdge_trv(vv);
    collectSource_SGEdge_trv_aft(vv);
  }
  public void collectDest(VecVisitor vv) {
    collectDest_SGEdge_trv(vv);
  }
  void collectDest_SGEdge_trv_bef(VecVisitor vv) {  }
  void collectDest_SGEdge_trv_aft(VecVisitor vv) {  }
  void collectDest_SGEdge_trv(VecVisitor vv) {
    collectDest_SGEdge_trv_bef(vv);
    dest.collectDest_SGEdge_trv(vv);
    collectDest_SGEdge_trv_aft(vv);
  }
  public void collectBypassVs(VecVisitor vv) {
    collectBypassVs_SGEdge_trv(vv);
  }
  void collectBypassVs_SGEdge_trv_bef(VecVisitor vv) {  }
  void collectBypassVs_SGEdge_trv_aft(VecVisitor vv) {  }
  void collectBypassVs_SGEdge_trv(VecVisitor vv) {
    collectBypassVs_SGEdge_trv_bef(vv);
    if (constraint != null) {
    constraint.collectBypassVs_SGEdge_trv(vv);
    }
    collectBypassVs_SGEdge_trv_aft(vv);
  }
  public void collectOnlyThruVs(VecVisitor vv) {
    collectOnlyThruVs_SGEdge_trv(vv);
  }
  void collectOnlyThruVs_SGEdge_trv_bef(VecVisitor vv) {  }
  void collectOnlyThruVs_SGEdge_trv_aft(VecVisitor vv) {  }
  void collectOnlyThruVs_SGEdge_trv(VecVisitor vv) {
    collectOnlyThruVs_SGEdge_trv_bef(vv);
    if (constraint != null) {
    constraint.collectOnlyThruVs_SGEdge_trv(vv);
    }
    collectOnlyThruVs_SGEdge_trv_aft(vv);
  }
  public void collectPartGlob(VecVisitor vv) {
    collectPartGlob_SGEdge_trv(vv);
  }
  void collectPartGlob_SGEdge_trv_bef(VecVisitor vv) {  }
  void collectPartGlob_SGEdge_trv_aft(VecVisitor vv) {  }
  void collectPartGlob_SGEdge_trv(VecVisitor vv) {
    collectPartGlob_SGEdge_trv_bef(vv);
    if (constraint != null) {
    constraint.collectPartGlob_SGEdge_trv(vv);
    }
    collectPartGlob_SGEdge_trv_aft(vv);
  }
  public void collectSubclassGlob(VecVisitor vv) {
    collectSubclassGlob_SGEdge_trv(vv);
  }
  void collectSubclassGlob_SGEdge_trv_bef(VecVisitor vv) {  }
  void collectSubclassGlob_SGEdge_trv_aft(VecVisitor vv) {  }
  void collectSubclassGlob_SGEdge_trv(VecVisitor vv) {
    collectSubclassGlob_SGEdge_trv_bef(vv);
    if (constraint != null) {
    constraint.collectSubclassGlob_SGEdge_trv(vv);
    }
    collectSubclassGlob_SGEdge_trv_aft(vv);
  }
  public void __trav_checkConstraint(__V_SGEdge_checkConstraint __v0) {
    __trav_checkConstraint_SGEdge_trv(__v0);
  }
  void __trav_checkConstraint_SGEdge_trv_bef(__V_SGEdge_checkConstraint __v0) {  }
  void __trav_checkConstraint_SGEdge_trv_aft(__V_SGEdge_checkConstraint __v0) {  }
  void __trav_checkConstraint_SGEdge_trv(__V_SGEdge_checkConstraint __v0) {
    __trav_checkConstraint_SGEdge_trv_bef(__v0);
    if (constraint != null) {
    constraint.__trav_checkConstraint_SGEdge_trv(__v0);
    }
    __trav_checkConstraint_SGEdge_trv_aft(__v0);
  }
}

