View Javadoc

1   /*
2    *  File: JaretTableCellImpl.java 
3    *  Copyright (c) 2004-2007  Peter Kliem (Peter.Kliem@jaret.de)
4    *  A commercial license is available, see http://www.jaret.de.
5    *
6    * All rights reserved. This program and the accompanying materials
7    * are made available under the terms of the Common Public License v1.0
8    * which accompanies this distribution, and is available at
9    * http://www.eclipse.org/legal/cpl-v10.html
10   */
11  package de.jaret.util.ui.table.model;
12  
13  /***
14   * Implementation of the IJaretTableCell.
15   * 
16   * @author Peter Kliem
17   * @version $Id: JaretTableCellImpl.java 175 2007-01-05 00:01:18Z olk $
18   */
19  public class JaretTableCellImpl implements IJaretTableCell {
20      /*** the row. */
21      protected IRow _row;
22  
23      /*** the column. */
24      protected IColumn _column;
25  
26      /***
27       * Construct a table cell instance.
28       * 
29       * @param row the row
30       * @param column the column
31       */
32      public JaretTableCellImpl(IRow row, IColumn column) {
33          _column = column;
34          _row = row;
35      }
36  
37      /***
38       * @return Returns the column.
39       */
40      public IColumn getColumn() {
41          return _column;
42      }
43  
44      /***
45       * @return Returns the row.
46       */
47      public IRow getRow() {
48          return _row;
49      }
50  
51      /***
52       * {@inheritDoc}
53       */
54      @Override
55      public boolean equals(Object o) {
56          if (o == null || !(o instanceof IJaretTableCell)) {
57              return false;
58          }
59          IJaretTableCell cell = (IJaretTableCell) o;
60          return _row.equals(cell.getRow()) && _column.equals(cell.getColumn());
61      }
62  
63      /***
64       * {@inheritDoc}
65       */
66      @Override
67      public int hashCode() {
68          return _row.hashCode() * _column.hashCode();
69      }
70  }