INTERFACE MixedEnergy; IMPORT Energy; TYPE T <: Public; Public = Energy.T OBJECT term: REF ARRAY OF Energy.T; (* Energy ingredients *) weight: REF ARRAY OF REAL; (* Weight of each ingredient *) termValue: REF ARRAY OF LONGREAL := NIL; (* Value of each term as of last "eval" *) METHODS init( READONLY term: ARRAY OF Energy.T; READONLY weight: ARRAY OF REAL ): T; (* Allocates new arrays for "term", "weight", and "termValue", and copies the given arrays into them. Assumes the "term[k]" has been initialized. *) END; (* A "MixedEnergy.T" is a linear combinations of the energy functions "term[k]", with weights "weight[k]". The "eval" method will leave the (unweighted) energy terms in "termValue". *) END MixedEnergy.