// (c): Tuomas J. Lukka package gzz.view.buoy; import gzz.view.*; import gzz.vob.*; import gzz.*; /** Make the kinds of links familiar from PP structure. * There are two dimensions, the "clone" dimension and the "assoc" * dimension. A link is a connection between the "clone" * of a cell on the assoc dimension and the "clone" of another cell. * The real clone dimension may be used; however, currently, * this only links between rootclones so it * is not possible to clone the cell to another paper. */ public class PPLinker implements CellBuoyViewLinker { public static final String rcsid = "$Id: PPLinker.java,v 1.1 2003/02/04 06:22:12 tjl Exp $"; public static boolean dbg = true; private static void pa(String s) { System.err.println(s); } private Dim d_clone; private Dim d_assoc; void doLinks(Cell c, VobScene vs, int cs, BuoyViewNodeType cellNodeType, BuoyLinkListener l) { // XXX Right? Allow only main cell to link? if(c.s(d_clone, -1) != null) return; for(Cell assoc = c; assoc != null; assoc = assoc.s(d_clone)) { Cell left = assoc.s(d_assoc, -1); Cell right = assoc.s(d_assoc, 1); if(dbg) pa("PPLinker: LINKS "+c+" "+left+" "+right); if(right != null) { Cell rl = right.h(d_clone); l.link(1, cs, cellNodeType, new Pair(c, rl)); } if(left != null) { Cell ll = left.h(d_clone); l.link(-1, cs, cellNodeType, new Pair(ll, c)); } } } }