root / sqs-reader / src / main / java / net / sqs2 / omr / result / path / AnswerItemPath.java @ 1847

View | Annotate | Download (1.6 KB)

1
/*
2
3
 AnswerItemPath.java
4
5
 Copyright 2008 KUBO Hiroya (hiroya@cuc.ac.jp).
6
7
 Licensed under the Apache License, Version 2.0 (the "License");
8
 you may not use this file except in compliance with the License.
9
 You may obtain a copy of the License at
10
11
 http://www.apache.org/licenses/LICENSE-2.0
12
13
 Unless required by applicable law or agreed to in writing, software
14
 distributed under the License is distributed on an "AS IS" BASIS,
15
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
 See the License for the specific language governing permissions and
17
 limitations under the License.
18
19
 Created on 2008/01/13
20
21
 */
22
package net.sqs2.omr.result.path;
23
24
/**
25
 * This class is used in EditAnswerServlet(EditMarkArea)
26
 * @author hiroya
27
 *
28
 */
29
public class AnswerItemPath extends SingleRowSingleQuestionPath {
30
31
        protected int answerItemIndex;
32
        
33
        public AnswerItemPath(String pathInfo) {
34
                super(pathInfo);
35
                try{
36
                        if(5 < paramDepth){
37
                                this.answerItemIndex = Integer.parseInt(pathInfoArray[5]);
38
                        }
39
                }catch(NumberFormatException ignore){
40
                        paramDepth = -1;
41
                }
42
        }
43
44
        public AnswerItemPath(long sessionID, 
45
                        int masterIndex, int tableIndex, int rowIndex, int questionIndex, int answerItemIndex) {
46
                super(sessionID, masterIndex, tableIndex, rowIndex, questionIndex);
47
                this.answerItemIndex = answerItemIndex;
48
        }
49
        
50
        public int getAnswerItemIndex(){
51
                if(5 < paramDepth){
52
                        return this.answerItemIndex;
53
                }
54
                throw new IllegalArgumentException();
55
        }
56
        
57
        public String toString(){
58
                return super.toString()+"/"+answerItemIndex;
59
        }
60
61
}