toruslink.sa
Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
class TORUS_CNV
class TORUS_CNV is
Torus2Knot(str:STR,inout knot:KNOT):BOOL is
-- format: "p q endcode" for torus link T(p,q).
res:BOOL:=Torus2BraidStr(inout str) and BRAID_CNV::BraidWord2Knot(str, inout knot,true,true);
if ~res then knot.NoCompo0; end;
return res;
end;
Torus2BraidStr(p,q:INT, out str:STR):BOOL is
if q.is_neg then p:=-p; q:=-q; end;
if q.is_zero then return false; elsif q=1.int then str:="1: endcode"; return true; end;
s:STR:=q.str+" :"; loop s:=s+" "+(1.int.upto!(q-1.int)).str; end; s:=s+" endcode";
str:=(#BRAID(s)^p).str;
return true;
end;
Torus2BraidStr(inout str:STR):BOOL is
-- format: "p q endcode". p,q for torus link T(p,q)
i:CARD:=str.search("endcode"); if i=CARD::maxval then return false; end;
sc:STR_CURSOR:=#(str.substring(0,i)); if sc.is_done then return false; end;
p:INT:=#(STRINGSK::splitStr(inout sc)); if sc.is_done then return false; end;
q:INT:=#(STRINGSK::splitStr(inout sc));
return Torus2BraidStr(p,q,out str);
end;
end;