]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/src/org/simantics/databoard/primitives/MutableString.java
Added addFirst/After/Before + remove SCL functions for Ordered Sets
[simantics/platform.git] / bundles / org.simantics.databoard / src / org / simantics / databoard / primitives / MutableString.java
1 /*******************************************************************************
2  *  Copyright (c) 2010 Association for Decentralized Information Management in
3  *  Industry THTH ry.
4  *  All rights reserved. This program and the accompanying materials
5  *  are made available under the terms of the Eclipse Public License v1.0
6  *  which accompanies this distribution, and is available at
7  *  http://www.eclipse.org/legal/epl-v10.html
8  *
9  *  Contributors:
10  *      VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.databoard.primitives;
13
14 public class MutableString implements java.io.Serializable, Comparable<String>, CharSequence {
15
16         private static final long serialVersionUID = 1L;
17         
18         public String value;
19         
20         public MutableString() {}
21         
22         public MutableString(String value) { this.value = value; }
23
24         public String getValue() {
25                 return value;
26         }
27         
28         public void setValue(String newValue) {
29                 this.value = newValue;
30         }
31         
32         @Override
33         public int compareTo(String o) {
34                 return value.compareTo(o);
35         }
36         
37         @Override
38         public int hashCode() {
39                 return value.hashCode();
40         }
41         
42         @Override
43         public boolean equals(Object obj) {
44                 if (obj == null) return false;
45                 if (obj == this) return true;
46                 
47                 return value.equals(obj);
48         }
49         
50         @Override
51         public String toString() {
52                 return value;
53         }
54
55         @Override
56         public char charAt(int index) {
57                 return value.charAt(index);
58         }
59
60         @Override
61         public int length() {
62                 return value.length();
63         }
64
65         @Override
66         public CharSequence subSequence(int start, int end) {
67                 return value.subSequence(start, end);
68         }
69         
70 }
71