Example Contracts for Case Studies Clause Samples

Example Contracts for Case Studies. Figure 10 contains a representative contract for an add method that inserts an element in a binary search tree. The method adds new elements by creating a new node object that is inserted into the tree at the appropriate place. Its contract reveals that the method only reads and modifies objects reachable via this. root and then following left or right properties. It does not change the value /∗c ... with [this. root./left|right/∗.value.@, this. root, this. root./left|right/∗./left|right/] ∗/ BinaryTree.add = function(elem) { ... }