Game of Life 1.5

org.bitstorm.gameoflife
Class StandaloneGameOfLife.GameOfLifeGridIO

java.lang.Object
  extended byorg.bitstorm.gameoflife.StandaloneGameOfLife.GameOfLifeGridIO
Enclosing class:
StandaloneGameOfLife

class StandaloneGameOfLife.GameOfLifeGridIO
extends java.lang.Object

File open and save operations for GameOfLifeGrid.


Field Summary
 java.lang.String FILE_EXTENSION
           
private  java.lang.String filename
           
private  GameOfLifeGrid grid
           
 
Constructor Summary
StandaloneGameOfLife.GameOfLifeGridIO(GameOfLifeGrid grid)
          Contructor.
 
Method Summary
 Shape makeShape(java.lang.String name, java.lang.String text)
          "Draw" the shape on the grid.
 void openShape()
          Load shape from disk
 void openShape(EasyFile file)
          Use EasyFile object to read GameOfLife-file from.
 void openShape(java.lang.String filename)
          Load shape from disk
 void openShape(java.net.URL url)
          Open shape from URL.
 void saveShape()
          Write shape to disk.
 void setShape(Shape shape)
          Set a shape and optionally resizes window.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_EXTENSION

public final java.lang.String FILE_EXTENSION
See Also:
Constant Field Values

grid

private GameOfLifeGrid grid

filename

private java.lang.String filename
Constructor Detail

StandaloneGameOfLife.GameOfLifeGridIO

public StandaloneGameOfLife.GameOfLifeGridIO(GameOfLifeGrid grid)
Contructor.

Parameters:
grid - grid to read/write files from/to
Method Detail

openShape

public void openShape()
Load shape from disk


openShape

public void openShape(java.lang.String filename)
Load shape from disk

Parameters:
filename - filename to load shape from, or null when no filename given.

openShape

public void openShape(java.net.URL url)
Open shape from URL.

Parameters:
url - URL pointing to GameOfLife-file

openShape

public void openShape(EasyFile file)
               throws java.io.IOException
Use EasyFile object to read GameOfLife-file from.

Parameters:
file - EasyFile-object
Throws:
java.io.IOException
See Also:
EasyFile

setShape

public void setShape(Shape shape)
Set a shape and optionally resizes window.

Parameters:
shape - Shape to set

makeShape

public Shape makeShape(java.lang.String name,
                       java.lang.String text)
"Draw" the shape on the grid. (Okay, it's not really drawing). The lines of text represent the cells of the shape.

Parameters:
name - name of shape
text - lines of text

saveShape

public void saveShape()
Write shape to disk.


Game of Life 1.5

This API descibes the Game of Life program, written by Edwin Martin. The source code is available online too.

Copyright 1996-2004 Edwin Martin <edwin@bitstorm.org>.