package Current.popups.Deg100; import Current.*; import Current.basic.*; import Current.popups.Unfold.*; import java.applet.Applet; import java.awt.event.*; import java.awt.*; /**This class contains the routines in the Spine class which are relevant for the 100 Degree theorem.*/ public class Deg100Spine { /**This class contains methods which extract the defining functions from the combinatorial information calculated when we perform the combinatorial version of the unfolding.*/ public Deg100Spine() {} /**Here is a palindrome test. 1 means palindrome*/ public static int palindromeTest(CombinatorialTriangle[] T) { int N=T[0].c[0]+1; for(int i=1;i=n) qq=q-n; S=W.substring(qq,qq+1); if(S.compareTo("1")==0) m=0; if(S.compareTo("2")==0) m=1; if(S.compareTo("3")==0) m=2; return(m); } public static int lastDigit(String W) { return(getDigit(W,W.length()-1)); } public static int[] getTriple(String W,int q) { int[] m=new int[3]; int n=W.length(); for(int i=-1;i<=1;++i) { m[i+1]=getDigit(W,q+i); } return(m); } /**here j is the vertex type. w[0] tells if the vertex is a top or bottom vertex. w[1] names the vertex */ public static int[] typeToCoords(CombinatorialTriangle T,int j) { int[] w=new int[2]; int up=1; if((T.c[0]==0)&&(j==1)) up=-1; if((T.c[0]==1)&&(j==2)) up=-1; if((T.c[0]==2)&&(j==0)) up=-1; up=up*T.parity; if(up==1) w[0]=1; if(up==-1) w[0]=2; if(up==-1) w[1]=T.c[2]; if(up==+1) w[1]=T.c[1]; return(w); } public static int findType(CombinatorialTriangle T,int up,int m) { int test=-T.parity; if(up==2) test=-test; int j=T.c[0]+test; if(j>=3) j=j-3; if(j<0) j=j+3; return(j); } public static int spineNumber(VertexPair V,CombinatorialTriangle[] T) { int n1=coordsToType(T[V.e1],V.o1); int n2=coordsToType(T[V.e2],V.o2); if(n1!=n2) return(3-n1-n2); if(n1==2) return(1); return(2); } public static int coordsToType(CombinatorialTriangle T,int m0) { return((3+T.c[0]+T.parity*(2*m0-3))%3); } /**a return of -1 means that the pair is misordered 1 means that the pair is correctly ordered 2 or 3 means that the vertices are the two endpoints of an interior edge */ public static int pairOrdering(VertexPair V,CombinatorialTriangle[] CT) { int n1,n2,n3,n4; n1=CT[V.e1].c[V.o1]; n2=CT[V.e2].c[V.o2]; n3=CT[V.e1].c[3-V.o1]; n4=CT[V.e2].c[3-V.o2]; if(V.o1==V.o2) { if(n1==n2) return(0); if(n1n2) return(-1); } if((n1==n4)) return(2); if((n2==n3)) return(3); if(n3=last) {n[1]=first;n[0]=1;n[2]=convention;n[3]=spine;return(n);} //exceptional count=2; for(int i=first+1;i