Figure 13-3 is an object diagram. It shows a set of objects and relationships at a particular moment in the execution of the system. You can view it as a snapshot of memory. Figure 13-3. treeMap object diagramIn this diagram, the rectangle icons represent objects. You can tell that they are objects because their names are underlined. The name after the colon is the name of the class that the object belongs to. Note that the lower compartment of each object shows the value of that object's key variable. The relationships between the objects are called links and are derived from the associations in Figure 13-2. Note that the links are named for the two array cells in the nodes array. Sequence DiagramsFigure 13-4 is a sequence diagram. It describes how the TReeMap.Add method is implemented. Figure 13-4. treeMap.add
The stick figure represents an unknown caller. This caller invokes the Add method on a treeMap object. If the topNode variable is null, treeMap responds by creating a new TReeMapNode and assigning it to topNode. Otherwise, the TReeMap sends the Add message to topNode. The Boolean expressions inside brackets are called guards. They show which path is taken. The message arrow that terminates on the TReeMapNode icon represents construction. The little arrows with circles are called data tokens. In this case, they depict the construction arguments. The skinny rectangle below treeMap is called an activation. It depicts how much time the add method executes. |