13 |
* The real clone dimension may be used; however, currently, |
* The real clone dimension may be used; however, currently, |
14 |
* this only links between rootclones so it |
* this only links between rootclones so it |
15 |
* is not possible to clone the cell to another paper. |
* is not possible to clone the cell to another paper. |
16 |
|
* |
17 |
|
* mudyc> What's this for? PP has never in my time done links like this. |
18 |
|
* I fix this.. |
19 |
*/ |
*/ |
20 |
public class PPLinker implements CellBuoyViewLinker { |
public class PPLinker implements CellBuoyViewLinker { |
21 |
public static final String rcsid = "$Id$"; |
public static final String rcsid = "$Id$"; |
22 |
public static boolean dbg = true; |
public static boolean dbg = true; |
23 |
private static void pa(String s) { System.err.println(s); } |
private static void pa(String s) { System.out.println("PPLinker:"+s); } |
24 |
|
|
25 |
private Dim d_clone; |
private Dim d_clone; |
26 |
private Dim d_assoc; |
private Dim d_assoc; |
27 |
public PPLinker(Dim d_clone, Dim d_assoc) { |
private Dim d_contains; |
28 |
|
public PPLinker(Dim d_clone, Dim d_assoc, Dim d_contains) { |
29 |
this.d_clone = d_clone; |
this.d_clone = d_clone; |
30 |
this.d_assoc = d_assoc; |
this.d_assoc = d_assoc; |
31 |
|
this.d_contains = d_contains; |
32 |
} |
} |
33 |
|
|
34 |
public void doLinks(Cell c, VobScene vs, int cs, |
public void doLinks(Cell c, VobScene vs, int cs, |
35 |
BuoyViewNodeType cellNodeType, |
BuoyViewNodeType cellNodeType, |
36 |
BuoyLinkListener l) { |
BuoyLinkListener l) { |
37 |
|
|
38 |
// XXX Right? Allow only main cell to link? |
// XXX Right? Allow only main cell to link? |
39 |
if(c.s(d_clone, -1) != null) return; |
// no, absolutely wrong. d.contains can link and the paper,root, can not. |
40 |
|
// <sigh> if(c.s(d_clone, -1) != null) return; |
41 |
|
|
42 |
for(Cell assoc = c; assoc != null; assoc = assoc.s(d_clone)) { |
Cell note = c.h(d_contains).s(d_contains); |
43 |
Cell left = assoc.s(d_assoc, -1); |
for (; note != null; note = note.s(d_contains)) { |
44 |
Cell right = assoc.s(d_assoc, 1); |
for(Cell assoc = note; assoc != null; assoc = assoc.s(d_clone)) { |
45 |
if(dbg) pa("PPLinker: LINKS "+c+" "+left+" "+right); |
Cell left = assoc.s(d_assoc, -1); |
46 |
if(right != null) { |
Cell right = assoc.s(d_assoc, 1); |
47 |
Cell rl = right.h(d_clone); |
if(dbg) pa("LINKS "+c+" "+left+" "+right); |
48 |
l.link(1, cs, cellNodeType, new Pair(c, rl), rl); |
if(right != null) { |
49 |
} |
Cell rl = right.h(d_clone); |
50 |
if(left != null) { |
l.link(1, cs, cellNodeType, new Pair(c, rl), rl); |
51 |
Cell ll = left.h(d_clone); |
} |
52 |
l.link(-1, cs, cellNodeType, new Pair(ll, c), ll); |
if(left != null) { |
53 |
|
Cell ll = left.h(d_clone); |
54 |
|
l.link(-1, cs, cellNodeType, new Pair(ll, c), ll); |
55 |
|
} |
56 |
} |
} |
57 |
} |
} |
58 |
} |
} |