Java Reference

In-Depth Information

public double f(double t)

{

return Math.exp(source[0].f(t));

}

}

SOLUTION 27.4

You might build up the equation by using several
Function
variables or by defining all in

one shot:

package com.oozinoz.applications;

import com.oozinoz.function.*;

public class ShowBrightness

{

public static void main(String args[])

{

FunPanel p = new FunPanel();

p.setPreferredSize(

new java.awt.Dimension(200, 200));

Function brightness =

new Arithmetic(

'*',

new Exp(

new Arithmetic(

'*', new Constant(-5), new T())),

new Sin(

new Arithmetic(

'*',

new Constant(Math.PI),

new T())));

p.setXY(new T(), brightness);

com.oozinoz.ui.SwingFacade.launch(

p,

" Brightness");

}

}

SOLUTION 27.5

Listeners provide flexibility in how an application behaves, but they do not include the idea of

composition. The intent of D
ECORATOR
is to let you
compose
an object's behavior, not merely

alter it.