From mira@ccs.neu.edu Thu Nov 20 12:31:03 1997 Received: from taboor.ccs.neu.edu (mira@taboor.ccs.neu.edu [129.10.112.115]) by amber.ccs.neu.edu (8.8.6/8.7.3) with ESMTP id MAA20316; Thu, 20 Nov 1997 12:31:02 -0500 (EST) From: Mira Mezini Received: (mira@localhost) by taboor.ccs.neu.edu (8.8.6/8.6.4) id MAA20890; Thu, 20 Nov 1997 12:31:01 -0500 (EST) Message-Id: <199711201731.MAA20890@taboor.ccs.neu.edu> Subject: Re: Mira's style in Demeter/Java To: binoy@ccs.neu.edu (Binoy Samuel) Date: Thu, 20 Nov 1997 12:31:01 -0500 (EST) Cc: lieber@ccs.neu.edu (Karl Lieberherr) In-Reply-To: <3474706F.6979@ccs.neu.edu> from "Binoy Samuel" at Nov 20, 97 12:16:31 pm X-Mailer: ELM [version 2.4 PL23beta2] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Status: R Hi Binoy and Karl: there is indeed confusion. The problem is that Karl has somehow modified the code we both agreed with by putting everything in the CHECK adjuster. The way this example was written before (or at least the way I would have written it) is as below. -- Mira -------- cut here ------------- Example 2: Container -------------------- For the container example the summing adjuster above can be reused. The strategy now is S1 = from Container to Weight; and the involved adjusters and adjustments: adjuster Summing(strategy s) [ adjustment SummingEntry { (@ int total_sum; @) init (@ total_sum = 0; @) return (@ total_sum @) } adjustment Sum(int total_sum) { change target(s) (@ total_sum += this.value; super(); @)} ] adjustment Initial modifies Summing { (@ int initial; Stack stack; @) change source(s) (@ stack.push(this.total_sum); super(); initial = (Integer) stack.pop(); @) } adjustment Checking modifies Initial { (@ int violations;@) change source(s) (@ System.out.println(" start newcontainer"); super(); integer initial = this.initial; int cap = this.get_capacity().get_i().intValue(); int diff = total_sum.intValue() -initial.intValue(); if (diff > cap) { violations = new Integer(violations.intValue()+1); // this.set_violations(new Integer(violations.intValue() + 1)); System.out.println(" total weight " + diff + " but limit is = " + cap + " OVERCAPACITY "$ System.out.println(" end container "); } Container c = new Container{Checking during S1}. c.checking(). --------- cut here ------------ > A bit of confusion w/ all the new terminoly. > Looking at the code below, should it be > "adjustment Summing" instead of "adjustment sum"? (2nd block of code) > > -binoy > > Karl Lieberherr wrote: > > > > Hi Binoy: > > > > The discussion with Mira is archived at: /proj/adaptive/www/related-work/Rondo > > > > Please can you add a test case to the test suite which implements > > the programming style which Mira outlined yesterday > ........ > > > > Example 2: Container > > -------------------- > > > > For the container example the summing adjuster above can be reused. The > > strategy now is > > > > S1 = from Container to Weight; > > > > adjuster CHECK(strategy s) > > adjustment SummingEntry { > > (@ int total_sum; @) > > init (@ total_sum = 0; @) > > return (@ total_sum @) > > } > > > > adjustment Sum(int total_sum) > => ^^^^^^^^ > > > { change target(s) (@ total_sum += this.value; super(); @)} > > > > adjustment Initial modifies Summing { > > (@ int initial; > > Stack stack; @) > > change source(s) > > (@ stack.push(this.total_sum); > > super(); > > initial = (Integer) stack.pop(); @) > > } > > > > adjustment Checking modifies Initial > > { > > (@ int violations;@) > > change source(s) (@ System.out.println(" start new container "); > > super(); > > integer initial = this.initial; > > int cap = this.get_capacity().get_i().intValue(); > > int diff = total_sum.intValue() - initial.intValue(); > > if (diff > cap) > > { violations = new Integer(violations.intValue() + 1); > > // this.set_violations(new Integer(violations.intValue() + 1)); > > System.out.println(" total weight " + > > diff + " but limit is = " + cap + " OVER CAPACITY "); }; > > System.out.println(" end container "); > > } > > > > Container c = new Container{CHECK during S1}. > > c.checking(). >