Class Environment

java.lang.Object
  extended by Environment
All Implemented Interfaces:
java.io.Serializable

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

WARNING: THIS IS A 2D ENVIRONMENT

See Also:
Serialized Form

Field Summary
private  Atmosphere atmosphere
           
private  double averageTemperature
          temperature
private  java.awt.Color backgroundColor
          Background
private  javax.swing.ImageIcon backgroundImage
           
private  int dayLength
           
static int DEFAULTSECTORSIZE
           
private  double height
           
private  java.util.Set items
           
 java.util.Set itemsToBeAdded
          add/remove
 java.util.Set itemsToBeRemoved
           
private  boolean loopBoundaries
           
private  java.lang.String name
          name
private  Sector[][] sector
           
private  double temperatureRange
           
private  boolean tileImage
           
private  int tileSize
           
private  int time
          time
private  double width
           
 
Constructor Summary
Environment(double w, double h, java.lang.String backgroundFileName)
           
 
Method Summary
 boolean add(Item m)
           
 Atmosphere atmosphere()
          atmosphere
 double averageTemperature()
           
 java.awt.Color backgroundColor()
           
 javax.swing.ImageIcon backgroundImage()
           
 Item checkForCollisions(Item i)
           
 void clearAllSectors()
           
 int clock()
           
 boolean contains(Item m)
           
static double convertCentigradeToFahrenheit(double c)
           
static double convertFahrenheitToCentigrade(double f)
           
 void createRandomWater(double amount)
           
 double currentTemperature()
           
 int dayLength()
           
 void fillCircleUsable(int x, int y, int radius, boolean use)
           
 void fillDisease(int xo, int yo, int xf, int yf, double amount)
           
 void fillUsable(int xo, int yo, int xf, int yf, boolean use)
           
 void fillWater(int xo, int yo, int xf, int yf, boolean wet)
           
 Sector findSector(Vector pos)
           
 java.util.LinkedList getAllVisibleSectors()
           
 java.util.Set getItemsWithinRadius(Vector pos, double x, double y)
           
 java.util.LinkedList getSectorsWithinRadius(Vector pos, double x, double y)
           
 double height()
           
 void incrementTime()
           
 boolean isEmptySpot(Vector pos)
           
 boolean isEmptySpot(Vector pos, double rOC)
           
 boolean isNightTime()
           
 Item itemAtPosition(Vector pos)
           
 java.util.Set items()
          get/set methods
 boolean loopBoundaries()
           
 void loopItemPosition(Item i, Vector oldPos)
           
 java.lang.String name()
           
 void recordMove(Item m, Vector oldPos)
           
 boolean remove(Item m)
           
 void setAtmosphere(Atmosphere a)
           
 void setAverageTemperature(double t)
           
 void setBackgroundColor(java.awt.Color c)
           
 void setBackgroundImage(javax.swing.ImageIcon i)
           
 void setDayLength(int d)
           
 void setLoopBoundaries(boolean b)
           
 void setName(java.lang.String s)
           
 void setTemperatureRange(double r)
           
 void setTileImage(boolean b)
           
 void setTileSize(int i)
           
 void setTime(int t)
           
 double temperatureRange()
           
 boolean tileImage()
           
 int tileSize()
           
 int time()
           
 java.lang.String toString()
           
 void update()
          update
 boolean validPosition(Vector pos)
           
 boolean validPosition(Vector pos, double radius)
           
 double width()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULTSECTORSIZE

public static final int DEFAULTSECTORSIZE
See Also:
Constant Field Values

sector

private Sector[][] sector

items

private java.util.Set items

atmosphere

private Atmosphere atmosphere

name

private java.lang.String name
name


time

private int time
time


dayLength

private int dayLength

averageTemperature

private double averageTemperature
temperature


temperatureRange

private double temperatureRange

itemsToBeAdded

public java.util.Set itemsToBeAdded
add/remove


itemsToBeRemoved

public java.util.Set itemsToBeRemoved

loopBoundaries

private boolean loopBoundaries

height

private double height

width

private double width

backgroundColor

private java.awt.Color backgroundColor
Background


backgroundImage

private javax.swing.ImageIcon backgroundImage

tileImage

private boolean tileImage

tileSize

private int tileSize
Constructor Detail

Environment

public Environment(double w,
                   double h,
                   java.lang.String backgroundFileName)
Method Detail

name

public java.lang.String name()

setName

public void setName(java.lang.String s)

toString

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

atmosphere

public Atmosphere atmosphere()
atmosphere


setAtmosphere

public void setAtmosphere(Atmosphere a)

createRandomWater

public void createRandomWater(double amount)

time

public int time()

incrementTime

public void incrementTime()

setTime

public void setTime(int t)

dayLength

public int dayLength()

setDayLength

public void setDayLength(int d)

clock

public int clock()

isNightTime

public boolean isNightTime()

averageTemperature

public double averageTemperature()

setAverageTemperature

public void setAverageTemperature(double t)

temperatureRange

public double temperatureRange()

setTemperatureRange

public void setTemperatureRange(double r)

currentTemperature

public double currentTemperature()

convertFahrenheitToCentigrade

public static double convertFahrenheitToCentigrade(double f)

convertCentigradeToFahrenheit

public static double convertCentigradeToFahrenheit(double c)

add

public boolean add(Item m)

remove

public boolean remove(Item m)

contains

public boolean contains(Item m)

recordMove

public void recordMove(Item m,
                       Vector oldPos)

validPosition

public boolean validPosition(Vector pos)

validPosition

public boolean validPosition(Vector pos,
                             double radius)

findSector

public Sector findSector(Vector pos)

checkForCollisions

public Item checkForCollisions(Item i)

loopBoundaries

public boolean loopBoundaries()

setLoopBoundaries

public void setLoopBoundaries(boolean b)

loopItemPosition

public void loopItemPosition(Item i,
                             Vector oldPos)

isEmptySpot

public boolean isEmptySpot(Vector pos)

isEmptySpot

public boolean isEmptySpot(Vector pos,
                           double rOC)

itemAtPosition

public Item itemAtPosition(Vector pos)

clearAllSectors

public void clearAllSectors()

fillWater

public void fillWater(int xo,
                      int yo,
                      int xf,
                      int yf,
                      boolean wet)

fillDisease

public void fillDisease(int xo,
                        int yo,
                        int xf,
                        int yf,
                        double amount)

fillUsable

public void fillUsable(int xo,
                       int yo,
                       int xf,
                       int yf,
                       boolean use)

fillCircleUsable

public void fillCircleUsable(int x,
                             int y,
                             int radius,
                             boolean use)

update

public void update()
update


items

public java.util.Set items()
get/set methods


height

public double height()

width

public double width()

getItemsWithinRadius

public java.util.Set getItemsWithinRadius(Vector pos,
                                          double x,
                                          double y)

getAllVisibleSectors

public java.util.LinkedList getAllVisibleSectors()

getSectorsWithinRadius

public java.util.LinkedList getSectorsWithinRadius(Vector pos,
                                                   double x,
                                                   double y)

backgroundColor

public java.awt.Color backgroundColor()

setBackgroundColor

public void setBackgroundColor(java.awt.Color c)

backgroundImage

public javax.swing.ImageIcon backgroundImage()

setBackgroundImage

public void setBackgroundImage(javax.swing.ImageIcon i)

tileImage

public boolean tileImage()

setTileImage

public void setTileImage(boolean b)

tileSize

public int tileSize()

setTileSize

public void setTileSize(int i)