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. |
|
* |
|
|
* mudyc> What's this for? PP has never in my time done links like this. |
|
|
* I fix this.. |
|
16 |
*/ |
*/ |
17 |
public class PPLinker implements CellBuoyViewLinker { |
public class PPLinker implements CellBuoyViewLinker { |
18 |
public static final String rcsid = "$Id$"; |
public static final String rcsid = "$Id$"; |
19 |
public static boolean dbg = true; |
public static boolean dbg = false; |
20 |
private static void pa(String s) { System.out.println("PPLinker:"+s); } |
private static void pa(String s) { System.out.println("PPLinker:"+s); } |
21 |
|
|
22 |
private Dim d_clone; |
private Dim d_clone; |
23 |
private Dim d_assoc; |
private Dim d_assoc; |
24 |
private Dim d_contains; |
public PPLinker(Dim d_clone, Dim d_assoc) { |
|
public PPLinker(Dim d_clone, Dim d_assoc, Dim d_contains) { |
|
25 |
this.d_clone = d_clone; |
this.d_clone = d_clone; |
26 |
this.d_assoc = d_assoc; |
this.d_assoc = d_assoc; |
|
this.d_contains = d_contains; |
|
27 |
} |
} |
28 |
|
|
29 |
public void doLinks(Cell c, VobScene vs, int cs, |
public void doLinks(Cell c, VobScene vs, int cs, |
31 |
BuoyLinkListener l) { |
BuoyLinkListener l) { |
32 |
|
|
33 |
// XXX Right? Allow only main cell to link? |
// XXX Right? Allow only main cell to link? |
34 |
// no, absolutely wrong. d.contains can link and the paper,root, can not. |
// ahem? why? |
35 |
// <sigh> if(c.s(d_clone, -1) != null) return; |
//if(c.s(d_clone, -1) != null) return; |
36 |
|
|
37 |
Cell note = c.h(d_contains).s(d_contains); |
Cell note = c.h(d_clone).s(d_clone); |
38 |
for (; note != null; note = note.s(d_contains)) { |
for(Cell assoc = note; assoc != null; assoc = assoc.s(d_clone)) { |
39 |
for(Cell assoc = note; assoc != null; assoc = assoc.s(d_clone)) { |
Cell left = assoc.s(d_assoc, -1); |
40 |
Cell left = assoc.s(d_assoc, -1); |
Cell right = assoc.s(d_assoc, 1); |
41 |
Cell right = assoc.s(d_assoc, 1); |
if(dbg) pa("LINKS "+c+" "+left+" "+right); |
42 |
if(dbg) pa("LINKS "+c+" "+left+" "+right); |
if(right != null) { |
43 |
if(right != null) { |
Cell rl = right.h(d_clone); |
44 |
Cell rl = right.h(d_clone); |
l.link(1, cs, cellNodeType, new Pair(c, rl), rl); |
45 |
l.link(1, cs, cellNodeType, new Pair(c, rl), rl); |
} |
46 |
} |
if(left != null) { |
47 |
if(left != null) { |
Cell ll = left.h(d_clone); |
48 |
Cell ll = left.h(d_clone); |
l.link(-1, cs, cellNodeType, new Pair(ll, c), ll); |
|
l.link(-1, cs, cellNodeType, new Pair(ll, c), ll); |
|
|
} |
|
49 |
} |
} |
50 |
} |
} |
51 |
} |
} |