001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements;
019:
020: import org.apache.cocoon.components.elementprocessor.types.NumericConverter;
021: import org.apache.cocoon.components.elementprocessor.types.NumericResult;
022:
023: import java.io.IOException;
024:
025: /**
026: * No-op implementation of ElementProcessor to handle the "Solver" tag
027: *
028: * This element is a container with four atributes (TargetRow,
029: * TargetCol, and ProblemType are integers, and Inputs is a String)
030: *
031: * This element is not used in HSSFSerializer 1.0
032: *
033: * @author Marc Johnson (marc_johnson27591@hotmail.com)
034: * @version CVS $Id: EPSolver.java 433543 2006-08-22 06:22:54Z crossley $
035: */
036: public class EPSolver extends BaseElementProcessor {
037: private NumericResult _target_row;
038: private NumericResult _target_col;
039: private NumericResult _problem_type;
040: private String _inputs;
041: private static final String _target_row_attribute = "TargetRow";
042: private static final String _target_col_attribute = "TargetCol";
043: private static final String _problem_type_attribute = "ProblemType";
044: private static final String _inputs_attribute = "Inputs";
045:
046: /**
047: * constructor
048: */
049: public EPSolver() {
050: super (null);
051: _target_row = null;
052: _target_col = null;
053: _problem_type = null;
054: _inputs = null;
055: }
056:
057: /**
058: * @return target column
059: * @exception IOException
060: */
061: public int getTargetCol() throws IOException {
062: if (_target_col == null) {
063: _target_col = NumericConverter
064: .extractInteger(getValue(_target_col_attribute));
065: }
066: return _target_col.intValue();
067: }
068:
069: /**
070: * @return target row
071: * @exception IOException
072: */
073: public int getTargetRow() throws IOException {
074: if (_target_row == null) {
075: _target_row = NumericConverter
076: .extractInteger(getValue(_target_row_attribute));
077: }
078: return _target_row.intValue();
079: }
080:
081: /**
082: * @return problem type
083: * @exception IOException
084: */
085: public int getProblemType() throws IOException {
086: if (_problem_type == null) {
087: _problem_type = NumericConverter
088: .extractInteger(getValue(_problem_type_attribute));
089: }
090: return _problem_type.intValue();
091: }
092:
093: /**
094: * @return inputs
095: */
096: public String getInputs() {
097: if (_inputs == null) {
098: String value = getValue(_inputs_attribute);
099:
100: _inputs = (value == null) ? "" : value.trim();
101: }
102: return _inputs;
103: }
104: } // end public class EPSolver
|