Spreadsheet Toolkit

corpus.analyser
Class Grid

java.lang.Object
  |
  +--corpus.analyser.Grid
All Implemented Interfaces:
java.io.Serializable

public class Grid
extends java.lang.Object
implements java.io.Serializable

This object creates a 2D array using vectors. When used in conjunction with spreadsheets x wil be the column and y the row.

See Also:
Serialized Form

Constructor Summary
Grid()
           
 
Method Summary
 void add(int x, int y, java.lang.Object value)
          Sets the value at x,y to the passed in value
 void clear(int x, int y)
          Sets the cell at x, y to null
 void displayInteger()
           
 void displayString()
           
 void displayStructure()
           
 void dumpValues(java.util.Vector vector, int x_offset, int y_offset)
           
static Grid from2DVector(java.util.Vector vector, int x_offset, int y_offset)
          Takes a Vector of vectors and converts it into a Grid.
 java.lang.Object get(int x, int y)
          Get the value stored at x,y
 int getMaxHeight()
           
 int getMaxWidth()
           
 int[] getMinMaxHeight(int x)
          Find the maximum occupied row for the given x(column)
 int[] getMinMaxWidth(int y)
          Find the maximum occupied row for the given y(row)
static Grid load(java.lang.String path)
           
static void main(java.lang.String[] args)
           
 void save(java.lang.String path)
           
 void saveCSVInteger(java.lang.String path)
           
 void saveVisad(java.lang.String path)
           
 java.awt.Point size()
           
 java.util.Vector to2DVector()
          Converts the current grid file into a vector of vectors.
 void toDoodler(java.lang.String title)
           
 double[][] toDoubleArray()
          Expects a grid of Doubles.
 java.lang.Object[][] toObjectArray()
          Expects a grid of Integers.
 java.lang.String toString()
           
 java.lang.String toString(Grid g2)
          Merge two grids in printing.
 java.lang.String toStringLogical()
           
 java.lang.String toStringQuick()
           
 void toVectorDoodler(java.lang.String title)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Grid

public Grid()
Method Detail

add

public void add(int x,
                int y,
                java.lang.Object value)
Sets the value at x,y to the passed in value


get

public java.lang.Object get(int x,
                            int y)
Get the value stored at x,y

Returns:
The object if the grid coord is valid and occupied. null if it is empty.

clear

public void clear(int x,
                  int y)
Sets the cell at x, y to null


size

public java.awt.Point size()
Returns:
the largest dimensions of the Grid as a Point

getMaxWidth

public int getMaxWidth()
Returns:
the largest width of the Grid

getMaxHeight

public int getMaxHeight()
Returns:
the largest height of the Grid

displayInteger

public void displayInteger()

displayString

public void displayString()

from2DVector

public static Grid from2DVector(java.util.Vector vector,
                                int x_offset,
                                int y_offset)
Takes a Vector of vectors and converts it into a Grid.


to2DVector

public java.util.Vector to2DVector()
Converts the current grid file into a vector of vectors. The first vector is the y value, and the second the x.


toDoubleArray

public double[][] toDoubleArray()
Expects a grid of Doubles.


toObjectArray

public java.lang.Object[][] toObjectArray()
Expects a grid of Integers.


displayStructure

public void displayStructure()

saveCSVInteger

public void saveCSVInteger(java.lang.String path)

saveVisad

public void saveVisad(java.lang.String path)

save

public void save(java.lang.String path)

load

public static Grid load(java.lang.String path)

toDoodler

public void toDoodler(java.lang.String title)

toVectorDoodler

public void toVectorDoodler(java.lang.String title)

dumpValues

public void dumpValues(java.util.Vector vector,
                       int x_offset,
                       int y_offset)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toStringQuick

public java.lang.String toStringQuick()

toStringLogical

public java.lang.String toStringLogical()

toString

public java.lang.String toString(Grid g2)
Merge two grids in printing.


getMinMaxHeight

public int[] getMinMaxHeight(int x)
Find the maximum occupied row for the given x(column)

Parameters:
x - the column to inspect.
Returns:
an int[2] where int[0] = min and int[1] = max.

getMinMaxWidth

public int[] getMinMaxWidth(int y)
Find the maximum occupied row for the given y(row)

Parameters:
y - the row to inspect.
Returns:
an int[2] where int[0] = min and int[1] = max.

main

public static void main(java.lang.String[] args)

Spreadsheet Toolkit

Project Home Page