1 /*
2  * Copyright (C) 2008-2012  OMRON SOFTWARE Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package jp.co.omronsoft.openwnn;
18 
19 /**
20  * The information container class of segment in a string.
21  *
22  * This class defines information of a segment in a string, such as a character, a word or a clause.
23  * It is used to represent the layers of the composing text ({@link ComposingText}).
24  *
25  * @author Copyright (C) 2009 OMRON SOFTWARE CO., LTD. All rights reserved.
26  */
27 public class StrSegment  {
28     /** The string */
29     public String string;
30     /** The start position */
31     public int from;
32     /** The end position */
33     public int to;
34 
35     /**
36      * Constructor
37      */
StrSegment()38     public StrSegment() {
39         this(null, -1, -1);
40     }
41 
42     /**
43      * Constructor
44      *
45      * @param str       The string
46      */
StrSegment(String str)47     public StrSegment(String str) {
48         this(str, -1, -1);
49     }
50 
51     /**
52      * Constructor
53      *
54      * @param chars     The array of characters
55      */
StrSegment(char[] chars)56     public StrSegment(char[] chars) {
57         this(new String(chars), -1, -1);
58     }
59 
60     /**
61      * Constructor
62      *
63      * @param str       The string
64      * @param from      The start position
65      * @param to        The end position
66      */
StrSegment(String str, int from, int to)67     public StrSegment(String str, int from, int to) {
68         this.string = str;
69         this.from = from;
70         this.to = to;
71     }
72 }
73