diff options
Diffstat (limited to 'src/main/java/io/devnulllabs/openjava/ptree/ConstructorInvocation.java')
-rw-r--r-- | src/main/java/io/devnulllabs/openjava/ptree/ConstructorInvocation.java | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/src/main/java/io/devnulllabs/openjava/ptree/ConstructorInvocation.java b/src/main/java/io/devnulllabs/openjava/ptree/ConstructorInvocation.java new file mode 100644 index 0000000..539142e --- /dev/null +++ b/src/main/java/io/devnulllabs/openjava/ptree/ConstructorInvocation.java @@ -0,0 +1,85 @@ +/* + * ConstructorInvocation.java 1.0 + * + * Jun 20, 1997 mich + * Sep 29, 1997 bv + * Oct 11, 1997 mich + * + * @see io.devnulllabs.openjava.ptree.ParseTree + * @version 1.0 last updated: Oct 11, 1997 + * @author Michiaki Tatsubori + */ +package io.devnulllabs.openjava.ptree; + +import io.devnulllabs.openjava.ptree.util.ParseTreeVisitor; + +/** + * The ConstructorInvocation class presents expression statement node + * of parse tree + * + * @see io.devnulllabs.openjava.ptree.ParseTree + * @see io.devnulllabs.openjava.ptree.NonLeaf + * @see io.devnulllabs.openjava.ptree.Statement + * @see io.devnulllabs.openjava.ptree.ExpressionList + */ +public class ConstructorInvocation extends NonLeaf { + + private boolean _isSelfInvocation = true; + + /** + * Constructs a new constructor invocation. + * i.e. <code>this(..)</code> + * + * @param exprs arguments for this constructor invocation + */ + public ConstructorInvocation(ExpressionList exprs) { + super(); + this._isSelfInvocation = true; + if (exprs == null) + exprs = new ExpressionList(); + set(exprs); + } + + /** + * Constructs a new constructor invocation. + * i.e. <code>super(..)</code> + * + * @param exprs arguments for this constructor invocation + * @param enclosing outerclass qualifier. + */ + public ConstructorInvocation(ExpressionList exprs, Expression enclosing) { + super(); + this._isSelfInvocation = false; + if (exprs == null) + exprs = new ExpressionList(); + set(exprs, enclosing); + } + + ConstructorInvocation() { + super(); + } + + /*********need modification for copy******/ + + public boolean isSelfInvocation() { + return _isSelfInvocation; + } + + /** + * Gets the expressions as arguments for this invocation. + * + * @return the expressions. + */ + public ExpressionList getArguments() { + return (ExpressionList) elementAt(0); + } + + public Expression getEnclosing() { + return (Expression) elementAt(1); + } + + public void accept(ParseTreeVisitor v) throws ParseTreeException { + v.visit(this); + } + +} |