diff options
author | Jim Shuma <jshuma@google.com> | 2010-07-07 14:24:21 -0700 |
---|---|---|
committer | Jim Shuma <jshuma@google.com> | 2010-07-15 13:42:02 -0700 |
commit | 288c8711a64893acb3f4a31caf69153be9809d17 (patch) | |
tree | 4349a0c89d71bfcdd08b70590cd864325ee2f9f5 /graphics/java/android/renderscript/Program.java | |
parent | d0d5c072aa8aa30cde3213af8b022104aabb51a5 (diff) |
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
Diffstat (limited to 'graphics/java/android/renderscript/Program.java')
-rw-r--r-- | graphics/java/android/renderscript/Program.java | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/graphics/java/android/renderscript/Program.java b/graphics/java/android/renderscript/Program.java index 1614ec590cbd..b16dac1f1e5b 100644 --- a/graphics/java/android/renderscript/Program.java +++ b/graphics/java/android/renderscript/Program.java @@ -91,8 +91,9 @@ public class Program extends BaseObj { mTextureCount = 0; } - public void setShader(String s) { + public BaseProgramBuilder setShader(String s) { mShader = s; + return this; } public void addInput(Element e) throws IllegalStateException { @@ -120,12 +121,13 @@ public class Program extends BaseObj { return mConstantCount++; } - public void setTextureCount(int count) throws IllegalArgumentException { + public BaseProgramBuilder setTextureCount(int count) throws IllegalArgumentException { // Should check for consistant and non-conflicting names... if(count >= MAX_CONSTANT) { throw new IllegalArgumentException("Max texture count exceeded."); } mTextureCount = count; + return this; } protected void initProgram(Program p) { |