hello.. i am doing
java at school and have a problem with something that we are doing.
We are making a Colony program(Game of Life). At the moment we have been given the Colony Model in a packed .jar file(contains classes that do all the work), and we have to make the GUI. We have been given an excercise just to try and interect with the model(call methods from the model and print out the return values - working in dos atm so no actuall graphical interface). My problem is that I am having trouble interacting with the model. when i call on methods from the model i get 'non-static method cannot be reference from a static context' - this happens even when called from a non-static method. Below is the model specs. Atm I just wanna setMaxGen to a number and be able to getMaxGen and print the value on screen.. thanks for any help.
Colony Model - Brief Specification
Class ColonyCtlr
Field Summary
Colony states:
static final int STOPPED
static final int PAUSED
static final int STEPPING
static final int RUNNING
Colony stop status:
static final int NORMAL - growing normally
static final int DEAD - no living cells
static final int STABLE - identical to the next generation
static final int CYCLIC - repeated within specified generations
static final int MAXGEN - reached maximum generations
Constructor Summary
ColonyCtlr(ColonyListener listener_)
Method Summary
void start()
Starts the life generation process in the Colony.
void stop()
Stops the life generation process and resets the generation number leaving the current generation in tact.
void pause()
Pauses the life generation process.
void step()
Produces the next generation of the Colony.
void clear()
Clears the colony ready to start again.
void createCell(int x_, int y_)
Creates a living cell at position (x_,y_)
void deleteCell(int x_, int y_)
Deletes a living cell at position (x_,y_)
void setMaxGen(int max_)
Sets the maximum number of generations
int getMaxGen()
Returns the maximum number of generations
int getState()
Returns the state of the colony,
i.e. either stopped, paused, stepping or running.
int getStopStatus()
Returns the status (reason) of the stopped state,
i.e. ok, dead, stable, cyclic or maximum generations reached.
boolean isAliveAt(int x_, int y_)
Returns whether a cell is alive at posn (x_,y_)
in the current generation
int getGenNum()
Returns the current generation number
int getPopulationCount()
Returns the current population count
Interface ColonyListener
Method Summary
void colonyChanged()
Indicates some change has occurred in the colony