/* * UnfoldingData.java * * Created on May 24, 2006, 2:01 PM */ /** * * @author pat */ package Current.popups.Unfold; import Current.*; import Current.basic.*; import Current.manage.*; public class UnfoldingData { public interface UnfoldingDataWatcher { public void updatedUnfoldingData(); } private Manager M; public String word; public ListenTriangle[] T; public int[] Top,Bot; //vertex labels to the left and right of an edge public double top,bot; // y corrdinates of end points of strips public boolean good=false; public Complex Z; private UnfoldingDataWatcher watcher; public UnfoldingData(Manager M) { this.M=M; word=M.getWord(); Z=M.getZ(); update(); M.addListener(this); M.addListener(this); } public void setWatcher(UnfoldingDataWatcher w) { watcher=w; } public void update() { //// UNFOLDING T=new ListenTriangle[word.length()]; T[0]=ListenTriangle.init(Z); T[0].reflectMe(word.charAt(0)-'1'); for (int i=1;ibot) bot=T[i].z[Bot[i]].y; } good=(top>bot); if (watcher!=null) { watcher.updatedUnfoldingData(); } // Debugging // System.out.println("Top is: "+top); // System.out.println("Bot is: "+bot); // if (top>bot) { // System.out.println("Good"); // } else { // System.out.println("Bad"); // } } public void mcbReceive(Parameter p) { Z=p.getZ(); update(); } public String getTitle() { return "UnfoldingData"; } public void readSettings() { } public void mcbReceive(Tile t) { word=t.getStringWord(); update(); } public void mcbCleanup() { M.remove(this); } }