blob: 81964fb47171339887a061a7ff9f26841000993d (
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
|
package org.zwobble.couscous.interpreter.values;
import java.util.List;
import java.util.function.BiFunction;
import org.zwobble.couscous.ast.TypeName;
import org.zwobble.couscous.interpreter.Environment;
public final class MethodValue implements Callable {
private final List<TypeName> argumentTypes;
private final BiFunction<Environment, MethodCallArguments<InterpreterValue>, InterpreterValue> apply;
public InterpreterValue apply(Environment environment, MethodCallArguments<InterpreterValue> arguments) {
return apply.apply(environment, arguments);
}
public MethodValue(final List<TypeName> argumentTypes, final BiFunction<Environment, MethodCallArguments<InterpreterValue>, InterpreterValue> apply) {
this.argumentTypes = argumentTypes;
this.apply = apply;
}
public List<TypeName> getArgumentTypes() {
return this.argumentTypes;
}
@java.lang.Override
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
if (!(o instanceof MethodValue)) return false;
final MethodValue other = (MethodValue)o;
final java.lang.Object this$argumentTypes = this.getArgumentTypes();
final java.lang.Object other$argumentTypes = other.getArgumentTypes();
if (this$argumentTypes == null ? other$argumentTypes != null : !this$argumentTypes.equals(other$argumentTypes)) return false;
final java.lang.Object this$apply = this.apply;
final java.lang.Object other$apply = other.apply;
if (this$apply == null ? other$apply != null : !this$apply.equals(other$apply)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
final int PRIME = 59;
int result = 1;
final java.lang.Object $argumentTypes = this.getArgumentTypes();
result = result * PRIME + ($argumentTypes == null ? 43 : $argumentTypes.hashCode());
final java.lang.Object $apply = this.apply;
result = result * PRIME + ($apply == null ? 43 : $apply.hashCode());
return result;
}
@java.lang.Override
public java.lang.String toString() {
return "MethodValue(argumentTypes=" + this.getArgumentTypes() + ", apply=" + this.apply + ")";
}
}
|