1
2
3
4
5
6 package gov.nist.secauto.metaschema.core.metapath.function;
7
8 import gov.nist.secauto.metaschema.core.metapath.item.IItem;
9 import gov.nist.secauto.metaschema.core.metapath.item.ISequence;
10
11 import java.util.List;
12 import java.util.Objects;
13
14 import edu.umd.cs.findbugs.annotations.NonNull;
15 import edu.umd.cs.findbugs.annotations.Nullable;
16
17
18
19
20
21
22
23
24
25
26
27 public final class CalledContext {
28 @NonNull
29 private final IFunction function;
30 @Nullable
31 private final IItem contextItem;
32 @NonNull
33 private final List<ISequence<?>> arguments;
34
35
36
37
38
39
40
41
42
43
44
45
46 public CalledContext(
47 @NonNull IFunction function,
48 @NonNull List<ISequence<?>> arguments,
49 @Nullable IItem contextItem) {
50 this.function = function;
51 this.contextItem = contextItem;
52 this.arguments = arguments;
53 }
54
55
56
57
58
59
60 @NonNull
61 public IFunction getFunction() {
62 return function;
63 }
64
65
66
67
68
69
70 @Nullable
71 public IItem getContextItem() {
72 return contextItem;
73 }
74
75
76
77
78
79
80 @NonNull
81 public List<ISequence<?>> getArguments() {
82 return arguments;
83 }
84
85 @Override
86 public int hashCode() {
87 final int prime = 31;
88 int result = 1;
89 result = prime * result + getFunction().hashCode();
90 return prime * result + Objects.hash(contextItem, arguments);
91 }
92
93 @SuppressWarnings("PMD.OnlyOneReturn")
94 @Override
95 public boolean equals(Object obj) {
96 if (this == obj) {
97 return true;
98 }
99 if (obj == null || getClass() != obj.getClass()) {
100 return false;
101 }
102 CalledContext other = (CalledContext) obj;
103 if (!getFunction().equals(other.getFunction())) {
104 return false;
105 }
106 return Objects.equals(function, other.function)
107 && Objects.equals(arguments, other.arguments)
108 && Objects.equals(contextItem, other.contextItem);
109 }
110 }