<?xml version="1.0" encoding="UTF-8"?> 
<java version="1.4.1-rc" class="java.beans.XMLDecoder"> 
 <object class="eclpss.model.ModelSpecification"> 
  <void property="author"> 
   <string>ew</string> 
  </void> 
  <void property="componentsVector"> 
   <void method="add"> 
    <object id="ComponentSpecification0" class="eclpss.component.ComponentSpecification"> 
     <void property="author"> 
      <string>ew</string> 
     </void> 
     <void property="date"> 
      <object class="java.util.Date"> 
       <long>1042693200000</long> 
      </object> 
     </void> 
     <void property="documentation"> 
      <array class="java.lang.String" length="18"> 
       <void index="0"> 
        <string>ew</string> 
       </void> 
       <void index="1"> 
        <string>1/16/03</string> 
       </void> 
       <void index="2"> 
        <string>9/17/03</string> 
       </void> 
       <void index="3"> 
        <string>v.1</string> 
       </void> 
       <void index="4"> 
        <string>Fill the grid with live cells according to the pattern selected in pre-sim method.
During the simulation, set cell to alive/dead depending on amount of neighbors.</string> 
       </void> 
       <void index="5"> 
        <string></string> 
       </void> 
       <void index="6"> 
        <string>9/15 documentation, generate graphic display using current tools.</string> 
       </void> 
       <void index="7"> 
        <string>RUN PRESIM AS SPATIAL!!!!!!</string> 
       </void> 
       <void index="8"> 
        <string></string> 
       </void> 
       <void index="9"> 
        <string></string> 
       </void> 
       <void index="10"> 
        <string></string> 
       </void> 
       <void index="11"> 
        <string></string> 
       </void> 
       <void index="12"> 
        <string></string> 
       </void> 
       <void index="13"> 
        <string></string> 
       </void> 
       <void index="14"> 
        <string></string> 
       </void> 
       <void index="15"> 
        <string></string> 
       </void> 
       <void index="16"> 
        <string></string> 
       </void> 
       <void index="17"> 
        <string></string> 
       </void> 
      </array> 
     </void> 
     <void property="eclpssVersion"> 
      <string>version 1.2.b0</string> 
     </void> 
     <void property="esvs"> 
      <array class="eclpss.esv.ESVSpecification" length="1"> 
       <void index="0"> 
        <object id="ESVSpecification0" class="eclpss.esv.ESVSpecification"> 
         <void property="attributeConstants"> 
          <void method="add"> 
           <object class="eclpss.esv.Constant"> 
            <void property="index"> 
             <int>0</int> 
            </void> 
            <void property="name"> 
             <string>State_DEAD</string> 
            </void> 
            <void property="type"> 
             <string>int</string> 
            </void> 
            <void property="unit"> 
             <string>Dimensionless_ONE</string> 
            </void> 
            <void property="value"> 
             <string>0</string> 
            </void> 
           </object> 
          </void> 
          <void method="add"> 
           <object class="eclpss.esv.Constant"> 
            <void property="index"> 
             <int>0</int> 
            </void> 
            <void property="name"> 
             <string>State_LIVE</string> 
            </void> 
            <void property="type"> 
             <string>int</string> 
            </void> 
            <void property="unit"> 
             <string>Dimensionless_ONE</string> 
            </void> 
            <void property="value"> 
             <string>1</string> 
            </void> 
           </object> 
          </void> 
         </void> 
         <void property="attributes"> 
          <void method="add"> 
           <object class="eclpss.esv.Attribute"> 
            <void property="index"> 
             <int>0</int> 
            </void> 
            <void property="name"> 
             <string>State</string> 
            </void> 
            <void property="type"> 
             <string>int</string> 
            </void> 
            <void property="unit"> 
             <string>Dimensionless_ONE</string> 
            </void> 
           </object> 
          </void> 
         </void> 
         <void property="author"> 
          <string>ew</string> 
         </void> 
         <void property="comments"> 
          <string>The state of the cell: LIVE or DEAD.
CHECKERBOARD: initial pattern of live cells in grid.
RANDOM:  initial pattern of live cells in grid.
LIVE_BORDER: initial border cells alive
RANDOM_LIVE_PERCENT: used in RANDOM initialization of cells.</string> 
         </void> 
         <void property="constants"> 
          <void method="add"> 
           <object class="eclpss.esv.Constant"> 
            <void property="index"> 
             <int>0</int> 
            </void> 
            <void property="name"> 
             <string>CHECKERBOARD</string> 
            </void> 
            <void property="type"> 
             <string>int</string> 
            </void> 
            <void property="unit"> 
             <string>NONE</string> 
            </void> 
            <void property="value"> 
             <string>0</string> 
            </void> 
           </object> 
          </void> 
          <void method="add"> 
           <object class="eclpss.esv.Constant"> 
            <void property="index"> 
             <int>0</int> 
            </void> 
            <void property="name"> 
             <string>RANDOM</string> 
            </void> 
            <void property="type"> 
             <string>int</string> 
            </void> 
            <void property="unit"> 
             <string>NONE</string> 
            </void> 
            <void property="value"> 
             <string>1</string> 
            </void> 
           </object> 
          </void> 
          <void method="add"> 
           <object class="eclpss.esv.Constant"> 
            <void property="index"> 
             <int>0</int> 
            </void> 
            <void property="name"> 
             <string>LIVE_BORDER</string> 
            </void> 
            <void property="type"> 
             <string>int</string> 
            </void> 
            <void property="unit"> 
             <string>NONE</string> 
            </void> 
            <void property="value"> 
             <string>2</string> 
            </void> 
           </object> 
          </void> 
          <void method="add"> 
           <object class="eclpss.esv.Constant"> 
            <void property="index"> 
             <int>0</int> 
            </void> 
            <void property="name"> 
             <string>RANDOM_LIVE_PERCENT</string> 
            </void> 
            <void property="type"> 
             <string>float</string> 
            </void> 
            <void property="unit"> 
             <string>NONE</string> 
            </void> 
            <void property="value"> 
             <string>(float) 0.6</string> 
            </void> 
           </object> 
          </void> 
         </void> 
         <void property="date"> 
          <object class="java.util.Date"> 
           <long>1042693200000</long> 
          </object> 
         </void> 
         <void property="eclpssVersion"> 
          <string>version 1.2.b0</string> 
         </void> 
         <void property="externalLocation"> 
          <string>/home/strempel/models/Cell.esv</string> 
         </void> 
         <void property="name"> 
          <string>Cell</string> 
         </void> 
         <void property="staticDeclarations"> 
          <string></string> 
         </void> 
         <void property="timeStamp"> 
          <object class="java.util.Date"> 
           <long>1063824768453</long> 
          </object> 
         </void> 
        </object> 
       </void> 
      </array> 
     </void> 
     <void property="externalLocation"> 
      <string>/home/strempel/models/Live.cpt</string> 
     </void> 
     <void property="height"> 
      <string></string> 
     </void> 
     <void property="javadoc"> 
      <string>/**
 *&lt;UL&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;BIG&gt;This is an &lt;font color = &quot;mediumblue&quot;&gt;&lt;i&gt; ECLPSS Component&lt;/i&gt;&lt;/font&gt;&lt;/BIG&gt;&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Author: &lt;/b&gt;ew&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Date Created: &lt;/b&gt;1/16/03&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Date Saved: &lt;/b&gt;9/17/03&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Version: &lt;/b&gt;v.1&lt;/LI&gt;&lt;BR&gt;&lt;br&gt;
 *&lt;LI&gt;&lt;b&gt;Purpose: &lt;/b&gt;Fill the grid with live cells according to the pattern selected in pre-sim method.
During the simulation, set cell to alive/dead depending on amount of neighbors.&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Algorithm Citation: &lt;/b&gt;&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Modification History: &lt;/b&gt;9/15 documentation, generate graphic display using current tools.&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Assumptions: &lt;/b&gt;RUN PRESIM AS SPATIAL!!!!!!&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Limitations: &lt;/b&gt;&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Known Problems: &lt;/b&gt;&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Suggested Improvements: &lt;/b&gt;&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Testing Statistics: &lt;/b&gt;&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Models used in: &lt;/b&gt;&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;General Comments: &lt;/b&gt;&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Pre-Sim Comments: &lt;/b&gt;&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Sim Comments: &lt;/b&gt;&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Post-Sim Comments: &lt;/b&gt;&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Local Method Comments: &lt;/b&gt;&lt;/LI&gt;&lt;BR&gt;
*/
</string> 
     </void> 
     <void property="localMethodCode"> 
      <string>// used by Sim method
final Point NORTH = new Point( 0, -1, -1 );
final Point SOUTH = new Point( 0, 1, -1 );
final Point EAST = new Point( 1, 0, -1 );
final Point WEST = new Point( -1, 0, -1 );
final Point NORTH_EAST = new Point( 1, -1, -1 );
final Point SOUTH_EAST = new Point( 1, 1, -1 );
final Point NORTH_WEST = new Point( -1, -1, -1 );
final Point SOUTH_WEST = new Point( -1, 1, -1 );


//used by Pre-Sim method
static int initialValue = 0; 

java.util.Random r = new java.util.Random();

</string> 
     </void> 
     <void property="name"> 
      <string>Live</string> 
     </void> 
     <void property="postRecords"> 
      <object class="java.util.Vector"> 
       <void method="add"> 
        <object class="eclpss.component.ESVReadsAndWritesRecord"> 
         <void property="name"> 
          <string>Cell</string> 
         </void> 
        </object> 
       </void> 
      </object> 
     </void> 
     <void property="postSimCode"> 
      <string>System.out.println(&quot;Life ended&quot;);</string> 
     </void> 
     <void property="preRecords"> 
      <object class="java.util.Vector"> 
       <void method="add"> 
        <object class="eclpss.component.ESVReadsAndWritesRecord"> 
         <void property="name"> 
          <string>Cell</string> 
         </void> 
         <void property="written"> 
          <boolean>true</boolean> 
         </void> 
        </object> 
       </void> 
      </object> 
     </void> 
     <void property="preSimCode"> 
      <string>/** Initialize the board with either random or a checkerboard pattern of
   * live cells.
   */
// by setting the initial values to the sum of the indices modulo 2, we get:
//   a checkerboard pattern.  It&apos;s an interesting simulation!!
//
// The Cell SV has static constants named CHECKERBOARD and RANDOM, which we
// set for initialization.
//   
int xx = current.getX();
int yy = current.getY();

boolean borderCell = (xx == grid.getAbsXLB()-1 || 
                                 xx == grid.getAbsXUB()-1 || 
                                 yy == grid.getAbsYLB()-1 || 
                                 yy == grid.getAbsYUB()-1 );
 
if (model.CellInitializationStyle == Cell.CHECKERBOARD) {
   initialValue = ( current.getX() + current.getY() ) % 2;
   //System.out.println(current.toString()+&quot;=&quot;+initialValue);
   grid.writeCell(current,CURRENT).add(new Cell(initialValue));
   if (borderCell) {
      grid.writeCell(current,PREVIOUS).add(new Cell(initialValue));
   }
}


else if (model.CellInitializationStyle == Cell.RANDOM) { 
   float rlp = model.CellRandomLivePercent;
   if (rlp &lt;=0.0)
      rlp = Cell.RANDOM_LIVE_PERCENT;
   initialValue = (r.nextFloat()&gt;rlp)?1:0;
   grid.writeCell(current,CURRENT).add(new Cell(initialValue));
   if (borderCell) {
      grid.writeCell(current,PREVIOUS).add(new Cell(initialValue));
   }
}


else if (model.CellInitializationStyle == Cell.LIVE_BORDER) {
   xx = current.getX();
   yy = current.getY();
   //System.out.println(&quot;XLB=&quot;+(grid.getAbsXLB()-1) );
   //System.out.println(&quot;XUB=&quot;+(grid.getAbsXUB()-1) );
   //System.out.println(&quot;YLB=&quot;+(grid.getAbsYLB()-1) );
   //System.out.println(&quot;YUB=&quot;+(grid.getAbsYUB()-1) );


// remember - these methods return cell numbers; we need to subtract 1 to get the
//                    index!!!

   if (borderCell) {
          //System.out.println(&quot;xx==&quot;+xx+&quot;yy==&quot;+yy+&quot; is a border cell&quot;);
          grid.writeCell(current,CURRENT).add(new Cell(Cell.State_LIVE));
          grid.writeCell(current,PREVIOUS).add(new Cell(Cell.State_LIVE));
   }
   else {
      grid.writeCell(current,CURRENT).add(new Cell(Cell.State_DEAD));    
   }
}</string> 
     </void> 
     <void property="simCode"> 
      <string>/** Loop through grid and determine if &quot;life&quot; in cell should be alive or dead 
   * depending on number of neighbors.
   */
int count = 0;

count += grid.readCell(current, NORTH).getState();
count += grid.readCell(current, SOUTH).getState();
count += grid.readCell(current, EAST).getState();
count += grid.readCell(current, WEST).getState();
count += grid.readCell(current, NORTH_EAST).getState();
count += grid.readCell(current, SOUTH_EAST).getState();
count += grid.readCell(current, NORTH_WEST).getState();
count += grid.readCell(current, SOUTH_WEST).getState();

int thisCell = grid.readCell(current, PREVIOUS).getState();


if (thisCell == Cell.State_DEAD){
        if (count == 3){	
                grid.writeCell(current, CURRENT).add( new Cell(Cell.State_LIVE) );
        }
        else {
                grid.writeCell(current, CURRENT).add( new Cell(Cell.State_DEAD) );
        }
}// end DEAD
else{
        if (count &lt;= 1){
                grid.writeCell(current, CURRENT).add( new Cell(Cell.State_DEAD) );
        }
        else if (count &gt;= 4){
                grid.writeCell(current, CURRENT).add( new Cell(Cell.State_DEAD) );
        }
        else{
                grid.writeCell(current, CURRENT).add( new Cell(Cell.State_LIVE) );
        }
}// end else
</string> 
     </void> 
     <void property="simRecords"> 
      <object class="java.util.Vector"> 
       <void method="add"> 
        <object class="eclpss.component.ESVReadsAndWritesRecord"> 
         <void property="name"> 
          <string>Cell</string> 
         </void> 
         <void property="read"> 
          <boolean>true</boolean> 
         </void> 
         <void property="written"> 
          <boolean>true</boolean> 
         </void> 
        </object> 
       </void> 
      </object> 
     </void> 
     <void property="staticDeclarations"> 
      <string></string> 
     </void> 
     <void property="timeStamp"> 
      <object class="java.util.Date"> 
       <long>1063824808927</long> 
      </object> 
     </void> 
     <void property="width"> 
      <string></string> 
     </void> 
    </object> 
   </void> 
   <void method="add"> 
    <object id="GraphicalComponentSpecification0" class="eclpss.component.GraphicalComponentSpecification"> 
     <void property="attribute"> 
      <object class="eclpss.esv.Attribute"> 
       <void property="index"> 
        <int>0</int> 
       </void> 
       <void property="name"> 
        <string>State</string> 
       </void> 
       <void property="type"> 
        <string>int</string> 
       </void> 
       <void property="unit"> 
        <string>Dimensionless_ONE</string> 
       </void> 
      </object> 
     </void> 
     <void property="author"> 
      <string>Generated Graphical Component</string> 
     </void> 
     <void property="date"> 
      <object class="java.util.Date"> 
       <long>1063657997886</long> 
      </object> 
     </void> 
     <void property="documentation"> 
      <array class="java.lang.String" length="18"/> 
     </void> 
     <void property="esvs"> 
      <array class="eclpss.esv.ESVSpecification" length="1"> 
       <void index="0"> 
        <object idref="ESVSpecification0"/> 
       </void> 
      </array> 
     </void> 
     <void property="frameTitle"> 
      <string>LifeGrid</string> 
     </void> 
     <void property="graphical"> 
      <boolean>true</boolean> 
     </void> 
     <void property="localMethodCode"> 
      <string>public void paint(Graphics g) {
  g.drawImage(image,15,30,Color.blue,this);

  float[] slope = new float[3];
  float[] startHSB = new float[3];
  Color.RGBtoHSB(0, 0, 255, startHSB);
  float[] endHSB = new float[3];
  Color.RGBtoHSB(255, 0, 0, endHSB);

  slope[0] = (endHSB[0] - startHSB[0])/frameWidth;
  slope[1] = (endHSB[1] - startHSB[1])/frameWidth;
  slope[2] = (endHSB[2] - startHSB[2])/frameWidth;

  for(int i = 0; i &lt; frameWidth; i++){
    g.setColor(Color.getHSBColor(startHSB[0] + (slope[0]*i),
      startHSB[1] + (slope[1]*i),
      startHSB[2] + (slope[2]*i)));
    g.drawLine(i+15, frameHeight+35, i+15, frameHeight+55);
  }

  g.setColor(Color.black);
  g.drawString(&quot;0.0&quot;, 15, frameHeight+70);
  g.drawString(&quot;1.0&quot;,frameWidth-10,frameHeight+70);
}

Graphics2D offScreen = null;
int frameWidth = 500 - 80;
int frameHeight = 500 - 80;
java.awt.image.BufferedImage image = new java.awt.image.BufferedImage(frameWidth, frameHeight, java.awt.image.BufferedImage.TYPE_INT_RGB);
</string> 
     </void> 
     <void property="maxValue"> 
      <string>1</string> 
     </void> 
     <void property="minValue"> 
      <string>0</string> 
     </void> 
     <void property="name"> 
      <string>LifeGrid</string> 
     </void> 
     <void property="postRecords"> 
      <object class="java.util.Vector"> 
       <void method="add"> 
        <object class="eclpss.component.ESVReadsAndWritesRecord"> 
         <void property="name"> 
          <string>Cell</string> 
         </void> 
         <void property="read"> 
          <boolean>true</boolean> 
         </void> 
        </object> 
       </void> 
      </object> 
     </void> 
     <void property="postSimCode"> 
      <string>boolean threeDimensions = !(grid.getZBoundryType()==ComputationalGrid.NO_Z); if(offScreen == null) {
  offScreen = image.createGraphics();
}
int xLB = grid.getXLB();
int yLB = grid.getYLB();
int zLB = grid.getZLB();
int xUB = grid.getXUB();
int yUB = grid.getYUB();
int zUB = grid.getZUB();

int blockWidth = 0;
int blockHeight = 0;
if(threeDimensions){
  if((2*xUB + 2*zUB) &gt; (2*yUB+2*zUB)){
    blockWidth = frameWidth / ((2*xUB)+(2*zUB));
    blockHeight = blockWidth;
  }
  else{
    blockWidth = frameHeight / ((2*yUB)+(2*zUB));
    blockHeight = blockWidth;
  }
}//end if(threeDimensions){
else{
  blockWidth = frameWidth / xUB;
  blockHeight = frameHeight/ yUB;
}
float value = (float)0;


float[] hsbStartColors = new float[3];
Color.RGBtoHSB(0, 0, 255, hsbStartColors);
float[] hsbEndColors = new float[3];
Color.RGBtoHSB(255, 0, 0, hsbEndColors);


ChangeablePoint p = new ChangeablePoint(xLB,yLB,zLB,-1);
for(int xx=0; xx&lt;xUB; xx++){
  p.setX(xx);
  for(int yy=0; yy&lt;yUB; yy++){
    p.setY(yy);
    if(threeDimensions){
      for(int zz=0;zz&lt;zUB;zz++){
        p.setZ(zz);
        try{
          value = (float)grid.readAbsCell(current,p).getState();
        }catch(Exception e){}

        float hue = 0f;
        if(hsbStartColors[0] == hsbEndColors[0]){
          hue = hsbStartColors[0];
        }
        else if(hsbStartColors[0]&gt;hsbEndColors[0]){
          hue = ((float)1-value)*((hsbStartColors[0]-hsbEndColors[0])/((float)1-(float)0))+hsbEndColors[0];
        }
        else{
          hue = (value-(float)0)*((hsbEndColors[0]-hsbStartColors[0])/((float)1-(float)0))+hsbStartColors[0];
        }

        float sat = 0f;
        if(hsbStartColors[1] == hsbEndColors[1]){
          sat = hsbStartColors[1];
        }
        else if(hsbStartColors[1] &gt; hsbEndColors[1]){
          sat = ((float)1-value)*((hsbStartColors[1]-hsbEndColors[1])/((float)1-(float)0))+hsbEndColors[1];
        }
        else{
          sat = (value-(float)0)*((hsbEndColors[1]-hsbStartColors[1])/((float)1-(float)0))+hsbStartColors[1];
        }

        float bri = 0f;
        if(hsbStartColors[2] == hsbEndColors[2]){
          bri = hsbStartColors[2];
        }
        else if(hsbStartColors[2] &gt; hsbEndColors[2]){
          bri = ((float)1-value)*((hsbStartColors[2]-hsbEndColors[2])/((float)1-(float)0))+hsbEndColors[2];
        }
        else{
          bri = (value-(float)0)*((hsbEndColors[2]-hsbStartColors[2])/((float)1-(float)0))+hsbStartColors[2];
        }

        Color hsbColor = Color.getHSBColor((float)hue,(float)sat,(float)bri);

        if(value &gt; 1){
          hsbColor = new Color(255,255,255);
        }
        else if(value &lt; 0){
          hsbColor = new Color(0,0,0);
        }

        offScreen.setColor(hsbColor);

        if(zz == zUB-1){
          offScreen.fill3DRect((xUB-xx-1)*blockWidth,(zUB+yy)*blockHeight, blockWidth, blockHeight, true);
        }
        if(xx==0){
          offScreen.fill3DRect((zUB-zz+xUB-1)*blockWidth, (zUB+yy)*blockHeight, blockWidth, blockHeight, true);
        }
        if(zz==0){
          offScreen.fill3DRect((xUB+zUB+xx)*blockWidth, (zUB+yy)*blockHeight, blockWidth, blockHeight, true);
        }
        if(xx == xUB-1){
          offScreen.fill3DRect((xUB+xUB+zUB+zz)*blockWidth, (zUB+yy)*blockHeight, blockWidth, blockHeight, true);
        }
        if(yy == 0){
          offScreen.fill3DRect((xUB+zUB+xx)*blockWidth, (zUB-zz-1)*blockHeight, blockWidth, blockHeight, true);
        }
        if(yy==yUB-1){
          offScreen.fill3DRect((xUB+zUB+xx)*blockWidth, (zUB+yUB+zz)*blockHeight, blockWidth, blockHeight, true);
        }
      }//end z loop
    }//end if(threeDimensions)
    else{
      try{
        value = (float)grid.readAbsCell(current,p).getState();
      }catch(Exception e){}

      float hue = 0f;
      if(hsbStartColors[0] == hsbEndColors[0]){
        hue = hsbStartColors[0];
      }
      else if(hsbStartColors[0]&gt;hsbEndColors[0]){
        hue = ((float)1-value)*((hsbStartColors[0]-hsbEndColors[0])/((float)1-(float)0))+hsbEndColors[0];
      }
    else{
      hue = (value-(float)0)*((hsbEndColors[0]-hsbStartColors[0])/((float)1-(float)0))+hsbStartColors[0];
    }

    float sat = 0f;
      if(hsbStartColors[1] == hsbEndColors[1]){
        sat = hsbStartColors[1];
      }
      else if(hsbStartColors[1] &gt; hsbEndColors[1]){
        sat = ((float)1-value)*((hsbStartColors[1]-hsbEndColors[1])/((float)1-(float)0))+hsbEndColors[1];
      }
      else{
        sat = (value-(float)0)*((hsbEndColors[1]-hsbStartColors[1])/((float)1-(float)0))+hsbStartColors[1];
      }

      float bri = 0f;
      if(hsbStartColors[2] == hsbEndColors[2]){
        bri = hsbStartColors[2];
      }
      else if(hsbStartColors[2] &gt; hsbEndColors[2]){
        bri = ((float)1-value)*((hsbStartColors[2]-hsbEndColors[2])/((float)1-(float)0))+hsbEndColors[2];
      }
      else{
        bri = (value-(float)0)*((hsbEndColors[2]-hsbStartColors[2])/((float)1-(float)0))+hsbStartColors[2];
      }

      Color hsbColor = Color.getHSBColor((float)hue,(float)sat,(float)bri);

      if(value &gt; 1){
        hsbColor = new Color(255,255,255);
      }
      else if(value &lt; 0){
        hsbColor = new Color(0,0,0);
      }

      offScreen.setColor(hsbColor);

      offScreen.fill3DRect(xx*blockWidth,yy*blockHeight, blockWidth, blockHeight, true);
    }//end else
  }//end y loop
}// end x loop
repaint();
</string> 
     </void> 
     <void property="preRecords"> 
      <object class="java.util.Vector"> 
       <void method="add"> 
        <object class="eclpss.component.ESVReadsAndWritesRecord"> 
         <void property="name"> 
          <string>Cell</string> 
         </void> 
         <void property="read"> 
          <boolean>true</boolean> 
         </void> 
        </object> 
       </void> 
      </object> 
     </void> 
     <void property="preSimCode"> 
      <string>    if(offScreen == null) {
      offScreen = image.createGraphics();
    }
int xLB = grid.getXLB();
int yLB = grid.getYLB();
int zLB = grid.getZLB();
int xUB = grid.getXUB();
int yUB = grid.getYUB();
int zUB = grid.getZUB();

    int blockWidth = 0;
    int blockHeight = 0;
    if((2*xUB + 2*zUB) &gt; (2*yUB+2*zUB)){
      blockWidth = frameWidth / ((2*xUB)+(2*zUB));
      blockHeight = blockWidth;
    }
    else{
      blockWidth = frameHeight / ((2*yUB)+(2*zUB));
      blockHeight = blockWidth;
    }
    float temp = (float)0;


    float[] hsbStartColors = new float[3];
    Color.RGBtoHSB(0, 0, 255, hsbStartColors);
    float[] hsbEndColors = new float[3];
    Color.RGBtoHSB(255, 0, 0, hsbEndColors);


    ChangeablePoint p = new ChangeablePoint(xLB,yLB,zLB,0);
    for(int xx=0; xx&lt;xUB; xx++){
      p.setX(xx);
      for(int yy=0; yy&lt;yUB; yy++){
        p.setY(yy);
        for(int zz=0;zz&lt;zUB;zz++){
          p.setZ(zz);
          try{
            temp = (float)grid.readAbsCell(current,p).getState();
          }catch(Exception e){}

          float hue = 0f;
          if(hsbStartColors[0] == hsbEndColors[0]){
            hue = hsbStartColors[0];
          }
          else if(hsbStartColors[0]&gt;hsbEndColors[0]){
            hue = ((float)1-temp)*((hsbStartColors[0]-hsbEndColors[0])/((float)1-(float)0))+hsbEndColors[0];
          }
         else{
            hue = (temp-(float)0)*((hsbEndColors[0]-hsbStartColors[0])/((float)1-(float)0))+hsbStartColors[0];
          }

          float sat = 0f;
          if(hsbStartColors[1] == hsbEndColors[1]){
            sat = hsbStartColors[1];
          }
          else if(hsbStartColors[1] &gt; hsbEndColors[1]){
            sat = ((float)1-temp)*((hsbStartColors[1]-hsbEndColors[1])/((float)1-(float)0))+hsbEndColors[1];
          }
          else{
            sat = (temp-(float)0)*((hsbEndColors[1]-hsbStartColors[1])/((float)1-(float)0))+hsbStartColors[1];
          }

          float bri = 0f;
          if(hsbStartColors[2] == hsbEndColors[2]){
            bri = hsbStartColors[2];
          }
          else if(hsbStartColors[2] &gt; hsbEndColors[2]){
            bri = ((float)1-temp)*((hsbStartColors[2]-hsbEndColors[2])/((float)1-(float)0))+hsbEndColors[2];
          }
          else{
            bri = (temp-(float)0)*((hsbEndColors[2]-hsbStartColors[2])/((float)1-(float)0))+hsbStartColors[2];
          }

          Color hsbColor = Color.getHSBColor((float)hue,(float)sat,(float)bri);

          if(temp &gt; 1){            hsbColor = new Color(255,255,255);          }          else if(temp &lt; 0){            hsbColor = new Color(0,0,0);          }
          offScreen.setColor(hsbColor);

          if(zz == zUB-1){
            offScreen.fill3DRect((xUB-xx-1)*blockWidth,(zUB+yy)*blockHeight, blockWidth, blockHeight, true);
          }
          if(xx==0){
            offScreen.fill3DRect((zUB-zz+xUB-1)*blockWidth, (zUB+yy)*blockHeight, blockWidth, blockHeight, true);
          }
          if(zz==0){
            offScreen.fill3DRect((xUB+zUB+xx)*blockWidth, (zUB+yy)*blockHeight, blockWidth, blockHeight, true);
          }
          if(xx == xUB-1){
            offScreen.fill3DRect((xUB+xUB+zUB+zz)*blockWidth, (zUB+yy)*blockHeight, blockWidth, blockHeight, true);
          }
          if(yy == 0){
            offScreen.fill3DRect((xUB+zUB+xx)*blockWidth, (zUB-zz-1)*blockHeight, blockWidth, blockHeight, true);
          }
          if(yy==yUB-1){
            offScreen.fill3DRect((xUB+zUB+xx)*blockWidth, (zUB+yUB+zz)*blockHeight, blockWidth, blockHeight, true);
          }
        }//end z loop
      }//end y loop
    }// end x loop
    repaint();
</string> 
     </void> 
     <void property="simCode"> 
      <string>int modulo = 1;
boolean threeDimensions = !(grid.getZBoundryType()==ComputationalGrid.NO_Z); 
if( ((model.getTimeIteration()-1) % modulo) == 0 ){int xLB = grid.getXLB();
int yLB = grid.getYLB();
int zLB = grid.getZLB();
int xUB = grid.getXUB();
int yUB = grid.getYUB();
int zUB = grid.getZUB();
    if(offScreen == null) {
      offScreen = image.createGraphics();
    }

    int blockWidth = 0;
    int blockHeight = 0;
    if(threeDimensions){
      if((2*xUB + 2*zUB) &gt; (2*yUB+2*zUB)){
        blockWidth = frameWidth / ((2*xUB)+(2*zUB));
        blockHeight = blockWidth;
      }
      else{
        blockWidth = frameHeight / ((2*yUB)+(2*zUB));
        blockHeight = blockWidth;
      }
    }//end if(threeDimensions){
    else{
      blockWidth = frameWidth / xUB;
      blockHeight = frameHeight/ yUB;
    }
    float value = (float)0;


    float[] hsbStartColors = new float[3];
    Color.RGBtoHSB(0, 0, 255, hsbStartColors);
    float[] hsbEndColors = new float[3];
    Color.RGBtoHSB(255, 0, 0, hsbEndColors);


    ChangeablePoint p = new ChangeablePoint(xLB,yLB,zLB,-1);
    for(int xx=xLB-1; xx&lt;xUB; xx++){
      p.setX(xx);
      for(int yy=yLB-1; yy&lt;yUB; yy++){
        p.setY(yy);
        if(threeDimensions){
          for(int zz=zLB-1;zz&lt;zUB;zz++){
            p.setZ(zz);
            try{
              value = (float)grid.readAbsCell(current,p).getState();
            }catch(Exception e){}

            float hue = 0f;
            if(hsbStartColors[0] == hsbEndColors[0]){
              hue = hsbStartColors[0];
            }
            else if(hsbStartColors[0]&gt;hsbEndColors[0]){
              hue = ((float)1-value)*((hsbStartColors[0]-hsbEndColors[0])/((float)1-(float)0))+hsbEndColors[0];
            }
           else{
              hue = (value-(float)0)*((hsbEndColors[0]-hsbStartColors[0])/((float)1-(float)0))+hsbStartColors[0];
            }

            float sat = 0f;
            if(hsbStartColors[1] == hsbEndColors[1]){
              sat = hsbStartColors[1];
            }
            else if(hsbStartColors[1] &gt; hsbEndColors[1]){
              sat = ((float)1-value)*((hsbStartColors[1]-hsbEndColors[1])/((float)1-(float)0))+hsbEndColors[1];
            }
            else{
              sat = (value-(float)0)*((hsbEndColors[1]-hsbStartColors[1])/((float)1-(float)0))+hsbStartColors[1];
            }

            float bri = 0f;
            if(hsbStartColors[2] == hsbEndColors[2]){
              bri = hsbStartColors[2];
            }
            else if(hsbStartColors[2] &gt; hsbEndColors[2]){
              bri = ((float)1-value)*((hsbStartColors[2]-hsbEndColors[2])/((float)1-(float)0))+hsbEndColors[2];
            }
            else{
              bri = (value-(float)0)*((hsbEndColors[2]-hsbStartColors[2])/((float)1-(float)0))+hsbStartColors[2];
            }

            Color hsbColor = Color.getHSBColor((float)hue,(float)sat,(float)bri);

            if(value &gt; 1){
              hsbColor = new Color(255,255,255);
            }
            else if(value &lt; 0){
              hsbColor = new Color(0,0,0);
            }

            offScreen.setColor(hsbColor);

            if(zz == zUB-1){
              offScreen.fill3DRect((xUB-xx-1)*blockWidth,(zUB+yy)*blockHeight, blockWidth, blockHeight, true);
            }
            if(xx==0){
              offScreen.fill3DRect((zUB-zz+xUB-1)*blockWidth, (zUB+yy)*blockHeight, blockWidth, blockHeight, true);
            }
            if(zz==0){
              offScreen.fill3DRect((xUB+zUB+xx)*blockWidth, (zUB+yy)*blockHeight, blockWidth, blockHeight, true);
            }
            if(xx == xUB-1){
              offScreen.fill3DRect((xUB+xUB+zUB+zz)*blockWidth, (zUB+yy)*blockHeight, blockWidth, blockHeight, true);
            }
            if(yy == 0){
              offScreen.fill3DRect((xUB+zUB+xx)*blockWidth, (zUB-zz-1)*blockHeight, blockWidth, blockHeight, true);
            }
            if(yy==yUB-1){
              offScreen.fill3DRect((xUB+zUB+xx)*blockWidth, (zUB+yUB+zz)*blockHeight, blockWidth, blockHeight, true);
            }
          }//end z loop
        }//end if(threeDimensions)
        else{
          try{
            value = (float)grid.readAbsCell(current,p).getState();
          }catch(Exception e){}

          float hue = 0f;
          if(hsbStartColors[0] == hsbEndColors[0]){
            hue = hsbStartColors[0];
          }
          else if(hsbStartColors[0]&gt;hsbEndColors[0]){
            hue = ((float)1-value)*((hsbStartColors[0]-hsbEndColors[0])/((float)1-(float)0))+hsbEndColors[0];
          }
         else{
            hue = (value-(float)0)*((hsbEndColors[0]-hsbStartColors[0])/((float)1-(float)0))+hsbStartColors[0];
          }

          float sat = 0f;
          if(hsbStartColors[1] == hsbEndColors[1]){
            sat = hsbStartColors[1];
          }
          else if(hsbStartColors[1] &gt; hsbEndColors[1]){
            sat = ((float)1-value)*((hsbStartColors[1]-hsbEndColors[1])/((float)1-(float)0))+hsbEndColors[1];
          }
          else{
            sat = (value-(float)0)*((hsbEndColors[1]-hsbStartColors[1])/((float)1-(float)0))+hsbStartColors[1];
          }

          float bri = 0f;
          if(hsbStartColors[2] == hsbEndColors[2]){
            bri = hsbStartColors[2];
          }
          else if(hsbStartColors[2] &gt; hsbEndColors[2]){
            bri = ((float)1-value)*((hsbStartColors[2]-hsbEndColors[2])/((float)1-(float)0))+hsbEndColors[2];
          }
          else{
            bri = (value-(float)0)*((hsbEndColors[2]-hsbStartColors[2])/((float)1-(float)0))+hsbStartColors[2];
          }

          Color hsbColor = Color.getHSBColor((float)hue,(float)sat,(float)bri);

          if(value &gt; 1){
            hsbColor = new Color(255,255,255);
          }
          else if(value &lt; 0){
            hsbColor = new Color(0,0,0);
          }

          offScreen.setColor(hsbColor);

          offScreen.fill3DRect(xx*blockWidth,yy*blockHeight, blockWidth, blockHeight, true);
        }//end else
      }//end y loop
    }// end x loop
  }
repaint();
</string> 
     </void> 
     <void property="simRecords"> 
      <object class="java.util.Vector"> 
       <void method="add"> 
        <object class="eclpss.component.ESVReadsAndWritesRecord"> 
         <void property="name"> 
          <string>Cell</string> 
         </void> 
         <void property="read"> 
          <boolean>true</boolean> 
         </void> 
        </object> 
       </void> 
      </object> 
     </void> 
     <void property="stateVariable"> 
      <object idref="ESVSpecification0"/> 
     </void> 
    </object> 
   </void> 
  </void> 
  <void property="date"> 
   <object class="java.util.Date"> 
    <long>1042693200000</long> 
   </object> 
  </void> 
  <void property="documentation"> 
   <array class="java.lang.String" length="9"> 
    <void index="0"> 
     <string>ew</string> 
    </void> 
    <void index="1"> 
     <string>1/16/03</string> 
    </void> 
    <void index="2"> 
     <string>10/29/03</string> 
    </void> 
    <void index="3"> 
     <string>v.1</string> 
    </void> 
    <void index="4"> 
     <string>Classic Game of Life implemented in Eclpss.</string> 
    </void> 
    <void index="5"> 
     <string>A simple 100x100 grid.</string> 
    </void> 
    <void index="6"> 
     <string>Time frames is 2.</string> 
    </void> 
    <void index="7"> 
     <string>May set the initial cell population pattern to three different patterns:
CHECKERBOARD,RANDOM,LIVE_BORDER.</string> 
    </void> 
    <void index="8"> 
     <string></string> 
    </void> 
   </array> 
  </void> 
  <void property="eclpssVersion"> 
   <string>version 2.0.b2</string> 
  </void> 
  <void property="endTime"> 
   <int>1000</int> 
  </void> 
  <void property="esvs"> 
   <array class="eclpss.esv.ESVSpecification" length="1"> 
    <void index="0"> 
     <object idref="ESVSpecification0"/> 
    </void> 
   </array> 
  </void> 
  <void property="externalLocation"> 
   <string>/home/wender/public_html/eclpss/DownLoads/GameOfLife.mdl</string> 
  </void> 
  <void property="grid"> 
   <object class="eclpss.grid.GridSpecification"> 
    <void property="author"> 
     <string>ew</string> 
    </void> 
    <void property="comments"> 
     <string>2-D grid 100x100.</string> 
    </void> 
    <void property="date"> 
     <object class="java.util.Date"> 
      <long>1035432000000</long> 
     </object> 
    </void> 
    <void property="eclpssVersion"> 
     <string>version 1.2.b0</string> 
    </void> 
    <void property="externalLocation"> 
     <string>/home/strempel/models/SimpleGrid.grd</string> 
    </void> 
    <void property="name"> 
     <string>SimpleGrid</string> 
    </void> 
    <void property="nrDimensions"> 
     <int>2</int> 
    </void> 
    <void property="nrTimeFrames"> 
     <int>2</int> 
    </void> 
    <void property="staticDeclarations"> 
     <string></string> 
    </void> 
    <void property="timeStamp"> 
     <object class="java.util.Date"> 
      <long>1063825074481</long> 
     </object> 
    </void> 
    <void property="x"> 
     <object class="eclpss.grid.GridDimension"> 
      <void property="boundryType"> 
       <int>4</int> 
      </void> 
      <void property="bufferDepth"> 
       <int>1</int> 
      </void> 
      <void property="cellWidth"> 
       <double>1.0</double> 
      </void> 
      <void property="numberOfCells"> 
       <int>100</int> 
      </void> 
      <void property="unit"> 
       <string>Dimensionless_ONE</string> 
      </void> 
     </object> 
    </void> 
    <void property="y"> 
     <object class="eclpss.grid.GridDimension"> 
      <void property="boundryType"> 
       <int>4</int> 
      </void> 
      <void property="bufferDepth"> 
       <int>1</int> 
      </void> 
      <void property="cellWidth"> 
       <double>1.0</double> 
      </void> 
      <void property="numberOfCells"> 
       <int>100</int> 
      </void> 
      <void property="unit"> 
       <string>Dimensionless_ONE</string> 
      </void> 
     </object> 
    </void> 
   </object> 
  </void> 
  <void property="intBased"> 
   <boolean>true</boolean> 
  </void> 
  <void property="intStep"> 
   <int>1</int> 
  </void> 
  <void property="javadoc"> 
   <string>/**
 *&lt;UL&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Author: &lt;/b&gt;ew&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Date Created: &lt;/b&gt;1/16/03&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Date Saved: &lt;/b&gt;10/29/03&lt;/LI&gt;&lt;BR&gt;&lt;br&gt;
 *&lt;LI&gt;&lt;b&gt;Version: &lt;/b&gt;v.1&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Purpose: &lt;/b&gt;Classic Game of Life implemented in Eclpss.&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Type of Grid: &lt;/b&gt;A simple 100x100 grid.&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Time step, time scale: &lt;/b&gt;Time frames is 2.&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Usage Notes: &lt;/b&gt;May set the initial cell population pattern to three different patterns:
CHECKERBOARD,RANDOM,LIVE_BORDER.&lt;/LI&gt;&lt;BR&gt;
 *&lt;LI&gt;&lt;b&gt;Miscellaneous Notes: &lt;/b&gt;&lt;/LI&gt;&lt;BR&gt;
*/
</string> 
  </void> 
  <void property="name"> 
   <string>GameOfLife</string> 
  </void> 
  <void property="noBounds"> 
   <boolean>true</boolean> 
  </void> 
  <void property="numberOfExecutions"> 
   <int>999</int> 
  </void> 
  <void property="preExecutionGroups"> 
   <void method="add"> 
    <object class="eclpss.component.ExecutionGroup"> 
     <void property="absoluteBounds"> 
      <boolean>true</boolean> 
     </void> 
     <void property="name"> 
      <string>Initialize Cell</string> 
     </void> 
     <void property="sim"> 
      <boolean>false</boolean> 
     </void> 
     <void property="specNames"> 
      <void method="add"> 
       <string>Live</string> 
      </void> 
     </void> 
     <void property="specs"> 
      <void method="add"> 
       <object idref="ComponentSpecification0"/> 
      </void> 
     </void> 
    </object> 
   </void> 
  </void> 
  <void property="simExecutionGroups"> 
   <void method="add"> 
    <object class="eclpss.component.ExecutionGroup"> 
     <void property="memoryModel"> 
      <int>2</int> 
     </void> 
     <void property="name"> 
      <string>Grow the Cell</string> 
     </void> 
     <void property="specNames"> 
      <void method="add"> 
       <string>Live</string> 
      </void> 
     </void> 
     <void property="specs"> 
      <void method="add"> 
       <object idref="ComponentSpecification0"/> 
      </void> 
     </void> 
    </object> 
   </void> 
   <void method="add"> 
    <object class="eclpss.component.ExecutionGroup"> 
     <void property="memoryModel"> 
      <int>2</int> 
     </void> 
     <void property="name"> 
      <string>Display  the Grid</string> 
     </void> 
     <void property="nonspacial"> 
      <boolean>true</boolean> 
     </void> 
     <void property="specNames"> 
      <void method="add"> 
       <string>LifeGrid</string> 
      </void> 
     </void> 
     <void property="specs"> 
      <void method="add"> 
       <object idref="GraphicalComponentSpecification0"/> 
      </void> 
     </void> 
    </object> 
   </void> 
  </void> 
  <void property="startTime"> 
   <int>1</int> 
  </void> 
  <void property="statics"> 
   <void method="add"> 
    <object class="eclpss.model.StaticVariable"> 
     <void property="comments"> 
      <string>Cell initialization style is either Cell.CHECKERBOARD, Cell.LIVE_BORDER or Cell.RANDOM</string> 
     </void> 
     <void property="name"> 
      <string>CellInitializationStyle</string> 
     </void> 
     <void property="string"> 
      <string>
/**
* Cell initialization style is either Cell.CHECKERBOARD, Cell.LIVE_BORDER or Cell.RANDOM
*/
public static int CellInitializationStyle = Cell.LIVE_BORDER;</string> 
     </void> 
     <void property="type"> 
      <string>int</string> 
     </void> 
     <void property="value"> 
      <string>Cell.LIVE_BORDER</string> 
     </void> 
    </object> 
   </void> 
   <void method="add"> 
    <object class="eclpss.model.StaticVariable"> 
     <void property="comments"> 
      <string>We need to set this variable - it is needed for RANDOM initialization style
or the default from Cell (Cell.RANDOM_LIVE_PERCENT) can be used.</string> 
     </void> 
     <void property="name"> 
      <string>CellRandomLivePercent</string> 
     </void> 
     <void property="string"> 
      <string>
/**
* We need to set this variable - it is needed for RANDOM initialization style
* or the default from Cell (Cell.RANDOM_LIVE_PERCENT) can be used.
*/
public static float CellRandomLivePercent = (float) 0.4;</string> 
     </void> 
     <void property="type"> 
      <string>float</string> 
     </void> 
     <void property="value"> 
      <string>(float) 0.4</string> 
     </void> 
    </object> 
   </void> 
  </void> 
  <void property="timeStamp"> 
   <object class="java.util.Date"> 
    <long>1070291361750</long> 
   </object> 
  </void> 
  <void property="timedSim"> 
   <boolean>true</boolean> 
  </void> 
 </object> 
</java> 
