|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| MethodCall.java | 40% | 52.9% | 62.5% | 51.4% |
|
||||||||||||||
| 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 | /** | |
| 36 | * An abstract parent for all method calls. Concrete implementations include:<ul> | |
| 37 | * <li>{@link SimpleMethodCall}</li> | |
| 38 | * <li>{@link ObjectMethodCall}</li> | |
| 39 | * <li>{@link StaticMethodCall}</li> | |
| 40 | * <li>{@link SuperMethodCall}</li> | |
| 41 | * </ul> | |
| 42 | */ | |
| 43 | ||
| 44 | public abstract class MethodCall extends PrimaryExpression | |
| 45 | implements StatementExpression { | |
| 46 | ||
| 47 | private Option<List<TypeName>> typeArgs; | |
| 48 | private String methodName; | |
| 49 | private List<Expression> arguments; | |
| 50 | ||
| 51 | /** | |
| 52 | * Creates a new node | |
| 53 | * @param mn the field name | |
| 54 | * @param args the arguments. null if no arguments. | |
| 55 | * @exception IllegalArgumentException if mn is null | |
| 56 | */ | |
| 57 | 361 | protected MethodCall(Option<List<TypeName>> targs, String mn, List<? extends Expression> args, |
| 58 | SourceInfo si) { | |
| 59 | 361 | super(si); |
| 60 | 0 | if (mn == null || targs == null) throw new IllegalArgumentException(); |
| 61 | 361 | typeArgs = targs; |
| 62 | 361 | methodName = mn; |
| 63 | 361 | arguments = (args == null) ? new ArrayList<Expression>(0) : new ArrayList<Expression>(args); |
| 64 | } | |
| 65 | ||
| 66 | 333 | public Option<List<TypeName>> getTypeArgs() { return typeArgs; } |
| 67 | 0 | public void setTypeArgs(List<TypeName> targs) { typeArgs = Option.wrap(targs); } |
| 68 | 0 | public void setTypeArgs(Option<List<TypeName>> targs) { |
| 69 | 0 | if (targs == null) throw new IllegalArgumentException(); |
| 70 | 0 | typeArgs = targs; |
| 71 | } | |
| 72 | ||
| 73 | /** | |
| 74 | * Returns the method name | |
| 75 | */ | |
| 76 | 803 | public String getMethodName() { |
| 77 | 803 | return methodName; |
| 78 | } | |
| 79 | ||
| 80 | /** | |
| 81 | * Sets the method name | |
| 82 | * @exception IllegalArgumentException if s is null | |
| 83 | */ | |
| 84 | 0 | public void setMethodName(String s) { |
| 85 | 0 | if (s == null) throw new IllegalArgumentException("s == null"); |
| 86 | 0 | methodName = s; |
| 87 | } | |
| 88 | ||
| 89 | /** | |
| 90 | * Returns the arguments. | |
| 91 | * @return null if there is no argument | |
| 92 | */ | |
| 93 | 823 | public List<Expression> getArguments() { |
| 94 | 823 | return arguments; |
| 95 | } | |
| 96 | ||
| 97 | /** | |
| 98 | * Sets the constructor arguments. | |
| 99 | */ | |
| 100 | 264 | public void setArguments(List<? extends Expression> l) { |
| 101 | 264 | arguments = (l == null) ? new ArrayList<Expression>(0) : new ArrayList<Expression>(l); |
| 102 | } | |
| 103 | } |
|
||||||||||