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);
if ~res then knot.NoCompo0; end;
return res;
end;
Torus2BraidStr(p,q:INT, out str:STR):BOOL is
if q<0 then p:=-p; q:=-q; end;
if q=0 then return false; elsif q=1 then str:="1: endcode"; return true; end;
s:STR:=q.str+" :"; loop s:=s+" "+(1.upto!(q-1)).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::=str.search("endcode"); if i=-1 then return false; end;
sc:STR_CURSOR:=#(str.left(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;