/[gzz]/gzz/doc/pegboard/containment--benja/peg.rst
ViewVC logotype

Diff of /gzz/doc/pegboard/containment--benja/peg.rst

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by benja, Mon Oct 28 12:05:21 2002 UTC revision 1.2 by benja, Tue Oct 29 12:50:09 2002 UTC
# Line 36  Changes Line 36  Changes
36  -------  -------
37    
38  For now, let's handle containment through a  For now, let's handle containment through a
39  ``gzz.zzutil.Contaiment`` class with the following methods::  ``gzz.zzutil.Containment`` class with the following methods::
40    
41      public static String getContainedText(Cell c) {      public static String getContainedText(Cell c) {
42          // ...          // ...
# Line 54  Additionally, new ``p``/``P`` bindings a Line 54  Additionally, new ``p``/``P`` bindings a
54  list of contained cells; ``P`` does the reverse. (Actually, let's  list of contained cells; ``P`` does the reverse. (Actually, let's
55  use the prefix mechanism explained in PEG 1022: other window if  use the prefix mechanism explained in PEG 1022: other window if
56  no cells are marked; the marked cells, if any; in the future,  no cells are marked; the marked cells, if any; in the future,
57  the cell identified by number, if any.)  the cell identified by number, if any.) If the cell to be put
58    "inside" another cell is already connected in a containment
59    structure (i.e., is already inside some other cell), it is
60    cloned and the clone is put instead.
61    
62    To encapsulate this properly, let's have an additional method
63    in ``Containment``::
64    
65        public static void addContainedCell(Cell add, Cell into)
66                                      throws IllegalArgumentException {
67            // ...
68        }
69    
70    This method puts ``add`` at the end of the list of cells contained
71    in ``into``, *if* ``add`` has no connections on ``d..contain-list``
72    and no negward connection on ``d.contain``. Otherwise, it throws
73    an ``IllegalArgumentException``.
74    
75    It doesn't do the cloning because that behavior is considered
76    specific to the binding. In the binding, we can then write::
77    
78        try {
79            addContainedCell(add, into);
80        } catch(IllegalArgumentException _) {
81            addContainedCell(add.zzclone(), into);
82        }
83    
84  - Benja  - Benja

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26