JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / src / com / stevesoft / pat / wrap / StringWrap.java
1 //
2 // This software is now distributed according to
3 // the Lesser Gnu Public License.  Please see
4 // http://www.gnu.org/copyleft/lesser.txt for
5 // the details.
6 //    -- Happy Computing!
7 //
8 package com.stevesoft.pat.wrap;
9
10 import com.stevesoft.pat.*;
11
12 /**
13  * A basic wrapper for the String object. Regex does not search String directly
14  * any longer, it searches StringLike.
15  */
16 public class StringWrap implements StringLike
17 {
18   String s;
19
20   public StringWrap(String s)
21   {
22     this.s = s;
23   }
24
25   public String toString()
26   {
27     return s;
28   }
29
30   public char charAt(int i)
31   {
32     return s.charAt(i);
33   }
34
35   public int length()
36   {
37     return s.length();
38   }
39
40   public String substring(int i1, int i2)
41   {
42     return s.substring(i1, i2);
43   }
44
45   public Object unwrap()
46   {
47     return s;
48   }
49
50   public BasicStringBufferLike newStringBufferLike()
51   {
52     return new StringBufferWrap();
53   }
54
55   public int indexOf(char c)
56   {
57     return s.indexOf(c);
58   }
59 }