public bool apply(reactor rec,int pa){ particle a = rec.get_particle_id(pa); type_state old_a = a.st; type_state new_a = end; if (old_a != new_a) rec.update_new_state (a, old_a, new_a); if (unlink) rec.all_unlink (a.id); return true; }
public bool apply(reactor rec,pair_part ret){ particle a = rec.get_particle_id(ret.id1); particle b = rec.get_particle_id(ret.id2); type_state old_a = a.st; type_state old_b = b.st; switch (function) { case 0: default: return false; case 1: //link rec.link (a, b); break; case 2: // split rec.unlink (a, b); break; case 3: // add type_state new_a = new type_state(a.st.type,a.st.state+1); type_state new_b = new type_state(b.st.type,b.st.state+1); rec.update_new_state (a, old_a,new_a); rec.update_new_state (b, old_b,new_b); break; case 4: // swap rec.update_new_state (a, old_a,old_b); rec.update_new_state (b, old_b,old_a); break; } return true; }
public bool apply(reactor rec,pair_part ret){ particle a = rec.get_particle_id(ret.id1); particle b = rec.get_particle_id(ret.id2); type_state old_a = a.st; type_state old_b = b.st; // Console.WriteLine ("A:" + (old_a.state == r.reactants.b.state)); pair_st st = products; type_state new_a = st.a; type_state new_b = st.b; if (old_a != new_a) rec.update_new_state (a, old_a, new_a); if (old_b!=new_b) rec.update_new_state (b , old_b, new_b); if (productContact) rec.link (a, b); else { a.unlink (b); rec.unlink (a, b); } return true; }