1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.millscript.office.spreadsheet.rows;
22
23 import org.millscript.millscript.datatypes.Deferred;
24 import org.millscript.office.spreadsheet.Cell;
25 import org.millscript.office.spreadsheet.CellRef;
26 import org.millscript.office.spreadsheet.ColumnRef;
27 import org.millscript.office.spreadsheet.RowRef;
28
29 /**
30 *
31 */
32 public class RowCellRefImpl extends Deferred implements CellRef {
33
34 private Cell cell;
35
36 private int indexToColumn;
37
38 private RowRef rowRef;
39
40 /**
41 *
42 */
43 public RowCellRefImpl( final RowRef row, final int col, final Cell c ) {
44 this.cell = c;
45 this.indexToColumn = col;
46 this.rowRef = row;
47 }
48
49 /**
50 * @see org.millscript.office.spreadsheet.CellRef#getCalculatedCellContents()
51 */
52 public Object getCalculatedCellContents() {
53 return this.cell.getCalculatedContents( this );
54 }
55
56 /**
57 * @see org.millscript.millscript.datatypes.Deferred#get()
58 */
59 @Override
60 public Object get() {
61 return this.cell == null ? null : this.getCalculatedCellContents();
62 }
63
64 /**
65 * @see org.millscript.office.spreadsheet.CellRef#getCell()
66 */
67 public Cell getCell() {
68 return this.cell;
69 }
70
71 /**
72 * @see org.millscript.office.spreadsheet.CellRef#getColumnIndex()
73 */
74 public int getColumnIndex() {
75 return this.indexToColumn;
76 }
77
78 /**
79 * @see org.millscript.office.spreadsheet.CellRef#getColumnRef()
80 */
81 public ColumnRef getColumnRef() {
82 return this.rowRef.getWorksheetRef().getColumnRef( this.indexToColumn );
83 }
84
85 /**
86 * @see org.millscript.office.spreadsheet.CellRef#getRowIndex()
87 */
88 public int getRowIndex() {
89 return this.getRowRef().getRowIndex();
90 }
91
92 /**
93 * @see org.millscript.office.spreadsheet.CellRef#getRowRef()
94 */
95 public RowRef getRowRef() {
96 return this.rowRef;
97 }
98
99 }