Java Reference
In-Depth Information
// ??
Function brightness =
// ??
p.setXY(new T(), brightness);
com.oozinoz.ui.SwingFacade.launch(
p, " Brightness");
}
}
This code produces the plot in Figure 27.7.
Figure 27.7. A star's brightness peaks quickly and then tails off.
CHALLENGE 27.4
Write the code to define a
brightness
object that represents the brightness
function.
You can add other functions to the
Function
hierarchy as needed. For example, you might
add
Random
,
Sqrt
, and
Tan
classes. You can also create new hierarchies that work on
different types, such as strings, or that have a different notion of how to define the
f()
operation. For example, you might define
f()
as a two- or three-dimensional function of
time. Regardless of the hierarchy you create, if you apply D
ECORATOR
and you wrap