1
2
3
4
5
6 package gov.nist.secauto.metaschema.core.metapath.function;
7
8 import gov.nist.secauto.metaschema.core.metapath.type.ISequenceType;
9
10 import java.util.Objects;
11
12 import edu.umd.cs.findbugs.annotations.NonNull;
13
14 class ArgumentImpl implements IArgument {
15 @NonNull
16 private final String name;
17 @NonNull
18 private final ISequenceType sequenceType;
19
20 protected ArgumentImpl(@NonNull String name, @NonNull ISequenceType sequenceType) {
21 this.name = name;
22 this.sequenceType = sequenceType;
23 }
24
25 @Override
26 public String getName() {
27 return name;
28 }
29
30 @Override
31 public ISequenceType getSequenceType() {
32 return sequenceType;
33 }
34
35 @SuppressWarnings("null")
36 @Override
37 public String toSignature() {
38 StringBuilder builder = new StringBuilder();
39
40
41 builder.append(getName())
42 .append(" as ")
43 .append(getSequenceType().toSignature());
44
45 return builder.toString();
46 }
47
48 @Override
49 public int hashCode() {
50 return Objects.hash(name, sequenceType);
51 }
52
53 @Override
54 public boolean equals(Object obj) {
55 if (this == obj) {
56 return true;
57 }
58 if (obj == null || getClass() != obj.getClass()) {
59 return false;
60 }
61 ArgumentImpl other = (ArgumentImpl) obj;
62 return Objects.equals(name, other.name) && Objects.equals(sequenceType, other.sequenceType);
63 }
64 }