|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| SuperMethodCall.java | 0% | 0% | 0% | 0% |
|
||||||||||||||
| 1 | /* | |
| 2 | * DynamicJava - Copyright (C) 1999-2001 | |
| 3 | * | |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a | |
| 5 | * copy of this software and associated documentation files | |
| 6 | * (the "Software"), to deal in the Software without restriction, including | |
| 7 | * without limitation the rights to use, copy, modify, merge, publish, | |
| 8 | * distribute, sublicense, and/or sell copies of the Software, and to permit | |
| 9 | * persons to whom the Software is furnished to do so, subject to the | |
| 10 | * following conditions: | |
| 11 | * The above copyright notice and this permission notice shall be included | |
| 12 | * in all copies or substantial portions of the Software. | |
| 13 | * | |
| 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
| 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
| 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
| 17 | * IN NO EVENT SHALL DYADE BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
| 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
| 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |
| 20 | * DEALINGS IN THE SOFTWARE. | |
| 21 | * | |
| 22 | * Except as contained in this notice, the name of Dyade shall not be | |
| 23 | * used in advertising or otherwise to promote the sale, use or other | |
| 24 | * dealings in this Software without prior written authorization from | |
| 25 | * Dyade. | |
| 26 | * | |
| 27 | */ | |
| 28 | ||
| 29 | package koala.dynamicjava.tree; | |
| 30 | ||
| 31 | import java.util.*; | |
| 32 | ||
| 33 | import edu.rice.cs.plt.tuple.Option; | |
| 34 | ||
| 35 | import koala.dynamicjava.tree.visitor.*; | |
| 36 | ||
| 37 | /** | |
| 38 | * This class represents the super method call nodes of the syntax tree. | |
| 39 | * For example: "super.foo(x, y+3)" | |
| 40 | * | |
| 41 | * @author Stephane Hillion | |
| 42 | * @version 1.0 - 1999/04/24 | |
| 43 | */ | |
| 44 | ||
| 45 | public class SuperMethodCall extends MethodCall { | |
| 46 | /** | |
| 47 | * The class that qualify that object | |
| 48 | */ | |
| 49 | private Option<String> className; | |
| 50 | ||
| 51 | 0 | public SuperMethodCall(Option<String> cn, Option<List<TypeName>> targs, String mn, |
| 52 | List<? extends Expression> args, SourceInfo si) { | |
| 53 | 0 | super(targs, mn, args, si); |
| 54 | 0 | if (cn == null) throw new IllegalArgumentException("cn == null"); |
| 55 | 0 | className = cn; |
| 56 | } | |
| 57 | ||
| 58 | 0 | public SuperMethodCall(Option<String> cn, String mn, List<? extends Expression> args, SourceInfo si) { |
| 59 | 0 | this(cn, Option.<List<TypeName>>none(), mn, args, si); |
| 60 | } | |
| 61 | ||
| 62 | 0 | public SuperMethodCall(Option<String> cn, Option<List<TypeName>> targs, String mn, |
| 63 | List<? extends Expression> args) { | |
| 64 | 0 | this(cn, targs, mn, args, SourceInfo.NONE); |
| 65 | } | |
| 66 | ||
| 67 | 0 | public SuperMethodCall(Option<String> cn, String mn, List<? extends Expression> args) { |
| 68 | 0 | this(cn, Option.<List<TypeName>>none(), mn, args, SourceInfo.NONE); |
| 69 | } | |
| 70 | ||
| 71 | /** | |
| 72 | * Returns the name of the class that qualify that object | |
| 73 | */ | |
| 74 | 0 | public Option<String> getClassName() { |
| 75 | 0 | return className; |
| 76 | } | |
| 77 | ||
| 78 | /** | |
| 79 | * Sets the name of the class that qualifies that object | |
| 80 | * @exception IllegalArgumentException if s is null or body is null | |
| 81 | */ | |
| 82 | 0 | public void setClassName(Option<String> cn) { |
| 83 | 0 | if (cn == null) throw new IllegalArgumentException("cn == null"); |
| 84 | 0 | className = cn; |
| 85 | } | |
| 86 | ||
| 87 | /** | |
| 88 | * Allows a visitor to traverse the tree | |
| 89 | * @param visitor the visitor to accept | |
| 90 | */ | |
| 91 | 0 | public <T> T acceptVisitor(Visitor<T> visitor) { |
| 92 | 0 | return visitor.visit(this); |
| 93 | } | |
| 94 | /** | |
| 95 | * Implementation of toString for use in unit testing | |
| 96 | */ | |
| 97 | 0 | public String toString() { |
| 98 | 0 | return "("+getClass().getName()+": "+toStringHelper()+")"; |
| 99 | } | |
| 100 | /** | |
| 101 | * Implementation of toString for use in unit testing | |
| 102 | */ | |
| 103 | 0 | public String toStringHelper() { |
| 104 | 0 | return getClassName()+" "+getTypeArgs()+" "+getMethodName()+" "+getArguments(); |
| 105 | } | |
| 106 | } |
|
||||||||||