persistable sclass SubMatrix extends AbstractMatrix {
Matrix matrix;
int x1, y1;
*(Matrix *matrix, Rect r) {
super(r.w, r.h);
x1 = r.x; y1 = r.y;
}
// currently no range checks
public A get(int x, int y) {
try {
ret matrix.get(x+x1, y+y1);
} catch e {
throw augmentException(e, this);
}
}
public void set(int x, int y, A a) { matrix.set(x+x1, y+y1, a); }
toString { ret renderFunctionCall("SubMatrix", x1, y1, w, h); }
}