Making Program*.Builder classes' setters return 'this'

This is for better correspondence with the Builder pattern.
See also: Effective Java, 2nd edition.

Change-Id: Iecccd42be49dea2ed8e4b8cc38ce96379cf3c11c
This commit is contained in:
Jim Shuma
2010-07-07 14:24:21 -07:00
parent d0d5c072aa
commit 288c8711a6
5 changed files with 26 additions and 13 deletions

View File

@@ -114,28 +114,33 @@ public class ProgramStore extends BaseObj {
}
public void setDepthFunc(DepthFunc func) {
public Builder setDepthFunc(DepthFunc func) {
mDepthFunc = func;
return this;
}
public void setDepthMask(boolean enable) {
public Builder setDepthMask(boolean enable) {
mDepthMask = enable;
return this;
}
public void setColorMask(boolean r, boolean g, boolean b, boolean a) {
public Builder setColorMask(boolean r, boolean g, boolean b, boolean a) {
mColorMaskR = r;
mColorMaskG = g;
mColorMaskB = b;
mColorMaskA = a;
return this;
}
public void setBlendFunc(BlendSrcFunc src, BlendDstFunc dst) {
public Builder setBlendFunc(BlendSrcFunc src, BlendDstFunc dst) {
mBlendSrc = src;
mBlendDst = dst;
return this;
}
public void setDitherEnable(boolean enable) {
public Builder setDitherEnable(boolean enable) {
mDither = enable;
return this;
}
static synchronized ProgramStore internalCreate(RenderScript rs, Builder b) {