diff options
author | Shevek <[email protected]> | 2014-09-10 16:10:52 -0700 |
---|---|---|
committer | Shevek <[email protected]> | 2014-09-10 19:07:35 -0700 |
commit | bcc3a2b96b0e8b8b03dad0babd7103903cc9df3f (patch) | |
tree | 09a2833189524f55e5a6c149cc0e4650a6e5a5f0 /src/main/java/org/anarres/cpp/Argument.java | |
parent | aefac8ce01aee2f538db413d5812613facee9c55 (diff) |
NetBeans refactorings to standardize codebase.
Diffstat (limited to 'src/main/java/org/anarres/cpp/Argument.java')
-rw-r--r-- | src/main/java/org/anarres/cpp/Argument.java | 80 |
1 files changed, 39 insertions, 41 deletions
diff --git a/src/main/java/org/anarres/cpp/Argument.java b/src/main/java/org/anarres/cpp/Argument.java index a868db5..31d9e93 100644 --- a/src/main/java/org/anarres/cpp/Argument.java +++ b/src/main/java/org/anarres/cpp/Argument.java @@ -14,16 +14,13 @@ * or implied. See the License for the specific language governing * permissions and limitations under the License. */ - package org.anarres.cpp; import java.io.IOException; - import java.util.ArrayList; -import java.util.List; import java.util.Iterator; - -import static org.anarres.cpp.Token.*; +import java.util.List; +import javax.annotation.Nonnull; /** * A macro argument. @@ -31,47 +28,48 @@ import static org.anarres.cpp.Token.*; * This encapsulates a raw and preprocessed token stream. */ /* pp */ class Argument extends ArrayList<Token> { - public static final int NO_ARGS = -1; - private List<Token> expansion; + private List<Token> expansion; - public Argument() { - this.expansion = null; - } + public Argument() { + this.expansion = null; + } - public void addToken(Token tok) { - add(tok); - } + public void addToken(@Nonnull Token tok) { + add(tok); + } - /* pp */ void expand(Preprocessor p) - throws IOException, - LexerException { - /* Cache expansion. */ - if (expansion == null) { - this.expansion = p.expand(this); - // System.out.println("Expanded arg " + this); - } - } + /* pp */ void expand(@Nonnull Preprocessor p) + throws IOException, + LexerException { + /* Cache expansion. */ + if (expansion == null) { + this.expansion = p.expand(this); + // System.out.println("Expanded arg " + this); + } + } - public Iterator<Token> expansion() { - return expansion.iterator(); - } + @Nonnull + public Iterator<Token> expansion() { + return expansion.iterator(); + } - public String toString() { - StringBuilder buf = new StringBuilder(); - buf.append("Argument("); - // buf.append(super.toString()); - buf.append("raw=[ "); - for (int i = 0; i < size(); i++) - buf.append(get(i).getText()); - buf.append(" ];expansion=[ "); - if (expansion == null) - buf.append("null"); - else - for (int i = 0; i < expansion.size(); i++) - buf.append(expansion.get(i).getText()); - buf.append(" ])"); - return buf.toString(); - } + @Override + public String toString() { + StringBuilder buf = new StringBuilder(); + buf.append("Argument("); + // buf.append(super.toString()); + buf.append("raw=[ "); + for (int i = 0; i < size(); i++) + buf.append(get(i).getText()); + buf.append(" ];expansion=[ "); + if (expansion == null) + buf.append("null"); + else + for (Token token : expansion) + buf.append(token.getText()); + buf.append(" ])"); + return buf.toString(); + } } |