You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by jo...@apache.org on 2003/06/14 02:26:43 UTC

cvs commit: cocoon-2.0/src/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements EPCell.java

joerg       2003/06/13 17:26:43

  Modified:    src/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements
                        EPCell.java
  Log:
  fixed javadoc error, code formatting
  
  Revision  Changes    Path
  1.2       +77 -146   cocoon-2.0/src/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPCell.java
  
  Index: EPCell.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.0/src/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPCell.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EPCell.java	9 Mar 2003 00:01:37 -0000	1.1
  +++ EPCell.java	14 Jun 2003 00:26:43 -0000	1.2
  @@ -60,66 +60,56 @@
   import java.io.IOException;
   
   /**
  - * implementation of ElementProcessor to handle the "Cell" tag
  - *
  + * Implementation of ElementProcessor to handle the "Cell" tag.
    * This element has several attributes and may contain other elements.
    *
    * @author Marc Johnson (marc_johnson27591@hotmail.com)
    */
  +public class EPCell extends BaseElementProcessor {
   
  -public class EPCell
  -    extends BaseElementProcessor
  -{
  -    private Cell                   _cell;
  -    private NumericResult          _col;
  -    private NumericResult          _row;
  -    private NumericResult          _expr_id;
  -    private NumericResult          _cols;
  -    private NumericResult          _rows;
  -    private NumericResult          _value_type;
  -    private String                 _value_format;
  -    private boolean                _expr_id_fetched;
  -    private boolean                _cols_fetched;
  -    private boolean                _rows_fetched;
  -    private boolean                _value_type_fetched;
  -    private boolean                _value_format_fetched;
  -    private static final String    _col_attribute          = "Col";
  -    private static final String    _row_attribute          = "Row";
  -    private static final String    _expr_id_attribute      = "ExprID";
  -    private static final String    _cols_attribute         = "Cols";
  -    private static final String    _rows_attribute         = "Rows";
  -    private static final String    _value_type_attribute   = "ValueType";
  -    private static final String    _value_format_attribute = "ValueFormat";
  -    private static final Validator _cell_type_validator    = new Validator()
  -    {
  -        public IOException validate(final Number number)
  -        {
  -            return CellType.isValid(number.intValue()) ? null
  -                                                       : new IOException(
  -                                                           "\"" + number
  -                                                           + "\" is not a legal value");
  +    private Cell _cell;
  +    private NumericResult _col;
  +    private NumericResult _row;
  +    private NumericResult _expr_id;
  +    private NumericResult _cols;
  +    private NumericResult _rows;
  +    private NumericResult _value_type;
  +    private String _value_format;
  +    private boolean _expr_id_fetched;
  +    private boolean _cols_fetched;
  +    private boolean _rows_fetched;
  +    private boolean _value_type_fetched;
  +    private boolean _value_format_fetched;
  +    private static final String _col_attribute = "Col";
  +    private static final String _row_attribute = "Row";
  +    private static final String _expr_id_attribute = "ExprID";
  +    private static final String _cols_attribute = "Cols";
  +    private static final String _rows_attribute = "Rows";
  +    private static final String _value_type_attribute = "ValueType";
  +    private static final String _value_format_attribute = "ValueFormat";
  +    private static final Validator _cell_type_validator = new Validator() {
  +        public IOException validate(final Number number) {
  +            return CellType.isValid(number.intValue()) ? null : new IOException("\"" + number + "\" is not a legal value");
           }
       };
   
       /**
        * constructor
        */
  -
  -    public EPCell()
  -    {
  +    public EPCell() {
           super(null);
  -        _cell                 = null;
  -        _col                  = null;
  -        _row                  = null;
  -        _expr_id              = null;
  -        _cols                 = null;
  -        _rows                 = null;
  -        _value_type           = null;
  -        _value_format         = null;
  -        _expr_id_fetched      = false;
  -        _cols_fetched         = false;
  -        _rows_fetched         = false;
  -        _value_type_fetched   = false;
  +        _cell = null;
  +        _col = null;
  +        _row = null;
  +        _expr_id = null;
  +        _cols = null;
  +        _rows = null;
  +        _value_type = null;
  +        _value_format = null;
  +        _expr_id_fetched = false;
  +        _cols_fetched = false;
  +        _rows_fetched = false;
  +        _value_type_fetched = false;
           _value_format_fetched = false;
       }
   
  @@ -128,14 +118,9 @@
        *
        * @exception IOException
        */
  -
  -    public int getColumn()
  -        throws IOException
  -    {
  -        if (_col == null)
  -        {
  -            _col = NumericConverter
  -                .extractNonNegativeInteger(getValue(_col_attribute));
  +    public int getColumn() throws IOException {
  +        if (_col == null) {
  +            _col = NumericConverter.extractNonNegativeInteger(getValue(_col_attribute));
           }
           return _col.intValue();
       }
  @@ -145,14 +130,9 @@
        *
        * @exception IOException
        */
  -
  -    public int getRow()
  -        throws IOException
  -    {
  -        if (_row == null)
  -        {
  -            _row = NumericConverter
  -                .extractNonNegativeInteger(getValue(_row_attribute));
  +    public int getRow() throws IOException {
  +        if (_row == null) {
  +            _row = NumericConverter.extractNonNegativeInteger(getValue(_row_attribute));
           }
           return _row.intValue();
       }
  @@ -163,18 +143,11 @@
        * @exception IOException
        * @exception NullPointerException
        */
  -
  -    public int getExpressionId()
  -        throws IOException, NullPointerException
  -    {
  -        if (!_expr_id_fetched)
  -        {
  +    public int getExpressionId() throws IOException, NullPointerException {
  +        if (!_expr_id_fetched) {
               String valueString = getValue(_expr_id_attribute);
  -
  -            if (valueString != null)
  -            {
  -                _expr_id =
  -                    NumericConverter.extractPositiveInteger(valueString);
  +            if (valueString != null) {
  +                _expr_id = NumericConverter.extractPositiveInteger(valueString);
               }
               _expr_id_fetched = true;
           }
  @@ -187,16 +160,10 @@
        * @exception IOException
        * @exception NullPointerException
        */
  -
  -    public int getColumns()
  -        throws IOException, NullPointerException
  -    {
  -        if (!_cols_fetched)
  -        {
  +    public int getColumns() throws IOException, NullPointerException {
  +        if (!_cols_fetched) {
               String valueString = getValue(_cols_attribute);
  -
  -            if (valueString != null)
  -            {
  +            if (valueString != null) {
                   _cols = NumericConverter.extractPositiveInteger(valueString);
               }
               _cols_fetched = true;
  @@ -210,16 +177,10 @@
        * @exception IOException
        * @exception NullPointerException
        */
  -
  -    public int getRows()
  -        throws IOException, NullPointerException
  -    {
  -        if (!_rows_fetched)
  -        {
  +    public int getRows() throws IOException, NullPointerException {
  +        if (!_rows_fetched) {
               String valueString = getValue(_rows_attribute);
  -
  -            if (valueString != null)
  -            {
  +            if (valueString != null) {
                   _rows = NumericConverter.extractPositiveInteger(valueString);
               }
               _rows_fetched = true;
  @@ -230,21 +191,14 @@
       /**
        * @return cell type as a public member of CellType
        *
  -     * @exception IOException, NullPointerException
  +     * @exception IOException
        * @exception NullPointerException
        */
  -
  -    public int getCellType()
  -        throws IOException, NullPointerException
  -    {
  -        if (!_value_type_fetched)
  -        {
  +    public int getCellType() throws IOException, NullPointerException {
  +        if (!_value_type_fetched) {
               String valueString = getValue(_value_type_attribute);
  -
  -            if (valueString != null)
  -            {
  -                _value_type = NumericConverter.extractInteger(valueString,
  -                        _cell_type_validator);
  +            if (valueString != null) {
  +                _value_type = NumericConverter.extractInteger(valueString, _cell_type_validator);
               }
               _value_type_fetched = true;
           }
  @@ -256,52 +210,34 @@
        *
        * @exception IOException
        */
  -
  -    public String getFormat()
  -        throws IOException
  -    {
  -        if (!_value_format_fetched)
  -        {
  -            _value_format         = getValue(_value_format_attribute);
  +    public String getFormat() throws IOException {
  +        if (!_value_format_fetched) {
  +            _value_format = getValue(_value_format_attribute);
               _value_format_fetched = true;
           }
           return _value_format;
       }
   
       /**
  -     * Override of Initialize() implementation
  -     *
  +     * Override of initialize() implementation
        * @param attributes the array of Attribute instances; may be
        *                   empty, will never be null
        * @param parent the parent ElementProcessor; may be null
        *
        * @exception IOException if anything is wrong
        */
  -
  -    public void initialize(final Attribute [] attributes,
  -                           final ElementProcessor parent)
  -        throws IOException
  -    {
  +    public void initialize(final Attribute[] attributes, final ElementProcessor parent) throws IOException {
           super.initialize(attributes, parent);
           int cellType = -1;
  -
  -        try
  -        {
  +        try {
               cellType = getCellType();
  +        } catch (NullPointerException ignored) {
           }
  -        catch (NullPointerException ignored)
  -        {
  -        }
  -        _cell = getSheet().getRow(( short ) getRow()).createCell(getColumn(),
  -                                  cellType);
  -        
  -       
  -    }
  - 
  -    public String getContent()
  -    {
  -      String content = getData();
  -      return content;
  +        _cell = getSheet().getRow((short)getRow()).createCell(getColumn(), cellType);
  +    }
  +
  +    public String getContent() {
  +        return getData();
       }
   
       /**
  @@ -309,14 +245,11 @@
        *
        * @exception IOException
        */
  -
  -    public void endProcessing() throws IOException
  -    {
  -      String content = getContent();
  -      if (content != null && !content.trim().equals(""))
  -      {
  -        getCell().setContent(getContent());
  -      }
  +    public void endProcessing() throws IOException {
  +        String content = getContent();
  +        if (content != null && !content.trim().equals("")) {
  +            getCell().setContent(getContent());
  +        }
       }
   
       /**
  @@ -324,9 +257,7 @@
        *
        * @return the cell
        */
  -
  -    protected Cell getCell()
  -    {
  +    protected Cell getCell() {
           return _cell;
       }
   }   // end public class EPCell