COGENT Online
CONTENTS
COGENT Help

The Edit Menu

Undo and Redo

The Undo/Redo facility allows edits to a model to be reversed. There are four broad classes of edit that can be made to a model: box-related edits (e.g., cutting, pasting, inserting and deleting boxes), arrow-related edits (e.g., inserting, deleting, and reversing arrows), clause-related edits (e.g., inserting, modifying, cutting and pasting buffer and process elements), and property-related edits (e.g., setting, adding and deleting items on a box's properties panel).

All edits to each box are stored so that, in case of error, they can be undone. Edits that are undone can then be redone, unless further edits are made between the undo and attempted redo. Edits can even be reversed after a box has been saved. Note however that when you exit COGENT all undo lists are discarded. You cannot therefore restart COGENT and undo edits from a previous session.

Each box stores its edits locally, so selecting Undo or Redo from the Edit menu of a given box will undo/redo the last edit to that particular box, not the last edit to the model itself.

COGENT writes all edits to disk. If COGENT should crash it is able to recover edits by reading this edit log and applying them to your model. (Whenever a model is saved the edit log is deleted.) If, on opening a model, COGENT discovers an edit log associated with any of the boxes in that model it will ask if it should attempt a recovery.

Note that it is possible to make a sequence of changes to a model with one set of mouse movements. For example, an existing arrow between two boxes can be diverted to and from a third box by dragging the middle of the arrow with the middle mouse button. This edit is recorded as three separate changes: deleting the original arrow and added two separate arrows. Undoing the edit will undo each step separately. That is, to completely reverse the edit it is necessary to undo the last three actions.

Find

COGENT's find facility allows the user to search for all occurrences of a given term in the rules, condition definitions, buffer elements, etc. of a model. Selecting Find from the Edit pull-down menu on any box opens the find dialogue, shown in figure 1.



Figure 1: The find dialogue

To search for a specific term, enter the term in the Find: field and hit the Search button. COGENT will search for occurrences of the Find term (i.e., terms which literally match it) in the box from which Find was selected (and, if the box from which Find was selected is a compound box, all sub-boxes). Find displays its results in a list in the lower half of the find window. Double clicking on any entry in that list will pop-up the window containing the object (rule, condition, buffer element, etc.) containing the find term, with the object selected.

Note that find is currently only able to find objects containing terms that match literally with the find term. Terms match literally if a) all non-variable sub-terms are identical; and b) any variables contained in them share the same name. For example, find animal(X) will match animal(X) but not animal(dog) or animal(Y). It is planned to extend the functionality of find to allow search for terms that unify with the find term.

Finally, note also that if find is given a term such as cat, it will find occurrences of that term within cat(tigger) and is_a(animal, cat) but not within cats([tigger,thomas]). That is, the find term may match the functor or an argument of a complex term, but it must match exactly and entirely.

Replace

COGENT's replace facility allows all terms within the rules, condition definitions, buffer elements, etc. of a model that match a given pattern to be replaced by an alternate pattern. Figure 2 shows the replace dialogue, which appears when Replace is selected from a box's Edit menu.



Figure 2: The replace dialogue

To use the facility, enter a term in the Find: field and enter the replacement term in the Replace with: field. Click on the Replace button and COGENT will search for occurrences of the find term (i.e., terms which literally match it) in the box from which replace was selected and replace them with occurrences of the replace term. When finished, replace will report the number of occurrences of the term that were found and replaced.

Replace uses the same search mechanisms as