
I don’t understand what
Function1
andMandelbrotBase
are supposed to do. Can you give an example?Objects conforming to
Function1
are representations of singlevalued functions whose argument and result types are the same. For example, the realvalued function f(x) = 3x could be represented as objects of the classclass Tripler implements Function1<Double> { public Double apply(Double d) { return 3.0 * d; } }
For example the statements
final Tripler tr = new Tripler(); System.out.println(tr.apply(2.3);
should print
6.9
.The
MandelbrotBase
class represents the family of functions f_{c} from which the Mandelbrot set is generated. For example, consider f_{3+4i}(x)=x^{2}+(3+4i). Note that f_{3+4i}(1+2i) = (1+2i)^{2} + (3+4i) = (1+4i4)+(3+4i) = 8i. So if we execute the statements:final Function1<Complex> f3p4i = new MandelbrotBase(Complex.cpl(3,4)); final Complex c = f3p4i.apply(Complex.cpl(1,2)); System.out.println(c.getReal() + "+" + c.getImaginary());
We would expect them to print
0+8i
. 
In the description of
Function1Iterator
, did you mean to describenext()
instead ofiterator
?Yes. I’ve corrected the text to say: The first value returned by the
next()
method of aFunction1Iterator
should beinitial
, and then the result off.apply(initial)
, thenf.apply(f.apply(initial))
, and so on. Implement a test classFunction1IteratorTests
to test an implementation ofFunction1Iterator
. 
What should the
hasNext
method do?Since we can always apply
f
another time,hasNext()
will always returntrue
. 
May I submit additional classes which I use in my tests?
Yes. Do remember the constraint that my tests of your JUnit code will provide alternate versions of
MandelbrotBase.java
andFunctionIterator.java
which are variously buggy, so you expect those classes to deliver no more than the minimum described in the assignment spec. 
What is this interface
Iterator
? Do I need to define it?No.
Iterator
is a standard class in the Java distribution; its JavaDoc page is here. It is injava.util
(and notjava.lang
), so you will need to useimport java.util.Iterator;
at the start of your file, in between the file header comment and the class Javadoc.
See also: Assignment 3.5, CS220 homepage