edu.psu.geovista.app.spreadsheet.formula
Class Cell

java.lang.Object
  extended byedu.psu.geovista.app.spreadsheet.formula.Cell

public class Cell
extends java.lang.Object


Field Summary
static int NULL
          Value Type
static int NUMBER
          The integer code that denotes the cell holds numbers.
static int TEXT
          The integer code that denotes the cell holds text.
static int UNKNOWN
          The integer code that denotes the cell holds a edu.psu.geovista.app.spreadsheet.formula.
 
Constructor Summary
Cell(java.util.Vector _container, SSTableModel tm)
          This constructor constructs a cell that will not have cells referencing it and are not formulas.
 
Method Summary
 boolean addOwner(Cell cell)
          protect against loop reference
 int compareTo(Cell x, boolean ascend)
          not finish yet, just for treeset String: if can't convert to number, alway on the top ."" is set to null in cell null<"": alway at the bottom number: always in middle
 void evaluate()
           
static java.lang.String getAbsCellAddress(java.awt.Point p)
          Given a cell's address in View(table) return absolute address in String format
 java.util.Vector getContainer()
          This method determines a cell is a edu.psu.geovista.app.spreadsheet.formula cell that has a error.
 SSTableModel getDataModel()
           
 Formula getFormula()
          This method returns the edu.psu.geovista.app.spreadsheet.formula associated with the cell or null if it does not exist.
static java.lang.String getRelCellAddress(java.awt.Point p)
          Given a cell's address in View(table) return relative address in String format
 java.lang.Object getValue()
          If it is a data cell, it returns the data of the cell.
 int getValueType()
          This method is useful for determining what information a cell holds.
 java.awt.Point getViewAddress()
          return the address of the cell in Table in form of (x,y) Need translate.
 java.lang.String getViewAddressText()
           
 boolean isDeleted()
          If the column or row contain the cell is deleted, the cell is set "deleted"
 boolean isFormula()
          This method returns true IFF it is a edu.psu.geovista.app.spreadsheet.formula cell
 void setAsFormula(boolean isf)
          This method sets the cell to be a edu.psu.geovista.app.spreadsheet.formula cell.
 void setDeleted(boolean d)
           
 void setFormula(Formula form)
           
 void setValue(java.lang.Object datum)
          Sets the value field of the cell.
 void setValueType(int t)
           
 java.lang.String toString()
          toString() method return same data as getValue(), but in different format toString() return String format for table.getValue() to paintCell() getValue() return Number for evaluate edu.psu.geovista.app.spreadsheet.formula called when paint cell
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NULL

public static final int NULL
Value Type

See Also:
Constant Field Values

TEXT

public static final int TEXT
The integer code that denotes the cell holds text.

See Also:
Constant Field Values

NUMBER

public static final int NUMBER
The integer code that denotes the cell holds numbers.

See Also:
Constant Field Values

UNKNOWN

public static final int UNKNOWN
The integer code that denotes the cell holds a edu.psu.geovista.app.spreadsheet.formula.

See Also:
Constant Field Values
Constructor Detail

Cell

public Cell(java.util.Vector _container,
            SSTableModel tm)
This constructor constructs a cell that will not have cells referencing it and are not formulas. Basically only used for creating the row and column labels.

Warning: Do not use this with Formulas

Method Detail

addOwner

public boolean addOwner(Cell cell)
protect against loop reference


evaluate

public void evaluate()

getFormula

public Formula getFormula()
This method returns the edu.psu.geovista.app.spreadsheet.formula associated with the cell or null if it does not exist.

Returns:
the edu.psu.geovista.app.spreadsheet.formula (string and internal object) or null if does not exist

setFormula

public void setFormula(Formula form)

getValue

public java.lang.Object getValue()
If it is a data cell, it returns the data of the cell. If it is a edu.psu.geovista.app.spreadsheet.formula, it returns the previously evaluated value of the edu.psu.geovista.app.spreadsheet.formula.

Returns:
the value (data or evaluated) of the cell

setValue

public void setValue(java.lang.Object datum)
Sets the value field of the cell.

Parameters:
datum - the object to set the value of cell to

setAsFormula

public void setAsFormula(boolean isf)
This method sets the cell to be a edu.psu.geovista.app.spreadsheet.formula cell. It puts the edu.psu.geovista.app.spreadsheet.formula object into the expression field. The Table of Cells is responsible for recalculating and setting the appropriate value in the value field of this cell.


getValueType

public int getValueType()
This method is useful for determining what information a cell holds. To check if a cell holds a certain type just see if getType() == edu.psu.geovista.app.spreadsheet.formula.Cell.CODE where CODE is any of the cell constants.

Returns:
the integer code of the type of data this cell holds

setValueType

public void setValueType(int t)

isFormula

public boolean isFormula()
This method returns true IFF it is a edu.psu.geovista.app.spreadsheet.formula cell

Returns:
true iff a edu.psu.geovista.app.spreadsheet.formula cell

isDeleted

public boolean isDeleted()
If the column or row contain the cell is deleted, the cell is set "deleted"


setDeleted

public void setDeleted(boolean d)

getDataModel

public SSTableModel getDataModel()

getContainer

public java.util.Vector getContainer()
This method determines a cell is a edu.psu.geovista.app.spreadsheet.formula cell that has a error.

Returns:
true if cell is an error cell public boolean isErrorCell() { return ((isFormula()) && (value instanceof ParserException)); }

toString

public java.lang.String toString()
toString() method return same data as getValue(), but in different format toString() return String format for table.getValue() to paintCell() getValue() return Number for evaluate edu.psu.geovista.app.spreadsheet.formula called when paint cell


compareTo

public int compareTo(Cell x,
                     boolean ascend)
not finish yet, just for treeset String: if can't convert to number, alway on the top ."" is set to null in cell null<"": alway at the bottom number: always in middle

Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

getViewAddress

public java.awt.Point getViewAddress()
return the address of the cell in Table in form of (x,y) Need translate. e.g. Row1 in Table is Row0 in TableModel


getViewAddressText

public java.lang.String getViewAddressText()

getRelCellAddress

public static java.lang.String getRelCellAddress(java.awt.Point p)
Given a cell's address in View(table) return relative address in String format


getAbsCellAddress

public static java.lang.String getAbsCellAddress(java.awt.Point p)
Given a cell's address in View(table) return absolute address in String format



Copyright © 1996-2003 GeoVista Center. All Rights Reserved.