package Current.basic; import Current.*; import java.applet.Applet; import java.awt.event.*; import java.awt.*; /**This class converts between various ways of encoding information about the some of the geometric objects.*/ public class Converter { public Converter() {} /**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); } }