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.
55 lines
891 B
55 lines
891 B
package mightypork.utils.math.rect;
|
|
|
|
|
|
import mightypork.utils.math.vect.Vect;
|
|
import mightypork.utils.math.vect.VectAdapter;
|
|
import mightypork.utils.math.vect.VectView;
|
|
|
|
|
|
/**
|
|
* Rect proxy with abstract method for plugging in / generating rect
|
|
* dynamically.
|
|
*
|
|
* @author MightyPork
|
|
*/
|
|
public abstract class RectAdapter extends RectView {
|
|
|
|
private VectAdapter originAdapter = new VectAdapter() {
|
|
|
|
@Override
|
|
protected Vect getSource()
|
|
{
|
|
return RectAdapter.this.getSource().origin();
|
|
}
|
|
};
|
|
|
|
private VectAdapter sizeAdapter = new VectAdapter() {
|
|
|
|
@Override
|
|
protected Vect getSource()
|
|
{
|
|
return RectAdapter.this.getSource().size();
|
|
}
|
|
};
|
|
|
|
|
|
/**
|
|
* @return the proxied coord
|
|
*/
|
|
protected abstract Rect getSource();
|
|
|
|
|
|
@Override
|
|
public VectView origin()
|
|
{
|
|
return originAdapter;
|
|
}
|
|
|
|
|
|
@Override
|
|
public VectView size()
|
|
{
|
|
return sizeAdapter;
|
|
}
|
|
|
|
}
|
|
|