View Javadoc

1   /**
2    * Copyright (c) 2008-2012, http://www.snakeyaml.org
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  package org.yaml.snakeyaml.scanner;
17  
18  import org.yaml.snakeyaml.error.Mark;
19  
20  /**
21   * Simple keys treatment.
22   * <p>
23   * Helper class for {@link ScannerImpl}.
24   * </p>
25   * 
26   * @see ScannerImpl
27   */
28  final class SimpleKey {
29      private int tokenNumber;
30      private boolean required;
31      private int index;
32      private int line;
33      private int column;
34      private Mark mark;
35  
36      public SimpleKey(int tokenNumber, boolean required, int index, int line, int column, Mark mark) {
37          this.tokenNumber = tokenNumber;
38          this.required = required;
39          this.index = index;
40          this.line = line;
41          this.column = column;
42          this.mark = mark;
43      }
44  
45      public int getTokenNumber() {
46          return this.tokenNumber;
47      }
48  
49      public int getColumn() {
50          return this.column;
51      }
52  
53      public Mark getMark() {
54          return mark;
55      }
56  
57      public int getIndex() {
58          return index;
59      }
60  
61      public int getLine() {
62          return line;
63      }
64  
65      public boolean isRequired() {
66          return required;
67      }
68  
69      @Override
70      public String toString() {
71          return "SimpleKey - tokenNumber=" + tokenNumber + " required=" + required + " index="
72                  + index + " line=" + line + " column=" + column;
73      }
74  }