This pattern makes sure that whether you call circularBuffer with new
or not, you still get a new instance.
So both of the following result in a new circularBuffer instance being
assigned to cb:
var cb = new circularBuffer(100);
var cb = circularBuffer(100);
In the first case, this is a circularBuffer instance so it follows the
if path. In the second case, this is window so the method follow
It's breaking on the >= test in validSquare. You can't determine the
truth value of X <= Y when both are unbound, basically, because
numerical operators don't assign values. You could solve this by using
a member to bind the coordinates to valid squares, i.e.
There's no change to the constructor required. What is required is
that you implement the methods prescribed by the interface.
That is to say, you could have the same constructor you're using
(provided that you provide types for your parameters, which you are
not, but you must), but you are required to implement
compareTo(Student other) somewhere in your class.