blob: 235b4853dd870ee681d35971e14bc0d24b14aeab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
package org.zwobble.couscous.ast;
import org.zwobble.couscous.types.Type;
import java.util.List;
public class ExceptionHandlerNode {
public static ExceptionHandlerNode exceptionHandler(VariableDeclaration declaration, List<StatementNode> body) {
return new ExceptionHandlerNode(declaration, body);
}
private final VariableDeclaration declaration;
private final List<StatementNode> body;
public ExceptionHandlerNode(VariableDeclaration declaration, List<StatementNode> body) {
this.declaration = declaration;
this.body = body;
}
public VariableDeclaration getDeclaration() {
return declaration;
}
public List<StatementNode> getBody() {
return body;
}
public Type getExceptionType() {
return declaration.getType();
}
public String getExceptionName() {
return declaration.getName();
}
@Override
public String toString() {
return "ExceptionHandlerNode(" +
"declaration=" + declaration +
", body=" + body +
')';
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ExceptionHandlerNode that = (ExceptionHandlerNode) o;
if (!declaration.equals(that.declaration)) return false;
return body.equals(that.body);
}
@Override
public int hashCode() {
int result = declaration.hashCode();
result = 31 * result + body.hashCode();
return result;
}
}
|