1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package eu.simuline.octave.type;
20
21
22
23
24 public final class OctaveString implements OctaveObject {
25
26 private static final int PRIME = 31;
27
28 private String value;
29
30
31
32
33 public OctaveString(final String string) {
34 this.value = string;
35 }
36
37
38
39
40
41
42
43 public String getString() {
44 return this.value;
45 }
46
47
48
49
50
51 public void setString(final String string) {
52 this.value = string;
53 }
54
55 @Override
56 public int hashCode() {
57 return (this.value == null) ? PRIME : this.value.hashCode();
58 }
59
60 @Override
61 public boolean equals(final Object obj) {
62 if (this == obj) {
63 return true;
64 }
65 if (obj == null || getClass() != obj.getClass()) {
66 return false;
67 }
68 final OctaveString/../../eu/simuline/octave/type/OctaveString.html#OctaveString">OctaveString other = (OctaveString) obj;
69 if (this.value == null) {
70 return other.value == null;
71 }
72 return this.value.equals(other.value);
73 }
74
75 @Override
76 public OctaveString shallowCopy() {
77 return new OctaveString(this.value);
78 }
79
80 @Override
81 public String toString() {
82 return "OctaveString[" + this.value + "]";
83 }
84
85 }