1 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 import org.apache.cocoon.components.elementprocessor.types.Validator; 22 23 import java.io.IOException ; 24 25 36 public class EPConstr extends BaseElementProcessor { 37 private NumericResult _lcol; 38 private NumericResult _lrow; 39 private NumericResult _rcol; 40 private NumericResult _rrow; 41 private NumericResult _cols; 42 private NumericResult _rows; 43 private NumericResult _type; 44 private static final String _lcol_attribute = "Lcol"; 45 private static final String _lrow_attribute = "Lrow"; 46 private static final String _rcol_attribute = "Rcol"; 47 private static final String _rrow_attribute = "Rrow"; 48 private static final String _cols_attribute = "Cols"; 49 private static final String _rows_attribute = "Rows"; 50 private static final String _type_attribute = "Type"; 51 private static final Validator _type_validator = new Validator() { 52 public IOException validate(final Number number) { 53 return ConstraintType.isValid(number.intValue()) ? null 54 : new IOException ("\"" + number + "\" is not a legal value"); 55 } 56 }; 57 58 61 public EPConstr() { 62 super(null); 63 _lcol = null; 64 _lrow = null; 65 _rcol = null; 66 _rrow = null; 67 _cols = null; 68 _rows = null; 69 _type = null; 70 } 71 72 76 public int getLcol() throws IOException { 77 if (_lcol == null) { 78 _lcol = NumericConverter.extractNonNegativeInteger( 79 getValue(_lcol_attribute)); 80 } 81 return _lcol.intValue(); 82 } 83 84 88 public int getLrow() throws IOException { 89 if (_lrow == null) { 90 _lrow = NumericConverter.extractNonNegativeInteger( 91 getValue(_lrow_attribute)); 92 } 93 return _lrow.intValue(); 94 } 95 96 100 public int getRcol() throws IOException { 101 if (_rcol == null) { 102 _rcol = NumericConverter.extractNonNegativeInteger( 103 getValue(_rcol_attribute)); 104 } 105 return _rcol.intValue(); 106 } 107 108 112 public int getRrow() throws IOException { 113 if (_rrow == null) { 114 _rrow = NumericConverter.extractNonNegativeInteger( 115 getValue(_rrow_attribute)); 116 } 117 return _rrow.intValue(); 118 } 119 120 124 public int getCols() throws IOException { 125 if (_cols == null) { 126 _cols = NumericConverter.extractPositiveInteger( 127 getValue(_cols_attribute)); 128 } 129 return _cols.intValue(); 130 } 131 132 136 public int getRows() throws IOException { 137 if (_rows == null) { 138 _rows = NumericConverter.extractPositiveInteger( 139 getValue(_rows_attribute)); 140 } 141 return _rows.intValue(); 142 } 143 144 148 public int getType() throws IOException { 149 if (_type == null) { 150 _type = NumericConverter.extractInteger( 151 getValue(_type_attribute), _type_validator); 152 } 153 return _type.intValue(); 154 } 155 } | Popular Tags |