next up previous contents
Next: Straw Accessors Up: The Weavable Interface and Previous: The HaystackID Class

Straw Modifiers

The main modifier operations provided by Weavable are systematic methods of connecting and disconnecting Straws.

For directly connecting a Straw to a Tie, the Straw class provides the methods attachForwardLink(...) and attachBackLink(...). These functions directly add the Straw to the appropriate StrawTies object.

For connecting two objects that have some relationship to each other, say a bale.HaystackDocument and a needle.Title, the HDM model calls for the connection to be done by means of a Tie. This is true for a connection between a Bale and a Needle, between two Needles or between two Bales. Attaching a Needle (say a comment about a Tie) to a Tie, is done by means of a third Tie. This is due to the first class nature of edges in the HDM graph.

In designing an interface for dealing with the HDM objects it became obvious that a substantial amount of the time a programmer wants to connect two objects directly without dealing with the intermediate Tie. To facilitate this, Straw provides two functions attachForwardObject(...) and attachBackObject(...). Both functions generate the intermediate Tie object and perform all the necessary adjustments to connect the two Straws. Ties are generated in a somewhat ``intelligent'' fashion. That is, a Tie is selected that most closely matches the object it is connecting. For example, if a needle.filetype.Mail object is to be attached to a bale.HaystackDocument, the attachForwardObject() operation will find the first valid object in the tie package that most accurately represents the needle. The function first verifies that the class tie.filetype.Mail exists. If the check fails, the function moves one level back in the type hierarchy and attempts to create a tie.Filetype. If after crawling up the hierarchy, no match is found, a basic Tie object is created to connect the two Straws.

This lookup process is an optimization that simplifies the process of adding new Straw types. It is not necessary to code a matching Tie class for every Needle and Bale object. However, the creation of new types of Straw is simplified and/or automated this process will no longer be necessary and a one-to-one correspondance will exist between the connected Tie and Needle (i.e. for a needle.filetype.Mail there will be a tie.filetype.Mail).

Straws also provide a mechanism to detach links (detachForwardLink(...), detachBackLink(...)). Use of these should be avoided as the HDM is intended to reflect changes over time, but they are provided for adept programmers who require such modifications to the HDM graph.


next up previous contents
Next: Straw Accessors Up: The Weavable Interface and Previous: The HaystackID Class

Copyright 1998, Eytan Adar (eytan@alum.mit.edu)