View Javadoc

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