Spreadsheet Toolkit

corpus.excel
Class WorkBook

java.lang.Object
  |
  +--corpus.excel.Component
        |
        +--corpus.excel.WorkBook
All Implemented Interfaces:
java.io.Serializable

public class WorkBook
extends Component

Used to store the internal representation of an excel file. This will be the data that is used to display the worksheet.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class corpus.excel.Component
haltOnErrors
 
Constructor Summary
WorkBook(java.lang.String name)
          Construct a new WorkBook
 
Method Summary
 void add(WorkSheet newSheet)
          Adds a new WorkSheet to the WorkBook
 void display()
          Displays the contents of this WorkBook using a tabbed table browser.
 Cell getCell(int depth, int col, int row)
          Returns the cell in a specific (col,row) pair and sheet depth
 java.lang.String[] getSheetNames()
          The names of the WorkSheets.
 java.lang.String getWorkBookName()
           
 WorkSheet getWorkSheet(int i)
          Get the WorkSheet at depth i
 java.util.Iterator iterator()
          An iterator to the WorkSheets contained in the WorkBook.
static WorkBook load(java.lang.String path)
          Load the saved version of the workbook.
static WorkBook loadDiskRaw(java.lang.String path, boolean api)
          Try to load from serialised disk version.
static WorkBook loadRaw(java.lang.String path, boolean api)
          Uses Extractor to read the excel file and save a workbook to disk.
static void main(java.lang.String[] args)
          Run tests, metrics and visualisations.
 int maxTreeDepth()
          Find maximum depth of dependency tree
 java.lang.String metricsFunctionCatagory(boolean header)
          Breaks down the functions used into catagories.
static Grid occupancyGrid(WorkBook wb)
          Counts the number of times each cell is occupied in the worksheet grids and returns the result in a Grid of Integers.
 int occupiedCells()
          Report number of occupied cells in each worksheet
 int orphanCount()
          Report number of orphans at each worksheet
 void print()
          Print all info.
 void process()
          Called after basic loading is complete, perfrom data structure init
 void save(java.lang.String path)
          Write out to disk
 void setExcelVersion(java.lang.String version)
          The excel version used in the spreadsheet
 void setReadUsing(java.lang.String readUsing)
          The API used to read the spreadsheet.
 void setWorkBookName(java.lang.String name)
           
static Grid sheetOccupancyGrid(WorkBook wb)
          Increases the count for each cell if it is within the total occupied area for the Worksheet.
 int size()
          How many worksheets the workbook has.
 java.lang.String toHTMLString()
          Converts information about this component into an HTML formatted String.
 java.lang.String toString()
          Dump String version
 java.lang.String treeToGraph()
          Convert the dependency tree into a file, node-edge-node.
 java.lang.String treeToString()
          Convert the dependency tree into a file, used for fisheye views.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WorkBook

public WorkBook(java.lang.String name)
Construct a new WorkBook

Parameters:
name - The name of the WorkBook (may include path details)
Method Detail

add

public void add(WorkSheet newSheet)
Adds a new WorkSheet to the WorkBook


size

public int size()
How many worksheets the workbook has.


getWorkSheet

public WorkSheet getWorkSheet(int i)
Get the WorkSheet at depth i


iterator

public java.util.Iterator iterator()
An iterator to the WorkSheets contained in the WorkBook.


getSheetNames

public java.lang.String[] getSheetNames()
The names of the WorkSheets.


getWorkBookName

public java.lang.String getWorkBookName()

setWorkBookName

public void setWorkBookName(java.lang.String name)

setExcelVersion

public void setExcelVersion(java.lang.String version)
The excel version used in the spreadsheet


setReadUsing

public void setReadUsing(java.lang.String readUsing)
The API used to read the spreadsheet.


getCell

public Cell getCell(int depth,
                    int col,
                    int row)
Returns the cell in a specific (col,row) pair and sheet depth


save

public void save(java.lang.String path)
Write out to disk

Parameters:
path - The disk location to write to.
See Also:
load(String)

load

public static WorkBook load(java.lang.String path)
Load the saved version of the workbook.

Parameters:
path - The location to load from.
Returns:
the WorkBook, else null.
See Also:
save(String)

loadRaw

public static WorkBook loadRaw(java.lang.String path,
                               boolean api)
Uses Extractor to read the excel file and save a workbook to disk.

Parameters:
api - true will use JExcelRead while false will use IBMExcelAccessor.

loadDiskRaw

public static WorkBook loadDiskRaw(java.lang.String path,
                                   boolean api)
Try to load from serialised disk version. If that fails loadRaw.

See Also:
load(String), loadRaw(String,boolean)

process

public void process()
Called after basic loading is complete, perfrom data structure init


toString

public java.lang.String toString()
Dump String version

Specified by:
toString in class Component

toHTMLString

public java.lang.String toHTMLString()
Converts information about this component into an HTML formatted String.

Specified by:
toHTMLString in class Component

print

public void print()
Print all info.


display

public void display()
Displays the contents of this WorkBook using a tabbed table browser.

See Also:
SpreadsheetTableTabbed

treeToString

public java.lang.String treeToString()
Convert the dependency tree into a file, used for fisheye views.


treeToGraph

public java.lang.String treeToGraph()
Convert the dependency tree into a file, node-edge-node.


occupiedCells

public int occupiedCells()
Report number of occupied cells in each worksheet


orphanCount

public int orphanCount()
Report number of orphans at each worksheet


maxTreeDepth

public int maxTreeDepth()
Find maximum depth of dependency tree


metricsFunctionCatagory

public java.lang.String metricsFunctionCatagory(boolean header)
Breaks down the functions used into catagories.


main

public static void main(java.lang.String[] args)
Run tests, metrics and visualisations.


occupancyGrid

public static Grid occupancyGrid(WorkBook wb)
Counts the number of times each cell is occupied in the worksheet grids and returns the result in a Grid of Integers. Finer grain than sheetOccupancyGrid(WorkBook) Counts occupied cells.

Parameters:
wb - The workbook to examine.
See Also:
sheetOccupancyGrid(WorkBook)

sheetOccupancyGrid

public static Grid sheetOccupancyGrid(WorkBook wb)
Increases the count for each cell if it is within the total occupied area for the Worksheet. Courser grain than occupancyGrid(WorkBook) Counts all cells in the occupied WorkSheetArea.

Parameters:
wb - The workbook to examine.
See Also:
occupancyGrid(WorkBook)

Spreadsheet Toolkit

Project Home Page