Island Simulation

Version 1.1

Architecture Specification Document

Lainey Barb

Ralph Spence III

Ilija Zeljkovic

Michael Zeller

April 2, 2007

Table of Contents

SectionPage

1.0Architecture Diagram...... 1

1.1 Extended Architecture Diagram...... 2

2.0 Component Descriptions...... 4

2.1 User Interface (UI) Module...... 4

2.2 Population Module...... 6

2.3 Water Module...... 7

2.4 Animal Module...... 8

2.5 Plant Module...... 8

2.6 Event/Timer Module...... 9

2.7 Statistics Module...... 9

2.8 Graph Module...... 9

2.9 Extended Entity Hierarchy...... 10

2.10 Map Interface...... 11

3.0 Justification for This Breakout...... 13

4.0 Object Interfaces...... 14

1.0 Architecture Diagram

1.1Extended Architecture

User Interface Module


2.0 Components

2.1 User Interface (UI) Module

Description:

This component handles the interaction of the application with the user. The user can use mouse clicks and keyboard presses to communicate with the application. The UI Module is in charge of listening for these events and taking the appropriate actions which could include exiting a window, generating a pop-up, or displaying a graph.

Depends on:

Map Interface, Graph Module

Depends on it:

Population Module, Event/Timer Handler

2.1.1. Main Display

Description:

This component is in charge of the main display window.

2.1.1.1.Time Bar

Description:

This component allows the user to manipulate time.

Requirements:

1.1.1

2.1.1.1.1. Slider

Description:

This component allows the user to adjust the time flow rate using a slider bar. All the requirements mapped here are closely related because they deal with adjusting time flow.

Requirements:

1.1.1.2, 1.1.2

2.1.1.1.2. Play/Pause Button

Description:

This component allows the user to pause and resume time flow. All the requirements are very closely related because they have to do with pausing and resuming the simulation.

Requirements:

1.1.1.1, 1.5.2, 1.6.2, 1.6.3

2.1.1.2.Entity Adder

Description:

This component is a menu where the user can select entities or water and add it to the map.

Requirements:

1.2.8, 1.3.1

2.1.1.3.Map Display

Description:

This component is the actual display of the map.

Requirements:

1.4.5

2.1.2.Pop-Ups

2.1.2.1.Graph Display

Description:

This component displays the graph

Requirements:

1.5.4

2.1.2.2.Sampling Rate Options

Description:

This component is where the user changes sampling rate options

Requirements:

1.5.3

2.1.2.3.Statistic Options

Description:

This component is where the user changes statistic options.

Requirements:

1.4.3

2.1.2.4.Graph Options

Description:

This component is where the user changes graph options.

Requirements:

1.4.4.2

2.1.2.5.Event Notice Options

Description:

This component is where the user changes event notice options.

Requirements:

1.6.1.3

2.1.2.6.Event Dialogs

Description:

This component is where the event dialogs appear.

Requirements:

1.6.1.2

2.1.3.Warnings

Description:

This component is where warnings are displayed.

Requirements:

1.6.4

2.2 Population Module

Description:

The Population Module stores all the information about the current state of the island. This information includes sections, water levels, populations of sections, entities, and the statuses of those entities.

Depends on:

UI Module, Water Module, Animal Module, Plant Module, Extended Entity Hierarchy

Depends on it:

Water Module, Animal Module, Plant Module, Statistics Module, Map Interface

2.2.1 Sections List

Description:

The Sections List is an ordered list that contains for each section: number of section, population value of animals, population value of plants, and water level. Every section of the map has a unique number. All information in the Sections List is current and updated by the Animal, Plant, and Water Modules via the Population Module.

Depends on:

UI Module, Water Module, Animal Module, Plant Module, Extended Entity Hierarchy

Depends on it:

Water Module, Animal Module, Plant Module, Statistics Module, Map Interface

Requirements:

1.2.5, 1.4.2

2.2.2 Entity List

Description:

The Entity List is a list of all the entities present on the island at the current time. For each entity present, the list stores their type (plant, prey, or hunter), age, thirst, hunger, life status, current movement pattern (random, patterned, etc.), and section where located.

Depends on:

UI Module, Water Module, Animal Module, Plant Module, Extended Entity Hierarchy

Depends on it:

Water Module, Animal Module, Plant Module, Statistics Module, Map Interface

Requirements:

1.2.6

2.3 Water Module

Description:

When notified by the Event/Timer Module that a water event should occur, the Water Module calculates the new water level of each section using the current population of said section. The Water Module updates the Population Module with this new information.

Depends on:

Population Module

Depends on it:

Population Module

Requirements:

1.3.3

2.4 Animal Module

Description:

When notified by the Event/Timer Module that an animal event, say a hunter died or some animal moved to a new section, has occurred, the Animal Module updates the Population Module to reflect the event. This may include updating populations in the Sections List or changing section values in the Entity List.

Depends on:

Population Module, Infrastructure Team’s Control Logic Hierarchy

Depends on it:

Population Module

Requirements:

1.7.2

2.5 Plant Module

Description:

When notified by the Event/Timer Module that a plant event has occurred, the Plant Module updates the Population Module to reflect the event. This may include updating populations in the Sections List or changing section values in the Entity List. Some monitored plant events would include death, new seedlings, or change in thirst status.

Depends on:

Population Module

Depends on it:

Population Module

Requirements:

1.2.7

2.6 Event/Timer Handler

Description:

This component handles the time of the simulation. Per the Infrastructure Team, time will be tied to entities. Timers can be associated with entities and scheduled to go off when certain things happen. When these timers go off, events are fired by the Infrastructure Team’s Event Controller. The Event/Timer Handler handles these events by notifying the appropriate modules.

Depends on:

Infrastructure Team’s Event Controller, UI Module

Depends on it:

Animal Module, Water Module, Plant Module, Statistics Module

Requirements:

1.1.3

2.7 Statistics Module

Description:

The Statistics Module keeps track of all the statistics that can later be graphed. These statistics include population vs. time, birth rates of animals, and death rates. The Statistics Module gathers a reading from the Population Module whenever the Event/Timer Handler notifies it that a reading should be taken. The Statistics Module can store and load all these statistics from disk.

Depends on:

Population Module, Event/Timer Handler

Depends on it:

Graph Module

Requirements:

1.4.5.3, 1.5.1, 1.5.2.1, 1.5.3

2.7.1 Section Statistics

Description:

This component is in charge of all the statistics stored for a single section. The larger Statistics Module has one of these for each section of the map.

Requirements:

1.4.4

2.8 Graph Module

Description:

The Graph Module is in charge of displaying the information contained within the Statistics Module. The Graphing occurs when the UI Module requests a graph. The Graph Module is responsible for plotting all the data.

Depends on:

Statistics Module

Depends on it:

UI Module

Requirements:

1.5.1, 1.5.4

2.9 Extended Entity Hierarchy

Description:

The Extended Entity Hierarchy is our extension of the Entity Libraries provided by the Infrastructure team. This Hierarchy includes our three major entities: Hunter, Prey, and Plant. By extending the given entities we can enable personalized use of the entities.

Depends on:

Infrastructure Team’s Base Entity Hierarchy

Depends on it:

Population Module – Entity List

2.9.1 Base

Description:

This is the base entity class provided by the Infrastructure Team.

2.9.2 Controlled

Description:

This is the controlled entity class provided by the Infrastructure Team.

2.9.3 Static

Description:

This is the static entity class provided by the Infrastructure Team.

2.9.4 Animal

Description:

This is a base class we will use to handle similarities between the two types of animals.

Requirements:

1.7.1

2.9.4.1 Hunter

Description:

This is the specific class for hunter entities.

Requirements:

1.2.1

2.9.4.2 Prey

Description:

This is the specific class for hunter entities.

Requirements:

1.2.2

2.9.5 Plant

Description:

This is the specific class for plant entities.

Requirements:

1.2.2

2.9.6 Water

Description:

This is the specific class for instances of water.

Requirements:

1.3.4

2.10 Map Interface

Description:

The Map Interface acts as the go between for the Infrastructure Team’s Map Loader and our team’s UI Interface. It uses the information from the Population Module to give visual feedback to the user as to the current status of the island.

Depends on:

Infrastructure Team’s Map Loader, Population Module

Depends on it:

UI Module

Requirements:

1.1.3

2.10.1 Icon

Description:

This is the icons that will be used for water, animals, and plants. The Map has multiple icons because each entity has a different one.

Requirements:

1.2.4, 1.3.4

2.10.2 Legend

Description:

This is the legend that will say what each icon represents.

Requirements:

1.2.4.2, 1.4.5.2

2.10.3 Sector

Description:

This is the displayed sectors on the map. No real information is here.

Requirements:

1.4.1

3.0 Justification for This Breakout

Components were chosen to minimize the number of dependences of each specific component, in order to make the development of each component more manageable. UI was an obvious, essential component, and then the Map Interface and Graph Modules were identified to be dependencies of the UI module, since the user interface will need to display the map of the island, as well as statistical graphs about the island, depending on the state the user wants to be viewing. From there, it was determined that the Map Interface only required information on the sectors, as well as information on the status of the animals in those sectors, so the Population Module now stores the entities and their states. Similarly, the Graph Module only seemed to depend on the statistical information of the island, so a module was created to provide that information. The water, plant, and animal modules were determined to be necessary to update the sectors, but since they should not affect each other, they were created as separate module. These three modules also depend on a time, but one can think of time as events. The Infrastructure team is providing an Event Controller, so we created an Event/Time Handler that acts as our go between. This Handler controls the time of our simulation by registering and monitoring the events the user desires. We did not see any need to break down the architecture even further. However, each of the modules will be broken down to objects in the following assignment.

4.0 Object Interfaces

public interface Map extends Drawable {

public Map(int width, int height);

public void draw(Window w, int x, int y);

public void setMapLocation(int x, int y);

public void setLegendLocation(int x, int y);

public Section isIn(int x, int y);

public Icon getIcon(BaseEntity e);

public void setIcon(BaseEntity e);

public void setWidth(int width);

public int getWidth();

public void setHeight(int height);

public int getHeight();

public SectorList getSections();

}

public interface Icon extends Drawable {

public Icon();

public Icon(BaseEntity);

public void draw(Window w, int x, int y);

public void setEntity(BaseEntity e);

public BaseEntity getEntity();

public void setSource(String filename);

public String getSource();

}

public interface Section {

public Section(int xcoords[], int ycoords[]);

public boolean isIn(int x, int y);

public int getID();

public int getPreyPopulation();

public int getHunterPopulation();

public int getPlantPopulation();

public int getWaterPopulation();

public void addPrey(Prey prey);

public void addHunter(Hunter hunter);

public void addPlant(Plant plant);

public void addWater(Water water);

public void removePrey(Prey prey);

public void removeHunter(Hunter hunter);

public void removePlant(Plant plant);

public void removeWater(Water water);

public EntityList getPrey();

public EntityList getHunter();

public EntityList getPlant();

public EntityList getWater();

}

public interface UserInterface {

public UserInterface(Window w);

public setMap(int x, int y, int width, int height);

public setTimeBar(int x, int y);

public setEntityAdder(int x, int y);

}

public interface SectorList extends LinkedList<Section> {

public void add(Section s);

public void remove(Section s);

}

public interface EntityList extends LinkedList<BaseEntity> {

public void add(BaseEntity e);

public void remove(BaseEntity e);

}

public interface Population {

public Population();

public SectorList getSections();

public void setSection(int ID, Section);

public Section getSection(int ID);

}

public interface Animal extends ControlledEntity {

public Animal();

public void setAge(int k);

public int getAge();

public void setThirst(int k);

public int getThirst();

public void setHunger(int k);

public int getHunger();

public void setStatus(int status);

public int getStatus();

public void setMovementPattern(MovementPattern p);

public MovementPattern getMovementPattern();

public void setFoodConsumptionRate(int k);

public int getFoodConsumptionRate();

public void setWaterConsumptionRate(int k);

public int getWaterConsumptionRate();

}

public interface Hunter extends Animal {

}

public interface Prey extends Animal {

}

public interface Plant extends StaticEntity {

public Plant();

public void setStatus(int status);

public int getStatus();

public void setWaterConsumptionRate(int k);

public int getWaterConsumptionRate();

}

public interface Water extends StaticEntity {

public int setStatus(int status);

public int getStatus();

public void setWaterLevel(double level);

public double getWaterLevel();

}

public interface WaterModule extends Event {

public WaterModule(Population pop);

public void update(int time);

}

public interface PlantModule extends Event {

public PlantModule(Population pop);

public void update(int time);

}

public interface AnimalModule extends Event {

public AnimalModule(Population pop);

public void update(int time);

}

public interface Graph extends Drawable {

public Graph(int width, int height);

public void setCurrentSection(Section s);

public void draw(Window w, int x, int y);

public void setWidth(int width);

public int getWidth();

public void setHeight(int height);

public int getHeight();

public void setStyle(int style);

public int getStyle();

public void setPlot(int plot);

public int getPlot();

public void setTimeRange(int start, int end);

public void setStatistics(Statistics stats);

}

public interface Statistic {

public int getPopulation();

public int getBirths();

public int getDeaths();

}

public interface SectionStatistic {

public SectionStatistic(int time);

public int getTime();

public Statistic getHunterStats();

public void setHunterStats(Statistic stats);

public Statistic getPreyStats();

public void setPreyStats(Statistic stats);

public Statistic getPlantStats();

public void setPlantStats(Statistic stats);

public Statistic getWaterStats();

public void setWaterStats(Statistic stats);

}

public interface Statistics extends Event {

public Statistics(SectorList s);

public void setSamplingRate(int k);

public int getSamplingRate();

public LinkedList<SectionStatistic>

getSectionStatistics(int ID, int start, int end);

public void load(String filename);

public void save(String filename);

public void update(int time);

}

public interface EventTimerHandler {

public void pause();

public void resume();

public void step();

public void add(Event e);

}

1