1
2
3
4
5
6
7
8
9
10
11
12 package org.hyphenType.datastructure.parser.option;
13
14 import java.lang.reflect.Method;
15 import java.util.Collections;
16 import java.util.List;
17
18 import org.hyphenType.datastructure.parser.StructureElement;
19
20
21
22
23 public class StructureOption extends StructureElement implements Comparable<StructureOption> {
24
25 public final String description;
26 public final List<String> alternatives;
27 public final StructureOptionValue value;
28 public final StructureOptionMapValue map;
29 public final List<StructureOptionArgument> arguments;
30
31 public StructureOption(Method method, String description, List<String> alternatives, StructureOptionValue value, StructureOptionMapValue map, List<StructureOptionArgument> arguments) {
32 super(method);
33 this.description = description;
34 this.alternatives = Collections.unmodifiableList(alternatives);
35 this.value = value;
36 this.map = map;
37 this.arguments = Collections.unmodifiableList(arguments);
38 }
39
40 @Override
41 public String toString() {
42 return "[alternatives = " + alternatives + ", method = " + method + ", value = " + value + " ]";
43 }
44
45 @Override
46 public boolean equals(Object obj) {
47 if (!(obj instanceof StructureOption))
48 return false;
49 StructureOption other = (StructureOption) obj;
50 return other.method.equals(this.method);
51 }
52
53 @Override
54 public int hashCode() {
55 return method.hashCode();
56 }
57
58 @Override
59 public int compareTo(StructureOption o) {
60 return this.toString().compareTo(o.toString());
61 }
62 }