1 /*
2 * Copyright 2013 the original author or authors.
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 com.orangesignal.csv;
18
19 import java.io.Serializable;
20
21 /**
22 * {@link CsvToken} を実装したデフォルトの実装クラスを提供します。
23 *
24 * @author Koji Sugisawa
25 */
26 public class SimpleCsvToken implements Serializable, CsvToken {
27
28 private static final long serialVersionUID = 9180143360016401191L;
29
30 /**
31 * トークンの値を保持します。
32 */
33 private String value;
34
35 /**
36 * トークンの開始物理行番号を保持します。
37 */
38 private int startLineNumber;
39
40 /**
41 * トークンの終了物理行番号を保持します。
42 */
43 private int endLineNumber;
44
45 /**
46 * トークンが囲み文字で囲まれていたかどうかを保持します。
47 */
48 private boolean enclosed;
49
50 /**
51 * デフォルトコンストラクタです。
52 */
53 protected SimpleCsvToken() {
54 }
55
56 /**
57 * コンストラクタです。
58 *
59 * @param value トークンの値
60 * @param start トークンの開始物理行番号
61 * @param end トークンの終了物理行番号
62 * @param enclosed トークンが囲み文字で囲まれていたかどうか
63 */
64 public SimpleCsvToken(final String value, final int start, final int end, final boolean enclosed) {
65 this.value = value;
66 this.startLineNumber = start;
67 this.endLineNumber = end;
68 this.enclosed = enclosed;
69 }
70
71 @Override public String getValue() { return value; }
72 @Override public int getStartLineNumber() { return startLineNumber; }
73 @Override public int getEndLineNumber() { return endLineNumber; }
74 @Override public boolean isEnclosed() { return enclosed; }
75
76 }