| 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 | 28 | public final class OctaveString implements OctaveObject { |
| 25 | |
|
| 26 | |
private static final int PRIME = 31; |
| 27 | |
|
| 28 | |
private String value; |
| 29 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 33 | 572 | public OctaveString(final String string) { |
| 34 | 572 | this.value = string; |
| 35 | 572 | } |
| 36 | |
|
| 37 | |
|
| 38 | |
|
| 39 | |
|
| 40 | |
|
| 41 | |
|
| 42 | |
|
| 43 | |
public String getString() { |
| 44 | 516 | return this.value; |
| 45 | |
} |
| 46 | |
|
| 47 | |
|
| 48 | |
|
| 49 | |
|
| 50 | |
|
| 51 | |
public void setString(final String string) { |
| 52 | 2 | this.value = string; |
| 53 | 2 | } |
| 54 | |
|
| 55 | |
@Override |
| 56 | |
public int hashCode() { |
| 57 | 0 | return (this.value == null) ? PRIME : this.value.hashCode(); |
| 58 | |
} |
| 59 | |
|
| 60 | |
@Override |
| 61 | |
public boolean equals(final Object obj) { |
| 62 | 28 | if (this == obj) { |
| 63 | 0 | return true; |
| 64 | |
} |
| 65 | 28 | if (obj == null || getClass() != obj.getClass()) { |
| 66 | 0 | return false; |
| 67 | |
} |
| 68 | 28 | final OctaveString other = (OctaveString) obj; |
| 69 | 28 | if (this.value == null) { |
| 70 | 0 | return other.value == null; |
| 71 | |
} |
| 72 | 28 | return this.value.equals(other.value); |
| 73 | |
} |
| 74 | |
|
| 75 | |
@Override |
| 76 | |
public OctaveString shallowCopy() { |
| 77 | 28 | return new OctaveString(this.value); |
| 78 | |
} |
| 79 | |
|
| 80 | |
@Override |
| 81 | |
public String toString() { |
| 82 | 0 | return "OctaveString[" + this.value + "]"; |
| 83 | |
} |
| 84 | |
|
| 85 | |
} |