| C:\upload\java\Life\source\java\Objects.java |
import java.awt.*;
final class Objects implements Strings
{
private Frame parentFrame;
private boolean instantiationsSucceeded;
private static ScreenLocations screenLocations;
private static HandleButtons buttons;
private static Initializations initializations;
private static PaintBoardAndComputeNextGeneration paintBoardAndComputeNextGeneration;
private static GenerationNumberCanvas genNum;
private static BoardUtilities boardUtilities;
private static ManageBoardCoordinates boardCoordinates;
private static UI ui;
private static RepeatPattern repeat;
Objects(Frame parentFrame, Graphics offScreenGraphics)
{
String errorString = ((parentFrame != null) &&
(offScreenGraphics != null)) ?
NULL_STRING : "parentFrame = " + parentFrame +
" offScreenGraphics = " + offScreenGraphics;
if (!errorString.equals(NULL_STRING))
{
System.out.println("Error, null pointer, Objects " + errorString);
return;
}
repeat = null;
boardUtilities = null;
paintBoardAndComputeNextGeneration = null;
genNum = null;
ui = null;
buttons = null;
initializations = null;
boardCoordinates = null;
instantiationsSucceeded = true;
this.parentFrame = parentFrame;
try
{
buttons = new HandleButtons();
screenLocations = new ScreenLocations(buttons);
initializations = new Initializations(this);
boardCoordinates = new ManageBoardCoordinates(parentFrame, screenLocations);
repeat = new RepeatPattern(parentFrame, this);
boardUtilities = new BoardUtilities(parentFrame, screenLocations);
paintBoardAndComputeNextGeneration = new PaintBoardAndComputeNextGeneration(
parentFrame, this,
screenLocations,
0, 0);
genNum = new GenerationNumberCanvas(parentFrame, screenLocations,
0, 0);
ui = new UI(this);
}
catch(RuntimeException e)
{
instantiationsSucceeded = false;
}
instantiationsSucceeded &= ((repeat != null) &&
(boardUtilities != null) &&
(paintBoardAndComputeNextGeneration != null) &&
(genNum != null) &&
(ui != null) &&
(parentFrame != null) &&
(offScreenGraphics != null) &&
(buttons != null) &&
(initializations != null) &&
(boardCoordinates != null));
errorString = (instantiationsSucceeded) ?
NULL_STRING : "Null Pointer, < objects.java >.";
if (!errorString.equals(NULL_STRING))
{
System.out.println("Error, null pointer, Objects " + errorString);
return;
}
}
protected final boolean InstantiationsSucceeded()
{
return instantiationsSucceeded;
}
protected final Frame GetParentFrame()
{
return parentFrame;
}
protected final void SetScreenLocations(ScreenLocations screenLocations)
{
this.screenLocations = screenLocations;
}
protected final ScreenLocations GetScreenLocations()
{
return screenLocations;
}
protected final void SetInitializations(Initializations initializations)
{
this.initializations = initializations;
}
protected final Initializations GetInitializations()
{
return initializations;
}
protected final void SetGenNum(GenerationNumberCanvas genNum)
{
this.genNum = genNum;
}
protected final GenerationNumberCanvas GetGenNum()
{
return genNum;
}
protected final void SetPaintBoardAndComputeNextGeneration(
PaintBoardAndComputeNextGeneration
paintBoardAndComputeNextGeneration)
{
this.paintBoardAndComputeNextGeneration = paintBoardAndComputeNextGeneration;
}
protected final PaintBoardAndComputeNextGeneration GetPaintBoardAndComputeNextGeneration()
{
return paintBoardAndComputeNextGeneration;
}
protected final void SetUi(UI ui)
{
this.ui = ui;
}
protected final UI GetUi()
{
return ui;
}
protected final void SetBoardUtilities(BoardUtilities boardUtilities)
{
this.boardUtilities = boardUtilities;
}
protected final BoardUtilities GetBoardUtilities()
{
return boardUtilities;
}
protected final void SetRepeatPattern (RepeatPattern repeat)
{
this.repeat = repeat;
}
protected final RepeatPattern GetRepeatPattern()
{
return repeat;
}
protected final void SetBoardCoordinates(ManageBoardCoordinates boardCoordinates)
{
this.boardCoordinates = boardCoordinates;
}
protected final ManageBoardCoordinates GetBoardCoordinates()
{
return boardCoordinates;
}
protected final HandleButtons GetButtons()
{
return buttons;
}
}