Rogue: Savage Rats, a retro-themed dungeon crawler
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
rogue-savage-rats/src/mightypork/utils/math/rect/AbstractRect.java

45 lines
731 B

package mightypork.utils.math.rect;
/**
* Abstract {@link Rect}, implementing all but the data getters
*
* @author MightyPork
*/
abstract class AbstractRect implements Rect {
private RectProxy proxy;
@Override
public RectView getRect()
{
return this.view();
}
@Override
public RectView view()
{
// must NOT call RectView.make, it'd cause infinite recursion.
if (proxy == null) proxy = new RectProxy(this);
return proxy;
}
@Override
public RectVal copy()
{
// must NOT call RectVal.make, it'd cause infinite recursion.
return new RectVal(this);
}
@Override
public String toString()
{
return String.format("Rect { %s - %s }", origin(), origin().copy().add(size()));
}
}