KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > components > elementprocessor > impl > poi > hssf > elements > EPSolver


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
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.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements;
18
19 import org.apache.cocoon.components.elementprocessor.types.NumericConverter;
20 import org.apache.cocoon.components.elementprocessor.types.NumericResult;
21
22 import java.io.IOException JavaDoc;
23
24 /**
25  * No-op implementation of ElementProcessor to handle the "Solver" tag
26  *
27  * This element is a container with four atributes (TargetRow,
28  * TargetCol, and ProblemType are integers, and Inputs is a String)
29  *
30  * This element is not used in HSSFSerializer 1.0
31  *
32  * @author Marc Johnson (marc_johnson27591@hotmail.com)
33  * @version CVS $Id: EPSolver.java 30932 2004-07-29 17:35:38Z vgritsenko $
34  */

35 public class EPSolver extends BaseElementProcessor {
36     private NumericResult _target_row;
37     private NumericResult _target_col;
38     private NumericResult _problem_type;
39     private String JavaDoc _inputs;
40     private static final String JavaDoc _target_row_attribute = "TargetRow";
41     private static final String JavaDoc _target_col_attribute = "TargetCol";
42     private static final String JavaDoc _problem_type_attribute = "ProblemType";
43     private static final String JavaDoc _inputs_attribute = "Inputs";
44
45     /**
46      * constructor
47      */

48     public EPSolver() {
49         super(null);
50         _target_row = null;
51         _target_col = null;
52         _problem_type = null;
53         _inputs = null;
54     }
55
56     /**
57      * @return target column
58      * @exception IOException
59      */

60     public int getTargetCol() throws IOException JavaDoc {
61         if (_target_col == null) {
62             _target_col = NumericConverter.extractInteger(
63                     getValue(_target_col_attribute));
64         }
65         return _target_col.intValue();
66     }
67
68     /**
69      * @return target row
70      * @exception IOException
71      */

72     public int getTargetRow() throws IOException JavaDoc {
73         if (_target_row == null) {
74             _target_row = NumericConverter.extractInteger(
75                     getValue(_target_row_attribute));
76         }
77         return _target_row.intValue();
78     }
79
80     /**
81      * @return problem type
82      * @exception IOException
83      */

84     public int getProblemType() throws IOException JavaDoc {
85         if (_problem_type == null) {
86             _problem_type = NumericConverter.extractInteger(
87                     getValue(_problem_type_attribute));
88         }
89         return _problem_type.intValue();
90     }
91
92     /**
93      * @return inputs
94      */

95     public String JavaDoc getInputs() {
96         if (_inputs == null) {
97             String JavaDoc value = getValue(_inputs_attribute);
98
99             _inputs = (value == null) ? "" : value.trim();
100         }
101         return _inputs;
102     }
103 } // end public class EPSolver
104
Popular Tags